Skip to contentSkip to conversation

docs: correct trailer `key_value_separator` description

PATCH Superseded Brian Lyles 4 participants 12 messages Mar 16, 2024 – Mar 19, 2024 Documentation

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 docs: correct trailer `key_value_separator` description

The description for key_value_separator incorrectly states that this separator is inserted between trailer lines, which appears likely to have been incorrectly copied from separator when this option was added.

Update the description to correctly indicate that it is a separator that appears between the key and the value of each trailer.

---
 Documentation/pretty-formats.txt | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
Documentation/pretty-formats.txt +3 -3
index d38b4ab566..4839c2843c 100644
@@ -329,9 +329,9 @@ multiple times, the last occurrence wins.
    `%(trailers:only,unfold=true)` unfolds and shows all trailer lines.
 ** 'keyonly[=<bool>]': only show the key part of the trailer.
 ** 'valueonly[=<bool>]': only show the value part of the trailer.
-** 'key_value_separator=<sep>': specify a separator inserted between
-   trailer lines. When this option is not given each trailer key-value
-   pair is separated by ": ". Otherwise it shares the same semantics
+** 'key_value_separator=<sep>': specify a separator inserted between each
+   trailer's key and value. When this option is not given each trailer
+   key-value pair is separated by ": ". Otherwise it shares the same semantics
    as 'separator=<sep>' above.
 
 NOTE: Some placeholders may depend on other options given to the
Signature · 1 line
2.43.0
#1 lore raw
Quoted 18 lines · Brian Lyles

The description for key_value_separator incorrectly states that this separator is inserted between trailer lines, which appears likely to have been incorrectly copied from separator when this option was added.

Update the description to correctly indicate that it is a separator that appears between the key and the value of each trailer.

---
 Documentation/pretty-formats.txt | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
Documentation/pretty-formats.txt +0 -0
index d38b4ab566..4839c2843c 100644

Documentation/pretty-formats.txt multiple times, the last occurrence wins. · line 332

Quoted 4 lines
Documentation/pretty-formats.txt +0 -1
@@ -329,9 +329,9 @@ multiple times, the last occurrence wins.
    `%(trailers:only,unfold=true)` unfolds and shows all trailer lines.
 ** 'keyonly[=<bool>]': only show the key part of the trailer.
 ** 'valueonly[=<bool>]': only show the value part of the trailer.
-** 'key_value_separator=<sep>': specify a separator inserted between

Nit: This line was modified to have " each" at the end. If you did that on the next line, then this diff could have been a touch smaller.

Documentation/pretty-formats.txt multiple times, the last occurrence wins. · line 335

Quoted 6 lines
Documentation/pretty-formats.txt +3 -2
-   trailer lines. When this option is not given each trailer key-value
-   pair is separated by ": ". Otherwise it shares the same semantics
+** 'key_value_separator=<sep>': specify a separator inserted between each
+   trailer's key and value. When this option is not given each trailer
+   key-value pair is separated by ": ". Otherwise it shares the same semantics
    as 'separator=<sep>' above.

LGTM.

It's probably not worth re-rolling, but a small suggestion I have is to simplify the language a bit to reduce repetition, like so:

** 'key_value_separator=<sep>': specify the separator between
the key and value of each trailer. Defaults to ": ". Otherwise it shares the same semantics as 'separator=<sep>' above.

Thanks.

#2 lore raw

Hi Linus

Quoted 2 lines · Linus Arver

Nit: This line was modified to have " each" at the end. If you did that on the next line, then this diff could have been a touch smaller.

Sure -- it looks like this was a result of applying a different hard-wrap width than the previous author, perhaps? I thought it more prudent to wrap to a consistent length than to be overly concerned about the diff given that it was already a fairly trivial patch. That said, I'm not seeing a recommended wrap width for doc files documented anywhere either. Is there a documented guideline to follow here, both in terms of preferred wrap width as well as when it might be appropriate to stray from it for reasons such as this?

Quoted 7 lines

It's probably not worth re-rolling, but a small suggestion I have is to simplify the language a bit to reduce repetition, like so:

** 'key_value_separator=<sep>': specify the separator between
the key and value of each trailer. Defaults to ": ". Otherwise it shares the same semantics as 'separator=<sep>' above.

