]> git.ipfire.org Git - thirdparty/git.git/commit
last-modified: verify revision argument is a commit-ish
authorToon Claes <toon@iotcl.com>
Fri, 30 Jan 2026 14:26:38 +0000 (15:26 +0100)
committerJunio C Hamano <gitster@pobox.com>
Fri, 30 Jan 2026 16:57:01 +0000 (08:57 -0800)
commit525ef52301be231c73393da5af4a4071f060eb20
treed9196ebe8c54c6f4607a82cca5ee6a5b017c6341
parentb768485c4b7ad0a80d0fd24ec941308b57ccb6ed
last-modified: verify revision argument is a commit-ish

Passing a non-committish revision to git-last-modified(1) triggers the
following BUG:

    git last-modified HEAD^{tree}
    BUG: builtin/last-modified.c:456: paths remaining beyond boundary in last-modified

Fix this error by ensuring that the given revision peels to a commit.

This change also adds a test to verify git-last-modified(1) can operate
on an annotated tag. For this an annotated tag is added that points to
the second commit. But this causes ambiguous results when calling
git-name-rev(1) with `--tags`, because now two tags point to the same
commit. To remove this ambiguity, pass `--exclude=<tag>` to
git-name-rev(1) to exclude the new annotated tag.

Reported-by: Gusted <gusted@codeberg.org>
Signed-off-by: Toon Claes <toon@iotcl.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/last-modified.c
t/t8020-last-modified.sh