Stay on current branch unless BRANCHNAME is set

This commit is contained in:
Alex Malinovich 2018-03-10 14:07:03 -08:00
parent 306edf9d0d
commit 6a882a8ad3
No known key found for this signature in database
GPG key ID: F3327D1AA93CF5F0

View file

@ -228,8 +228,9 @@ if [ "${AUTOUPDATE}" = "yes" ]; then
elif ! git diff --quiet; then
warn "You have made changes to the plexupdate files, cannot auto update"
else
BRANCHNAME="${BRANCHNAME:-master}"
if [ "${BRANCHNAME}" != "$(git symbolic-ref -q --short HEAD)" ]; then
if [ -z "${BRANCHNAME}" ]; then
BRANCHNAME="$(git symbolic-ref -q --short HEAD)"
elif [ "${BRANCHNAME}" != "$(git symbolic-ref -q --short HEAD)" ]; then
git checkout "${BRANCHNAME}"
fi
# Force FETCH_HEAD to point to the correct branch (for older versions of git which don't default to current branch)