{"thread":{"id":"53633","subject":"[PATCH] Recommend \"git gc --prune=now\" instead of \"git prune\"","startedAt":"2020-06-08T02:02:25Z","lastAt":"2020-06-10T07:38:22Z","messageCount":9,"participants":["John Lin via GitGitGadget","Denton Liu","Junio C Hamano","Ævar Arnfjörð Bjarmason","林自均"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"399269","messageId":"pull.652.git.1591581739031.gitgitgadget@gmail.com","threadId":"53633","inReplyTo":null,"subject":"[PATCH] Recommend \"git gc --prune=now\" instead of \"git prune\"","fromName":"John Lin via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2020-06-08T02:02:18Z","receivedAt":"2020-06-08T02:02:25Z","isPatch":true,"sender":{"key":"johnlinp@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1290376?v=4"},"body":"From: John Lin <johnlinp@gmail.com>\n\nSigned-off-by: John Lin <johnlinp@gmail.com>\n---\n    Recommend \"git gc --prune=now\" instead of \"git prune\"\n    \n    Signed-off-by: John Lin johnlinp@gmail.com [johnlinp@gmail.com]\n    \n    Fix according to #642.\n\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-652%2Fjohnlinp%2Ffix-git-gc-warning-message-v1\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-652/johnlinp/fix-git-gc-warning-message-v1\nPull-Request: https://github.com/gitgitgadget/git/pull/652\n\n builtin/gc.c | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/builtin/gc.c b/builtin/gc.c\nindex 8e0b9cf41b3..74185eac917 100644\n--- a/builtin/gc.c\n+++ b/builtin/gc.c\n@@ -692,7 +692,7 @@ int cmd_gc(int argc, const char **argv, const char *prefix)\n \n \tif (auto_gc && too_many_loose_objects())\n \t\twarning(_(\"There are too many unreachable loose objects; \"\n-\t\t\t\"run 'git prune' to remove them.\"));\n+\t\t\t\"run 'git gc --prune=now' to remove them.\"));\n \n \tif (!daemonized)\n \t\tunlink(git_path(\"gc.log\"));\n\nbase-commit: 20514004ddf1a3528de8933bc32f284e175e1012\n-- \ngitgitgadget\n"},{"id":"399288","messageId":"20200608101720.GA33389@generichostname","threadId":"53633","inReplyTo":"pull.652.git.1591581739031.gitgitgadget@gmail.com","subject":"Re: [PATCH] Recommend \"git gc --prune=now\" instead of \"git prune\"","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2020-06-08T10:17:20Z","receivedAt":"2020-06-08T10:17:27Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"Hi John,\n\nThanks for working on this topic.\n\nOn Mon, Jun 08, 2020 at 02:02:18AM +0000, John Lin via GitGitGadget wrote:\n> Subject: [PATCH] Recommend \"git gc --prune=now\" instead of \"git prune\"\n\nThe format for subjects is generally \"<area>: <description>\" so perhaps\nsomething like \"git gc: recommend use of `git gc --prune=now`\"?\n\n> From: John Lin <johnlinp@gmail.com>\n> \n> Signed-off-by: John Lin <johnlinp@gmail.com>\n\nThis commit is missing some justification. In the commit message, we\nshould mention that `git prune` is a plumbing command and in the\ndocumentation for it, it mentions that the porcelain `git gc` command\nshould be used instead.\n"},{"id":"399335","messageId":"pull.652.v2.git.1591662224566.gitgitgadget@gmail.com","threadId":"53633","inReplyTo":"pull.652.git.1591581739031.gitgitgadget@gmail.com","subject":"[PATCH v2] gc: recommend `git gc --prune=now` instead of `git prune`","fromName":"John Lin via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2020-06-09T00:23:44Z","receivedAt":"2020-06-09T00:23:56Z","isPatch":true,"sender":{"key":"johnlinp@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1290376?v=4"},"body":"From: John Lin <johnlinp@gmail.com>\n\n`git prune` is a plumbing command and should not be run directly by\nusers. The corresponding porcelain command is `git gc`, which is\nmentioned in the man page of `git prune`.\n\nSigned-off-by: John Lin <johnlinp@gmail.com>\n---\n    Recommend \"git gc --prune=now\" instead of \"git prune\"\n    \n    Signed-off-by: John Lin johnlinp@gmail.com [johnlinp@gmail.com]\n    \n    Fix according to #642.\n\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-652%2Fjohnlinp%2Ffix-git-gc-warning-message-v2\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-652/johnlinp/fix-git-gc-warning-message-v2\nPull-Request: https://github.com/gitgitgadget/git/pull/652\n\nRange-diff vs v1:\n\n 1:  83b7137abfd ! 1:  42aa6380067 Recommend \"git gc --prune=now\" instead of \"git prune\"\n     @@ Metadata\n      Author: John Lin <johnlinp@gmail.com>\n      \n       ## Commit message ##\n     -    Recommend \"git gc --prune=now\" instead of \"git prune\"\n     +    gc: recommend `git gc --prune=now` instead of `git prune`\n     +\n     +    `git prune` is a plumbing command and should not be run directly by\n     +    users. The corresponding porcelain command is `git gc`, which is\n     +    mentioned in the man page of `git prune`.\n      \n          Signed-off-by: John Lin <johnlinp@gmail.com>\n      \n\n\n builtin/gc.c | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/builtin/gc.c b/builtin/gc.c\nindex 8e0b9cf41b3..74185eac917 100644\n--- a/builtin/gc.c\n+++ b/builtin/gc.c\n@@ -692,7 +692,7 @@ int cmd_gc(int argc, const char **argv, const char *prefix)\n \n \tif (auto_gc && too_many_loose_objects())\n \t\twarning(_(\"There are too many unreachable loose objects; \"\n-\t\t\t\"run 'git prune' to remove them.\"));\n+\t\t\t\"run 'git gc --prune=now' to remove them.\"));\n \n \tif (!daemonized)\n \t\tunlink(git_path(\"gc.log\"));\n\nbase-commit: 20514004ddf1a3528de8933bc32f284e175e1012\n-- \ngitgitgadget\n"},{"id":"399339","messageId":"xmqqv9k0j087.fsf@gitster.c.googlers.com","threadId":"53633","inReplyTo":"pull.652.v2.git.1591662224566.gitgitgadget@gmail.com","subject":"Re: [PATCH v2] gc: recommend `git gc --prune=now` instead of `git prune`","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2020-06-09T05:07:36Z","receivedAt":"2020-06-09T05:07:46Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"John Lin via GitGitGadget\" <gitgitgadget@gmail.com> writes:\n\n> From: John Lin <johnlinp@gmail.com>\n>\n> `git prune` is a plumbing command and should not be run directly by\n> users. The corresponding porcelain command is `git gc`, which is\n> mentioned in the man page of `git prune`.\n\nMuch better than v1 that came without any justification ;-)\n\nI however wouldn't say \"should not\"---that feels a bit too strong (I\npersonally use \"prune\" from the command line once or twice every\nweek and do not see why I should be forbidden from doing so [*1*]),\nbut the users who see this message would not need such a precise\ncontrol afforded by use of \"git prune\", so \"gc --prune=now\" is a\nbetter recommendation.\n\nThanks.\n\n[Footnote]\n\n*1* The command does not even produce a machine readable output.\n    The reason it is not recommended (but that is different from\n    \"should not\") to casual users over \"git gc\" is because it is a\n    very focused tool (it is only about removing loose objects and\n    does not touch other things) and applicable to a very specific\n    condition.  Those who can recognize that they are in that\n    situation should not be forbidden from using it with a dogmatic\n    \"should not\".\n\n"},{"id":"399345","messageId":"87bllsa47u.fsf@evledraar.gmail.com","threadId":"53633","inReplyTo":"pull.652.v2.git.1591662224566.gitgitgadget@gmail.com","subject":"Re: [PATCH v2] gc: recommend `git gc --prune=now` instead of `git prune`","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2020-06-09T11:06:13Z","receivedAt":"2020-06-09T11:06:20Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"\nOn Tue, Jun 09 2020, John Lin via GitGitGadget wrote:\n\n> From: John Lin <johnlinp@gmail.com>\n>\n> `git prune` is a plumbing command and should not be run directly by\n> users. The corresponding porcelain command is `git gc`, which is\n> mentioned in the man page of `git prune`.\n\nThis change feels incomplete without a change to git-prune's\ndocumentation, see 8d308b3540 (\"Documentation: point git-prune users to\ngit-gc\", 2008-04-29).\n\nI.e. it still talks about \"in most cases you shouldn't run this\", but\nhere we are removing a case where it would otherwise make sense because\nthe user shouldn't use it directly.\n\nI think instead the small change that makes the most sense here is to\njust add \"prune\" to completions, i.e. I disagree with Denton Liu in\nhttps://github.com/gitgitgadget/git/issues/642#issuecomment-640202110\n\nThe \"right\" change is much harder, there's numerous odd edge cases that\n\"gc\" can get into with these loose objects (for the curious [1] and [2]\nare a nice entry to that rabbit hole).\n\nFixing that is non-trivial, but in the meantime I don't think it's good\nto:\n\n a) Recommend an option to \"gc\" which implies \"repack -a\", which as\n    noted in gc's docs can produce corruption in a live repository.\n\n    I.e. I don't think \"let's not recommend this plumbing\" should lead\n    us to \"let's recommend this thing that could corrupt the repository\n    instead\".\n\n b) Even if you don't get the corruption with \"a\" above \"gc --prune=now\"\n    will produce a very differently packed repository. This might have\n    unexpected performance etc. trade-offs the user wasn't expecting\n    from a \"run this for a quick fix\" command.\n\n c) In the cases where \"prune\" here would help, e.g. on some large repo\n    where something else added a lot of loose unreachable objects during\n    the \"gc\" for some reason recommending a full \"gc\" might take a lot\n    more time than just the \"prune\".\n\n1. https://public-inbox.org/git/87eflvmovg.fsf@evledraar.gmail.com/\n2. https://public-inbox.org/git/8736lnxlig.fsf@evledraar.gmail.com/\n\n> Signed-off-by: John Lin <johnlinp@gmail.com>\n> ---\n>     Recommend \"git gc --prune=now\" instead of \"git prune\"\n>\n>     Signed-off-by: John Lin johnlinp@gmail.com [johnlinp@gmail.com]\n>\n>     Fix according to #642.\n>\n> Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-652%2Fjohnlinp%2Ffix-git-gc-warning-message-v2\n> Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-652/johnlinp/fix-git-gc-warning-message-v2\n> Pull-Request: https://github.com/gitgitgadget/git/pull/652\n>\n> Range-diff vs v1:\n>\n>  1:  83b7137abfd ! 1:  42aa6380067 Recommend \"git gc --prune=now\" instead of \"git prune\"\n>      @@ Metadata\n>       Author: John Lin <johnlinp@gmail.com>\n>\n>        ## Commit message ##\n>      -    Recommend \"git gc --prune=now\" instead of \"git prune\"\n>      +    gc: recommend `git gc --prune=now` instead of `git prune`\n>      +\n>      +    `git prune` is a plumbing command and should not be run directly by\n>      +    users. The corresponding porcelain command is `git gc`, which is\n>      +    mentioned in the man page of `git prune`.\n>\n>           Signed-off-by: John Lin <johnlinp@gmail.com>\n>\n>\n>\n>  builtin/gc.c | 2 +-\n>  1 file changed, 1 insertion(+), 1 deletion(-)\n>\n> diff --git a/builtin/gc.c b/builtin/gc.c\n> index 8e0b9cf41b3..74185eac917 100644\n> --- a/builtin/gc.c\n> +++ b/builtin/gc.c\n> @@ -692,7 +692,7 @@ int cmd_gc(int argc, const char **argv, const char *prefix)\n>\n>  \tif (auto_gc && too_many_loose_objects())\n>  \t\twarning(_(\"There are too many unreachable loose objects; \"\n> -\t\t\t\"run 'git prune' to remove them.\"));\n> +\t\t\t\"run 'git gc --prune=now' to remove them.\"));\n>\n>  \tif (!daemonized)\n>  \t\tunlink(git_path(\"gc.log\"));\n>\n> base-commit: 20514004ddf1a3528de8933bc32f284e175e1012\n"},{"id":"399348","messageId":"xmqqa71ci5vd.fsf@gitster.c.googlers.com","threadId":"53633","inReplyTo":"87bllsa47u.fsf@evledraar.gmail.com","subject":"Re: [PATCH v2] gc: recommend `git gc --prune=now` instead of `git prune`","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2020-06-09T16:03:18Z","receivedAt":"2020-06-09T16:03:26Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:\n\n> On Tue, Jun 09 2020, John Lin via GitGitGadget wrote:\n>\n>> From: John Lin <johnlinp@gmail.com>\n>>\n>> `git prune` is a plumbing command and should not be run directly by\n>> users. The corresponding porcelain command is `git gc`, which is\n>> mentioned in the man page of `git prune`.\n>\n> This change feels incomplete without a change to git-prune's\n> documentation, see 8d308b3540 (\"Documentation: point git-prune users to\n> git-gc\", 2008-04-29).\n>\n> I.e. it still talks about \"in most cases you shouldn't run this\", but\n> here we are removing a case where it would otherwise make sense because\n> the user shouldn't use it directly.\n>\n> I think instead the small change that makes the most sense here is to\n> just add \"prune\" to completions,...\n\nThat's perfectly reasonable stance to take.\n"},{"id":"399384","messageId":"CAKO26MuO6UR8c5U+WX0ayEJjmXEnsp9P=ujZGwasM7KbrUgcRw@mail.gmail.com","threadId":"53633","inReplyTo":"xmqqa71ci5vd.fsf@gitster.c.googlers.com","subject":"Re: [PATCH v2] gc: recommend `git gc --prune=now` instead of `git prune`","fromName":"林自均","fromEmail":"johnlinp@gmail.com","sentAt":"2020-06-10T03:43:09Z","receivedAt":"2020-06-10T03:43:24Z","isPatch":true,"sender":{"key":"johnlinp@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1290376?v=4"},"body":"Hi all,\n\nThank you Bjarmason & Junio. If Denton doesn't have other concerns,\nI'll start working on adding bash completion for \"git prune\".\n\nBest,\nJohn Lin\n\nJunio C Hamano <gitster@pobox.com> 於 2020年6月10日 週三 上午12:03寫道：\n>\n> Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:\n>\n> > On Tue, Jun 09 2020, John Lin via GitGitGadget wrote:\n> >\n> >> From: John Lin <johnlinp@gmail.com>\n> >>\n> >> `git prune` is a plumbing command and should not be run directly by\n> >> users. The corresponding porcelain command is `git gc`, which is\n> >> mentioned in the man page of `git prune`.\n> >\n> > This change feels incomplete without a change to git-prune's\n> > documentation, see 8d308b3540 (\"Documentation: point git-prune users to\n> > git-gc\", 2008-04-29).\n> >\n> > I.e. it still talks about \"in most cases you shouldn't run this\", but\n> > here we are removing a case where it would otherwise make sense because\n> > the user shouldn't use it directly.\n> >\n> > I think instead the small change that makes the most sense here is to\n> > just add \"prune\" to completions,...\n>\n> That's perfectly reasonable stance to take.\n"},{"id":"399385","messageId":"20200610034759.GA18542@generichostname","threadId":"53633","inReplyTo":"CAKO26MuO6UR8c5U+WX0ayEJjmXEnsp9P=ujZGwasM7KbrUgcRw@mail.gmail.com","subject":"Re: [PATCH v2] gc: recommend `git gc --prune=now` instead of `git prune`","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2020-06-10T03:47:59Z","receivedAt":"2020-06-10T03:48:07Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"On Wed, Jun 10, 2020 at 11:43:09AM +0800, 林自均 wrote:\n> Hi all,\n> \n> Thank you Bjarmason & Junio. If Denton doesn't have other concerns,\n> I'll start working on adding bash completion for \"git prune\".\n\nNo concerns. Thanks for contributing!\n"},{"id":"399399","messageId":"CAKO26MsL0gRafj5GxNs1uAYUMGwuWTjoRz5Kx+Kjg+LyyM_VYA@mail.gmail.com","threadId":"53633","inReplyTo":"20200610034759.GA18542@generichostname","subject":"Re: [PATCH v2] gc: recommend `git gc --prune=now` instead of `git prune`","fromName":"林自均","fromEmail":"johnlinp@gmail.com","sentAt":"2020-06-10T07:38:08Z","receivedAt":"2020-06-10T07:38:22Z","isPatch":true,"sender":{"key":"johnlinp@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1290376?v=4"},"body":"Thanks Denton!\n\nBest,\nJohn Lin\n\nDenton Liu <liu.denton@gmail.com> 於 2020年6月10日 週三 上午11:48寫道：\n>\n> On Wed, Jun 10, 2020 at 11:43:09AM +0800, 林自均 wrote:\n> > Hi all,\n> >\n> > Thank you Bjarmason & Junio. If Denton doesn't have other concerns,\n> > I'll start working on adding bash completion for \"git prune\".\n>\n> No concerns. Thanks for contributing!\n"}]}