Skip to content

Commit 0e701f8

Browse files
LemmingAvalanchegitster
authored andcommitted
doc: interpret-trailers: add key format example
All of the examples speak of the Happy Path where everything works as intended. But failure examples can also be instructive. Especially for explaining again, by example, the key format (see previous commit). This also allows us to demonstrate trailer block detection with a concrete example. Signed-off-by: Kristoffer Haugsbakk <code@khaugsbakk.name> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 975c9a4 commit 0e701f8

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

Documentation/git-interpret-trailers.adoc

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,29 @@ mv "\$1.new" "\$1"
405405
$ chmod +x .git/hooks/commit-msg
406406
------------
407407

408+
* Here we try to to use three different trailer keys. But it fails
409+
because two of them are not recognized as trailer keys.
410+
+
411+
----
412+
$ cat msg.txt
413+
subject
414+
415+
Skapad-på: some-branch
416+
Hash-in-v6.11: 45c12d3269fe48f22834320c782ffe86c3560f2c
417+
Reviewed-by: Alice <alice@example.com>
418+
$ git interpret-trailers --only-trailers <msg.txt
419+
$
420+
----
421+
+
422+
Recall that a trailer key has to consist of only ASCII alphanumeric
423+
characters and hyphens, and this does not hold for the two first
424+
supposed trailer keys. And now none are recognized as trailers because
425+
the candidate trailer block has at least one non-trailer line, even
426+
though `Reviewed-by` is a valid trailer key. Recall that a trailer block
427+
has to either (i) be all trailers, or (ii) consist of at least one
428+
Git-generated or user-configured trailer (and some other conditions).
429+
And (ii) is not satisfied since we have not configured any trailer keys.
430+
408431
SEE ALSO
409432
--------
410433
linkgit:git-commit[1], linkgit:git-format-patch[1], linkgit:git-config[1]

0 commit comments

Comments
 (0)