diff options
author | Sverre Rabbelier <srabbelier@gmail.com> | 2009-12-04 18:06:59 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2009-12-04 16:10:59 -0800 |
commit | 081751c882f8398081b94335faa23912a655fb1c (patch) | |
tree | 3da0cea4682608beabbd36e0075a15e59d789bbc /fast-import.c | |
parent | 2792f26c3e93c268732957b71c0390a1efe14d7e (diff) | |
download | git-081751c882f8398081b94335faa23912a655fb1c.tar.gz |
fast-import: allow for multiple --import-marks= arguments
The --import-marks= option may be specified multiple times on the
commandline and should result in all marks being read in. Only one
import-marks feature may be specified in the stream, which is
overriden by any --import-marks= commandline options.
If one wishes to specify import-marks files in addition to the one
specified in the stream, it is easy to repeat the stream option as a
--import-marks= commandline option.
Also verify this behavior with tests.
Signed-off-by: Sverre Rabbelier <srabbelier@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'fast-import.c')
-rw-r--r-- | fast-import.c | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/fast-import.c b/fast-import.c index ab099b6338..4c3406e9f0 100644 --- a/fast-import.c +++ b/fast-import.c @@ -322,6 +322,7 @@ static struct object_entry *object_table[1 << 16]; static struct mark_set *marks; static const char *export_marks_file; static const char *import_marks_file; +static int import_marks_file_from_stream; /* Our last blob */ static struct last_object last_blob = { STRBUF_INIT, 0, 0, 0 }; @@ -2469,9 +2470,19 @@ static void parse_progress(void) skip_optional_lf(); } -static void option_import_marks(const char *marks) +static void option_import_marks(const char *marks, int from_stream) { + if (import_marks_file) { + if (from_stream) + die("Only one import-marks command allowed per stream"); + + /* read previous mark file */ + if(!import_marks_file_from_stream) + read_marks(); + } + import_marks_file = xstrdup(marks); + import_marks_file_from_stream = from_stream; } static void option_date_format(const char *fmt) @@ -2538,12 +2549,12 @@ static int parse_one_option(const char *option) return 1; } -static int parse_one_feature(const char *feature) +static int parse_one_feature(const char *feature, int from_stream) { if (!prefixcmp(feature, "date-format=")) { option_date_format(feature + 12); } else if (!prefixcmp(feature, "import-marks=")) { - option_import_marks(feature + 13); + option_import_marks(feature + 13, from_stream); } else if (!prefixcmp(feature, "export-marks=")) { option_export_marks(feature + 13); } else if (!prefixcmp(feature, "force")) { @@ -2562,7 +2573,7 @@ static void parse_feature(void) if (seen_data_command) die("Got feature command '%s' after data command", feature); - if (parse_one_feature(feature)) + if (parse_one_feature(feature, 1)) return; die("This version of fast-import does not support feature %s.", feature); @@ -2618,7 +2629,7 @@ static void parse_argv(void) if (parse_one_option(a + 2)) continue; - if (parse_one_feature(a + 2)) + if (parse_one_feature(a + 2, 0)) continue; die("unknown option %s", a); |