diff --git a/lib/ulib/vcs b/lib/ulib/vcs index b2ddb4f..2708b3e 100644 --- a/lib/ulib/vcs +++ b/lib/ulib/vcs @@ -564,6 +564,9 @@ function git_track_branch() { [ -n "$branch" ] || return git_have_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" } function git_ensure_branch() { @@ -578,9 +581,7 @@ function git_ensure_branch() { # créer une nouvelle branche du nom spécifié git_have_branch "$source" || return 2 git branch "$branch" "$source" || return 2 - if git_have_remote "$origin"; then - git push "$origin" "$branch" && git_track_branch "$branch" "$origin" - fi + git_have_remote "$origin" && git_track_branch "$branch" "$origin" fi return 0 }