git/list[1] front-page[2] threads[3] people[4] search[5] about
 

git-last-modified weirdness

From
GGusted <gusted@codeberg.org>
Date
Jan 4, 2026, 05:13 UTC
Message-ID
<03f96860-29fc-42a7-a220-c3ec65eb8516@codeberg.org>
In-Reply-To
<406222e6-d10b-47d8-a177-de5912db4512@codeberg.org>
Hi,

Resending this mail as it looks like it might not have arrived (couldn't find it in the mailing list archive).

For Forgejo, I wanted to look into using git-last-modified to gain extra performance for larger repositories where this can often result in being (one of) the slowest git operation. However I noticed some problems that looks to be bugs.

I've ran all the following commands on the following Git repository, on Git v2.52.0 (Arch Linux) and my git config does not enable or disable any feature that should've impacted the any of the following observations.

$ tmp=$(mktemp -d) $ git clone https://codeberg.org/forgejo/forgejo $tmp $ cd tmp

During some experiments I noticed it being slower for some files. An example:

$ hyperfine --warmup 5 'git log --max-count=1 DCO' 'git last-modified DCO'
Benchmark 1: git log --max-count=1 DCO
   Time (mean ± σ):      86.9 ms ±   0.8 ms    [User: 70.1 ms, System: 
15.6 ms]
   Range (min … max):    85.5 ms …  88.3 ms    34 runs
Benchmark 2: git last-modified DCO
   Time (mean ± σ):     151.3 ms ±   4.3 ms    [User: 133.4 ms, System: 
15.9 ms]
   Range (min … max):   145.4 ms … 167.1 ms    19 runs

This might be me misunderstanding the feature, but it looks to me this cannot be used for paths that is inside a directory. The following two commands yield the same output:

$ git last-modified -- web_src 24019ef5e83fd7bed7f31ad09dd8d5f26b4bdc69        web_src $ git last-modified -- web_src/svg 24019ef5e83fd7bed7f31ad09dd8d5f26b4bdc69        web_src

Where I expected the latter command to return the last commit of web_src/svg.

I'm not sure why I tried this, but I can trigger a BUG when giving it some nonsense input:

$ git last-modified fb06ce04173d47aaaa498385621cba8b8dfd7584
BUG: builtin/last-modified.c:456: paths remaining beyond boundary in
last-modified
[1]    690163 IOT instruction (core dumped)  git last-modified

`fb06ce04173d47aaaa498385621cba8b8dfd7584` is the tree commit id of web_src. I suppose this should've returned a nice error message or blank output. It does give a blank output when you specify a valid path:

$ git last-modified fb06ce04173d47aaaa498385621cba8b8dfd7584 web_src

Kind regards, Gusted

Next: Toon Claes
Message 1 of 3 in “git-last-modified weirdness”
  1. GustedJan 4, 2026
  2. Toon ClaesJan 5, 2026
  3. GustedJan 5, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.