[PATCH 2/8] t7900: setup and tear down clones
- From
Kristoffer Haugsbakk <code@khaugsbakk.name>
- Date
- Oct 14, 2023, 21:45 UTC
- Message-ID
- <e3987cda75e4db72393f85de4bbb71d2ebaa097b.1697319294.git.code@khaugsbakk.name>
- In-Reply-To
- <cover.1697319294.git.code@khaugsbakk.name>
Test `loose-objects task` depends on the two clones setup in `prefetch multiple remotes`.
Reuse the two clones setup and tear down the clones afterwards in both tests.
Signed-off-by: Kristoffer Haugsbakk <code@khaugsbakk.name> --- t/t7900-maintenance.sh | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+)
diff --git a/t/t7900-maintenance.sh b/t/t7900-maintenance.sh index ca86b2ba687..ebc207f1a58 100755 --- a/t/t7900-maintenance.sh +++ b/t/t7900-maintenance.sh @@ -145,6 +145,12 @@ test_expect_success 'run --task=prefetch with no remotes' ' ' test_expect_success 'prefetch multiple remotes' ' + test_when_finished rm -r clone1 && + test_when_finished rm -r clone2 && + test_when_finished git remote remove remote1 && + test_when_finished git remote remove remote2 && + test_when_finished git tag --delete one && + test_when_finished git tag --delete two && git clone . clone1 && git clone . clone2 && git remote add remote1 "file://$(pwd)/clone1" && @@ -175,6 +181,22 @@ test_expect_success 'prefetch multiple remotes' ' ' test_expect_success 'loose-objects task' ' + test_when_finished rm -r clone1 && + test_when_finished rm -r clone2 && + test_when_finished git remote remove remote1 && + test_when_finished git remote remove remote2 && + test_when_finished git tag --delete one && + test_when_finished git tag --delete two && + git clone . clone1 && + git clone . clone2 && + git remote add remote1 "file://$(pwd)/clone1" && + git remote add remote2 "file://$(pwd)/clone2" && + git -C clone1 switch -c one && + git -C clone2 switch -c two && + test_commit -C clone1 one && + test_commit -C clone2 two && + git fetch --all && + # Repack everything so we know the state of the object dir git repack -adk &&
-- 2.42.0.2.g879ad04204