From: Derrick Stolee Date: Thu, 16 Jan 2020 20:21:53 +0000 (+0000) Subject: clean: demonstrate a bug with pathspecs X-Git-Tag: v2.25.1~12^2~3 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f365bf40a073624b96651c9f731da4bd7d0114f7;p=thirdparty%2Fgit.git 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 ". 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 Signed-off-by: Derrick Stolee Reviewed-by: Elijah Newren Signed-off-by: Junio C Hamano --- 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