Re: [PATCH v4 0/3] diff: add pathspec support to --no-index
Show 35 quoted lines
> Le 3 juin 2025 à 17:12, Junio C Hamano <gitster@pobox.com> a écrit :
>
> Jacob Keller <jacob.e.keller@intel.com> writes:
>
>> From: Jacob Keller <jacob.keller@gmail.com>
>> This series adds support for using pathspecs to limit the comparison when
>> using git diff --no-index. This is similar to how you can limit what is
>> included with pathspecs when comparing inside a repository.
>> This version uses only one set of pathspecs and instead uses some logic to
>> skip past the root of each directory tree being scanned. This avoids needing
>> to parse pathspecs multiple times, and is overall a simpler approach.
>> I also opted to add a match_leading_pathspec() instead of exposing the
>> match_pathspec_with_flags(), since I didn't how DO_MATCH_EXCLUDES wasn't
>> exposed. It felt messy.
>> I tried a couple of different methods for skipping past the leading portion
>> of a path, including skip_prefix. Ultimately just the index to skip to
>> seemed like the simplest solution. I like that it means we only need a
>> single pathspec array now, and that we no longer have to worry about
>> changing prefix_path_gently.
>> Changes since v3:
>> * Drop the patch modifying prefix_path(_gently).
>> * Instead of exposing the do_match_pathspec flags, create a
>> match_leading_pathspec() variant that sets both flags when is_dir is true.
>> * Use some simple logic to skip past the starting portions of each path
>> before calling match_leading_pathspec
>> * Re-write the commit message for the final patch
>> * Add a couple more test cases
>> * Simplify existing test cases to use --name-status
>> * Drop remaining TODOs
>
> Anybody, other than Jacob and I, interested in this series? We
> haven't seen any support or review and I am considering merging it
> down for the next cycle sometime in coming weeks.
>
> Thanks.
I have no code review, and the docs look good. I probably would lean more towards other tools for diffing (non-Git) directories, but I don’t know which offhand, so I don’t mind extending Git’s existing mechanism this way. It certainly allows some interesting commands that I can see myself taking advantage of, and it feels overall like a natural extension of the interface.