Skip to content

Commit

Permalink
clean: demonstrate a bug with pathspecs
Browse files Browse the repository at this point in the history
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 <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 b9660c1 then fails after.

Helped-by: Kevin Willford <Kevin.Willford@microsoft.com>
Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
  • Loading branch information
derrickstolee committed Jan 15, 2020
1 parent b9670c1 commit 38a9a1a
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions t/t7300-clean.sh
Expand Up @@ -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

0 comments on commit 38a9a1a

Please sign in to comment.