From: Michael Haggerty Date: Thu, 30 Mar 2017 11:07:01 GMT Subject: Re: [PATCH v5 6/6] remove_subtree(): test removing nested directories Message-ID: <520a6bbb-5915-b51e-7292-ec67e3274f9e@alum.mit.edu> In-Reply-To: <1490844730-47634-7-git-send-email-bnmvco@gmail.com> On 03/30/2017 05:32 AM, Daniel Ferreira wrote: > Test removing a nested directory when an attempt is made to restore the > index to a state where it does not exist. A similar test could be found > previously in t/t2000-checkout-cache-clash.sh, but it did not check for > nested directories, which could allow a faulty implementation of > remove_subtree() pass the tests. > > Signed-off-by: Daniel Ferreira > --- > t/t2000-checkout-cache-clash.sh | 11 +++++++++++ > 1 file changed, 11 insertions(+) > > diff --git a/t/t2000-checkout-cache-clash.sh b/t/t2000-checkout-cache-clash.sh > index de3edb5..ac10ba3 100755 > --- a/t/t2000-checkout-cache-clash.sh > +++ b/t/t2000-checkout-cache-clash.sh > @@ -57,4 +57,15 @@ test_expect_success SYMLINKS 'checkout-index -f twice with --prefix' ' > git checkout-index -a -f --prefix=there/ > ' > > +test_expect_success 'git checkout-index -f should remove nested subtrees' ' > + echo content >path && > + git update-index --add path && > + rm path && > + mkdir -p path/with/nested/paths && > + echo content >path/file1 && > + echo content >path/with/nested/paths/file2 && > + git checkout-index -f -a && > + test ! -d path > +' > + > test_done > It would be better for this patch to precede "remove_subtree(): reimplement using iterators", as a slightly better proof that the change to using iterators doesn't change the behavior. Michael