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

Re: [PATCH 1/2] transport-helper: report errors properly

From
Felipe Contreras <felipe.contreras@gmail.com>
Date
Apr 13, 2013, 05:42 UTC
Message-ID
<CAMP44s1pZW6OJ2nkegKFQq6=npPSiD4dX_z37t63B9baaFW16w@mail.gmail.com>
In-Reply-To
<7vd2u0hdmj.fsf@alter.siamese.dyndns.org>
On Thu, Apr 11, 2013 at 6:05 PM, Junio C Hamano <gitster@pobox.com> wrote:
Show 7 quoted lines
> Felipe Contreras <felipe.contreras@gmail.com> writes:
>
>> And if you must, you might was well label them with "REMINDER", no,
>> wait, that's what "TODO" comments are for, where people can see them,
>> and not *forget* them.
>
> Yeah, good point.
Moreover, I think there's a clear double standard. Consider this commit:
commit 99d3206010ba1fcc9311cbe8376c0b5e78f4a136
Author: Antoine Pelisse <apelisse@gmail.com>
Date:   Sat Mar 23 18:23:28 2013 +0100
    combine-diff: coalesce lost lines optimally
    This replaces the greedy implementation to coalesce lost lines by using
    dynamic programming to find the Longest Common Subsequence.
    The O(n²) time complexity is obviously bigger than previous
    implementation but it can produce shorter diff results (and most likely
    easier to read).
    List of lost lines is now doubly-linked because we reverse-read it when
    reading the direction matrix.

The commit message is 9 lines, and the diffstat 320 insertions(+), 64 deletions(-). Moreover, there are some important bits of information on the mailing list that never made it to the commit message:

--- Best-case analysis: All p parents have the same n lines. We will find LCS and provide a n lines (the same lines) new list in O(n²), and then run it again in O(n²) with the next parent, etc. It will end-up being O(pn²).

Worst-case analysis: All p parents have no lines in common. We will find LCS and provide a 2n new list in O(n²). Then we run it again in O(2n x n), and again O(3n x n), etc, until O(pn x n). When we sum these all, we end-up with O(p² x n²) ---

--- Unfortunately on a commit that would remove A LOT of lines (10000) from 7 parents, the times goes from 0.01s to 1.5s... I'm pretty sure that scenario is quite uncommon though. ---

This is not mentioned in the commit message; on which situations this implementation would be worst and why it's OK either way.

--- As you can see the last test is broken because the solution is not optimal for more than two parents. It would probably require to extend the dynamic programming to a k-dimension matrix (for k parents) but the result would end-up being O(n^k) (when removing n consecutives lines from p parents). I'm not sure there is any better solution known yet to the k-LCS problem. Implementing the dynamic solution with the k-dimension matrix would probably require to re-hash the strings (I guess it's already done by xdiff), as the number of string comparisons would increase. ---

The fact that the last test is broken is not mentioned at all.

Now let's compare to the final version of my patch which is 19 lines 40 insertions(+), 1 deletion(-). The ration of commit message lines vs. code changed lines is 19/41(0.46) whereas Antoine's patch is 3/128(0.02), a difference of over 19 times. Granted, some single-line changes do require a good chunk of explanation, but this is not one of them; this single line patch doesn't even change the behavior of the code, simply changes a silent error exit to a verbose error exit, that's all. Antoine's patch has a lot more potential to trigger something unexpected.

And the chances that somebody would have to look at Antoine's patch is quite high, especially since a failing test-case is introduced. The chances that anybody would look at mine are very very low.

So either Antoine's commit message was fine, and so was mine, or it was sorely lacking explanation.

To me, the reality is obvious: my patch didn't require such a big commit message, the short version was fine, the only reason Jeff King insisted on a longer version is because the patch came from me. Antoine's patch might have benefited from a little more explanation, but not every issue that was discussed in the mailing list was necessary (in my patch virtually every issue discussed was added to the commit message).

This is the definition of double standard.
Cheers.
-- 
Felipe Contreras
Previous: Junio C HamanoNext: Jeff King
Message 21 of 31 in “transport-helper: report errors properly”
  1. transport-helper: report errors properlyFelipe Contreras, Apr 8, 2013
  2. Sverre RabbelierApr 8, 2013
  3. Jeff KingApr 8, 2013
  4. Jeff KingApr 8, 2013
  5. Thomas RastApr 9, 2013
  6. Jeff KingApr 9, 2013
  7. 0/2 reporting transport helper errorsJeff King, Apr 10, 2013
  8. 1/2 transport-helper: report errors properlyJeff King, Apr 10, 2013
  9. Sverre RabbelierApr 10, 2013
  10. Eric SunshineApr 10, 2013
  11. Felipe ContrerasApr 11, 2013
  12. Jeff KingApr 11, 2013
  13. Felipe ContrerasApr 11, 2013
  14. Jeff KingApr 11, 2013
  15. Felipe ContrerasApr 11, 2013
  16. Junio C HamanoApr 11, 2013
  17. Felipe ContrerasApr 11, 2013
  18. Junio C HamanoApr 11, 2013
  19. Felipe ContrerasApr 11, 2013
  20. Junio C HamanoApr 11, 2013
  21. Felipe ContrerasApr 13, 2013
  22. Jeff KingApr 13, 2013
  23. Felipe ContrerasApr 13, 2013
  24. Junio C HamanoApr 14, 2013
  25. Felipe ContrerasApr 14, 2013
  26. 2/2 transport-helper: mention helper name when it diesJeff King, Apr 10, 2013
  27. Sverre RabbelierApr 10, 2013
  28. Jeff KingApr 10, 2013
  29. Sverre RabbelierApr 10, 2013
  30. rhApr 10, 2013
  31. Jeff KingApr 11, 2013

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.