[PATCH 0/2] name-rev: learn --format=<pretty>
- From
- kristofferhaugsbakk@fastmail.com <kristofferhaugsbakk@fastmail.com>
- Date
- Mar 13, 2026, 16:03 UTC
- Message-ID
- <CV_name-rev_--format.4ad@msgid.xyz>
From: Kristoffer Haugsbakk <code@khaugsbakk.name>
Topic name: kh/name-rev-pretty-format
Topic summary: Teach git-name-rev(1) a mode to pretty format revisions instead of outputting symbolic names.
(See the second patch for details.)
The first patch is just for `CodingGuidelines`. Unrelated.
I have gone through three approaches: pretty print, `log-tree: log_tree_commit`, and pretty print again. At first I was confused when using `pretty_print_commit` because I couldn’t seem to get the same output as git-log(1):
# for git-log(1)
git log --format=<pretty>
# for git-name-rev(1)
git rev-list HEAD |
git name-rev --format=<pretty> --annotate-stdinBecause there were some minor differences for a few things I tried:
• fuller: log has the `commit <commit>` header; pretty does not • oneline: log has the oid; pretty does not
Then I tried `log_tree_commit`. But then I got some things that I didn’t want. This function also didn’t fit in with the git-name-rev(1) processing since it just dumps straight to standard out instead of allowing you to accumulate things in a scratch buffer (strbuf). So then I went back to the `pretty_print_commit` approach.
Notes are handled by reading the display refs. I can imagine that it would be better for this command to use `--[no-]notes` arguments like the ones that git-log(1) has for explicit control (without using env. variables).
[1/2] name-rev: wrap both blocks in braces [2/2] name-rev: learn --format=<pretty>
Documentation/git-name-rev.adoc | 9 +++- builtin/name-rev.c | 85 ++++++++++++++++++++++++++++----- t/t6120-describe.sh | 58 ++++++++++++++++++++++ 3 files changed, 139 insertions(+), 13 deletions(-)
base-commit: 67006b9db8b772423ad0706029286096307d2567
-- 2.53.0.32.gf6228eaf9cc