Code

gitweb: Add git_get_rev_name_tags function
[git.git] / sha1_name.c
index 5fe8e5d4bf25d79c3fa76610d1617ee07c1f1e2c..f567454d22ada41b1565f26e7136e62b70769dfa 100644 (file)
@@ -191,9 +191,9 @@ const char *find_unique_abbrev(const unsigned char *sha1, int len)
        int status, is_null;
        static char hex[41];
 
-       is_null = !memcmp(sha1, null_sha1, 20);
+       is_null = is_null_sha1(sha1);
        memcpy(hex, sha1_to_hex(sha1), 40);
-       if (len == 40)
+       if (len == 40 || !len)
                return hex;
        while (len < 40) {
                unsigned char sha1_ret[20];