diff mbox series

[v3,2/2] blame: document --color-* options

Message ID 20211001113725.13354-3-bagasdotme@gmail.com (mailing list archive)
State Superseded
Headers show
Series blame: documentation update | expand

Commit Message

Bagas Sanjaya Oct. 1, 2021, 11:37 a.m. UTC
Commit cdc2d5f11f1a (builtin/blame: dim uninteresting metadata lines,
2018-04-23) and 25d5f52901f0 (builtin/blame: highlight recently changed
lines, 2018-04-23) introduce --color-lines and --color-by-age options to
git blame, respectively. While both options are mentioned in usage help,
they aren't documented in git-blame(1). Document them.

Co-authored-by: Dr. Matthias St. Pierre <m.st.pierre@ncp-e.com>
Signed-off-by: Dr. Matthias St. Pierre <m.st.pierre@ncp-e.com>
Signed-off-by: Bagas Sanjaya <bagasdotme@gmail.com>
---
 Documentation/blame-options.txt | 12 ++++++++++++
 Documentation/config/color.txt  | 12 ++++++------
 Documentation/git-blame.txt     |  4 ++--
 3 files changed, 20 insertions(+), 8 deletions(-)

Comments

Eric Sunshine Oct. 1, 2021, 7:10 p.m. UTC | #1
On Fri, Oct 1, 2021 at 7:38 AM Bagas Sanjaya <bagasdotme@gmail.com> wrote:
> Commit cdc2d5f11f1a (builtin/blame: dim uninteresting metadata lines,
> 2018-04-23) and 25d5f52901f0 (builtin/blame: highlight recently changed
> lines, 2018-04-23) introduce --color-lines and --color-by-age options to
> git blame, respectively. While both options are mentioned in usage help,
> they aren't documented in git-blame(1). Document them.
>
> Co-authored-by: Dr. Matthias St. Pierre <m.st.pierre@ncp-e.com>
> Signed-off-by: Dr. Matthias St. Pierre <m.st.pierre@ncp-e.com>
> Signed-off-by: Bagas Sanjaya <bagasdotme@gmail.com>
> ---
> diff --git a/Documentation/blame-options.txt b/Documentation/blame-options.txt
> @@ -136,5 +136,17 @@ take effect.
> +--color-lines::
> +       Color lines differently, if they come from the same commit as the preceding line.

Drop the comma: s/differently,/differently/

> +       This facilitates distinguishing code blocks introduced by different commits.

Taking non-native English speakers into account, perhaps:
s/facilitates distinguishing/makes it easier to distinguish/

> +       The color defaults to cyan and be adjusted using the `color.blame.repeatedLines`

s/and be/and can be/

> +       config option. Only the line annotation (see "The Default Format" section)
> +       is colored.

You can drop the last sentence entirely if you start the blurb like this:

    Color line annotations differently, if...

> +--color-by-age::
> +       Color lines depending on the age of the line. The `color.blame.highlightRecent`
> +       config option controls what color is used for which range of age. Only the
> +       line annotation (see "The Default Format" section) is colored.

Ditto about dropping the last sentence.

    Color line annotations depending upon the age of the line.

> diff --git a/Documentation/config/color.txt b/Documentation/config/color.txt
> @@ -9,8 +9,8 @@ color.advice.hint::
>  color.blame.highlightRecent::
> -       This can be used to color the metadata of a blame line depending
> -       on age of the line.
> +       Used to color line annotations differently depending on the age of the commit
> +       (`git blame --color-by-age`).

This can be tightened up:

    Specify the line annotation color depending upon the age
    of the commit (`git blame...`).

> @@ -20,15 +20,15 @@ before the given timestamp, overwriting older timestamped colors.
>  color.blame.repeatedLines::
> -       Use the customized color for the part of git-blame output that
> -       is repeated meta information per line (such as commit id,
> -       author name, date and timezone). Defaults to cyan.
> +       Use the specified color to colorize line annotations, if they come from the
> +       same commit as the preceding line (`git blame --color-lines`). Defaults to
> +       cyan.

Likewise:

    Specify the line annotation color for lines which
    originate with the same commit (`git blame...`).
Bagas Sanjaya Oct. 2, 2021, 2:35 a.m. UTC | #2
On 02/10/21 02.10, Eric Sunshine wrote:
>> +       config option. Only the line annotation (see "The Default Format" section)
>> +       is colored.
> 
> You can drop the last sentence entirely if you start the blurb like this:
> 
>      Color line annotations differently, if...
> 
>> +--color-by-age::
>> +       Color lines depending on the age of the line. The `color.blame.highlightRecent`
>> +       config option controls what color is used for which range of age. Only the
>> +       line annotation (see "The Default Format" section) is colored.
> 
> Ditto about dropping the last sentence.
> 
>      Color line annotations depending upon the age of the line.
> 

