Subject: Re: [PATCH v3 4/4] last-modified: change default max-depth to 0

From: "Kristoffer Haugsbakk" <[email-masked]>
Date: Sun, 25 Jan 2026 12:24:54 +0100

On Tue, Jan 20, 2026, at 22:47, Toon Claes wrote:
> By default git-last-modified(1) doesn't recurse into subtrees. So when
> the pathspec contained a path in a subtree, the command would only print
> the commit information about the parent tree of the path, like:
>
>     $ git last-modified -- path/file
>     aaa0aab1bbb2bcc3ccc4ddd5dde6eee7eff8fff9	path
>
> Change the default behavior to give commit information about the exact
> path instead:
>
>     $ git last-modified -- path/file
>     aaa0aab1bbb2bcc3ccc4ddd5dde6eee7eff8fff9	path/file
>
> To achieve this, the default max-depth is changed to 0 and recursive is
> always enabled.
>
> The handling of option '-r' is modified to disable a max-depth,
> resulting in the behavior of this option to remain unchanged.
>
> No existing tests were modified, because there didn't exist any tests
> covering the example above. But more tests are added to cover this now.
>
> Signed-off-by: Toon Claes <[email-masked]>
> ---

Thanks. I think this makes more sense.

>[snip]
> --- a/Documentation/git-last-modified.adoc
> +++ b/Documentation/git-last-modified.adoc
> @@ -25,13 +25,14 @@ OPTIONS
>
>  `-r`::
>  `--recursive`::
> -	Instead of showing tree entries, step into subtrees and show all entries
> -	inside them recursively.
> +	Recursively traverse into all subtrees. By default, the command only
> +	shows tree entries matching the `<pathspec>`. With this option, it

This should be s/`<pathspec>`/_<pathspec>_ since this is a `[synopsis]`
doc. But this is in `next` so it will have to be left for another time.

>[snip]