]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
patman: Only apply patches when we know the original HEAD
authorSimon Glass <sjg@chromium.org>
Thu, 12 Jun 2014 05:27:09 +0000 (23:27 -0600)
committerSimon Glass <sjg@chromium.org>
Mon, 7 Jul 2014 23:22:03 +0000 (17:22 -0600)
When patman applies the patches it checks out a new branch, uses 'git am'
to apply the patches one by one, and then tries to go back to the old
branch. If you try this when the branch is 'undefined', this doesn't work
as patman cannot restore the correct branch after applying the patches.
It seems that 'undefined' is created by git and is persistent after it is
created, so that you can end up on quite an old branch.

Add a check for the 'undefined' branch to avoid this.

Reported-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
tools/patman/gitutil.py

index 3ea256de2e262cd0e34de4d9126fe95ee10e843c..7b75c83a82c07c0d8e3f502c11f4f9b0f3b598d8 100644 (file)
@@ -232,6 +232,10 @@ def ApplyPatches(verbose, args, start_point):
         print stdout
         return False
     old_head = stdout.splitlines()[0]
+    if old_head == 'undefined':
+        str = "Invalid HEAD '%s'" % stdout.strip()
+        print col.Color(col.RED, str)
+        return False
 
     # Checkout the required start point
     cmd = ['git', 'checkout', 'HEAD~%d' % start_point]