Skip to content

Commit 118805b

Browse files
spearcegitster
authored andcommitted
Finish current packfile during fast-import crash handler
If fast-import is in the middle of crashing due to a protocol error or something like that then it can be very useful to have the mark table and all objects up until that point be available for a new import to resume from. Currently we just close the active packfile, unkeep all of our newly created packfiles (so they can be deleted), and dump the marks table to a temporary file. We don't attempt to update the refs/tags that the process has in memory as much of that data can be found in the crash report and I'm not sure it would be the right thing to do under every type of crash. Signed-off-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 3b08e5b commit 118805b

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

fast-import.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -459,6 +459,10 @@ static void write_crash_report(const char *err)
459459
fclose(rpt);
460460
}
461461

462+
static void end_packfile(void);
463+
static void unkeep_all_packs(void);
464+
static void dump_marks(void);
465+
462466
static NORETURN void die_nicely(const char *err, va_list params)
463467
{
464468
static int zombie;
@@ -472,6 +476,9 @@ static NORETURN void die_nicely(const char *err, va_list params)
472476
if (!zombie) {
473477
zombie = 1;
474478
write_crash_report(message);
479+
end_packfile();
480+
unkeep_all_packs();
481+
dump_marks();
475482
}
476483
exit(128);
477484
}

0 commit comments

Comments
 (0)