From: Ævar Arnfjörð Bjarmason Date: Sat, 27 Nov 2021 10:32:17 GMT Subject: Re: [PATCH v3 01/11] t2501: add various tests for removing the current working directory Message-ID: <211127.864k7xj38p.gmgdl@evledraar.gmail.com> In-Reply-To: <4b0044656b0ebe81db60f605a184948f728c4b9d.1637966463.git.gitgitgadget@gmail.com> On Fri, Nov 26 2021, Elijah Newren via GitGitGadget wrote: > From: Elijah Newren > + # Although we want pwd & git status to pass, test for existing > + # rather than desired behavior. > + if [[ $works == "success" ]]; then Wasn't "[[" bash-specific or something? In any case a more regular "if test "$works" = "success" would work here. > + pwd -P && I wonder if this is doing what we want everywhere cf. 482e1488a9b (t0001: fix broken not-quite getcwd(3) test in bed67874e2, 2021-07-30), but haven't looked much/thought about it. > +test_expect_success 'checkout does not clean cwd incidentally' ' > + test_incidental_dir_removal failure git checkout init > +' > + > +test_expect_success 'checkout fails if cwd needs to be removed' ' > + test_required_dir_removal failure git checkout fd_conflict > +' > + > +test_expect_success 'reset --hard does not clean cwd incidentally' ' > + test_incidental_dir_removal failure git reset --hard init > +' > + > +test_expect_success 'reset --hard fails if cwd needs to be removed' ' > + test_required_dir_removal failure git reset --hard fd_conflict > +' > + > +test_expect_success 'merge does not clean cwd incidentally' ' > + test_incidental_dir_removal failure git merge reverted > +' This testing the current behavior (and below) looks much better, thanks!