Created
June 26, 2015 10:22
-
-
Save michael-k/79d4282a6c8a9d1fb3a2 to your computer and use it in GitHub Desktop.
Git LFS Diff
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/sh | |
if [ $# -ne 3 ] ; then | |
echo "Usage: $0 <ref> <ref> <filename>" | |
exit 1 | |
fi | |
RevA=$1 | |
RevB=$2 | |
File=$3 | |
object() { | |
Rev=$1 | |
File=$2 | |
Object="" | |
Oid=$(git show $Rev:$File 2> /dev/null | grep "sha256" | cut -d ":" -f 2) | |
if [ "$Oid" != "" ]; then | |
Oid12=$(echo $Oid | cut -b 1-2) | |
Oid34=$(echo $Oid | cut -b 3-4) | |
Object=.git/lfs/objects/$Oid12/$Oid34/$Oid | |
if [ ! -e "$Object" ] ; then | |
echo "Missing file $File at revision $Rev" | |
exit 2 | |
fi | |
fi | |
echo "$Object" | |
} | |
ObjectA=$(object $RevA $File) | |
EC="$?" | |
if [ "$EC" != "0" ]; then | |
echo "$ObjectA" | |
exit "$EC" | |
fi | |
ObjectB=$(object $RevB $File) | |
EC="$?" | |
if [ "$EC" != "0" ]; then | |
echo "$ObjectB" | |
exit "$EC" | |
fi | |
diff -urN "$ObjectA" "$ObjectB" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment