summaryrefslogtreecommitdiff
path: root/t/t6500-gc.sh
diff options
context:
space:
mode:
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>2022-03-17 10:13:12 (GMT)
committerJunio C Hamano <gitster@pobox.com>2022-03-17 15:40:26 (GMT)
commitd7ef03681fbcbd0314d91c71d60f79a51338690a (patch)
tree0e2631623a87590a2a630fbcf4afe0063028aea5 /t/t6500-gc.sh
parentf818f7f725e4a49296e9e28cf3bb26aa8a1bf3ba (diff)
downloadgit-d7ef03681fbcbd0314d91c71d60f79a51338690a.zip
git-d7ef03681fbcbd0314d91c71d60f79a51338690a.tar.gz
git-d7ef03681fbcbd0314d91c71d60f79a51338690a.tar.bz2
gc + p4 tests: use "test_hook", remove sub-shells
Refactor the repository setup code for tests that test hooks the use of sub-shells when setting up the test repository and hooks, and use the "test_hook" wrapper instead of "write_scripts". Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t6500-gc.sh')
-rwxr-xr-xt/t6500-gc.sh22
1 files changed, 10 insertions, 12 deletions
diff --git a/t/t6500-gc.sh b/t/t6500-gc.sh
index c202126..cd6c533 100755
--- a/t/t6500-gc.sh
+++ b/t/t6500-gc.sh
@@ -101,12 +101,12 @@ test_expect_success 'pre-auto-gc hook can stop auto gc' '
EOF
git init pre-auto-gc-hook &&
+ test_hook -C pre-auto-gc-hook pre-auto-gc <<-\EOF &&
+ echo >&2 no gc for you &&
+ exit 1
+ EOF
(
cd pre-auto-gc-hook &&
- write_script ".git/hooks/pre-auto-gc" <<-\EOF &&
- echo >&2 no gc for you &&
- exit 1
- EOF
git config gc.auto 3 &&
git config gc.autoDetach false &&
@@ -128,14 +128,12 @@ test_expect_success 'pre-auto-gc hook can stop auto gc' '
See "git help gc" for manual housekeeping.
EOF
- (
- cd pre-auto-gc-hook &&
- write_script ".git/hooks/pre-auto-gc" <<-\EOF &&
- echo >&2 will gc for you &&
- exit 0
- EOF
- git gc --auto >../out.actual 2>../err.actual
- ) &&
+ test_hook -C pre-auto-gc-hook --clobber pre-auto-gc <<-\EOF &&
+ echo >&2 will gc for you &&
+ exit 0
+ EOF
+
+ git -C pre-auto-gc-hook gc --auto >out.actual 2>err.actual &&
test_must_be_empty out.actual &&
test_cmp err.expect err.actual