Re: [PATCH v7 2/5] remove_subtree(): test removing nested directories
- From
Stefan Beller <sbeller@google.com>
- Date
- Apr 3, 2017, 22:35 UTC
- Message-ID
- <CAGZ79kbrPjKV=Gi0AHHwSAS_DviysvpSd_6g-w-XuD0R3ceDwg@mail.gmail.com>
- In-Reply-To
- <1491163388-41255-3-git-send-email-bnmvco@gmail.com>
On Sun, Apr 2, 2017 at 1:03 PM, Daniel Ferreira <bnmvco@gmail.com> wrote:
Show 30 quoted lines
> 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 <bnmvco@gmail.com> > --- > 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 > +' > +
Looks good to me.
Thanks, Stefan