git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [BUG] git clean -X skips a directory containing only ignored files

From
MSMichael Schubert <mschub@elegosoft.com>
Date
Feb 1, 2012, 12:18 UTC
Message-ID
<4F292DAA.1000107@elegosoft.com>
In-Reply-To
<4F2814D7.8030504@sohovfx.com>
On 01/31/2012 05:20 PM, Andrew Wong wrote:
> I think there were a bit of discussions on this issues just while ago too:
> http://thread.gmane.org/gmane.comp.version-control.git/188605
Thanks, missed that.

Below a patch with an update for Documentation/git-clean.txt - I'm not sure if the issue should be described more accurate.?

-- >8 --
Subject: [PATCH] Documentation: tell about "git clean -Xd" bug

"git clean -Xd" doesn't work as expected (delete all ignored files and untracked directories), because Git's dir subsystem is skipping directories which both aren't explicitly ignored and don't hold any tracked files.

Tell about this limitation in BUGS.
Signed-off-by: Michael Schubert <mschub@elegosoft.com>
---
 Documentation/git-clean.txt |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/Documentation/git-clean.txt b/Documentation/git-clean.txt
index 79fb984..888c07d 100644
--- a/Documentation/git-clean.txt
+++ b/Documentation/git-clean.txt
@@ -29,7 +29,8 @@ OPTIONS
 	Remove untracked directories in addition to untracked files.
 	If an untracked directory is managed by a different git
 	repository, it is not removed by default.  Use -f option twice
-	if you really want to remove such a directory.
+	if you really want to remove such a directory.  Also see BUGS
+	below.
 
 -f::
 --force::
@@ -63,6 +64,11 @@ OPTIONS
 	Remove only files ignored by git.  This may be useful to rebuild
 	everything from scratch, but keep manually created files.
 
+BUGS
+----
+'git-clean -Xd' doesn't work as expected for directories which don't hold
+any tracked files and aren't explicitly ignored either.
+
 GIT
 ---
 Part of the linkgit:git[1] suite
-- 
1.7.9.174.g356eff6
Previous: Andrew Wong
Message 5 of 5 in “[BUG] git clean -X skips a directory containing only ignored files”
  1. Paul BerryJan 30, 2012
  2. Michael SchubertJan 31, 2012
  3. Paul BerryJan 31, 2012
  4. Andrew WongJan 31, 2012
  5. Michael SchubertFeb 1, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.