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

Re: ls-files --exclude broken?

From
Nguyen Thai Ngoc Duy <pclouds@gmail.com>
Date
Sep 15, 2010, 23:06 UTC
Message-ID
<AANLkTinW3ugUK6uBq6oFOzKorHubP-oi9KwJzsNrgpE4@mail.gmail.com>
In-Reply-To
<AANLkTimuTHvA+qjqpmz=VkCpTTiRA7imb5+ZyTVmPwYy@mail.gmail.com>
On Thu, Sep 16, 2010 at 8:40 AM, Jay Soffian <jaysoffian@gmail.com> wrote:
Show 10 quoted lines
> Am I missing something really obvious here?
>
> kore:~/Repos/git (master)$ git ls-files | wc -l
>    2009
> kore:~/Repos/git (master)$ git ls-files -x \* | wc -l
>    2009
> kore:~/Repos/git (master)$ git ls-files -i -x \* | wc -l
>    2009
> kore:~/Repos/git (master)$ git version
> git version 1.7.3.rc1.5.g95127

excluded() is not called as far as I can tell, which explains why it did not exclude anything for you. That exclude code was touched by Jeff in commits b5227d8 (ls-files: excludes should not impact tracked files) and 500348a (ls-files: unbreak "ls-files -i").

Something like this works for me, but I haven't finished my morning tea yet, so..

diff --git a/builtin/ls-files.c b/builtin/ls-files.c
index bb4f612..ab87843 100644
--- a/builtin/ls-files.c
+++ b/builtin/ls-files.c
@@ -216,9 +216,14 @@ static void show_files(struct dir_struct *dir)
 		for (i = 0; i < active_nr; i++) {
 			struct cache_entry *ce = active_cache[i];
 			int dtype = ce_to_dtype(ce);
-			if (dir->flags & DIR_SHOW_IGNORED &&
-			    !excluded(dir, ce->name, &dtype))
-				continue;
+			if (dir->flags & DIR_SHOW_IGNORED) {
+				if (!excluded(dir, ce->name, &dtype))
+					continue;
+			}
+			else {
+				if (excluded(dir, ce->name, &dtype))
+					continue;
+			}
 			if (show_unmerged && !ce_stage(ce))
 				continue;
 			if (ce->ce_flags & CE_UPDATE)
-- 
Duy
Previous: Jay SoffianNext: Junio C Hamano
Message 2 of 17 in “ls-files --exclude broken?”
  1. Jay SoffianSep 15, 2010
  2. Nguyen Thai Ngoc DuySep 15, 2010
  3. Junio C HamanoSep 15, 2010
  4. Jay SoffianSep 15, 2010
  5. Nguyen Thai Ngoc DuySep 15, 2010
  6. Jay SoffianSep 15, 2010
  7. Jay SoffianSep 15, 2010
  8. Jeff KingSep 16, 2010
  9. Jay SoffianSep 16, 2010
  10. Jeff KingSep 16, 2010
  11. Elijah NewrenSep 15, 2010
  12. Kevin BallardSep 15, 2010
  13. Daniel JohnsonSep 15, 2010
  14. git-ls-files.txt: clarify -x/--exclude optionJay Soffian, Sep 15, 2010
  15. Jeff KingSep 16, 2010
  16. Junio C HamanoSep 16, 2010
  17. Jeff KingSep 16, 2010

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.