[PATCH] Make "git resolve" less scary
[git/dscho.git] / git-diff-script
bloba285a2a4ee056fc4689c139eebe299072c91b46d
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-cache $flags $rev $files"
27 '')
28 cmd="git-diff-files $flags $files"
31 die "I don't understand $*"
33 esac
35 eval "$cmd"