s'assurer de la présence de la branche distante avant de la traquer
This commit is contained in:
parent
c0bdafd864
commit
c99ec45e95
|
@ -564,6 +564,9 @@ function git_track_branch() {
|
||||||
[ -n "$branch" ] || return
|
[ -n "$branch" ] || return
|
||||||
git_have_remote "$origin" || return
|
git_have_remote "$origin" || return
|
||||||
[ "$(git config --get branch.$branch.remote)" == "$origin" ] && return
|
[ "$(git config --get branch.$branch.remote)" == "$origin" ] && return
|
||||||
|
if ! git_have_rbranch "$branch" "$origin"; then
|
||||||
|
git push "$origin" "$branch" || return
|
||||||
|
fi
|
||||||
git branch -t --set-upstream "$branch" "$origin/$branch"
|
git branch -t --set-upstream "$branch" "$origin/$branch"
|
||||||
}
|
}
|
||||||
function git_ensure_branch() {
|
function git_ensure_branch() {
|
||||||
|
@ -578,9 +581,7 @@ function git_ensure_branch() {
|
||||||
# créer une nouvelle branche du nom spécifié
|
# créer une nouvelle branche du nom spécifié
|
||||||
git_have_branch "$source" || return 2
|
git_have_branch "$source" || return 2
|
||||||
git branch "$branch" "$source" || return 2
|
git branch "$branch" "$source" || return 2
|
||||||
if git_have_remote "$origin"; then
|
git_have_remote "$origin" && git_track_branch "$branch" "$origin"
|
||||||
git push "$origin" "$branch" && git_track_branch "$branch" "$origin"
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue