git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/2] blame: documentation update
@ 2021-10-01 11:37 Bagas Sanjaya
  2021-10-01 11:37 ` [PATCH v3 1/2] blame: Describe default output format Bagas Sanjaya
  2021-10-01 11:37 ` [PATCH v3 2/2] blame: document --color-* options Bagas Sanjaya
  0 siblings, 2 replies; 7+ messages in thread
From: Bagas Sanjaya @ 2021-10-01 11:37 UTC (permalink / raw)
  To: git
  Cc: Junio C Hamano, Stefan Beller, Dr . Matthias St . Pierre, Bagas Sanjaya

Document the default output format for git-blame(1), as well as the
--color-* options which are currently undocumented but mentioned in
usage help.

Changes since v2 [1]:
  - describe that the default blame format has "author ident" (suggested
    by Junio)
  - s/they belong to/they come from/ (suggested by Junio)

Bagas Sanjaya (2):
  blame: Describe default output format
  blame: document --color-* options

 Documentation/blame-options.txt | 12 ++++++++++++
 Documentation/config/color.txt  | 12 ++++++------
 Documentation/git-blame.txt     | 17 +++++++++++++++--
 3 files changed, 33 insertions(+), 8 deletions(-)

Range-diff against v2 [1]:
1:  d6433fc682 ! 1:  2478909d67 blame: Describe default output format
    @@ Documentation/git-blame.txt: include::blame-options.txt[]
     +------------------
     +
     +When neither `--porcelain` nor `--incremental` option is specified,
    -+`git blame` will output inline annotation for each line with:
    ++`git blame` will output annotation for each line with:
     +
    -+- abbreviated SHA-1 of the commit the line is attributed to;
    -+- author name (or author email if `-e` or `--show-email` is specified);
    -+- author date; and
    ++- abbreviated object name for the commit the line came from;
    ++- author ident (by default author name and date unless `-s` or `-e` is
    ++specified); and
     +- line number
     +
    ++before the line contents.
     +
      THE PORCELAIN FORMAT
      --------------------
2:  5a5ca69012 ! 2:  a6f75786ec blame: document --color-* options
    @@ Documentation/blame-options.txt: take effect.
      	previously processed files.
      
     +--color-lines::
    -+	Color lines differently, if they belong to the same commit as the preceding line.
    ++	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)
    @@ Documentation/config/color.txt: before the given timestamp, overwriting older ti
     -	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 belong to the
    ++	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.
      
[1]:
https://lore.kernel.org/git/20210929124935.41917-1-bagasdotme@gmail.com/T/#t

base-commit: cefe983a320c03d7843ac78e73bd513a27806845
-- 
An old man doll... just what I always wanted! - Clara


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v3 1/2] blame: Describe default output format
  2021-10-01 11:37 [PATCH v3 0/2] blame: documentation update Bagas Sanjaya
@ 2021-10-01 11:37 ` Bagas Sanjaya
  2021-10-01 22:43   ` Junio C Hamano
  2021-10-01 11:37 ` [PATCH v3 2/2] blame: document --color-* options Bagas Sanjaya
  1 sibling, 1 reply; 7+ messages in thread
From: Bagas Sanjaya @ 2021-10-01 11:37 UTC (permalink / raw)
  To: git
  Cc: Junio C Hamano, Stefan Beller, Dr . Matthias St . Pierre, Bagas Sanjaya

While there is descriptions for porcelain and incremental output
formats, the default format isn't described. Describe that format for
the sake of completeness.

Signed-off-by: Bagas Sanjaya <bagasdotme@gmail.com>
---
 Documentation/git-blame.txt | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/Documentation/git-blame.txt b/Documentation/git-blame.txt
index 3bf5d5d8b4..683f8ab0b0 100644
--- a/Documentation/git-blame.txt
+++ b/Documentation/git-blame.txt
@@ -93,6 +93,19 @@ include::blame-options.txt[]
 	is used for a caret to mark the boundary commit.
 
 
+THE DEFAULT FORMAT
+------------------
+
+When neither `--porcelain` nor `--incremental` option is specified,
+`git blame` will output annotation for each line with:
+
+- abbreviated object name for the commit the line came from;
+- author ident (by default author name and date unless `-s` or `-e` is
+specified); and
+- line number
+
+before the line contents.
+
 THE PORCELAIN FORMAT
 --------------------
 
-- 
An old man doll... just what I always wanted! - Clara


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v3 2/2] blame: document --color-* options
  2021-10-01 11:37 [PATCH v3 0/2] blame: documentation update Bagas Sanjaya
  2021-10-01 11:37 ` [PATCH v3 1/2] blame: Describe default output format Bagas Sanjaya
