]> git.ipfire.org Git - thirdparty/git.git/blobdiff - sha1_name.c
sha1_name: avoid unnecessary sha1 lookup in find_unique_abbrev
[thirdparty/git.git] / sha1_name.c
index 65ad066d9bb4efd9b61142b40d790bac9543de1d..e98d0304683aa82c467714e62f2ccd24ca788d9d 100644 (file)
@@ -373,10 +373,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);