summaryrefslogtreecommitdiff
path: root/tools/patman/gitutil.py
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2014-06-12 05:27:09 (GMT)
committerSimon Glass <sjg@chromium.org>2014-07-07 23:22:03 (GMT)
commit4251978afccb4b58c477c74f2d9888a063e5a995 (patch)
treec83121b9e2f7ff0db88f320e4507aec74db4e114 /tools/patman/gitutil.py
parent6ee3d00d1d9d9977e975bd72c3668ee4f210a99d (diff)
downloadu-boot-fsl-qoriq-4251978afccb4b58c477c74f2d9888a063e5a995.tar.xz
patman: Only apply patches when we know the original HEAD
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>
Diffstat (limited to 'tools/patman/gitutil.py')
-rw-r--r--tools/patman/gitutil.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/tools/patman/gitutil.py b/tools/patman/gitutil.py
index 3ea256d..7b75c83 100644
--- a/tools/patman/gitutil.py
+++ b/tools/patman/gitutil.py
@@ -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]