diff options
author | Ryan S. Arnold <ryan.arnold@linaro.org> | 2015-08-14 09:26:01 -0500 |
---|---|---|
committer | Ryan Arnold <ryan.arnold@linaro.org> | 2015-08-31 16:51:26 +0000 |
commit | 49698d7bd28468368450201566c29bde67979814 (patch) | |
tree | 335c6cbe2f85c871a8ebc249f181a5637a7497e4 /lib | |
parent | db949b000119669c0e7813ba0ddccf19abb05fcf (diff) |
lib/checkout.sh: Deliberately checkout HEAD if ${branch} is empty.
[https://bugs.linaro.org/show_bug.cgi?id=1751]
This patch deliberately checks ${branch} and sets it to HEAD if it is
empty (only for checkout()) so that we deliberately checkout HEAD,
rather than by happenstance. Otherwise we get git 'fatal' warnings
from a malformed checkout which pollute the log and confuse users.
Change-Id: Ic21f5c7d61d37b9d5be3ae887c98029ed76378de
Diffstat (limited to 'lib')
-rw-r--r-- | lib/checkout.sh | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/checkout.sh b/lib/checkout.sh index 08a170a7..fc897535 100644 --- a/lib/checkout.sh +++ b/lib/checkout.sh @@ -350,9 +350,9 @@ checkout() dryrun "(cd ${srcdir} && git_robust checkout -B local_${revision})" else # Make sure we are on the correct branch. - # This is a no-op if $branch is empty and it - # just gets master. - dryrun "(cd ${srcdir} && git_robust checkout -B ${branch} origin/${branch})" + # If ${branch} is empty we set it to HEAD and checkout HEAD. + : ${branch:=HEAD} + dryrun "(cd ${srcdir} && git_robust checkout -B local_${branch} origin/${branch})" dryrun "(cd ${srcdir} && git_robust pull)" fi fi |