i'm trying to porting some
git log --topo-order --no-color --parents --boundary -z --pretty=format:%m%HX%PX%n%cn<%ce>%n%an<%ae>%n%at%n%s%n%b HEAD --all
X is not a format specifier.
The argument to
--pretty=tformat: (most users need
tformat, but this code is using
-z which adds a NUL character after each commit) contains both directives like
%H, and literal text that is simply transcribed:
$ git log -n 3 --pretty=tformat:hello%x25world hello%world hello%world hello%world
world strings were simply copied through, while
%x25 was interpreted. Since it means "print character with hex code 25" which is the percent sign
-n 3 told
git log to stop after logging three commits, we got three copies of
X works because
%m prints one character that is not
%P print hashes that do not contain
%n prints a newline—so whatever is reading this output can be sure that each commit begins with the marker character, an
X, the commit hash, another
X, and each parent hash with a space between each, then a newline.
%s%n%b sequence is not entirely necessary (one could simply use
%B instead). I'm not sure off-hand, though, whether this adjusts the way that "unusually formatted" commits—those that are not a single subject line, followed by a newline, followed by a commit body—come out. It probably does.
(I know nothing of libgit2.)