diff options
author | Hamza Mahfooz <someguy@effective-light.com> | 2021-10-07 16:31:47 -0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2021-10-08 14:19:14 -0700 |
commit | 6a5c337922a5221d1f6d025d84e18b526df9944c (patch) | |
tree | 79a681ce03ce5028777414f382e36c99393e3093 /Documentation/config/color.txt | |
parent | grep: refactor next_match() and match_one_pattern() for external use (diff) | |
download | tgif-6a5c337922a5221d1f6d025d84e18b526df9944c.tar.xz |
pretty: colorize pattern matches in commit messages
The "git log" command limits its output to the commits that contain strings
matched by a pattern when the "--grep=<pattern>" option is used, but unlike
output from "git grep -e <pattern>", the matches are not highlighted,
making them harder to spot.
Teach the pretty-printer code to highlight matches from the
"--grep=<pattern>", "--author=<pattern>" and "--committer=<pattern>"
options (to view the last one, you may have to ask for --pretty=fuller).
Also, it must be noted that we are effectively greping the content twice
(because it would be a hassle to rework the existing matching code to do
a /g match and then pass it all down to the coloring code), however it only
slows down "git log --author=^H" on this repository by around 1-2%
(compared to v2.33.0), so it should be a small enough slow down to justify
the addition of the feature.
Signed-off-by: Hamza Mahfooz <someguy@effective-light.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'Documentation/config/color.txt')
-rw-r--r-- | Documentation/config/color.txt | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/Documentation/config/color.txt b/Documentation/config/color.txt index e05d520a86..91d9a9da32 100644 --- a/Documentation/config/color.txt +++ b/Documentation/config/color.txt @@ -104,9 +104,12 @@ color.grep.<slot>:: `matchContext`;; matching text in context lines `matchSelected`;; - matching text in selected lines + matching text in selected lines. Also, used to customize the following + linkgit:git-log[1] subcommands: `--grep`, `--author` and `--committer`. `selected`;; - non-matching text in selected lines + non-matching text in selected lines. Also, used to customize the + following linkgit:git-log[1] subcommands: `--grep`, `--author` and + `--committer`. `separator`;; separators between fields on a line (`:`, `-`, and `=`) and between hunks (`--`) |