git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Jean-Philippe Gariépy" <jean-philippe.gariepy@nuecho.com>
To: git@vger.kernel.org
Subject: [BUG] git clean -X behaviour when .gitignore has sub-directory entries
Date: Mon, 27 Sep 2010 10:35:06 -0400	[thread overview]
Message-ID: <4CA0AB9A.4050002@nuecho.com> (raw)

(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

             reply	other threads:[~2010-09-27 14:42 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-27 14:35 Jean-Philippe Gariépy [this message]
2010-09-27 20:36 ` [BUG] git clean -X behaviour when .gitignore has sub-directory entries Jonathan Nieder
2010-10-03 18:55   ` Jean-Philippe Gariépy
2010-10-03 19:12     ` Jonathan Nieder

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4CA0AB9A.4050002@nuecho.com \
    --to=jean-philippe.gariepy@nuecho.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).