summaryrefslogtreecommitdiff
path: root/jenkins-helpers.sh
diff options
context:
space:
mode:
authorMaxim Kuvyrkov <maxim.kuvyrkov@linaro.org>2019-04-27 19:04:35 +0000
committerMaxim Kuvyrkov <maxim.kuvyrkov@linaro.org>2019-04-27 19:04:35 +0000
commitfba29c39be5aaf4af24d875b37b6efbc4931335d (patch)
tree75966facc0654dd63ded631cbb0dc36aebc10547 /jenkins-helpers.sh
parent52f3f9711c37970fff48a7889258bb43237c6e2b (diff)
jenkins-helpers.sh: Avoid inconsistent state of remote by re-creating it
We can get into state when remote has no "fetch" configured, and "git remote set-branches" fails. Make repo updates more robust by recreating remote entries. Also makes for simpler code. Change-Id: I18b830ac177bac1917ebfc4c4bdcd7bb5aa60f57
Diffstat (limited to 'jenkins-helpers.sh')
-rw-r--r--jenkins-helpers.sh10
1 files changed, 3 insertions, 7 deletions
diff --git a/jenkins-helpers.sh b/jenkins-helpers.sh
index c64d1766..7003b3a7 100644
--- a/jenkins-helpers.sh
+++ b/jenkins-helpers.sh
@@ -468,13 +468,9 @@ clone_or_update_repo_no_checkout ()
cd "$dir"
# Update from URL.
- git remote add "$remote" "$url" > /dev/null 2>&1 || true
- git remote set-url "$remote" "$url"
- if [ x"$single_branch" = x"" ]; then
- git remote set-branches "$remote" "*"
- else
- git remote set-branches "$remote" "$single_branch"
- fi
+ git remote rm "$remote" > /dev/null 2>&1 || true
+ git remote add ${single_branch:+-t "$single_branch"} "$remote" "$url"
+
local refspec="+refs/changes/*:refs/changes/*"
if [ x"$single_branch" = x"" ]; then
run_with_timeout_and_retry 1h 3 git remote update -p