@matheusbsbs / matheus-bagliano / commits / f365bf40a0
Fork 0

clean: demonstrate a bug with pathspecs

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> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Derrick Stolee committed Jan 16, 2020 at 20:21 UTC f365bf40a073624b96651c9f731da4bd7d0114f7
1 file changed +9
t/t7300-clean.sh
+9
@@ -737,4 +737,13 @@ test_expect_success MINGW 'handle clean & core.longpaths = false nicely' '
737 test_i18ngrep "too long" .git/err
738 '
739
740 +test_expect_failure 'clean untracked paths by pathspec' '
741 + git init untracked &&
742 + mkdir untracked/dir &&
743 + echo >untracked/dir/file.txt &&
744 + git -C untracked clean -f dir/file.txt &&
745 + ls untracked/dir >actual &&
746 + test_must_be_empty actual
747 +'
748 +
749 test_done