Skip to content

Commit efc028b

Browse files
committed
Merge branch 'mh/find-uniq-abbrev' into maint
* mh/find-uniq-abbrev: sha1_name: avoid unnecessary sha1 lookup in find_unique_abbrev
2 parents 9ea21fa + 61e704e commit efc028b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

sha1_name.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,10 +372,10 @@ const char *find_unique_abbrev(const unsigned char *sha1, int len)
372372
int status, exists;
373373
static char hex[41];
374374

375-
exists = has_sha1_file(sha1);
376375
memcpy(hex, sha1_to_hex(sha1), 40);
377376
if (len == 40 || !len)
378377
return hex;
378+
exists = has_sha1_file(sha1);
379379
while (len < 40) {
380380
unsigned char sha1_ret[20];
381381
status = get_short_sha1(hex, len, sha1_ret, GET_SHA1_QUIETLY);

0 commit comments

Comments
 (0)