X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=builtin-fast-export.c;h=fdf4ae9ebdba7832a0ac736d56a7b564bba41baa;hb=5b841d61c428bc8dbb9e3b5afd12781aff51eb2a;hp=7d5d57ad7568b8c0bf7396cdbd581c67ab4600e2;hpb=14de7393f1eca05c99f785cc2f43281da2c46e9e;p=git.git diff --git a/builtin-fast-export.c b/builtin-fast-export.c index 7d5d57ad7..fdf4ae9eb 100644 --- a/builtin-fast-export.c +++ b/builtin-fast-export.c @@ -24,6 +24,7 @@ static const char *fast_export_usage[] = { static int progress; static enum { VERBATIM, WARN, STRIP, ABORT } signed_tag_mode = ABORT; +static int fake_missing_tagger; static int parse_opt_signed_tag_mode(const struct option *opt, const char *arg, int unset) @@ -297,10 +298,17 @@ static void handle_tag(const char *name, struct tag *tag) message_size = strlen(message); } tagger = memmem(buf, message ? message - buf : size, "\ntagger ", 8); - if (!tagger) - die ("No tagger for tag %s", sha1_to_hex(tag->object.sha1)); - tagger++; - tagger_end = strchrnul(tagger, '\n'); + if (!tagger) { + if (fake_missing_tagger) + tagger = "tagger Unspecified Tagger " + " 0 +0000"; + else + tagger = ""; + tagger_end = tagger + strlen(tagger); + } else { + tagger++; + tagger_end = strchrnul(tagger, '\n'); + } /* handle signed tags */ if (message) { @@ -326,9 +334,10 @@ static void handle_tag(const char *name, struct tag *tag) if (!prefixcmp(name, "refs/tags/")) name += 10; - printf("tag %s\nfrom :%d\n%.*s\ndata %d\n%.*s\n", + printf("tag %s\nfrom :%d\n%.*s%sdata %d\n%.*s\n", name, get_object_mark(tag->tagged), (int)(tagger_end - tagger), tagger, + tagger == tagger_end ? "" : "\n", (int)message_size, (int)message_size, message ? message : ""); } @@ -483,9 +492,14 @@ int cmd_fast_export(int argc, const char **argv, const char *prefix) "Dump marks to this file"), OPT_STRING(0, "import-marks", &import_filename, "FILE", "Import marks from this file"), + OPT_BOOLEAN(0, "fake-missing-tagger", &fake_missing_tagger, + "Fake a tagger when tags lack one"), OPT_END() }; + if (argc == 1) + usage_with_options (fast_export_usage, options); + /* we handle encodings */ git_config(git_default_config, NULL); @@ -500,6 +514,7 @@ int cmd_fast_export(int argc, const char **argv, const char *prefix) get_tags_and_duplicates(&revs.pending, &extra_refs); + revs.topo_order = 1; if (prepare_revision_walk(&revs)) die("revision walk setup failed"); revs.diffopt.format_callback = show_filemodify;