summaryrefslogtreecommitdiff
path: root/git-diff-script
blob: 926f594be41ae856668f82436333f7b7e804a1b6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/bin/sh
rev=($(git-rev-parse --revs-only "$@")) || exit
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