blame: documentation update
v2 cover blame: documentation update
Document the default output format for git-blame(1), as well as the --color-* options which are currently undocumented but mentioned in usage help.
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 | 16 ++++++++++++++-- 3 files changed, 32 insertions(+), 8 deletions(-)
base-commit: cefe983a320c03d7843ac78e73bd513a27806845
Signature · 1 line
An old man doll... just what I always wanted! - Clara
PATCH v2 1/2 blame: Describe default output format
While there is descriptions for porcelain and incremental output formats, the default format isn't described. Describe that format for the sake of completeness.
--- Documentation/git-blame.txt | 12 ++++++++++++ 1 file changed, 12 insertions(+)
Documentation/git-blame.txt +12 -0
@@ -93,6 +93,18 @@ 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 inline 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 +- line number + + THE PORCELAIN FORMAT --------------------
Signature · 1 line
An old man doll... just what I always wanted! - Clara
Re: [PATCH v2 1/2] blame: Describe default output format
Quoted 3 lines · 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.
Sounds quite sensible. It also is sensible to have it before other formats, as this is what the users will see most often.
Documentation/git-blame.txt include::blame-options.txt[] · line 106
Quoted 11 lines
Documentation/git-blame.txt +11
-0+THE DEFAULT FORMAT +------------------ + +When neither `--porcelain` nor `--incremental` option is specified, +`git blame` will output inline 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 +- line number +
We probably would want to conclude the sentence and tell the readers that they get the contents of the file as well ;-) Perhaps like...
git blame will output annotation for each line with:
<<<these things that we list here>>>
before the contents of the line.
The second and third items may want to see a bit more careful thought, though. I think three presentations are possible for them, i.e. you can:
. use -s to suppress the author ident part altogether;
. accept the default to use the name and date as the author ident; or . use -e to replace name with email in the author ident.
Given that, it would be easier to explain if you did not split the author ident as if they are two independent items. The most concice description would be:
- abbreviated object name for the commit the line came from,
- author ident (usually the name and the date, but see '-e' and '-s' for how these options may affect it),
- line number
I also thought we might need to also update description for "-s" and "-e" to clarify what they affect is "author ident" while trying to come up with the above suggestion, but after re-reading them, I think the current text we use to describe them is understandable enough.
Thanks.
PATCH v2 2/2 blame: document --color-* options
In reply to Bagas SanjayaCommit 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.
--- Documentation/blame-options.txt | 12 ++++++++++++ Documentation/config/color.txt | 12 ++++++------ Documentation/git-blame.txt | 4 ++-- 3 files changed, 20 insertions(+), 8 deletions(-)
Documentation/blame-options.txt +12 -0
@@ -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 belong to 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.
Documentation/config/color.txt +6 -6
@@ -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 belong to 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
Documentation/git-blame.txt +2 -2
@@ -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 -----------
Signature · 1 line
An old man doll... just what I always wanted! - Clara
Re: [PATCH v2 2/2] blame: document --color-* options
Quoted 6 lines · Bagas Sanjaya
Commit
cdc2d5f11f1a(builtin/blame: dim uninteresting metadata lines, 2018-04-23) and25d5f52901f0(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.
Quoted 8 lines
Co-authored-by Dr. Matthias St. Pierre <[email protected]>Signed-off-by Dr. Matthias St. Pierre <[email protected]>Signed-off-by Bagas Sanjaya <[email protected]>--- Documentation/blame-options.txt | 12 ++++++++++++ Documentation/config/color.txt | 12 ++++++------ Documentation/git-blame.txt | 4 ++-- 3 files changed, 20 insertions(+), 8 deletions(-)
Nicely written.
Documentation/blame-options.txt take effect. · line 140
Quoted 2 lines
+--color-lines::
Documentation/blame-options.txt +1
-0+ Color lines differently, if they belong to the same commit as the preceding line.
Is "belong" the right verb? I view these lines "come from" their originating commits, so "they belong to" -> "they come from", perhaps.
Documentation/config/color.txt before the given timestamp, overwriting older timestamped colors. · line 29
Quoted 5 lines
color.blame.repeatedLines::
Documentation/config/color.txt +1
-3- 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
Ditto.
Thanks.