Skip to content

Commit 60cb906

Browse files
dschoGit for Windows Build Agent
authored andcommitted
Always auto-gc after calling a fast-import transport
After importing anything with fast-import, we should always let the garbage collector do its job, since the objects are written to disk inefficiently. This brings down an initial import of http://selenic.com/hg from about 230 megabytes to about 14. In the future, we may want to make this configurable on a per-remote basis, or maybe teach fast-import about it in the first place. Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 3efaacd commit 60cb906

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

transport-helper.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
#include "packfile.h"
2323

2424
static int debug;
25+
/* TODO: put somewhere sensible, e.g. git_transport_options? */
26+
static int auto_gc = 1;
2527

2628
struct helper_data {
2729
char *name;
@@ -589,6 +591,13 @@ static int fetch_with_import(struct transport *transport,
589591
}
590592
}
591593
strbuf_release(&buf);
594+
if (auto_gc) {
595+
struct child_process cmd = CHILD_PROCESS_INIT;
596+
597+
cmd.git_cmd = 1;
598+
strvec_pushl(&cmd.args, "gc", "--auto", "--quiet", NULL);
599+
run_command(&cmd);
600+
}
592601
return 0;
593602
}
594603

0 commit comments

Comments
 (0)