@ 2021-10-01 11:37 ` Bagas Sanjaya
  2021-10-01 19:10   ` Eric Sunshine
  1 sibling, 1 reply; 7+ messages in thread
From: Bagas Sanjaya @ 2021-10-01 11:37 UTC (permalink / raw)
  To: git
  Cc: Junio C Hamano, Stefan Beller, Dr . Matthias St . Pierre, Bagas Sanjaya

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(-)

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
 -----------
-- 
An old man doll... just what I always wanted! - Clara


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH v3 2/2] blame: document --color-* options
  2021-10-01 11:37 ` [PATCH v3 2/2] blame: document --color-* options Bagas Sanjaya
@ 2021-10-01 19:10   ` Eric Sunshine
  2021-10-02  2:35     ` Bagas Sanjaya
  0 siblings, 1 reply; 7+ messages in thread
From: Eric Sunshine @ 2021-10-01 19:10 UTC (permalink / raw)
  To: Bagas Sanjaya
  Cc: Git List, Junio C Hamano, Stefan Beller, Dr . Matthias St . Pierre

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...`).

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v3 1/2] blame: Describe default output format
  2021-10-01 11:37 ` [PATCH v3 1/2] blame: Describe default output format Bagas Sanjaya
@ 2021-10-01 22:43   ` Junio C Hamano
  0 siblings, 0 replies; 7+ messages in thread
From: Junio C Hamano @ 2021-10-01 22:43 UTC (permalink / raw)
  To: Bagas Sanjaya; +Cc: git, Stefan Beller, Dr . Matthias St . Pierre

Bagas Sanjaya <bagasdotme@gmail.com> writes:

> While there is descriptions for porcelain and incremental output
> formats, the default format isn't described. Describe that format for
> the sake of completeness.
>
> Signed-off-by: Bagas Sanjaya <bagasdotme@gmail.com>
> ---
>  Documentation/git-blame.txt | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
>
> diff --git a/Documentation/git-blame.txt b/Documentation/git-blame.txt
> index 3bf5d5d8b4..683f8ab0b0 100644
> --- a/Documentation/git-blame.txt
> +++ b/Documentation/git-blame.txt
> @@ -93,6 +93,19 @@ include::blame-options.txt[]
>  	is used for a caret to mark the boundary commit.
>  
>  
> +THE DEFAULT FORMAT
> +------------------
> +
> +When neither `--porcelain` nor `--incremental` option is specified,
> +`git blame` will output annotation for each line with:
> +
> +- abbreviated object name for the commit the line came from;
> +- author ident (by default author name and date unless `-s` or `-e` is
> +specified); and

It probably would become easier to read with a comma before
"unless".

Other than that (and the downcasing of Describe in the title), looks
good to me.

Thanks.

> +- line number
> +
> +before the line contents.
> +
>  THE PORCELAIN FORMAT
>  --------------------

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v3 2/2] blame: document --color-* options
  2021-10-01 19:10   ` Eric Sunshine
@ 2021-10-02  2:35     ` Bagas Sanjaya
  2021-10-04 11:41       ` Junio C Hamano
  0 siblings, 1 reply; 7+ messages in thread
From: Bagas Sanjaya @ 2021-10-02  2:35 UTC (permalink / raw)
  To: Eric Sunshine
  Cc: Git List, Junio C Hamano, Stefan Beller, Dr . Matthias St . Pierre

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 ...`

-- 
An old man doll... just what I always wanted! - Clara

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v3 2/2] blame: document --color-* options
  2021-10-02  2:35     ` Bagas Sanjaya
@ 2021-10-04 11:41       ` Junio C Hamano
  0 siblings, 0 replies; 7+ messages in thread
From: Junio C Hamano @ 2021-10-04 11:41 UTC (permalink / raw)
  To: Bagas Sanjaya
  Cc: Eric Sunshine, Git List, Stefan Beller, Dr . Matthias St . Pierre

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.



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-10-04 11:41 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-01 11:37 [PATCH v3 0/2] blame: documentation update Bagas Sanjaya
2021-10-01 11:37 ` [PATCH v3 1/2] blame: Describe default output format Bagas Sanjaya
2021-10-01 22:43   ` Junio C Hamano
2021-10-01 11:37 ` [PATCH v3 2/2] blame: document --color-* options Bagas Sanjaya
2021-10-01 19:10   ` Eric Sunshine
2021-10-02  2:35     ` Bagas Sanjaya
2021-10-04 11:41       ` Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).