This informational message can cause a problem if 'git prune' is spawned
from an auto-gc during receive-pack.  In this case, the informational
message will be sent back over the wire to the git client and the client
will try to interpret it as part of the pack protocol and will produce an

So let's refrain from producing this message unless show_only or verbose
is enabled.

This fixes the test in t5400.

Signed-off-by: Brandon Casey <>
 builtin/prune.c      | 3 ++-
 t/ | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/builtin/prune.c b/builtin/prune.c
index b99b635..6cb9944 100644
--- a/builtin/prune.c
+++ b/builtin/prune.c
@@ -25,7 +25,8 @@ static int prune_tmp_object(const char *path, const char 
                return error("Could not stat '%s'", fullpath);
        if (st.st_mtime > expire)
                return 0;
-       printf("Removing stale temporary file %s\n", fullpath);
+       if (show_only || verbose)
+               printf("Removing stale temporary file %s\n", fullpath);
        if (!show_only)
        return 0;
diff --git a/t/ b/t/
index 04a8791..250c720 100755
--- a/t/
+++ b/t/
@@ -145,7 +145,7 @@ test_expect_success 'push --all excludes remote-tracking 
hierarchy' '
-test_expect_failure 'receive-pack runs auto-gc in remote repo' '
+test_expect_success 'receive-pack runs auto-gc in remote repo' '
        rm -rf parent child &&
        git init parent &&

To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to
More majordomo info at

Reply via email to