X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;f=fast-import.c;h=36ec5b87f8878dacedc9fc3f4acc5b51644a4b71;hb=ef90d6d4208a5130185b04f06e5f90a5f9959fe3;hp=32ec159915611f6a21c218969bf82a09b6720c48;hpb=655e8515f279c01f525745d443f509f97cd805ab;p=git.git diff --git a/fast-import.c b/fast-import.c index 32ec15991..36ec5b87f 100644 --- a/fast-import.c +++ b/fast-import.c @@ -372,6 +372,8 @@ static void write_branch_report(FILE *rpt, struct branch *b) fputc('\n', rpt); } +static void dump_marks_helper(FILE *, uintmax_t, struct mark_set *); + static void write_crash_report(const char *err) { char *loc = git_path("fast_import_crash_%d", getpid()); @@ -430,12 +432,37 @@ static void write_crash_report(const char *err) write_branch_report(rpt, b); } + if (first_tag) { + struct tag *tg; + fputc('\n', rpt); + fputs("Annotated Tags\n", rpt); + fputs("--------------\n", rpt); + for (tg = first_tag; tg; tg = tg->next_tag) { + fputs(sha1_to_hex(tg->sha1), rpt); + fputc(' ', rpt); + fputs(tg->name, rpt); + fputc('\n', rpt); + } + } + + fputc('\n', rpt); + fputs("Marks\n", rpt); + fputs("-----\n", rpt); + if (mark_file) + fprintf(rpt, " exported to %s\n", mark_file); + else + dump_marks_helper(rpt, 0, marks); + fputc('\n', rpt); fputs("-------------------\n", rpt); fputs("END OF CRASH REPORT\n", rpt); fclose(rpt); } +static void end_packfile(void); +static void unkeep_all_packs(void); +static void dump_marks(void); + static NORETURN void die_nicely(const char *err, va_list params) { static int zombie; @@ -449,6 +476,9 @@ static NORETURN void die_nicely(const char *err, va_list params) if (!zombie) { zombie = 1; write_crash_report(message); + end_packfile(); + unkeep_all_packs(); + dump_marks(); } exit(128); } @@ -1486,6 +1516,8 @@ static int update_branch(struct branch *b) struct ref_lock *lock; unsigned char old_sha1[20]; + if (is_null_sha1(b->sha1)) + return 0; if (read_ref(b->name, old_sha1)) hashclr(old_sha1); lock = lock_any_ref_for_update(b->name, old_sha1, 0); @@ -2320,7 +2352,7 @@ static void import_marks(const char *input_file) fclose(f); } -static int git_pack_config(const char *k, const char *v) +static int git_pack_config(const char *k, const char *v, void *cb) { if (!strcmp(k, "pack.depth")) { max_depth = git_config_int(k, v); @@ -2338,7 +2370,7 @@ static int git_pack_config(const char *k, const char *v) pack_compression_seen = 1; return 0; } - return git_default_config(k, v); + return git_default_config(k, v, cb); } static const char fast_import_usage[] = @@ -2348,7 +2380,8 @@ int main(int argc, const char **argv) { unsigned int i, show_stats = 1; - git_config(git_pack_config); + setup_git_directory(); + git_config(git_pack_config, NULL); if (!pack_compression_seen && core_compression_seen) pack_compression_level = core_compression_level;