I do prefer the simplified language. I had initially aimed to simply correct the inaccuracy, but I think that it probably *is* worth a quick re-roll to make this simplification. I will send that out shortly.

Signature · 2 lines
Thank you,
Brian Lyles
#3 lore raw
Quoted 10 lines · Brian Lyles

Hi Linus

Quoted 2 lines · Linus Arver

Nit: This line was modified to have " each" at the end. If you did that on the next line, then this diff could have been a touch smaller.

[...] Is there a documented guideline to follow here, both in terms of preferred wrap width as well as when it might be appropriate to stray from it for reasons such as this?

WRT line lengths, probably 80-ish columns is the (unwritten?) rule. The text files aren't really meant for end-user consumption (that's what the manpage and HTML formats are for), so I think it's OK if the line lengths are roughly in the same ballpark (no need to worry too much about exact lengths).

When I contributed some patches to the docs last year, I was advised to minimize diffs where appropriate, to make it easier for reviewers. In this case it didn't matter too much (the patch being so small), but I thought it was still worth mentioning. /shrug

#4 lore raw
Quoted 1 line · Linus Arver

WRT line lengths, probably 80-ish columns is the (unwritten?) rule. The

Your patches will be reviewed on the mailing list. If you keep your line length to somewhere around ~70, the line will still fit within the 80-ish terminal width after a few rounds of review exchanges, with ">> " prefixed. That reasoning is mostly about the proposed commit log messages, but the same would apply to things like AsciiDoc sources.

It is true that we do not write it down. Perhaps something like this is in order?

Documentation/SubmittingPatches +8 -0
index e734a3f0f1..68e9ad71a1 100644
@@ -280,6 +280,14 @@ or, on an older version of Git without support for --pretty=reference:
 	git show -s --date=short --pretty='format:%h (%s, %ad)' <commit>
 ....
 
+[[line-wrap]]
+
+Just like we limit the patch subject to 50 chars or so, the lines in
+the proposed log message should be around 70 chars to make sure that
+it still can be shown on 80-column terminal without line wrapping
+after a handful of review exchanges add "> " prefix to them.
+
+
 [[sign-off]]
 === Certify your work by adding your `Signed-off-by` trailer
 
Quoted 4 lines

text files aren't really meant for end-user consumption (that's what the manpage and HTML formats are for), so I think it's OK if the line lengths are roughly in the same ballpark (no need to worry too much about exact lengths).

Yes, too. And it is one way to reduce patch noise and nicer to reviewers, when used moderately (i.e. removing a word and making a line to occupy only 50 columns when ajacent ones are 70 columns may still be better than reflowing. Leaving only a single word on such a line may not be reasonable and tucking the word after or before one of these ajacent 70-column lines would work better in such a case).

Thanks.

#5 lore raw
Quoted 22 lines · Junio C Hamano
Quoted 1 line · Linus Arver

WRT line lengths, probably 80-ish columns is the (unwritten?) rule. The

Your patches will be reviewed on the mailing list. If you keep your line length to somewhere around ~70, the line will still fit within the 80-ish terminal width after a few rounds of review exchanges, with ">> " prefixed. That reasoning is mostly about the proposed commit log messages, but the same would apply to things like AsciiDoc sources.

It is true that we do not write it down. Perhaps something like this is in order?

(quoted diff) +0 -0

w/Documentation/SubmittingPatches
index e734a3f0f1..68e9ad71a1 100644

Documentation/SubmittingPatches +0 -1
@@ -280,6 +280,14 @@ or, on an older version of Git without support for
--pretty=reference:
 	git show -s --date=short --pretty='format:%h (%s, %ad)' <commit>

Documentation/SubmittingPatches or, on an older version of Git without support for · line 290

Quoted 10 lines
Documentation/SubmittingPatches +8 -0
....
 
+[[line-wrap]]
+
+Just like we limit the patch subject to 50 chars or so, the lines in
+the proposed log message should be around 70 chars to make sure that
+it still can be shown on 80-column terminal without line wrapping
+after a handful of review exchanges add "> " prefix to them.
+
+

There’s also .editorconfig which says that it should be 72 characters. My Magit respects it but NeoVim doesn’t seem to. Maybe worth mentioning since you might not need to configure it yourself for this project, depending on your commit message editor.

Quoted 17 lines

