{"thread":{"id":"50625","subject":"is it \"git gc --prune=now\" or \"git gc --prune=all\"?","startedAt":"2019-03-02T08:27:10Z","lastAt":"2019-03-11T02:18:06Z","messageCount":5,"participants":["Robert P. J. Day","Jeff King","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"370464","messageId":"alpine.LFD.2.21.1903020323110.16672@localhost.localdomain","threadId":"50625","inReplyTo":null,"subject":"is it \"git gc --prune=now\" or \"git gc --prune=all\"?","fromName":"Robert P. J. Day","fromEmail":"rpjday@crashcourse.ca","sentAt":"2019-03-02T08:26:37Z","receivedAt":"2019-03-02T08:27:10Z","isPatch":false,"sender":{"key":"rpjday@crashcourse.ca","avatar":"https://avatars.githubusercontent.com/u/226084077?v=4"},"body":"\n  more pedantry, but digging through \"git gc\", the man page reads:\n\n       --prune=<date>\n           Prune loose objects older than date (default is 2 weeks\n           ago, overridable by the config variable gc.pruneExpire).\n           --prune=all prunes loose objects regardless of their age\n           ^^^^^^^^^^^\n\nbut the code for gc.c contains a check for \"now\" (which actually makes\nmore sense semantically):\n\n  static void add_repack_all_option(struct string_list *keep_pack)\n  {\n        if (prune_expire && !strcmp(prune_expire, \"now\"))\n                argv_array_push(&repack, \"-a\");\n        else {\n        ... snip ...\n\nwhile the man page does not seem to mention the possible value of\n\"now\".\n\n  am i misreading something? should the man page mention the possible\nvalue of \"now\" as opposed to \"all\"?\n\nrday\n\n-- \n\n========================================================================\nRobert P. J. Day                                 Ottawa, Ontario, CANADA\n                  http://crashcourse.ca/dokuwiki\n\nTwitter:                                       http://twitter.com/rpjday\nLinkedIn:                               http://ca.linkedin.com/in/rpjday\n========================================================================\n"},{"id":"370667","messageId":"20190305050326.GK19800@sigill.intra.peff.net","threadId":"50625","inReplyTo":"alpine.LFD.2.21.1903020323110.16672@localhost.localdomain","subject":"Re: is it \"git gc --prune=now\" or \"git gc --prune=all\"?","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2019-03-05T05:03:27Z","receivedAt":"2019-03-05T05:03:30Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Sat, Mar 02, 2019 at 03:26:37AM -0500, Robert P. J. Day wrote:\n\n>   more pedantry, but digging through \"git gc\", the man page reads:\n> \n>        --prune=<date>\n>            Prune loose objects older than date (default is 2 weeks\n>            ago, overridable by the config variable gc.pruneExpire).\n>            --prune=all prunes loose objects regardless of their age\n>            ^^^^^^^^^^^\n> \n> but the code for gc.c contains a check for \"now\" (which actually makes\n> more sense semantically):\n> \n>   static void add_repack_all_option(struct string_list *keep_pack)\n>   {\n>         if (prune_expire && !strcmp(prune_expire, \"now\"))\n>                 argv_array_push(&repack, \"-a\");\n>         else {\n>         ... snip ...\n> \n> while the man page does not seem to mention the possible value of\n> \"now\".\n> \n>   am i misreading something? should the man page mention the possible\n> value of \"now\" as opposed to \"all\"?\n\nUsing \"all\" would also work. It wouldn't shortcut to using \"-a\" (which\nlets pack-objects save a little work), but it is handled in\nparse_expiry_date() the same as \"now\". I do think the documentation\nshould recommend \"now\". Possibly builtin/gc.c should be smarter about\nrecognizing \"all\" in the conditional you quoted, too, though I don't\nknow that it's all that important (especially if we tweak the\ndocumentation).\n\n-Peff\n"},{"id":"370773","messageId":"xmqqef7ksw2w.fsf@gitster-ct.c.googlers.com","threadId":"50625","inReplyTo":"20190305050326.GK19800@sigill.intra.peff.net","subject":"Re: is it \"git gc --prune=now\" or \"git gc --prune=all\"?","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2019-03-06T00:08:55Z","receivedAt":"2019-03-06T00:09:00Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jeff King <peff@peff.net> writes:\n\n> ... I do think the documentation\n> should recommend \"now\". Possibly builtin/gc.c should be smarter about\n> recognizing \"all\" in the conditional you quoted, too, though I don't\n> know that it's all that important (especially if we tweak the\n> documentation).\n\nYup, as the placeholder for the value is labeled as \"<date>\", \"now\"\nwould be the one we should be encouraging.\n\nThanks.\n"},{"id":"371038","messageId":"alpine.LFD.2.21.1903091309130.16641@localhost.localdomain","threadId":"50625","inReplyTo":"xmqqef7ksw2w.fsf@gitster-ct.c.googlers.com","subject":"Re: is it \"git gc --prune=now\" or \"git gc --prune=all\"?","fromName":"Robert P. J. Day","fromEmail":"rpjday@crashcourse.ca","sentAt":"2019-03-09T18:13:41Z","receivedAt":"2019-03-09T18:13:47Z","isPatch":false,"sender":{"key":"rpjday@crashcourse.ca","avatar":"https://avatars.githubusercontent.com/u/226084077?v=4"},"body":"On Wed, 6 Mar 2019, Junio C Hamano wrote:\n\n> Jeff King <peff@peff.net> writes:\n>\n> > ... I do think the documentation should recommend \"now\". Possibly\n> > builtin/gc.c should be smarter about recognizing \"all\" in the\n> > conditional you quoted, too, though I don't know that it's all\n> > that important (especially if we tweak the documentation).\n>\n> Yup, as the placeholder for the value is labeled as \"<date>\", \"now\"\n> would be the one we should be encouraging.\n\n  i can submit an obviously trivial patch for that -- i can see in\ndate.c the equally valid alternatives:\n\n    int parse_expiry_date(const char *date, timestamp_t *timestamp)\n    {\n        int errors = 0;\n\n        if (!strcmp(date, \"never\") || !strcmp(date, \"false\"))\n                *timestamp = 0;\n        else if (!strcmp(date, \"all\") || !strcmp(date, \"now\"))\n        ... snip ...\n\n  is the preference to simply list both alternatives, or to\n*encourage* the more intuitive \"now\" and \"never\" values while politely\ndeprecating the others? the impression i get is the latter.\n\nrday\n\n-- \n\n========================================================================\nRobert P. J. Day                                 Ottawa, Ontario, CANADA\n                  http://crashcourse.ca/dokuwiki\n\nTwitter:                                       http://twitter.com/rpjday\nLinkedIn:                               http://ca.linkedin.com/in/rpjday\n========================================================================\n\n"},{"id":"371099","messageId":"xmqqsgvukvc6.fsf@gitster-ct.c.googlers.com","threadId":"50625","inReplyTo":"alpine.LFD.2.21.1903091309130.16641@localhost.localdomain","subject":"Re: is it \"git gc --prune=now\" or \"git gc --prune=all\"?","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2019-03-11T02:18:01Z","receivedAt":"2019-03-11T02:18:06Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Robert P. J. Day\" <rpjday@crashcourse.ca> writes:\n\n> On Wed, 6 Mar 2019, Junio C Hamano wrote:\n>\n>> Jeff King <peff@peff.net> writes:\n>>\n>> > ... I do think the documentation should recommend \"now\". Possibly\n>> > builtin/gc.c should be smarter about recognizing \"all\" in the\n>> > conditional you quoted, too, though I don't know that it's all\n>> > that important (especially if we tweak the documentation).\n>>\n>> Yup, as the placeholder for the value is labeled as \"<date>\", \"now\"\n>> would be the one we should be encouraging.\n>\n>   i can submit an obviously trivial patch for that\n\nYou already did to turn --prune=all into --prune=now in the doc, I\nthink.\n\nDo we encourage 'false' where we should encourage 'never'?  I see we\ndo not even mention the negative form in git-gc manpage, and I think\nit is a good thing, especially because --prune=<date> is listed just\nnext to --no-prune, which is even more explicit.\n\n\n"}]}