Re: [PATCHv3 0/4] blame: (dim rep. metadata lines or fields, decay date coloring)

2018-02-01 Thread Stefan Beller
On Thu, Feb 1, 2018 at 11:29 AM, Ævar Arnfjörð Bjarmason
 wrote:
>
> On Thu, Jan 04 2018, Stefan Beller jotted:
>
>> Stefan Beller (4):
>>   color.h: document and modernize header
>>   builtin/blame: dim uninteresting metadata
>>   builtin/blame: add option to color metadata fields separately
>>   builtin/blame: highlight recently changed lines
>
> I like this feature in principle, but I can't get it to work. Building
> pu and:

Thanks for testing the feature!
Please use the flag `--color-lines`, `--color-fields` or `--heated-lines`
for experimentation.

In the future we may decide that one of them becomes the default
(which one?) and is triggered by the color.ui=always setting as well.

> ./git -c color.ui=always --exec-path=$PWD blame Makefile
>
> Shows no colors. Neither does:
>
> ./git -c color.ui=always --exec-path=$PWD -c 
> color.blame.highlightRecent="red,12 month ago,blue" blame Makefile
>
> And there's a bug, it segfaults on any custom value to the other config
> option:
>
> ./git -c color.ui=always --exec-path=$PWD -c color.blame.repeatedMeta=red 
> blame Makefile
>
> 0x004c312b in color_parse_mem (value=0x8f6520 "red", value_len=3, 
> dst=0x1 ) at color.c:272
> 272 OUT('\033');
>
> The repeated_meta_color variable is NULL when passed to
> color_parse_mem(). Didn't dig further.

Thanks for noticing.
Fix below (white space mangled)

--- i/builtin/blame.c
+++ w/builtin/blame.c
@@ -48,7 +48,7 @@ static int xdl_opts;
 static int abbrev = -1;
 static int no_whole_file_rename;
 static int show_progress;
-static char *repeated_meta_color;
+static char repeated_meta_color[COLOR_MAXLEN];

 static struct date_mode blame_date_mode = { DATE_ISO8601 };
 static size_t blame_date_width;
@@ -1099,9 +1099,9 @@ int cmd_blame(int argc, const char **argv, const
char *prefix)

if (!(output_option & OUTPUT_PORCELAIN)) {
find_alignment(, _option);
-   if (!repeated_meta_color &&
+   if (!*repeated_meta_color &&
(output_option & (OUTPUT_COLOR_LINE | OUTPUT_COLOR_FIELDS)))
-   repeated_meta_color = GIT_COLOR_DARK;
+   strcpy(repeated_meta_color, GIT_COLOR_DARK);
}


Re: [PATCHv3 0/4] blame: (dim rep. metadata lines or fields, decay date coloring)

2018-02-01 Thread Ævar Arnfjörð Bjarmason

On Thu, Jan 04 2018, Stefan Beller jotted:

> Stefan Beller (4):
>   color.h: document and modernize header
>   builtin/blame: dim uninteresting metadata
>   builtin/blame: add option to color metadata fields separately
>   builtin/blame: highlight recently changed lines

I like this feature in principle, but I can't get it to work. Building
pu and:

./git -c color.ui=always --exec-path=$PWD blame Makefile

Shows no colors. Neither does:

./git -c color.ui=always --exec-path=$PWD -c 
color.blame.highlightRecent="red,12 month ago,blue" blame Makefile

And there's a bug, it segfaults on any custom value to the other config
option:

./git -c color.ui=always --exec-path=$PWD -c color.blame.repeatedMeta=red 
blame Makefile

0x004c312b in color_parse_mem (value=0x8f6520 "red", value_len=3, 
dst=0x1 ) at color.c:272
272 OUT('\033');

The repeated_meta_color variable is NULL when passed to
color_parse_mem(). Didn't dig further.


[PATCHv3 0/4] blame: (dim rep. metadata lines or fields, decay date coloring)

2018-01-04 Thread Stefan Beller
v3:

Thanks Eric for feedback, I implemented all of the suggestions.
Specifically I dropped the abstractions in patch2 but keep around a similar
abstraction in patch 3 as that still looks like it benefits (the condition
is just growing large).

Thanks,
Stefan

v2:
This is picking up [1], but presenting it in another approach,
as I realized these are orthogonal features:
* dimming repeated lines/fields of information
* giving a quick visual information how old (as a proxy for 'well tested')
  a line of code is.

Both features are configurable.

Changes from sending it out in November:
* better commit messages
* rebased on master

Any feedback welcome.

Thanks,
Stefan

[1] https://public-inbox.org/git/20171110011002.10179-1-sbel...@google.com/

Stefan Beller (4):
  color.h: document and modernize header
  builtin/blame: dim uninteresting metadata
  builtin/blame: add option to color metadata fields separately
  builtin/blame: highlight recently changed lines

 Documentation/config.txt |  23 ++
 builtin/blame.c  | 201 ++-
 color.c  |   2 -
 color.h  |  59 ++
 t/t8012-blame-colors.sh  |  56 +
 5 files changed, 305 insertions(+), 36 deletions(-)
 create mode 100755 t/t8012-blame-colors.sh

-- 
2.16.0.rc0.223.g4a4ac83678-goog