From: "Harald van Dijk via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: Harald van Dijk <harald@gigawatt.nl>,
Harald van Dijk <harald@gigawatt.nl>
Subject: [PATCH] show_one_mergetag: print non-parent in hex form.
Date: Sat, 29 Feb 2020 13:07:57 +0000 [thread overview]
Message-ID: <pull.568.git.1582981677312.gitgitgadget@gmail.com> (raw)
From: Harald van Dijk <harald@gigawatt.nl>
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>
---
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 [harald@gigawatt.nl]
Before, after a shallow clone of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/:
$ git show -s --show-signature
commit a2f0b878c3ca531a1706cb2a8b079cea3b17bafc (grafted, HEAD -> master, origin/master, origin/HEAD)
tag kbuild-fixes-v5.6-2 names a non-parent 꼋<CB>)/<B9><A5>u{^L<8A><B7>u^_A<B0><A1>^D<F8>
No signature
Author: Linus Torvalds <torvalds@linux-foundation.org>
Date: Thu Feb 27 11:26:33 2020 -0800
[...]
After:
$ git show -s --show-signature
commit a2f0b878c3ca531a1706cb2a8b079cea3b17bafc (grafted, HEAD -> master, origin/master, origin/HEAD)
tag kbuild-fixes-v5.6-2 names a non-parent eabc8bcb292fb9a5757b0c8ab7751f41b0a104f8
No signature
Author: Linus Torvalds <torvalds@linux-foundation.org>
Date: Thu Feb 27 11:26:33 2020 -0800
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-568%2Fhvdijk%2Fmergetag-hex-form-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-568/hvdijk/mergetag-hex-form-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/568
log-tree.c | 2 +-
t/t4202-log.sh | 20 ++++++++++++++++++++
2 files changed, 21 insertions(+), 1 deletion(-)
diff --git a/log-tree.c b/log-tree.c
index cae38dcc662..2a2db96d5ec 100644
--- a/log-tree.c
+++ b/log-tree.c
@@ -517,7 +517,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);
diff --git a/t/t4202-log.sh b/t/t4202-log.sh
index 192347a3e1f..20cb436c433 100755
--- a/t/t4202-log.sh
+++ b/t/t4202-log.sh
@@ -1634,6 +1634,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 &&
base-commit: 2d2118b814c11f509e1aa76cb07110f7231668dc
--
gitgitgadget
next reply other threads:[~2020-02-29 13:08 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-29 13:07 Harald van Dijk via GitGitGadget [this message]
2020-03-01 2:01 ` [PATCH] show_one_mergetag: print non-parent in hex form brian m. carlson
2020-03-01 15:59 ` Martin Ågren
2020-03-01 20:25 ` Harald van Dijk
2020-03-02 19:17 ` Martin Ågren
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=pull.568.git.1582981677312.gitgitgadget@gmail.com \
--to=gitgitgadget@gmail.com \
--cc=git@vger.kernel.org \
--cc=harald@gigawatt.nl \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).