Commits

Junio C Hamano  committed 472d07b Merge

Merge branch 'jk/gc-auto-after-fetch' into next

Help "fetch only" repositories that do not trigger "gc --auto" often
enough.

This is to resolve merge conflicts early for the same topic to
recent codebase.

* jk/gc-auto-after-fetch:
fetch-pack: avoid repeatedly re-scanning pack directory
fetch: run gc --auto after fetching

  • Participants
  • Parent commits b639b47, 012a1bb
  • Branches next

Comments (0)

Files changed (2)

File builtin/fetch.c

 	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");
 
 	list.strdup_strings = 1;
 	string_list_clear(&list, 0);
 
+	run_command_v_opt(argv_gc_auto, RUN_GIT_CMD);
+
 	return result;
 }

File fetch-pack.c

 	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;