diff mbox series

[2/3] doc: interpret-trailers: don’t use deprecated config

Message ID 20230331181422.15409-1-code@khaugsbakk.name (mailing list archive)
State New, archived
Headers show
Series [1/3] doc: interpret-trailers: remove trailing spaces | expand

Commit Message

Kristoffer Haugsbakk March 31, 2023, 6:14 p.m. UTC
`trailer.sign.command` has been deprecated since commit
c364b7ef51 (trailer: add new .cmd config option, 2021-05-03).

Use the commit message of c364b7ef51 as a guide to replace the use of
`$ARG` and to use a script instead of an inline command.[1] Also,
explicitly trigger the command by passing in `--trailer=sign`, since
this config is not automatically used.[2]

[1]: “Instead of "$ARG", users can refer to the value as positional
   argument, $1, in their scripts.”
[2]: “At the same time, in order to allow `git interpret-trailers` to
   better simulate the behavior of `git command -s`,
   'trailer.<token>.cmd' will not automatically execute.”

Cc: ZheNing Hu <adlternative@gmail.com>
Signed-off-by: Kristoffer Haugsbakk <code@khaugsbakk.name>
---
 Documentation/git-interpret-trailers.txt | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

Comments

Andrei Rybak April 1, 2023, 12:22 a.m. UTC | #1
I've noticed a discrepancy in this patch

On 31/03/2023 20:14, Kristoffer Haugsbakk wrote:
> explicitly trigger the command by passing in `--trailer=sign`, since

Commit message mentions "sign" as the value for "--trailer=" ...

> -$ git config trailer.see.command "git log -1 --oneline --format=\"%h (%s)\" --abbrev-commit --abbrev=14 \$ARG"
> -$ git interpret-trailers <<EOF
> +$ git config trailer.see.cmd "glog-ref"
> +$ git interpret-trailers --trailer=see <<EOF

... but the new sample code uses "see" as the value.

>   > subject
>   >
>   > message
diff mbox series

Patch

diff --git a/Documentation/git-interpret-trailers.txt b/Documentation/git-interpret-trailers.txt
index 787332771e..792d61ae7b 100644
--- a/Documentation/git-interpret-trailers.txt
+++ b/Documentation/git-interpret-trailers.txt
@@ -325,7 +325,7 @@  $ git interpret-trailers --trailer 'Cc: Alice <alice@example.com>' --trailer 'Re
 $ 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 config trailer.sign.cmd 'echo "$(git config user.name) <$(git config user.email)>"'
 $ git interpret-trailers <<EOF
 > EOF
 
@@ -402,11 +402,14 @@  Reference-to: 8bc9a0c769 (Add copyright notices., 2005-04-07)
   commit that is related, and show how it works:
 +
 ------------
+$ cat ~/bin/glog-ref
+#!/bin/sh
+git log -1 --oneline --format="%h (%s)" --abbrev-commit --abbrev=14
 $ 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
+$ git config trailer.see.cmd "glog-ref"
+$ git interpret-trailers --trailer=see <<EOF
 > subject
 >
 > message