Git development
 help / color / mirror / Atom feed
From: Paul Mackerras <paulus@samba.org>
To: Junio C Hamano <junkio@cox.net>, git@vger.kernel.org
Subject: git-diff-tree --cc on the dodecapus
Date: Sat, 4 Feb 2006 22:45:35 +1100	[thread overview]
Message-ID: <17380.37855.117313.631961@cargo.ozlabs.ibm.com> (raw)

Junio,

When I use git diff-tree --cc on Len's dodecapus merge (9fdb62af), the
first diff hunk that it shows is this:

@@@@@@@@@@@@@ -712,17 -711,9 -703,9 -703,9 -703,9 -708,9 -703,9 -703,9 -711,9 -703,9 -711,9 -711,9 +717,17 @@@@@@@@@@@@@
            	load_ramdisk=	[RAM] List of ramdisks to load from floppy
            			See Documentation/ramdisk.txt.
            
 -----------	lockd.udpport=	[NFS]
 +++++++++++	lockd.nlm_grace_period=P  [NFS] Assign grace period.
 +++++++++++			Format: <integer>
 +++++++++++
 +++++++++++	lockd.nlm_tcpport=N	[NFS] Assign TCP port.
 +++++++++++			Format: <integer>
 ++++ ++++++
     -      	lockd.tcpport=	[NFS]
 +++++++++++	lockd.nlm_timeout=T	[NFS] Assign timeout value.
 +++++++++++			Format: <integer>
     +      
 ---- ------	lockd.tcpport=	[NFS]
 +++++++++++	lockd.nlm_udpport=M	[NFS] Assign UDP port.
 +++++++++++			Format: <integer>
            
            	logibm.irq=	[HW,MOUSE] Logitech Bus Mouse Driver
            			Format: <irq>

For some reason, the 6th parent's lines are getting matched
differently from the other parents.  Parents 2-12 are actually all the
same in this file AFAICS.  All that has happened is that a sequence of
three lines: "lockd.udpport=  [NFS]", a blank line, "lockd.tcpport=
[NFS]", have been replaced by 11 lines.  For parent 6, the blank line
has been matched with the 6th line of the new stuff, whereas for
parents 2..5 and 7..12 the blank line has been matched with line 9 of
the new stuff.  This makes it look like the change from parent 6 is
different when it isn't really, and thus the diff looks interesting
when it shouldn't.

In general, I have found in doing N-way diff displays (both in dirdiff
and in gitk), that one needs to be a bit clever about working out
which lines correspond in the N versions.  If you do a series of 2-way
diffs and just believe what diff tells you about which lines
correspond, you will end up with things being shown as different when
they aren't.  Where there is ambiguity, some of the 2-way diffs will
resolve it one way and some another, and as a result, something which
is in fact common to all the files can end up being shown as a
difference.

What I do in dirdiff is to do a number of 2-way diffs, but just use
the result as an indication of which parts of the files have some
difference.  I then find the matches between all the files in Tcl code
and work out which lines are common and which lines are unique.  I
have found it necessary to apply a rule that says that a match across
a larger number of files is preferable to a match across a smaller
number, even if it is a longer match.  For a set of lines, I
iteratively pull out the best match (most number of files, then most
number of lines).  What's left at the end is the lines that are unique
to one file.  This ends up being a bit complicated, but it seems to be
necessary for producing a reasonable result.  I can go into more
detail on the algorithm I use if you want.

Paul.

             reply	other threads:[~2006-02-04 11:45 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-02-04 11:45 Paul Mackerras [this message]
2006-02-04 13:01 ` git-diff-tree --cc on the dodecapus Junio C Hamano

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=17380.37855.117313.631961@cargo.ozlabs.ibm.com \
    --to=paulus@samba.org \
    --cc=git@vger.kernel.org \
    --cc=junkio@cox.net \
    /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