doc: interpret-trailers: don’t use heredoc in examples

This file contains four instances of trailing spaces from its inception in commit [1]. These spaces might be intentional, since a user would be prompted with `> ` in an interactive session. On the one hand, this is a whitespace error according to `git diff --check`; on the other hand, the raw documentation—it makes no difference in the rendered output—is just staying faithful to the simulation of the interactive prompt. Let’s get rid of these whitespace errors and also make the examples more friendly to cut-and-paste by replacing the heredocs with files which are shown with cat(1). [1]: dfd66ddf5a (Documentation: add documentation for 'git interpret-trailers', 2014-10-13) Suggested-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Kristoffer Haugsbakk <code@khaugsbakk.name> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Kristoffer Haugsbakk committed May 1, 2023 at 22:02 UTC c892bcc94424f1297dadc1e5e9cb6e752a22e79e
1 file changed +35 -39
Documentation/git-interpret-trailers.txt
+35 -39
@@ -326,13 +326,12 @@ $ git config trailer.sign.key "Signed-off-by: "
326 $ git config trailer.sign.ifmissing add
327 $ git config trailer.sign.ifexists doNothing
328 $ git config trailer.sign.command 'echo "$(git config user.name) <$(git config user.email)>"'
329 -$ git interpret-trailers <<EOF
330 -> EOF
329 +$ git interpret-trailers </dev/null
330
331 Signed-off-by: Bob <bob@example.com>
333 -$ git interpret-trailers <<EOF
334 -> Signed-off-by: Alice <alice@example.com>
335 -> EOF
332 +$ cat msg.txt
333 +Signed-off-by: Alice <alice@example.com>
334 +$ git interpret-trailers <msg.txt
335
336 Signed-off-by: Alice <alice@example.com>
337 ------------
@@ -357,15 +356,14 @@ Fix #42
356 $ cat ~/bin/glog-find-author
357 #!/bin/sh
358 test -n "$1" && git log --author="$1" --pretty="%an <%ae>" -1 || true
359 +$ cat msg.txt
360 +subject
361 +
362 +message
363 $ git config trailer.help.key "Helped-by: "
364 $ git config trailer.help.ifExists "addIfDifferentNeighbor"
365 $ git config trailer.help.cmd "~/bin/glog-find-author"
363 -$ git interpret-trailers --trailer="help:Junio" --trailer="help:Couder" <<EOF
364 -> subject
365 ->
366 -> message
367 ->
368 -> EOF
366 +$ git interpret-trailers --trailer="help:Junio" --trailer="help:Couder" <msg.txt
367 subject
368
369 message
@@ -382,15 +380,14 @@ Helped-by: Christian Couder <christian.couder@gmail.com>
380 $ cat ~/bin/glog-grep
381 #!/bin/sh
382 test -n "$1" && git log --grep "$1" --pretty=reference -1 || true
383 +$ cat msg.txt
384 +subject
385 +
386 +message
387 $ git config trailer.ref.key "Reference-to: "
388 $ git config trailer.ref.ifExists "replace"
389 $ git config trailer.ref.cmd "~/bin/glog-grep"
388 -$ git interpret-trailers --trailer="ref:Add copyright notices." <<EOF
389 -> subject
390 ->
391 -> message
392 ->
393 -> EOF
390 +$ git interpret-trailers --trailer="ref:Add copyright notices." <msg.txt
391 subject
392
393 message
@@ -402,17 +399,17 @@ Reference-to: 8bc9a0c769 (Add copyright notices., 2005-04-07)
399 commit that is related, and show how it works:
400 +
401 ------------
402 +$ cat msg.txt
403 +subject
404 +
405 +message
406 +
407 +see: HEAD~2
408 $ git config trailer.see.key "See-also: "
409 $ git config trailer.see.ifExists "replace"
410 $ git config trailer.see.ifMissing "doNothing"
411 $ git config trailer.see.command "git log -1 --oneline --format=\"%h (%s)\" --abbrev-commit --abbrev=14 \$ARG"
409 -$ git interpret-trailers <<EOF
410 -> subject
411 ->
412 -> message
413 ->
414 -> see: HEAD~2
415 -> EOF
412 +$ git interpret-trailers <msg.txt
413 subject
414
415 message
@@ -427,22 +424,21 @@ See-also: fe3187489d69c4 (subject of related commit)
424 to add a 'git-version' trailer:
425 +
426 ------------
430 -$ sed -e 's/ Z$/ /' >commit_template.txt <<EOF
431 -> ***subject***
432 ->
433 -> ***message***
434 ->
435 -> Fixes: Z
436 -> Cc: Z
437 -> Reviewed-by: Z
438 -> Signed-off-by: Z
439 -> EOF
427 +$ cat temp.txt
428 +***subject***
429 +
430 +***message***
431 +
432 +Fixes: Z
433 +Cc: Z
434 +Reviewed-by: Z
435 +Signed-off-by: Z
436 +$ sed -e 's/ Z$/ /' temp.txt > commit_template.txt
437 $ git config commit.template commit_template.txt
441 -$ cat >.git/hooks/commit-msg <<EOF
442 -> #!/bin/sh
443 -> git interpret-trailers --trim-empty --trailer "git-version: \$(git describe)" "\$1" > "\$1.new"
444 -> mv "\$1.new" "\$1"
445 -> EOF
438 +$ cat .git/hooks/commit-msg
439 +#!/bin/sh
440 +git interpret-trailers --trim-empty --trailer "git-version: \$(git describe)" "\$1" > "\$1.new"
441 +mv "\$1.new" "\$1"
442 $ chmod +x .git/hooks/commit-msg
443 ------------
444