Last active
April 10, 2017 02:01
-
-
Save gecko655/d9430a2ec0cf7a257c6cca55d48f3c65 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
DIFFCOMMAND=diff | |
MTEXTPIPECOMMAND="grep 'mText:' | perl -Xpne 's/\\\\u([0-9a-fA-F]{4})/chr(hex("'$1'"))/eg'" | |
if [ $# -lt 1 ] ; then | |
echo "usage: $0 [--mtext] [rev1] [rev2] filename" | |
exit 1 | |
fi | |
if [ $1 = '--mtext' ] ; then | |
if [ $# -eq 1 ] ; then | |
echo "usage: $0 [--mtext] [rev1] [rev2] filename" | |
exit 1 | |
fi | |
after_diff=$MTEXTPIPECOMMAND | |
shift | |
else | |
after_diff='cat' | |
fi | |
if [ $# -eq 1 ] ; then | |
$DIFFCOMMAND <(git show HEAD:"${@:1}" | git lfs smudge) "${@:1}" | eval $after_diff | |
elif [ $# -eq 2 ] ; then | |
$DIFFCOMMAND <(git show $1:"${@:2}" | git lfs smudge) "${@:2}" | eval $after_diff | |
else | |
$DIFFCOMMAND <(git show $1:"${@:3}" | git lfs smudge) <(git show $2:"${@:3}" | git lfs smudge) | eval $after_diff | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment