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

Re: [PATCH v4 3/3] diff --no-index: support limiting by pathspec

From
Jacob Keller <jacob.e.keller@intel.com>
Date
Jun 4, 2025, 17:22 UTC
Message-ID
<a5bc1851-e80b-4795-8aaf-46984b0cdfb8@intel.com>
In-Reply-To
<374BC043-8FB8-4052-BDE7-6BAE7F182994@gmail.com>
On 6/3/2025 7:37 PM, Ben Knoble wrote:
Show 18 quoted lines
> Actually, one comment :)
> 
>> Le 21 mai 2025 à 19:29, Jacob Keller <jacob.e.keller@intel.com> a écrit :
>>
>> From: Jacob Keller <jacob.keller@gmail.com>
>>
>> The --no-index option of git-diff enables using the diff machinery from
>> git while operating outside of a repository. This mode of git diff is
>> able to compare directories and produce a diff of their contents.
>>
>> When operating git diff in a repository, git has the notion of
>> "pathspecs" which can specify which files to compare. In particular,
>> when using git to diff two trees, you might invoke:
>>
>> $ git diff-tree -r <treeish1> <treeish2>.
> 
> I do find it slightly confusing that this series and in particular this patch is all about git-diff(1), but the only example is about git-diff-tree(1). It’s not the best example to me, esp. since it doesn’t actually use the pathspec machinery (deferring that to prose only). But I get the gist, so not really an issue.
> 

Fair point. I think my brain wires got crossed as I was thinking of git diff-tree as an example for why pathspecs always come at the end.

> Rereading a bit, it seems this message goes to lengths to teach readers about pathspecs for git-diff here; perhaps we can simplify those parts and assume the reader is familiar enough with the details to understand the implications of « no-index mode doesn’t support pathspecs to limit comparison »?
> 

Yea, we could probably simplify this. I usually try to be verbose with my "this is the reasoning for why to do this" and give background.. but that can sometimes end up being too much.

Regardless, the example probably should use pathspecs if we keep it..
> Nit: Should the diff-tree command end with a period?
> 
It should not.
Previous: Ben KnobleNext: Jacob Keller
Message 6 of 22 in “diff: add pathspec support to --no-index”
  1. 0/3 diff: add pathspec support to --no-indexJacob Keller, May 21, 2025
  2. 1/3 pathspec: add match_leading_pathspec variantJacob Keller, May 21, 2025
  3. 2/3 pathspec: add flag to indicate operation without repositoryJacob Keller, May 21, 2025
  4. 3/3 diff --no-index: support limiting by pathspecJacob Keller, May 21, 2025
  5. Ben KnobleJun 4, 2025
  6. Jacob KellerJun 4, 2025
  7. Jacob KellerJun 4, 2025
  8. Junio C HamanoJun 4, 2025
  9. Jacob KellerJun 4, 2025
  10. D. Ben KnobleJun 4, 2025
  11. Junio C HamanoJun 4, 2025
  12. Johannes SchindelinSep 23, 2025
  13. Jacob KellerSep 23, 2025
  14. Johannes SchindelinSep 24, 2025
  15. Jacob KellerSep 24, 2025
  16. Jacob KellerSep 24, 2025
  17. Junio C HamanoMay 22, 2025
  18. Jacob KellerMay 22, 2025
  19. Junio C HamanoMay 22, 2025
  20. Junio C HamanoJun 3, 2025
  21. Ben KnobleJun 4, 2025
  22. Phillip WoodJun 5, 2025

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.