Skip to content

Commit 0d957a4

Browse files
johnkeepinggitster
authored andcommitted
transport-helper: add 'signed-tags' capability
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> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent b8bd826 commit 0d957a4

4 files changed

Lines changed: 21 additions & 2 deletions

File tree

Documentation/gitremote-helpers.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,10 @@ capability then it should advertise `refspec *:*`.
202202
marks specified in <file> before processing any input. For details,
203203
read up on '--import-marks=<file>' in linkgit:git-fast-export[1].
204204

205+
'signed-tags'::
206+
This modifies the 'export' capability, instructing Git to pass
207+
'--signed-tags=verbatim' to linkgit:git-fast-export[1]. In the
208+
absence of this capability, Git will use '--signed-tags=warn-strip'.
205209

206210

207211

git-remote-testgit

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ do
3838
echo "*import-marks $gitmarks"
3939
echo "*export-marks $gitmarks"
4040
fi
41+
test -n "$GIT_REMOTE_TESTGIT_SIGNED_TAGS" && echo "signed-tags"
4142
echo
4243
;;
4344
list)

t/t5801-remote-helpers.sh

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,17 @@ test_expect_success GPG 'push signed tag' '
173173
git tag -s -m signed-tag signed-tag &&
174174
git push origin signed-tag
175175
) &&
176-
compare_refs local signed-tag^{} server signed-tag^{}
176+
compare_refs local signed-tag^{} server signed-tag^{} &&
177+
test_must_fail compare_refs local signed-tag server signed-tag
178+
'
179+
180+
test_expect_success GPG 'push signed tag with signed-tags capability' '
181+
(cd local &&
182+
git checkout master &&
183+
git tag -s -m signed-tag signed-tag-2 &&
184+
GIT_REMOTE_TESTGIT_SIGNED_TAGS=1 git push origin signed-tag-2
185+
) &&
186+
compare_refs local signed-tag-2 server signed-tag-2
177187
'
178188

179189
test_done

transport-helper.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ struct helper_data {
2525
option : 1,
2626
push : 1,
2727
connect : 1,
28+
signed_tags : 1,
2829
no_disconnect_req : 1;
2930
char *export_marks;
3031
char *import_marks;
@@ -191,6 +192,8 @@ static struct child_process *get_helper(struct transport *transport)
191192
refspecs[refspec_nr++] = xstrdup(capname + strlen("refspec "));
192193
} else if (!strcmp(capname, "connect")) {
193194
data->connect = 1;
195+
} else if (!strcmp(capname, "signed-tags")) {
196+
data->signed_tags = 1;
194197
} else if (!prefixcmp(capname, "export-marks ")) {
195198
struct strbuf arg = STRBUF_INIT;
196199
strbuf_addstr(&arg, "--export-marks=");
@@ -413,7 +416,8 @@ static int get_exporter(struct transport *transport,
413416
fastexport->argv = xcalloc(6 + revlist_args->nr, sizeof(*fastexport->argv));
414417
fastexport->argv[argc++] = "fast-export";
415418
fastexport->argv[argc++] = "--use-done-feature";
416-
fastexport->argv[argc++] = "--signed-tags=warn-strip";
419+
fastexport->argv[argc++] = data->signed_tags ?
420+
"--signed-tags=verbatim" : "--signed-tags=warn-strip";
417421
if (data->export_marks)
418422
fastexport->argv[argc++] = data->export_marks;
419423
if (data->import_marks)

0 commit comments

Comments
 (0)