Skip to content

Commit

Permalink
Merge branch 'jk/gc-auto-after-fetch'
Browse files Browse the repository at this point in the history
Help "fetch only" repositories that do not trigger "gc --auto"
often enough.

* jk/gc-auto-after-fetch:
  fetch-pack: avoid repeatedly re-scanning pack directory
  fetch: run gc --auto after fetching
  • Loading branch information
Junio C Hamano committed Feb 1, 2013
2 parents 97fbc23 + 012a1bb commit 4acfff9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions builtin/fetch.c
Original file line number Diff line number Diff line change
Expand Up @@ -962,6 +962,9 @@ int cmd_fetch(int argc, const char **argv, const char *prefix)
struct string_list list = STRING_LIST_INIT_NODUP;
struct remote *remote;
int result = 0;
static const char *argv_gc_auto[] = {
"gc", "--auto", NULL,
};

packet_trace_identity("fetch");

Expand Down Expand Up @@ -1041,5 +1044,7 @@ int cmd_fetch(int argc, const char **argv, const char *prefix)
list.strdup_strings = 1;
string_list_clear(&list, 0);

run_command_v_opt(argv_gc_auto, RUN_GIT_CMD);

return result;
}
3 changes: 3 additions & 0 deletions fetch-pack.c
Original file line number Diff line number Diff line change
Expand Up @@ -594,6 +594,9 @@ static int everything_local(struct fetch_pack_args *args,
for (ref = *refs; ref; ref = ref->next) {
struct object *o;

if (!has_sha1_file(ref->old_sha1))
continue;

o = parse_object(ref->old_sha1);
if (!o)
continue;
Expand Down

0 comments on commit 4acfff9

Please sign in to comment.