From 77a9a450d2fee38e23f4e0a289298b3d313cfca1 Mon Sep 17 00:00:00 2001 From: Patrick Ohly Date: Mon, 2 Mar 2020 04:45:27 -0800 Subject: [PATCH] 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 --- test/runtests.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/runtests.py b/test/runtests.py index 60fd21a0..5b5c3255 100755 --- a/test/runtests.py +++ b/test/runtests.py @@ -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