]> git.ipfire.org Git - thirdparty/git.git/blame - t/lib-diff.sh
The third batch
[thirdparty/git.git] / t / lib-diff.sh
CommitLineData
15b808da
ÆAB
1. "$TEST_DIRECTORY"/lib-diff-data.sh
2
edb0c724
JH
3:
4
2ece6ad2 5sanitize_diff_raw='/^:/s/ '"\($OID_REGEX\)"' '"\($OID_REGEX\)"' \([A-Z]\)[0-9]* / \1 \2 \3# /'
edb0c724
JH
6compare_diff_raw () {
7 # When heuristics are improved, the score numbers would change.
8 # Ignore them while comparing.
9 # Also we do not check SHA1 hash generation in this test, which
10 # is a job for t0000-basic.sh
11
12 sed -e "$sanitize_diff_raw" <"$1" >.tmp-1
13 sed -e "$sanitize_diff_raw" <"$2" >.tmp-2
3af82863 14 test_cmp .tmp-1 .tmp-2 && rm -f .tmp-1 .tmp-2
edb0c724
JH
15}
16
2ece6ad2 17sanitize_diff_raw_z='/^:/s/ '"$OID_REGEX"' '"$OID_REGEX"' \([A-Z]\)[0-9]*$/ X X \1#/'
edb0c724
JH
18compare_diff_raw_z () {
19 # When heuristics are improved, the score numbers would change.
20 # Ignore them while comparing.
21 # Also we do not check SHA1 hash generation in this test, which
22 # is a job for t0000-basic.sh
23
e85fe4d8
JK
24 perl -pe 'y/\000/\012/' <"$1" | sed -e "$sanitize_diff_raw_z" >.tmp-1
25 perl -pe 'y/\000/\012/' <"$2" | sed -e "$sanitize_diff_raw_z" >.tmp-2
3af82863 26 test_cmp .tmp-1 .tmp-2 && rm -f .tmp-1 .tmp-2
edb0c724
JH
27}
28
29compare_diff_patch () {
30 # When heuristics are improved, the score numbers would change.
31 # Ignore them while comparing.
ec1fcc16
JH
32 sed -e '
33 /^[dis]*imilarity index [0-9]*%$/d
34 /^index [0-9a-f]*\.\.[0-9a-f]/d
35 ' <"$1" >.tmp-1
36 sed -e '
37 /^[dis]*imilarity index [0-9]*%$/d
38 /^index [0-9a-f]*\.\.[0-9a-f]/d
39 ' <"$2" >.tmp-2
3af82863 40 test_cmp .tmp-1 .tmp-2 && rm -f .tmp-1 .tmp-2
edb0c724 41}