]> git.ipfire.org Git - thirdparty/git.git/commit
last-modified: change default max-depth to 0
authorToon Claes <toon@iotcl.com>
Fri, 16 Jan 2026 13:22:53 +0000 (14:22 +0100)
committerJunio C Hamano <gitster@pobox.com>
Fri, 16 Jan 2026 18:27:20 +0000 (10:27 -0800)
commit9aeda2827b3956b6466b17d64e4b2c2bee3cd8ea
tree11865528d447e40562dc01567f9c63025fe4870a
parent19ccdcd2a5349534f01c8611d7adcac0267a10ee
last-modified: change default max-depth to 0

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 <toon@iotcl.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/git-last-modified.adoc
builtin/last-modified.c
t/t8020-last-modified.sh