{"thread":{"id":"59511","subject":"[PATCH 1/3] doc: interpret-trailers: remove trailing spaces","startedAt":"2023-03-31T18:13:28Z","lastAt":"2023-05-01T20:59:49Z","messageCount":33,"participants":["Kristoffer Haugsbakk","Junio C Hamano","Andrei Rybak","ZheNing Hu"],"isPatch":true,"patchVersion":1,"patchTotal":3},"messages":[{"id":"474520","messageId":"20230331181229.15255-1-code@khaugsbakk.name","threadId":"59511","inReplyTo":"20230331180817.14466-1-code@khaugsbakk.name","subject":"[PATCH 1/3] doc: interpret-trailers: remove trailing spaces","fromName":"Kristoffer Haugsbakk","fromEmail":"code@khaugsbakk.name","sentAt":"2023-03-31T18:12:29Z","receivedAt":"2023-03-31T18:13:28Z","isPatch":true,"sender":{"key":"code@khaugsbakk.name","avatar":"https://avatars.githubusercontent.com/u/2229597?v=4"},"body":"Signed-off-by: Kristoffer Haugsbakk <code@khaugsbakk.name>\n---\n Documentation/git-interpret-trailers.txt | 8 ++++----\n 1 file changed, 4 insertions(+), 4 deletions(-)\n\ndiff --git a/Documentation/git-interpret-trailers.txt b/Documentation/git-interpret-trailers.txt\nindex 22ff3a603e..787332771e 100644\n--- a/Documentation/git-interpret-trailers.txt\n+++ b/Documentation/git-interpret-trailers.txt\n@@ -408,9 +408,9 @@ $ git config trailer.see.ifMissing \"doNothing\"\n $ git config trailer.see.command \"git log -1 --oneline --format=\\\"%h (%s)\\\" --abbrev-commit --abbrev=14 \\$ARG\"\n $ git interpret-trailers <<EOF\n > subject\n-> \n+>\n > message\n-> \n+>\n > see: HEAD~2\n > EOF\n subject\n@@ -429,9 +429,9 @@ See-also: fe3187489d69c4 (subject of related commit)\n ------------\n $ sed -e 's/ Z$/ /' >commit_template.txt <<EOF\n > ***subject***\n-> \n+>\n > ***message***\n-> \n+>\n > Fixes: Z\n > Cc: Z\n > Reviewed-by: Z\n-- \n2.40.0\n\n"},{"id":"474521","messageId":"20230331181422.15409-1-code@khaugsbakk.name","threadId":"59511","inReplyTo":"20230331180817.14466-1-code@khaugsbakk.name","subject":"[PATCH 2/3] doc: interpret-trailers: don’t use deprecated config","fromName":"Kristoffer Haugsbakk","fromEmail":"code@khaugsbakk.name","sentAt":"2023-03-31T18:14:22Z","receivedAt":"2023-03-31T18:14:51Z","isPatch":true,"sender":{"key":"code@khaugsbakk.name","avatar":"https://avatars.githubusercontent.com/u/2229597?v=4"},"body":"`trailer.sign.command` has been deprecated since commit\nc364b7ef51 (trailer: add new .cmd config option, 2021-05-03).\n\nUse the commit message of c364b7ef51 as a guide to replace the use of\n`$ARG` and to use a script instead of an inline command.[1] Also,\nexplicitly trigger the command by passing in `--trailer=sign`, since\nthis config is not automatically used.[2]\n\n[1]: “Instead of \"$ARG\", users can refer to the value as positional\n   argument, $1, in their scripts.”\n[2]: “At the same time, in order to allow `git interpret-trailers` to\n   better simulate the behavior of `git command -s`,\n   'trailer.<token>.cmd' will not automatically execute.”\n\nCc: ZheNing Hu <adlternative@gmail.com>\nSigned-off-by: Kristoffer Haugsbakk <code@khaugsbakk.name>\n---\n Documentation/git-interpret-trailers.txt | 9 ++++++---\n 1 file changed, 6 insertions(+), 3 deletions(-)\n\ndiff --git a/Documentation/git-interpret-trailers.txt b/Documentation/git-interpret-trailers.txt\nindex 787332771e..792d61ae7b 100644\n--- a/Documentation/git-interpret-trailers.txt\n+++ b/Documentation/git-interpret-trailers.txt\n@@ -325,7 +325,7 @@ $ git interpret-trailers --trailer 'Cc: Alice <alice@example.com>' --trailer 'Re\n $ git config trailer.sign.key \"Signed-off-by: \"\n $ git config trailer.sign.ifmissing add\n $ git config trailer.sign.ifexists doNothing\n-$ git config trailer.sign.command 'echo \"$(git config user.name) <$(git config user.email)>\"'\n+$ git config trailer.sign.cmd 'echo \"$(git config user.name) <$(git config user.email)>\"'\n $ git interpret-trailers <<EOF\n > EOF\n \n@@ -402,11 +402,14 @@ Reference-to: 8bc9a0c769 (Add copyright notices., 2005-04-07)\n   commit that is related, and show how it works:\n +\n ------------\n+$ cat ~/bin/glog-ref\n+#!/bin/sh\n+git log -1 --oneline --format=\"%h (%s)\" --abbrev-commit --abbrev=14\n $ git config trailer.see.key \"See-also: \"\n $ git config trailer.see.ifExists \"replace\"\n $ git config trailer.see.ifMissing \"doNothing\"\n-$ git config trailer.see.command \"git log -1 --oneline --format=\\\"%h (%s)\\\" --abbrev-commit --abbrev=14 \\$ARG\"\n-$ git interpret-trailers <<EOF\n+$ git config trailer.see.cmd \"glog-ref\"\n+$ git interpret-trailers --trailer=see <<EOF\n > subject\n >\n > message\n-- \n2.40.0\n\n"},{"id":"474522","messageId":"20230331181652.15729-1-code@khaugsbakk.name","threadId":"59511","inReplyTo":"20230331180817.14466-1-code@khaugsbakk.name","subject":"[PATCH 3/3] doc: interpret-trailers: fix example","fromName":"Kristoffer Haugsbakk","fromEmail":"code@khaugsbakk.name","sentAt":"2023-03-31T18:16:52Z","receivedAt":"2023-03-31T18:17:14Z","isPatch":true,"sender":{"key":"code@khaugsbakk.name","avatar":"https://avatars.githubusercontent.com/u/2229597?v=4"},"body":"This command won’t output anything if you don’t give it an input and/or\na `--trailer`.\n\nCc: Christian Couder <chriscool@tuxfamily.org>\nSigned-off-by: Kristoffer Haugsbakk <code@khaugsbakk.name>\n---\n Documentation/git-interpret-trailers.txt | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/Documentation/git-interpret-trailers.txt b/Documentation/git-interpret-trailers.txt\nindex 792d61ae7b..2aa190fd3f 100644\n--- a/Documentation/git-interpret-trailers.txt\n+++ b/Documentation/git-interpret-trailers.txt\n@@ -326,7 +326,7 @@ $ git config trailer.sign.key \"Signed-off-by: \"\n $ git config trailer.sign.ifmissing add\n $ git config trailer.sign.ifexists doNothing\n $ git config trailer.sign.cmd 'echo \"$(git config user.name) <$(git config user.email)>\"'\n-$ git interpret-trailers <<EOF\n+$ git interpret-trailers --trailer sign <<EOF\n > EOF\n \n Signed-off-by: Bob <bob@example.com>\n-- \n2.40.0\n\n"},{"id":"474525","messageId":"e1d11808-3740-47ca-bbea-24858d09bfef@app.fastmail.com","threadId":"59511","inReplyTo":"20230331181229.15255-1-code@khaugsbakk.name","subject":"Re: [PATCH 1/3] doc: interpret-trailers: remove trailing spaces","fromName":"Kristoffer Haugsbakk","fromEmail":"code@khaugsbakk.name","sentAt":"2023-03-31T18:21:16Z","receivedAt":"2023-03-31T18:22:23Z","isPatch":true,"sender":{"key":"code@khaugsbakk.name","avatar":"https://avatars.githubusercontent.com/u/2229597?v=4"},"body":"On Fri, Mar 31, 2023, at 20:12, Kristoffer Haugsbakk wrote:\n> Signed-off-by: Kristoffer Haugsbakk <code@khaugsbakk.name>\n\nIt seems that my cover letter got denied since it contained non-ascii in the subject.\n\nI’ll re-roll later.\n\n-- \nKristoffer Haugsbakk\n"},{"id":"474526","messageId":"4c5ca07b-dd36-4176-8f93-bbae7c3f672f@app.fastmail.com","threadId":"59511","inReplyTo":"e1d11808-3740-47ca-bbea-24858d09bfef@app.fastmail.com","subject":"Re: [PATCH 1/3] doc: interpret-trailers: remove trailing spaces","fromName":"Kristoffer Haugsbakk","fromEmail":"code@khaugsbakk.name","sentAt":"2023-03-31T18:28:28Z","receivedAt":"2023-03-31T18:29:06Z","isPatch":true,"sender":{"key":"code@khaugsbakk.name","avatar":"https://avatars.githubusercontent.com/u/2229597?v=4"},"body":"On Fri, Mar 31, 2023, at 20:21, Kristoffer Haugsbakk wrote:\n> I’ll re-roll later.\n\nInterestingly though it worked for the third patch which had the same\nsubject since it got encoded properly. But I pasted in the same subject\nmanually in the cover letter.\n\n-- \nKristoffer Haugsbakk\n"},{"id":"474527","messageId":"xmqqsfdkep2b.fsf@gitster.g","threadId":"59511","inReplyTo":"20230331181229.15255-1-code@khaugsbakk.name","subject":"Re: [PATCH 1/3] doc: interpret-trailers: remove trailing spaces","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2023-03-31T18:46:52Z","receivedAt":"2023-03-31T18:47:00Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Kristoffer Haugsbakk <code@khaugsbakk.name> writes:\n\n>  $ git interpret-trailers <<EOF\n>  > subject\n> -> \n> +>\n>  > message\n> -> \n> +>\n>  > see: HEAD~2\n>  > EOF\n>  subject\n\nThis example pretends as if the above was an interactive session the\nwriter of the documentation did with a shell in a terminal, and\nthese lines are trying to show that each line is prefixed with $PS2\n(the secondary prompt string given by the shell for continued\nlines).\n\nTaking that fact into account, it is arguably more correct to keep\nthese spaces rather than removing them like this patch does, but of\ncourse it does not make a practical difference, because these spaces\nare invisible unless the reader reads the source documentation pages\nwithout passing them through AsciiDoc machinery.\n\nThe only folks that would be helped by this patch are those of us\nwho edit one of these four lines of the source file (perhaps by\nreplacing '>' with '|', such a patch tries to show use of a\ndifferent $PS2) and are annoyed to see trailing whitespaces their\npatch inherited from the original trigger \"git diff --check\"; I\nwonder if that is a good enough justification.\n\nI, however, do wonder if we should make our example more friendly to\ncutting and pasting.  And I would not mind it if we got rid of these\n4 trailing whitespaces as a side effect of such an effort.\n\nOne way to do so, while still pretending to show an actual session\nwith an interactive shell, may be to give the example with an empty\nstring set to $PS2, i.e.\n\n    $ git interpret-trailers <<\\EOF\n    subject\n\n    message\n\n    see: HEAD~2\n    EOF\n    subject\n    ...\n\nbut then it makes it a bit harder to see what is input and what is\noutput.  Showing with a separate intermediate file, i.e.\n\n    $ cat sample-message.txt\n    subject\n\n    message\n\n    see: HEAD~2\n    $ git interpret-trailers <sample-message.txt\n    subject\n    ...\n\nmight make the result slightly easier to follow.  I dunno.\n\nThe same comment applies to the other hunk.\n\nThanks.\n"},{"id":"474528","messageId":"xmqqo7o8eo83.fsf@gitster.g","threadId":"59511","inReplyTo":"xmqqsfdkep2b.fsf@gitster.g","subject":"Re: [PATCH 1/3] doc: interpret-trailers: remove trailing spaces","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2023-03-31T19:05:00Z","receivedAt":"2023-03-31T19:05:04Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n[jc: I forgot to cc the area expert, so here is a forward]\n\n> Kristoffer Haugsbakk <code@khaugsbakk.name> writes:\n>\n>>  $ git interpret-trailers <<EOF\n>>  > subject\n>> -> \n>> +>\n>>  > message\n>> -> \n>> +>\n>>  > see: HEAD~2\n>>  > EOF\n>>  subject\n>\n> This example pretends as if the above was an interactive session the\n> writer of the documentation did with a shell in a terminal, and\n> these lines are trying to show that each line is prefixed with $PS2\n> (the secondary prompt string given by the shell for continued\n> lines).\n>\n> Taking that fact into account, it is arguably more correct to keep\n> these spaces rather than removing them like this patch does, but of\n> course it does not make a practical difference, because these spaces\n> are invisible unless the reader reads the source documentation pages\n> without passing them through AsciiDoc machinery.\n>\n> The only folks that would be helped by this patch are those of us\n> who edit one of these four lines of the source file (perhaps by\n> replacing '>' with '|', such a patch tries to show use of a\n> different $PS2) and are annoyed to see trailing whitespaces their\n> patch inherited from the original trigger \"git diff --check\"; I\n> wonder if that is a good enough justification.\n>\n> I, however, do wonder if we should make our example more friendly to\n> cutting and pasting.  And I would not mind it if we got rid of these\n> 4 trailing whitespaces as a side effect of such an effort.\n>\n> One way to do so, while still pretending to show an actual session\n> with an interactive shell, may be to give the example with an empty\n> string set to $PS2, i.e.\n>\n>     $ git interpret-trailers <<\\EOF\n>     subject\n>\n>     message\n>\n>     see: HEAD~2\n>     EOF\n>     subject\n>     ...\n>\n> but then it makes it a bit harder to see what is input and what is\n> output.  Showing with a separate intermediate file, i.e.\n>\n>     $ cat sample-message.txt\n>     subject\n>\n>     message\n>\n>     see: HEAD~2\n>     $ git interpret-trailers <sample-message.txt\n>     subject\n>     ...\n>\n> might make the result slightly easier to follow.  I dunno.\n>\n> The same comment applies to the other hunk.\n>\n> Thanks.\n"},{"id":"474537","messageId":"21ac6dc4-3d1d-0075-cee7-bdaebaae36a6@gmail.com","threadId":"59511","inReplyTo":"20230331181422.15409-1-code@khaugsbakk.name","subject":"Re: [PATCH 2/3] doc: interpret-trailers: don’t use deprecated config","fromName":"Andrei Rybak","fromEmail":"rybak.a.v@gmail.com","sentAt":"2023-04-01T00:22:01Z","receivedAt":"2023-04-01T00:22:08Z","isPatch":true,"sender":{"key":"rybak.a.v@gmail.com","avatar":"https://avatars.githubusercontent.com/u/624072?v=4"},"body":"I've noticed a discrepancy in this patch\n\nOn 31/03/2023 20:14, Kristoffer Haugsbakk wrote:\n> explicitly trigger the command by passing in `--trailer=sign`, since\n\nCommit message mentions \"sign\" as the value for \"--trailer=\" ...\n\n> -$ git config trailer.see.command \"git log -1 --oneline --format=\\\"%h (%s)\\\" --abbrev-commit --abbrev=14 \\$ARG\"\n> -$ git interpret-trailers <<EOF\n> +$ git config trailer.see.cmd \"glog-ref\"\n> +$ git interpret-trailers --trailer=see <<EOF\n\n... but the new sample code uses \"see\" as the value.\n\n>   > subject\n>   >\n>   > message\n\n"},{"id":"474706","messageId":"cover.1680548208.git.code@khaugsbakk.name","threadId":"59511","inReplyTo":"20230331181229.15255-1-code@khaugsbakk.name","subject":"[PATCH v2 0/3] doc: interpret-trailers: don't use deprecated config","fromName":"Kristoffer Haugsbakk","fromEmail":"code@khaugsbakk.name","sentAt":"2023-04-03T19:21:58Z","receivedAt":"2023-04-03T19:23:41Z","isPatch":true,"sender":{"key":"code@khaugsbakk.name","avatar":"https://avatars.githubusercontent.com/u/2229597?v=4"},"body":"Replace deprecated `command` with `cmd` (patch 2). While visiting this\nfile also rewrite heredoc examples to use files which are shown with\ncat(1) (patch 1) and fix two examples that didn’t work properly (patch\n3).\n\n§ Changes in v2\n\nFirst of all I had to send a second version since I messed up sending my\nv1 cover letter (unencoded Unicode in the subject). But I ended up doing\nquite a few changes:\n\n1. Patch 1: Junio had some alternative suggestions. Remove trailing\n   spaces by using files which are shown with cat(1) and thereby make it\n   easier to copy-paste from the docs.\n2. Patch 2: Fix discrepancy (see/sign) in commit message (thanks to\n   Andrei Rybak)\n3. Patch 2: minor commit message correction\n4. Patch 3: Fix another example and build on top of it by using the\n   typical “subject/message” format instead of an empty file and an\n   s-o-b file (a file with just an s-o-b trailer)\n\nKristoffer Haugsbakk (3):\n  doc: interpret-trailers: don’t use heredoc in examples\n  doc: interpret-trailers: don’t use deprecated config\n  doc: interpret-trailers: fix examples\n\n Documentation/git-interpret-trailers.txt | 93 +++++++++++++-----------\n 1 file changed, 52 insertions(+), 41 deletions(-)\n\nRange-diff against v1:\n1:  b57fac21e4 < -:  ---------- doc: interpret-trailers: remove trailing spaces\n2:  d85e955ff2 < -:  ---------- doc: interpret-trailers: don’t use deprecated config\n3:  bd6b78a707 < -:  ---------- doc: interpret-trailers: fix example\n-:  ---------- > 1:  38f9a4bdf8 doc: interpret-trailers: don’t use heredoc in examples\n-:  ---------- > 2:  ea06be8f5a doc: interpret-trailers: don’t use deprecated config\n-:  ---------- > 3:  14555cf87f doc: interpret-trailers: fix examples\n--\n2.40.0\n"},{"id":"474707","messageId":"38f9a4bdf89f854c30a7b708e955e2089b031c13.1680548650.git.code@khaugsbakk.name","threadId":"59511","inReplyTo":"cover.1680548650.git.code@khaugsbakk.name","subject":"[PATCH v2 1/3] doc: interpret-trailers: don’t use heredoc in examples","fromName":"Kristoffer Haugsbakk","fromEmail":"code@khaugsbakk.name","sentAt":"2023-04-03T19:21:59Z","receivedAt":"2023-04-03T19:24:07Z","isPatch":true,"sender":{"key":"code@khaugsbakk.name","avatar":"https://avatars.githubusercontent.com/u/2229597?v=4"},"body":"This file contains four instances of trailing spaces from its inception\nin commit [1]. These spaces might be intentional, since a user would be\nprompted with `> ` in an interactive session. On the one hand, this is a\nwhitespace error according to `git diff --check`; on the other hand, the\nraw documentation—it makes no difference in the rendered output—is just\nstaying faithful to the simulation of the interactive prompt.\n\nLet’s get rid of these whitespace errors and also make the examples more\nfriendly to cut-and-paste by replacing the heredocs with files which are\nshown with cat(1).\n\n[1]: dfd66ddf5a (Documentation: add documentation for 'git\n    interpret-trailers', 2014-10-13)\n\nSuggested-by: Junio C Hamano <gitster@pobox.com>\nCc: Christian Couder <chriscool@tuxfamily.org>\nSigned-off-by: Kristoffer Haugsbakk <code@khaugsbakk.name>\n---\n\nNotes (series):\n    This was one of the suggestions by Junio[1]\n    \n    > Showing with a separate intermediate file, i.e.\n    > [snip]\n    > might make the result slightly easier to follow.  I dunno.\n    \n    [1]: https://lore.kernel.org/git/xmqqsfdkep2b.fsf@gitster.g/\n\n Documentation/git-interpret-trailers.txt | 72 +++++++++++-------------\n 1 file changed, 33 insertions(+), 39 deletions(-)\n\ndiff --git a/Documentation/git-interpret-trailers.txt b/Documentation/git-interpret-trailers.txt\nindex 22ff3a603e..dbbb6815c3 100644\n--- a/Documentation/git-interpret-trailers.txt\n+++ b/Documentation/git-interpret-trailers.txt\n@@ -326,13 +326,12 @@ $ git config trailer.sign.key \"Signed-off-by: \"\n $ git config trailer.sign.ifmissing add\n $ git config trailer.sign.ifexists doNothing\n $ git config trailer.sign.command 'echo \"$(git config user.name) <$(git config user.email)>\"'\n-$ git interpret-trailers <<EOF\n-> EOF\n+$ cat empty-msg.txt | git interpret-trailers\n \n Signed-off-by: Bob <bob@example.com>\n-$ git interpret-trailers <<EOF\n-> Signed-off-by: Alice <alice@example.com>\n-> EOF\n+$ cat msg.txt\n+Signed-off-by: Alice <alice@example.com>\n+$ cat msg.txt | git interpret-trailers\n \n Signed-off-by: Alice <alice@example.com>\n ------------\n@@ -357,15 +356,14 @@ Fix #42\n $ cat ~/bin/glog-find-author\n #!/bin/sh\n test -n \"$1\" && git log --author=\"$1\" --pretty=\"%an <%ae>\" -1 || true\n+$ cat msg.txt\n+subject\n+\n+message\n $ git config trailer.help.key \"Helped-by: \"\n $ git config trailer.help.ifExists \"addIfDifferentNeighbor\"\n $ git config trailer.help.cmd \"~/bin/glog-find-author\"\n-$ git interpret-trailers --trailer=\"help:Junio\" --trailer=\"help:Couder\" <<EOF\n-> subject\n->\n-> message\n->\n-> EOF\n+$ cat msg.txt | git interpret-trailers --trailer=\"help:Junio\" --trailer=\"help:Couder\"\n subject\n \n message\n@@ -382,15 +380,14 @@ Helped-by: Christian Couder <christian.couder@gmail.com>\n $ cat ~/bin/glog-grep\n #!/bin/sh\n test -n \"$1\" && git log --grep \"$1\" --pretty=reference -1 || true\n+$ cat msg.txt\n+subject\n+\n+message\n $ git config trailer.ref.key \"Reference-to: \"\n $ git config trailer.ref.ifExists \"replace\"\n $ git config trailer.ref.cmd \"~/bin/glog-grep\"\n-$ git interpret-trailers --trailer=\"ref:Add copyright notices.\" <<EOF\n-> subject\n->\n-> message\n->\n-> EOF\n+$ cat msg.txt | git interpret-trailers --trailer=\"ref:Add copyright notices.\"\n subject\n \n message\n@@ -402,17 +399,15 @@ Reference-to: 8bc9a0c769 (Add copyright notices., 2005-04-07)\n   commit that is related, and show how it works:\n +\n ------------\n+$ cat msg.txt\n+subject\n+\n+message\n $ git config trailer.see.key \"See-also: \"\n $ git config trailer.see.ifExists \"replace\"\n $ git config trailer.see.ifMissing \"doNothing\"\n $ git config trailer.see.command \"git log -1 --oneline --format=\\\"%h (%s)\\\" --abbrev-commit --abbrev=14 \\$ARG\"\n-$ git interpret-trailers <<EOF\n-> subject\n-> \n-> message\n-> \n-> see: HEAD~2\n-> EOF\n+$ cat msg.txt | git interpret-trailers\n subject\n \n message\n@@ -427,22 +422,21 @@ See-also: fe3187489d69c4 (subject of related commit)\n   to add a 'git-version' trailer:\n +\n ------------\n-$ sed -e 's/ Z$/ /' >commit_template.txt <<EOF\n-> ***subject***\n-> \n-> ***message***\n-> \n-> Fixes: Z\n-> Cc: Z\n-> Reviewed-by: Z\n-> Signed-off-by: Z\n-> EOF\n+$ cat commit_template.txt\n+***subject***\n+\n+***message***\n+\n+Fixes: Z\n+Cc: Z\n+Reviewed-by: Z\n+Signed-off-by: Z\n+$ sed --in-place -e 's/ Z$/ /' commit_template.txt\n $ git config commit.template commit_template.txt\n-$ cat >.git/hooks/commit-msg <<EOF\n-> #!/bin/sh\n-> git interpret-trailers --trim-empty --trailer \"git-version: \\$(git describe)\" \"\\$1\" > \"\\$1.new\"\n-> mv \"\\$1.new\" \"\\$1\"\n-> EOF\n+$ cat .git/hooks/commit-msg\n+#!/bin/sh\n+git interpret-trailers --trim-empty --trailer \"git-version: \\$(git describe)\" \"\\$1\" > \"\\$1.new\"\n+mv \"\\$1.new\" \"\\$1\"\n $ chmod +x .git/hooks/commit-msg\n ------------\n \n-- \n2.40.0\n\n"},{"id":"474708","messageId":"ea06be8f5ac77e5be64ab674f5a4fbe0b7e56c0e.1680548650.git.code@khaugsbakk.name","threadId":"59511","inReplyTo":"cover.1680548650.git.code@khaugsbakk.name","subject":"[PATCH v2 2/3] doc: interpret-trailers: don’t use deprecated config","fromName":"Kristoffer Haugsbakk","fromEmail":"code@khaugsbakk.name","sentAt":"2023-04-03T19:22:00Z","receivedAt":"2023-04-03T19:24:19Z","isPatch":true,"sender":{"key":"code@khaugsbakk.name","avatar":"https://avatars.githubusercontent.com/u/2229597?v=4"},"body":"`command` has been deprecated since commit c364b7ef51 (trailer: add new\n.cmd config option, 2021-05-03).\n\nUse the commit message of c364b7ef51 as a guide to replace the use of\n`$ARG` and to use a script instead of an inline command.[1] Also,\nexplicitly trigger the command by passing in `--trailer=see`, since\nthis config is not automatically used.[2]\n\n[1]: “Instead of \"$ARG\", users can refer to the value as positional\n   argument, $1, in their scripts.”\n[2]: “At the same time, in order to allow `git interpret-trailers` to\n   better simulate the behavior of `git command -s`,\n   'trailer.<token>.cmd' will not automatically execute.”\n\nCc: ZheNing Hu <adlternative@gmail.com>\nSigned-off-by: Kristoffer Haugsbakk <code@khaugsbakk.name>\n---\n Documentation/git-interpret-trailers.txt | 9 ++++++---\n 1 file changed, 6 insertions(+), 3 deletions(-)\n\ndiff --git a/Documentation/git-interpret-trailers.txt b/Documentation/git-interpret-trailers.txt\nindex dbbb6815c3..c76efae76a 100644\n--- a/Documentation/git-interpret-trailers.txt\n+++ b/Documentation/git-interpret-trailers.txt\n@@ -325,7 +325,7 @@ $ git interpret-trailers --trailer 'Cc: Alice <alice@example.com>' --trailer 'Re\n $ git config trailer.sign.key \"Signed-off-by: \"\n $ git config trailer.sign.ifmissing add\n $ git config trailer.sign.ifexists doNothing\n-$ git config trailer.sign.command 'echo \"$(git config user.name) <$(git config user.email)>\"'\n+$ git config trailer.sign.cmd 'echo \"$(git config user.name) <$(git config user.email)>\"'\n $ cat empty-msg.txt | git interpret-trailers\n \n Signed-off-by: Bob <bob@example.com>\n@@ -403,11 +403,14 @@ $ cat msg.txt\n subject\n \n message\n+$ cat ~/bin/glog-ref\n+#!/bin/sh\n+git log -1 --oneline --format=\"%h (%s)\" --abbrev-commit --abbrev=14\n $ git config trailer.see.key \"See-also: \"\n $ git config trailer.see.ifExists \"replace\"\n $ git config trailer.see.ifMissing \"doNothing\"\n-$ git config trailer.see.command \"git log -1 --oneline --format=\\\"%h (%s)\\\" --abbrev-commit --abbrev=14 \\$ARG\"\n-$ cat msg.txt | git interpret-trailers\n+$ git config trailer.see.cmd \"glog-ref\"\n+$ cat msg.txt | git interpret-trailers --trailer=see\n subject\n \n message\n-- \n2.40.0\n\n"},{"id":"474709","messageId":"14555cf87fa5fdc0ce14c7077ba212d16ad3bc76.1680548650.git.code@khaugsbakk.name","threadId":"59511","inReplyTo":"cover.1680548650.git.code@khaugsbakk.name","subject":"[PATCH v2 3/3] doc: interpret-trailers: fix examples","fromName":"Kristoffer Haugsbakk","fromEmail":"code@khaugsbakk.name","sentAt":"2023-04-03T19:22:01Z","receivedAt":"2023-04-03T19:24:27Z","isPatch":true,"sender":{"key":"code@khaugsbakk.name","avatar":"https://avatars.githubusercontent.com/u/2229597?v=4"},"body":"We need to provide `--trailer sign` since the command won’t output\nanything if you don’t give it an input and/or a\n`--trailer`. Furthermore, the example where `msg.txt` already contains\nan s-o-b is wrong:\n\n    $ cat msg.txt | git interpret-trailers --trailer sign\n    Signed-off-by: Alice <alice@example.com>\n\n    Signed-off-by: Alice <alice@example.com>\n\nA file which only consists of one trailer line is not interpreted as the\noriginal example must have expected. So change the examples to use the\ntypical “subject/message” file.\n\nCc: Christian Couder <chriscool@tuxfamily.org>\nSigned-off-by: Kristoffer Haugsbakk <code@khaugsbakk.name>\n---\n\nNotes (series):\n    This isn’t just a quirk of this series but also happens on `master`:\n    \n        $ git config trailer.sign.ifmissing add\n        $ git config trailer.sign.ifexists doNothing\n        $ git config trailer.sign.command 'echo \"$(git config user.name) <$(git config user.email)>\"'\n        $ git interpret-trailers <<EOF\n        > EOF\n        $ git interpret-trailers <<EOF\n        Signed-off-by: Alice <alice@example.com>\n        > EOF\n        Signed-off-by: Alice <alice@example.com>\n    \n        Signed-off-by: Kristoffer Haugsbakk <code@khaugsbakk.name>\n\n Documentation/git-interpret-trailers.txt | 20 +++++++++++++++++---\n 1 file changed, 17 insertions(+), 3 deletions(-)\n\ndiff --git a/Documentation/git-interpret-trailers.txt b/Documentation/git-interpret-trailers.txt\nindex c76efae76a..c6f5b92ecc 100644\n--- a/Documentation/git-interpret-trailers.txt\n+++ b/Documentation/git-interpret-trailers.txt\n@@ -322,16 +322,30 @@ $ git interpret-trailers --trailer 'Cc: Alice <alice@example.com>' --trailer 'Re\n   'Signed-off-by: ' already, and show how it works:\n +\n ------------\n+$ cat msg1.txt\n+subject\n+\n+message\n $ git config trailer.sign.key \"Signed-off-by: \"\n $ git config trailer.sign.ifmissing add\n $ git config trailer.sign.ifexists doNothing\n $ git config trailer.sign.cmd 'echo \"$(git config user.name) <$(git config user.email)>\"'\n-$ cat empty-msg.txt | git interpret-trailers\n+$ cat msg1.txt | git interpret-trailers --trailer sign\n+subject\n+\n+message\n \n Signed-off-by: Bob <bob@example.com>\n-$ cat msg.txt\n+$ cat msg2.txt\n+subject\n+\n+message\n+\n Signed-off-by: Alice <alice@example.com>\n-$ cat msg.txt | git interpret-trailers\n+$ cat msg2.txt | git interpret-trailers --trailer sign\n+subject\n+\n+message\n \n Signed-off-by: Alice <alice@example.com>\n ------------\n-- \n2.40.0\n\n"},{"id":"474713","messageId":"xmqqmt3o4t81.fsf@gitster.g","threadId":"59511","inReplyTo":"38f9a4bdf89f854c30a7b708e955e2089b031c13.1680548650.git.code@khaugsbakk.name","subject":"Re: [PATCH v2 1/3] doc: interpret-trailers: don’t use heredoc in examples","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2023-04-03T20:16:14Z","receivedAt":"2023-04-03T20:16:23Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"> @@ -357,15 +356,14 @@ Fix #42\n>  $ cat ~/bin/glog-find-author\n>  #!/bin/sh\n>  test -n \"$1\" && git log --author=\"$1\" --pretty=\"%an <%ae>\" -1 || true\n> +$ cat msg.txt\n> +subject\n> +\n> +message\n\nWhen I suggested to use \"cat\" to show contents, instead of\npretending an interactive session, I didn't check if we already had\nexamples, but it looks like we did, which is great.\n\n> +$ cat msg.txt | git interpret-trailers --trailer=\"help:Junio\" --trailer=\"help:Couder\"\n\nDo not \"cat\" a single file and pipe into another command.  It will\nalways be equivalent to redirecting that file into the command on\nthe downstream, i.e.\n\n   $ git interpret-trailers --options <mst.txt\n\n> +$ sed --in-place -e 's/ Z$/ /' commit_template.txt\n\nAvoid \"--in-place\"; not everybody's \"sed\" has it.\n\nOther than that, I didn't spot anything glaringly wrong.\n\nThanks for working on this series.\n"},{"id":"474715","messageId":"xmqqbkk44qbo.fsf@gitster.g","threadId":"59511","inReplyTo":"ea06be8f5ac77e5be64ab674f5a4fbe0b7e56c0e.1680548650.git.code@khaugsbakk.name","subject":"Re: [PATCH v2 2/3] doc: interpret-trailers: don’t use deprecated config","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2023-04-03T21:18:51Z","receivedAt":"2023-04-03T21:19:01Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Kristoffer Haugsbakk <code@khaugsbakk.name> writes:\n\n> [2]: “At the same time, in order to allow `git interpret-trailers` to\n>    better simulate the behavior of `git command -s`,\n>    'trailer.<token>.cmd' will not automatically execute.”\n\nThis may be a question more for Zhening than for you, but is the\nabove a typo for \"git commit -s\", not \"command\"?\n\n> +$ git config trailer.see.cmd \"glog-ref\"\n> +$ cat msg.txt | git interpret-trailers --trailer=see\n\nThis is inherited from the original, but it is a poor practice to\nrun \"cat\" on a single file and pipe the result to another command.\nJust redirect from the file into the downstream command instead,\ni.e.\n\n    $ git interpret-trailers <empty-msg.txt\n\nPerhaps we should do that as a preliminary clean-up before these\nupdates?\n"},{"id":"474793","messageId":"bbdd2746-cfb6-4841-8314-4bdad5493f72@app.fastmail.com","threadId":"59511","inReplyTo":"xmqqbkk44qbo.fsf@gitster.g","subject":"Re: [PATCH v2 2/3] doc: interpret-trailers: don’t use deprecated config","fromName":"Kristoffer Haugsbakk","fromEmail":"code@khaugsbakk.name","sentAt":"2023-04-04T18:02:53Z","receivedAt":"2023-04-04T18:03:18Z","isPatch":true,"sender":{"key":"code@khaugsbakk.name","avatar":"https://avatars.githubusercontent.com/u/2229597?v=4"},"body":"On Mon, Apr 3, 2023, at 23:18, Junio C Hamano wrote:\n> Perhaps we should do that as a preliminary clean-up before these\n> updates?\n\nI think updating to use `<msg.txt` for existing (on `master`) examples\nwould fit in as patch number 2, since I rewrite heredocs to use files in\npatch 1. The commit message for patch 2 would then say, “and let’s make\nthings consistent for the other examples as well”.\n\nThanks for spotting that. :)\n\n-- \nKristoffer Haugsbakk\n"},{"id":"474796","messageId":"xmqqy1n7ze7j.fsf@gitster.g","threadId":"59511","inReplyTo":"bbdd2746-cfb6-4841-8314-4bdad5493f72@app.fastmail.com","subject":"Re: [PATCH v2 2/3] doc: interpret-trailers: don’t use deprecated config","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2023-04-04T18:37:04Z","receivedAt":"2023-04-04T18:38:52Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Kristoffer Haugsbakk\" <code@khaugsbakk.name> writes:\n\n> On Mon, Apr 3, 2023, at 23:18, Junio C Hamano wrote:\n>> Perhaps we should do that as a preliminary clean-up before these\n>> updates?\n>\n> I think updating to use `<msg.txt` for existing (on `master`) examples\n> would fit in as patch number 2, since I rewrite heredocs to use files in\n> patch 1. The commit message for patch 2 would then say, “and let’s make\n> things consistent for the other examples as well”.\n\nThe suggestion to do so in a separate preliminary step was made\nbecause I had an impression that existing examples were full of\nthese \"cat file | command\" patterns, and you were adjusting only\nsome of them.  If there were (I didn't count or re-check the file)\nsay 10 such bad examples and you are only changing only two for the\nprimary purpose of the patch (i.e. use interpret-trailers command\ncorrectly), updating the other 8 bad examples \"while at it\" would\nmake the patch with unnecessarily noisy, and fixing the \"cat file |\"\nin a separate step may help us let each step of the series focus on\none thing and do it well.\n\nBut I see there is only one or two existing \"cat file | command\", so\nI agree with you that it is more reasonable to do it there.\n\nThanks.\n"},{"id":"474826","messageId":"CAOLTT8QJYumrv1G1SQ8005n2ab1Ycyoc6T_YyFHunJM5=6ZmtQ@mail.gmail.com","threadId":"59511","inReplyTo":"ea06be8f5ac77e5be64ab674f5a4fbe0b7e56c0e.1680548650.git.code@khaugsbakk.name","subject":"Re: [PATCH v2 2/3] doc: interpret-trailers: don’t use deprecated config","fromName":"ZheNing Hu","fromEmail":"adlternative@gmail.com","sentAt":"2023-04-05T07:45:48Z","receivedAt":"2023-04-05T07:45:54Z","isPatch":true,"sender":{"key":"adlternative@gmail.com","avatar":"https://avatars.githubusercontent.com/u/58138461?v=4"},"body":"Kristoffer Haugsbakk <code@khaugsbakk.name> 于2023年4月4日周二 03:24写道：\n>\n> `command` has been deprecated since commit c364b7ef51 (trailer: add new\n> .cmd config option, 2021-05-03).\n>\n> Use the commit message of c364b7ef51 as a guide to replace the use of\n> `$ARG` and to use a script instead of an inline command.[1] Also,\n> explicitly trigger the command by passing in `--trailer=see`, since\n> this config is not automatically used.[2]\n>\n> [1]: “Instead of \"$ARG\", users can refer to the value as positional\n>    argument, $1, in their scripts.”\n> [2]: “At the same time, in order to allow `git interpret-trailers` to\n>    better simulate the behavior of `git command -s`,\n>    'trailer.<token>.cmd' will not automatically execute.”\n>\n\nChanging these examples from command -> cmd makes sense.\nSo users will tend to use 'cmd' instead of 'command' as much as\npossible when referring to examples.\n\n> Cc: ZheNing Hu <adlternative@gmail.com>\n> Signed-off-by: Kristoffer Haugsbakk <code@khaugsbakk.name>\n> ---\n>  Documentation/git-interpret-trailers.txt | 9 ++++++---\n>  1 file changed, 6 insertions(+), 3 deletions(-)\n>\n> diff --git a/Documentation/git-interpret-trailers.txt b/Documentation/git-interpret-trailers.txt\n> index dbbb6815c3..c76efae76a 100644\n> --- a/Documentation/git-interpret-trailers.txt\n> +++ b/Documentation/git-interpret-trailers.txt\n> @@ -325,7 +325,7 @@ $ git interpret-trailers --trailer 'Cc: Alice <alice@example.com>' --trailer 'Re\n>  $ git config trailer.sign.key \"Signed-off-by: \"\n>  $ git config trailer.sign.ifmissing add\n>  $ git config trailer.sign.ifexists doNothing\n> -$ git config trailer.sign.command 'echo \"$(git config user.name) <$(git config user.email)>\"'\n> +$ git config trailer.sign.cmd 'echo \"$(git config user.name) <$(git config user.email)>\"'\n>  $ cat empty-msg.txt | git interpret-trailers\n>\n>  Signed-off-by: Bob <bob@example.com>\n> @@ -403,11 +403,14 @@ $ cat msg.txt\n>  subject\n>\n>  message\n> +$ cat ~/bin/glog-ref\n> +#!/bin/sh\n> +git log -1 --oneline --format=\"%h (%s)\" --abbrev-commit --abbrev=14\n>  $ git config trailer.see.key \"See-also: \"\n>  $ git config trailer.see.ifExists \"replace\"\n>  $ git config trailer.see.ifMissing \"doNothing\"\n> -$ git config trailer.see.command \"git log -1 --oneline --format=\\\"%h (%s)\\\" --abbrev-commit --abbrev=14 \\$ARG\"\n> -$ cat msg.txt | git interpret-trailers\n> +$ git config trailer.see.cmd \"glog-ref\"\n> +$ cat msg.txt | git interpret-trailers --trailer=see\n>  subject\n>\n>  message\n> --\n> 2.40.0\n>\n\nThanks.\n--\nZheNing Hu\n"},{"id":"474827","messageId":"CAOLTT8QQABhiUsNiyDZj40yU2wu9RwkL=OANtLqzOrMioHMUZQ@mail.gmail.com","threadId":"59511","inReplyTo":"xmqqbkk44qbo.fsf@gitster.g","subject":"Re: [PATCH v2 2/3] doc: interpret-trailers: don’t use deprecated config","fromName":"ZheNing Hu","fromEmail":"adlternative@gmail.com","sentAt":"2023-04-05T07:46:45Z","receivedAt":"2023-04-05T07:46:51Z","isPatch":true,"sender":{"key":"adlternative@gmail.com","avatar":"https://avatars.githubusercontent.com/u/58138461?v=4"},"body":"Junio C Hamano <gitster@pobox.com> 于2023年4月4日周二 05:18写道：\n>\n> Kristoffer Haugsbakk <code@khaugsbakk.name> writes:\n>\n> > [2]: “At the same time, in order to allow `git interpret-trailers` to\n> >    better simulate the behavior of `git command -s`,\n> >    'trailer.<token>.cmd' will not automatically execute.”\n>\n> This may be a question more for Zhening than for you, but is the\n> above a typo for \"git commit -s\", not \"command\"?\n>\n\nAh, indeed it was a typo.\n\n> > +$ git config trailer.see.cmd \"glog-ref\"\n> > +$ cat msg.txt | git interpret-trailers --trailer=see\n>\n> This is inherited from the original, but it is a poor practice to\n> run \"cat\" on a single file and pipe the result to another command.\n> Just redirect from the file into the downstream command instead,\n> i.e.\n>\n>     $ git interpret-trailers <empty-msg.txt\n>\n> Perhaps we should do that as a preliminary clean-up before these\n> updates?\n"},{"id":"474830","messageId":"7941ae15-a29c-4163-8170-02fd96a80048@app.fastmail.com","threadId":"59511","inReplyTo":"CAOLTT8QJYumrv1G1SQ8005n2ab1Ycyoc6T_YyFHunJM5=6ZmtQ@mail.gmail.com","subject":"Re: [PATCH v2 2/3] doc: interpret-trailers: don’t use deprecated config","fromName":"Kristoffer Haugsbakk","fromEmail":"code@khaugsbakk.name","sentAt":"2023-04-05T09:09:12Z","receivedAt":"2023-04-05T09:11:45Z","isPatch":true,"sender":{"key":"code@khaugsbakk.name","avatar":"https://avatars.githubusercontent.com/u/2229597?v=4"},"body":"On Wed, Apr 5, 2023, at 09:45, ZheNing Hu wrote:\n> Changing these examples from command -> cmd makes sense.\n> So users will tend to use 'cmd' instead of 'command' as much as\n> possible when referring to examples.\n\nThanks ZheNing. I’ll add an “ack” trailer to this patch. :)\n\n-- \nKristoffer Haugsbakk\n"},{"id":"475227","messageId":"cover.1681326818.git.code@khaugsbakk.name","threadId":"59511","inReplyTo":"cover.1680548208.git.code@khaugsbakk.name","subject":"[PATCH v3 0/4] doc: interpret-trailers: don't use deprecated config","fromName":"Kristoffer Haugsbakk","fromEmail":"code@khaugsbakk.name","sentAt":"2023-04-12T19:52:11Z","receivedAt":"2023-04-12T19:54:27Z","isPatch":true,"sender":{"key":"code@khaugsbakk.name","avatar":"https://avatars.githubusercontent.com/u/2229597?v=4"},"body":"Replace deprecated `command` with `cmd` (patch 3). While visiting this\nfile also:\n\n• rewrite heredoc examples to use files which are shown with\n  cat(1) (patch 1);\n• use input redirection instead of using cat(1) piped into `git\n  interpret-trailers` (patch 2); and\n• fix an example that didn’t work properly (patch 4).\n\n§ Changes in v3\n\n• All patches: drop “Cc” trailers\n• Patch 1: Use input redirection instead of `cat msg.txt | git […]`\n• Patch 2: New\n• Patch 3: Add “acked” trailer\n• Patch 4: Tweak commit message\n\nKristoffer Haugsbakk (4):\n  doc: interpret-trailers: don’t use heredoc in examples\n  doc: interpret-trailers: use input redirection\n  doc: interpret-trailers: don’t use deprecated config\n  doc: interpret-trailers: fix example\n\n Documentation/git-interpret-trailers.txt | 97 ++++++++++++++----------\n 1 file changed, 55 insertions(+), 42 deletions(-)\n\nRange-diff against v2:\n1:  38f9a4bdf8 ! 1:  fd515ad8b4 doc: interpret-trailers: don’t use heredoc in examples\n    @@ Commit message\n             interpret-trailers', 2014-10-13)\n\n         Suggested-by: Junio C Hamano <gitster@pobox.com>\n    -    Cc: Christian Couder <chriscool@tuxfamily.org>\n         Signed-off-by: Kristoffer Haugsbakk <code@khaugsbakk.name>\n\n    -\n    - ## Notes (series) ##\n    -    This was one of the suggestions by Junio[1]\n    -\n    -    > Showing with a separate intermediate file, i.e.\n    -    > [snip]\n    -    > might make the result slightly easier to follow.  I dunno.\n    -\n    -    [1]: https://lore.kernel.org/git/xmqqsfdkep2b.fsf@gitster.g/\n    -\n      ## Documentation/git-interpret-trailers.txt ##\n     @@ Documentation/git-interpret-trailers.txt: $ git config trailer.sign.key \"Signed-off-by: \"\n      $ git config trailer.sign.ifmissing add\n    @@ Documentation/git-interpret-trailers.txt: $ git config trailer.sign.key \"Signed-\n      $ git config trailer.sign.command 'echo \"$(git config user.name) <$(git config user.email)>\"'\n     -$ git interpret-trailers <<EOF\n     -> EOF\n    -+$ cat empty-msg.txt | git interpret-trailers\n    ++$ git interpret-trailers <empty-msg.txt\n\n      Signed-off-by: Bob <bob@example.com>\n     -$ git interpret-trailers <<EOF\n    @@ Documentation/git-interpret-trailers.txt: $ git config trailer.sign.key \"Signed-\n     -> EOF\n     +$ cat msg.txt\n     +Signed-off-by: Alice <alice@example.com>\n    -+$ cat msg.txt | git interpret-trailers\n    ++$ git interpret-trailers <msg.txt\n\n      Signed-off-by: Alice <alice@example.com>\n      ------------\n    @@ Documentation/git-interpret-trailers.txt: Fix #42\n     -> message\n     ->\n     -> EOF\n    -+$ cat msg.txt | git interpret-trailers --trailer=\"help:Junio\" --trailer=\"help:Couder\"\n    ++$ git interpret-trailers --trailer=\"help:Junio\" --trailer=\"help:Couder\" <msg.txt\n      subject\n\n      message\n    @@ Documentation/git-interpret-trailers.txt: Helped-by: Christian Couder <christian\n     -> message\n     ->\n     -> EOF\n    -+$ cat msg.txt | git interpret-trailers --trailer=\"ref:Add copyright notices.\"\n    ++$ git interpret-trailers --trailer=\"ref:Add copyright notices.\" <msg.txt\n      subject\n\n      message\n    @@ Documentation/git-interpret-trailers.txt: Reference-to: 8bc9a0c769 (Add copyrigh\n     +subject\n     +\n     +message\n    ++\n    ++see: HEAD~2\n      $ git config trailer.see.key \"See-also: \"\n      $ git config trailer.see.ifExists \"replace\"\n      $ git config trailer.see.ifMissing \"doNothing\"\n    @@ Documentation/git-interpret-trailers.txt: Reference-to: 8bc9a0c769 (Add copyrigh\n     ->\n     -> see: HEAD~2\n     -> EOF\n    -+$ cat msg.txt | git interpret-trailers\n    ++$ git interpret-trailers <msg.txt\n      subject\n\n      message\n    @@ Documentation/git-interpret-trailers.txt: See-also: fe3187489d69c4 (subject of r\n     -> Reviewed-by: Z\n     -> Signed-off-by: Z\n     -> EOF\n    -+$ cat commit_template.txt\n    ++$ cat temp.txt\n     +***subject***\n     +\n     +***message***\n    @@ Documentation/git-interpret-trailers.txt: See-also: fe3187489d69c4 (subject of r\n     +Cc: Z\n     +Reviewed-by: Z\n     +Signed-off-by: Z\n    -+$ sed --in-place -e 's/ Z$/ /' commit_template.txt\n    ++$ sed -e 's/ Z$/ /' temp.txt > commit_template.txt\n      $ git config commit.template commit_template.txt\n     -$ cat >.git/hooks/commit-msg <<EOF\n     -> #!/bin/sh\n-:  ---------- > 2:  12f7b10462 doc: interpret-trailers: use input redirection\n2:  ea06be8f5a ! 3:  dc1982f0d0 doc: interpret-trailers: don’t use deprecated config\n    @@ Commit message\n            better simulate the behavior of `git command -s`,\n            'trailer.<token>.cmd' will not automatically execute.”\n\n    -    Cc: ZheNing Hu <adlternative@gmail.com>\n    +    Acked-by: ZheNing Hu <adlternative@gmail.com>\n         Signed-off-by: Kristoffer Haugsbakk <code@khaugsbakk.name>\n\n      ## Documentation/git-interpret-trailers.txt ##\n    @@ Documentation/git-interpret-trailers.txt: $ git interpret-trailers --trailer 'Cc\n      $ git config trailer.sign.ifexists doNothing\n     -$ git config trailer.sign.command 'echo \"$(git config user.name) <$(git config user.email)>\"'\n     +$ git config trailer.sign.cmd 'echo \"$(git config user.name) <$(git config user.email)>\"'\n    - $ cat empty-msg.txt | git interpret-trailers\n    + $ git interpret-trailers <empty-msg.txt\n\n      Signed-off-by: Bob <bob@example.com>\n    -@@ Documentation/git-interpret-trailers.txt: $ cat msg.txt\n    - subject\n    -\n    +@@ Documentation/git-interpret-trailers.txt: subject\n      message\n    +\n    + see: HEAD~2\n     +$ cat ~/bin/glog-ref\n     +#!/bin/sh\n     +git log -1 --oneline --format=\"%h (%s)\" --abbrev-commit --abbrev=14\n    @@ Documentation/git-interpret-trailers.txt: $ cat msg.txt\n      $ git config trailer.see.ifExists \"replace\"\n      $ git config trailer.see.ifMissing \"doNothing\"\n     -$ git config trailer.see.command \"git log -1 --oneline --format=\\\"%h (%s)\\\" --abbrev-commit --abbrev=14 \\$ARG\"\n    --$ cat msg.txt | git interpret-trailers\n    +-$ git interpret-trailers <msg.txt\n     +$ git config trailer.see.cmd \"glog-ref\"\n    -+$ cat msg.txt | git interpret-trailers --trailer=see\n    ++$ git interpret-trailers --trailer=see <msg.txt\n      subject\n\n      message\n3:  14555cf87f ! 4:  f6e5605107 doc: interpret-trailers: fix examples\n    @@ Metadata\n     Author: Kristoffer Haugsbakk <code@khaugsbakk.name>\n\n      ## Commit message ##\n    -    doc: interpret-trailers: fix examples\n    +    doc: interpret-trailers: fix example\n\n         We need to provide `--trailer sign` since the command won’t output\n         anything if you don’t give it an input and/or a\n    -    `--trailer`. Furthermore, the example where `msg.txt` already contains\n    -    an s-o-b is wrong:\n    +    `--trailer`. Furthermore, the message which already contains an s-o-b is\n    +    wrong:\n\n    -        $ cat msg.txt | git interpret-trailers --trailer sign\n    +        $ git interpret-trailers --trailer sign <msg.txt\n             Signed-off-by: Alice <alice@example.com>\n\n             Signed-off-by: Alice <alice@example.com>\n\n    -    A file which only consists of one trailer line is not interpreted as the\n    -    original example must have expected. So change the examples to use the\n    -    typical “subject/message” file.\n    -\n    -    Cc: Christian Couder <chriscool@tuxfamily.org>\n    -    Signed-off-by: Kristoffer Haugsbakk <code@khaugsbakk.name>\n    +    This can’t be what was originally intended.\n\n    +    So change the messages in this example to use the typical\n    +    “subject/message” file.\n\n    - ## Notes (series) ##\n    -    This isn’t just a quirk of this series but also happens on `master`:\n    -\n    -        $ git config trailer.sign.ifmissing add\n    -        $ git config trailer.sign.ifexists doNothing\n    -        $ git config trailer.sign.command 'echo \"$(git config user.name) <$(git config user.email)>\"'\n    -        $ git interpret-trailers <<EOF\n    -        > EOF\n    -        $ git interpret-trailers <<EOF\n    -        Signed-off-by: Alice <alice@example.com>\n    -        > EOF\n    -        Signed-off-by: Alice <alice@example.com>\n    -\n    -        Signed-off-by: Kristoffer Haugsbakk <code@khaugsbakk.name>\n    +    Signed-off-by: Kristoffer Haugsbakk <code@khaugsbakk.name>\n\n      ## Documentation/git-interpret-trailers.txt ##\n     @@ Documentation/git-interpret-trailers.txt: $ git interpret-trailers --trailer 'Cc: Alice <alice@example.com>' --trailer 'Re\n    @@ Documentation/git-interpret-trailers.txt: $ git interpret-trailers --trailer 'Cc\n      $ git config trailer.sign.ifmissing add\n      $ git config trailer.sign.ifexists doNothing\n      $ git config trailer.sign.cmd 'echo \"$(git config user.name) <$(git config user.email)>\"'\n    --$ cat empty-msg.txt | git interpret-trailers\n    -+$ cat msg1.txt | git interpret-trailers --trailer sign\n    +-$ git interpret-trailers <empty-msg.txt\n    ++$ git interpret-trailers --trailer sign <msg1.txt\n     +subject\n     +\n     +message\n    @@ Documentation/git-interpret-trailers.txt: $ git interpret-trailers --trailer 'Cc\n     +message\n     +\n      Signed-off-by: Alice <alice@example.com>\n    --$ cat msg.txt | git interpret-trailers\n    -+$ cat msg2.txt | git interpret-trailers --trailer sign\n    +-$ git interpret-trailers <msg.txt\n    ++$ git interpret-trailers --trailer sign <msg2.txt\n     +subject\n     +\n     +message\n--\n2.40.0\n"},{"id":"475228","messageId":"fd515ad8b4b7c04aea9f332f47a660350d91fd57.1681326818.git.code@khaugsbakk.name","threadId":"59511","inReplyTo":"cover.1681326818.git.code@khaugsbakk.name","subject":"[PATCH v3 1/4] doc: interpret-trailers: don’t use heredoc in examples","fromName":"Kristoffer Haugsbakk","fromEmail":"code@khaugsbakk.name","sentAt":"2023-04-12T19:52:12Z","receivedAt":"2023-04-12T19:57:40Z","isPatch":true,"sender":{"key":"code@khaugsbakk.name","avatar":"https://avatars.githubusercontent.com/u/2229597?v=4"},"body":"This file contains four instances of trailing spaces from its inception\nin commit [1]. These spaces might be intentional, since a user would be\nprompted with `> ` in an interactive session. On the one hand, this is a\nwhitespace error according to `git diff --check`; on the other hand, the\nraw documentation—it makes no difference in the rendered output—is just\nstaying faithful to the simulation of the interactive prompt.\n\nLet’s get rid of these whitespace errors and also make the examples more\nfriendly to cut-and-paste by replacing the heredocs with files which are\nshown with cat(1).\n\n[1]: dfd66ddf5a (Documentation: add documentation for 'git\n    interpret-trailers', 2014-10-13)\n\nSuggested-by: Junio C Hamano <gitster@pobox.com>\nSigned-off-by: Kristoffer Haugsbakk <code@khaugsbakk.name>\n---\n Documentation/git-interpret-trailers.txt | 74 +++++++++++-------------\n 1 file changed, 35 insertions(+), 39 deletions(-)\n\ndiff --git a/Documentation/git-interpret-trailers.txt b/Documentation/git-interpret-trailers.txt\nindex 22ff3a603e..15d34b983f 100644\n--- a/Documentation/git-interpret-trailers.txt\n+++ b/Documentation/git-interpret-trailers.txt\n@@ -326,13 +326,12 @@ $ git config trailer.sign.key \"Signed-off-by: \"\n $ git config trailer.sign.ifmissing add\n $ git config trailer.sign.ifexists doNothing\n $ git config trailer.sign.command 'echo \"$(git config user.name) <$(git config user.email)>\"'\n-$ git interpret-trailers <<EOF\n-> EOF\n+$ git interpret-trailers <empty-msg.txt\n \n Signed-off-by: Bob <bob@example.com>\n-$ git interpret-trailers <<EOF\n-> Signed-off-by: Alice <alice@example.com>\n-> EOF\n+$ cat msg.txt\n+Signed-off-by: Alice <alice@example.com>\n+$ git interpret-trailers <msg.txt\n \n Signed-off-by: Alice <alice@example.com>\n ------------\n@@ -357,15 +356,14 @@ Fix #42\n $ cat ~/bin/glog-find-author\n #!/bin/sh\n test -n \"$1\" && git log --author=\"$1\" --pretty=\"%an <%ae>\" -1 || true\n+$ cat msg.txt\n+subject\n+\n+message\n $ git config trailer.help.key \"Helped-by: \"\n $ git config trailer.help.ifExists \"addIfDifferentNeighbor\"\n $ git config trailer.help.cmd \"~/bin/glog-find-author\"\n-$ git interpret-trailers --trailer=\"help:Junio\" --trailer=\"help:Couder\" <<EOF\n-> subject\n->\n-> message\n->\n-> EOF\n+$ git interpret-trailers --trailer=\"help:Junio\" --trailer=\"help:Couder\" <msg.txt\n subject\n \n message\n@@ -382,15 +380,14 @@ Helped-by: Christian Couder <christian.couder@gmail.com>\n $ cat ~/bin/glog-grep\n #!/bin/sh\n test -n \"$1\" && git log --grep \"$1\" --pretty=reference -1 || true\n+$ cat msg.txt\n+subject\n+\n+message\n $ git config trailer.ref.key \"Reference-to: \"\n $ git config trailer.ref.ifExists \"replace\"\n $ git config trailer.ref.cmd \"~/bin/glog-grep\"\n-$ git interpret-trailers --trailer=\"ref:Add copyright notices.\" <<EOF\n-> subject\n->\n-> message\n->\n-> EOF\n+$ git interpret-trailers --trailer=\"ref:Add copyright notices.\" <msg.txt\n subject\n \n message\n@@ -402,17 +399,17 @@ Reference-to: 8bc9a0c769 (Add copyright notices., 2005-04-07)\n   commit that is related, and show how it works:\n +\n ------------\n+$ cat msg.txt\n+subject\n+\n+message\n+\n+see: HEAD~2\n $ git config trailer.see.key \"See-also: \"\n $ git config trailer.see.ifExists \"replace\"\n $ git config trailer.see.ifMissing \"doNothing\"\n $ git config trailer.see.command \"git log -1 --oneline --format=\\\"%h (%s)\\\" --abbrev-commit --abbrev=14 \\$ARG\"\n-$ git interpret-trailers <<EOF\n-> subject\n-> \n-> message\n-> \n-> see: HEAD~2\n-> EOF\n+$ git interpret-trailers <msg.txt\n subject\n \n message\n@@ -427,22 +424,21 @@ See-also: fe3187489d69c4 (subject of related commit)\n   to add a 'git-version' trailer:\n +\n ------------\n-$ sed -e 's/ Z$/ /' >commit_template.txt <<EOF\n-> ***subject***\n-> \n-> ***message***\n-> \n-> Fixes: Z\n-> Cc: Z\n-> Reviewed-by: Z\n-> Signed-off-by: Z\n-> EOF\n+$ cat temp.txt\n+***subject***\n+\n+***message***\n+\n+Fixes: Z\n+Cc: Z\n+Reviewed-by: Z\n+Signed-off-by: Z\n+$ sed -e 's/ Z$/ /' temp.txt > commit_template.txt\n $ git config commit.template commit_template.txt\n-$ cat >.git/hooks/commit-msg <<EOF\n-> #!/bin/sh\n-> git interpret-trailers --trim-empty --trailer \"git-version: \\$(git describe)\" \"\\$1\" > \"\\$1.new\"\n-> mv \"\\$1.new\" \"\\$1\"\n-> EOF\n+$ cat .git/hooks/commit-msg\n+#!/bin/sh\n+git interpret-trailers --trim-empty --trailer \"git-version: \\$(git describe)\" \"\\$1\" > \"\\$1.new\"\n+mv \"\\$1.new\" \"\\$1\"\n $ chmod +x .git/hooks/commit-msg\n ------------\n \n-- \n2.40.0\n\n"},{"id":"475229","messageId":"12f7b10462184cbac884859e91d7b45e021041ee.1681326818.git.code@khaugsbakk.name","threadId":"59511","inReplyTo":"cover.1681326818.git.code@khaugsbakk.name","subject":"[PATCH v3 2/4] doc: interpret-trailers: use input redirection","fromName":"Kristoffer Haugsbakk","fromEmail":"code@khaugsbakk.name","sentAt":"2023-04-12T19:52:13Z","receivedAt":"2023-04-12T19:58:00Z","isPatch":true,"sender":{"key":"code@khaugsbakk.name","avatar":"https://avatars.githubusercontent.com/u/2229597?v=4"},"body":"Suggested-by: Junio C Hamano <gitster@pobox.com>\nSigned-off-by: Kristoffer Haugsbakk <code@khaugsbakk.name>\n---\n\nNotes (series):\n    Link: https://lore.kernel.org/git/xmqqbkk44qbo.fsf@gitster.g/\n\n Documentation/git-interpret-trailers.txt | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/Documentation/git-interpret-trailers.txt b/Documentation/git-interpret-trailers.txt\nindex 15d34b983f..6b712564a4 100644\n--- a/Documentation/git-interpret-trailers.txt\n+++ b/Documentation/git-interpret-trailers.txt\n@@ -280,7 +280,7 @@ $ cat msg.txt\n subject\n \n message\n-$ cat msg.txt | git interpret-trailers --trailer 'sign: Alice <alice@example.com>' --trailer 'sign: Bob <bob@example.com>'\n+$ git interpret-trailers --trailer 'sign: Alice <alice@example.com>' --trailer 'sign: Bob <bob@example.com>' <msg.txt\n subject\n \n message\n-- \n2.40.0\n\n"},{"id":"475230","messageId":"dc1982f0d0a26b13b4b2f37ac844bc85b891157a.1681326818.git.code@khaugsbakk.name","threadId":"59511","inReplyTo":"cover.1681326818.git.code@khaugsbakk.name","subject":"[PATCH v3 3/4] doc: interpret-trailers: don’t use deprecated config","fromName":"Kristoffer Haugsbakk","fromEmail":"code@khaugsbakk.name","sentAt":"2023-04-12T19:52:14Z","receivedAt":"2023-04-12T19:58:35Z","isPatch":true,"sender":{"key":"code@khaugsbakk.name","avatar":"https://avatars.githubusercontent.com/u/2229597?v=4"},"body":"`command` has been deprecated since commit c364b7ef51 (trailer: add new\n.cmd config option, 2021-05-03).\n\nUse the commit message of c364b7ef51 as a guide to replace the use of\n`$ARG` and to use a script instead of an inline command.[1] Also,\nexplicitly trigger the command by passing in `--trailer=see`, since\nthis config is not automatically used.[2]\n\n[1]: “Instead of \"$ARG\", users can refer to the value as positional\n   argument, $1, in their scripts.”\n[2]: “At the same time, in order to allow `git interpret-trailers` to\n   better simulate the behavior of `git command -s`,\n   'trailer.<token>.cmd' will not automatically execute.”\n\nAcked-by: ZheNing Hu <adlternative@gmail.com>\nSigned-off-by: Kristoffer Haugsbakk <code@khaugsbakk.name>\n---\n Documentation/git-interpret-trailers.txt | 9 ++++++---\n 1 file changed, 6 insertions(+), 3 deletions(-)\n\ndiff --git a/Documentation/git-interpret-trailers.txt b/Documentation/git-interpret-trailers.txt\nindex 6b712564a4..d2a23e9161 100644\n--- a/Documentation/git-interpret-trailers.txt\n+++ b/Documentation/git-interpret-trailers.txt\n@@ -325,7 +325,7 @@ $ git interpret-trailers --trailer 'Cc: Alice <alice@example.com>' --trailer 'Re\n $ git config trailer.sign.key \"Signed-off-by: \"\n $ git config trailer.sign.ifmissing add\n $ git config trailer.sign.ifexists doNothing\n-$ git config trailer.sign.command 'echo \"$(git config user.name) <$(git config user.email)>\"'\n+$ git config trailer.sign.cmd 'echo \"$(git config user.name) <$(git config user.email)>\"'\n $ git interpret-trailers <empty-msg.txt\n \n Signed-off-by: Bob <bob@example.com>\n@@ -405,11 +405,14 @@ subject\n message\n \n see: HEAD~2\n+$ cat ~/bin/glog-ref\n+#!/bin/sh\n+git log -1 --oneline --format=\"%h (%s)\" --abbrev-commit --abbrev=14\n $ git config trailer.see.key \"See-also: \"\n $ git config trailer.see.ifExists \"replace\"\n $ git config trailer.see.ifMissing \"doNothing\"\n-$ git config trailer.see.command \"git log -1 --oneline --format=\\\"%h (%s)\\\" --abbrev-commit --abbrev=14 \\$ARG\"\n-$ git interpret-trailers <msg.txt\n+$ git config trailer.see.cmd \"glog-ref\"\n+$ git interpret-trailers --trailer=see <msg.txt\n subject\n \n message\n-- \n2.40.0\n\n"},{"id":"475231","messageId":"f6e56051078f01310b1196d64f97c2cf6173b411.1681326818.git.code@khaugsbakk.name","threadId":"59511","inReplyTo":"cover.1681326818.git.code@khaugsbakk.name","subject":"[PATCH v3 4/4] doc: interpret-trailers: fix example","fromName":"Kristoffer Haugsbakk","fromEmail":"code@khaugsbakk.name","sentAt":"2023-04-12T19:52:15Z","receivedAt":"2023-04-12T19:58:43Z","isPatch":true,"sender":{"key":"code@khaugsbakk.name","avatar":"https://avatars.githubusercontent.com/u/2229597?v=4"},"body":"We need to provide `--trailer sign` since the command won’t output\nanything if you don’t give it an input and/or a\n`--trailer`. Furthermore, the message which already contains an s-o-b is\nwrong:\n\n    $ git interpret-trailers --trailer sign <msg.txt\n    Signed-off-by: Alice <alice@example.com>\n\n    Signed-off-by: Alice <alice@example.com>\n\nThis can’t be what was originally intended.\n\nSo change the messages in this example to use the typical\n“subject/message” file.\n\nSigned-off-by: Kristoffer Haugsbakk <code@khaugsbakk.name>\n---\n Documentation/git-interpret-trailers.txt | 20 +++++++++++++++++---\n 1 file changed, 17 insertions(+), 3 deletions(-)\n\ndiff --git a/Documentation/git-interpret-trailers.txt b/Documentation/git-interpret-trailers.txt\nindex d2a23e9161..4b97f812be 100644\n--- a/Documentation/git-interpret-trailers.txt\n+++ b/Documentation/git-interpret-trailers.txt\n@@ -322,16 +322,30 @@ $ git interpret-trailers --trailer 'Cc: Alice <alice@example.com>' --trailer 'Re\n   'Signed-off-by: ' already, and show how it works:\n +\n ------------\n+$ cat msg1.txt\n+subject\n+\n+message\n $ git config trailer.sign.key \"Signed-off-by: \"\n $ git config trailer.sign.ifmissing add\n $ git config trailer.sign.ifexists doNothing\n $ git config trailer.sign.cmd 'echo \"$(git config user.name) <$(git config user.email)>\"'\n-$ git interpret-trailers <empty-msg.txt\n+$ git interpret-trailers --trailer sign <msg1.txt\n+subject\n+\n+message\n \n Signed-off-by: Bob <bob@example.com>\n-$ cat msg.txt\n+$ cat msg2.txt\n+subject\n+\n+message\n+\n Signed-off-by: Alice <alice@example.com>\n-$ git interpret-trailers <msg.txt\n+$ git interpret-trailers --trailer sign <msg2.txt\n+subject\n+\n+message\n \n Signed-off-by: Alice <alice@example.com>\n ------------\n-- \n2.40.0\n\n"},{"id":"475238","messageId":"xmqqr0so7qe4.fsf@gitster.g","threadId":"59511","inReplyTo":"cover.1681326818.git.code@khaugsbakk.name","subject":"Re: [PATCH v3 0/4] doc: interpret-trailers: don't use deprecated config","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2023-04-12T21:16:19Z","receivedAt":"2023-04-12T21:16:24Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Kristoffer Haugsbakk <code@khaugsbakk.name> writes:\n\n> Replace deprecated `command` with `cmd` (patch 3). While visiting this\n> file also:\n>\n> • rewrite heredoc examples to use files which are shown with\n>   cat(1) (patch 1);\n> • use input redirection instead of using cat(1) piped into `git\n>   interpret-trailers` (patch 2); and\n> • fix an example that didn’t work properly (patch 4).\n\nThis was a pleasant read.  I had small nits here and there but\noverall the series is very well crafted.\n\nWill queue.  Thanks.\n"},{"id":"475239","messageId":"xmqqjzyg7qdw.fsf@gitster.g","threadId":"59511","inReplyTo":"12f7b10462184cbac884859e91d7b45e021041ee.1681326818.git.code@khaugsbakk.name","subject":"Re: [PATCH v3 2/4] doc: interpret-trailers: use input redirection","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2023-04-12T21:16:27Z","receivedAt":"2023-04-12T21:16:32Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Kristoffer Haugsbakk <code@khaugsbakk.name> writes:\n\n> Suggested-by: Junio C Hamano <gitster@pobox.com>\n> Signed-off-by: Kristoffer Haugsbakk <code@khaugsbakk.name>\n> ---\n\nPerhaps explain why it is a good idea in the body of the message?\n\n    Instead of \"cat\"ting a single file into a pipe, redirect from\n    the file to the standard input of the command on the downstream\n    side of the pipe.  This is more straight-forward, saves one\n    extra process, and often makes the line shorter.\n\nor something like that.\n"},{"id":"475240","messageId":"xmqqcz487qds.fsf@gitster.g","threadId":"59511","inReplyTo":"fd515ad8b4b7c04aea9f332f47a660350d91fd57.1681326818.git.code@khaugsbakk.name","subject":"Re: [PATCH v3 1/4] doc: interpret-trailers: don’t use heredoc in examples","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2023-04-12T21:16:31Z","receivedAt":"2023-04-12T21:16:37Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Kristoffer Haugsbakk <code@khaugsbakk.name> writes:\n\n> Let’s get rid of these whitespace errors and also make the examples more\n> friendly to cut-and-paste by replacing the heredocs with files which are\n> shown with cat(1).\n> -$ git interpret-trailers <<EOF\n> -> EOF\n> +$ git interpret-trailers <empty-msg.txt\n>  \n>  Signed-off-by: Bob <bob@example.com>\n\nNobody created empty-msg.txt and readers need to guess that it is a\nfile with 0-byte contents.  Using \"</dev/null\" would have avoided\nthe need for guessing.\n\nBut it seems that this goes away at the end of the series, so let's\nnot worry too much about it ;-)\n"},{"id":"476376","messageId":"cover.1682970213.git.code@khaugsbakk.name","threadId":"59511","inReplyTo":"cover.1680548208.git.code@khaugsbakk.name","subject":"[PATCH v4 0/4] doc: interpret-trailers: don't use deprecated config","fromName":"Kristoffer Haugsbakk","fromEmail":"code@khaugsbakk.name","sentAt":"2023-05-01T20:02:37Z","receivedAt":"2023-05-01T20:05:25Z","isPatch":true,"sender":{"key":"code@khaugsbakk.name","avatar":"https://avatars.githubusercontent.com/u/2229597?v=4"},"body":"Replace deprecated `command` with `cmd` (patch 3). While visiting this\nfile also:\n\n• rewrite heredoc examples to use files which are shown with\n  cat(1) (patch 1);\n• use input redirection instead of using cat(1) piped into `git\n  interpret-trailers` (patch 2); and\n• fix an example that didn’t work properly (patch 4).\n\n§ Changes in v4\n\n• Patch 1: Use `/dev/null` instead of `empty-msg.txt`\n• Patch 2: Expand commit message\n\nKristoffer Haugsbakk (4):\n  doc: interpret-trailers: don’t use heredoc in examples\n  doc: interpret-trailers: use input redirection\n  doc: interpret-trailers: don’t use deprecated config\n  doc: interpret-trailers: fix example\n\n Documentation/git-interpret-trailers.txt | 97 ++++++++++++++----------\n 1 file changed, 55 insertions(+), 42 deletions(-)\n\nRange-diff against v3:\n1:  fd515ad8b4 ! 1:  149dcf964c doc: interpret-trailers: don’t use heredoc in examples\n    @@ Documentation/git-interpret-trailers.txt: $ git config trailer.sign.key \"Signed-\n      $ git config trailer.sign.command 'echo \"$(git config user.name) <$(git config user.email)>\"'\n     -$ git interpret-trailers <<EOF\n     -> EOF\n    -+$ git interpret-trailers <empty-msg.txt\n    ++$ git interpret-trailers </dev/null\n\n      Signed-off-by: Bob <bob@example.com>\n     -$ git interpret-trailers <<EOF\n2:  12f7b10462 ! 2:  32483aa635 doc: interpret-trailers: use input redirection\n    @@ Metadata\n      ## Commit message ##\n         doc: interpret-trailers: use input redirection\n\n    +    Use input redirection instead of invoking cat(1) on a single file. This\n    +    is more straightforward, saves a process, and often makes the line\n    +    shorter.\n    +\n         Suggested-by: Junio C Hamano <gitster@pobox.com>\n         Signed-off-by: Kristoffer Haugsbakk <code@khaugsbakk.name>\n\n\n      ## Notes (series) ##\n    -    Link: https://lore.kernel.org/git/xmqqbkk44qbo.fsf@gitster.g/\n    +    Junio suggested expanding the commit message:\n    +    https://lore.kernel.org/git/xmqqjzyg7qdw.fsf@gitster.g/\n\n      ## Documentation/git-interpret-trailers.txt ##\n     @@ Documentation/git-interpret-trailers.txt: $ cat msg.txt\n3:  dc1982f0d0 ! 3:  9ea4c4f916 doc: interpret-trailers: don’t use deprecated config\n    @@ Documentation/git-interpret-trailers.txt: $ git interpret-trailers --trailer 'Cc\n      $ git config trailer.sign.ifexists doNothing\n     -$ git config trailer.sign.command 'echo \"$(git config user.name) <$(git config user.email)>\"'\n     +$ git config trailer.sign.cmd 'echo \"$(git config user.name) <$(git config user.email)>\"'\n    - $ git interpret-trailers <empty-msg.txt\n    + $ git interpret-trailers </dev/null\n\n      Signed-off-by: Bob <bob@example.com>\n     @@ Documentation/git-interpret-trailers.txt: subject\n4:  f6e5605107 ! 4:  95760aafe8 doc: interpret-trailers: fix example\n    @@ Documentation/git-interpret-trailers.txt: $ git interpret-trailers --trailer 'Cc\n      $ git config trailer.sign.ifmissing add\n      $ git config trailer.sign.ifexists doNothing\n      $ git config trailer.sign.cmd 'echo \"$(git config user.name) <$(git config user.email)>\"'\n    --$ git interpret-trailers <empty-msg.txt\n    +-$ git interpret-trailers </dev/null\n     +$ git interpret-trailers --trailer sign <msg1.txt\n     +subject\n     +\n--\n2.40.1\n"},{"id":"476377","messageId":"149dcf964cb0ff056b8bb454602b07b316725400.1682970213.git.code@khaugsbakk.name","threadId":"59511","inReplyTo":"cover.1682970213.git.code@khaugsbakk.name","subject":"[PATCH v4 1/4] doc: interpret-trailers: don’t use heredoc in examples","fromName":"Kristoffer Haugsbakk","fromEmail":"code@khaugsbakk.name","sentAt":"2023-05-01T20:02:38Z","receivedAt":"2023-05-01T20:05:37Z","isPatch":true,"sender":{"key":"code@khaugsbakk.name","avatar":"https://avatars.githubusercontent.com/u/2229597?v=4"},"body":"This file contains four instances of trailing spaces from its inception\nin commit [1]. These spaces might be intentional, since a user would be\nprompted with `> ` in an interactive session. On the one hand, this is a\nwhitespace error according to `git diff --check`; on the other hand, the\nraw documentation—it makes no difference in the rendered output—is just\nstaying faithful to the simulation of the interactive prompt.\n\nLet’s get rid of these whitespace errors and also make the examples more\nfriendly to cut-and-paste by replacing the heredocs with files which are\nshown with cat(1).\n\n[1]: dfd66ddf5a (Documentation: add documentation for 'git\n    interpret-trailers', 2014-10-13)\n\nSuggested-by: Junio C Hamano <gitster@pobox.com>\nSigned-off-by: Kristoffer Haugsbakk <code@khaugsbakk.name>\n---\n Documentation/git-interpret-trailers.txt | 74 +++++++++++-------------\n 1 file changed, 35 insertions(+), 39 deletions(-)\n\ndiff --git a/Documentation/git-interpret-trailers.txt b/Documentation/git-interpret-trailers.txt\nindex 22ff3a603e..4f4eb7a7fc 100644\n--- a/Documentation/git-interpret-trailers.txt\n+++ b/Documentation/git-interpret-trailers.txt\n@@ -326,13 +326,12 @@ $ git config trailer.sign.key \"Signed-off-by: \"\n $ git config trailer.sign.ifmissing add\n $ git config trailer.sign.ifexists doNothing\n $ git config trailer.sign.command 'echo \"$(git config user.name) <$(git config user.email)>\"'\n-$ git interpret-trailers <<EOF\n-> EOF\n+$ git interpret-trailers </dev/null\n \n Signed-off-by: Bob <bob@example.com>\n-$ git interpret-trailers <<EOF\n-> Signed-off-by: Alice <alice@example.com>\n-> EOF\n+$ cat msg.txt\n+Signed-off-by: Alice <alice@example.com>\n+$ git interpret-trailers <msg.txt\n \n Signed-off-by: Alice <alice@example.com>\n ------------\n@@ -357,15 +356,14 @@ Fix #42\n $ cat ~/bin/glog-find-author\n #!/bin/sh\n test -n \"$1\" && git log --author=\"$1\" --pretty=\"%an <%ae>\" -1 || true\n+$ cat msg.txt\n+subject\n+\n+message\n $ git config trailer.help.key \"Helped-by: \"\n $ git config trailer.help.ifExists \"addIfDifferentNeighbor\"\n $ git config trailer.help.cmd \"~/bin/glog-find-author\"\n-$ git interpret-trailers --trailer=\"help:Junio\" --trailer=\"help:Couder\" <<EOF\n-> subject\n->\n-> message\n->\n-> EOF\n+$ git interpret-trailers --trailer=\"help:Junio\" --trailer=\"help:Couder\" <msg.txt\n subject\n \n message\n@@ -382,15 +380,14 @@ Helped-by: Christian Couder <christian.couder@gmail.com>\n $ cat ~/bin/glog-grep\n #!/bin/sh\n test -n \"$1\" && git log --grep \"$1\" --pretty=reference -1 || true\n+$ cat msg.txt\n+subject\n+\n+message\n $ git config trailer.ref.key \"Reference-to: \"\n $ git config trailer.ref.ifExists \"replace\"\n $ git config trailer.ref.cmd \"~/bin/glog-grep\"\n-$ git interpret-trailers --trailer=\"ref:Add copyright notices.\" <<EOF\n-> subject\n->\n-> message\n->\n-> EOF\n+$ git interpret-trailers --trailer=\"ref:Add copyright notices.\" <msg.txt\n subject\n \n message\n@@ -402,17 +399,17 @@ Reference-to: 8bc9a0c769 (Add copyright notices., 2005-04-07)\n   commit that is related, and show how it works:\n +\n ------------\n+$ cat msg.txt\n+subject\n+\n+message\n+\n+see: HEAD~2\n $ git config trailer.see.key \"See-also: \"\n $ git config trailer.see.ifExists \"replace\"\n $ git config trailer.see.ifMissing \"doNothing\"\n $ git config trailer.see.command \"git log -1 --oneline --format=\\\"%h (%s)\\\" --abbrev-commit --abbrev=14 \\$ARG\"\n-$ git interpret-trailers <<EOF\n-> subject\n-> \n-> message\n-> \n-> see: HEAD~2\n-> EOF\n+$ git interpret-trailers <msg.txt\n subject\n \n message\n@@ -427,22 +424,21 @@ See-also: fe3187489d69c4 (subject of related commit)\n   to add a 'git-version' trailer:\n +\n ------------\n-$ sed -e 's/ Z$/ /' >commit_template.txt <<EOF\n-> ***subject***\n-> \n-> ***message***\n-> \n-> Fixes: Z\n-> Cc: Z\n-> Reviewed-by: Z\n-> Signed-off-by: Z\n-> EOF\n+$ cat temp.txt\n+***subject***\n+\n+***message***\n+\n+Fixes: Z\n+Cc: Z\n+Reviewed-by: Z\n+Signed-off-by: Z\n+$ sed -e 's/ Z$/ /' temp.txt > commit_template.txt\n $ git config commit.template commit_template.txt\n-$ cat >.git/hooks/commit-msg <<EOF\n-> #!/bin/sh\n-> git interpret-trailers --trim-empty --trailer \"git-version: \\$(git describe)\" \"\\$1\" > \"\\$1.new\"\n-> mv \"\\$1.new\" \"\\$1\"\n-> EOF\n+$ cat .git/hooks/commit-msg\n+#!/bin/sh\n+git interpret-trailers --trim-empty --trailer \"git-version: \\$(git describe)\" \"\\$1\" > \"\\$1.new\"\n+mv \"\\$1.new\" \"\\$1\"\n $ chmod +x .git/hooks/commit-msg\n ------------\n \n-- \n2.40.1\n\n"},{"id":"476378","messageId":"32483aa635a61283c3c901c4705e531c9736209b.1682970213.git.code@khaugsbakk.name","threadId":"59511","inReplyTo":"cover.1682970213.git.code@khaugsbakk.name","subject":"[PATCH v4 2/4] doc: interpret-trailers: use input redirection","fromName":"Kristoffer Haugsbakk","fromEmail":"code@khaugsbakk.name","sentAt":"2023-05-01T20:02:39Z","receivedAt":"2023-05-01T20:05:44Z","isPatch":true,"sender":{"key":"code@khaugsbakk.name","avatar":"https://avatars.githubusercontent.com/u/2229597?v=4"},"body":"Use input redirection instead of invoking cat(1) on a single file. This\nis more straightforward, saves a process, and often makes the line\nshorter.\n\nSuggested-by: Junio C Hamano <gitster@pobox.com>\nSigned-off-by: Kristoffer Haugsbakk <code@khaugsbakk.name>\n---\n\nNotes (series):\n    Junio suggested expanding the commit message:\n    https://lore.kernel.org/git/xmqqjzyg7qdw.fsf@gitster.g/\n\n Documentation/git-interpret-trailers.txt | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/Documentation/git-interpret-trailers.txt b/Documentation/git-interpret-trailers.txt\nindex 4f4eb7a7fc..4ff8be7f2e 100644\n--- a/Documentation/git-interpret-trailers.txt\n+++ b/Documentation/git-interpret-trailers.txt\n@@ -280,7 +280,7 @@ $ cat msg.txt\n subject\n \n message\n-$ cat msg.txt | git interpret-trailers --trailer 'sign: Alice <alice@example.com>' --trailer 'sign: Bob <bob@example.com>'\n+$ git interpret-trailers --trailer 'sign: Alice <alice@example.com>' --trailer 'sign: Bob <bob@example.com>' <msg.txt\n subject\n \n message\n-- \n2.40.1\n\n"},{"id":"476379","messageId":"9ea4c4f91673af53985aac04e93e5f46d9508fde.1682970213.git.code@khaugsbakk.name","threadId":"59511","inReplyTo":"cover.1682970213.git.code@khaugsbakk.name","subject":"[PATCH v4 3/4] doc: interpret-trailers: don’t use deprecated config","fromName":"Kristoffer Haugsbakk","fromEmail":"code@khaugsbakk.name","sentAt":"2023-05-01T20:02:40Z","receivedAt":"2023-05-01T20:05:54Z","isPatch":true,"sender":{"key":"code@khaugsbakk.name","avatar":"https://avatars.githubusercontent.com/u/2229597?v=4"},"body":"`command` has been deprecated since commit c364b7ef51 (trailer: add new\n.cmd config option, 2021-05-03).\n\nUse the commit message of c364b7ef51 as a guide to replace the use of\n`$ARG` and to use a script instead of an inline command.[1] Also,\nexplicitly trigger the command by passing in `--trailer=see`, since\nthis config is not automatically used.[2]\n\n[1]: “Instead of \"$ARG\", users can refer to the value as positional\n   argument, $1, in their scripts.”\n[2]: “At the same time, in order to allow `git interpret-trailers` to\n   better simulate the behavior of `git command -s`,\n   'trailer.<token>.cmd' will not automatically execute.”\n\nAcked-by: ZheNing Hu <adlternative@gmail.com>\nSigned-off-by: Kristoffer Haugsbakk <code@khaugsbakk.name>\n---\n Documentation/git-interpret-trailers.txt | 9 ++++++---\n 1 file changed, 6 insertions(+), 3 deletions(-)\n\ndiff --git a/Documentation/git-interpret-trailers.txt b/Documentation/git-interpret-trailers.txt\nindex 4ff8be7f2e..acecc037ec 100644\n--- a/Documentation/git-interpret-trailers.txt\n+++ b/Documentation/git-interpret-trailers.txt\n@@ -325,7 +325,7 @@ $ git interpret-trailers --trailer 'Cc: Alice <alice@example.com>' --trailer 'Re\n $ git config trailer.sign.key \"Signed-off-by: \"\n $ git config trailer.sign.ifmissing add\n $ git config trailer.sign.ifexists doNothing\n-$ git config trailer.sign.command 'echo \"$(git config user.name) <$(git config user.email)>\"'\n+$ git config trailer.sign.cmd 'echo \"$(git config user.name) <$(git config user.email)>\"'\n $ git interpret-trailers </dev/null\n \n Signed-off-by: Bob <bob@example.com>\n@@ -405,11 +405,14 @@ subject\n message\n \n see: HEAD~2\n+$ cat ~/bin/glog-ref\n+#!/bin/sh\n+git log -1 --oneline --format=\"%h (%s)\" --abbrev-commit --abbrev=14\n $ git config trailer.see.key \"See-also: \"\n $ git config trailer.see.ifExists \"replace\"\n $ git config trailer.see.ifMissing \"doNothing\"\n-$ git config trailer.see.command \"git log -1 --oneline --format=\\\"%h (%s)\\\" --abbrev-commit --abbrev=14 \\$ARG\"\n-$ git interpret-trailers <msg.txt\n+$ git config trailer.see.cmd \"glog-ref\"\n+$ git interpret-trailers --trailer=see <msg.txt\n subject\n \n message\n-- \n2.40.1\n\n"},{"id":"476380","messageId":"95760aafe86315c67115e4152e9ea98737de8c9e.1682970213.git.code@khaugsbakk.name","threadId":"59511","inReplyTo":"cover.1682970213.git.code@khaugsbakk.name","subject":"[PATCH v4 4/4] doc: interpret-trailers: fix example","fromName":"Kristoffer Haugsbakk","fromEmail":"code@khaugsbakk.name","sentAt":"2023-05-01T20:02:41Z","receivedAt":"2023-05-01T20:06:02Z","isPatch":true,"sender":{"key":"code@khaugsbakk.name","avatar":"https://avatars.githubusercontent.com/u/2229597?v=4"},"body":"We need to provide `--trailer sign` since the command won’t output\nanything if you don’t give it an input and/or a\n`--trailer`. Furthermore, the message which already contains an s-o-b is\nwrong:\n\n    $ git interpret-trailers --trailer sign <msg.txt\n    Signed-off-by: Alice <alice@example.com>\n\n    Signed-off-by: Alice <alice@example.com>\n\nThis can’t be what was originally intended.\n\nSo change the messages in this example to use the typical\n“subject/message” file.\n\nSigned-off-by: Kristoffer Haugsbakk <code@khaugsbakk.name>\n---\n Documentation/git-interpret-trailers.txt | 20 +++++++++++++++++---\n 1 file changed, 17 insertions(+), 3 deletions(-)\n\ndiff --git a/Documentation/git-interpret-trailers.txt b/Documentation/git-interpret-trailers.txt\nindex acecc037ec..4b97f812be 100644\n--- a/Documentation/git-interpret-trailers.txt\n+++ b/Documentation/git-interpret-trailers.txt\n@@ -322,16 +322,30 @@ $ git interpret-trailers --trailer 'Cc: Alice <alice@example.com>' --trailer 'Re\n   'Signed-off-by: ' already, and show how it works:\n +\n ------------\n+$ cat msg1.txt\n+subject\n+\n+message\n $ git config trailer.sign.key \"Signed-off-by: \"\n $ git config trailer.sign.ifmissing add\n $ git config trailer.sign.ifexists doNothing\n $ git config trailer.sign.cmd 'echo \"$(git config user.name) <$(git config user.email)>\"'\n-$ git interpret-trailers </dev/null\n+$ git interpret-trailers --trailer sign <msg1.txt\n+subject\n+\n+message\n \n Signed-off-by: Bob <bob@example.com>\n-$ cat msg.txt\n+$ cat msg2.txt\n+subject\n+\n+message\n+\n Signed-off-by: Alice <alice@example.com>\n-$ git interpret-trailers <msg.txt\n+$ git interpret-trailers --trailer sign <msg2.txt\n+subject\n+\n+message\n \n Signed-off-by: Alice <alice@example.com>\n ------------\n-- \n2.40.1\n\n"},{"id":"476381","messageId":"xmqqh6sv4vjz.fsf@gitster.g","threadId":"59511","inReplyTo":"cover.1682970213.git.code@khaugsbakk.name","subject":"Re: [PATCH v4 0/4] doc: interpret-trailers: don't use deprecated config","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2023-05-01T20:59:44Z","receivedAt":"2023-05-01T20:59:49Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Kristoffer Haugsbakk <code@khaugsbakk.name> writes:\n\n> Replace deprecated `command` with `cmd` (patch 3). While visiting this\n> file also:\n>\n> • rewrite heredoc examples to use files which are shown with\n>   cat(1) (patch 1);\n> • use input redirection instead of using cat(1) piped into `git\n>   interpret-trailers` (patch 2); and\n> • fix an example that didn’t work properly (patch 4).\n>\n> § Changes in v4\n>\n> • Patch 1: Use `/dev/null` instead of `empty-msg.txt`\n> • Patch 2: Expand commit message\n\nLooking good.  Will replace.  I'll ping Christian as the area expert\njust in case there is something obvious we missed, but let's aim to\nmerge this down to 'next' soonish.\n\nThanks.\n"}]}