From 2b2b72d113f0332ffefb89e7a1ed94ae372a7592 Mon Sep 17 00:00:00 2001 From: Sebastian Ullrich Date: Thu, 29 Jan 2026 18:43:31 +0100 Subject: [PATCH] test: more .git cleanup (#12238) Co-authored-by: Mac Malone --- tests/lake/tests/clone/test.sh | 10 ++-------- tests/lake/tests/manifest/test.sh | 10 ++-------- tests/lake/tests/packageOverrides/test.sh | 10 ++-------- tests/pkg/ver_clash/test.sh | 8 +++++++- 4 files changed, 13 insertions(+), 25 deletions(-) diff --git a/tests/lake/tests/clone/test.sh b/tests/lake/tests/clone/test.sh index cf4a144a00..b3ba81f1f5 100755 --- a/tests/lake/tests/clone/test.sh +++ b/tests/lake/tests/clone/test.sh @@ -6,20 +6,13 @@ source ../common.sh # Test Lake's management of a single Git-cloned dependency. echo "# SETUP" -set -x mkdir hello pushd hello $LAKE init hello rm -f lean-toolchain $LAKE update -git init -git checkout -b master -git config user.name test -git config user.email test@example.com -git add --all -git commit -m "initial commit" +init_git popd -set +x HELLO_MAP="{\"hello\" : \"file://$(pwd)/hello\"}" @@ -74,4 +67,5 @@ git -C .lake/packages/hello remote set-url origin $TEST_URL LAKE_PKG_URL_MAP=$TEST_MAP test_no_warn build # Cleanup +rm -rf hello/.git rm -f produced.out diff --git a/tests/lake/tests/manifest/test.sh b/tests/lake/tests/manifest/test.sh index cc987c922d..e5eb1fe21e 100755 --- a/tests/lake/tests/manifest/test.sh +++ b/tests/lake/tests/manifest/test.sh @@ -7,17 +7,10 @@ source ../common.sh # We reinitialize the bar repository on each test. This requires updating the # locked manifest to the new hash to ensure things work properly. echo "# SETUP" -set -x pushd bar -git init -git checkout -b master -git config user.name test -git config user.email test@example.com -git add --all -git commit -m "initial commit" +init_git GIT_REV=`git rev-parse HEAD` popd -set +x LOCKED_REV='0538596b94a0510f55dc820cabd3bde41ad93c3e' @@ -62,4 +55,5 @@ test_manifest v1.0.0 test_manifest v1.1.0 # cleanup +rm -rf bar/.git rm -f produced.out diff --git a/tests/lake/tests/packageOverrides/test.sh b/tests/lake/tests/packageOverrides/test.sh index 6d336de871..66340a55c7 100755 --- a/tests/lake/tests/packageOverrides/test.sh +++ b/tests/lake/tests/packageOverrides/test.sh @@ -6,16 +6,9 @@ source ../common.sh # Since committing a Git repository to a Git repository is not well-supported, # We reinitialize the `bar1` repository on each test. echo "# SETUP" -set -x pushd bar1 -git init -git checkout -b master -git config user.name test -git config user.email test@example.com -git add --all -git commit -m "initial commit" +init_git popd -set +x # Test the functionality of package overrides @@ -41,4 +34,5 @@ test_out "bar2" exe bar test_out "foo" exe foo # Cleanup +rm -rf bar1/.git rm -f produced.out diff --git a/tests/pkg/ver_clash/test.sh b/tests/pkg/ver_clash/test.sh index be2e89fba8..9836eac7e1 100755 --- a/tests/pkg/ver_clash/test.sh +++ b/tests/pkg/ver_clash/test.sh @@ -68,7 +68,7 @@ popd # Main tests # --- -cd DiamondExample-D +pushd DiamondExample-D # Test build succeeds on v1 git switch v1 --detach @@ -83,3 +83,9 @@ sed_i '/name/ s/A/A-v1/' .lake/packages/DiamondExample-B/lakefile.toml sed_i '/name/ s/A/A-v2/' .lake/packages/DiamondExample-C/lakefile.toml test_run update test_err 'could not disambiguate the module `DiamondExampleA.Ring.Lemmas`' build + +popd + +# Cleanup +rm -rf DiamondExample-*/.git +rm -f produced.out