Skip to content

Commit 792fe55

Browse files
author
Junio C Hamano
committed
Fix "git-diff-script A B"
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>
1 parent 56fc510 commit 792fe55

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

git-diff-script

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,14 @@ case "${#rev[*]}" in
88
1)
99
git-diff-cache -M -p "$@";;
1010
2)
11-
begin=$(echo "${rev[1]}" | tr -d '^')
12-
end="${rev[0]}"
11+
case "${rev[1]}" in
12+
^?*)
13+
begin=$(echo "${rev[1]}" | tr -d '^')
14+
end="${rev[0]}" ;;
15+
*)
16+
begin="${rev[0]}"
17+
end="${rev[1]}" ;;
18+
esac
1319
git-diff-tree -M -p $flags $begin $end $files;;
1420
*)
1521
echo "I don't understand"

0 commit comments

Comments
 (0)