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

[PATCH 3/3] transport-helper: add 'signed-tags' capability

From
John Keeping <john@keeping.me.uk>
Date
Apr 14, 2013, 10:57 UTC
Message-ID
<5a121757b7fb1142e5b0a42a19c45e0431deda3b.1365936811.git.john@keeping.me.uk>
In-Reply-To
<cover.1365936811.git.john@keeping.me.uk>

This allows a remote helper using the 'export' protocol to specify that it supports signed tags, changing the handing from 'warn-strip' to 'verbatim'.

Signed-off-by: John Keeping <john@keeping.me.uk>
---
 Documentation/gitremote-helpers.txt |  4 ++++
 git-remote-testgit                  |  1 +
 t/t5801-remote-helpers.sh           | 12 +++++++++++-
 transport-helper.c                  |  6 +++++-
 4 files changed, 21 insertions(+), 2 deletions(-)
diff --git a/Documentation/gitremote-helpers.txt b/Documentation/gitremote-helpers.txt
index f506031..da74641 100644
--- a/Documentation/gitremote-helpers.txt
+++ b/Documentation/gitremote-helpers.txt
@@ -202,6 +202,10 @@ capability then it should advertise `refspec *:*`.
 	marks specified in <file> before processing any input. For details,
 	read up on '--import-marks=<file>' in linkgit:git-fast-export[1].
 
+'signed-tags'::
+	This modifies the 'export' capability, instructing Git to pass
+	'--signed-tags=verbatim' to linkgit:git-fast-export[1].  In the
+	absence of this capability, Git will use '--signed-tags=warn-strip'.
 
 
 
diff --git a/git-remote-testgit b/git-remote-testgit
index b395c8d..e7ed3a3 100755
--- a/git-remote-testgit
+++ b/git-remote-testgit
@@ -38,6 +38,7 @@ do
 			echo "*import-marks $gitmarks"
 			echo "*export-marks $gitmarks"
 		fi
+		test -n "$GIT_REMOTE_TESTGIT_SIGNED_TAGS" && echo "signed-tags"
 		echo
 		;;
 	list)
diff --git a/t/t5801-remote-helpers.sh b/t/t5801-remote-helpers.sh
index 9b287db..69212cd 100755
--- a/t/t5801-remote-helpers.sh
+++ b/t/t5801-remote-helpers.sh
@@ -173,7 +173,17 @@ test_expect_success GPG 'push signed tag' '
 	git tag -s -m signed-tag signed-tag &&
 	git push origin signed-tag
 	) &&
-	compare_refs local signed-tag^{} server signed-tag^{}
+	compare_refs local signed-tag^{} server signed-tag^{} &&
+	test_must_fail compare_refs local signed-tag server signed-tag
+'
+
+test_expect_success GPG 'push signed tag with signed-tags capability' '
+	(cd local &&
+	git checkout master &&
+	git tag -s -m signed-tag signed-tag-2 &&
+	GIT_REMOTE_TESTGIT_SIGNED_TAGS=1 git push origin signed-tag-2
+	) &&
+	compare_refs local signed-tag-2 server signed-tag-2
 '
 
 test_done
diff --git a/transport-helper.c b/transport-helper.c
index 3ce8259..5f8d075 100644
--- a/transport-helper.c
+++ b/transport-helper.c
@@ -25,6 +25,7 @@ struct helper_data {
 		option : 1,
 		push : 1,
 		connect : 1,
+		signed_tags : 1,
 		no_disconnect_req : 1;
 	char *export_marks;
 	char *import_marks;
@@ -191,6 +192,8 @@ static struct child_process *get_helper(struct transport *transport)
 			refspecs[refspec_nr++] = xstrdup(capname + strlen("refspec "));
 		} else if (!strcmp(capname, "connect")) {
 			data->connect = 1;
+		} else if (!strcmp(capname, "signed-tags")) {
+			data->signed_tags = 1;
 		} else if (!prefixcmp(capname, "export-marks ")) {
 			struct strbuf arg = STRBUF_INIT;
 			strbuf_addstr(&arg, "--export-marks=");
@@ -413,7 +416,8 @@ static int get_exporter(struct transport *transport,
 	fastexport->argv = xcalloc(6 + revlist_args->nr, sizeof(*fastexport->argv));
 	fastexport->argv[argc++] = "fast-export";
 	fastexport->argv[argc++] = "--use-done-feature";
-	fastexport->argv[argc++] = "--signed-tags=warn-strip";
+	fastexport->argv[argc++] = data->signed_tags ?
+		"--signed-tags=verbatim" : "--signed-tags=warn-strip";
 	if (data->export_marks)
 		fastexport->argv[argc++] = data->export_marks;
 	if (data->import_marks)
-- 
1.8.2.694.ga76e9c3.dirty
Previous: John Keeping
Message 14 of 14 in “Remote helpers and signed tags”
  1. John KeepingApr 7, 2013
  2. Jonathan NiederApr 7, 2013
  3. Sverre RabbelierApr 8, 2013
  4. 0/3 Handle signed tags with 'export' remote helpersJohn Keeping, Apr 14, 2013
  5. 1/3 fast-export: add --signed-tags=warn-strip modeJohn Keeping, Apr 14, 2013
  6. Sverre RabbelierApr 16, 2013
  7. Junio C HamanoApr 16, 2013
  8. Sverre RabbelierApr 16, 2013
  9. John KeepingApr 16, 2013
  10. Junio C HamanoApr 17, 2013
  11. Sverre RabbelierApr 17, 2013
  12. Jonathan NiederApr 16, 2013
  13. 2/3 transport-helper: pass --signed-tags=warn-strip to fast-exportJohn Keeping, Apr 14, 2013
  14. 3/3 transport-helper: add 'signed-tags' capabilityJohn Keeping, Apr 14, 2013

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.