From: Kristoffer Haugsbakk <code@khaugsbakk.name>
To: git@vger.kernel.org
Cc: Kristoffer Haugsbakk <code@khaugsbakk.name>,
Junio C Hamano <gitster@pobox.com>
Subject: [PATCH v4 1/4] doc: interpret-trailers: don’t use heredoc in examples
Date: Mon, 1 May 2023 22:02:38 +0200 [thread overview]
Message-ID: <149dcf964cb0ff056b8bb454602b07b316725400.1682970213.git.code@khaugsbakk.name> (raw)
In-Reply-To: <cover.1682970213.git.code@khaugsbakk.name>
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>
---
Documentation/git-interpret-trailers.txt | 74 +++++++++++-------------
1 file changed, 35 insertions(+), 39 deletions(-)
diff --git a/Documentation/git-interpret-trailers.txt b/Documentation/git-interpret-trailers.txt
index 22ff3a603e..4f4eb7a7fc 100644
--- a/Documentation/git-interpret-trailers.txt
+++ b/Documentation/git-interpret-trailers.txt
@@ -326,13 +326,12 @@ $ git config trailer.sign.key "Signed-off-by: "
$ git config trailer.sign.ifmissing add
$ git config trailer.sign.ifexists doNothing
$ git config trailer.sign.command 'echo "$(git config user.name) <$(git config user.email)>"'
-$ git interpret-trailers <<EOF
-> EOF
+$ git interpret-trailers </dev/null
Signed-off-by: Bob <bob@example.com>
-$ git interpret-trailers <<EOF
-> Signed-off-by: Alice <alice@example.com>
-> EOF
+$ cat msg.txt
+Signed-off-by: Alice <alice@example.com>
+$ git interpret-trailers <msg.txt
Signed-off-by: Alice <alice@example.com>
------------
@@ -357,15 +356,14 @@ Fix #42
$ cat ~/bin/glog-find-author
#!/bin/sh
test -n "$1" && git log --author="$1" --pretty="%an <%ae>" -1 || true
+$ cat msg.txt
+subject
+
+message
$ git config trailer.help.key "Helped-by: "
$ git config trailer.help.ifExists "addIfDifferentNeighbor"
$ git config trailer.help.cmd "~/bin/glog-find-author"
-$ git interpret-trailers --trailer="help:Junio" --trailer="help:Couder" <<EOF
-> subject
->
-> message
->
-> EOF
+$ git interpret-trailers --trailer="help:Junio" --trailer="help:Couder" <msg.txt
subject
message
@@ -382,15 +380,14 @@ Helped-by: Christian Couder <christian.couder@gmail.com>
$ cat ~/bin/glog-grep
#!/bin/sh
test -n "$1" && git log --grep "$1" --pretty=reference -1 || true
+$ cat msg.txt
+subject
+
+message
$ git config trailer.ref.key "Reference-to: "
$ git config trailer.ref.ifExists "replace"
$ git config trailer.ref.cmd "~/bin/glog-grep"
-$ git interpret-trailers --trailer="ref:Add copyright notices." <<EOF
-> subject
->
-> message
->
-> EOF
+$ git interpret-trailers --trailer="ref:Add copyright notices." <msg.txt
subject
message
@@ -402,17 +399,17 @@ Reference-to: 8bc9a0c769 (Add copyright notices., 2005-04-07)
commit that is related, and show how it works:
+
------------
+$ cat msg.txt
+subject
+
+message
+
+see: HEAD~2
$ git config trailer.see.key "See-also: "
$ git config trailer.see.ifExists "replace"
$ git config trailer.see.ifMissing "doNothing"
$ git config trailer.see.command "git log -1 --oneline --format=\"%h (%s)\" --abbrev-commit --abbrev=14 \$ARG"
-$ git interpret-trailers <<EOF
-> subject
->
-> message
->
-> see: HEAD~2
-> EOF
+$ git interpret-trailers <msg.txt
subject
message
@@ -427,22 +424,21 @@ See-also: fe3187489d69c4 (subject of related commit)
to add a 'git-version' trailer:
+
------------
-$ sed -e 's/ Z$/ /' >commit_template.txt <<EOF
-> ***subject***
->
-> ***message***
->
-> Fixes: Z
-> Cc: Z
-> Reviewed-by: Z
-> Signed-off-by: Z
-> EOF
+$ cat temp.txt
+***subject***
+
+***message***
+
+Fixes: Z
+Cc: Z
+Reviewed-by: Z
+Signed-off-by: Z
+$ sed -e 's/ Z$/ /' temp.txt > commit_template.txt
$ git config commit.template commit_template.txt
-$ cat >.git/hooks/commit-msg <<EOF
-> #!/bin/sh
-> git interpret-trailers --trim-empty --trailer "git-version: \$(git describe)" "\$1" > "\$1.new"
-> mv "\$1.new" "\$1"
-> EOF
+$ cat .git/hooks/commit-msg
+#!/bin/sh
+git interpret-trailers --trim-empty --trailer "git-version: \$(git describe)" "\$1" > "\$1.new"
+mv "\$1.new" "\$1"
$ chmod +x .git/hooks/commit-msg
------------
--
2.40.1
next prev parent reply other threads:[~2023-05-01 20:05 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20230331180817.14466-1-code@khaugsbakk.name>
2023-03-31 18:12 ` [PATCH 1/3] doc: interpret-trailers: remove trailing spaces Kristoffer Haugsbakk
2023-03-31 18:21 ` Kristoffer Haugsbakk
2023-03-31 18:28 ` Kristoffer Haugsbakk
2023-03-31 18:46 ` Junio C Hamano
2023-03-31 19:05 ` Junio C Hamano
2023-04-03 19:21 ` [PATCH v2 0/3] doc: interpret-trailers: don't use deprecated config Kristoffer Haugsbakk
2023-04-12 19:52 ` [PATCH v3 0/4] " Kristoffer Haugsbakk
2023-04-12 19:52 ` [PATCH v3 1/4] doc: interpret-trailers: don’t use heredoc in examples Kristoffer Haugsbakk
2023-04-12 21:16 ` Junio C Hamano
2023-04-12 19:52 ` [PATCH v3 2/4] doc: interpret-trailers: use input redirection Kristoffer Haugsbakk
2023-04-12 21:16 ` Junio C Hamano
2023-04-12 19:52 ` [PATCH v3 3/4] doc: interpret-trailers: don’t use deprecated config Kristoffer Haugsbakk
2023-04-12 19:52 ` [PATCH v3 4/4] doc: interpret-trailers: fix example Kristoffer Haugsbakk
2023-04-12 21:16 ` [PATCH v3 0/4] doc: interpret-trailers: don't use deprecated config Junio C Hamano
2023-05-01 20:02 ` [PATCH v4 " Kristoffer Haugsbakk
2023-05-01 20:02 ` Kristoffer Haugsbakk [this message]
2023-05-01 20:02 ` [PATCH v4 2/4] doc: interpret-trailers: use input redirection Kristoffer Haugsbakk
2023-05-01 20:02 ` [PATCH v4 3/4] doc: interpret-trailers: don’t use deprecated config Kristoffer Haugsbakk
2023-05-01 20:02 ` [PATCH v4 4/4] doc: interpret-trailers: fix example Kristoffer Haugsbakk
2023-05-01 20:59 ` [PATCH v4 0/4] doc: interpret-trailers: don't use deprecated config Junio C Hamano
[not found] ` <cover.1680548650.git.code@khaugsbakk.name>
2023-04-03 19:21 ` [PATCH v2 1/3] doc: interpret-trailers: don’t use heredoc in examples Kristoffer Haugsbakk
2023-04-03 20:16 ` Junio C Hamano
2023-04-03 19:22 ` [PATCH v2 2/3] doc: interpret-trailers: don’t use deprecated config Kristoffer Haugsbakk
2023-04-03 21:18 ` Junio C Hamano
2023-04-04 18:02 ` Kristoffer Haugsbakk
2023-04-04 18:37 ` Junio C Hamano
2023-04-05 7:46 ` ZheNing Hu
2023-04-05 7:45 ` ZheNing Hu
2023-04-05 9:09 ` Kristoffer Haugsbakk
2023-04-03 19:22 ` [PATCH v2 3/3] doc: interpret-trailers: fix examples Kristoffer Haugsbakk
2023-03-31 18:14 ` [PATCH 2/3] doc: interpret-trailers: don’t use deprecated config Kristoffer Haugsbakk
2023-04-01 0:22 ` Andrei Rybak
2023-03-31 18:16 ` [PATCH 3/3] doc: interpret-trailers: fix example Kristoffer Haugsbakk
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=149dcf964cb0ff056b8bb454602b07b316725400.1682970213.git.code@khaugsbakk.name \
--to=code@khaugsbakk.name \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).