fix: Switch detached head for daily updates (#8194)

If HEAD is detached, switch to master.
(Detached head is ok for the release version)
This commit is contained in:
Tony Murray
2018-02-05 15:20:06 -06:00
committed by Neil Lathwood
parent b834d2d4b4
commit 3ddeb1dbc5

View File

@ -194,6 +194,12 @@ main () {
update_res=0
if [[ "$up" == "1" ]] || [[ "$php_ver_ret" == "1" ]]; then
# Update current branch to latest
local branch=$(git rev-parse --abbrev-ref HEAD)
if [[ "$branch" == "HEAD" ]]; then
# if the branch is HEAD, then we are not on a branch, checkout master
git checkout master
fi
old_ver=$(git rev-parse --short HEAD)
status_run 'Updating to latest codebase' 'git pull --quiet' 'update'
update_res=$?