Skip to content

Commit

Permalink
Finish current packfile during fast-import crash handler
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Shawn O. Pearce authored and Junio C Hamano committed Feb 16, 2008
1 parent 3b08e5b commit 118805b
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions fast-import.c
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,10 @@ static void write_crash_report(const char *err)
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;
Expand All @@ -472,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);
}
Expand Down

0 comments on commit 118805b

Please sign in to comment.