summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2011-09-23 14:20:51 -0700
committerJunio C Hamano <gitster@pobox.com>2011-09-23 14:20:51 -0700
commitbe5acb3b63af077db05788235a1d845d511e4561 (patch)
tree8ba71ba5b17a2827924ce93bf67bc02664c4d674 /builtin
parent503359f13abc251ecbcd6a135918efbc58a4e6f6 (diff)
parentf3738c1ce9193a4bf45ba1a3ea67d0cf32da0257 (diff)
downloadgit-be5acb3b63af077db05788235a1d845d511e4561.tar.gz
Merge branch 'mh/check-ref-format-print-normalize' into maint
* mh/check-ref-format-print-normalize: Forbid DEL characters in reference names check-ref-format --print: Normalize refnames that start with slashes
Diffstat (limited to 'builtin')
-rw-r--r--builtin/check-ref-format.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/builtin/check-ref-format.c b/builtin/check-ref-format.c
index ae3f28115a..0723cf245e 100644
--- a/builtin/check-ref-format.c
+++ b/builtin/check-ref-format.c
@@ -12,8 +12,8 @@ static const char builtin_check_ref_format_usage[] =
" or: git check-ref-format --branch <branchname-shorthand>";
/*
- * Replace each run of adjacent slashes in src with a single slash,
- * and write the result to dst.
+ * Remove leading slashes and replace each run of adjacent slashes in
+ * src with a single slash, and write the result to dst.
*
* This function is similar to normalize_path_copy(), but stripped down
* to meet check_ref_format's simpler needs.
@@ -21,7 +21,7 @@ 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 ((ch = *src++) != '\0') {
if (prev == '/' && ch == prev)