git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] git ls files recursively show ignored files
@ 2006-02-24 22:02 Shawn Pearce
  0 siblings, 0 replies; only message in thread
From: Shawn Pearce @ 2006-02-24 22:02 UTC (permalink / raw)
  To: git

Make git-ls-files --others --ignored recurse into non-excluded
subdirectories.

Typically when asking git-ls-files to display all files which are
ignored by one or more exclude patterns one would want it to recurse
into subdirectories which are not themselves excluded to see if
there are any excluded files contained within those subdirectories.

---
 I found this issue while trying to find temporary garbage that was
 created within a tracked subdirectory:

   touch a/b/foo#1
   git-ls-files --others --ignored --exclude='*#1'

 would never display a/b/foo#1 as the directory 'a' was not itself
 excluded.  It would be rather nice if git-ls-files actually
 showed it.

 ls-files.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

base 98214e96be00c5132047ae80bca20d4690933c33
last 809da5f8a21a10112eece4ee9be55fe64371ce68
diff --git a/ls-files.c b/ls-files.c
index 90b289f03d987c6c90214fc12d00c30b4e28bb27..df25c8c012a96a8277413ca3a81490b81b7dc067 100644
--- a/ls-files.c
+++ b/ls-files.c
@@ -279,8 +279,11 @@ static void read_directory(const char *p
 				continue;
 			len = strlen(de->d_name);
 			memcpy(fullname + baselen, de->d_name, len+1);
-			if (excluded(fullname) != show_ignored)
-				continue;
+			if (excluded(fullname) != show_ignored) {
+				if (!show_ignored || DTYPE(de) != DT_DIR) {
+					continue;
+				}
+			}
 
 			switch (DTYPE(de)) {
 			struct stat st;
-- 
1.2.3.g809d

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2006-02-24 22:02 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-02-24 22:02 [PATCH] git ls files recursively show ignored files Shawn Pearce

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).