{"thread":{"id":"53630","subject":"[PATCH] Recommend \"git gc --auto\" instead of \"git prune\"","startedAt":"2020-06-07T16:18:40Z","lastAt":"2020-06-08T17:34:25Z","messageCount":5,"participants":["John Lin via GitGitGadget","brian m. carlson","Junio C Hamano","Denton Liu"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"399243","messageId":"pull.651.git.1591546715913.gitgitgadget@gmail.com","threadId":"53630","inReplyTo":null,"subject":"[PATCH] Recommend \"git gc --auto\" instead of \"git prune\"","fromName":"John Lin via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2020-06-07T16:18:35Z","receivedAt":"2020-06-07T16:18:40Z","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 --auto\" instead of \"git prune\"\n    \n    Fix according to #642.\n\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-651%2Fjohnlinp%2Ffix-git-gc-warning-message-v1\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-651/johnlinp/fix-git-gc-warning-message-v1\nPull-Request: https://github.com/gitgitgadget/git/pull/651\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..3833a3de332 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 --auto' to remove them.\"));\n \n \tif (!daemonized)\n \t\tunlink(git_path(\"gc.log\"));\n\nbase-commit: 20514004ddf1a3528de8933bc32f284e175e1012\n-- \ngitgitgadget\n"},{"id":"399248","messageId":"20200607162556.GJ6569@camp.crustytoothpaste.net","threadId":"53630","inReplyTo":"pull.651.git.1591546715913.gitgitgadget@gmail.com","subject":"Re: [PATCH] Recommend \"git gc --auto\" instead of \"git prune\"","fromName":"brian m. carlson","fromEmail":"sandals@crustytoothpaste.net","sentAt":"2020-06-07T16:25:56Z","receivedAt":"2020-06-07T16:26:37Z","isPatch":true,"sender":{"key":"sandals@crustytoothpaste.net","avatar":"https://avatars.githubusercontent.com/u/497054?v=4"},"body":"On 2020-06-07 at 16:18:35, John Lin via GitGitGadget wrote:\n> From: John Lin <johnlinp@gmail.com>\n> \n> Signed-off-by: John Lin <johnlinp@gmail.com>\n> ---\n>     Recommend \"git gc --auto\" instead of \"git prune\"\n>     \n>     Fix according to #642.\n> \n> Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-651%2Fjohnlinp%2Ffix-git-gc-warning-message-v1\n> Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-651/johnlinp/fix-git-gc-warning-message-v1\n> Pull-Request: https://github.com/gitgitgadget/git/pull/651\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..3833a3de332 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 --auto' to remove them.\"));\n\nI'm not sure this is correct.  If we have just expelled a large number\nof objects from a pack into loose objects because they're no longer\nreferenced, it's possible we may trigger another git gc --auto on the\nnext time we run a command.  If so, no amount of git gc --auto is going\nto help here; you really have to run git prune.\n-- \nbrian m. carlson: Houston, Texas, US\nOpenPGP: https://keybase.io/bk2204\n"},{"id":"399251","messageId":"xmqq8sgyn6o4.fsf@gitster.c.googlers.com","threadId":"53630","inReplyTo":"20200607162556.GJ6569@camp.crustytoothpaste.net","subject":"Re: [PATCH] Recommend \"git gc --auto\" instead of \"git prune\"","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2020-06-07T17:10:19Z","receivedAt":"2020-06-07T17:10:26Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"brian m. carlson\" <sandals@crustytoothpaste.net> writes:\n\n>> diff --git a/builtin/gc.c b/builtin/gc.c\n>> index 8e0b9cf41b3..3833a3de332 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 --auto' to remove them.\"));\n>\n> I'm not sure this is correct.  If we have just expelled a large number\n> of objects from a pack into loose objects because they're no longer\n> referenced, it's possible we may trigger another git gc --auto on the\n> next time we run a command.  If so, no amount of git gc --auto is going\n> to help here; you really have to run git prune.\n\nCorrect.  When running manually, after noticing the need to do a GC,\nit is a mental bug to add \"--auto\" to it, I would think.\n"},{"id":"399264","messageId":"20200607204531.GA2313@generichostname","threadId":"53630","inReplyTo":"xmqq8sgyn6o4.fsf@gitster.c.googlers.com","subject":"Re: [PATCH] Recommend \"git gc --auto\" instead of \"git prune\"","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2020-06-07T20:45:31Z","receivedAt":"2020-06-07T20:45:36Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"Hi all,\n\nOn Sun, Jun 07, 2020 at 10:10:19AM -0700, Junio C Hamano wrote:\n> \"brian m. carlson\" <sandals@crustytoothpaste.net> writes:\n> \n> >> diff --git a/builtin/gc.c b/builtin/gc.c\n> >> index 8e0b9cf41b3..3833a3de332 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 --auto' to remove them.\"));\n> >\n> > I'm not sure this is correct.  If we have just expelled a large number\n> > of objects from a pack into loose objects because they're no longer\n> > referenced, it's possible we may trigger another git gc --auto on the\n> > next time we run a command.  If so, no amount of git gc --auto is going\n> > to help here; you really have to run git prune.\n> \n> Correct.  When running manually, after noticing the need to do a GC,\n> it is a mental bug to add \"--auto\" to it, I would think.\n\nSorry about the confusion, when I was responding to the original\nissue[0], I mistakenly typed the wrong thing. I meant to suggest\nreplacing it with `git gc --prune=now`, _not_ `git gc --auto` but I\nguess I had my wires crossed. With this in mind...\n\nThe rationale behind this change is that John wanted to add bash\ncompletions for `git prune`. However, I noted that prune is a plumbing\ncommand and users should opt to use `git gc` instead. He mentioned that\nsometimes when auto gc runs, it tells the user that they should run\n`git prune` so I suggested (meant to suggest) replacing the command with\n`git gc --prune=now` instead so that users could call the porcelain.\n\n[0]: https://github.com/gitgitgadget/git/issues/642\n"},{"id":"399308","messageId":"xmqqd069law7.fsf@gitster.c.googlers.com","threadId":"53630","inReplyTo":"20200607204531.GA2313@generichostname","subject":"Re: [PATCH] Recommend \"git gc --auto\" instead of \"git prune\"","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2020-06-08T17:34:16Z","receivedAt":"2020-06-08T17:34:25Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Denton Liu <liu.denton@gmail.com> writes:\n\n>> Correct.  When running manually, after noticing the need to do a GC,\n>> it is a mental bug to add \"--auto\" to it, I would think.\n>\n> Sorry about the confusion, when I was responding to the original\n> issue[0], I mistakenly typed the wrong thing. I meant to suggest\n> replacing it with `git gc --prune=now`, _not_ `git gc --auto` but I\n> guess I had my wires crossed. With this in mind...\n>\n> The rationale behind this change is that John wanted to add bash\n> completions for `git prune`. However, I noted that prune is a plumbing\n> command and users should opt to use `git gc` instead. He mentioned that\n> sometimes when auto gc runs, it tells the user that they should run\n> `git prune` so I suggested (meant to suggest) replacing the command with\n> `git gc --prune=now` instead so that users could call the porcelain.\n\nNice to know.  The reasoning behind the change should be available\nto those who only look at \"git show\".\n\nJohn, if you are to send an updated patch, please make sure you have\na meaningful log message in it.\n\nThanks.\n"}]}