Weird behavior/bug for git clean in untracked directory
- From
- David Spångberg <david@tunna.org>
- Date
- Oct 4, 2017, 19:06 UTC
- Message-ID
- <8760bu7mxh.fsf@tunna.org>
Hello
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 tmprepo cd tmprepo git init mkdir a b touch a/file b/file
and try to clean both these files at the same time with git clean as such:
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:
SYNOPSIS
git clean [-d] [-f] [-i] [-n] [-q] [-e <pattern>] [-x | -X] [--] <path>... DESCRIPTION
...
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:
* 2.1.4 * 2.14.2 * 2.14.2.959.g6663358d3 (currently latest on next branch)
Best regards, David