[[sign-off]]
=== Certify your work by adding your Signed-off-by trailer

Quoted 4 lines

text files aren't really meant for end-user consumption (that's what the manpage and HTML formats are for), so I think it's OK if the line lengths are roughly in the same ballpark (no need to worry too much about exact lengths).

Yes, too. And it is one way to reduce patch noise and nicer to reviewers, when used moderately (i.e. removing a word and making a line to occupy only 50 columns when ajacent ones are 70 columns may still be better than reflowing. Leaving only a single word on such a line may not be reasonable and tucking the word after or before one of these ajacent 70-column lines would work better in such a case).

Quoted 1 line

Thanks.

My interpretation of this is

1. Commit messages are flowed/reflowed to 72 columns
2. Code is reflowed to 80 columns (enforced by tools like clang-format)
• See .clang-format and .editorconfig (kept in synch.)
3. Source documentation (AsciiDoc) is reflowed to 72 opportunistically; not every time (in order to avoid diff noise) but when it feels like it makes sense

Maybe SubmittingPatches should mention that last point? If my interpretation is correct.

#6 lore raw
Quoted 11 lines · Kristoffer Haugsbakk

My interpretation of this is

1. Commit messages are flowed/reflowed to 72 columns
2. Code is reflowed to 80 columns (enforced by tools like clang-format)
• See .clang-format and .editorconfig (kept in synch.)
3. Source documentation (AsciiDoc) is reflowed to 72 opportunistically; not every time (in order to avoid diff noise) but when it feels like it makes sense

Maybe SubmittingPatches should mention that last point? If my interpretation is correct.

I do not know about #2. I've seen cases where a patch trying to stick to the hard 80-column limit is hurting readability a lot. I think the moral of the story is that code should never be reflowed mechanically without thinking---rather developers, when they see the need to go way too deep in indentation levels, should learn to take it a sign that they need to first refactor their code, e.g. with smaller helper functions with meaningful names.

#7 lore raw
In reply to Junio C Hamano
Quoted 10 lines · Junio C Hamano
Quoted 1 line · Linus Arver

WRT line lengths, probably 80-ish columns is the (unwritten?) rule. The

Your patches will be reviewed on the mailing list. If you keep your line length to somewhere around ~70, the line will still fit within the 80-ish terminal width after a few rounds of review exchanges, with ">> " prefixed. That reasoning is mostly about the proposed commit log messages, but the same would apply to things like AsciiDoc sources.

Agreed.

Quoted 8 lines

It is true that we do not write it down. Perhaps something like this is in order?

Documentation/SubmittingPatches +0 -0
index e734a3f0f1..68e9ad71a1 100644

Documentation/SubmittingPatches or, on an older version of Git without support for --pretty=reference: · line 289

Quoted 10 lines
Documentation/SubmittingPatches +7 -0
@@ -280,6 +280,14 @@ or, on an older version of Git without support for --pretty=reference:
 	git show -s --date=short --pretty='format:%h (%s, %ad)' <commit>
....
 
+[[line-wrap]]
+
+Just like we limit the patch subject to 50 chars or so, the lines in
+the proposed log message should be around 70 chars to make sure that
+it still can be shown on 80-column terminal without line wrapping
+after a handful of review exchanges add "> " prefix to them.
+

I would tweak it slightly like this:

[[line-lengths]]

Just like we limit the patch subject to 50 chars or so, the lines in the proposed log message should be around 70 chars. This helps avoid line wrapping on 80-column terminal displays, even after after a handful of review exchanges add "> " prefixes to them.

Quoted 9 lines

[[sign-off]]
=== Certify your work by adding your Signed-off-by trailer

Quoted 4 lines

text files aren't really meant for end-user consumption (that's what the manpage and HTML formats are for), so I think it's OK if the line lengths are roughly in the same ballpark (no need to worry too much about exact lengths).

Quoted 7 lines

Yes, too. And it is one way to reduce patch noise and nicer to reviewers, when used moderately (i.e. removing a word and making a line to occupy only 50 columns when ajacent ones are 70 columns may still be better than reflowing. Leaving only a single word on such a line may not be reasonable and tucking the word after or before one of these ajacent 70-column lines would work better in such a case).

Agreed. Thank you for kindly putting into concrete examples what I was too lazy to write out in my earlier response to Brian. :)

