Re: [PATCH 1/7] t7300: skip untracked dirs containing ignored files
- From
Stefan Beller <sbeller@google.com>
- Date
- May 3, 2017, 18:19 UTC
- Message-ID
- <CAGZ79kauf5tAEv1JJCbTsuKhPYFKq0DVChBBt2EjHxRRZEzYAw@mail.gmail.com>
- In-Reply-To
- <20170503032932.16043-2-sxlijin@gmail.com>
On Tue, May 2, 2017 at 8:29 PM, Samuel Lijin <sxlijin@gmail.com> wrote:
> If git sees a directory which contains only untracked and ignored > files, clean -d should not remove that directory.
Yes that states a fact; it is not clear why we want to have this test here and now. (Is it testing for a recently fixed regression?) Are you just introducing the test to demonstrate it keeps working later on? Do you plan on changing this behavior in a later patch?)
Show 21 quoted lines
> --- > t/t7300-clean.sh | 10 ++++++++++ > 1 file changed, 10 insertions(+) > > diff --git a/t/t7300-clean.sh b/t/t7300-clean.sh > index b89fd2a6a..948a455e8 100755 > --- a/t/t7300-clean.sh > +++ b/t/t7300-clean.sh > @@ -653,4 +653,14 @@ test_expect_success 'git clean -d respects pathspecs (pathspec is prefix of dir) > test_path_is_dir foobar > ' > > +test_expect_success 'git clean -d skips untracked dirs containing ignored files' ' > + echo /foo/bar >.gitignore && > + rm -rf foo && > + mkdir -p foo && > + touch foo/bar && > + git clean -df && > + test_path_is_file foo/bar && > + test_path_is_dir foo > +'
The test makes sense, though I am wondering if we can integrate this test into another test e.g. "ok 15 - git clean -d".
Is the -f flag needed?
Thanks, Stefan