Browse Source

find_unique_abbrev() with len=0 should not abbreviate

Signed-off-by: Junio C Hamano <junkio@cox.net>
maint
Junio C Hamano 19 years ago
parent
commit
02c5cba200
  1. 2
      sha1_name.c

2
sha1_name.c

@ -193,7 +193,7 @@ const char *find_unique_abbrev(const unsigned char *sha1, int len)


is_null = !memcmp(sha1, null_sha1, 20); is_null = !memcmp(sha1, null_sha1, 20);
memcpy(hex, sha1_to_hex(sha1), 40); memcpy(hex, sha1_to_hex(sha1), 40);
if (len == 40) if (len == 40 || !len)
return hex; return hex;
while (len < 40) { while (len < 40) {
unsigned char sha1_ret[20]; unsigned char sha1_ret[20];

Loading…
Cancel
Save