All of lore.kernel.org
 help / color / mirror / Atom feed
From: Clemens Buchacher <drizzd@aon.at>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: "Adeodato Simó" <dato@net.com.org.es>,
	"Johannes Schindelin" <Johannes.Schindelin@gmx.de>,
	"Pierre Habouzit" <madcoder@debian.org>,
	davidel@xmailserver.org, "Francis Galiegue" <fg@one2team.net>,
	"Git ML" <git@vger.kernel.org>
Subject: Re: [PATCH 0/3] Teach Git about the patience diff algorithm
Date: Fri, 2 Jan 2009 11:55:38 +0100	[thread overview]
Message-ID: <20090102105537.GA14691@localhost> (raw)
In-Reply-To: <alpine.LFD.2.00.0901011747010.5086@localhost.localdomain>

On Thu, Jan 01, 2009 at 05:56:13PM -0800, Linus Torvalds wrote:
> See above - I really don't think this has anything to do with "patience vs 
> non-patience". It's more akin to the things we do for our merge conflict 
> markers: if we have two merge conflicts next to each other, with just a 
> couple of lines in between, we coalesce the merge conflicts into one 
> larger one instead.

But patience diff does more than that. Take a look at "git diff" and "git
diff --patience" output below (taken from [1]). You can see that patience
diff produces two separate hunks, one removing a function and one adding a
function. Merging consecutive diff fragments would have produced one big
hunk instead.

*** git diff ****************************** git diff --patience **********
 #include <stdio.h>                   | #include <stdio.h>
                                      |
+int fib(int n)                       |-// Frobs foo heartily
+{                                    |-int frobnitz(int foo)
+    if(n > 2)                        |+int fib(int n)
+    {                                | {
+        return fib(n-1) + fib(n-2);  |-    int i;
+    }                                |-    for(i = 0; i < 10; i++)
+    return 1;                        |+    if(n > 2)
+}                                    |     {
+                                     |-        printf("Your answer is: ");
 // Frobs foo heartily                |-        printf("%d\n", foo);
 int frobnitz(int foo)                |+        return fib(n-1) + fib(n-2);
 {                                    |     }
     int i;                           |+    return 1;
     for(i = 0; i < 10; i++)          | }
     {                                |
-        printf("Your answer is: ");  |-int fact(int n)
         printf("%d\n", foo);         |+// Frobs foo heartily
     }                                |+int frobnitz(int foo)
 }                                    | {
                                      |-    if(n > 1)
-int fact(int n)                      |+    int i;
-{                                    |+    for(i = 0; i < 10; i++)
-    if(n > 1)                        |     {
-    {                                |-        return fact(n-1) * n;
-        return fact(n-1) * n;        |+        printf("%d\n", foo);
-    }                                |     }
-    return 1;                        |-    return 1;
-}                                    | }
-                                     |
 int main(int argc, char **argv)      | int main(int argc, char **argv)
 {                                    | {
-    frobnitz(fact(10));              |-    frobnitz(fact(10));
+    frobnitz(fib(10));               |+    frobnitz(fib(10));
 }                                    | }

[1] http://alfedenzo.livejournal.com/170301.html

  reply	other threads:[~2009-01-02 10:57 UTC|newest]

