git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* is it "git gc --prune=now" or "git gc --prune=all"?
@ 2019-03-02  8:26 Robert P. J. Day
  2019-03-05  5:03 ` Jeff King
  0 siblings, 1 reply; 5+ messages in thread
From: Robert P. J. Day @ 2019-03-02  8:26 UTC (permalink / raw)
  To: Git Mailing list


  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"?

rday

-- 

========================================================================
Robert P. J. Day                                 Ottawa, Ontario, CANADA
                  http://crashcourse.ca/dokuwiki

Twitter:                                       http://twitter.com/rpjday
LinkedIn:                               http://ca.linkedin.com/in/rpjday
========================================================================

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: is it "git gc --prune=now" or "git gc --prune=all"?
  2019-03-02  8:26 is it "git gc --prune=now" or "git gc --prune=all"? Robert P. J. Day
@ 2019-03-05  5:03 ` Jeff King
  2019-03-06  0:08   ` Junio C Hamano
  0 siblings, 1 reply; 5+ messages in thread
From: Jeff King @ 2019-03-05  5:03 UTC (permalink / raw)
  To: Robert P. J. Day; +Cc: Git Mailing list

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: is it "git gc --prune=now" or "git gc --prune=all"?
  2019-03-05  5:03 ` Jeff King
@ 2019-03-06  0:08   ` Junio C Hamano
  2019-03-09 18:13     ` Robert P. J. Day
  0 siblings, 1 reply; 5+ messages in thread
From: Junio C Hamano @ 2019-03-06  0:08 UTC (permalink / raw)
  To: Jeff King; +Cc: Robert P. J. Day, Git Mailing list

Jeff King <peff@peff.net> writes:

> ... 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).

Yup, as the placeholder for the value is labeled as "<date>", "now"
would be the one we should be encouraging.

Thanks.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: is it "git gc --prune=now" or "git gc --prune=all"?
  2019-03-06  0:08   ` Junio C Hamano
@ 2019-03-09 18:13     ` Robert P. J. Day
  2019-03-11  2:18       ` Junio C Hamano
  0 siblings, 1 reply; 5+ messages in thread
From: Robert P. J. Day @ 2019-03-09 18:13 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Jeff King, Git Mailing list

On Wed, 6 Mar 2019, Junio C Hamano wrote:

> Jeff King <peff@peff.net> writes:
>
> > ... 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).
>
> Yup, as the placeholder for the value is labeled as "<date>", "now"
> would be the one we should be encouraging.

  i can submit an obviously trivial patch for that -- i can see in
date.c the equally valid alternatives:

    int parse_expiry_date(const char *date, timestamp_t *timestamp)
    {
        int errors = 0;

        if (!strcmp(date, "never") || !strcmp(date, "false"))
                *timestamp = 0;
        else if (!strcmp(date, "all") || !strcmp(date, "now"))
        ... snip ...

  is the preference to simply list both alternatives, or to
*encourage* the more intuitive "now" and "never" values while politely
deprecating the others? the impression i get is the latter.

rday

-- 

========================================================================
Robert P. J. Day                                 Ottawa, Ontario, CANADA
                  http://crashcourse.ca/dokuwiki

Twitter:                                       http://twitter.com/rpjday
LinkedIn:                               http://ca.linkedin.com/in/rpjday
========================================================================


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: is it "git gc --prune=now" or "git gc --prune=all"?
  2019-03-09 18:13     ` Robert P. J. Day
@ 2019-03-11  2:18       ` Junio C Hamano
  0 siblings, 0 replies; 5+ messages in thread
From: Junio C Hamano @ 2019-03-11  2:18 UTC (permalink / raw)
  To: Robert P. J. Day; +Cc: Jeff King, Git Mailing list

"Robert P. J. Day" <rpjday@crashcourse.ca> writes:

> On Wed, 6 Mar 2019, Junio C Hamano wrote:
>
>> Jeff King <peff@peff.net> writes:
>>
>> > ... 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).
>>
>> Yup, as the placeholder for the value is labeled as "<date>", "now"
>> would be the one we should be encouraging.
>
>   i can submit an obviously trivial patch for that

You already did to turn --prune=all into --prune=now in the doc, I
think.

Do we encourage 'false' where we should encourage 'never'?  I see we
do not even mention the negative form in git-gc manpage, and I think
it is a good thing, especially because --prune=<date> is listed just
next to --no-prune, which is even more explicit.



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-03-11  2:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-02  8:26 is it "git gc --prune=now" or "git gc --prune=all"? Robert P. J. Day
2019-03-05  5:03 ` Jeff King
2019-03-06  0:08   ` Junio C Hamano
2019-03-09 18:13     ` Robert P. J. Day
2019-03-11  2:18       ` Junio C Hamano

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).