summaryrefslogtreecommitdiff
path: root/sha1_name.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2010-12-03 16:10:35 -0800
committerJunio C Hamano <gitster@pobox.com>2010-12-03 16:10:35 -0800
commit63ae595c6d60ac238e8a785bd811db41de74e93d (patch)
tree06a8969c011b95bea88ee34ccae75b1c5ff6dda0 /sha1_name.c
parent5e738ae820ec53c45895b029baa3a1f63e654b1b (diff)
parent72a5b561fc1c4286bc7c5b0693afc076af261e1f (diff)
downloadgit-63ae595c6d60ac238e8a785bd811db41de74e93d.tar.gz
Merge branch 'jc/abbrev-guard'
* jc/abbrev-guard: core.abbrevguard: Ensure short object names stay unique a bit longer
Diffstat (limited to 'sha1_name.c')
-rw-r--r--sha1_name.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/sha1_name.c b/sha1_name.c
index 3e856b8036..b48b91c507 100644
--- a/sha1_name.c
+++ b/sha1_name.c
@@ -206,7 +206,9 @@ const char *find_unique_abbrev(const unsigned char *sha1, int len)
if (exists
? !status
: status == SHORT_NAME_NOT_FOUND) {
- hex[len] = 0;
+ int cut_at = len + unique_abbrev_extra_length;
+ cut_at = (cut_at < 40) ? cut_at : 40;
+ hex[cut_at] = 0;
return hex;
}
len++;