From fda47932154de6126f800a3cf42fb7db15b31a9a Mon Sep 17 00:00:00 2001 From: Sebastian Ullrich Date: Fri, 27 Mar 2026 11:25:58 +0100 Subject: [PATCH] test: copy `ver_clash` test data to temp dir before modifying (#13134) Avoids git/(especially) jj thinking the files have vanished from the root repo --- tests/pkg/ver_clash/.gitignore | 1 + tests/pkg/ver_clash/clean.sh | 4 +--- tests/pkg/ver_clash/run_test.sh | 16 ++++++++++------ 3 files changed, 12 insertions(+), 9 deletions(-) create mode 100644 tests/pkg/ver_clash/.gitignore diff --git a/tests/pkg/ver_clash/.gitignore b/tests/pkg/ver_clash/.gitignore new file mode 100644 index 0000000000..76b5fe4428 --- /dev/null +++ b/tests/pkg/ver_clash/.gitignore @@ -0,0 +1 @@ +/work/ diff --git a/tests/pkg/ver_clash/clean.sh b/tests/pkg/ver_clash/clean.sh index 0c5790af33..b734e1d511 100755 --- a/tests/pkg/ver_clash/clean.sh +++ b/tests/pkg/ver_clash/clean.sh @@ -1,3 +1 @@ -rm -rf DiamondExample-*/.git -rm -rf DiamondExample-*/.lake DiamondExample-*/lake-manifest.json -rm -f DiamondExample-D/produced.out +rm -rf work diff --git a/tests/pkg/ver_clash/run_test.sh b/tests/pkg/ver_clash/run_test.sh index 7b22adf8e7..ee7b1ef6a4 100644 --- a/tests/pkg/ver_clash/run_test.sh +++ b/tests/pkg/ver_clash/run_test.sh @@ -18,6 +18,16 @@ # Setup # --- +./clean.sh + +# Copy test data to a working directory to avoid initializing Git repositories +# inside the checked-in source tree. Cleaned at the start so artifacts from a +# failed run remain available for inspection. +WORK_DIR="$PWD/work" +mkdir -p "$WORK_DIR" +cp -r DiamondExample-A DiamondExample-B DiamondExample-C DiamondExample-D lean-toolchain "$WORK_DIR/" +cd "$WORK_DIR" + # Since committing a Git repository to a Git repository is not well-supported, # We reinitialize the repositories on each test. @@ -42,8 +52,6 @@ init_git() { set +x } -./clean.sh - pushd DiamondExample-A sed_i s/add_left_comm/poorly_named_lemma/ DiamondExampleA/Ring/Lemmas.lean lake update @@ -107,7 +115,3 @@ capture_fail lake build check_out_contains 'could not disambiguate the module `DiamondExampleA.Ring.Lemmas`' popd - -# Cleanup -rm -rf DiamondExample-*/.git -rm -rf DiamondExample-*/.lake