I observed that both --color-lines and --color-by-age only apply to 
default blame format, so the wording can be `Color line annotations ... 
if neither --porcelain nor --incremental option is specified ...`
Junio C Hamano Oct. 4, 2021, 11:41 a.m. UTC | #3
Bagas Sanjaya <bagasdotme@gmail.com> writes:

> On 02/10/21 02.10, Eric Sunshine wrote:
>>> +       config option. Only the line annotation (see "The Default Format" section)
>>> +       is colored.
>> You can drop the last sentence entirely if you start the blurb like
>> this:
>>      Color line annotations differently, if...
>> 
>>> +--color-by-age::
>>> +       Color lines depending on the age of the line. The `color.blame.highlightRecent`
>>> +       config option controls what color is used for which range of age. Only the
>>> +       line annotation (see "The Default Format" section) is colored.
>> Ditto about dropping the last sentence.
>>      Color line annotations depending upon the age of the line.
>> 
>
> I observed that both --color-lines and --color-by-age only apply to
> default blame format, ...

Technically, it is sufficient to say "color line annotations"
because the default format is the only one that is described to give
"line annotations".  I do not think it would hurt too much to be a
bit more explicit, perhaps like:

    Color line annotations, depending upon the age of the line, in
    the default output format.

I personally feel "(see section X)" is being a bit more ditracting
than being helpful to readers.

Thanks.
diff mbox series

Patch

diff --git a/Documentation/blame-options.txt b/Documentation/blame-options.txt
index 117f4cf806..9f82936bf1 100644
--- a/Documentation/blame-options.txt
+++ b/Documentation/blame-options.txt
@@ -136,5 +136,17 @@  take effect.
 	option.  An empty file name, `""`, will clear the list of revs from
 	previously processed files.
 
+--color-lines::
+	Color lines differently, if they come from the same commit as the preceding line.
+	This facilitates distinguishing code blocks introduced by different commits.
+	The color defaults to cyan and be adjusted using the `color.blame.repeatedLines`
+	config option. Only the line annotation (see "The Default Format" section)
+	is colored.
+
+--color-by-age::
+	Color lines depending on the age of the line. The `color.blame.highlightRecent`
+	config option controls what color is used for which range of age. Only the
+	line annotation (see "The Default Format" section) is colored.
+
 -h::
 	Show help message.
diff --git a/Documentation/config/color.txt b/Documentation/config/color.txt
index e05d520a86..5634f5b800 100644
--- a/Documentation/config/color.txt
+++ b/Documentation/config/color.txt
@@ -9,8 +9,8 @@  color.advice.hint::
 	Use customized color for hints.
 
 color.blame.highlightRecent::
-	This can be used to color the metadata of a blame line depending
-	on age of the line.
+	Used to color line annotations differently depending on the age of the commit
+	(`git blame --color-by-age`).
 +
 This setting should be set to a comma-separated list of color and date settings,
 starting and ending with a color, the dates should be set from oldest to newest.
@@ -20,15 +20,15 @@  before the given timestamp, overwriting older timestamped colors.
 Instead of an absolute timestamp relative timestamps work as well, e.g.
 2.weeks.ago is valid to address anything older than 2 weeks.
 +
-It defaults to 'blue,12 month ago,white,1 month ago,red', which colors
+It defaults to `blue,12 month ago,white,1 month ago,red`, which colors
 everything older than one year blue, recent changes between one month and
 one year old are kept white, and lines introduced within the last month are
 colored red.
 
 color.blame.repeatedLines::
-	Use the customized color for the part of git-blame output that
-	is repeated meta information per line (such as commit id,
-	author name, date and timezone). Defaults to cyan.
+	Use the specified color to colorize line annotations, if they come from the
+	same commit as the preceding line (`git blame --color-lines`). Defaults to
+	cyan.
 
 color.branch::
 	A boolean to enable/disable color in the output of
diff --git a/Documentation/git-blame.txt b/Documentation/git-blame.txt
index 683f8ab0b0..9d7b6003cd 100644
--- a/Documentation/git-blame.txt
+++ b/Documentation/git-blame.txt
@@ -11,8 +11,8 @@  SYNOPSIS
 'git blame' [-c] [-b] [-l] [--root] [-t] [-f] [-n] [-s] [-e] [-p] [-w] [--incremental]
 	    [-L <range>] [-S <revs-file>] [-M] [-C] [-C] [-C] [--since=<date>]
 	    [--ignore-rev <rev>] [--ignore-revs-file <file>]
-	    [--progress] [--abbrev=<n>] [<rev> | --contents <file> | --reverse <rev>..<rev>]
-	    [--] <file>
+	    [--color-lines] [--color-by-age] [--progress] [--abbrev=<n>]
+	    [<rev> | --contents <file> | --reverse <rev>..<rev>] [--] <file>
 
 DESCRIPTION
 -----------