Skip to content

Commit a37cce3

Browse files
drafnelgitster
authored andcommitted
git-gc: always use -A when manually repacking
Now that repack -A will leave unreferenced objects unpacked, there is no reason to use the -a option to repack (which will discard unreferenced objects). The unpacked unreferenced objects will not be repacked by a subsequent repack, and will eventually be pruned by git-gc based on the gc.pruneExpire config option.
1 parent ccc1297 commit a37cce3

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

builtin-gc.c

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -256,17 +256,8 @@ int cmd_gc(int argc, const char **argv, const char *prefix)
256256
"performance. You may also\n"
257257
"run \"git gc\" manually. See "
258258
"\"git help gc\" for more information.\n");
259-
} else {
260-
/*
261-
* Use safer (for shared repos) "-A" option to
262-
* repack when not pruning. Auto-gc makes its
263-
* own decision.
264-
*/
265-
if (prune)
266-
append_option(argv_repack, "-a", MAX_ADD);
267-
else
268-
append_option(argv_repack, "-A", MAX_ADD);
269-
}
259+
} else
260+
append_option(argv_repack, "-A", MAX_ADD);
270261

271262
if (pack_refs && run_command_v_opt(argv_pack_refs, RUN_GIT_CMD))
272263
return error(FAILED_RUN, argv_pack_refs[0]);

0 commit comments

Comments
 (0)