Skip to content

Commit 66077a2

Browse files
committed
Merge branch 'kh/doc-interpret-trailers-updates'
Doc update. * kh/doc-interpret-trailers-updates: doc: interpret-trailers: fix example doc: interpret-trailers: don’t use deprecated config doc: interpret-trailers: use input redirection doc: interpret-trailers: don’t use heredoc in examples
2 parents fa88934 + cbb83da commit 66077a2

File tree

1 file changed

+55
-42
lines changed

1 file changed

+55
-42
lines changed

Documentation/git-interpret-trailers.txt

Lines changed: 55 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ $ cat msg.txt
280280
subject
281281

282282
message
283-
$ cat msg.txt | git interpret-trailers --trailer 'sign: Alice <[email protected]>' --trailer 'sign: Bob <[email protected]>'
283+
$ git interpret-trailers --trailer 'sign: Alice <[email protected]>' --trailer 'sign: Bob <[email protected]>' <msg.txt
284284
subject
285285

286286
message
@@ -322,17 +322,30 @@ $ git interpret-trailers --trailer 'Cc: Alice <[email protected]>' --trailer 'Re
322322
'Signed-off-by: ' already, and show how it works:
323323
+
324324
------------
325+
$ cat msg1.txt
326+
subject
327+
328+
message
325329
$ git config trailer.sign.key "Signed-off-by: "
326330
$ git config trailer.sign.ifmissing add
327331
$ git config trailer.sign.ifexists doNothing
328-
$ git config trailer.sign.command 'echo "$(git config user.name) <$(git config user.email)>"'
329-
$ git interpret-trailers <<EOF
330-
> EOF
332+
$ git config trailer.sign.cmd 'echo "$(git config user.name) <$(git config user.email)>"'
333+
$ git interpret-trailers --trailer sign <msg1.txt
334+
subject
335+
336+
message
331337

332338
Signed-off-by: Bob <[email protected]>
333-
$ git interpret-trailers <<EOF
334-
> Signed-off-by: Alice <[email protected]>
335-
> EOF
339+
$ cat msg2.txt
340+
subject
341+
342+
message
343+
344+
Signed-off-by: Alice <[email protected]>
345+
$ git interpret-trailers --trailer sign <msg2.txt
346+
subject
347+
348+
message
336349

337350
Signed-off-by: Alice <[email protected]>
338351
------------
@@ -357,15 +370,14 @@ Fix #42
357370
$ cat ~/bin/glog-find-author
358371
#!/bin/sh
359372
test -n "$1" && git log --author="$1" --pretty="%an <%ae>" -1 || true
373+
$ cat msg.txt
374+
subject
375+
376+
message
360377
$ git config trailer.help.key "Helped-by: "
361378
$ git config trailer.help.ifExists "addIfDifferentNeighbor"
362379
$ git config trailer.help.cmd "~/bin/glog-find-author"
363-
$ git interpret-trailers --trailer="help:Junio" --trailer="help:Couder" <<EOF
364-
> subject
365-
>
366-
> message
367-
>
368-
> EOF
380+
$ git interpret-trailers --trailer="help:Junio" --trailer="help:Couder" <msg.txt
369381
subject
370382

371383
message
@@ -382,15 +394,14 @@ Helped-by: Christian Couder <[email protected]>
382394
$ cat ~/bin/glog-grep
383395
#!/bin/sh
384396
test -n "$1" && git log --grep "$1" --pretty=reference -1 || true
397+
$ cat msg.txt
398+
subject
399+
400+
message
385401
$ git config trailer.ref.key "Reference-to: "
386402
$ git config trailer.ref.ifExists "replace"
387403
$ git config trailer.ref.cmd "~/bin/glog-grep"
388-
$ git interpret-trailers --trailer="ref:Add copyright notices." <<EOF
389-
> subject
390-
>
391-
> message
392-
>
393-
> EOF
404+
$ git interpret-trailers --trailer="ref:Add copyright notices." <msg.txt
394405
subject
395406

396407
message
@@ -402,17 +413,20 @@ Reference-to: 8bc9a0c769 (Add copyright notices., 2005-04-07)
402413
commit that is related, and show how it works:
403414
+
404415
------------
416+
$ cat msg.txt
417+
subject
418+
419+
message
420+
421+
see: HEAD~2
422+
$ cat ~/bin/glog-ref
423+
#!/bin/sh
424+
git log -1 --oneline --format="%h (%s)" --abbrev-commit --abbrev=14
405425
$ git config trailer.see.key "See-also: "
406426
$ git config trailer.see.ifExists "replace"
407427
$ git config trailer.see.ifMissing "doNothing"
408-
$ git config trailer.see.command "git log -1 --oneline --format=\"%h (%s)\" --abbrev-commit --abbrev=14 \$ARG"
409-
$ git interpret-trailers <<EOF
410-
> subject
411-
>
412-
> message
413-
>
414-
> see: HEAD~2
415-
> EOF
428+
$ git config trailer.see.cmd "glog-ref"
429+
$ git interpret-trailers --trailer=see <msg.txt
416430
subject
417431

418432
message
@@ -427,22 +441,21 @@ See-also: fe3187489d69c4 (subject of related commit)
427441
to add a 'git-version' trailer:
428442
+
429443
------------
430-
$ sed -e 's/ Z$/ /' >commit_template.txt <<EOF
431-
> ***subject***
432-
>
433-
> ***message***
434-
>
435-
> Fixes: Z
436-
> Cc: Z
437-
> Reviewed-by: Z
438-
> Signed-off-by: Z
439-
> EOF
444+
$ cat temp.txt
445+
***subject***
446+
447+
***message***
448+
449+
Fixes: Z
450+
Cc: Z
451+
Reviewed-by: Z
452+
Signed-off-by: Z
453+
$ sed -e 's/ Z$/ /' temp.txt > commit_template.txt
440454
$ git config commit.template commit_template.txt
441-
$ cat >.git/hooks/commit-msg <<EOF
442-
> #!/bin/sh
443-
> git interpret-trailers --trim-empty --trailer "git-version: \$(git describe)" "\$1" > "\$1.new"
444-
> mv "\$1.new" "\$1"
445-
> EOF
455+
$ cat .git/hooks/commit-msg
456+
#!/bin/sh
457+
git interpret-trailers --trim-empty --trailer "git-version: \$(git describe)" "\$1" > "\$1.new"
458+
mv "\$1.new" "\$1"
446459
$ chmod +x .git/hooks/commit-msg
447460
------------
448461

0 commit comments

Comments
 (0)