Skip to contentSkip to conversation

fixup! builtin rebase: support `--gpg-sign` option

PATCH In review Junio C Hamano 2 participants 3 messages Oct 11, 2018 – Oct 12, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fixup! builtin rebase: support `--gpg-sign` option

From: Johannes Schindelin <[email protected]>
Date: Thu, 27 Sep 2018 14:48:17 +0200

The --gpg-sign option takes an *optional* argument, not a mandatory one.

This was discovered as part of the investigation of
https://github.com/git-for-windows/git/issues/1836.

---

* I am sending this out as I want to mimize the number of non-trivial changes that come into my tree without hitting the list archive.

 builtin/rebase.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
builtin/rebase.c +3 -2
index a28bfbd62f..43bc6f7915 100644
@@ -1030,8 +1030,9 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
 		OPT_BOOL(0, "autosquash", &options.autosquash,
 			 N_("move commits that begin with "
 			    "squash!/fixup! under -i")),
-		OPT_STRING('S', "gpg-sign", &gpg_sign,
-			   N_("gpg-sign?"), N_("GPG-sign commits")),
+		{ OPTION_STRING, 'S', "gpg-sign", &gpg_sign, N_("key-id"),
+			N_("GPG-sign commits"),
+			PARSE_OPT_OPTARG, NULL, (intptr_t) "" },
 		OPT_STRING_LIST(0, "whitespace", &whitespace,
 				N_("whitespace"), N_("passed to 'git apply'")),
 		OPT_SET_INT('C', 0, &opt_c, N_("passed to 'git apply'"),
Signature · 1 line
2.19.1-328-g5a0cc8aca7
#1 lore raw
Quoted 24 lines · Junio C Hamano

From: Johannes Schindelin <[email protected]>
Date: Thu, 27 Sep 2018 14:48:17 +0200

The --gpg-sign option takes an *optional* argument, not a mandatory one.

This was discovered as part of the investigation of
https://github.com/git-for-windows/git/issues/1836.

---

* I am sending this out as I want to mimize the number of non-trivial changes that come into my tree without hitting the list archive.

 builtin/rebase.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
builtin/rebase.c +0 -0
index a28bfbd62f..43bc6f7915 100644

builtin/rebase.c int cmd_rebase(int argc, const char **argv, const char *prefix) · line 1035

Quoted 8 lines
builtin/rebase.c +3 -2
@@ -1030,8 +1030,9 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
 		OPT_BOOL(0, "autosquash", &options.autosquash,
 			 N_("move commits that begin with "
 			    "squash!/fixup! under -i")),
-		OPT_STRING('S', "gpg-sign", &gpg_sign,
-			   N_("gpg-sign?"), N_("GPG-sign commits")),
+		{ OPTION_STRING, 'S', "gpg-sign", &gpg_sign, N_("key-id"),
+			N_("GPG-sign commits"),
+			PARSE_OPT_OPTARG, NULL, (intptr_t) "" },

This allows "--gpg-sign" in addition to "--gpg-sign=ARG" and stores an empty string in place of ARG when accepting the option without arg.

The result in gpg_sign is used by checking if the pointer is non-NULL and formatted with xstrfmt("-S%s", gpg_sign).

The change looks correct; will squash into what has been queued on 'pu'.

Thanks.

Quoted 3 lines
builtin/rebase.c +0 -0
 		OPT_STRING_LIST(0, "whitespace", &whitespace,
 				N_("whitespace"), N_("passed to 'git apply'")),
 		OPT_SET_INT('C', 0, &opt_c, N_("passed to 'git apply'"),
#2 lore raw
In reply to Junio C Hamano

Hi Junio,

Quoted 9 lines · Junio C Hamano

From: Johannes Schindelin <[email protected]>
Date: Thu, 27 Sep 2018 14:48:17 +0200

The --gpg-sign option takes an *optional* argument, not a mandatory one.

This was discovered as part of the investigation of
https://github.com/git-for-windows/git/issues/1836.

Quoted 6 lines

---

* I am sending this out as I want to mimize the number of non-trivial changes that come into my tree without hitting the list archive.

Thanks, *much* appreciated.

Ciao,
Dscho

Quoted 24 lines
 builtin/rebase.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
builtin/rebase.c +3 -2
index a28bfbd62f..43bc6f7915 100644
@@ -1030,8 +1030,9 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
 		OPT_BOOL(0, "autosquash", &options.autosquash,
 			 N_("move commits that begin with "
 			    "squash!/fixup! under -i")),
-		OPT_STRING('S', "gpg-sign", &gpg_sign,
-			   N_("gpg-sign?"), N_("GPG-sign commits")),
+		{ OPTION_STRING, 'S', "gpg-sign", &gpg_sign, N_("key-id"),
+			N_("GPG-sign commits"),
+			PARSE_OPT_OPTARG, NULL, (intptr_t) "" },
 		OPT_STRING_LIST(0, "whitespace", &whitespace,
 				N_("whitespace"), N_("passed to 'git apply'")),
 		OPT_SET_INT('C', 0, &opt_c, N_("passed to 'git apply'"),
Signature · 1 line
2.19.1-328-g5a0cc8aca7