Web lists-archives.com

Re: is it "git gc --prune=now" or "git gc --prune=all"?




On Sat, Mar 02, 2019 at 03:26:37AM -0500, Robert P. J. Day wrote:

>   more pedantry, but digging through "git gc", the man page reads:
> 
>        --prune=<date>
>            Prune loose objects older than date (default is 2 weeks
>            ago, overridable by the config variable gc.pruneExpire).
>            --prune=all prunes loose objects regardless of their age
>            ^^^^^^^^^^^
> 
> but the code for gc.c contains a check for "now" (which actually makes
> more sense semantically):
> 
>   static void add_repack_all_option(struct string_list *keep_pack)
>   {
>         if (prune_expire && !strcmp(prune_expire, "now"))
>                 argv_array_push(&repack, "-a");
>         else {
>         ... snip ...
> 
> while the man page does not seem to mention the possible value of
> "now".
> 
>   am i misreading something? should the man page mention the possible
> value of "now" as opposed to "all"?

Using "all" would also work. It wouldn't shortcut to using "-a" (which
lets pack-objects save a little work), but it is handled in
parse_expiry_date() the same as "now". I do think the documentation
should recommend "now". Possibly builtin/gc.c should be smarter about
recognizing "all" in the conditional you quoted, too, though I don't
know that it's all that important (especially if we tweak the
documentation).

-Peff