Test if branch is locally available is not reliable because of possible ambiguities

This commit is contained in:
DL6ER 2017-03-11 16:40:10 +01:00
parent d4a49d192f
commit 1b9e7fbf2e
No known key found for this signature in database
GPG Key ID: 00135ACBD90B28DD
1 changed files with 4 additions and 10 deletions

View File

@ -48,16 +48,10 @@ fetch_checkout_pull_branch() {
local directory="${1}" local directory="${1}"
local branch="${2}" local branch="${2}"
# Check if branch exists locally # Set the reference for the requested branch, fetch, check it put and pull it
if git rev-parse --quiet --verify "${branch}" &> /dev/null; then git remote set-branches origin "${branch}" || return 1
# Branch exists locally, we can check it out and pull it git fetch --quiet || return 1
checkout_pull_branch "${directory}" "${branch}" || return 1 checkout_pull_branch "${directory}" "${branch}" || return 1
else
# Branch does not exist locally, we set the reference for it, fetch, check it put and pull it
git remote set-branches origin "${branch}" || return 1
git fetch --quiet || return 1
checkout_pull_branch "${directory}" "${branch}" || return 1
fi
} }
checkout_pull_branch() { checkout_pull_branch() {