blame: documentation update
v4 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.
Changes since v3 [1]:
- grammatical and wording fixes (suggested by Eric and Junio)
Bagas Sanjaya (2):
blame: describe default output format
blame: document --color-* options
Documentation/blame-options.txt | 13 +++++++++++++ Documentation/config/color.txt | 33 ++++++++++++++++++--------------- Documentation/git-blame.txt | 17 +++++++++++++++-- 3 files changed, 46 insertions(+), 17 deletions(-)
Range-diff against v3:
1: 2478909d67 ! 1: 976c17a485 blame: Describe default output format
@@ Metadata
Author: Bagas Sanjaya <[email protected]>
## Commit message ##
- blame: Describe default output format
+ 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
@@ Documentation/git-blame.txt: include::blame-options.txt[]
+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 ++- author ident (by default author name and date, unless -s or -e is
+specified); and
+- line number
+
2: a6f75786ec < -: ---------- blame: document --color-* options -: ---------- > 2: 517dc2cb3d blame: document --color-* options
[1]:
https://lore.kernel.org/git/[email protected]/T/#t
base-commit: cefe983a320c03d7843ac78e73bd513a27806845
Signature · 1 line
An old man doll... just what I always wanted! - Clara
PATCH v4 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 | 13 +++++++++++++ 1 file changed, 13 insertions(+)
Documentation/git-blame.txt +13 -0
@@ -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 --------------------
Signature · 1 line
An old man doll... just what I always wanted! - Clara
PATCH v4 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 | 13 +++++++++++++ Documentation/config/color.txt | 33 ++++++++++++++++++--------------- Documentation/git-blame.txt | 4 ++-- 3 files changed, 33 insertions(+), 17 deletions(-)
Documentation/blame-options.txt +13 -0
@@ -136,5 +136,18 @@ take effect. option. An empty file name, `""`, will clear the list of revs from previously processed files. +--color-lines:: + Color line annotations (see "The Default Format" section) differently if they + come from the same commit as the preceding line, and if neither `--porcelain` + nor `--incremental` format option is specified. This makes it easier to distinguish + code blocks introduced by different commits. The color defaults to cyan and + can be adjusted using the `color.blame.repeatedLines` config option. + +--color-by-age:: + Color line annotations (see "The Default Format" section) depending on the age of + the line, if neither `--porcelain` nor `--incremental` format option is specified. + The `color.blame.highlightRecent` config option controls what color is used for + each range of age. + -h:: Show help message.
Documentation/config/color.txt +18 -15
@@ -9,26 +9,29 @@ 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. + Specify the line annotation color for `git blame --color-by-age` + depending upon the age of the line. + -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. -The metadata will be colored given the colors if the line was introduced -before the given timestamp, overwriting older timestamped colors. +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. The metadata will be colored with the +specified colors if the line was introduced 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. +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 -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. +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 for + `git blame --color-lines`, if they come from the same commit as the + preceding line. 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