<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/t/t4072-diff-max-depth.sh, branch jch</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=jch</id>
<link rel='self' href='https://git.shady.money/git/atom?h=jch'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2025-08-07T22:29:35Z</updated>
<entry>
<title>diff: teach tree-diff a max-depth parameter</title>
<updated>2025-08-07T22:29:35Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2025-08-07T20:52:58Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=a1dfa5448d583bbfd1ec45642a4495ad499970c9'/>
<id>urn:sha1:a1dfa5448d583bbfd1ec45642a4495ad499970c9</id>
<content type='text'>
When you are doing a tree-diff, there are basically two options: do not
recurse into subtrees at all, or recurse indefinitely. While most
callers would want to always recurse and see full pathnames, some may
want the efficiency of looking only at a particular level of the tree.
This is currently easy to do for the top-level (just turn off
recursion), but you cannot say "show me what changed in subdir/, but do
not recurse".

This patch adds a max-depth parameter which is measured from the closest
pathspec match, so that you can do:

  git log --raw --max-depth=1 -- a/b/c

and see the raw output for a/b/c/, but not those of a/b/c/d/
(instead of the raw output you would see for a/b/c/d).

Co-authored-by: Toon Claes &lt;toon@iotcl.com&gt;
Signed-off-by: Toon Claes &lt;toon@iotcl.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
