{"thread":{"id":"3237","subject":"git-diff-tree --cc on the dodecapus","startedAt":"2006-02-04T11:45:35Z","lastAt":"2006-02-04T13:01:22Z","messageCount":2,"participants":["Paul Mackerras","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"15569","messageId":"17380.37855.117313.631961@cargo.ozlabs.ibm.com","threadId":"3237","inReplyTo":null,"subject":"git-diff-tree --cc on the dodecapus","fromName":"Paul Mackerras","fromEmail":"paulus@samba.org","sentAt":"2006-02-04T11:45:35Z","receivedAt":"2006-02-04T11:45:35Z","isPatch":false,"sender":{"key":"paulus@samba.org","avatar":"https://avatars.githubusercontent.com/u/1606439?v=4"},"body":"Junio,\n\nWhen I use git diff-tree --cc on Len's dodecapus merge (9fdb62af), the\nfirst diff hunk that it shows is this:\n\n@@@@@@@@@@@@@ -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 @@@@@@@@@@@@@\n            \tload_ramdisk=\t[RAM] List of ramdisks to load from floppy\n            \t\t\tSee Documentation/ramdisk.txt.\n            \n -----------\tlockd.udpport=\t[NFS]\n +++++++++++\tlockd.nlm_grace_period=P  [NFS] Assign grace period.\n +++++++++++\t\t\tFormat: <integer>\n +++++++++++\n +++++++++++\tlockd.nlm_tcpport=N\t[NFS] Assign TCP port.\n +++++++++++\t\t\tFormat: <integer>\n ++++ ++++++\n     -      \tlockd.tcpport=\t[NFS]\n +++++++++++\tlockd.nlm_timeout=T\t[NFS] Assign timeout value.\n +++++++++++\t\t\tFormat: <integer>\n     +      \n ---- ------\tlockd.tcpport=\t[NFS]\n +++++++++++\tlockd.nlm_udpport=M\t[NFS] Assign UDP port.\n +++++++++++\t\t\tFormat: <integer>\n            \n            \tlogibm.irq=\t[HW,MOUSE] Logitech Bus Mouse Driver\n            \t\t\tFormat: <irq>\n\nFor some reason, the 6th parent's lines are getting matched\ndifferently from the other parents.  Parents 2-12 are actually all the\nsame in this file AFAICS.  All that has happened is that a sequence of\nthree lines: \"lockd.udpport=  [NFS]\", a blank line, \"lockd.tcpport=\n[NFS]\", have been replaced by 11 lines.  For parent 6, the blank line\nhas been matched with the 6th line of the new stuff, whereas for\nparents 2..5 and 7..12 the blank line has been matched with line 9 of\nthe new stuff.  This makes it look like the change from parent 6 is\ndifferent when it isn't really, and thus the diff looks interesting\nwhen it shouldn't.\n\nIn general, I have found in doing N-way diff displays (both in dirdiff\nand in gitk), that one needs to be a bit clever about working out\nwhich lines correspond in the N versions.  If you do a series of 2-way\ndiffs and just believe what diff tells you about which lines\ncorrespond, you will end up with things being shown as different when\nthey aren't.  Where there is ambiguity, some of the 2-way diffs will\nresolve it one way and some another, and as a result, something which\nis in fact common to all the files can end up being shown as a\ndifference.\n\nWhat I do in dirdiff is to do a number of 2-way diffs, but just use\nthe result as an indication of which parts of the files have some\ndifference.  I then find the matches between all the files in Tcl code\nand work out which lines are common and which lines are unique.  I\nhave found it necessary to apply a rule that says that a match across\na larger number of files is preferable to a match across a smaller\nnumber, even if it is a longer match.  For a set of lines, I\niteratively pull out the best match (most number of files, then most\nnumber of lines).  What's left at the end is the lines that are unique\nto one file.  This ends up being a bit complicated, but it seems to be\nnecessary for producing a reasonable result.  I can go into more\ndetail on the algorithm I use if you want.\n\nPaul.\n"},{"id":"15576","messageId":"7vy80rwa59.fsf@assigned-by-dhcp.cox.net","threadId":"3237","inReplyTo":"17380.37855.117313.631961@cargo.ozlabs.ibm.com","subject":"Re: git-diff-tree --cc on the dodecapus","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-02-04T13:01:22Z","receivedAt":"2006-02-04T13:01:22Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Paul Mackerras <paulus@samba.org> writes:\n\n> Junio,\n>\n> When I use git diff-tree --cc on Len's dodecapus merge (9fdb62af), the\n> first diff hunk that it shows is this:\n\nYeah, I noticed it too, and you described how that happens quite\nwell.  The algorithm is simplistic and improvement patches are\nwelcome.\n"}]}