On Fri, Jun 23, 2017 at 12:13 PM, Junio C Hamano <gitster@xxxxxxxxx> wrote: > Daniel Hahler <git@xxxxxxxxxx> writes: > >> When -U0 is used, trim_common_tail should be called after `xdl_diff`, so >> that `--indent-heuristic` (and other diff processing) works as expected. > > I thought common-tail trimming was a hack/optimization to avoid > having to pass the whole thing to have xdl_diff() work on it? What > would we be gaining by unconditionally passing the whole thing first > and then still trimming? So I tried finding out more about this hack, and found the patch that introduced the common tail trimming at https://public-inbox.org/git/7vmysez0oa.fsf@xxxxxxxxxxxxxxxxxxxxxxxxxx/ 913b45f51b (xdi_diff: trim common trailing lines, 2007-12-13) In the early days there were much larger email threads apparently. I haven't seen such a big one in a while. I did not find the email that the commit message referenced to unfortunately. AFAICT we have 2 things going on: * swapping the order of xdl_diff and the tail trimming * change the condition under which the tail is trimmed (as a logical follow up/ cleanup because of the first point) I do not understand the first one, yet.