Gurjeet Singh <singh.gurj...@gmail.com> wrote:
> Alvaro Herrera <alvhe...@commandprompt.com>wrote:
 
>> There is a very simple example posted on some of the blog posts
>> that goes something like
>>
>> aaaaaaaa
>> aaaaaaaa
>> aaaaaaaa
>> bbbbbbbb
>> bbbbbbbb
>> bbbbbbbb
>> xyz
>>
>> and the "xyz" is moved to the front.  In this corner case, the
>> patience diff is a lot worse.
>>
> 
> Sorry, but that example didn't make much sense to me. Can you
> please elaborate, or maybe share those blog posts you are referring
to.
 
I tried it out.  Here are the results:
 
git diff --color
diff --git a/a1 b/a1
index bd0586b..32736d1 100644
--- a/a1
+++ b/a1
@@ -1,7 +1,7 @@
+xyz
 aaaaaaaa
 aaaaaaaa
 aaaaaaaa
 bbbbbbbb
 bbbbbbbb
 bbbbbbbb
-xyz
git diff --color --patience
diff --git a/a1 b/a1
index bd0586b..32736d1 100644
--- a/a1
+++ b/a1
@@ -1,7 +1,7 @@
-aaaaaaaa
-aaaaaaaa
-aaaaaaaa
-bbbbbbbb
-bbbbbbbb
-bbbbbbbb
 xyz
+aaaaaaaa
+aaaaaaaa
+aaaaaaaa
+bbbbbbbb
+bbbbbbbb
+bbbbbbbb
 
This is because lines which only occur once in a file are the
"anchors" around which lines which occur multiple times move -- 
after keeping intact any leading and trailing lines which match
between the files.  An interesting exercise it so think about what
real-life lines you could have which would have multiple occurrences
in this pattern, and think about whether you would then prefer the
--patience output, especially if this were part of a larger file. 
Even in this supposed "worst case" example, I'm not at all sure I
wouldn't prefer --patience, personally, even though more lines are
flagged.
 
-Kevin

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to