6 ### This script is an adaptor for git mergetool so that, while /it/ thinks
7 ### it's using emerge, it's really using ediff, which is much better, and
8 ### maybe a long-running Emacs via gnuserv.
10 ## Find out what we're supposed to be doing. The command line looks like
12 ## emerge-hack -f emerge-mumble FILE FILE ... OUTPUT
19 *) echo >&2 "$0: expected -f emerge-mumble"; exit 1;;
23 emerge-files-with-ancestor-command)
24 func=ediff-merge-files-with-ancestor
26 emerge-merge-files-command)
30 echo >&2 "$0: unexpected command $command"
35 ## Find out whether there's a plausible-looking gnuserv.
37 if gnuclient -batch -eval t >/dev/null 2>&1; then
43 ## Now build the command line.
45 ## The hairy-looking seddery is there to quotify file names properly for
46 ## Lisp. We also need to make sure that the filenames are absolute.
47 ## Finally, there's a little tweak to separate off the last name because of
48 ## the strange argument order ediff uses.
60 quot=$(echo -n "$name" |
80 ## Done. Note that we pass the output filename again, as an explicit
81 ## argument. This will make gnuclient wait until we've finished with the
84 exec "$emacs" -eval "($expr${sep}nil $last)" "$output"