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

Re: [PATCH v2 10/14] dir.c: unify is_excluded and is_path_excluded APIs

From
Junio C Hamano <gitster@pobox.com>
Date
Apr 15, 2013, 21:35 UTC
Message-ID
<7vwqs3pjdj.fsf@alter.siamese.dyndns.org>
In-Reply-To
<516C510E.5000606@gmail.com>
Karsten Blees <karsten.blees@gmail.com> writes:
> is_excluded doesn't handle ignored directories, results for paths within
> ignored directories are incorrect. This is probably based on the premise
> that recursive directory scans should stop at ignored directories,...

Correct. Long time ago, we used to have strange rules in a case like this:

	.gitignore has "d/" to exclude it;
        d/.gitignore says "!f" to cause d/f included.

and when you ask about d/f, we would say "d/ is ignored, so we wouldn't even bother checking and declare it ignored", while asked about "f" from within "d/" by first chdir'ing to it, we said "the fact that you are inside d/ alone means you are interested in looking at its contents, and checking d/.gitignore tells us that you are interested in f". "recursion stops at ignored paths" mattered back then.

I think we consistently honors higher level .gitignore files these days.

Show 14 quoted lines
> Teach is_excluded / prep_exclude about ignored directories: whenever
> entering a new directory, first check if the entire directory is excluded.
> Remember the excluded state in dir_struct. Don't traverse into already
> ignored directories (i.e. don't read irrelevant .gitignore files).
> ...
> Here's some performance data from the linux and WebKit repos (best of 10
> runs on a Debian Linux on SSD, core.preloadIndex=true):
>
>        | ls-files -ci   |    status      | status --ignored
>        | linux | WebKit | linux | WebKit | linux | WebKit
> -------+-------+--------+-------+--------+-------+---------
> before | 0.506 |  6.539 | 0.212 |  1.555 | 0.323 |  2.541
> after  | 0.080 |  1.191 | 0.218 |  1.583 | 0.321 |  2.579
> gain   | 6.325 |  5.490 | 0.972 |  0.982 | 1.006 |  0.985
Nice.
Previous: Karsten BleesNext: Karsten Blees
Message 24 of 36 in “Improve git-status --ignored”
  1. 0/8 Improve git-status --ignoredKarsten Blees, Mar 18, 2013
  2. Junio C HamanoMar 19, 2013
  3. Duy NguyenMar 19, 2013
  4. Karsten BleesMar 19, 2013
  5. Junio C HamanoMar 19, 2013
  6. Duy NguyenMar 19, 2013
  7. 00/14 Improve git-status --ignoredKarsten Blees, Apr 15, 2013
  8. 01/14 dir.c: git-status --ignored: don't drop ignored directoriesKarsten Blees, Apr 15, 2013
  9. Ramkumar RamachandraApr 16, 2013
  10. Karsten BleesApr 17, 2013
  11. 02/14 dir.c: git-status --ignored: don't list files in ignored directoriesKarsten Blees, Apr 15, 2013
  12. read_revisions_from_stdin: make copies for handle_revision_argThomas Rast, Apr 16, 2013
  13. Junio C HamanoApr 16, 2013
  14. 03/14 dir.c: git-status --ignored: don't list empty ignored directoriesKarsten Blees, Apr 15, 2013
  15. Ramkumar RamachandraApr 16, 2013
  16. Karsten BleesApr 17, 2013
  17. 04/14 dir.c: git-ls-files --directories: don't hide empty directoriesKarsten Blees, Apr 15, 2013
  18. 05/14 dir.c: git-status --ignored: don't list empty directories as ignoredKarsten Blees, Apr 15, 2013
  19. 06/14 dir.c: make 'git-status --ignored' work within leading directoriesKarsten Blees, Apr 15, 2013
  20. 07/14 dir.c: git-clean -d -X: don't delete tracked directoriesKarsten Blees, Apr 15, 2013
  21. 08/14 dir.c: factor out parts of last_exclude_matching for later reuseKarsten Blees, Apr 15, 2013
  22. 09/14 dir.c: move prep_excludeKarsten Blees, Apr 15, 2013
  23. 10/14 dir.c: unify is_excluded and is_path_excluded APIsKarsten Blees, Apr 15, 2013
  24. Junio C HamanoApr 15, 2013
  25. 11/14 dir.c: replace is_path_excluded with now equivalent is_excluded APIKarsten Blees, Apr 15, 2013
  26. 12/14 dir.c: git-status: avoid is_excluded checks for tracked filesKarsten Blees, Apr 15, 2013
  27. 13/14 dir.c: git-status --ignored: don't scan the work tree three timesKarsten Blees, Apr 15, 2013
  28. 14/14 dir.c: git-status --ignored: don't scan the work tree twiceKarsten Blees, Apr 15, 2013
  29. Junio C HamanoApr 15, 2013
  30. Junio C HamanoApr 15, 2013
  31. Karsten BleesApr 15, 2013
  32. Junio C HamanoApr 15, 2013
  33. Karsten BleesApr 17, 2013
  34. Junio C HamanoApr 17, 2013
  35. 11/14 dir.c: replace is_path_excluded with now equivalent is_excluded APIKarsten Blees, Apr 17, 2013
  36. 14/14 dir.c: git-status --ignored: don't scan the work tree twiceKarsten Blees, Apr 17, 2013

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.