From 8a2756125a0684f850d42f63fa175e0751776fc4 Mon Sep 17 00:00:00 2001 From: Jephte Clain Date: Thu, 4 Jun 2015 22:13:55 +0400 Subject: [PATCH] pu: afficher un message s'il y a des modifications locales --- lib/ulib/vcs | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/lib/ulib/vcs b/lib/ulib/vcs index 9e7ccd0..2eb9fe6 100644 --- a/lib/ulib/vcs +++ b/lib/ulib/vcs @@ -461,7 +461,24 @@ function git_update() { git fetch -p "$@" || return - git_check_cleancheckout || return 0 + if ! git_check_cleancheckout; then + branch="$(git_get_branch)" + remote="$(git_get_branch_remote "$branch")" + rbranch="$(git_get_branch_rbranch "$branch" "$remote")" + pbranch="${rbranch#refs/remotes/}" + if [ -z "$remote" -o -z "$rbranch" ]; then + echo "Note: there are uncommitted local changes" + return 0 + elif git_is_ancestor "$branch" "$rbranch"; then + echo "* Uncommitted changes, unwilling to fast-forward local branch $branch from $pbranch" + else + echo "* Cannot fast-forward local branch $branch from $pbranch" + echo " (and there are uncommitted local changes)" + fi + echo "Try to merge manually with: git merge $pbranch" + return 0 + fi + orig_branch="$(git_get_branch)" array_from_lines branches "$(git_list_branches)" for branch in "${branches[@]}"; do