mirror of
https://github.com/git/git
synced 2024-10-06 00:29:28 +00:00
Merge branch 'tc/show-ref-exists-fix'
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
This commit is contained in:
commit
cf58f5920d
|
@ -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,
|
if (refs_read_raw_ref(get_main_ref_store(the_repository), ref,
|
||||||
&unused_oid, &unused_referent, &unused_type,
|
&unused_oid, &unused_referent, &unused_type,
|
||||||
&failure_errno)) {
|
&failure_errno)) {
|
||||||
if (failure_errno == ENOENT) {
|
if (failure_errno == ENOENT || failure_errno == EISDIR) {
|
||||||
error(_("reference does not exist"));
|
error(_("reference does not exist"));
|
||||||
ret = 2;
|
ret = 2;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -262,9 +262,9 @@ test_expect_success '--exists with non-commit object' '
|
||||||
|
|
||||||
test_expect_success '--exists with directory fails with generic error' '
|
test_expect_success '--exists with directory fails with generic error' '
|
||||||
cat >expect <<-EOF &&
|
cat >expect <<-EOF &&
|
||||||
error: failed to look up reference: Is a directory
|
error: reference does not exist
|
||||||
EOF
|
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
|
test_cmp expect err
|
||||||
'
|
'
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue