Anonymous committed 820b931

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 <>

Comments (0)

Files changed (2)


-Forces gfi to close the current packfile and start a new one.
-As this requires a significant amount of CPU time and disk IO
-(to compute the overall pack SHA-1 checksum and generate the
-corresponding index file) it can easily take several minutes for
-a single `checkpoint` command to complete.
+Forces gfi to close the current packfile, start a new one, and to
+save out all current branch refs, tags and marks.
 	'checkpoint' LF
+Note that gfi automatically switches packfiles when the current
+packfile reaches \--max-pack-size, or 4 GiB, whichever limit is
+smaller.  During an automatic packfile switch gfi does not update
+the branch refs, tags or marks.
+As a `checkpoint` can require a significant amount of CPU time and
+disk IO (to compute the overall pack SHA-1 checksum, generate the
+corresponding index file, and update the refs) it can easily take
+several minutes for a single `checkpoint` command to complete.
+Frontends may choose to issue checkpoints during extremely large
+and long running imports, or when they need to allow another Git
+process access to a branch.  However given that a 30 GiB Subversion
+repository can be loaded into Git through gfi in about 3 hours,
+explicit checkpointing may not be necessary.
 Packfile Optimization
 When packing a blob gfi always attempts to deltify against the last
 	last_blob.depth = 0;
-static void checkpoint(void)
+static void cycle_packfile(void)
 		/* This new object needs to *not* have the current pack_id. */
 		e->pack_id = pack_id + 1;
-		checkpoint();
+		cycle_packfile();
 		/* We cannot carry a delta into the new pack. */
 		if (delta) {
 static void cmd_checkpoint(void)
-	if (object_count)
-		checkpoint();
+	if (object_count) {
+		cycle_packfile();
+		dump_branches();
+		dump_tags();
+		dump_marks();
+	}
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.