Provide more meaningful output from 'git init-db'.
[gitweb.git] / git-merge.sh
index 75af10d3e431edf6f7447ab4a3dfcf84e994a2ef..c895a04f6be0e09670af71532558abe994369a64 100755 (executable)
@@ -188,14 +188,15 @@ else
        # in this loop.
        merge_name=$(for remote
                do
-                       rh=$(git-rev-parse --verify "$remote"^0 2>/dev/null) &&
-                       if git show-ref -q --verify "refs/heads/$remote"
+                       rh=$(git-rev-parse --verify "$remote"^0 2>/dev/null) ||
+                       continue ;# not something we can merge
+                       bh=$(git show-ref -s --verify "refs/heads/$remote" 2>/dev/null)
+                       if test "$rh" = "$bh"
                        then
-                               what=branch
+                               echo "$rh               branch '$remote' of ."
                        else
-                               what=commit
-                       fi &&
-                       echo "$rh               $what '$remote'"
+                               echo "$rh               commit '$remote'"
+                       fi
                done | git-fmt-merge-msg
        )
        merge_msg="${merge_msg:+$merge_msg$LF$LF}$merge_name"
@@ -264,7 +265,7 @@ f,*)
        echo "Updating $(git-rev-parse --short $head)..$(git-rev-parse --short $1)"
        git-update-index --refresh 2>/dev/null
        new_head=$(git-rev-parse --verify "$1^0") &&
-       git-read-tree -u -v -m $head "$new_head" &&
+       git-read-tree -v -m -u --exclude-per-directory=.gitignore $head "$new_head" &&
        finish "$new_head" "Fast forward"
        dropsave
        exit 0
@@ -399,7 +400,14 @@ fi
 case "$best_strategy" in
 '')
        restorestate
-       echo >&2 "No merge strategy handled the merge."
+       case "$use_strategies" in
+       ?*' '?*)
+               echo >&2 "No merge strategy handled the merge."
+               ;;
+       *)
+               echo >&2 "Merge with strategy $use_strategies failed."
+               ;;
+       esac
        exit 2
        ;;
 "$wt_strategy")