Re: [PATCH v2 1/9] cherry-pick, revert: add the --gpg-sign option

2014-01-24 Thread Junio C Hamano
brian m. carlson sand...@crustytoothpaste.net writes:

 +-S[keyid]::
 +--gpg-sign[=keyid]::
 + GPG-sign commits.
 +

Does this accept --no-gpg-sign?  If not, shouldn't it?

 diff --git a/sequencer.c b/sequencer.c
 index 90cac7b..bde5f04 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);
 + }

Here you would need to invent a new way to propagate --no-gpg-sign
to subsequent invocations, I think.



--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 1/9] cherry-pick, revert: add the --gpg-sign option

2014-01-24 Thread brian m. carlson
On Fri, Jan 24, 2014 at 01:00:06PM -0800, Junio C Hamano wrote:
 brian m. carlson sand...@crustytoothpaste.net writes:
 
  +-S[keyid]::
  +--gpg-sign[=keyid]::
  +   GPG-sign commits.
  +
 
 Does this accept --no-gpg-sign?  If not, shouldn't it?

It does not.  I took Nicolas's patches from the list and applied them to
master, so nothing from next is there, including the commit.gpgsign
stuff.

Would you prefer I rebased them on next instead?

  diff --git a/sequencer.c b/sequencer.c
  index 90cac7b..bde5f04 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);
  +   }
 
 Here you would need to invent a new way to propagate --no-gpg-sign
 to subsequent invocations, I think.

Probably.  It wouldn't be too terribly difficult.

-- 
brian m. carlson / brian with sandals: Houston, Texas, US
+1 832 623 2791 | http://www.crustytoothpaste.net/~bmc | My opinion only
OpenPGP: RSA v4 4096b: 88AC E9B2 9196 305B A994 7552 F1BA 225C 0223 B187


signature.asc
Description: Digital signature


Re: [PATCH v2 1/9] cherry-pick, revert: add the --gpg-sign option

2014-01-24 Thread Junio C Hamano
brian m. carlson sand...@crustytoothpaste.net writes:

 On Fri, Jan 24, 2014 at 01:00:06PM -0800, Junio C Hamano wrote:
 brian m. carlson sand...@crustytoothpaste.net writes:
 
  +-S[keyid]::
  +--gpg-sign[=keyid]::
  +  GPG-sign commits.
  +
 
 Does this accept --no-gpg-sign?  If not, shouldn't it?

 It does not.  I took Nicolas's patches from the list and applied them to
 master, so nothing from next is there, including the commit.gpgsign
 stuff.

 Would you prefer I rebased them on next instead?

Not really.

It is debatable if it should mean that the user wants to sign
commits that are created by running other commands like am and
stash when he sets commit.gpgsign to true, but even if the answer
to that question were true, the configuration must be overridable
with e.g. git stash --no-gpg-sign, explicitly from the command
line.  Until that happens, the series with 2af2ef3c (Add the
commit.gpgsign option to sign all commits, 2013-11-05) cannot be
merged to 'master'.

A series that lets you specify positives from the command line
without any sticky configuration variable, i.e. these patches, do
not have to wait for that to happen.  So this series should come
first and then the commit.gpgsign ones can be rebased on top of
this series, I would think.

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 1/9] cherry-pick, revert: add the --gpg-sign option

2014-01-23 Thread brian m. carlson
From: Nicolas Vigier bo...@mars-attacks.org

Signed-off-by: Nicolas Vigier bo...@mars-attacks.org
Signed-off-by: brian m. carlson sand...@crustytoothpaste.net
---
 Documentation/git-cherry-pick.txt |  7 ++-
 Documentation/git-revert.txt  |  6 +-
 builtin/revert.c  |  2 ++
 sequencer.c   | 11 +++
 sequencer.h   |  2 ++
 5 files changed, 26 insertions(+), 2 deletions(-)

diff --git a/Documentation/git-cherry-pick.txt 
b/Documentation/git-cherry-pick.txt
index c205d23..f1e6b2f 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 2de67a5..9eb83f0 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 87659c9..065d88d 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 90cac7b..bde5f04 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) {
@@ -808,6 +815,8 @@ static int populate_opts_cb(const char *key, const char 
*value, void *data)
opts-mainline = git_config_int(key, value);
else if (!strcmp(key, options.strategy))
git_config_string(opts-strategy, key, value);
+   else if (!strcmp(key, options.gpg-sign))
+   git_config_string(opts-gpg_sign, key, value);
else if (!strcmp(key, options.strategy-option)) {
ALLOC_GROW(opts-xopts, opts-xopts_nr + 1, opts-xopts_alloc);
opts-xopts[opts-xopts_nr++] = xstrdup(value);
@@ -981,6 +990,8 @@ static void save_opts(struct replay_opts *opts)
}
if (opts-strategy)
git_config_set_in_file(opts_file, options.strategy, 
opts-strategy);
+   if (opts-gpg_sign)
+   git_config_set_in_file(opts_file, options.gpg-sign, 
opts-gpg_sign);
if (opts-xopts) {
int i;
for (i = 0; i  opts-xopts_nr; i++)
diff --git a/sequencer.h b/sequencer.h
index 1fc22dc..db43e9c 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.9.rc0.1002.gd081c64.dirty

--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at