Use the same output machinery when --verify is absent or present, which allows tag dereferencing (-d) to work with --verify. This is useful when the user wishes to avoid the costly iteration of refs. Signed-off-by: Vladimir Panteleev <git@xxxxxxxxxxxxxxxxxx> --- builtin/show-ref.c | 3 +-- t/t1403-show-ref.sh | 9 +++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/builtin/show-ref.c b/builtin/show-ref.c index 945a483e3..bcdc1a95e 100644 --- a/builtin/show-ref.c +++ b/builtin/show-ref.c @@ -205,8 +205,7 @@ int cmd_show_ref(int argc, const char **argv, const char *prefix) if ((starts_with(*pattern, "refs/") || (show_head && !strcmp(*pattern, "HEAD"))) && !read_ref(*pattern, oid.hash)) { - if (!quiet) - show_one(*pattern, &oid); + show_ref(*pattern, &oid, 0, NULL); } else if (!quiet) die("'%s' - not a valid ref", *pattern); diff --git a/t/t1403-show-ref.sh b/t/t1403-show-ref.sh index 2fb5dc879..5c540e67f 100755 --- a/t/t1403-show-ref.sh +++ b/t/t1403-show-ref.sh @@ -97,6 +97,9 @@ test_expect_success 'show-ref -d' ' git show-ref -d refs/tags/A refs/tags/C >actual && test_cmp expect actual && + git show-ref --verify -d refs/tags/A refs/tags/C >actual && + test_cmp expect actual && + echo $(git rev-parse refs/heads/master) refs/heads/master >expect && git show-ref -d master >actual && test_cmp expect actual && @@ -116,6 +119,12 @@ test_expect_success 'show-ref -d' ' test_cmp expect actual && test_must_fail git show-ref -d --verify heads/master >actual && + test_cmp expect actual && + + test_must_fail git show-ref --verify -d A C >actual && + test_cmp expect actual && + + test_must_fail git show-ref --verify -d tags/A tags/C >actual && test_cmp expect actual ' -- 2.11.0