From: Junio C Hamano <junkio@cox.net>
To: Davide Libenzi <davidel@xmailserver.org>
Cc: git@vger.kernel.org
Subject: [RFH] shifting xdiff hunks?
Date: Wed, 12 Apr 2006 23:30:03 -0700 [thread overview]
Message-ID: <7vmzeqyolw.fsf@assigned-by-dhcp.cox.net> (raw)
I was looking at one diff produced from my work-in-progress,
which looked like this...
diff --git a/Documentation/git.txt b/Documentation/git.txt
index 06b2e53..f72abfc 100644
--- a/Documentation/git.txt
+++ b/Documentation/git.txt
@@ -265,6 +265,9 @@ gitlink:git-checkout[1]::
gitlink:git-cherry-pick[1]::
Cherry-pick the effect of an existing commit.
+gitlink:git-clean[1]::
+ Remove untracked files from the working tree.
+
gitlink:git-clone[1]::
Clones a repository into a new directory.
@@ -318,6 +321,9 @@ gitlink:git-resolve[1]::
gitlink:git-revert[1]::
Revert an existing commit.
+
+gitlink:git-rm[1]::
+ Remove files from the working tree and from the index.
gitlink:git-shortlog[1]::
Summarizes 'git log' output.
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).
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?
next reply other threads:[~2006-04-13 6:30 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-04-13 6:30 Junio C Hamano [this message]
2006-04-13 6:52 ` [RFH] shifting xdiff hunks? Davide Libenzi
2006-04-13 21:55 ` Davide Libenzi
2006-04-13 23:31 ` Junio C Hamano
2006-04-13 7:44 ` Jakub Narebski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7vmzeqyolw.fsf@assigned-by-dhcp.cox.net \
--to=junkio@cox.net \
--cc=davidel@xmailserver.org \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox