fast-export: support done feature
If fast-export is being used to generate a fast-import stream that will be used afterwards it is desirable to indicate the end of the stream with the new 'done' command. Add a flag that causes fast-export to end with 'done'. Signed-off-by: Sverre Rabbelier <srabbelier@gmail.com> Acked-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Sverre Rabbelier committed
Jul 16, 2011 at 15:03 UTC
82670a5cb57d6a590f261430b6e2b39d09c22900
2 files changed
+13
Documentation/git-fast-export.txt
+4
@@ -82,6 +82,10 @@ marks the same across runs.
82
allow that. So fake a tagger to be able to fast-import the
83
output.
84
85
+--use-done-feature::
86
+ Start the stream with a 'feature done' stanza, and terminate
87
+ it with a 'done' command.
88
+
89
--no-data::
90
Skip output of blob objects and instead refer to blobs via
91
their original SHA-1 hash. This is useful when rewriting the
builtin/fast-export.c
+9
@@ -26,6 +26,7 @@ static int progress;
26
static enum { ABORT, VERBATIM, WARN, STRIP } signed_tag_mode = ABORT;
27
static enum { ERROR, DROP, REWRITE } tag_of_filtered_mode = ABORT;
28
static int fake_missing_tagger;
29
+static int use_done_feature;
30
static int no_data;
31
static int full_tree;
32
@@ -627,6 +628,8 @@ int cmd_fast_export(int argc, const char **argv, const char *prefix)
628
"Fake a tagger when tags lack one"),
629
OPT_BOOLEAN(0, "full-tree", &full_tree,
630
"Output full tree for each commit"),
631
+ OPT_BOOLEAN(0, "use-done-feature", &use_done_feature,
632
+ "Use the done feature to terminate the stream"),
633
{ OPTION_NEGBIT, 0, "data", &no_data, NULL,
634
"Skip output of blob data",
635
PARSE_OPT_NOARG | PARSE_OPT_NEGHELP, NULL, 1 },
@@ -648,6 +651,9 @@ int cmd_fast_export(int argc, const char **argv, const char *prefix)
651
if (argc > 1)
652
usage_with_options (fast_export_usage, options);
653
654
+ if (use_done_feature)
655
+ printf("feature done\n");
656
+
657
if (import_filename)
658
import_marks(import_filename);
659
@@ -675,5 +681,8 @@ int cmd_fast_export(int argc, const char **argv, const char *prefix)
681
if (export_filename)
682
export_marks(export_filename);
683
684
+ if (use_done_feature)
685
+ printf("done\n");
686
+
687
return 0;
688
}