1. Stefan Saasen
  2. git

Commits

Junio C Hamano  committed 5a82b4f

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>

  • Participants
  • Parent commits 88f8f0a
  • Branches master

Comments (0)

Files changed (1)

File sha1_name.c

View file
  • Ignore whitespace
 	}
 	/* 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;
 }