Re: [PATCH] git-gc: by default use safer "-A" option to repack when not --prune'ing
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- Oct 11, 2007, 00:49 UTC
- Message-ID
- <Pine.LNX.4.64.0710110149100.4174@racer.site>
- In-Reply-To
- <Pine.LNX.4.64.0710101918060.30020@torch.nrlssc.navy.mil>
Hi,
On Wed, 10 Oct 2007, Brandon Casey wrote:
Show 28 quoted lines
> On Thu, 11 Oct 2007, Johannes Schindelin wrote:
>
> > > @@ -211,6 +205,16 @@ int cmd_gc(int argc, const char **argv, const char
> > > *prefix)
> > > prune = 0;
> > > if (!need_to_gc())
> > > return 0;
> > > + } else {
> > > + /*
> > > + * Use safer (for shared repos) "-A" option to
> > > + * repack when not pruning. Auto-gc makes its
> > > + * own decision.
> > > + */
> > > + if (prune)
> > > + append_option(argv_repack, "-a", MAX_ADD);
> > > + else
> > > + append_option(argv_repack, "-A", MAX_ADD);
> > > }
> > >
> > > if (pack_refs && run_command_v_opt(argv_pack_refs, RUN_GIT_CMD))
> >
> > To use the append_option() function, you need to make sure that the
> > argv has enough space, so I suggest adding another NULL to
> > argv_repack[]. This is enough, since you only ever add one option.
> > But you should mention it somewhere, probably above the definition of
> > argv_repack[].
>
> Shouldn't argv_repack have space for MAX_ADD (10) items?Ouch... I overlooked that. So please strike this objection.
Thanks, Dscho