Skip to content

Instantly share code, notes, and snippets.

@evilstreak
Created January 13, 2010 15:15
Show Gist options
  • Save evilstreak/276266 to your computer and use it in GitHub Desktop.
Save evilstreak/276266 to your computer and use it in GitHub Desktop.
#!/bin/sh
# Invoke like this:
# svn di --diff-cmd=./diffwarp.sh && cat .gitdiff | gitx && rm .gitdiff
#
# For easier use, stick diffwarp.sh in your path and alias the command
# alias svnx='svn di --diff-cmd=diffwarp.sh > /dev/null && cat .gitdiff | gitx && rm .gitdiff'
# Subversion provides the paths we need as the sixth and seventh
# parameters.
LEFT=${6}
RIGHT=${7}
# Call the diff command (change the following line to make sense for
# your merge program).
diff "$@"
status=$?
if [ $status ]; then
echo "diff --git a/${RIGHT} b/${RIGHT} " >> .gitdiff
echo "index" >> .gitdiff
diff -p -u -L "a/${RIGHT}" -L "b/${RIGHT}" "${LEFT}" "${RIGHT}" >> .gitdiff
fi
# Return an errorcode of 0 if no differences were detected, 1 if some were.
# Any other errorcode will be treated as fatal.
exit $status
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment