test: allow missing remote branches

The code for checking out source code for testing no longer worked
with newer git when there weren't any remote branches which had to be
reset.

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
This commit is contained in:
Patrick Ohly 2020-03-02 04:45:27 -08:00
parent 1216bdaebc
commit 77a9a450d2

View file

@ -723,8 +723,10 @@ class GitCopy(GitCheckoutBase, Action):
'if git branch | grep -q -w "^..nightly$"; then git branch -D nightly; fi',
# fetch
'echo "remove stale merge branches and fetch anew"',
'git branch -r -D $( git branch -r | grep -e "/for-%(revision)s/" ) ',
'git branch -D $( git branch | grep -e "^ for-%(revision)s/" ) ',
'branches=$( git branch -r | grep -e "/for-%(revision)s/"; true )',
'( [ ! "$branches" ] || git branch -r -D $branches )',
'branches=$( git branch | grep -e "^ for-%(revision)s/"; true )',
'( [ ! "$branches" ] || git branch -D $branches )',
'git fetch',
'git fetch --tags',
# pick tag or remote branch