Speaking of reducing patch noise, perhaps it deserves a callout in SubmittingPatches, something like this (first bullet point)?

[[optimize-for-reviewers]]

To help speed up the review process (and to incentivize would-be reviewers), avoid introducing unnecessary noise in your patch series. The following are some things to avoid:

. Avoid _reflowing_ (i.e., adjusting where lines start and end in a
paragraph) around chunks of prose such as in documentation or comments, for relatively minor changes. For example, given a paragraph with lines about 70 characters long and where your patch wants to change the content of one line, consider changing only that one line (and leaving the surrounding lines as is) --- even if doing so would make that one line go under or over 70 characters. This makes the patch (now just a one-line diff) easier to read, versus a reflowed version where N lines are modified.

. Avoid _extraneous changes_ (however small) in your patch that are
not called out in the commit log message. Reviewers read your log message first, then read the diffs; if there are things in the diff that do not line up with your log message, it will surprise reviewers.

. Avoid _breaking tests_ in your series, even if you fix them up
later. Consider flipping the broken tests to expect to fail temporarily, and then changing them back to their original state. Making sure that all tests pass (at every patch in your series) helps to keep the history clean, which can potentially help things like git-bisect later on.

. Avoid having _too many patches_ in one series. Aim for a maximum
of 5-10 patches in your series. If your series requires additional patches, consider breaking it up into multiple series (where each series achieves one major objective). Wait for reviews of the first series to be accepted before sending up the next series.

I took the liberty of documenting some additional "what not to do" lessons I learned from reviewers from my time on the list so far. I assume the "reflowing" thing happens more frequently than the other bullet points, so I put it first.

#8 lore raw

PATCH v2 1/2 docs: correct trailer `key_value_separator` description

In reply to Brian Lyles

The description for key_value_separator incorrectly states that this separator is inserted between trailer lines, which appears likely to have been incorrectly copied from separator when this option was added.

Update the description to correctly indicate that it is a separator that appears between the key and the value of each trailer.

---
Changes since v1:
- Minor wording tweak
- Minor wrapping tweak

 Documentation/pretty-formats.txt | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Documentation/pretty-formats.txt +2 -2
index d38b4ab566..e1788cb07a 100644
@@ -330,8 +330,8 @@ multiple times, the last occurrence wins.
 ** 'keyonly[=<bool>]': only show the key part of the trailer.
 ** 'valueonly[=<bool>]': only show the value part of the trailer.
 ** 'key_value_separator=<sep>': specify a separator inserted between
-   trailer lines. When this option is not given each trailer key-value
-   pair is separated by ": ". Otherwise it shares the same semantics
+   the key and value of each trailer. When this option is not given each trailer
+   key-value pair is separated by ": ". Otherwise it shares the same semantics
    as 'separator=<sep>' above.
 
 NOTE: Some placeholders may depend on other options given to the
Signature · 1 line
2.43.2
#9 lore raw
Quoted 22 lines · Brian Lyles

The description for key_value_separator incorrectly states that this separator is inserted between trailer lines, which appears likely to have been incorrectly copied from separator when this option was added.

Update the description to correctly indicate that it is a separator that appears between the key and the value of each trailer.

---
Changes since v1:
- Minor wording tweak
- Minor wrapping tweak

 Documentation/pretty-formats.txt | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Documentation/pretty-formats.txt +0 -0
index d38b4ab566..e1788cb07a 100644

Documentation/pretty-formats.txt multiple times, the last occurrence wins. · line 335

Quoted 8 lines
Documentation/pretty-formats.txt +2 -2
@@ -330,8 +330,8 @@ multiple times, the last occurrence wins.
 ** 'keyonly[=<bool>]': only show the key part of the trailer.
 ** 'valueonly[=<bool>]': only show the value part of the trailer.
 ** 'key_value_separator=<sep>': specify a separator inserted between
-   trailer lines. When this option is not given each trailer key-value
-   pair is separated by ": ". Otherwise it shares the same semantics
+   the key and value of each trailer. When this option is not given each trailer
+   key-value pair is separated by ": ". Otherwise it shares the same semantics
    as 'separator=<sep>' above.

I was tempted to insert a comma before "each trailer key-value pair" while queuing this, but the missing comma is shared with other entries of the same list, so I'd queue it as-is.

Thanks.

