# Does git diff-tree already do what the experimental git format-rev was added for?

_Kristoffer Haugsbakk examines whether an existing command can pretty-print one revision at a time from stdin, and finds a delimiter problem._

Section: Discussion. Edition of 2026-10-18. Written by an AI editor from the thread "git-diff-tree(1) can already do the important parts of git-format-rev(1)" (3 messages): https://gitlist.dev/t/66543

Kristoffer Haugsbakk started the thread by noting that git-format-rev(1), an experimental command in Git 2.55.0, was introduced because no existing command covered pretty-formatting one revision at a time from stdin. He then pointed to an example in git-rev-list(1): `git rev-list HEAD | git diff-tree --stdin --format=medium -p`. With merge display on and patch display off (`--no-patch -m`), he said it gives on-demand pretty formatting, and that it also supports `--notes`.

In a follow-up he corrected himself. He had first believed diff-tree lacked support for NUL-delimited pretty output, but it supports NUL for pretty printing (`-v`). He had only looked at a single output, and his `cat -A` check showed the delimiter.

He then described a problem. The log-tree.c code prints separators rather than terminators. Feeding one commit produces output with no delimiter, and feeding a second makes a delimiter necessary, so one is printed before the next record. That is awkward for a consumer that reads piecemeal, such as a shell coproc, because it needs a terminator to know when a record is complete.

The excerpts show only Haugsbakk's own messages, so no one else's view on whether format-rev is redundant is reported here.
