Intégration de la branche pu

This commit is contained in:
Jephte CLAIN 2015-05-21 15:09:27 +04:00
commit 2b5eb2aefc
1 changed files with 31 additions and 15 deletions

View File

@ -451,26 +451,42 @@ function git_update() {
return 1 return 1
} }
git pull "$@" || return if [ -z "$autoff" ]; then
if [ -n "$autoff" ]; then git pull "$@"
local orig_branch restore_branch rbranch return $?
local -a branches fi
git_check_cleancheckout || return 0
orig_branch="$(git_get_branch)" local orig_branch restore_branch remote rbranch pbranch
array_from_lines branches "$(git_list_branches)" local -a branches
for branch in "${branches[@]}"; do
remote="$(git_get_branch_remote "$branch")" git fetch -p "$@" || return
rbranch="$(git_get_branch_rbranch "$branch" "$remote")"
[ -n "$remote" -a -n "$rbranch" ] || continue git_check_cleancheckout || return 0
orig_branch="$(git_get_branch)"
array_from_lines branches "$(git_list_branches)"
for branch in "${branches[@]}"; do
remote="$(git_get_branch_remote "$branch")"
rbranch="$(git_get_branch_rbranch "$branch" "$remote")"
pbranch="${rbranch#refs/remotes/}"
[ -n "$remote" -a -n "$rbranch" ] || continue
if git_is_ancestor "$branch" "$rbranch"; then
if git_should_ff "$branch" "$rbranch"; then if git_should_ff "$branch" "$rbranch"; then
echo "Fast-forwarding $branch..." echo "* Fast-forwarding $branch -> $pbranch"
git checkout -q "$branch" git checkout -q "$branch"
git merge -q --ff-only "$rbranch" git merge -q --ff-only "$rbranch"
restore_branch=1 restore_branch=1
fi fi
done else
[ -n "$restore_branch" ] && git checkout -q "$orig_branch" if [ "$branch" == "$orig_branch" ]; then
fi echo "* Cannot fast-forward CURRENT branch $branch from $pbranch
Try to merge manually with: git merge $pbranch"
else
echo "* Cannot fast-forward local branch $branch from $pbranch
You can merge manually with: git checkout $branch; git merge $pbranch"
fi
fi
done
[ -n "$restore_branch" ] && git checkout -q "$orig_branch"
return 0 return 0
} }
function git_push() { function git_push() {