]> git.ipfire.org Git - thirdparty/git.git/commit
doc-diff: add `--cut-header-footer`
authorMartin Ågren <martin.agren@gmail.com>
Sun, 17 Mar 2019 18:36:03 +0000 (19:36 +0100)
committerJunio C Hamano <gitster@pobox.com>
Mon, 18 Mar 2019 06:54:17 +0000 (15:54 +0900)
commite605077260080584ec03be039a8c62ed2bd52e81
treeeb69793caacfbda4c083b17ae35c0a885bb864a8
parent2be39bb43da52680fbf60b2353033b908bd4eadf
doc-diff: add `--cut-header-footer`

AsciiDoc and Asciidoctor do not agree on what to write in the header and
footer of each man-page, i.e., the very first and the very last line of
*.[157]. Those differences can certainly be interesting in their own
right, but they clutter the output of `./doc-diff --from-asciidoc
--to-asciidoctor HEAD HEAD` quite a bit since the diff contains some
10-15 lines of noise per file diffed.

Teach doc-diff to cut away the first two and last two lines, i.e., the
header/footer and the empty line immediately following/preceding it.
Because Asciidoctor uses an extra empty line compared to AsciiDoc,
remove one more line at each end of the file, but only if it's empty.

An alternative approach might be to pass down `--no-header-footer`,
which both AsciiDoc and Asciidoctor understand, but it has some
drawbacks. First of all, the result doesn't build -- `xmlto` stumbles on
the resulting xml since it has multiple root elements. Second, it cuts
too much -- dropping the header loses the synopsis, which would be
interesting to diff.

Like in the previous commit, encode this option into the directory name
of the "installed" and "rendered" files. Otherwise, we wouldn't be able
to trust that what we use out of that cache actually corresponds to the
options given for this run. (We could optimize this caching a little
since this flag doesn't affect the contents of "installed" at all, but
let's punt on that.)

Signed-off-by: Martin Ågren <martin.agren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/doc-diff