git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Brandon Richardson <brandon1024.br@gmail.com>
To: git@vger.kernel.org
Cc: Brandon Richardson <brandon1024.br@gmail.com>
Subject: [PATCH] commit-tree: add missing --gpg-sign flag
Date: Thu, 17 Jan 2019 21:09:18 -0400	[thread overview]
Message-ID: <20190118010918.43705-1-brandon1024.br@gmail.com> (raw)
In-Reply-To: <y>

Add --gpg-sign option in commit-tree, which was documented, but not
implemented, in 55ca3f99ae.

Signed-off-by: Brandon Richardson <brandon1024.br@gmail.com>
---

Thanks Martin for the tips and suggestions!

 builtin/commit-tree.c    | 8 +++++++-
 t/t7510-signed-commit.sh | 4 +++-
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/builtin/commit-tree.c b/builtin/commit-tree.c
index 9ec36a82b..a51b2c8d7 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")) {
+		    skip_prefix(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..efc136eaf 100755
--- a/t/t7510-signed-commit.sh
+++ b/t/t7510-signed-commit.sh
@@ -51,7 +51,9 @@ 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 must sign.
+	git tag eleventh-signed $(echo 11 | git commit-tree --gpg-sign HEAD^{tree})
 '
 
 test_expect_success GPG 'verify and show signatures' '
-- 
2.20.1


             reply	other threads:[~2019-01-18  1:09 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-18  1:09 Brandon Richardson [this message]
2019-01-18  7:11 ` [PATCH] commit-tree: add missing --gpg-sign flag Martin Ågren
2019-01-18 15:06   ` Brandon Richardson
2019-01-18 21:02 ` Junio C Hamano

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=20190118010918.43705-1-brandon1024.br@gmail.com \
    --to=brandon1024.br@gmail.com \
    --cc=git@vger.kernel.org \
    /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).