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

Re: [RFC PATCH 4/7] dir: Directories should be checked for matching pathspecs too

From
Junio C Hamano <gitster@pobox.com>
Date
Apr 9, 2018, 02:07 UTC
Message-ID
<xmqqefjp6sko.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<20180405193124.GA24643@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 7 quoted lines
> To be honest, I don't know. Most of dir.c predates me, and I've tried to
> avoid looking at it too hard. But I had a vague recollection of it being
> "best effort", and this bit from cf424f5fd89b reinforces that:
>
>   However, read_directory does not actually check against our pathspec.
>   It uses a simplified version that may turn up false positives. As a
>   result, we need to check that any hits match our pathspec.

At least the original design of the traversal was "try making use of pathspec during the traversal when we can cheaply filter out obvious non-hits and avoid recursing into an entire hierarchy---false negative is an absolute no-no, but forcing the consumer to post filter is OK".

> ... But I think that anybody who looks at the output of
> fill_directory() does need to be aware that they may get more entries
> than they expected, and has to apply the pathspecs themselves.

That matches with my understanding of how "fill" thing worked from early days.

Previous: Jeff KingNext: Elijah Newren
Message 8 of 17 in “Fix `git clean` with pathspecs”
  1. 0/7 Fix `git clean` with pathspecsElijah Newren, Apr 5, 2018
  2. 7/7 If we do not want globs to recurse into subdirs without -d...Elijah Newren, Apr 5, 2018
  3. 6/7 dir: If our pathspec might match files under a dir, recurse into itElijah Newren, Apr 5, 2018
  4. 4/7 dir: Directories should be checked for matching pathspecs tooElijah Newren, Apr 5, 2018
  5. Jeff KingApr 5, 2018
  6. Elijah NewrenApr 5, 2018
  7. Jeff KingApr 5, 2018
  8. Junio C HamanoApr 9, 2018
  9. 3/7 t7300: Add some testcases showing failure to clean specified pathspecsElijah Newren, Apr 5, 2018
  10. 5/7 dir: Make the DO_MATCH_SUBMODULE code reusable for a non-submodule caseElijah Newren, Apr 5, 2018
  11. 1/7 dir.c: Fix typo in commentElijah Newren, Apr 5, 2018
  12. 2/7 dir.c: fix off-by-one error in match_pathspec_itemElijah Newren, Apr 5, 2018
  13. Jeff KingApr 5, 2018
  14. Elijah NewrenApr 5, 2018
  15. Jeff KingApr 5, 2018
  16. Elijah NewrenApr 5, 2018
  17. Jeff KingApr 6, 2018

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.