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

Re: [RFH] shifting xdiff hunks?

From
DLDavide Libenzi <davidel@xmailserver.org>
Date
Apr 13, 2006, 06:52 UTC
Message-ID
<Pine.LNX.4.64.0604122348010.7104@alien.or.mcafeemobile.com>
In-Reply-To
<7vmzeqyolw.fsf@assigned-by-dhcp.cox.net>
On Wed, 12 Apr 2006, Junio C Hamano wrote:
Show 8 quoted lines
> The first hunk begins by an addition of a couple of non-blank
> line followed by an addition of a blank line.  The second hunk,
> while it does the same thing, is shown differently.
>
> Now, from correctness point of view, this is not a problem at
> all, but I am wondering if xdiff can help to always shift the
> hunk down or up to consistently produce one way or another
> (personally I feel the former is easier to read).
Next on your screens, Junio and Linus in the new commedy "Pickier and Pickiest" :)
Show 15 quoted lines
> Here is a rough sketch of what I think I want.  When we have
> additions, as long as the first line added happens to match the
> first line that is common between the versions that comes after
> the added hunk (that is, in the case of the second hunk above,
> the empty line before "gitlink:git-rm[1]" happens to match the
> empty line after the added three lines), roll the hunk down by
> one, until you cannot roll it down anymore.
>
> Just in case I get misinterpreted, I am not talking about
> treating empty lines in any special way.  It is more about
> "starting the hunk with actually changed line".  The first hunk
> above clearly begins with something added, while the second one
> does not.
>
> Is this something easy to do with the xdiff code?

Yes, this is what GNU diff does. It's a post-process of the edit script. Not a problem at all. Till this weekend (included) I'm pretty booked, but I'll do that in the following days.

- Davide
Previous: Junio C HamanoNext: Davide Libenzi
Message 2 of 5 in “[RFH] shifting xdiff hunks?”
  1. Junio C HamanoApr 13, 2006
  2. Davide LibenziApr 13, 2006
  3. Davide LibenziApr 13, 2006
  4. Junio C HamanoApr 13, 2006
  5. Jakub NarebskiApr 13, 2006

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.