From cdc2d5f11f1ab931d2f39fefc6197ea1cab220a6 Mon Sep 17 00:00:00 2001 From: Stefan Beller Date: Mon, 23 Apr 2018 17:08:58 -0700 Subject: builtin/blame: dim uninteresting metadata lines When using git-blame lots of lines contain redundant information, for example in hunks that consist of multiple lines, the metadata (commit name, author, date) are repeated. A reader may not be interested in those, so offer an option to color the information that is repeated from the previous line differently. Traditionally, we use CYAN for lines that are less interesting than others (e.g. hunk header), so go with that. The command line option '--color-lines' will trigger the coloring of repeated lines, and the config option 'color.blame.colorLines' is provided to select the color. Setting the config option doesn't imply that repeated lines are colored. A later patch will introduce a config to enable this mode by default. Signed-off-by: Stefan Beller Signed-off-by: Junio C Hamano --- t/t8012-blame-colors.sh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100755 t/t8012-blame-colors.sh (limited to 't') diff --git a/t/t8012-blame-colors.sh b/t/t8012-blame-colors.sh new file mode 100755 index 0000000000..98a22a3c8d --- /dev/null +++ b/t/t8012-blame-colors.sh @@ -0,0 +1,19 @@ +#!/bin/sh + +test_description='colored git blame' +. ./test-lib.sh + +PROG='git blame -c' +. "$TEST_DIRECTORY"/annotate-tests.sh + +test_expect_success 'colored blame colors contiguous lines' ' + git -c color.blame.repeatedLines=yellow blame --color-lines --abbrev=12 hello.c >actual.raw && + test_decode_color actual && + grep "" darkened && + grep "(F" darkened > F.expect && + grep "(H" darkened > H.expect && + test_line_count = 2 F.expect && + test_line_count = 3 H.expect +' + +test_done -- cgit v1.2.1