t1002-read-tree-m-u-2way.sh: use 'git diff -U0' rather than 'diff -U0'
Some old platforms have an old diff which doesn't have the -U option. 'git diff' can be used in its place. Adjust the comparison function to strip git's additional header lines to make this possible. Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Brandon Casey committed
Aug 18, 2008 at 18:17 UTC
26e08a0190cb3354e43bab13ea693a5c826a8fe1
1 file changed
+6
-4
t/t1002-read-tree-m-u-2way.sh
+6
-4
@@ -14,6 +14,8 @@ _x40='[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]'
14
_x40="$_x40$_x40$_x40$_x40$_x40$_x40$_x40$_x40"
15
compare_change () {
16
sed >current \
17
+ -e '1{/^diff --git /d;}' \
18
+ -e '2{/^index /d;}' \
19
-e '/^--- /d; /^+++ /d; /^@@ /d;' \
20
-e 's/^\(.[0-7][0-7][0-7][0-7][0-7][0-7]\) '"$_x40"' /\1 X /' "$1"
21
test_cmp expected current
@@ -75,7 +77,7 @@ test_expect_success \
77
git update-index --add yomin &&
78
git read-tree -m -u $treeH $treeM &&
79
git ls-files --stage >4.out || return 1
78
- diff -U0 M.out 4.out >4diff.out
80
+ git diff -U0 --no-index M.out 4.out >4diff.out
81
compare_change 4diff.out expected &&
82
check_cache_at yomin clean &&
83
sum bozbar frotz nitfol >actual4.sum &&
@@ -94,7 +96,7 @@ test_expect_success \
96
echo yomin yomin >yomin &&
97
git read-tree -m -u $treeH $treeM &&
98
git ls-files --stage >5.out || return 1
97
- diff -U0 M.out 5.out >5diff.out
99
+ git diff -U0 --no-index M.out 5.out >5diff.out
100
compare_change 5diff.out expected &&
101
check_cache_at yomin dirty &&
102
sum bozbar frotz nitfol >actual5.sum &&
@@ -206,7 +208,7 @@ test_expect_success \
208
git update-index --add nitfol &&
209
git read-tree -m -u $treeH $treeM &&
210
git ls-files --stage >14.out || return 1
209
- diff -U0 M.out 14.out >14diff.out
211
+ git diff -U0 --no-index M.out 14.out >14diff.out
212
compare_change 14diff.out expected &&
213
sum bozbar frotz >actual14.sum &&
214
grep -v nitfol M.sum > expected14.sum &&
@@ -227,7 +229,7 @@ test_expect_success \
229
echo nitfol nitfol nitfol >nitfol &&
230
git read-tree -m -u $treeH $treeM &&
231
git ls-files --stage >15.out || return 1
230
- diff -U0 M.out 15.out >15diff.out
232
+ git diff -U0 --no-index M.out 15.out >15diff.out
233
compare_change 15diff.out expected &&
234
check_cache_at nitfol dirty &&
235
sum bozbar frotz >actual15.sum &&