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

Re: [PATCH] pretty: add diff-stat log placeholders

From
Junio C Hamano <gitster@pobox.com>
Date
May 4, 2026, 05:09 UTC
Message-ID
<xmqqmryfpxpg.fsf@gitster.g>
In-Reply-To
<pull.2284.git.git.1777578903593.gitgitgadget@gmail.com>
"Andrey Zarubin via GitGitGadget" <gitgitgadget@gmail.com> writes:
Show 25 quoted lines
> From: Andrey Zarubin <zarandr@gmail.com>
>
> Currently, users who want per-commit line/file change counts in
> a custom log format must post-process `git log --shortstat`
> output because the pretty formatter exposes no equivalent
> placeholders.
>
> Introduce `%(diff-stat:files)`, `%(diff-stat:insertions)`,
> `%(diff-stat:deletions)`, and `%(diff-stat:lines)`, computed
> from the same diffstat machinery as `--shortstat` and cached
> once per commit during format expansion.
>
> Short aliases are provided as `%aF`, `%aA`, and `%aR`. The
> requested `%aI` and `%aD` forms are unavailable because those
> names already expand to author dates, so use additions/removals
> mnemonics instead.
>
> When log output is already walking a diff, the formatter reuses
> the current diff queue. Otherwise it computes a private summary
> lazily, so formats without these placeholders still pay no diff
> cost.
>
> Signed-off-by: Andrey Zarubin <zarandr@gmail.com>
> ---
>     pretty: add diff-stat log placeholders

Personally I find this a bit on the other side of the line between sensible and insanity. Will we next be adding a new placeholder to show the summary (i.e. list of created, deleted, and renamed paths) and another placeholder to show the entire patch text?

Previous: Andrey Zarubin via GitGitGadgetNext: Andrey Zarubin
Message 2 of 3 in “pretty: add diff-stat log placeholders”
  1. pretty: add diff-stat log placeholdersAndrey Zarubin via GitGitGadget, Apr 30, 2026
  2. Junio C HamanoMay 4, 2026
  3. Andrey ZarubinMay 4, 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.