summaryrefslogtreecommitdiff
path: root/git-diff-script
blob: 03ed555e777b6dfeac8811338986eb752418ab72 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/bin/sh
. git-sh-setup-script || die "Not a git archive"
 
rev=($(git-rev-parse --revs-only "$@"))
flags=($(git-rev-parse --no-revs --flags "$@"))
files=($(git-rev-parse --no-revs --no-flags "$@"))
case "${#rev[*]}" in
0)
	git-diff-files -M -p "$@";;
1)
	git-diff-cache -M -p "$@";;
2)
	begin=$(echo "${rev[1]}" | tr -d '^')
	end="${rev[0]}"
	git-diff-tree -M -p $flags $begin $end $files;;
*)
	echo "I don't understand"
	exit 1;;
esac