On Mon, Feb 08, 2021 at 02:52:22PM +0000, Derrick Stolee via GitGitGadget wrote: > +pack-refs:: > + The `pack-refs` task collects the loose reference files and > + collects them into a single file. This speeds up operations that > + need to iterate across many refereences. See linkgit:git-pack-refs[1] > + for more information. > + Do you think it's worth documenting here or in git-gc(1) that running this has the effect of disabling the same step during gc? > OPTIONS > ------- > --auto:: > diff --git a/builtin/gc.c b/builtin/gc.c > index 4c40594d660e..8f13c3bb8607 100644 > --- a/builtin/gc.c > +++ b/builtin/gc.c > @@ -54,7 +54,6 @@ static const char *prune_worktrees_expire = "3.months.ago"; > static unsigned long big_pack_threshold; > static unsigned long max_delta_cache_size = DEFAULT_DELTA_CACHE_SIZE; > > -static struct strvec pack_refs_cmd = STRVEC_INIT; > static struct strvec reflog = STRVEC_INIT; > static struct strvec repack = STRVEC_INIT; > static struct strvec prune = STRVEC_INIT; > @@ -163,6 +162,15 @@ static void gc_config(void) > git_config(git_default_config, NULL); > } > > +struct maintenance_run_opts; > +static int maintenance_task_pack_refs(struct maintenance_run_opts *opts) It may be worth calling this "unused", since you explicitly pass NULL below. > +{ > + struct strvec pack_refs_cmd = STRVEC_INIT; > + strvec_pushl(&pack_refs_cmd, "pack-refs", "--all", "--prune", NULL); > + > + return run_command_v_opt(pack_refs_cmd.v, RUN_GIT_CMD); > +} > + > static int too_many_loose_objects(void) > { > /* > @@ -518,8 +526,8 @@ static void gc_before_repack(void) > if (done++) > return; > > - if (pack_refs && run_command_v_opt(pack_refs_cmd.v, RUN_GIT_CMD)) > - die(FAILED_RUN, pack_refs_cmd.v[0]); > + if (pack_refs && maintenance_task_pack_refs(NULL)) > + die(FAILED_RUN, "pack-refs"); Hmm. Am I missing where opting into the maintenance step disables this in gc? You suggest that it does in the commit message, but I can't seem to see it here. > +test_expect_success 'pack-refs task' ' > + for n in $(test_seq 1 5) > + do > + git branch -f to-pack/$n HEAD || return 1 > + done && > + git maintenance run --task=pack-refs && > + ls .git/refs/heads/ >after && > + test_must_be_empty after Worth testing that $GIT_DIR/packed-refs exists, too? Thanks, Taylor