git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nicolas Vigier <boklm@mars-attacks.org>
To: git@vger.kernel.org
Cc: Nicolas Vigier <boklm@mars-attacks.org>
Subject: [PATCH 1/8] cherry-pick, revert: add the --gpg-sign option
Date: Sun,  3 Nov 2013 16:54:17 +0100	[thread overview]
Message-ID: <1383494064-5653-2-git-send-email-boklm@mars-attacks.org> (raw)
In-Reply-To: <1383494064-5653-1-git-send-email-boklm@mars-attacks.org>

Signed-off-by: Nicolas Vigier <boklm@mars-attacks.org>
---
 Documentation/git-cherry-pick.txt | 7 ++++++-
 Documentation/git-revert.txt      | 6 +++++-
 builtin/revert.c                  | 2 ++
 sequencer.c                       | 7 +++++++
 sequencer.h                       | 2 ++
 5 files changed, 22 insertions(+), 2 deletions(-)

diff --git a/Documentation/git-cherry-pick.txt b/Documentation/git-cherry-pick.txt
index c205d2363e42..f1e6b2fd6d15 100644
--- a/Documentation/git-cherry-pick.txt
+++ b/Documentation/git-cherry-pick.txt
@@ -8,7 +8,8 @@ git-cherry-pick - Apply the changes introduced by some existing commits
 SYNOPSIS
 --------
 [verse]
-'git cherry-pick' [--edit] [-n] [-m parent-number] [-s] [-x] [--ff] <commit>...
+'git cherry-pick' [--edit] [-n] [-m parent-number] [-s] [-x] [--ff]
+		  [-S[<keyid>]] <commit>...
 'git cherry-pick' --continue
 'git cherry-pick' --quit
 'git cherry-pick' --abort
@@ -100,6 +101,10 @@ effect to your index in a row.
 --signoff::
 	Add Signed-off-by line at the end of the commit message.
 
+-S[<keyid>]::
+--gpg-sign[=<keyid>]::
+	GPG-sign commits.
+
 --ff::
 	If the current HEAD is the same as the parent of the
 	cherry-pick'ed commit, then a fast forward to this commit will
diff --git a/Documentation/git-revert.txt b/Documentation/git-revert.txt
index 2de67a54962b..9eb83f01a451 100644
--- a/Documentation/git-revert.txt
+++ b/Documentation/git-revert.txt
@@ -8,7 +8,7 @@ git-revert - Revert some existing commits
 SYNOPSIS
 --------
 [verse]
-'git revert' [--[no-]edit] [-n] [-m parent-number] [-s] <commit>...
+'git revert' [--[no-]edit] [-n] [-m parent-number] [-s] [-S[<keyid>]] <commit>...
 'git revert' --continue
 'git revert' --quit
 'git revert' --abort
@@ -80,6 +80,10 @@ more details.
 This is useful when reverting more than one commits'
 effect to your index in a row.
 
+-S[<keyid>]::
+--gpg-sign[=<keyid>]::
+	GPG-sign commits.
+
 -s::
 --signoff::
 	Add Signed-off-by line at the end of the commit message.
diff --git a/builtin/revert.c b/builtin/revert.c
index 87659c9fdb74..065d88dd05ea 100644
--- a/builtin/revert.c
+++ b/builtin/revert.c
@@ -89,6 +89,8 @@ static void parse_args(int argc, const char **argv, struct replay_opts *opts)
 		OPT_STRING(0, "strategy", &opts->strategy, N_("strategy"), N_("merge strategy")),
 		OPT_CALLBACK('X', "strategy-option", &opts, N_("option"),
 			N_("option for merge strategy"), option_parse_x),
+		{ OPTION_STRING, 'S', "gpg-sign", &opts->gpg_sign, N_("key id"),
+		  N_("GPG sign commit"), PARSE_OPT_OPTARG, NULL, (intptr_t) "" },
 		OPT_END(),
 		OPT_END(),
 		OPT_END(),
diff --git a/sequencer.c b/sequencer.c
index 06e52b4c83ff..b10a90fe70f6 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -392,11 +392,18 @@ static int run_git_commit(const char *defmsg, struct replay_opts *opts,
 {
 	struct argv_array array;
 	int rc;
+	char *gpg_sign;
 
 	argv_array_init(&array);
 	argv_array_push(&array, "commit");
 	argv_array_push(&array, "-n");
 
+	if (opts->gpg_sign) {
+		gpg_sign = xmalloc(3 + strlen(opts->gpg_sign));
+		sprintf(gpg_sign, "-S%s", opts->gpg_sign);
+		argv_array_push(&array, gpg_sign);
+		free(gpg_sign);
+	}
 	if (opts->signoff)
 		argv_array_push(&array, "-s");
 	if (!opts->edit) {
diff --git a/sequencer.h b/sequencer.h
index 1fc22dcabe13..db43e9cf86dc 100644
--- a/sequencer.h
+++ b/sequencer.h
@@ -37,6 +37,8 @@ struct replay_opts {
 
 	int mainline;
 
+	const char *gpg_sign;
+
 	/* Merge strategy */
 	const char *strategy;
 	const char **xopts;
-- 
1.8.4.2

  reply	other threads:[~2013-11-03 15:55 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-03 15:54 Adding --gpg-sign to cherry-pick, revert, am, rebase Nicolas Vigier
2013-11-03 15:54 ` Nicolas Vigier [this message]
2013-11-03 17:50   ` [PATCH 1/8] cherry-pick, revert: add the --gpg-sign option brian m. carlson
2013-11-03 18:00     ` Nicolas Vigier
2013-11-03 18:46     ` [PATCH] " Nicolas Vigier
2013-11-03 18:48       ` brian m. carlson
2013-11-03 15:54 ` [PATCH 2/8] git-sh-setup.sh: add variable to use the stuck-long mode Nicolas Vigier
2013-11-03 15:54 ` [PATCH 3/8] am: parse options in " Nicolas Vigier
2013-11-03 15:54 ` [PATCH 4/8] am: add the --gpg-sign option Nicolas Vigier
2013-11-03 19:30   ` [PATCH] " Nicolas Vigier
2013-11-03 15:54 ` [PATCH 5/8] rebase: remove useless arguments check Nicolas Vigier
2013-11-03 15:54 ` [PATCH 6/8] rebase: don't try to match -M option Nicolas Vigier
2013-11-03 15:54 ` [PATCH 7/8] rebase: parse options in stuck-long mode Nicolas Vigier
2013-11-03 15:54 ` [PATCH 8/8] rebase: add the --gpg-sign option Nicolas Vigier
2013-12-08 20:40 ` Adding --gpg-sign to cherry-pick, revert, am, rebase brian m. carlson

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=1383494064-5653-2-git-send-email-boklm@mars-attacks.org \
    --to=boklm@mars-attacks.org \
    --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.
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).