diff options
-rw-r--r-- | builtin/gc.c | 2 | ||||
-rwxr-xr-x | t/t6500-gc.sh | 21 |
2 files changed, 22 insertions, 1 deletions
diff --git a/builtin/gc.c b/builtin/gc.c index 06ddd3aea5..91ffb1a803 100644 --- a/builtin/gc.c +++ b/builtin/gc.c @@ -647,7 +647,7 @@ int cmd_gc(int argc, const char **argv, const char *prefix) if (gc_write_commit_graph) write_commit_graph_reachable(get_object_directory(), 0, - !daemonized); + !quiet && !daemonized); if (auto_gc && too_many_loose_objects()) warning(_("There are too many unreachable loose objects; " diff --git a/t/t6500-gc.sh b/t/t6500-gc.sh index 818435f04e..b3fbd87ee7 100755 --- a/t/t6500-gc.sh +++ b/t/t6500-gc.sh @@ -4,6 +4,7 @@ test_description='basic git gc tests ' . ./test-lib.sh +. "$TEST_DIRECTORY"/lib-terminal.sh test_expect_success 'setup' ' # do not let the amount of physical memory affects gc @@ -99,6 +100,26 @@ test_expect_success 'auto gc with too many loose objects does not attempt to cre test_line_count = 2 new # There is one new pack and its .idx ' +test_expect_success 'gc --no-quiet' ' + git -c gc.writeCommitGraph=true gc --no-quiet >stdout 2>stderr && + test_must_be_empty stdout && + test_line_count = 1 stderr && + test_i18ngrep "Computing commit graph generation numbers" stderr +' + +test_expect_success TTY 'with TTY: gc --no-quiet' ' + test_terminal git -c gc.writeCommitGraph=true gc --no-quiet >stdout 2>stderr && + test_must_be_empty stdout && + test_i18ngrep "Enumerating objects" stderr && + test_i18ngrep "Computing commit graph generation numbers" stderr +' + +test_expect_success 'gc --quiet' ' + git -c gc.writeCommitGraph=true gc --quiet >stdout 2>stderr && + test_must_be_empty stdout && + test_must_be_empty stderr +' + run_and_wait_for_auto_gc () { # We read stdout from gc for the side effect of waiting until the # background gc process exits, closing its fd 9. Furthermore, the |