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

Re: indent-heuristic, compaction-heuristic combination

From
Jacob Keller <jacob.keller@gmail.com>
Date
Dec 17, 2016, 00:45 UTC
Message-ID
<CA+P7+xqECPzGd0MoXXDM6m7LMiYXs4=U+pUey7BRLfv+XQYJ_A@mail.gmail.com>
In-Reply-To
<CA+P7+xqBwdoHNVFrgwFXn48YtggatrFiBwbAt6+KZ+iG4oznqw@mail.gmail.com>
On Fri, Dec 16, 2016 at 4:44 PM, Jacob Keller <jacob.keller@gmail.com> wrote:
Show 27 quoted lines
> On Fri, Dec 16, 2016 at 4:28 PM, Norbert Kiesel <nkiesel@gmail.com> wrote:
>> Hi,
>>
>> I started using compaction-heuristic with 2.9, and then also (or so I
>> thought) enabled indent-heuristic with 2.11.
>> Only after reading a comment in "Git rev news" I realized that these 2
>> options are mutually exclusive.  I then
>> checked the Git source code and saw that Git first checks the new
>> indent-heuristic and then the old compaction-heuristic.
>> Therefore, anyone who is as stupid as me and enabled both will always
>> (and silently) end up with the older of the
>> two.
>>
>> Apart from better documentation (I know that both are marked
>> experimental, but nevertheless): could we not swap the
>> order in which they are tested so that the newer heuristic wins?
>>
>> </nk>
>
> I looked at the code and I don't think this is the case. In
> diff_setup() on line 3381, we check indent heuristic first. However,
> when we check the compaction heuristic second, we use an "else if" so
> we do not set both. I believe it already performs indent heuristic
> correctly if you enable both options in configuration.
>
> Thanks,
> Jake

On further looking, I realized again that maybe you are right. I will send a patch to change the other spot where we might prefer the older heuristic.

Thanks, Jake

Previous: Jacob Keller
Message 4 of 4 in “indent-heuristic, compaction-heuristic combination”
  1. Norbert KieselDec 17, 2016
  2. Jacob KellerDec 17, 2016
  3. Jacob KellerDec 17, 2016
  4. Jacob KellerDec 17, 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.