@matheusbsbs / matheus-bagliano / commits / f22fd75c6a
Fork 0

git-diff: do not fall back on --cc when -[123], --ours etc. are given.

These flags ask diff with a specific unmerged stage, so it should fall back on -p instead. Also when -c is given, we should not do --cc. Signed-off-by: Junio C Hamano <junkio@cox.net>

Junio C Hamano committed Feb 6, 2006 at 11:17 UTC f22fd75c6a39a72d6bf20786ba889fb73038bec9
1 file changed +13 -4
git-diff.sh
+13 -4
@@ -22,14 +22,23 @@ case "$rev" in
22 esac
23 esac
24
25 -# If we do not have --name-status, --name-only nor -r, default to --cc.
26 -# If we do not have -B nor -C, default to -M.
25 +# If we have -[123] --ours --theirs --base, don't do --cc by default.
26 case " $flags " in
28 -*" '--name-status' "* | *" '--name-only' "* | *" '-r' "* )
27 +*" '-"[123]"' "* | *" '--ours' "* | *" '--base' "* | *" '--theirs' "*)
28 + cc_or_p=-p ;;
29 +*)
30 + cc_or_p=--cc ;;
31 +esac
32 +
33 +# If we do not have --name-status, --name-only, -r, or -c default to --cc.
34 +case " $flags " in
35 +*" '--name-status' "* | *" '--name-only' "* | *" '-r' "* | *" '-c' "* )
36 ;;
37 *)
31 - flags="$flags'--cc' " ;;
38 + flags="$flags'$cc_or_p' " ;;
39 esac
40 +
41 +# If we do not have -B nor -C, default to -M.
42 case " $flags " in
43 *" '-"[BCM]* | *" '--find-copies-harder' "*)
44 ;; # something like -M50.