Skip to content

Commit c892bcc

Browse files
LemmingAvalanchegitster
authored andcommitted
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]: dfd66dd (Documentation: add documentation for 'git interpret-trailers', 2014-10-13) Suggested-by: Junio C Hamano <[email protected]> Signed-off-by: Kristoffer Haugsbakk <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 73876f4 commit c892bcc

File tree

1 file changed

+35
-39
lines changed

1 file changed

+35
-39
lines changed

Documentation/git-interpret-trailers.txt

Lines changed: 35 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -326,13 +326,12 @@ $ git config trailer.sign.key "Signed-off-by: "
326326
$ git config trailer.sign.ifmissing add
327327
$ git config trailer.sign.ifexists doNothing
328328
$ 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
331330

332331
Signed-off-by: Bob <[email protected]>
333-
$ git interpret-trailers <<EOF
334-
> Signed-off-by: Alice <[email protected]>
335-
> EOF
332+
$ cat msg.txt
333+
Signed-off-by: Alice <[email protected]>
334+
$ git interpret-trailers <msg.txt
336335

337336
Signed-off-by: Alice <[email protected]>
338337
------------
@@ -357,15 +356,14 @@ Fix #42
357356
$ cat ~/bin/glog-find-author
358357
#!/bin/sh
359358
test -n "$1" && git log --author="$1" --pretty="%an <%ae>" -1 || true
359+
$ cat msg.txt
360+
subject
361+
362+
message
360363
$ git config trailer.help.key "Helped-by: "
361364
$ git config trailer.help.ifExists "addIfDifferentNeighbor"
362365
$ 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
369367
subject
370368

371369
message
@@ -382,15 +380,14 @@ Helped-by: Christian Couder <[email protected]>
382380
$ cat ~/bin/glog-grep
383381
#!/bin/sh
384382
test -n "$1" && git log --grep "$1" --pretty=reference -1 || true
383+
$ cat msg.txt
384+
subject
385+
386+
message
385387
$ git config trailer.ref.key "Reference-to: "
386388
$ git config trailer.ref.ifExists "replace"
387389
$ 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
394391
subject
395392

396393
message
@@ -402,17 +399,17 @@ Reference-to: 8bc9a0c769 (Add copyright notices., 2005-04-07)
402399
commit that is related, and show how it works:
403400
+
404401
------------
402+
$ cat msg.txt
403+
subject
404+
405+
message
406+
407+
see: HEAD~2
405408
$ git config trailer.see.key "See-also: "
406409
$ git config trailer.see.ifExists "replace"
407410
$ git config trailer.see.ifMissing "doNothing"
408411
$ 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
416413
subject
417414

418415
message
@@ -427,22 +424,21 @@ See-also: fe3187489d69c4 (subject of related commit)
427424
to add a 'git-version' trailer:
428425
+
429426
------------
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
440437
$ 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"
446442
$ chmod +x .git/hooks/commit-msg
447443
------------
448444

0 commit comments

Comments
 (0)