{"thread":{"id":"44721","subject":"indent-heuristic, compaction-heuristic combination","startedAt":"2016-12-17T00:28:36Z","lastAt":"2016-12-17T00:46:07Z","messageCount":4,"participants":["Norbert Kiesel","Jacob Keller"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"307932","messageId":"CAM+g_NsDLKxWLZCDOgrh2O3W23PRP8Zxf-Zzf_twSw5VX3=G=A@mail.gmail.com","threadId":"44721","inReplyTo":null,"subject":"indent-heuristic, compaction-heuristic combination","fromName":"Norbert Kiesel","fromEmail":"nkiesel@gmail.com","sentAt":"2016-12-17T00:28:24Z","receivedAt":"2016-12-17T00:28:36Z","isPatch":false,"sender":{"key":"nkiesel@gmail.com","avatar":null},"body":"Hi,\n\nI started using compaction-heuristic with 2.9, and then also (or so I\nthought) enabled indent-heuristic with 2.11.\nOnly after reading a comment in \"Git rev news\" I realized that these 2\noptions are mutually exclusive.  I then\nchecked the Git source code and saw that Git first checks the new\nindent-heuristic and then the old compaction-heuristic.\nTherefore, anyone who is as stupid as me and enabled both will always\n(and silently) end up with the older of the\ntwo.\n\nApart from better documentation (I know that both are marked\nexperimental, but nevertheless): could we not swap the\norder in which they are tested so that the newer heuristic wins?\n\n</nk>\n"},{"id":"307933","messageId":"CA+P7+xpwL+jw=eJhBH6xTPCJoDrzXBHj4p86xtyMZ++eyyHkTA@mail.gmail.com","threadId":"44721","inReplyTo":"CAM+g_NsDLKxWLZCDOgrh2O3W23PRP8Zxf-Zzf_twSw5VX3=G=A@mail.gmail.com","subject":"Re: indent-heuristic, compaction-heuristic combination","fromName":"Jacob Keller","fromEmail":"jacob.keller@gmail.com","sentAt":"2016-12-17T00:37:19Z","receivedAt":"2016-12-17T00:37:44Z","isPatch":false,"sender":{"key":"jacob.keller@gmail.com","avatar":"https://avatars.githubusercontent.com/u/874719?v=4"},"body":"On Fri, Dec 16, 2016 at 4:28 PM, Norbert Kiesel <nkiesel@gmail.com> wrote:\n> Hi,\n>\n> I started using compaction-heuristic with 2.9, and then also (or so I\n> thought) enabled indent-heuristic with 2.11.\n> Only after reading a comment in \"Git rev news\" I realized that these 2\n> options are mutually exclusive.  I then\n> checked the Git source code and saw that Git first checks the new\n> indent-heuristic and then the old compaction-heuristic.\n> Therefore, anyone who is as stupid as me and enabled both will always\n> (and silently) end up with the older of the\n> two.\n>\n> Apart from better documentation (I know that both are marked\n> experimental, but nevertheless): could we not swap the\n> order in which they are tested so that the newer heuristic wins?\n>\n> </nk>\n\nThis seems reasonable to me.\n\nThanks,\nJake\n"},{"id":"307934","messageId":"CA+P7+xqBwdoHNVFrgwFXn48YtggatrFiBwbAt6+KZ+iG4oznqw@mail.gmail.com","threadId":"44721","inReplyTo":"CAM+g_NsDLKxWLZCDOgrh2O3W23PRP8Zxf-Zzf_twSw5VX3=G=A@mail.gmail.com","subject":"Re: indent-heuristic, compaction-heuristic combination","fromName":"Jacob Keller","fromEmail":"jacob.keller@gmail.com","sentAt":"2016-12-17T00:44:41Z","receivedAt":"2016-12-17T00:45:11Z","isPatch":false,"sender":{"key":"jacob.keller@gmail.com","avatar":"https://avatars.githubusercontent.com/u/874719?v=4"},"body":"On Fri, Dec 16, 2016 at 4:28 PM, Norbert Kiesel <nkiesel@gmail.com> wrote:\n> Hi,\n>\n> I started using compaction-heuristic with 2.9, and then also (or so I\n> thought) enabled indent-heuristic with 2.11.\n> Only after reading a comment in \"Git rev news\" I realized that these 2\n> options are mutually exclusive.  I then\n> checked the Git source code and saw that Git first checks the new\n> indent-heuristic and then the old compaction-heuristic.\n> Therefore, anyone who is as stupid as me and enabled both will always\n> (and silently) end up with the older of the\n> two.\n>\n> Apart from better documentation (I know that both are marked\n> experimental, but nevertheless): could we not swap the\n> order in which they are tested so that the newer heuristic wins?\n>\n> </nk>\n\nI looked at the code and I don't think this is the case. In\ndiff_setup() on line 3381, we check indent heuristic first. However,\nwhen we check the compaction heuristic second, we use an \"else if\" so\nwe do not set both. I believe it already performs indent heuristic\ncorrectly if you enable both options in configuration.\n\nThanks,\nJake\n"},{"id":"307935","messageId":"CA+P7+xqECPzGd0MoXXDM6m7LMiYXs4=U+pUey7BRLfv+XQYJ_A@mail.gmail.com","threadId":"44721","inReplyTo":"CA+P7+xqBwdoHNVFrgwFXn48YtggatrFiBwbAt6+KZ+iG4oznqw@mail.gmail.com","subject":"Re: indent-heuristic, compaction-heuristic combination","fromName":"Jacob Keller","fromEmail":"jacob.keller@gmail.com","sentAt":"2016-12-17T00:45:41Z","receivedAt":"2016-12-17T00:46:07Z","isPatch":false,"sender":{"key":"jacob.keller@gmail.com","avatar":"https://avatars.githubusercontent.com/u/874719?v=4"},"body":"On Fri, Dec 16, 2016 at 4:44 PM, Jacob Keller <jacob.keller@gmail.com> wrote:\n> On Fri, Dec 16, 2016 at 4:28 PM, Norbert Kiesel <nkiesel@gmail.com> wrote:\n>> Hi,\n>>\n>> I started using compaction-heuristic with 2.9, and then also (or so I\n>> thought) enabled indent-heuristic with 2.11.\n>> Only after reading a comment in \"Git rev news\" I realized that these 2\n>> options are mutually exclusive.  I then\n>> checked the Git source code and saw that Git first checks the new\n>> indent-heuristic and then the old compaction-heuristic.\n>> Therefore, anyone who is as stupid as me and enabled both will always\n>> (and silently) end up with the older of the\n>> two.\n>>\n>> Apart from better documentation (I know that both are marked\n>> experimental, but nevertheless): could we not swap the\n>> order in which they are tested so that the newer heuristic wins?\n>>\n>> </nk>\n>\n> I looked at the code and I don't think this is the case. In\n> diff_setup() on line 3381, we check indent heuristic first. However,\n> when we check the compaction heuristic second, we use an \"else if\" so\n> we do not set both. I believe it already performs indent heuristic\n> correctly if you enable both options in configuration.\n>\n> Thanks,\n> Jake\n\nOn further looking, I realized again that maybe you are right. I will\nsend a patch to change the other spot where we might prefer the older\nheuristic.\n\nThanks,\nJake\n"}]}