mirror of
https://github.com/git/git.git
synced 2024-10-31 22:37:54 +01:00
792fe559d0
When "git-diff-script A..B" notation was introduced, it ended up breaking the traditional two revisions notation. [jc: there are other issues with the current "git diff" I would like to address, but they would be left to later rounds. For example, -M and -p flags should not be hardcoded default, and it shouldn't be too hard to rewrite the script without using shell arrays.] Signed-off-by: Junio C Hamano <junkio@cox.net>
23 lines
478 B
Bash
Executable file
23 lines
478 B
Bash
Executable file
#!/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)
|
|
case "${rev[1]}" in
|
|
^?*)
|
|
begin=$(echo "${rev[1]}" | tr -d '^')
|
|
end="${rev[0]}" ;;
|
|
*)
|
|
begin="${rev[0]}"
|
|
end="${rev[1]}" ;;
|
|
esac
|
|
git-diff-tree -M -p $flags $begin $end $files;;
|
|
*)
|
|
echo "I don't understand"
|
|
exit 1;;
|
|
esac
|