Ignore symbolic references during local_prep.

In the image update script ignore any branch returned by `git branch -a`
containing the ' -> 'substring. This entire string denotes a symbolic
reference and is not a valid branch (so it cannot be checked out). We
can do this safely because `git branch -a` will also return the branch
referred to by the reference.

Change-Id: I47852ffd6e25fe3a29a1b310142c5614ca5a6fa9
This commit is contained in:
Clark Boylan
2013-01-08 19:49:36 -08:00
parent b77da8f48b
commit 01de7f0599

View File

@@ -101,6 +101,12 @@ def tokenize(fn, tokens, distribution, comment=None):
def local_prep(distribution):
branches = []
for branch in git_branches():
# Ignore branches of the form 'somestring -> someotherstring' as
# this denotes a symbolic reference and the entire string as is
# cannot be checkout out. We can do this safely as the reference
# will refer to one of the other branches returned by git_branches.
if ' -> ' in branch:
continue
branch_data = {'name': branch}
print 'Branch: ', branch
run_local(['git', 'checkout', branch], cwd=DEVSTACK)