Make GIT-VERSION-GEN tolerate missing git describe command again
[git.git] / sha1_name.c
index 67b69a5..e18a96d 100644 (file)
@@ -143,7 +143,7 @@ static int find_unique_short_object(int len, char *canonical,
        }
        /* Both have unique ones -- do they match? */
        if (memcmp(packed_sha1, unpacked_sha1, 20))
-               return -2;
+               return SHORT_NAME_AMBIGUOUS;
        memcpy(sha1, packed_sha1, 20);
        return 0;
 }
@@ -188,7 +188,10 @@ const char *find_unique_abbrev(const unsigned char *sha1, int len)
 {
        int status;
        static char hex[41];
+
        memcpy(hex, sha1_to_hex(sha1), 40);
+       if (len == 40)
+               return hex;
        while (len < 40) {
                unsigned char sha1_ret[20];
                status = get_short_sha1(hex, len, sha1_ret, 1);