3 # This script is used to produce git context diffs
7 # path old-file old-hash old-mode new-file new-hash new-mode
8 # 'path' is the git-tree-relative path of the file being diff'ed
11 new_hash
=$
(git hash-object
"$5")
14 [ "$old_hash" = "$new_hash" ] && exit 0
16 [ "$DIFF_OPTS" = "" ] && DIFF_OPTS
='-pcd'
18 echo "diff --git a/$1 b/$1"
19 echo "new file mode $7"
20 echo "index ${old_hash:0:7}..${new_hash:0:7}"
22 diff --label a
/"$1" --label b
/"$1" $DIFF_OPTS "$2" "$5"