diff mbox series

[v3,1/4] clean: demonstrate a bug with pathspecs

Message ID 9efed585ef7a1c09ed62998882236e7dbb58383a.1579206117.git.gitgitgadget@gmail.com (mailing list archive)
State New, archived
Headers show
Series dir: more fill_directory() fixes | expand

Commit Message

Johannes Schindelin via GitGitGadget Jan. 16, 2020, 8:21 p.m. UTC
From: Derrick Stolee <dstolee@microsoft.com>

b9670c1f5e (dir: fix checks on common prefix directory, 2019-12-19)
modified the way pathspecs are handled when handling a directory
during "git clean -f <path>". While this improved the behavior for
known test breakages, it also regressed in how the clean command
handles cleaning a specified file.

Add a test case that demonstrates this behavior. This test passes
before b9670c1f5e then fails after.

Helped-by: Kevin Willford <Kevin.Willford@microsoft.com>
Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Reviewed-by: Elijah Newren <newren@gmail.com>
---
 t/t7300-clean.sh | 9 +++++++++
 1 file changed, 9 insertions(+)

Comments

Derrick Stolee Jan. 17, 2020, 3:20 p.m. UTC | #1
On 1/16/2020 3:21 PM, Derrick Stolee via GitGitGadget wrote:
> From: Derrick Stolee <dstolee@microsoft.com>
> 
> b9670c1f5e (dir: fix checks on common prefix directory, 2019-12-19)

Thanks for fixing my typo here.

> modified the way pathspecs are handled when handling a directory
> during "git clean -f <path>". While this improved the behavior for
> known test breakages, it also regressed in how the clean command
> handles cleaning a specified file.
> 
> Add a test case that demonstrates this behavior. This test passes
> before b9670c1f5e then fails after.
> 
> Helped-by: Kevin Willford <Kevin.Willford@microsoft.com>
> Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
> Reviewed-by: Elijah Newren <newren@gmail.com>

Do we need your sign-off here, too?

-Stolee
Elijah Newren Jan. 17, 2020, 4:53 p.m. UTC | #2
On Fri, Jan 17, 2020 at 7:20 AM Derrick Stolee <stolee@gmail.com> wrote:
>
> On 1/16/2020 3:21 PM, Derrick Stolee via GitGitGadget wrote:
> > From: Derrick Stolee <dstolee@microsoft.com>
> >
> > b9670c1f5e (dir: fix checks on common prefix directory, 2019-12-19)
>
> Thanks for fixing my typo here.
>
> > modified the way pathspecs are handled when handling a directory
> > during "git clean -f <path>". While this improved the behavior for
> > known test breakages, it also regressed in how the clean command
> > handles cleaning a specified file.
> >
> > Add a test case that demonstrates this behavior. This test passes
> > before b9670c1f5e then fails after.
> >
> > Helped-by: Kevin Willford <Kevin.Willford@microsoft.com>
> > Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
> > Reviewed-by: Elijah Newren <newren@gmail.com>
>
> Do we need your sign-off here, too?

I figured I didn't change the code, and the list already independently
saw your submission and sign-off, so I assumed that a "Reviewed-by"
was more appropriate.  If I'm wrong or people would just prefer me to
also add a Signed-off-by, I'm happy to add one.  And if it is, then it
should also be added to the last patch in the series from Peff.

If Junio wants it and it's easier for him to just edit-in for both of
these commits:
   Signed-off-by: Elijah Newren <newren@gmail.com>

or I can send a re-roll.  But I'll assume it's not necessary if I
don't hear otherwise.
diff mbox series

Patch

diff --git a/t/t7300-clean.sh b/t/t7300-clean.sh
index 6e6d24c1c3..782e125c89 100755
--- a/t/t7300-clean.sh
+++ b/t/t7300-clean.sh
@@ -737,4 +737,13 @@  test_expect_success MINGW 'handle clean & core.longpaths = false nicely' '
 	test_i18ngrep "too long" .git/err
 '
 
+test_expect_failure 'clean untracked paths by pathspec' '
+	git init untracked &&
+	mkdir untracked/dir &&
+	echo >untracked/dir/file.txt &&
+	git -C untracked clean -f dir/file.txt &&
+	ls untracked/dir >actual &&
+	test_must_be_empty actual
+'
+
 test_done