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

Re: [PATCH 2/5] pathspec: add tree_recursive_diff parameter

From
Nguyen Thai Ngoc Duy <pclouds@gmail.com>
Date
Sep 28, 2010, 02:38 UTC
Message-ID
<AANLkTinZt8kish9L2F-ad_boXByZTUj-BnYTp-vtePk0@mail.gmail.com>
In-Reply-To
<7vocbivnfs.fsf@alter.siamese.dyndns.org>
2010/9/28 Junio C Hamano <gitster@pobox.com>:
Show 20 quoted lines
> Nguyễn Thái Ngọc Duy  <pclouds@gmail.com> writes:
>
>> When wildcard match is implemented, a full path is needed to do final
>> match. What type of diff_tree is performed determines how to treat
>> directories:
>>
>>  - If it's recursive diff, directories are just an intermediate step.
>>    All path must end with a file name. Thus, directories will be
>>    unconditionally matched.
>
> Hmm, I am not sure what you mean by this.  If the pathspec says a/b*/c,
> you are in "a" and are deciding if you should descend to its subdirectory,
> then you would surely want to be able to say:
>
>  (1) Ah, the subdirectory I am looking at is "bar" and it does match "b*".
>     It might contain "c"; I should descend into it.
>
>  (2) Nope, the subdirectory I am looking at is "frotz" and it can never
>     match "b*", so there is no point recursing into it.
>

I did not go that far, trying to analyse the pattern. When I wrote "immediate step" I was thinking of "*foo" pattern, which effectively means descending to any reachable directories because '*' matches slashes too. I think that's the worst case.

Anyway I did not know that I could borrow some optimizations from pathspec_matches() in builtin/grep.c.

-- 
Duy
Previous: Junio C HamanoNext: Junio C Hamano
Message 5 of 9 in “Globbing support in diff family”
  1. 0/5 Globbing support in diff familyNguyễn Thái Ngọc Duy, Sep 19, 2010
  2. 1/5 pathspec: mark wildcard pathspecs from the beginningNguyễn Thái Ngọc Duy, Sep 19, 2010
  3. 2/5 pathspec: add tree_recursive_diff parameterNguyễn Thái Ngọc Duy, Sep 19, 2010
  4. Junio C HamanoSep 27, 2010
  5. Nguyen Thai Ngoc DuySep 28, 2010
  6. Junio C HamanoSep 28, 2010
  7. 3/5 tree_entry_interesting: turn to match_pathspec if wildcard is presentNguyễn Thái Ngọc Duy, Sep 19, 2010
  8. 4/5 Convert ce_path_match() to use struct pathspecNguyễn Thái Ngọc Duy, Sep 19, 2010
  9. 5/5 ce_path_match: drop prefix matching in favor of match_pathspecNguyễn Thái Ngọc Duy, Sep 19, 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.