git@vger.kernel.org list mirror (unofficial, 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

git@vger.kernel.org list mirror (unofficial, one of many)

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://public-inbox.org/git
	git clone --mirror http://ou63pmih66umazou.onion/git
	git clone --mirror http://czquwvybam4bgbro.onion/git
	git clone --mirror http://hjrcffqmbrq6wope.onion/git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V1 git git/ https://public-inbox.org/git \
		git@vger.kernel.org
	public-inbox-index git

Example config snippet for mirrors.
Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.version-control.git
	nntp://ou63pmih66umazou.onion/inbox.comp.version-control.git
	nntp://czquwvybam4bgbro.onion/inbox.comp.version-control.git
	nntp://hjrcffqmbrq6wope.onion/inbox.comp.version-control.git
	nntp://news.gmane.io/gmane.comp.version-control.git
 note: .onion URLs require Tor: https://www.torproject.org/

code repositories for project(s) associated with this inbox:

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

AGPL code for this site: git clone https://public-inbox.org/public-inbox.git