{"thread":{"id":"8755","subject":"[PATCH] Add emacs 'ediff' mode to git-mergetool's tools","startedAt":"2007-06-28T06:25:11Z","lastAt":"2007-06-28T06:25:11Z","messageCount":1,"participants":["Jason Sewall"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"45957","messageId":"11830119113828-git-send-email-jasonsewall@gmail.com","threadId":"8755","inReplyTo":null,"subject":"[PATCH] Add emacs 'ediff' mode to git-mergetool's tools","fromName":"Jason Sewall","fromEmail":"jasonsewall@gmail.com","sentAt":"2007-06-28T06:25:11Z","receivedAt":"2007-06-28T06:25:11Z","isPatch":true,"sender":{"key":"jasonsewall@gmail.com","avatar":null},"body":"It is now possible to specifiy 'ediff' as a value to the '--tool=' option to git-mergetool; this invokes an ediff session in emacs with the appropriate files.\n\nSigned-off-by: Jason Sewall <jasonsewall@gmail.com>\n---\n\nEdiff is is an emacs mode similar to emerge for performing merges; it is fuller-featured than emerge and I find it easier to use.\n\n git-mergetool.sh |   17 +++++++++++++----\n 1 files changed, 13 insertions(+), 4 deletions(-)\n\ndiff --git a/git-mergetool.sh b/git-mergetool.sh\nindex 7b66309..c27d212 100755\n--- a/git-mergetool.sh\n+++ b/git-mergetool.sh\n@@ -258,6 +258,15 @@ merge_file () {\n \t    status=$?\n \t    save_backup\n \t    ;;\n+\tediff)\n+\t    if base_present ; then\n+\t\temacs --eval \"(ediff-merge-files-with-ancestor \\\"$LOCAL\\\" \\\"$REMOTE\\\" \\\"$BASE\\\" \\\"$path\\\")\"\n+\t    else\n+\t\temacs --eval \"(ediff-merge-files \\\"$LOCAL\\\" \\\"$REMOTE\\\" \\\"$path\\\")\"\n+\t    fi\n+\t    status=$?\n+\t    save_backup\n+\t    ;;\n     esac\n     if test \"$status\" -ne 0; then\n \techo \"merge of $path failed\" 1>&2\n@@ -299,7 +308,7 @@ done\n if test -z \"$merge_tool\"; then\n     merge_tool=`git-config merge.tool`\n     case \"$merge_tool\" in\n-\tkdiff3 | tkdiff | xxdiff | meld | opendiff | emerge | vimdiff | gvimdiff | \"\")\n+\tkdiff3 | tkdiff | xxdiff | meld | opendiff | emerge | ediff | vimdiff | gvimdiff | \"\")\n \t    ;; # happy\n \t*)\n \t    echo >&2 \"git config option merge.tool set to unknown tool: $merge_tool\"\n@@ -320,7 +329,7 @@ if test -z \"$merge_tool\" ; then\n         fi\n     fi\n     if echo \"${VISUAL:-$EDITOR}\" | grep 'emacs' > /dev/null 2>&1; then\n-        merge_tool_candidates=\"$merge_tool_candidates emerge\"\n+        merge_tool_candidates=\"$merge_tool_candidates emerge ediff\"\n     fi\n     if echo \"${VISUAL:-$EDITOR}\" | grep 'vim' > /dev/null 2>&1; then\n         merge_tool_candidates=\"$merge_tool_candidates vimdiff\"\n@@ -328,7 +337,7 @@ if test -z \"$merge_tool\" ; then\n     merge_tool_candidates=\"$merge_tool_candidates opendiff emerge vimdiff\"\n     echo \"merge tool candidates: $merge_tool_candidates\"\n     for i in $merge_tool_candidates; do\n-        if test $i = emerge ; then\n+        if test $i = emerge -o $i = ediff ; then\n             cmd=emacs\n         else\n             cmd=$i\n@@ -351,7 +360,7 @@ case \"$merge_tool\" in\n \t    exit 1\n \tfi\n \t;;\n-    emerge)\n+    emerge|ediff)\n \tif ! type \"emacs\" > /dev/null 2>&1; then\n \t    echo \"Emacs is not available\"\n \t    exit 1\n--\n1.5.2.2.589.g4b646\n"}]}