Skip to content

Commit 9d4625a

Browse files
committed
Add proper git-external-diff script to src/tools.
1 parent 7564654 commit 9d4625a

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

src/tools/git-external-diff

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/bin/bash
2+
3+
# Parameters:
4+
# $1 $2 $3 $4 $5 $6 $7
5+
# path old-file old-hash old-mode new-file new-hash new-mode
6+
# 'path' is the git-tree-relative path of the file being diff'ed
7+
8+
old_hash="$3"
9+
new_hash=$(git hash-object "$5")
10+
11+
# no change?
12+
[ "$old_hash" = "$new_hash" ] && exit 0
13+
14+
[ "$DIFF_OPTS" = "" ] && DIFF_OPTS='-pcd'
15+
16+
echo "diff --git a/$1 b/$1"
17+
echo "new file mode $7"
18+
echo "index ${old_hash:0:7}..${new_hash:0:7}"
19+
20+
diff --label a/"$1" --label b/"$1" $DIFF_OPTS "$2" "$5"
21+
22+
exit 0

0 commit comments

Comments
 (0)