From: Brandon Richardson <brandon1024.br@gmail.com>
To: git@vger.kernel.org, martin.agren@gmail.com, gitster@pobox.com
Cc: Brandon Richardson <brandon1024.br@gmail.com>
Subject: [PATCH v3] commit-tree: add missing --gpg-sign flag
Date: Fri, 18 Jan 2019 23:35:30 -0400 [thread overview]
Message-ID: <20190119033530.4241-1-brandon1024.br@gmail.com> (raw)
Add --gpg-sign option in commit-tree, which was documented, but not
implemented, in 55ca3f99ae. Add tests for the --gpg-sign option.
Signed-off-by: Brandon Richardson <brandon1024.br@gmail.com>
---
Hi all,
Third and (hopefully) final version. Thanks again Martin for the helpful
comments.
---
builtin/commit-tree.c | 8 +++++++-
t/t7510-signed-commit.sh | 13 +++++++++++--
2 files changed, 18 insertions(+), 3 deletions(-)
diff --git a/builtin/commit-tree.c b/builtin/commit-tree.c
index 9ec36a82b..298e499ac 100644
--- a/builtin/commit-tree.c
+++ b/builtin/commit-tree.c
@@ -66,7 +66,13 @@ int cmd_commit_tree(int argc, const char **argv, const char *prefix)
continue;
}
- if (skip_prefix(arg, "-S", &sign_commit))
+ if(!strcmp(arg, "--gpg-sign")) {
+ sign_commit = "";
+ continue;
+ }
+
+ if (skip_prefix(arg, "-S", &sign_commit) ||
+ skip_prefix(arg, "--gpg-sign=", &sign_commit))
continue;
if (!strcmp(arg, "--no-gpg-sign")) {
diff --git a/t/t7510-signed-commit.sh b/t/t7510-signed-commit.sh
index 86d3f93fa..095d4b254 100755
--- a/t/t7510-signed-commit.sh
+++ b/t/t7510-signed-commit.sh
@@ -51,13 +51,22 @@ test_expect_success GPG 'create signed commits' '
# commit.gpgsign is still on but this must not be signed
git tag ninth-unsigned $(echo 9 | git commit-tree HEAD^{tree}) &&
# explicit -S of course must sign.
- git tag tenth-signed $(echo 9 | git commit-tree -S HEAD^{tree})
+ git tag tenth-signed $(echo 10 | git commit-tree -S HEAD^{tree}) &&
+
+ # --gpg-sign[=<key-id>] must sign.
+ echo 11 >file && test_tick && git commit -S -a -m "eleventh signed" &&
+ git tag eleventh-signed &&
+ git commit-tree --gpg-sign -m "twelfth signed" HEAD^{tree} &&
+ git tag twelfth-signed &&
+ git commit-tree --gpg-sign=B7227189 -m "thirteenth signed" HEAD^{tree} &&
+ git tag thirteenth-signed
'
test_expect_success GPG 'verify and show signatures' '
(
for commit in initial second merge fourth-signed \
- fifth-signed sixth-signed seventh-signed tenth-signed
+ fifth-signed sixth-signed seventh-signed tenth-signed \
+ eleventh-signed twelfth-signed thirteenth-signed
do
git verify-commit $commit &&
git show --pretty=short --show-signature $commit >actual &&
--
2.20.1
next reply other threads:[~2019-01-19 3:36 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-19 3:35 Brandon Richardson [this message]
2019-01-19 15:45 ` [PATCH v3] commit-tree: add missing --gpg-sign flag Martin Ågren
2019-01-19 16:48 ` Martin Ågren
2019-01-19 18:05 ` Brandon Richardson
2019-01-19 21:18 ` Martin Ågren
2019-01-19 23:18 ` Brandon Richardson
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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190119033530.4241-1-brandon1024.br@gmail.com \
--to=brandon1024.br@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=martin.agren@gmail.com \
/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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).