libgit2 - Decoding git log complex pretty format -
i'm trying porting git
-depending stuff libgit2
open source project.
1 of git
calls weird:
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
first of all, i'm interesting in format string. means x
after h
? unable find x
specifier on official git site :/ , second question - can libgit2
complex formatting, or should process myself?
p.s. however, i'm pretty sure cannot :)
the x
not format specifier.
the argument --pretty=format:
or --pretty=tformat:
(most users need tformat
, code using -z
adds nul character after each commit) contains both directives %m
, %h
, , literal text transcribed:
$ git log -n 3 --pretty=tformat:hello%x25world hello%world hello%world hello%world
here, hello
, world
strings copied through, while %x25
interpreted. since means "print character hex code 25" percent sign %
, , -n 3
told git log
stop after logging 3 commits, got 3 copies of hello%world
.
the literal x
works because %m
prints 1 character not x
, %h
, %p
print hashes not contain x
, , %n
prints newline—so whatever reading output can sure each commit begins marker character, x
, commit hash, x
, , each parent hash space between each, newline.
the %s%n%b
sequence not entirely necessary (one use %b
instead). i'm not sure off-hand, though, whether adjusts way "unusually formatted" commits—those not single subject line, followed newline, followed commit body—come out. does.
(i know nothing of libgit2.)
Comments
Post a Comment