git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[RFC PATCH 1/2] crypto sign: add crypto-sign alias flag

From
Fabian Stelzer <fs@gigacodes.de>
Date
Dec 20, 2021, 14:09 UTC
Message-ID
<20211220140928.1205586-2-fs@gigacodes.de>
In-Reply-To
<20211220140928.1205586-1-fs@gigacodes.de>

Multiple commands allow passing `--gpg-sign` or `--no-gpg-sign` to enable or disable object signing. Since git can now use other methods for signing this flag could suggest that it selects `gpg` as the method to use, which it does not. Since just `--sign` would conflict with `--signoff` too easily we choose `--crypto-sign` as a more general name.

Add the new flag to all affected commands as an alias to gpg-sign. Move the `-S` shorthand to the new flag to indicate that this is the recommended one to use. Update the documentation to match.

This affects the commands: am, commit-tree, commit, merge, rebase and
revert.
---
 Documentation/git-commit.txt | 15 ++++++++++-----
 builtin/commit.c             |  5 ++++-
 2 files changed, 14 insertions(+), 6 deletions(-)
diff --git a/Documentation/git-commit.txt b/Documentation/git-commit.txt
index 6c60bf98f9..b2c1d8bdb9 100644
--- a/Documentation/git-commit.txt
+++ b/Documentation/git-commit.txt
@@ -387,13 +387,18 @@ changes to tracked files.
 	default commit message.
 
 -S[<keyid>]::
+--crypto-sign[=<keyid>]::
+--no-crypto-sign::
 --gpg-sign[=<keyid>]::
 --no-gpg-sign::
-	GPG-sign commits. The `keyid` argument is optional and
-	defaults to the committer identity; if specified, it must be
-	stuck to the option without a space. `--no-gpg-sign` is useful to
-	countermand both `commit.gpgSign` configuration variable, and
-	earlier `--gpg-sign`.
+	Cryptographically sign commits. The `keyid` argument is optional and
+	its default depends on the configured `cryptoSign.format`; if specified,
+	it must be stuck to the option without a space. `--no-crypto-sign` is
+	useful to countermand both `commit.gpgSign` configuration variable, and
+	earlier `--crypto-sign`.
+	`--(no-)gpg-sign` is a compatibility alias and has no effect on which
+	cryptographic format will be used. This is determined by the
+	configuration variable cryptoSign.format (see linkgit:git-config[1]).
 
 \--::
 	Do not interpret any more arguments as options.
diff --git a/builtin/commit.c b/builtin/commit.c
index 883c16256c..2c789ff6f9 100644
--- a/builtin/commit.c
+++ b/builtin/commit.c
@@ -1639,8 +1639,11 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
 		OPT_BOOL('e', "edit", &edit_flag, N_("force edit of commit")),
 		OPT_CLEANUP(&cleanup_arg),
 		OPT_BOOL(0, "status", &include_status, N_("include status in commit message template")),
-		{ OPTION_STRING, 'S', "gpg-sign", &sign_commit, N_("key-id"),
+		{ OPTION_STRING, 'S', "crypto-sign", &sign_commit, N_("key-id"),
+		  N_("cryptographically sign commit"), PARSE_OPT_OPTARG, NULL, (intptr_t) "" },
+		{ OPTION_STRING, 0, "gpg-sign", &sign_commit, N_("key-id"),
 		  N_("GPG sign commit"), PARSE_OPT_OPTARG, NULL, (intptr_t) "" },
+
 		/* end commit message options */
 
 		OPT_GROUP(N_("Commit contents options")),
-- 
2.33.1
Previous: Fabian StelzerNext: Junio C Hamano
Message 2 of 7 in “cryptoSign flag & config”
  1. 0/2 cryptoSign flag & configFabian Stelzer, Dec 20, 2021
  2. 1/2 crypto sign: add crypto-sign alias flagFabian Stelzer, Dec 20, 2021
  3. Junio C HamanoDec 20, 2021
  4. Fabian StelzerDec 21, 2021
  5. 2/2 crypto sign: add cryptoSign.* configFabian Stelzer, Dec 20, 2021
  6. Eric SunshineDec 20, 2021
  7. Fabian StelzerDec 21, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.