diff options
author | Junio C Hamano <gitster@pobox.com> | 2017-04-19 21:37:22 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-04-19 21:37:22 -0700 |
commit | 442136f742b18872b292cc37ae4809d746791043 (patch) | |
tree | f84190f296565641af2c56821fc1c01e6ba555eb | |
parent | 2f9dfb83d7665940ad09464adc70f73ecf01cc03 (diff) | |
parent | ef09036cf34c2e5704c753a4ffb3c947a89402af (diff) | |
download | git-442136f742b18872b292cc37ae4809d746791043.tar.gz |
Merge branch 'dt/gc-ignore-old-gc-logs'
* dt/gc-ignore-old-gc-logs:
t6500: wait for detached auto gc at the end of the test script
-rwxr-xr-x | t/t6500-gc.sh | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/t/t6500-gc.sh b/t/t6500-gc.sh index 08de2e8ab0..cc7acd101d 100755 --- a/t/t6500-gc.sh +++ b/t/t6500-gc.sh @@ -67,6 +67,16 @@ 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 ' +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 + # variable assignment from a command substitution preserves the + # exit status of the main gc process. + # Note: this fd trickery doesn't work on Windows, but there is no + # need to, because on Win the auto gc always runs in the foreground. + doesnt_matter=$(git gc --auto 9>&1) +} + test_expect_success 'background auto gc does not run if gc.log is present and recent but does if it is old' ' test_commit foo && test_commit bar && @@ -80,7 +90,13 @@ test_expect_success 'background auto gc does not run if gc.log is present and re test-chmtime =-345600 .git/gc.log && test_must_fail git gc --auto && test_config gc.logexpiry 2.days && - git gc --auto + run_and_wait_for_auto_gc && + ls .git/objects/pack/pack-*.pack >packs && + test_line_count = 1 packs ' +# DO NOT leave a detached auto gc process running near the end of the +# test script: it can run long enough in the background to racily +# interfere with the cleanup in 'test_done'. + test_done |