Thread overview: 67+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-04  0:40 libxdiff and patience diff Pierre Habouzit
2008-11-04  3:17 ` Davide Libenzi
2008-11-04  8:33   ` Pierre Habouzit
2008-11-04  5:39 ` Johannes Schindelin
2008-11-04  8:30   ` Pierre Habouzit
2008-11-04 14:34     ` Johannes Schindelin
2008-11-04 15:23       ` Pierre Habouzit
2008-11-04 15:57         ` Johannes Schindelin
2008-11-04 16:15           ` Pierre Habouzit
2009-01-01 16:38         ` [PATCH 0/3] Teach Git about the patience diff algorithm Johannes Schindelin
2009-01-01 16:38           ` [PATCH 1/3] Implement " Johannes Schindelin
2009-01-01 16:39           ` [PATCH 2/3] Introduce the diff option '--patience' Johannes Schindelin
2009-01-01 16:39           ` [PATCH 3/3] bash completions: Add the --patience option Johannes Schindelin
2009-01-01 19:45           ` [PATCH 0/3] Teach Git about the patience diff algorithm Linus Torvalds
2009-01-01 20:00             ` Linus Torvalds
2009-01-02 18:17               ` Johannes Schindelin
2009-01-02 18:49                 ` Linus Torvalds
2009-01-02 19:07                   ` Johannes Schindelin
2009-01-02 18:51                 ` Jeff King
2009-01-02 21:59               ` [PATCH 1/3 v2] Implement " Johannes Schindelin
2009-01-02 21:59                 ` Johannes Schindelin
2009-01-01 20:46             ` [PATCH 0/3] Teach Git about " Adeodato Simó
2009-01-02  1:56               ` Linus Torvalds
2009-01-02 10:55                 ` Clemens Buchacher [this message]
2009-01-02 10:58                   ` Clemens Buchacher
2009-01-02 16:42                     ` Linus Torvalds
2009-01-02 18:46                       ` Johannes Schindelin
2009-01-02 19:03                         ` Linus Torvalds
2009-01-02 19:22                           ` Johannes Schindelin
2009-01-02 19:39                           ` Jeff King
2009-01-02 19:50                             ` Jeff King
2009-01-02 20:52                               ` Jeff King
2009-01-02 23:05                                 ` Linus Torvalds
2009-01-03 16:24                             ` Bazaar's patience diff as GIT_EXTERNAL_DIFF Adeodato Simó
2009-01-02 21:59                       ` [PATCH 0/3] Teach Git about the patience diff algorithm Johannes Schindelin
2009-01-08 19:55                       ` Adeodato Simó
2009-01-08 20:06                         ` Adeodato Simó
2009-01-09  6:54                         ` Junio C Hamano
2009-01-09 13:07                           ` Johannes Schindelin
2009-01-09 15:59                             ` Adeodato Simó
2009-01-09 18:09                             ` Linus Torvalds
2009-01-09 18:13                               ` Linus Torvalds
2009-01-09 20:53                             ` Junio C Hamano
2009-01-10 11:36                               ` Johannes Schindelin
2009-01-02 11:03                   ` Junio C Hamano
2009-01-02 18:50                 ` Adeodato Simó
2009-01-06 11:17           ` Pierre Habouzit
2009-01-06 11:39             ` Pierre Habouzit
2009-01-06 19:40             ` Johannes Schindelin
2009-01-07 14:39               ` Pierre Habouzit
2009-01-07 17:01                 ` Johannes Schindelin
2009-01-07 17:04                   ` [PATCH v3 1/3] Implement " Johannes Schindelin
2009-01-07 18:10                     ` Davide Libenzi
2009-01-07 18:32                       ` Johannes Schindelin
2009-01-07 20:09                         ` Davide Libenzi
2009-01-07 20:19                           ` Johannes Schindelin
2009-01-07 18:59                       ` Linus Torvalds
2009-01-07 20:00                         ` Johannes Schindelin
2009-01-07 20:11                         ` Davide Libenzi
2009-01-07 20:15               ` [PATCH 0/3] Teach Git about " Sam Vilain
2009-01-07 20:25                 ` Linus Torvalds
2009-01-08  2:31                   ` Sam Vilain
2009-01-07 20:38                 ` Johannes Schindelin
2009-01-07 20:48                   ` Junio C Hamano
2009-01-07 22:00                     ` Johannes Schindelin
2009-01-07 22:45                       ` Pierre Habouzit
2009-01-07 23:03                         ` Johannes Schindelin

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=20090102105537.GA14691@localhost \
    --to=drizzd@aon.at \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=dato@net.com.org.es \
    --cc=davidel@xmailserver.org \
    --cc=fg@one2team.net \
    --cc=git@vger.kernel.org \
    --cc=madcoder@debian.org \
    --cc=torvalds@linux-foundation.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.