transport-helper: add 'signed-tags' capability
authorJohn Keeping <john@keeping.me.uk>
Sun, 14 Apr 2013 10:57:08 +0000 (11:57 +0100)
committerJunio C Hamano <gitster@pobox.com>
Mon, 15 Apr 2013 16:04:43 +0000 (09:04 -0700)
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>
Documentation/gitremote-helpers.txt
git-remote-testgit
t/t5801-remote-helpers.sh
transport-helper.c
index f506031ae49070e216e71914d8ef241da58430e1..da746419b355a4b5d49b23ed51e3d4aa89d8c2c1 100644 (file)
@@ -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'.
 
 
 
index b395c8de59c33768f1a957248447d162bda8ef94..e7ed3a33e6d7180e65f06a882342fa2d7efb4d03 100755 (executable)
@@ -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)
index 9b287db650ae8042d7da3be2331a95e94421032d..69212cdde14c012261eabc4ac9b2e5956213f8d5 100755 (executable)
@@ -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
index 3ce825989e893d8cf805d8630f091aafc00e4cf4..5f8d075ed8c18b198e956bf10d6647598f565597 100644 (file)
@@ -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)