Skip to content

Commit b8bd826

Browse files
johnkeepinggitster
authored andcommitted
transport-helper: pass --signed-tags=warn-strip to fast-export
Currently, attempting to push a signed tag to a remote helper which uses fast-export results in the remote helper failing because the default fast-export action for signed tags is "abort". This is not helpful for users because there is no way to pass additional arguments to fast-export here, either from the remote helper or from the command line. In general, the signature will be invalidated by whatever transformation a remote helper performs on a tag to push it to a repository in a different format so the correct behaviour is to strip the tag. Doing this silently may surprise people, so use "warn-strip" to issue a warning when a signed tag is encountered. Signed-off-by: John Keeping <john@keeping.me.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent cd16c59 commit b8bd826

2 files changed

Lines changed: 12 additions & 1 deletion

File tree

t/t5801-remote-helpers.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
test_description='Test remote-helper import and export commands'
77

88
. ./test-lib.sh
9+
. "$TEST_DIRECTORY"/lib-gpg.sh
910

1011
if ! type "${BASH-bash}" >/dev/null 2>&1; then
1112
skip_all='skipping remote-testgit tests, bash not available'
@@ -166,4 +167,13 @@ test_expect_success 'push ref with existing object' '
166167
compare_refs local dup server dup
167168
'
168169

170+
test_expect_success GPG 'push signed tag' '
171+
(cd local &&
172+
git checkout master &&
173+
git tag -s -m signed-tag signed-tag &&
174+
git push origin signed-tag
175+
) &&
176+
compare_refs local signed-tag^{} server signed-tag^{}
177+
'
178+
169179
test_done

transport-helper.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -410,9 +410,10 @@ static int get_exporter(struct transport *transport,
410410
/* we need to duplicate helper->in because we want to use it after
411411
* fastexport is done with it. */
412412
fastexport->out = dup(helper->in);
413-
fastexport->argv = xcalloc(5 + revlist_args->nr, sizeof(*fastexport->argv));
413+
fastexport->argv = xcalloc(6 + revlist_args->nr, sizeof(*fastexport->argv));
414414
fastexport->argv[argc++] = "fast-export";
415415
fastexport->argv[argc++] = "--use-done-feature";
416+
fastexport->argv[argc++] = "--signed-tags=warn-strip";
416417
if (data->export_marks)
417418
fastexport->argv[argc++] = data->export_marks;
418419
if (data->import_marks)

0 commit comments

Comments
 (0)