@matheusbsbs / matheus-bagliano / commits / 5a82b4fb3e
Fork 0

Error message from get_sha1() on ambiguous short SHA1.

Unlike cases where "no such object exists", the case where specified prefix is ambiguous would confuse the user if we say "no such commit" or such. Give an extra error message from the uniqueness check if there are more than one objects that match the given prefix. Signed-off-by: Junio C Hamano <junkio@cox.net>

Junio C Hamano committed Oct 3, 2005 at 00:36 UTC 5a82b4fb3e547c4aa14cd417790b3f925713a422
1 file changed +1 -1
sha1_name.c
+1 -1
@@ -128,7 +128,7 @@ static int find_unique_short_object(int len, char *canonical,
128 }
129 /* Both have unique ones -- do they match? */
130 if (memcmp(packed_sha1, unpacked_sha1, 20))
131 - return -1;
131 + return error("short SHA1 %.*s is ambiguous.", len, canonical);
132 memcpy(sha1, packed_sha1, 20);
133 return 0;
134 }