Skip to content
Snippets Groups Projects
Commit 4338e33c973b authored by Brendan Cully's avatar Brendan Cully
Browse files

Safer version of FileMerge merge

parent d529cdc0a3ee
No related branches found
No related tags found
No related merge requests found
......@@ -44,14 +44,37 @@
cp "$LOCAL.orig" "$LOCAL"
fi
# on MacOS X try opendiff
# (uses FileMerge.app, shipped with Apple's developer tools)
if type opendiff > /dev/null 2>&1; then
opendiff "$LOCAL.orig" "$OTHER" -ancestor "$BASE" -merge "$LOCAL" || exit 1
# prevent $OTHER from being removed too early
# can surely be done in a more elegant way
sleep 1
exit 0
# on MacOS X try FileMerge.app, shipped with Apple's developer tools
# TODO: make proper temp files. foo.orig and foo.link are dangerous
FILEMERGE='/Developer/Applications/Utilities/FileMerge.app/Contents/MacOS/FileMerge'
if type "$FILEMERGE" > /dev/null 2>&1; then
cp "$LOCAL.orig" "$LOCAL"
ln "$LOCAL" "$LOCAL.link"
# filemerge prefers the right by default
if ! "$FILEMERGE" -left "$OTHER" -right "$LOCAL" -ancestor "$BASE" -merge "$LOCAL"
then
echo "FileMerge failed to launch"
exit 1
fi
if ! test "$LOCAL" -ef "$LOCAL.link"
then
rm "$LOCAL.orig" "$LOCAL.link"
exit 0
else
rm "$LOCAL.link"
echo "$LOCAL is unchanged. Was the merge successful?"
select answer in yes no
do
if test "$answer" == "yes"
then
rm "$LOCAL.orig"
exit 0
else
exit 1
fi
done
exit 1
fi
fi
if [ -n "$DISPLAY" ]; then
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment