t4038: add tests for "diff --cc --raw <trees>"

Signed-off-by: John Keeping <john@keeping.me.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>

John Keeping committed Feb 5, 2013 at 21:39 UTC edbc00e76d29213010db947d8d7bff3baab12a35
1 file changed +24
t/t4038-diff-combined.sh
+24
@@ -89,4 +89,28 @@ test_expect_success 'diagnose truncated file' '
89 grep "diff --cc file" out
90 '
91
92 +test_expect_success 'setup for --cc --raw' '
93 + blob=$(echo file | git hash-object --stdin -w) &&
94 + base_tree=$(echo "100644 blob $blob file" | git mktree) &&
95 + trees= &&
96 + for i in `test_seq 1 40`
97 + do
98 + blob=$(echo file$i | git hash-object --stdin -w) &&
99 + trees="$trees$(echo "100644 blob $blob file" | git mktree)$LF"
100 + done
101 +'
102 +
103 +test_expect_success 'check --cc --raw with four trees' '
104 + four_trees=$(echo "$trees" | sed -e 4q) &&
105 + git diff --cc --raw $four_trees $base_tree >out &&
106 + # Check for four leading colons in the output:
107 + grep "^::::[^:]" out
108 +'
109 +
110 +test_expect_success 'check --cc --raw with forty trees' '
111 + git diff --cc --raw $trees $base_tree >out &&
112 + # Check for forty leading colons in the output:
113 + grep "^::::::::::::::::::::::::::::::::::::::::[^:]" out
114 +'
115 +
116 test_done