On Fri, Jan 14 2022, Elijah Newren via GitGitGadget wrote: > From: Elijah Newren <newren@xxxxxxxxx> > [...] > # Set up a strange condition of having a file edit > - # outside of the sparse-checkout cone. This is just > - # to verify that sparse-checkout and sparse-index > - # behave the same in this case. > + # outside of the sparse-checkout cone. We want to verify > + # that all modes handle this the same, and detect the > + # modification. > write_script edit-content <<-\EOF && > - mkdir folder1 && > + mkdir -p folder1 && > echo content >>folder1/a > EOF > - run_on_sparse ../edit-content && > + run_on_all ../edit-content && The end-state of this series will pass its tests with this on top, only the last "mkdir -p" you added for the ls-files test seems to do anything: diff --git a/t/t1092-sparse-checkout-compatibility.sh b/t/t1092-sparse-checkout-compatibility.sh index 2a04b532f91..160c119e17d 100755 --- a/t/t1092-sparse-checkout-compatibility.sh +++ b/t/t1092-sparse-checkout-compatibility.sh @@ -639,7 +639,7 @@ test_expect_success 'update-index modify outside sparse definition' ' # condition in which a `skip-worktree` enabled, outside-of-cone file # exists on disk. It is used here to ensure `update-index` is stable # and behaves predictably if such a condition occurs. - run_on_sparse mkdir -p folder1 && + run_on_sparse mkdir folder1 && run_on_sparse cp ../initial-repo/folder1/a folder1/a && run_on_all ../edit-contents folder1/a && @@ -665,7 +665,7 @@ test_expect_success 'update-index --add outside sparse definition' ' EOF # Create folder1, add new file - run_on_sparse mkdir -p folder1 && + run_on_sparse mkdir folder1 && run_on_all ../edit-contents folder1/b && # The *untracked* out-of-cone file is added to the index because it does @@ -949,7 +949,7 @@ test_expect_success 'checkout-index outside sparse definition' ' run_on_sparse rm -rf folder1 && echo test >new-a && - run_on_sparse mkdir -p folder1 && + run_on_sparse mkdir folder1 && run_on_all cp ../new-a folder1/a && test_all_match test_must_fail git checkout-index --ignore-skip-worktree-bits -- folder1/a && @@ -996,7 +996,7 @@ test_expect_success 'clean' ' test_all_match git commit -m "ignore bogus files" && run_on_sparse mkdir folder1 && - run_on_all mkdir -p deep/untracked-deep && + run_on_all mkdir deep/untracked-deep && run_on_all touch folder1/bogus && run_on_all touch folder1/untracked && run_on_all touch deep/untracked-deep/bogus && A bit nit-y I guess, but I do think tests are much easier to follow when it's clear when we're doing initial setup v.s. using already set-up data. In this case More importantnly I think between this and 19a0acc83e4 (t1092: test interesting sparse-checkout scenarios, 2021-01-23) that introduced this pattern there's a large foot-gun being left in place here by using these "run_on_all" and "run_on_sparse" helpers to run POSIX tooling, as opposed to git itself. Utilities like "mv", "rm", "mkdir" etc. are differently chatty between platform, and this helper captures their stdout/stderr for a later test_cmp. Now, I think actually there isn't a bug *now* because we clobber the output, and seem to only call test_all_match() and other test_cmp helpers right after we've run "git", not these POSIX utilities. But since all we want in those cases is just a "run these commands in these N dirs" it would be good to split up the helper.