Subject: git clean removes directories when not asked to

From: Joachim B Haga <[email-masked]>
Date: Tue, 08 Apr 2008 20:22:56 +0200

This is with debian packaged 1.5.4.4.

When invoked from a subdirectory, git clean removes more than it
should. According to the documentation, it should not remove
directories unless "-d" is given. However:

pep ~/src/test 0$ git init
Initialized empty Git repository in .git/
pep ~/src/test|master 0$ mkdir dir
pep ~/src/test|master 0$ mkdir dir/subdir
pep ~/src/test|master 0$ git clean -f
Not removing dir/
pep ~/src/test|master 0$ cd dir
pep ~/src/test/dir|master 0$ git clean -f
Removing subdir/
pep ~/src/test/dir|master 0$ ls subdir
ls: cannot access subdir: No such file or directory

Luckily I just lost some compilation results in this case, but this is
unexpected and dangerous behaviour.

(Additionally, I find the "-f" slightly annoying but that's not an issue here.)

-j