summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2014-12-22 20:26:57 (GMT)
committerJunio C Hamano <gitster@pobox.com>2014-12-22 20:26:58 (GMT)
commit5109f2aaabcd7ce2c493bb663417c2dd4d5b81fe (patch)
tree7178b9d85944107b4aacc594682cfdf5c5f81f94
parent2374f1dfd12542d171b60065dc139a96cb0efe29 (diff)
parent61e704e38a4c3e181403a766c5cf28814e4102e4 (diff)
downloadgit-5109f2aaabcd7ce2c493bb663417c2dd4d5b81fe.zip
git-5109f2aaabcd7ce2c493bb663417c2dd4d5b81fe.tar.gz
git-5109f2aaabcd7ce2c493bb663417c2dd4d5b81fe.tar.bz2
Merge branch 'mh/find-uniq-abbrev'
The code to abbreviate an object name to its short unique prefix has been optimized when no abbreviation was requested. * mh/find-uniq-abbrev: sha1_name: avoid unnecessary sha1 lookup in find_unique_abbrev
-rw-r--r--sha1_name.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/sha1_name.c b/sha1_name.c
index 5b004f5..cb88170 100644
--- a/sha1_name.c
+++ b/sha1_name.c
@@ -372,10 +372,10 @@ const char *find_unique_abbrev(const unsigned char *sha1, int len)
int status, exists;
static char hex[41];
- exists = has_sha1_file(sha1);
memcpy(hex, sha1_to_hex(sha1), 40);
if (len == 40 || !len)
return hex;
+ exists = has_sha1_file(sha1);
while (len < 40) {
unsigned char sha1_ret[20];
status = get_short_sha1(hex, len, sha1_ret, GET_SHA1_QUIETLY);