Teach git-diff-tree(1) option --max-depth
Please consider these patches authored by Peff. They add option
--max-depth
to the diff machinery.
During the process to upstream the git-blame-tree(1), later named
git-last-modified(1), various times1 the topic was raised to add
option --max-depth
to the diff machinery. In this patch series this
change is added as a separate patch series.
The patches were originally written by Peff3 and I'm crediting him as the author. I've taken the patches almost verbatim from his fork on GitHub, with some minor tweaks in the commit messages. Because only tiny changes were made, I've kept his Signed-off-by trailers, but I can remove if you disagree.
The goal of the option --max-depth
is to stop recursively traversing
the tree if the given depth is reached from the pathspec.
These patches add max_depth
and max_depth_valid
to struct diff_options
. This is different from what git-grep(1) does, which uses
max_depth
on struct pathspec
instead. At the moment I'm on the fence
whether this is an issue: while it probably makes sense to consolidate
them into the same structs, it does not really make sense to reuse these
the struct fields if they are used in two separate code paths.
Cc: Jeff King peff@peff.net
--- b4-submit-tracking ---
This section is used internally by b4 prep for tracking purposes.
{ "series": { "revision": 1, "change-id": "20250724-toon-max-depth-25d3c19e2607", "prefixes": [] } }