git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [BUG] git clean -X behaviour when .gitignore has sub-directory entries
@ 2010-09-27 14:35 Jean-Philippe Gariépy
  2010-09-27 20:36 ` Jonathan Nieder
  0 siblings, 1 reply; 4+ messages in thread
From: Jean-Philippe Gariépy @ 2010-09-27 14:35 UTC (permalink / raw)
  To: git

(this is a repost w/ a bit more context)

Hi,

Context:
"git clean -X" is really helpful in my projects to mimick a "make clean" 
(or more precisely a "make distclean") but I believe there is a small 
problem with the -X option of git clean. I've validated this with other 
people and they agree it's a bug.

Problem:
When using sub-directory entries in .gitignore, while the entry is 
ignored as expected, "git clean -X" doesn't clean the ignored sub-directory.

$ git init test
Initialized empty Git repository in /home/jpgariep/git/test/.git/
$ cd test/
$ mkdir -p a/b/c
$ touch a/b/c/test
$ echo '/a/b/' > .gitignore
$ git add .gitignore
$ git commit -m "Added .gitignore."
[master (root-commit) 94e2825] Added .gitignore.
  1 files changed, 1 insertions(+), 0 deletions(-)
  create mode 100644 .gitignore
$ git status
# On branch master
nothing to commit (working directory clean)
$ git clean -X -d -f
$ ls a
b

Why is b still there?


Git version:
git version 1.7.2.3  (but this has been around since 1.6.something)
Tested also with 1.7.3.2.g9027fa (today's HEAD of master branch)

Thanks.

-- 
Jean-Philippe

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-10-03 19:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-09-27 14:35 [BUG] git clean -X behaviour when .gitignore has sub-directory entries Jean-Philippe Gariépy
2010-09-27 20:36 ` Jonathan Nieder
2010-10-03 18:55   ` Jean-Philippe Gariépy
2010-10-03 19:12     ` Jonathan Nieder

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).