blob: c211dc40eed98fc58c953d2e3b1f7ba752f98a02 [file] [log] [blame]
Junio C Hamanoedb0c722005-05-31 14:47:25 -07001:
2
Junio C Hamanobd9150b2015-02-15 13:47:36 -08003sanitize_diff_raw='/^:/s/ '"\($_x40\)"' '"\($_x40\)"' \([A-Z]\)[0-9]* / \1 \2 \3# /'
Junio C Hamanoedb0c722005-05-31 14:47:25 -07004compare_diff_raw () {
5 # When heuristics are improved, the score numbers would change.
6 # Ignore them while comparing.
7 # Also we do not check SHA1 hash generation in this test, which
8 # is a job for t0000-basic.sh
9
10 sed -e "$sanitize_diff_raw" <"$1" >.tmp-1
11 sed -e "$sanitize_diff_raw" <"$2" >.tmp-2
Junio C Hamano3af82862008-05-23 22:28:56 -070012 test_cmp .tmp-1 .tmp-2 && rm -f .tmp-1 .tmp-2
Junio C Hamanoedb0c722005-05-31 14:47:25 -070013}
14
15sanitize_diff_raw_z='/^:/s/ '"$_x40"' '"$_x40"' \([A-Z]\)[0-9]*$/ X X \1#/'
16compare_diff_raw_z () {
17 # When heuristics are improved, the score numbers would change.
18 # Ignore them while comparing.
19 # Also we do not check SHA1 hash generation in this test, which
20 # is a job for t0000-basic.sh
21
Jeff Kinge85fe4d2008-03-12 17:31:06 -040022 perl -pe 'y/\000/\012/' <"$1" | sed -e "$sanitize_diff_raw_z" >.tmp-1
23 perl -pe 'y/\000/\012/' <"$2" | sed -e "$sanitize_diff_raw_z" >.tmp-2
Junio C Hamano3af82862008-05-23 22:28:56 -070024 test_cmp .tmp-1 .tmp-2 && rm -f .tmp-1 .tmp-2
Junio C Hamanoedb0c722005-05-31 14:47:25 -070025}
26
27compare_diff_patch () {
28 # When heuristics are improved, the score numbers would change.
29 # Ignore them while comparing.
Junio C Hamanoec1fcc12005-10-07 03:42:00 -070030 sed -e '
31 /^[dis]*imilarity index [0-9]*%$/d
32 /^index [0-9a-f]*\.\.[0-9a-f]/d
33 ' <"$1" >.tmp-1
34 sed -e '
35 /^[dis]*imilarity index [0-9]*%$/d
36 /^index [0-9a-f]*\.\.[0-9a-f]/d
37 ' <"$2" >.tmp-2
Junio C Hamano3af82862008-05-23 22:28:56 -070038 test_cmp .tmp-1 .tmp-2 && rm -f .tmp-1 .tmp-2
Junio C Hamanoedb0c722005-05-31 14:47:25 -070039}