diff options
Diffstat (limited to 'sha1_name.c')
-rw-r--r-- | sha1_name.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/sha1_name.c b/sha1_name.c index 01b36ead42..b3a90e6f05 100644 --- a/sha1_name.c +++ b/sha1_name.c @@ -1065,9 +1065,13 @@ int interpret_branch_name(const char *name, struct strbuf *buf) int strbuf_branchname(struct strbuf *sb, const char *name) { int len = strlen(name); - if (interpret_branch_name(name, sb) == len) + int used = interpret_branch_name(name, sb); + + if (used == len) return 0; - strbuf_add(sb, name, len); + if (used < 0) + used = 0; + strbuf_add(sb, name + used, len - used); return len; } |