* [PATCH] Recommend "git gc --auto" instead of "git prune" @ 2020-06-07 16:18 John Lin via GitGitGadget 2020-06-07 16:25 ` brian m. carlson 0 siblings, 1 reply; 5+ messages in thread From: John Lin via GitGitGadget @ 2020-06-07 16:18 UTC (permalink / raw) To: git; +Cc: John Lin, John Lin From: John Lin <johnlinp@gmail.com> Signed-off-by: John Lin <johnlinp@gmail.com> --- Recommend "git gc --auto" instead of "git prune" Fix according to #642. Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-651%2Fjohnlinp%2Ffix-git-gc-warning-message-v1 Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-651/johnlinp/fix-git-gc-warning-message-v1 Pull-Request: https://github.com/gitgitgadget/git/pull/651 builtin/gc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builtin/gc.c b/builtin/gc.c index 8e0b9cf41b3..3833a3de332 100644 --- a/builtin/gc.c +++ b/builtin/gc.c @@ -692,7 +692,7 @@ int cmd_gc(int argc, const char **argv, const char *prefix) if (auto_gc && too_many_loose_objects()) warning(_("There are too many unreachable loose objects; " - "run 'git prune' to remove them.")); + "run 'git gc --auto' to remove them.")); if (!daemonized) unlink(git_path("gc.log")); base-commit: 20514004ddf1a3528de8933bc32f284e175e1012 -- gitgitgadget ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] Recommend "git gc --auto" instead of "git prune" 2020-06-07 16:18 [PATCH] Recommend "git gc --auto" instead of "git prune" John Lin via GitGitGadget @ 2020-06-07 16:25 ` brian m. carlson 2020-06-07 17:10 ` Junio C Hamano 0 siblings, 1 reply; 5+ messages in thread From: brian m. carlson @ 2020-06-07 16:25 UTC (permalink / raw) To: John Lin via GitGitGadget; +Cc: git, John Lin [-- Attachment #1: Type: text/plain, Size: 1461 bytes --] On 2020-06-07 at 16:18:35, John Lin via GitGitGadget wrote: > From: John Lin <johnlinp@gmail.com> > > Signed-off-by: John Lin <johnlinp@gmail.com> > --- > Recommend "git gc --auto" instead of "git prune" > > Fix according to #642. > > Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-651%2Fjohnlinp%2Ffix-git-gc-warning-message-v1 > Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-651/johnlinp/fix-git-gc-warning-message-v1 > Pull-Request: https://github.com/gitgitgadget/git/pull/651 > > builtin/gc.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/builtin/gc.c b/builtin/gc.c > index 8e0b9cf41b3..3833a3de332 100644 > --- a/builtin/gc.c > +++ b/builtin/gc.c > @@ -692,7 +692,7 @@ int cmd_gc(int argc, const char **argv, const char *prefix) > > if (auto_gc && too_many_loose_objects()) > warning(_("There are too many unreachable loose objects; " > - "run 'git prune' to remove them.")); > + "run 'git gc --auto' to remove them.")); I'm not sure this is correct. If we have just expelled a large number of objects from a pack into loose objects because they're no longer referenced, it's possible we may trigger another git gc --auto on the next time we run a command. If so, no amount of git gc --auto is going to help here; you really have to run git prune. -- brian m. carlson: Houston, Texas, US OpenPGP: https://keybase.io/bk2204 [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 263 bytes --] ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Recommend "git gc --auto" instead of "git prune" 2020-06-07 16:25 ` brian m. carlson @ 2020-06-07 17:10 ` Junio C Hamano 2020-06-07 20:45 ` Denton Liu 0 siblings, 1 reply; 5+ messages in thread From: Junio C Hamano @ 2020-06-07 17:10 UTC (permalink / raw) To: brian m. carlson; +Cc: John Lin via GitGitGadget, git, John Lin "brian m. carlson" <sandals@crustytoothpaste.net> writes: >> diff --git a/builtin/gc.c b/builtin/gc.c >> index 8e0b9cf41b3..3833a3de332 100644 >> --- a/builtin/gc.c >> +++ b/builtin/gc.c >> @@ -692,7 +692,7 @@ int cmd_gc(int argc, const char **argv, const char *prefix) >> >> if (auto_gc && too_many_loose_objects()) >> warning(_("There are too many unreachable loose objects; " >> - "run 'git prune' to remove them.")); >> + "run 'git gc --auto' to remove them.")); > > I'm not sure this is correct. If we have just expelled a large number > of objects from a pack into loose objects because they're no longer > referenced, it's possible we may trigger another git gc --auto on the > next time we run a command. If so, no amount of git gc --auto is going > to help here; you really have to run git prune. Correct. When running manually, after noticing the need to do a GC, it is a mental bug to add "--auto" to it, I would think. ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Recommend "git gc --auto" instead of "git prune" 2020-06-07 17:10 ` Junio C Hamano @ 2020-06-07 20:45 ` Denton Liu 2020-06-08 17:34 ` Junio C Hamano 0 siblings, 1 reply; 5+ messages in thread From: Denton Liu @ 2020-06-07 20:45 UTC (permalink / raw) To: Junio C Hamano; +Cc: brian m. carlson, John Lin via GitGitGadget, git, John Lin Hi all, On Sun, Jun 07, 2020 at 10:10:19AM -0700, Junio C Hamano wrote: > "brian m. carlson" <sandals@crustytoothpaste.net> writes: > > >> diff --git a/builtin/gc.c b/builtin/gc.c > >> index 8e0b9cf41b3..3833a3de332 100644 > >> --- a/builtin/gc.c > >> +++ b/builtin/gc.c > >> @@ -692,7 +692,7 @@ int cmd_gc(int argc, const char **argv, const char *prefix) > >> > >> if (auto_gc && too_many_loose_objects()) > >> warning(_("There are too many unreachable loose objects; " > >> - "run 'git prune' to remove them.")); > >> + "run 'git gc --auto' to remove them.")); > > > > I'm not sure this is correct. If we have just expelled a large number > > of objects from a pack into loose objects because they're no longer > > referenced, it's possible we may trigger another git gc --auto on the > > next time we run a command. If so, no amount of git gc --auto is going > > to help here; you really have to run git prune. > > Correct. When running manually, after noticing the need to do a GC, > it is a mental bug to add "--auto" to it, I would think. Sorry about the confusion, when I was responding to the original issue[0], I mistakenly typed the wrong thing. I meant to suggest replacing it with `git gc --prune=now`, _not_ `git gc --auto` but I guess I had my wires crossed. With this in mind... The rationale behind this change is that John wanted to add bash completions for `git prune`. However, I noted that prune is a plumbing command and users should opt to use `git gc` instead. He mentioned that sometimes when auto gc runs, it tells the user that they should run `git prune` so I suggested (meant to suggest) replacing the command with `git gc --prune=now` instead so that users could call the porcelain. [0]: https://github.com/gitgitgadget/git/issues/642 ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Recommend "git gc --auto" instead of "git prune" 2020-06-07 20:45 ` Denton Liu @ 2020-06-08 17:34 ` Junio C Hamano 0 siblings, 0 replies; 5+ messages in thread From: Junio C Hamano @ 2020-06-08 17:34 UTC (permalink / raw) To: Denton Liu; +Cc: brian m. carlson, John Lin via GitGitGadget, git, John Lin Denton Liu <liu.denton@gmail.com> writes: >> Correct. When running manually, after noticing the need to do a GC, >> it is a mental bug to add "--auto" to it, I would think. > > Sorry about the confusion, when I was responding to the original > issue[0], I mistakenly typed the wrong thing. I meant to suggest > replacing it with `git gc --prune=now`, _not_ `git gc --auto` but I > guess I had my wires crossed. With this in mind... > > The rationale behind this change is that John wanted to add bash > completions for `git prune`. However, I noted that prune is a plumbing > command and users should opt to use `git gc` instead. He mentioned that > sometimes when auto gc runs, it tells the user that they should run > `git prune` so I suggested (meant to suggest) replacing the command with > `git gc --prune=now` instead so that users could call the porcelain. Nice to know. The reasoning behind the change should be available to those who only look at "git show". John, if you are to send an updated patch, please make sure you have a meaningful log message in it. Thanks. ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-06-08 17:34 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2020-06-07 16:18 [PATCH] Recommend "git gc --auto" instead of "git prune" John Lin via GitGitGadget 2020-06-07 16:25 ` brian m. carlson 2020-06-07 17:10 ` Junio C Hamano 2020-06-07 20:45 ` Denton Liu 2020-06-08 17:34 ` Junio C Hamano
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 NNTP newsgroup(s).