diff options
-rw-r--r-- | sha1_name.c | 3 | ||||
-rwxr-xr-x | t/t1512-rev-parse-disambiguation.sh | 6 |
2 files changed, 9 insertions, 0 deletions
diff --git a/sha1_name.c b/sha1_name.c index 0ff83a9985..e7e3a38728 100644 --- a/sha1_name.c +++ b/sha1_name.c @@ -1386,6 +1386,9 @@ static int get_sha1_with_context_1(const char *name, const char *cp; int only_to_die = flags & GET_SHA1_ONLY_TO_DIE; + if (only_to_die) + flags |= GET_SHA1_QUIETLY; + memset(oc, 0, sizeof(*oc)); oc->mode = S_IFINVALID; ret = get_sha1_1(name, namelen, sha1, flags); diff --git a/t/t1512-rev-parse-disambiguation.sh b/t/t1512-rev-parse-disambiguation.sh index e221167cfb..16f970982b 100755 --- a/t/t1512-rev-parse-disambiguation.sh +++ b/t/t1512-rev-parse-disambiguation.sh @@ -291,4 +291,10 @@ test_expect_success 'ambiguous short sha1 ref' ' grep "refname.*${REF}.*ambiguous" err ' +test_expect_success C_LOCALE_OUTPUT 'ambiguity errors are not repeated' ' + test_must_fail git rev-parse 00000 2>stderr && + grep "is ambiguous" stderr >errors && + test_line_count = 1 errors +' + test_done |