Re: [PATCH] check-ref-format --print: Normalize refnames that start with slashes
Michael Haggerty <mhagger@alum.mit.edu> writes:
> And add tests that such refnames are accepted and normalized
> correctly.
Thanks. I think this is a bit simpler, though...
builtin/check-ref-format.c | 4 +---
t/t1402-check-ref-format.sh | 1 -
2 files changed, 1 insertions(+), 4 deletions(-)
diff --git b/builtin/check-ref-format.c a/builtin/check-ref-format.c
index 7118021..0723cf2 100644
--- b/builtin/check-ref-format.c
+++ a/builtin/check-ref-format.c
@@ -21,10 +21,8 @@ static const char builtin_check_ref_format_usage[] =
static void collapse_slashes(char *dst, const char *src)
{
char ch;
- char prev = '\0';
+ char prev = '/';
- while (*src == '/')
- src++;
while ((ch = *src++) != '\0') {
if (prev == '/' && ch == prev)
continue;
diff --git b/t/t1402-check-ref-format.sh a/t/t1402-check-ref-format.sh
index e6fafb2..7563043 100755
--- b/t/t1402-check-ref-format.sh
+++ a/t/t1402-check-ref-format.sh
@@ -31,7 +31,6 @@ valid_ref 'heads/foo@bar'
invalid_ref 'heads/v@{ation'
invalid_ref 'heads/foo\bar'
-
test_expect_success "check-ref-format --branch @{-1}" '
T=$(git write-tree) &&
sha1=$(echo A | git commit-tree $T) &&