diff options
author | Junio C Hamano <gitster@pobox.com> | 2021-05-12 14:22:19 +0900 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2021-05-12 14:22:19 +0900 |
commit | 51a55bc4ecf70f5836e65d13a82c613e070ac990 (patch) | |
tree | d880c033a10533f5379a99968f475d667d3fd40f /git-interpret-trailers.html | |
parent | cd56dd5585d64b65937fe5001d2f24fa39f254dd (diff) | |
download | git-htmldocs-51a55bc4ecf70f5836e65d13a82c613e070ac990.tar.gz |
Autogenerated HTML docs for v2.31.1-606-gdf6c4f
Diffstat (limited to 'git-interpret-trailers.html')
-rw-r--r-- | git-interpret-trailers.html | 106 |
1 files changed, 89 insertions, 17 deletions
diff --git a/git-interpret-trailers.html b/git-interpret-trailers.html index 19fea0387..2b0943ef9 100644 --- a/git-interpret-trailers.html +++ b/git-interpret-trailers.html @@ -1063,23 +1063,40 @@ trailer.<token>.command </dt>
<dd>
<p>
- This option can be used to specify a shell command that will
- be called to automatically add or modify a trailer with the
- specified <token>.
+ This option behaves in the same way as <em>trailer.<token>.cmd</em>, except
+ that it doesn’t pass anything as argument to the specified command.
+ Instead the first occurrence of substring $ARG is replaced by the
+ value that would be passed as argument.
</p>
-<div class="paragraph"><p>When this option is specified, the behavior is as if a special
-<em><token>=<value></em> argument were added at the beginning of the command
-line, where <value> is taken to be the standard output of the
-specified command with any leading and trailing whitespace trimmed
-off.</p></div>
-<div class="paragraph"><p>If the command contains the <code>$ARG</code> string, this string will be
-replaced with the <value> part of an existing trailer with the same
-<token>, if any, before the command is launched.</p></div>
-<div class="paragraph"><p>If some <em><token>=<value></em> arguments are also passed on the command
-line, when a <em>trailer.<token>.command</em> is configured, the command will
-also be executed for each of these arguments. And the <value> part of
-these arguments, if any, will be used to replace the <code>$ARG</code> string in
-the command.</p></div>
+<div class="paragraph"><p>The <em>trailer.<token>.command</em> option has been deprecated in favor of
+<em>trailer.<token>.cmd</em> due to the fact that $ARG in the user’s command is
+only replaced once and that the original way of replacing $ARG is not safe.</p></div>
+<div class="paragraph"><p>When both <em>trailer.<token>.cmd</em> and <em>trailer.<token>.command</em> are given
+for the same <token>, <em>trailer.<token>.cmd</em> is used and
+<em>trailer.<token>.command</em> is ignored.</p></div>
+</dd>
+<dt class="hdlist1">
+trailer.<token>.cmd
+</dt>
+<dd>
+<p>
+ This option can be used to specify a shell command that will be called:
+ once to automatically add a trailer with the specified <token>, and then
+ each time a <em>--trailer <token>=<value></em> argument to modify the <value> of
+ the trailer that this option would produce.
+</p>
+<div class="paragraph"><p>When the specified command is first called to add a trailer
+with the specified <token>, the behavior is as if a special
+<em>--trailer <token>=<value></em> argument was added at the beginning
+of the "git interpret-trailers" command, where <value>
+is taken to be the standard output of the command with any
+leading and trailing whitespace trimmed off.</p></div>
+<div class="paragraph"><p>If some <em>--trailer <token>=<value></em> arguments are also passed
+on the command line, the command is called again once for each
+of these arguments with the same <token>. And the <value> part
+of these arguments, if any, will be passed to the command as its
+first argument. This way the command can produce a <value> computed
+from the <value> passed in the <em>--trailer <token>=<value></em> argument.</p></div>
</dd>
</dl></div>
</div>
@@ -1183,6 +1200,61 @@ Fix #42</code></pre> </li>
<li>
<p>
+Configure a <em>help</em> trailer with a cmd use a script <code>glog-find-author</code>
+ which search specified author identity from git log in git repository
+ and show how it works:
+</p>
+<div class="listingblock">
+<div class="content">
+<pre><code>$ cat ~/bin/glog-find-author
+#!/bin/sh
+test -n "$1" && git log --author="$1" --pretty="%an <%ae>" -1 || true
+$ git config trailer.help.key "Helped-by: "
+$ git config trailer.help.ifExists "addIfDifferentNeighbor"
+$ git config trailer.help.cmd "~/bin/glog-find-author"
+$ git interpret-trailers --trailer="help:Junio" --trailer="help:Couder" <<EOF
+> subject
+>
+> message
+>
+> EOF
+subject
+
+message
+
+Helped-by: Junio C Hamano <gitster@pobox.com>
+Helped-by: Christian Couder <christian.couder@gmail.com></code></pre>
+</div></div>
+</li>
+<li>
+<p>
+Configure a <em>ref</em> trailer with a cmd use a script <code>glog-grep</code>
+ to grep last relevant commit from git log in the git repository
+ and show how it works:
+</p>
+<div class="listingblock">
+<div class="content">
+<pre><code>$ cat ~/bin/glog-grep
+#!/bin/sh
+test -n "$1" && git log --grep "$1" --pretty=reference -1 || true
+$ git config trailer.ref.key "Reference-to: "
+$ git config trailer.ref.ifExists "replace"
+$ git config trailer.ref.cmd "~/bin/glog-grep"
+$ git interpret-trailers --trailer="ref:Add copyright notices." <<EOF
+> subject
+>
+> message
+>
+> EOF
+subject
+
+message
+
+Reference-to: 8bc9a0c769 (Add copyright notices., 2005-04-07)</code></pre>
+</div></div>
+</li>
+<li>
+<p>
Configure a <em>see</em> trailer with a command to show the subject of a
commit that is related, and show how it works:
</p>
@@ -1255,7 +1327,7 @@ $ chmod +x .git/hooks/commit-msg</code></pre> <div id="footer">
<div id="footer-text">
Last updated
- 2020-03-11 00:03:13 JST
+ 2021-05-12 14:17:56 JST
</div>
</div>
</body>
|