Merge branch 'mh/rebase-skip-hard'
[gitweb.git] / git-mergetool.sh
index 4f89cbe8e6ce86175a56b400bdcc34576db34d28..5587c5ecea0f6a97f2715636890c9e2f89845d52 100755 (executable)
@@ -10,6 +10,7 @@
 
 USAGE='[--tool=tool] [file to merge] ...'
 SUBDIRECTORY_OK=Yes
+OPTIONS_SPEC=
 . git-sh-setup
 require_work_tree
 prefix=$(git rev-parse --show-prefix)
@@ -250,6 +251,16 @@ merge_file () {
            check_unchanged
            save_backup
            ;;
+       ecmerge)
+           touch "$BACKUP"
+           if base_present; then
+               "$merge_tool_path" "$BASE" "$LOCAL" "$REMOTE" --mode=merge3 --to="$path"
+           else
+               "$merge_tool_path" "$LOCAL" "$REMOTE" --mode=merge2 --to="$path"
+           fi
+           check_unchanged
+           save_backup
+           ;;
        emerge)
            if base_present ; then
                "$merge_tool_path" -f emerge-files-with-ancestor-command "$LOCAL" "$REMOTE" "$BASE" "$(basename "$path")"
@@ -299,7 +310,7 @@ done
 
 valid_tool() {
        case "$1" in
-               kdiff3 | tkdiff | xxdiff | meld | opendiff | emerge | vimdiff | gvimdiff)
+               kdiff3 | tkdiff | xxdiff | meld | opendiff | emerge | vimdiff | gvimdiff | ecmerge)
                        ;; # happy
                *)
                        return 1
@@ -324,7 +335,7 @@ init_merge_tool_path() {
 
 if test -z "$merge_tool"; then
     merge_tool=`git config merge.tool`
-    if ! valid_tool "$merge_tool"; then
+    if test -n "$merge_tool" && ! valid_tool "$merge_tool"; then
            echo >&2 "git config option merge.tool set to unknown tool: $merge_tool"
            echo >&2 "Resetting to default..."
            unset merge_tool