Skip to content

Commit

Permalink
Error message from get_sha1() on ambiguous short SHA1.
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Junio C Hamano committed Oct 3, 2005
1 parent 88f8f0a commit 5a82b4f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion sha1_name.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 5a82b4f

Please sign in to comment.