If the merge operation fails during git-pull it usually exits with a non-zero exit status to let the caller know it failed. But git-pull tossed that status away and always returned 0 (success), leading to confusing output in any higher level interface which supplied both the console output (showing the merge failure) and the exit status (showing success). So now git-pull just exec's git-merge, allowing its exit status to be reported directly to the caller. There were also a number of cases within git-merge which terminated with a success (0) exit status despite having been caused by failure to merge. This is equally misleading and should return 1 instead. Signed-off-by: Shawn O. Pearce <spearce@xxxxxxxxxxx> --- git-merge.sh | 10 +++++----- git-pull.sh | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/git-merge.sh b/git-merge.sh index cb09438..7725908 100755 --- a/git-merge.sh +++ b/git-merge.sh @@ -203,7 +203,7 @@ f,*) git-update-index --refresh 2>/dev/null new_head=$(git-rev-parse --verify "$1^0") && git-read-tree -u -v -m $head "$new_head" && - finish "$new_head" "Fast forward" + finish "$new_head" "Fast forward" || exit 1 dropsave exit 0 ;; @@ -214,7 +214,7 @@ f,*) ?,1,*,) # We are not doing octopus, not fast forward, and have only # one common. See if it is really trivial. - git var GIT_COMMITTER_IDENT >/dev/null || exit + git var GIT_COMMITTER_IDENT >/dev/null || exit 1 echo "Trying really trivial in-index merge..." git-update-index --refresh 2>/dev/null @@ -225,7 +225,7 @@ f,*) result_commit=$( echo "$merge_msg" | git-commit-tree $result_tree -p HEAD -p "$1" - ) || exit + ) || exit 1 finish "$result_commit" "In-index merge" dropsave exit 0 @@ -253,7 +253,7 @@ f,*) esac # We are going to make a new commit. -git var GIT_COMMITTER_IDENT >/dev/null || exit +git var GIT_COMMITTER_IDENT >/dev/null || exit 1 # At this point, we need a real merge. No matter what strategy # we use, it would operate on the index, possibly affecting the @@ -327,7 +327,7 @@ done if test '' != "$result_tree" then parents=$(git-show-branch --independent "$head" "$@" | sed -e 's/^/-p /') - result_commit=$(echo "$merge_msg" | git-commit-tree $result_tree $parents) || exit + result_commit=$(echo "$merge_msg" | git-commit-tree $result_tree $parents) || exit 1 finish "$result_commit" "Merge made by $wt_strategy." dropsave exit 0 diff --git a/git-pull.sh b/git-pull.sh index ed04e7d..d10fcdd 100755 --- a/git-pull.sh +++ b/git-pull.sh @@ -102,6 +102,6 @@ case "$strategy_args" in esac merge_name=$(git-fmt-merge-msg <"$GIT_DIR/FETCH_HEAD") || exit -git-merge "--reflog-action=pull $*" \ +exec git-merge "--reflog-action=pull $*" \ $no_summary $no_commit $squash $strategy_args \ "$merge_name" HEAD $merge_head -- 1.4.3.4.g2920-dirty - To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html