]> git.ipfire.org Git - thirdparty/git.git/commitdiff
show_one_mergetag: print non-parent in hex form.
authorHarald van Dijk <harald@gigawatt.nl>
Sat, 29 Feb 2020 13:07:57 +0000 (13:07 +0000)
committerJunio C Hamano <gitster@pobox.com>
Mon, 2 Mar 2020 20:34:00 +0000 (12:34 -0800)
When a mergetag names a non-parent, which can occur after a shallow
clone, its hash was previously printed as raw data. Print it in hex form
instead.

Signed-off-by: Harald van Dijk <harald@gigawatt.nl>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
log-tree.c
t/t4202-log.sh

index 1e56df62a79c0d221fa55ba351b6b16f8027d12b..f02343a4611087e2583f47b927f001e30d0d3435 100644 (file)
@@ -514,7 +514,7 @@ static int show_one_mergetag(struct commit *commit,
                            "merged tag '%s'\n", tag->tag);
        else if ((nth = which_parent(&tag->tagged->oid, commit)) < 0)
                strbuf_addf(&verify_message, "tag %s names a non-parent %s\n",
-                                   tag->tag, tag->tagged->oid.hash);
+                                   tag->tag, oid_to_hex(&tag->tagged->oid));
        else
                strbuf_addf(&verify_message,
                            "parent #%d, tagged '%s'\n", nth + 1, tag->tag);
index 819c24d10eaa3cb4a58b72ae8a8e96151b5cabe9..eecac1801b7f9a892a7ab3823f7eeea52d0e9451 100755 (executable)
@@ -1596,6 +1596,26 @@ test_expect_success GPG 'log --graph --show-signature for merged tag' '
        grep "^| | gpg: Good signature" actual
 '
 
+test_expect_success GPG 'log --graph --show-signature for merged tag in shallow clone' '
+       test_when_finished "git reset --hard && git checkout master" &&
+       git checkout -b plain-shallow master &&
+       echo aaa >bar &&
+       git add bar &&
+       git commit -m bar_commit &&
+       git checkout --detach master &&
+       echo bbb >baz &&
+       git add baz &&
+       git commit -m baz_commit &&
+       git tag -s -m signed_tag_msg signed_tag_shallow &&
+       hash=$(git rev-parse HEAD) &&
+       git checkout plain-shallow &&
+       git merge --no-ff -m msg signed_tag_shallow &&
+       git clone --depth 1 --no-local . shallow &&
+       test_when_finished "rm -rf shallow" &&
+       git -C shallow log --graph --show-signature -n1 plain-shallow >actual &&
+       grep "tag signed_tag_shallow names a non-parent $hash" actual
+'
+
 test_expect_success GPGSM 'log --graph --show-signature for merged tag x509' '
        test_when_finished "git reset --hard && git checkout master" &&
        test_config gpg.format x509 &&