Re: [PATCH 0/3] Teach Git about the patience diff algorithm
- From
Linus Torvalds <torvalds@linux-foundation.org>
- Date
- Jan 2, 2009, 23:05 UTC
- Message-ID
- <alpine.LFD.2.00.0901021500530.3179@localhost.localdomain>
- In-Reply-To
- <20090102205208.GA9273@coredump.intra.peff.net>
On Fri, 2 Jan 2009, Jeff King wrote:
Show 29 quoted lines
> > Here's another interesting one: d592b315. The commit removes dashes > from git commands in test scripts. Git says: > > echo "tag-one-line" >expect && > - git-tag -l | grep "^tag-one-line" >actual && > + git tag -l | grep "^tag-one-line" >actual && > test_cmp expect actual && > - git-tag -n0 -l | grep "^tag-one-line" >actual && > + git tag -n0 -l | grep "^tag-one-line" >actual && > test_cmp expect actual && > - git-tag -n0 -l tag-one-line >actual && > + git tag -n0 -l tag-one-line >actual && > test_cmp expect actual && > > whereas patience says: > > echo "tag-one-line" >expect && > - git-tag -l | grep "^tag-one-line" >actual && > - test_cmp expect actual && > - git-tag -n0 -l | grep "^tag-one-line" >actual && > - test_cmp expect actual && > - git-tag -n0 -l tag-one-line >actual && > + git tag -l | grep "^tag-one-line" >actual && > + test_cmp expect actual && > + git tag -n0 -l | grep "^tag-one-line" >actual && > + test_cmp expect actual && > + git tag -n0 -l tag-one-line >actual && > test_cmp expect actual &&
Yeah, the bazaar version clearly is inferior here. But again, I don't think that's actually a patience diff issue, I think it's because the bazaar diff has merged consecutive diff lines too aggressively.
I suspect both patience and the straight Mayers diff (that git uses) actually finds exactly the same differences, and then bazaar has a "merge closeby -/ pairs together if there is just a single unmodified line in between them".
And _that_ is where it should care whether the unmodified line is complex or not. If it's complex, you shouldn't merge it into the -/+ region.
(but yes, it's possible that the bazaar diff uses "uniqueness" as a complexity analysis marker, and while that is somewhat valid, it is _not_ valid enough to be useful. Unique lines tend to be complex, but complex lines are _not_ always unique)
Linus