fast-export: add --signed-tags=warn-strip mode
authorJohn Keeping <john@keeping.me.uk>
Sun, 14 Apr 2013 10:57:06 +0000 (11:57 +0100)
committerJunio C Hamano <gitster@pobox.com>
Mon, 15 Apr 2013 16:02:25 +0000 (09:02 -0700)
This issues a warning while stripping signatures from signed tags, which
allows us to use it as default behaviour for remote helpers which cannot
specify how to handle signed tags.

Signed-off-by: John Keeping <john@keeping.me.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/git-fast-export.txt
builtin/fast-export.c
t/t9350-fast-export.sh
index feab7a3e4ecb56aa17c32bd555e907a51001ef1f..03fc8c39d8607677533b72c39b11e14151ac5b60 100644 (file)
@@ -27,15 +27,17 @@ OPTIONS
        Insert 'progress' statements every <n> objects, to be shown by
        'git fast-import' during import.
 
        Insert 'progress' statements every <n> objects, to be shown by
        'git fast-import' during import.
 
---signed-tags=(verbatim|warn|strip|abort)::
+--signed-tags=(verbatim|warn|warn-strip|strip|abort)::
        Specify how to handle signed tags.  Since any transformation
        after the export can change the tag names (which can also happen
        when excluding revisions) the signatures will not match.
 +
 When asking to 'abort' (which is the default), this program will die
        Specify how to handle signed tags.  Since any transformation
        after the export can change the tag names (which can also happen
        when excluding revisions) the signatures will not match.
 +
 When asking to 'abort' (which is the default), this program will die
-when encountering a signed tag.  With 'strip', the tags will be made
-unsigned, with 'verbatim', they will be silently exported
-and with 'warn', they will be exported, but you will see a warning.
+when encountering a signed tag.  With 'strip', the tags will silently
+be made unsigned, with 'warn-strip' they will be made unsigned but a
+warning will be displayed, with 'verbatim', they will be silently
+exported and with 'warn', they will be exported, but you will see a
+warning.
 
 --tag-of-filtered-object=(abort|drop|rewrite)::
        Specify how to handle tags whose tagged object is filtered out.
 
 --tag-of-filtered-object=(abort|drop|rewrite)::
        Specify how to handle tags whose tagged object is filtered out.
index 725c0a7dca70ae8cbb31f571e0284f5c31a61cff..d60d675f6f5f1a2df50bdd3a6ba076e8c0ddd1f2 100644 (file)
@@ -24,7 +24,7 @@ static const char *fast_export_usage[] = {
 };
 
 static int progress;
 };
 
 static int progress;
-static enum { ABORT, VERBATIM, WARN, STRIP } signed_tag_mode = ABORT;
+static enum { ABORT, VERBATIM, WARN, WARN_STRIP, STRIP } signed_tag_mode = ABORT;
 static enum { ERROR, DROP, REWRITE } tag_of_filtered_mode = ERROR;
 static int fake_missing_tagger;
 static int use_done_feature;
 static enum { ERROR, DROP, REWRITE } tag_of_filtered_mode = ERROR;
 static int fake_missing_tagger;
 static int use_done_feature;
@@ -40,6 +40,8 @@ static int parse_opt_signed_tag_mode(const struct option *opt,
                signed_tag_mode = VERBATIM;
        else if (!strcmp(arg, "warn"))
                signed_tag_mode = WARN;
                signed_tag_mode = VERBATIM;
        else if (!strcmp(arg, "warn"))
                signed_tag_mode = WARN;
+       else if (!strcmp(arg, "warn-strip"))
+               signed_tag_mode = WARN_STRIP;
        else if (!strcmp(arg, "strip"))
                signed_tag_mode = STRIP;
        else
        else if (!strcmp(arg, "strip"))
                signed_tag_mode = STRIP;
        else
@@ -428,6 +430,10 @@ static void handle_tag(const char *name, struct tag *tag)
                                /* fallthru */
                        case VERBATIM:
                                break;
                                /* fallthru */
                        case VERBATIM:
                                break;
+                       case WARN_STRIP:
+                               warning ("Stripping signature from tag %s",
+                                        sha1_to_hex(tag->object.sha1));
+                               /* fallthru */
                        case STRIP:
                                message_size = signature + 1 - message;
                                break;
                        case STRIP:
                                message_size = signature + 1 - message;
                                break;
index 9320b4f94c25bf376a004c2c0d4451c0fd96f969..2471bc6777df58c222a96d4fc6e77d77e9e38703 100755 (executable)
@@ -146,6 +146,12 @@ test_expect_success 'signed-tags=strip' '
 
 '
 
 
 '
 
+test_expect_success 'signed-tags=warn-strip' '
+       git fast-export --signed-tags=warn-strip sign-your-name >output 2>err &&
+       ! grep PGP output &&
+       test -s err
+'
+
 test_expect_success 'setup submodule' '
 
        git checkout -f master &&
 test_expect_success 'setup submodule' '
 
        git checkout -f master &&