diff options
author | Carlos Martín Nieto <cmn@dwim.me> | 2013-01-31 23:23:30 +0400 |
---|---|---|
committer | Carlos Martín Nieto <cmn@dwim.me> | 2013-01-31 23:23:30 +0400 |
commit | e5ef0f18141409fc932d2c9cc0a42b769a880927 (patch) | |
tree | eef7f0e6b005913543a88be1c6db60a449197069 /src/refs.c | |
parent | 5f9f69d983d7ebc2d9d29cf295e86f32ab12906d (diff) |
refs: handle ALLOW_ONELEVEL normalization with leading slash
A leading slash confuses the name normalization code when the flags
include ALLOW_ONELEVEL. Catch this case in particular to avoid
triggering an assertion in the uppercase check which expects us not to
pass it an empty string.
The existing tests don't catch this as they simply use the NORMAL
flag.
This fixes #1300.
Diffstat (limited to 'src/refs.c')
-rw-r--r-- | src/refs.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/refs.c b/src/refs.c index 52e0adac6..e75f51001 100644 --- a/src/refs.c +++ b/src/refs.c @@ -1691,6 +1691,11 @@ int git_reference__normalize_name( segments_count++; } + /* This means that there's a leading slash in the refname */ + if (segment_len == 0 && segments_count == 0) { + goto cleanup; + } + if (current[segment_len] == '\0') break; |