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

Re: [WIP PATCH v2] diff.c: emit moved lines with a different color

From
Jacob Keller <jacob.keller@gmail.com>
Date
Sep 6, 2016, 01:09 UTC
Message-ID
<CA+P7+xqx4PHHoKT_PK5s5eOtZMG9QJTSHED_=+BHZ=U330AQtw@mail.gmail.com>
In-Reply-To
<xmqq1t0yqinr.fsf@gitster.mtv.corp.google.com>
On Mon, Sep 5, 2016 at 11:57 AM, Junio C Hamano <gitster@pobox.com> wrote:
Show 18 quoted lines
> Stefan Beller <stefanbeller@gmail.com> writes:
>
>> diff --git a/Documentation/config.txt b/Documentation/config.txt
>> index 0bcb679..f4f51c2 100644
>> --- a/Documentation/config.txt
>> +++ b/Documentation/config.txt
>> @@ -980,8 +980,9 @@ color.diff.<slot>::
>>       of `context` (context text - `plain` is a historical synonym),
>>       `meta` (metainformation), `frag`
>>       (hunk header), 'func' (function in hunk header), `old` (removed lines),
>> -     `new` (added lines), `commit` (commit headers), or `whitespace`
>> -     (highlighting whitespace errors).
>> +     `new` (added lines), `commit` (commit headers), `whitespace`
>> +     (highlighting whitespace errors), `moved-old` (removed lines that
>> +     reappear), `moved-new` (added lines that were removed elsewhere).
>
> Could we have a config to disable this rather costly new feature,
> too?

That seems entirely reasonable, though we *do* have a configuration for disabling color altogether.. is there any numbers on how much more this costs to compute?

Show 7 quoted lines
>> +static struct hashmap *duplicates_added;
>> +static struct hashmap *duplicates_removed;
>> +static int hash_previous_line_added;
>> +static int hash_previous_line_removed;
>
> I think these should be added as new fields to diff_options
> structure.
Agreed, those seem like good choices for diff_options.

Thanks, Jake

Previous: Junio C HamanoNext: Stefan Beller
Message 3 of 7 in “diff.c: emit moved lines with a different color”
  1. diff.c: emit moved lines with a different colorStefan Beller, Sep 4, 2016
  2. Junio C HamanoSep 5, 2016
  3. Jacob KellerSep 6, 2016
  4. Stefan BellerSep 6, 2016
  5. Junio C HamanoSep 6, 2016
  6. Stefan BellerSep 6, 2016
  7. Stefan BellerSep 6, 2016

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.