On Sat, Nov 27, 2021 at 2:35 AM Ævar Arnfjörð Bjarmason <avarab@xxxxxxxxx> wrote: > > On Fri, Nov 26 2021, Elijah Newren via GitGitGadget wrote: > > > From: Elijah Newren <newren@xxxxxxxxx> > > > + # 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. Thanks; will fix. > > + 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. I can change to `test-tool getcwd` for the obscure platforms; thanks for the tip. > > +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! :-)