Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2024-01-24 00:40:39 +0300
committerJunio C Hamano <gitster@pobox.com>2024-01-24 00:40:39 +0300
commited33fc92cd13b7d13c9fabea92f190b399b41d8b (patch)
tree6549e7be086d974fd42aa5284af33be0024cb5ca
parent74fc9110b5bf7ea0d06d5b4fe91269efcd95e3b9 (diff)
parent0aabeaa562fa269834f10cbda6e966b553dcec71 (diff)
Merge branch 'tc/show-ref-exists-fix' into jch
Update to a new feature recently added, "git show-ref --exists". * tc/show-ref-exists-fix: builtin/show-ref: treat directory as non-existing in --exists
-rw-r--r--builtin/show-ref.c2
-rwxr-xr-xt/t1403-show-ref.sh4
2 files changed, 3 insertions, 3 deletions
diff --git a/builtin/show-ref.c b/builtin/show-ref.c
index aaa2c39b2f..79955c2856 100644
--- a/builtin/show-ref.c
+++ b/builtin/show-ref.c
@@ -238,7 +238,7 @@ static int cmd_show_ref__exists(const char **refs)
if (refs_read_raw_ref(get_main_ref_store(the_repository), ref,
&unused_oid, &unused_referent, &unused_type,
&failure_errno)) {
- if (failure_errno == ENOENT) {
+ if (failure_errno == ENOENT || failure_errno == EISDIR) {
error(_("reference does not exist"));
ret = 2;
} else {
diff --git a/t/t1403-show-ref.sh b/t/t1403-show-ref.sh
index ec1957b709..d0a8f7b121 100755
--- a/t/t1403-show-ref.sh
+++ b/t/t1403-show-ref.sh
@@ -262,9 +262,9 @@ test_expect_success '--exists with non-commit object' '
test_expect_success '--exists with directory fails with generic error' '
cat >expect <<-EOF &&
- error: failed to look up reference: Is a directory
+ error: reference does not exist
EOF
- test_expect_code 1 git show-ref --exists refs/heads 2>err &&
+ test_expect_code 2 git show-ref --exists refs/heads 2>err &&
test_cmp expect err
'