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

Re: git-last-modified(1) slower than git-log(1)?

From
Toon Claes <toon@iotcl.com>
Date
Jul 17, 2026, 19:12 UTC
Message-ID
<87fr1h1ldr.fsf@emacs.iotcl.com>
In-Reply-To
<87v7afffpa.fsf@emacs.iotcl.com>
Toon Claes <toon@iotcl.com> writes:
> You're actually not the first to notice this, and I've been aware of
> this.
Hah, wait, ... the previous reporter was ... you[1].
> The thing is, you're testing the difference on a single file.

I was mixing up use-cases, and the problem you're stating here isn't related to your previous report. Now while I did sent out patches for the problem in this email, the issue in the other email isn't addressed with it. Unfortunately.

(nerdsniping Peff :-))
Gusted <gusted@codeberg.org> writes:
Show 5 quoted lines
> The current implementation of Forgejo (inherited from Gitea) works
> roughly like this:
> 1. Run `git log --name-status -c --format=commit%x00%H %P%x00" --parents
> --no-renames -t -z $OID -- :(literal)some/path`, the output of this is
> quite complex and possible outputs more information than necessary.
That's quite clever actually.
> 2. The output of this is piped to some code to a parser and reconstructs
> what commit ID last modified each file in the directory.

My only worry would be this could end up in a very long list of (duplicate) commits. But you can probably filter out data as you read in lines.

> 3. Via `git cat-file --batch` get each unique commits information.
Yes we use git-cat-file(1) in batch mode too.

But, and I learned this from blog post[2] from GitHub about Git v2.55, git v2.55 now has git-format-rev(1)[3]. You can pipe the output of git-last-modified(1) into that and get everything you want at once (maybe).

I haven't tried yet to integrate that into GitLab to see if it would bring any gains.

[1]: https://lore.kernel.org/git/03f96860-29fc-42a7-a220-c3ec65eb8516@codeberg.org/ [2]: https://github.blog/open-source/git/highlights-from-git-2-55/ [3]: https://git-scm.com/docs/git-format-rev

-- 
Cheers,
Toon
Previous: Jeff King
Message 8 of 8 in “git-last-modified(1) slower than git-log(1)?”
  1. GustedJul 14, 2026
  2. Jeff KingJul 16, 2026
  3. Toon ClaesJul 16, 2026
  4. Jeff KingJul 17, 2026
  5. Toon ClaesJul 16, 2026
  6. GustedJul 17, 2026
  7. Jeff KingJul 17, 2026
  8. Toon ClaesJul 17, 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.