Message ID | e0a56c8e61d80ef345885bf266e9844de289695f.1686017304.git.gitgitgadget@gmail.com (mailing list archive) |
---|---|
State | Superseded |
Commit | 695242f673b86c666d6eeca3c2d3d078f1afac70 |
Headers | show |
Series | docs: interpret-trailers: reword and add examples | expand |
On Tue, Jun 6, 2023 at 4:08 AM Linus Arver via GitGitGadget <gitgitgadget@gmail.com> wrote: > > From: Linus Arver <linusa@google.com> > > The command can take inputs that are either just a commit message, or > an email-like output such as git-format-patch which includes a commit > message, "---" divider, and patch part. The existing explanation blends > these two inputs together in the first sentence > > This command reads some patches or commit messages > > which then necessitates using the "commit message part" phrasing (as > opposed to just "commit message") because the input is ambiguous per the > above definition. > > This change separates the two input types and explains them separately, > and so there is no longer a need to use the "commit message part" > phrase. > > Signed-off-by: Linus Arver <linusa@google.com> > --- > Documentation/git-interpret-trailers.txt | 35 +++++++++++++----------- > 1 file changed, 19 insertions(+), 16 deletions(-) > > diff --git a/Documentation/git-interpret-trailers.txt b/Documentation/git-interpret-trailers.txt > index da8fec7d5fe..ffde97a6c3d 100644 > --- a/Documentation/git-interpret-trailers.txt > +++ b/Documentation/git-interpret-trailers.txt > @@ -18,17 +18,22 @@ Add or parse 'trailer' lines that look similar to RFC 822 e-mail > headers, at the end of the otherwise free-form part of a commit > message. > > -This command reads some patches or commit messages from either the > -<file> arguments or the standard input if no <file> is specified. If > -`--parse` is specified, the output consists of the parsed trailers. > - > +This command reads commit messages from either the > +<file> arguments or the standard input if no <file> is specified. > +If `--parse` is specified, the output consists of the parsed trailers. > Otherwise, this command applies the arguments passed using the > -`--trailer` option, if any, to the commit message part of each input > -file. The result is emitted on the standard output. > +`--trailer` option, if any, to each input file. The result is emitted on the > +standard output. > + > +This command can also operate on the output of linkgit:git-format-patch[1], > +which is more elaborate than a plain commit message. Namely, such output > +includes a commit message (as above), a "---" divider line, and a patch part. > +For these inputs, the divider and patch parts are ignored, unless `--no-divider` > +is specified. I think saying "the divider and patch parts are ignored" is a bit ambiguous. It could mean that when a patch is read by the command only its commit message, possibly modified by the command, is emitted on the standard output. I would suggest something like: "For these inputs, the divider and patch parts are not modified by this command and are emitted as is on the output, unless `--no-divider` is specified."
Christian Couder <christian.couder@gmail.com> writes: >> +This command can also operate on the output of >> linkgit:git-format-patch[1], >> +which is more elaborate than a plain commit message. Namely, such output >> +includes a commit message (as above), a "---" divider line, and a patch >> part. >> +For these inputs, the divider and patch parts are ignored, unless >> `--no-divider` >> +is specified. > I think saying "the divider and patch parts are ignored" is a bit > ambiguous. It could mean that when a patch is read by the command only > its commit message, possibly modified by the command, is emitted on > the standard output. Indeed. Updated in v4.
diff --git a/Documentation/git-interpret-trailers.txt b/Documentation/git-interpret-trailers.txt index da8fec7d5fe..ffde97a6c3d 100644 --- a/Documentation/git-interpret-trailers.txt +++ b/Documentation/git-interpret-trailers.txt @@ -18,17 +18,22 @@ Add or parse 'trailer' lines that look similar to RFC 822 e-mail headers, at the end of the otherwise free-form part of a commit message. -This command reads some patches or commit messages from either the -<file> arguments or the standard input if no <file> is specified. If -`--parse` is specified, the output consists of the parsed trailers. - +This command reads commit messages from either the +<file> arguments or the standard input if no <file> is specified. +If `--parse` is specified, the output consists of the parsed trailers. Otherwise, this command applies the arguments passed using the -`--trailer` option, if any, to the commit message part of each input -file. The result is emitted on the standard output. +`--trailer` option, if any, to each input file. The result is emitted on the +standard output. + +This command can also operate on the output of linkgit:git-format-patch[1], +which is more elaborate than a plain commit message. Namely, such output +includes a commit message (as above), a "---" divider line, and a patch part. +For these inputs, the divider and patch parts are ignored, unless `--no-divider` +is specified. Some configuration variables control the way the `--trailer` arguments -are applied to each commit message and the way any existing trailer in -the commit message is changed. They also make it possible to +are applied to each input and the way any existing trailer in +the input is changed. They also make it possible to automatically add some trailers. By default, a '<token>=<value>' or '<token>:<value>' argument given @@ -36,7 +41,7 @@ using `--trailer` will be appended after the existing trailers only if the last trailer has a different (<token>, <value>) pair (or if there is no existing trailer). The <token> and <value> parts will be trimmed to remove starting and trailing whitespace, and the resulting trimmed -<token> and <value> will appear in the message like this: +<token> and <value> will appear in the output like this: ------------------------------------------------ token: value @@ -47,19 +52,17 @@ This means that the trimmed <token> and <value> will be separated by By default the new trailer will appear at the end of all the existing trailers. If there is no existing trailer, the new trailer will appear -after the commit message part of the output, and, if there is no line -with only spaces at the end of the commit message part, one blank line -will be added before the new trailer. +at the end of the input. A blank line will be added before the new +trailer if there isn't one already. -Existing trailers are extracted from the input message by looking for +Existing trailers are extracted from the input by looking for a group of one or more lines that (i) is all trailers, or (ii) contains at least one Git-generated or user-configured trailer and consists of at least 25% trailers. The group must be preceded by one or more empty (or whitespace-only) lines. -The group must either be at the end of the message or be the last +The group must either be at the end of the input or be the last non-whitespace lines before a line that starts with '---' (followed by a -space or the end of the line). Such three minus signs start the patch -part of the message. See also `--no-divider` below. +space or the end of the line). When reading trailers, there can be no whitespace before or inside the token, but any number of regular space and tab characters are allowed