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

Re: [PATCH RFC] Convert ce_path_match() use to match_pathspec()

From
Nguyen Thai Ngoc Duy <pclouds@gmail.com>
Date
May 26, 2009, 11:04 UTC
Message-ID
<fcaeb9bf0905260404h3eb35355p4fec33bc1912ce9b@mail.gmail.com>
In-Reply-To
<7voctgvnic.fsf@alter.siamese.dyndns.org>
2009/5/26 Junio C Hamano <gitster@pobox.com>:
Show 8 quoted lines
> Nguyễn Thái Ngọc Duy  <pclouds@gmail.com> writes:
>
>> For some reasons diff code did not get converted to use
>> match_pathspec(). So diff commands do not understand wildcards.
>
> ce_path_match() is not just about diffs; there may be places that do not
> expect pathspecs to match cruft with globs.  Have you checked all the
> callsites and they are Ok with globbing?

I'm pretty sure except preload-index. I have checked again, all read_cache_preload() callsites seem to prefer files and leading path over globbing.

Show 8 quoted lines
> I think using glob in diff-files should be Ok, but that would make it
> inconsistent with diff-tree (and possibly diff-index but I didn't check).
> The correct operation of diff-tree (and path pruning in "git log" family)
> heavily relies on an early-exit optimization not to recurse into a
> directory when we can detect that none of the paths in that directory will
> ever match any of the given pathspecs, and this is done based on the
> non-globbing (iow "leading path") semantics; you need to be extra careful
> about this.
Now I know the reason. Thanks.
-- 
Duy
Previous: Junio C Hamano
Message 3 of 3 in “Convert ce_path_match() use to match_pathspec()”
  1. Convert ce_path_match() use to match_pathspec()Nguyễn Thái Ngọc Duy, May 25, 2009
  2. Junio C HamanoMay 25, 2009
  3. Nguyen Thai Ngoc DuyMay 26, 2009

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.