chiark / gitweb /
Optimise pick --fold to use git-apply first
authorCatalin Marinas <catalin.marinas@gmail.com>
Thu, 10 Nov 2005 14:28:42 +0000 (14:28 +0000)
committerCatalin Marinas <catalin.marinas@gmail.com>
Thu, 10 Nov 2005 14:28:42 +0000 (14:28 +0000)
If "git-diff-tree | git-apply" fails, the command falls back to a
three-way merge.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
stgit/commands/pick.py

index 770d69fc4fbcfcfb6f447c15e55d2cd09f7ceae9..c425945124c22be806e28c3fd4ff8d0a198fc1c9 100644 (file)
@@ -80,7 +80,9 @@ def func(parser, options, args):
         print 'Folding commit %s...' % commit_id,
         sys.stdout.flush()
 
-        git.merge(bottom, git.get_head(), top)
+        # try a direct git-apply first
+        if not git.apply_diff(bottom, top):
+            git.merge(bottom, git.get_head(), top)
 
         print 'done'
     else: