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

Re: [PATCH] diff: Fix rename pretty-print when suffix and prefix overlap

From
Antoine Pelisse <apelisse@gmail.com>
Date
Feb 25, 2013, 19:50 UTC
Message-ID
<CALWbr2yviqF68zF7mBbhaXW7oFar0YRqROBWXwqjo7UNgZNVBQ@mail.gmail.com>
In-Reply-To
<7vzjyu3we1.fsf@alter.siamese.dyndns.org>
On Sun, Feb 24, 2013 at 10:15 AM, Junio C Hamano <gitster@pobox.com> wrote:
Show 10 quoted lines
> Antoine Pelisse <apelisse@gmail.com> writes:
>
>> When considering a rename for two files that have a suffix and a prefix
>> that can overlap, a confusing line is shown. As an example, renaming
>> "a/b/b/c" to "a/b/c" shows "a/b/{ => }/b/c".
>
> This would be vastly more readable if it had "It should show XXX
> instead" somewhere in the description, perhaps at the end of this
> sentence.  It can also be after "thus the { => }" below, but I think
> giving the expected output earlier would be more appropriate.
Good catch, this would probably be better:
    When considering a rename for two files that have a suffix and a prefix
    that can overlap, a confusing line is shown. As an example, renaming
    "a/b/b/c" to "a/b/c" shows "a/b/{ => }/b/c", instead of "a/b/{ => b}/c"
Show 8 quoted lines
>> Currently, what we do is calculate the common prefix ("a/b/"), and the
>> common suffix ("/b/c"), but the same "/b/" is actually counted both in
>> prefix and suffix. Then when calculating the size of the non-common part,
>> we end-up with a negative value which is reset to 0, thus the "{ => }".
>
> In this example, the common prefix would be "a/b/" and the common
> suffix that does not overlap with the prefix part would be "/c", so
> I am imagining that "a/b/{ => b}/c" would be the desired output?
Yes, at least that's what I expected.
Show 5 quoted lines
> This is a really old thinko (dating back to June 2005).  I'll queue
> the patch on maint-1.7.6 (because 1.7.6.6 is slightly more than one
> year old while 1.7.5.4 is a lot older) to allow distros that issue
> incremental fixes on top of ancient versions of Git to pick up the
> fix if they wanted to.  Perhaps we would want to add a few tests?

I can easily understand why that was missed. I will try to resubmit with tests very soon.

Previous: Junio C HamanoNext: Philip Oakley
Message 3 of 16 in “diff: Fix rename pretty-print when suffix and prefix overlap”
  1. diff: Fix rename pretty-print when suffix and prefix overlapAntoine Pelisse, Feb 23, 2013
  2. Junio C HamanoFeb 24, 2013
  3. Antoine PelisseFeb 25, 2013
  4. Philip OakleyFeb 25, 2013
  5. Antoine PelisseFeb 25, 2013
  6. diff: Fix rename pretty-print when suffix and prefix overlapAntoine Pelisse, Feb 28, 2013
  7. Thomas RastFeb 28, 2013
  8. Antoine PelisseFeb 28, 2013
  9. Junio C HamanoFeb 28, 2013
  10. tests: make sure rename pretty print worksAntoine Pelisse, Mar 2, 2013
  11. Junio C HamanoMar 3, 2013
  12. tests: make sure rename pretty print worksAntoine Pelisse, Mar 6, 2013
  13. Junio C HamanoMar 6, 2013
  14. diff: prevent pprint_rename from underrunning inputThomas Rast, Feb 26, 2013
  15. Junio C HamanoFeb 26, 2013
  16. Antoine PelisseFeb 27, 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.