Dump all refs and marks during a checkpoint in fast-import.
If the frontend asks us to checkpoint (via the explicit checkpoint command) its probably because they are afraid the current import will crash/fail/whatever and want to make sure they can pickup from the last checkpoint. To do that sort of recovery, we will need the current tip of every branch and tag available at the next startup. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Shawn O. Pearce committed
Feb 7, 2007 at 02:42 UTC
820b9310127afe3533bb57034d6f458f5aed3e7e
2 files changed
+27
-9
Documentation/git-fast-import.txt
+19
-5
@@ -650,17 +650,31 @@ a data chunk which does not have an LF as its last byte.
650
651
`checkpoint`
652
~~~~~~~~~~~~
653
-Forces gfi to close the current packfile and start a new one.
654
-As this requires a significant amount of CPU time and disk IO
655
-(to compute the overall pack SHA-1 checksum and generate the
656
-corresponding index file) it can easily take several minutes for
657
-a single `checkpoint` command to complete.
653
+Forces gfi to close the current packfile, start a new one, and to
654
+save out all current branch refs, tags and marks.
655
656
....
657
'checkpoint' LF
658
LF
659
....
660
661
+Note that gfi automatically switches packfiles when the current
662
+packfile reaches \--max-pack-size, or 4 GiB, whichever limit is
663
+smaller. During an automatic packfile switch gfi does not update
664
+the branch refs, tags or marks.
665
+
666
+As a `checkpoint` can require a significant amount of CPU time and
667
+disk IO (to compute the overall pack SHA-1 checksum, generate the
668
+corresponding index file, and update the refs) it can easily take
669
+several minutes for a single `checkpoint` command to complete.
670
+
671
+Frontends may choose to issue checkpoints during extremely large
672
+and long running imports, or when they need to allow another Git
673
+process access to a branch. However given that a 30 GiB Subversion
674
+repository can be loaded into Git through gfi in about 3 hours,
675
+explicit checkpointing may not be necessary.
676
+
677
+
678
Packfile Optimization
679
---------------------
680
When packing a blob gfi always attempts to deltify against the last
fast-import.c
+8
-4
@@ -838,7 +838,7 @@ static void end_packfile(void)
838
last_blob.depth = 0;
839
}
840
841
-static void checkpoint(void)
841
+static void cycle_packfile(void)
842
{
843
end_packfile();
844
start_packfile();
@@ -931,7 +931,7 @@ static int store_object(
931
932
/* This new object needs to *not* have the current pack_id. */
933
e->pack_id = pack_id + 1;
934
- checkpoint();
934
+ cycle_packfile();
935
936
/* We cannot carry a delta into the new pack. */
937
if (delta) {
@@ -1940,8 +1940,12 @@ static void cmd_reset_branch(void)
1940
1941
static void cmd_checkpoint(void)
1942
{
1943
- if (object_count)
1944
- checkpoint();
1943
+ if (object_count) {
1944
+ cycle_packfile();
1945
+ dump_branches();
1946
+ dump_tags();
1947
+ dump_marks();
1948
+ }
1949
read_next_command();
1950
}
1951