Weird behavior/bug for git clean in untracked directory
- Date: Wed, 04 Oct 2017 21:06:18 +0200
- From: David Spångberg <david@xxxxxxxxx>
- Subject: Weird behavior/bug for git clean in untracked directory
I'm a little bit confused about the behavior of git clean when trying to
clean multiple files/directories at once. For instance if I create two
directories with an empty file in an new git repository as such:
mkdir a b
touch a/file b/file
and try to clean both these files at the same time with git clean as
git clean -f a/file b/file
then git will not clean any of the files. However, if I separate the
cleaning into two separate calls like this:
git clean -f a/file
git clean -f b/file
then both directories will be cleaned. The git clean manual page suggests
git clean should support multiple paths/directories:
git clean [-d] [-f] [-i] [-n] [-q] [-e <pattern>] [-x | -X] [--] <path>...
If any optional <path>... _arguments_ are given, only those _paths_ are affected.
The expected behavior for me would be that there should be no difference
between the first `git clean...' with two files and the two
`git clean...' with one file each.
I've tested on the following git versions so far:
* 18.104.22.1689.g6663358d3 (currently latest on next branch)