Skip to content
This repository was archived by the owner on Nov 9, 2017. It is now read-only.

Commit 68cfd0b

Browse files
dschokasal
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 23d01f5 commit 68cfd0b

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

transport-helper.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
#include "refs.h"
1515

1616
static int debug;
17+
/* TODO: put somewhere sensible, e.g. git_transport_options? */
18+
static int auto_gc = 1;
1719

1820
struct helper_data {
1921
const char *name;
@@ -535,6 +537,12 @@ static int fetch_with_import(struct transport *transport,
535537
}
536538
}
537539
strbuf_release(&buf);
540+
if (auto_gc) {
541+
const char *argv_gc_auto[] = {
542+
"gc", "--auto", "--quiet", NULL,
543+
};
544+
run_command_v_opt(argv_gc_auto, RUN_GIT_CMD);
545+
}
538546
return 0;
539547
}
540548

0 commit comments

Comments
 (0)