ulib/vcs: corriger le code de git_track_branch. Utiliser ce code dans pdev --sync
This commit is contained in:
parent
fc75fcd960
commit
01b9a6804f
25
lib/ulib/vcs
25
lib/ulib/vcs
|
@ -673,16 +673,21 @@ 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
|
if git_have_rbranch "$branch" "$origin"; then
|
||||||
git push "$origin" "$branch" || return
|
if git_have_branch "$branch"; then
|
||||||
fi
|
local version="$(LANG=C git version)"
|
||||||
local version="$(LANG=C git version)"
|
version="${version#git version }"
|
||||||
version="${version#git version }"
|
eval "version=(${version//./ })"
|
||||||
eval "version=(${version//./ })"
|
if [ ${version[0]} -le 1 -a ${version[1]} -le 7 ]; then
|
||||||
if [ ${version[0]} -le 1 -a ${version[1]} -le 7 ]; then
|
git branch -t --set-upstream "$branch" "$origin/$branch"
|
||||||
git branch -t --set-upstream "$branch" "$origin/$branch"
|
else
|
||||||
else
|
git branch -u "$origin/$branch" "$branch"
|
||||||
git branch -u "$origin/$branch" "$branch"
|
fi
|
||||||
|
else
|
||||||
|
git branch -t "$branch" "$origin/$branch"
|
||||||
|
fi
|
||||||
|
elif git_have_branch "$branch"; then
|
||||||
|
git push -u "$origin" "$branch" || return
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
function git_ensure_branch() {
|
function git_ensure_branch() {
|
||||||
|
|
14
pdev
14
pdev
|
@ -135,14 +135,13 @@ git_ensure_gitvcs
|
||||||
|
|
||||||
if [ "$action" == sync ]; then
|
if [ "$action" == sync ]; then
|
||||||
[ -z "$UTOOLS_VCS_OFFLINE" ] || die "L'option --sync nécessite le mode --online"
|
[ -z "$UTOOLS_VCS_OFFLINE" ] || die "L'option --sync nécessite le mode --online"
|
||||||
|
version="$(LANG=C git version)"
|
||||||
|
version="${version#git version }"
|
||||||
|
eval "version=(${version//./ })"
|
||||||
|
|
||||||
setx -a branches=list_feature_branches "$origin"
|
setx -a branches=list_feature_branches "$origin"
|
||||||
for branch in "${branches[@]}"; do
|
for branch in "${branches[@]}"; do
|
||||||
if git_have_branch "$branch"; then
|
git_track_branch "$branch" "$origin"
|
||||||
git_track_branch "$branch" "$origin"
|
|
||||||
else
|
|
||||||
git branch -t "$branch" "$origin/$branch"
|
|
||||||
fi
|
|
||||||
done
|
done
|
||||||
|
|
||||||
exit $?
|
exit $?
|
||||||
|
@ -177,9 +176,7 @@ if [ "$action" == branch ]; then
|
||||||
|
|
||||||
# On est peut-être déjà sur la bonne branche
|
# On est peut-être déjà sur la bonne branche
|
||||||
if git_is_branch "$feature"; then
|
if git_is_branch "$feature"; then
|
||||||
if [ -z "$UTOOLS_VCS_OFFLINE" ]; then
|
[ -z "$UTOOLS_VCS_OFFLINE" ] && git_track_branch "$feature" "$origin"
|
||||||
git_track_branch "$feature" "$origin"
|
|
||||||
fi
|
|
||||||
git_fast_forward "$feature" "" "$origin"
|
git_fast_forward "$feature" "" "$origin"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
@ -202,6 +199,7 @@ Vous allez créer la nouvelle feature branch ${COULEUR_VERTE}$feature${COULEUR_N
|
||||||
[ $? -eq 2 ] && die "Impossible de créer la branche $feature. Veuillez vérifier que la branche $source existe"
|
[ $? -eq 2 ] && die "Impossible de créer la branche $feature. Veuillez vérifier que la branche $source existe"
|
||||||
git checkout "$feature" || r=$?
|
git checkout "$feature" || r=$?
|
||||||
fi
|
fi
|
||||||
|
[ -z "$UTOOLS_VCS_OFFLINE" ] && git_track_branch "$feature" "$origin"
|
||||||
if [ "$r" -eq 0 ]; then
|
if [ "$r" -eq 0 ]; then
|
||||||
# éventuellement fast-forwarder automatiquement
|
# éventuellement fast-forwarder automatiquement
|
||||||
git_fast_forward "$feature" "" "$origin"
|
git_fast_forward "$feature" "" "$origin"
|
||||||
|
|
Loading…
Reference in New Issue