fast-export: add --signed-tags=warn-strip mode
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>
John Keeping committed
Apr 14, 2013 at 11:57 UTC
cd16c59bfa216b7e153f357ccfa89d2a567b8c00
3 files changed
+19
-5
Documentation/git-fast-export.txt
+6
-4
@@ -27,15 +27,17 @@ OPTIONS
27
Insert 'progress' statements every <n> objects, to be shown by
28
'git fast-import' during import.
29
30
---signed-tags=(verbatim|warn|strip|abort)::
30
+--signed-tags=(verbatim|warn|warn-strip|strip|abort)::
31
Specify how to handle signed tags. Since any transformation
32
after the export can change the tag names (which can also happen
33
when excluding revisions) the signatures will not match.
34
+
35
When asking to 'abort' (which is the default), this program will die
36
-when encountering a signed tag. With 'strip', the tags will be made
37
-unsigned, with 'verbatim', they will be silently exported
38
-and with 'warn', they will be exported, but you will see a warning.
36
+when encountering a signed tag. With 'strip', the tags will silently
37
+be made unsigned, with 'warn-strip' they will be made unsigned but a
38
+warning will be displayed, with 'verbatim', they will be silently
39
+exported and with 'warn', they will be exported, but you will see a
40
+warning.
41
42
--tag-of-filtered-object=(abort|drop|rewrite)::
43
Specify how to handle tags whose tagged object is filtered out.
builtin/fast-export.c
+7
-1
@@ -24,7 +24,7 @@ static const char *fast_export_usage[] = {
24
};
25
26
static int progress;
27
-static enum { ABORT, VERBATIM, WARN, STRIP } signed_tag_mode = ABORT;
27
+static enum { ABORT, VERBATIM, WARN, WARN_STRIP, STRIP } signed_tag_mode = ABORT;
28
static enum { ERROR, DROP, REWRITE } tag_of_filtered_mode = ERROR;
29
static int fake_missing_tagger;
30
static int use_done_feature;
@@ -40,6 +40,8 @@ static int parse_opt_signed_tag_mode(const struct option *opt,
40
signed_tag_mode = VERBATIM;
41
else if (!strcmp(arg, "warn"))
42
signed_tag_mode = WARN;
43
+ else if (!strcmp(arg, "warn-strip"))
44
+ signed_tag_mode = WARN_STRIP;
45
else if (!strcmp(arg, "strip"))
46
signed_tag_mode = STRIP;
47
else
@@ -428,6 +430,10 @@ static void handle_tag(const char *name, struct tag *tag)
430
/* fallthru */
431
case VERBATIM:
432
break;
433
+ case WARN_STRIP:
434
+ warning ("Stripping signature from tag %s",
435
+ sha1_to_hex(tag->object.sha1));
436
+ /* fallthru */
437
case STRIP:
438
message_size = signature + 1 - message;
439
break;
t/t9350-fast-export.sh
+6
@@ -146,6 +146,12 @@ test_expect_success 'signed-tags=strip' '
146
147
'
148
149
+test_expect_success 'signed-tags=warn-strip' '
150
+ git fast-export --signed-tags=warn-strip sign-your-name >output 2>err &&
151
+ ! grep PGP output &&
152
+ test -s err
153
+'
154
+
155
test_expect_success 'setup submodule' '
156
157
git checkout -f master &&