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

Re: Quick question

From
Linus Torvalds <torvalds@osdl.org>
Date
Feb 13, 2006, 16:54 UTC
Message-ID
<Pine.LNX.4.64.0602130848220.3691@g5.osdl.org>
In-Reply-To
<43F0B577.4070608@gorzow.mm.pl>
On Mon, 13 Feb 2006, Radoslaw Szkodzinski wrote:
Show 8 quoted lines
>
> How to display ignored files of the whole project using only core git?
> 
> I've tried:
> 
> git-ls-files -o -i -X .git/info/exclude
> 
> and it only showed me the excluded files in the current directory...

Well, since you're telling it to only show excluded files, it will also only show excluded directories.

Which is admittedly insane. You don't want to exclude directories. Or maybe you do, but then we should add the "/" to the end before we do the exclusion.

This patch (untested) will never exclude directories. Which may or may not be the right thing.

Junio? Others? Comments?
		Linus
---
diff --git a/ls-files.c b/ls-files.c
index 7024cf1..b923f92 100644
--- a/ls-files.c
+++ b/ls-files.c
@@ -276,8 +276,6 @@ 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;
 
 			switch (DTYPE(de)) {
 			struct stat st;
@@ -304,6 +302,8 @@ static void read_directory(const char *p
 			case DT_LNK:
 				break;
 			}
+			if (excluded(fullname) != show_ignored)
+				continue;
 			add_name(fullname, baselen + len);
 		}
 		closedir(dir);
Previous: Radoslaw SzkodzinskiNext: Radoslaw Szkodzinski
Message 2 of 9 in “Quick question”
  1. Radoslaw SzkodzinskiFeb 13, 2006
  2. Linus TorvaldsFeb 13, 2006
  3. Radoslaw SzkodzinskiFeb 13, 2006
  4. Alex RiesenFeb 13, 2006
  5. Junio C HamanoFeb 14, 2006
  6. Junio C HamanoFeb 14, 2006
  7. Radoslaw SzkodzinskiFeb 14, 2006
  8. Junio C HamanoFeb 14, 2006
  9. Radoslaw SzkodzinskiFeb 14, 2006

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.