Re: [PATCH] Recommend "git gc --auto" instead of "git prune"

2 messages, 2 authors, 2020-06-07 · open the first message on its own page

Re: [PATCH] Recommend "git gc --auto" instead of "git prune"

From: Junio C Hamano <hidden>
Date: 2020-06-07 17:10:26

"brian m. carlson" [off-list ref] writes:
quoted
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.

Re: [PATCH] Recommend "git gc --auto" instead of "git prune"

From: Denton Liu <hidden>
Date: 2020-06-07 20:45:36

Hi all,

On Sun, Jun 07, 2020 at 10:10:19AM -0700, Junio C Hamano wrote:
"brian m. carlson" [off-list ref] writes:
quoted
quoted
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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help