diff options
author | Bruce Momjian | 2011-03-10 23:06:13 +0000 |
---|---|---|
committer | Bruce Momjian | 2011-03-10 23:06:13 +0000 |
commit | 9d4625ad0b836538618e324b4ebbc3ba366447a1 (patch) | |
tree | c6c1316b8e8d31f3d988009fd88965813c076712 | |
parent | 7564654adf07ec26b83c7effc7f54f7183e04519 (diff) |
Add proper git-external-diff script to src/tools.
-rw-r--r-- | src/tools/git-external-diff | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/tools/git-external-diff b/src/tools/git-external-diff new file mode 100644 index 0000000000..fdc7080f3a --- /dev/null +++ b/src/tools/git-external-diff @@ -0,0 +1,22 @@ +#!/bin/bash + +# Parameters: +# $1 $2 $3 $4 $5 $6 $7 +# path old-file old-hash old-mode new-file new-hash new-mode +# 'path' is the git-tree-relative path of the file being diff'ed + +old_hash="$3" +new_hash=$(git hash-object "$5") + +# no change? +[ "$old_hash" = "$new_hash" ] && exit 0 + +[ "$DIFF_OPTS" = "" ] && DIFF_OPTS='-pcd' + +echo "diff --git a/$1 b/$1" +echo "new file mode $7" +echo "index ${old_hash:0:7}..${new_hash:0:7}" + +diff --label a/"$1" --label b/"$1" $DIFF_OPTS "$2" "$5" + +exit 0 |