aboutsummaryrefslogtreecommitdiff
path: root/lib/checkout.sh
diff options
context:
space:
mode:
Diffstat (limited to 'lib/checkout.sh')
-rw-r--r--lib/checkout.sh6
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