#10 lore raw

PATCH v2 2/2 docs: adjust trailer `separator` and `key_value_separator` language

In reply to Brian Lyles

The language describing the trailer separator and key-value separator default value is overly complicated.

Indicate the default with simpler "Defaults to ..." language.

---
This commit is new in v2 per Linus' suggestion[1].

[1]: https://lore.kernel.org/git/[email protected]/

 Documentation/pretty-formats.txt | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)
Documentation/pretty-formats.txt +5 -7
index e1788cb07a..8ee940b6a4 100644
@@ -316,9 +316,8 @@ multiple times, the last occurrence wins.
    `Reviewed-by`.
 ** 'only[=<bool>]': select whether non-trailer lines from the trailer
    block should be included.
-** 'separator=<sep>': specify a separator inserted between trailer
-   lines. When this option is not given each trailer line is
-   terminated with a line feed character. The string <sep> may contain
+** 'separator=<sep>': specify the separator inserted between trailer
+   lines. Defaults to a line feed character. The string <sep> may contain
    the literal formatting codes described above. To use comma as
    separator one must use `%x2C` as it would otherwise be parsed as
    next option. E.g., `%(trailers:key=Ticket,separator=%x2C )`
@@ -329,10 +328,9 @@ multiple times, the last occurrence wins.
    `%(trailers:only,unfold=true)` unfolds and shows all trailer lines.
 ** 'keyonly[=<bool>]': only show the key part of the trailer.
 ** 'valueonly[=<bool>]': only show the value part of the trailer.
-** 'key_value_separator=<sep>': specify a separator inserted between
-   the key and value of each trailer. When this option is not given each trailer
-   key-value pair is separated by ": ". Otherwise it shares the same semantics
-   as 'separator=<sep>' above.
+** 'key_value_separator=<sep>': specify the separator inserted between
+   the key and value of each trailer. Defaults to ": ". Otherwise it
+   shares the same semantics as 'separator=<sep>' above.
 
 NOTE: Some placeholders may depend on other options given to the
 revision traversal engine. For example, the `%g*` reflog options will
Signature · 1 line
2.43.2
#11 lore raw

Re: [PATCH v2 2/2] docs: adjust trailer `separator` and `key_value_separator` language

Brian Lyles <[email protected]> writes:

This v2 LGTM. Thanks!

Quoted 47 lines

The language describing the trailer separator and key-value separator default value is overly complicated.

Indicate the default with simpler "Defaults to ..." language.

---
This commit is new in v2 per Linus' suggestion[1].

[1]: https://lore.kernel.org/git/[email protected]/

 Documentation/pretty-formats.txt | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)
Documentation/pretty-formats.txt +5 -7
index e1788cb07a..8ee940b6a4 100644
@@ -316,9 +316,8 @@ multiple times, the last occurrence wins.
    `Reviewed-by`.
 ** 'only[=<bool>]': select whether non-trailer lines from the trailer
    block should be included.
-** 'separator=<sep>': specify a separator inserted between trailer
-   lines. When this option is not given each trailer line is
-   terminated with a line feed character. The string <sep> may contain
+** 'separator=<sep>': specify the separator inserted between trailer
+   lines. Defaults to a line feed character. The string <sep> may contain
    the literal formatting codes described above. To use comma as
    separator one must use `%x2C` as it would otherwise be parsed as
    next option. E.g., `%(trailers:key=Ticket,separator=%x2C )`
@@ -329,10 +328,9 @@ multiple times, the last occurrence wins.
    `%(trailers:only,unfold=true)` unfolds and shows all trailer lines.
 ** 'keyonly[=<bool>]': only show the key part of the trailer.
 ** 'valueonly[=<bool>]': only show the value part of the trailer.
-** 'key_value_separator=<sep>': specify a separator inserted between
-   the key and value of each trailer. When this option is not given each trailer
-   key-value pair is separated by ": ". Otherwise it shares the same semantics
-   as 'separator=<sep>' above.
+** 'key_value_separator=<sep>': specify the separator inserted between
+   the key and value of each trailer. Defaults to ": ". Otherwise it
+   shares the same semantics as 'separator=<sep>' above.
 
 NOTE: Some placeholders may depend on other options given to the
 revision traversal engine. For example, the `%g*` reflog options will
Signature · 1 line
2.43.2