diff mbox series

[v2,3/3] doc: interpret-trailers: fix examples

Message ID 14555cf87fa5fdc0ce14c7077ba212d16ad3bc76.1680548650.git.code@khaugsbakk.name (mailing list archive)
State New, archived
Headers show
Series [v2,1/3] doc: interpret-trailers: don’t use heredoc in examples | expand

Commit Message

Kristoffer Haugsbakk April 3, 2023, 7:22 p.m. UTC
We need to provide `--trailer sign` since the command won’t output
anything if you don’t give it an input and/or a
`--trailer`. Furthermore, the example where `msg.txt` already contains
an s-o-b is wrong:

    $ cat msg.txt | git interpret-trailers --trailer sign
    Signed-off-by: Alice <alice@example.com>

    Signed-off-by: Alice <alice@example.com>

A file which only consists of one trailer line is not interpreted as the
original example must have expected. So change the examples to use the
typical “subject/message” file.

Cc: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Kristoffer Haugsbakk <code@khaugsbakk.name>
---

Notes (series):
    This isn’t just a quirk of this series but also happens on `master`:
    
        $ 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 <<EOF
        Signed-off-by: Alice <alice@example.com>
        > EOF
        Signed-off-by: Alice <alice@example.com>
    
        Signed-off-by: Kristoffer Haugsbakk <code@khaugsbakk.name>

 Documentation/git-interpret-trailers.txt | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/Documentation/git-interpret-trailers.txt b/Documentation/git-interpret-trailers.txt
index c76efae76a..c6f5b92ecc 100644
--- a/Documentation/git-interpret-trailers.txt
+++ b/Documentation/git-interpret-trailers.txt
@@ -322,16 +322,30 @@  $ git interpret-trailers --trailer 'Cc: Alice <alice@example.com>' --trailer 'Re
   'Signed-off-by: ' already, and show how it works:
 +
 ------------
+$ cat msg1.txt
+subject
+
+message
 $ git config trailer.sign.key "Signed-off-by: "
 $ git config trailer.sign.ifmissing add
 $ git config trailer.sign.ifexists doNothing
 $ git config trailer.sign.cmd 'echo "$(git config user.name) <$(git config user.email)>"'
-$ cat empty-msg.txt | git interpret-trailers
+$ cat msg1.txt | git interpret-trailers --trailer sign
+subject
+
+message
 
 Signed-off-by: Bob <bob@example.com>
-$ cat msg.txt
+$ cat msg2.txt
+subject
+
+message
+
 Signed-off-by: Alice <alice@example.com>
-$ cat msg.txt | git interpret-trailers
+$ cat msg2.txt | git interpret-trailers --trailer sign
+subject
+
+message
 
 Signed-off-by: Alice <alice@example.com>
 ------------