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

pull/1313/head
DL6ER 7 years ago
parent d4a49d192f
commit 1b9e7fbf2e
No known key found for this signature in database
GPG Key ID: 00135ACBD90B28DD

@ -48,16 +48,10 @@ fetch_checkout_pull_branch() {
local directory="${1}"
local branch="${2}"
# Check if branch exists locally
if git rev-parse --quiet --verify "${branch}" &> /dev/null; then
# Branch exists locally, we can check it out and pull it
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
# Set the reference for the requested branch, 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
}
checkout_pull_branch() {

Loading…
Cancel
Save