From 38a9a1ad10ba4b03b8f071fb36016902d579c571 Mon Sep 17 00:00:00 2001 From: Derrick Stolee Date: Wed, 15 Jan 2020 19:36:00 +0000 Subject: [PATCH] clean: demonstrate a bug with pathspecs b9660c1 (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 b9660c1 then fails after. Helped-by: Kevin Willford Signed-off-by: Derrick Stolee --- t/t7300-clean.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/t/t7300-clean.sh b/t/t7300-clean.sh index 6e6d24c1c3a5c5..782e125c89e77c 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