git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Stefan Beller <sbeller@google.com>
Date
Feb 1, 2018, 20:24 UTC
Message-ID
<CAGZ79kZeDZD4pOSv-Bk3AspfMYrcjHEnJrQf9EZ3LevZx9bnGA@mail.gmail.com>
In-Reply-To
<87inbgmrug.fsf@evledraar.gmail.com>

On Thu, Feb 1, 2018 at 11:29 AM, Ævar Arnfjörð Bjarmason <avarab@gmail.com> wrote:

Show 11 quoted lines
>
> 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.

Show 16 quoted lines
>     ./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
>
>     0x00000000004c312b in color_parse_mem (value=0x8f6520 "red", value_len=3, dst=0x1 <Address 0x1 out of bounds>) 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(&sb, &output_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);
        }
Previous: Ævar Arnfjörð Bjarmason
Message 17 of 17 in “blame: (dim rep. metadata lines or fields, decay date coloring)”
  1. 0/4 blame: (dim rep. metadata lines or fields, decay date coloring)Stefan Beller, Nov 10, 2017
  2. 1/4 color.h: modernize headerStefan Beller, Nov 10, 2017
  3. 2/4 builtin/blame: dim uninteresting metadataStefan Beller, Nov 10, 2017
  4. 3/4 builtin/blame: add option to color metadata fields separatelyStefan Beller, Nov 10, 2017
  5. 4/4 builtin/blame: highlight recently changed linesStefan Beller, Nov 10, 2017
  6. 0/4 blame: (dim rep. metadata lines or fields, decay date coloring)Stefan Beller, Jan 4, 2018
  7. 1/4 color.h: document and modernize headerStefan Beller, Jan 4, 2018
  8. Junio C HamanoJan 8, 2018
  9. 2/4 builtin/blame: dim uninteresting metadataStefan Beller, Jan 4, 2018
  10. Junio C HamanoJan 8, 2018
  11. Stefan BellerFeb 8, 2018
  12. 4/4 builtin/blame: highlight recently changed linesStefan Beller, Jan 4, 2018
  13. Junio C HamanoJan 8, 2018
  14. Stefan BellerJan 8, 2018
  15. 3/4 builtin/blame: add option to color metadata fields separatelyStefan Beller, Jan 4, 2018
  16. Ævar Arnfjörð BjarmasonFeb 1, 2018
  17. Stefan BellerFeb 1, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.