]> code.ossystems Code Review - openembedded-core.git/commitdiff
lib/oe/patch.py: abort "git am" if it fails
authorPaul Eggleton <paul.eggleton@linux.intel.com>
Fri, 19 Dec 2014 11:41:48 +0000 (11:41 +0000)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Sun, 21 Dec 2014 12:37:18 +0000 (12:37 +0000)
If we don't do this, you may still be in the git am resolution mode at
the end of applying patches, which is not desirable.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/lib/oe/patch.py

index 2bf30651eb5acfa2dc3bc97e22863ef30d440729..522778140cc70864915d8e9289d0255c143adf71 100644 (file)
@@ -290,6 +290,12 @@ class GitApplyTree(PatchTree):
             shellcmd = ["git", "--work-tree=.", "am", "-3", "--keep-cr", "-p%s" % patch['strippath']]
             return _applypatchhelper(shellcmd, patch, force, reverse, run)
         except CmdError:
+            # Need to abort the git am, or we'll still be within it at the end
+            try:
+                shellcmd = ["git", "--work-tree=.", "am", "--abort"]
+                runcmd(["sh", "-c", " ".join(shellcmd)], self.dir)
+            except CmdError:
+                pass
             # Fall back to git apply
             shellcmd = ["git", "--git-dir=.", "apply", "-p%s" % patch['strippath']]
             try: