@matheusbsbs / matheus-bagliano / commits / 237a28173f
Fork 0

show_one_mergetag: print non-parent in hex form.

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>

Harald van Dijk committed Feb 29, 2020 at 13:07 UTC 237a28173feffc9bdec5aa669aa17fba1ac7c279
2 files changed +21 -1
log-tree.c
+1 -1
@@ -514,7 +514,7 @@ static int show_one_mergetag(struct commit *commit,
514 "merged tag '%s'\n", tag->tag);
515 else if ((nth = which_parent(&tag->tagged->oid, commit)) < 0)
516 strbuf_addf(&verify_message, "tag %s names a non-parent %s\n",
517 - tag->tag, tag->tagged->oid.hash);
517 + tag->tag, oid_to_hex(&tag->tagged->oid));
518 else
519 strbuf_addf(&verify_message,
520 "parent #%d, tagged '%s'\n", nth + 1, tag->tag);
t/t4202-log.sh
+20
@@ -1596,6 +1596,26 @@ test_expect_success GPG 'log --graph --show-signature for merged tag' '
1596 grep "^| | gpg: Good signature" actual
1597 '
1598
1599 +test_expect_success GPG 'log --graph --show-signature for merged tag in shallow clone' '
1600 + test_when_finished "git reset --hard && git checkout master" &&
1601 + git checkout -b plain-shallow master &&
1602 + echo aaa >bar &&
1603 + git add bar &&
1604 + git commit -m bar_commit &&
1605 + git checkout --detach master &&
1606 + echo bbb >baz &&
1607 + git add baz &&
1608 + git commit -m baz_commit &&
1609 + git tag -s -m signed_tag_msg signed_tag_shallow &&
1610 + hash=$(git rev-parse HEAD) &&
1611 + git checkout plain-shallow &&
1612 + git merge --no-ff -m msg signed_tag_shallow &&
1613 + git clone --depth 1 --no-local . shallow &&
1614 + test_when_finished "rm -rf shallow" &&
1615 + git -C shallow log --graph --show-signature -n1 plain-shallow >actual &&
1616 + grep "tag signed_tag_shallow names a non-parent $hash" actual
1617 +'
1618 +
1619 test_expect_success GPGSM 'log --graph --show-signature for merged tag x509' '
1620 test_when_finished "git reset --hard && git checkout master" &&
1621 test_config gpg.format x509 &&