[PATCH] Rewrite read-tree
[alt-git.git] / git-diff.sh
blob9732c8ac3110e9beb65221c7528812a4655eab13
1 #!/bin/sh
3 # Copyright (c) 2005 Linus Torvalds
4 # Copyright (c) 2005 Junio C Hamano
6 rev=$(git-rev-parse --revs-only --no-flags --sq "$@") || exit
7 flags=$(git-rev-parse --no-revs --flags --sq "$@")
8 files=$(git-rev-parse --no-revs --no-flags --sq "$@")
10 : ${flags:="'-M' '-p'"}
12 case "$rev" in
13 ?*' '?*' '?*)
14 die "I don't understand"
16 ?*' '^?*)
17 begin=$(expr "$rev" : '.*^.\([0-9a-f]*\).*') &&
18 end=$(expr "$rev" : '.\([0-9a-f]*\). .*') || exit
19 cmd="git-diff-tree $flags $begin $end $files"
21 ?*' '?*)
22 cmd="git-diff-tree $flags $rev $files"
24 ?*' ')
25 cmd="git-diff-index $flags $rev $files"
27 '')
28 cmd="git-diff-files $flags $files"
31 die "I don't understand $*"
33 esac
35 eval "$cmd"