aboutsummaryrefslogtreecommitdiffstats
path: root/sha1_name.c
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2005-10-03 00:36:13 -0700
committerJunio C Hamano <junkio@cox.net>2005-10-03 00:36:13 -0700
commit5a82b4fb3e547c4aa14cd417790b3f925713a422 (patch)
treeaf98bb0616e70e5f1993af62f80c27458e22be8c /sha1_name.c
parent88f8f0a52b2962452d89e854ad751283595473e4 (diff)
downloadgit-5a82b4fb3e547c4aa14cd417790b3f925713a422.tar.gz
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>
Diffstat (limited to 'sha1_name.c')
-rw-r--r--sha1_name.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/sha1_name.c b/sha1_name.c
index 0225f3107e..8920de1c45 100644
--- a/sha1_name.c
+++ b/sha1_name.c
@@ -128,7 +128,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 -1;
+ return error("short SHA1 %.*s is ambiguous.", len, canonical);
memcpy(sha1, packed_sha1, 20);
return 0;
}