[PATCH] clean: respect pathspecs with -d

2014-03-10 Thread Jeff King
git-clean uses read_directory to fill in a `struct dir` with potential hits. However, read_directory does not actually check against our pathspec. It uses a simplified version that may turn up false positives. As a result, we need to check that any hits match our pathspec. We do so reliably for

Re: [PATCH] clean: respect pathspecs with -d

2014-03-10 Thread Jeff King
On Mon, Mar 10, 2014 at 01:20:02PM -0400, Jeff King wrote: On Mon, Mar 10, 2014 at 11:31:37AM +0100, Robin Pedersen wrote: I accidentially deleted a directory using git clean. I would think this is a bug, but I'm not sure. Was using 1.8.1, but upgraded to 1.9.0 just to see if it was

Re: [PATCH] clean: respect pathspecs with -d

2014-03-10 Thread Simon Ruderich
On Mon, Mar 10, 2014 at 01:22:15PM -0400, Jeff King wrote: +test_expect_success 'git clean -d respects pathspecs' ' + mkdir foo + mkdir foobar + git clean -df foobar + test_path_is_dir foo + test_path_is_missing foobar +' + test_done I think we should also test

Re: [PATCH] clean: respect pathspecs with -d

2014-03-10 Thread Jeff King
On Mon, Mar 10, 2014 at 09:02:35PM +0100, Simon Ruderich wrote: On Mon, Mar 10, 2014 at 01:22:15PM -0400, Jeff King wrote: +test_expect_success 'git clean -d respects pathspecs' ' + mkdir foo + mkdir foobar + git clean -df foobar + test_path_is_dir foo +