]> git.ipfire.org Git - thirdparty/git.git/blame - t/diff-lib.sh
path.c: don't call the match function without value in trie_find()
[thirdparty/git.git] / t / diff-lib.sh
CommitLineData
edb0c724
JH
1:
2
2ece6ad2 3sanitize_diff_raw='/^:/s/ '"\($OID_REGEX\)"' '"\($OID_REGEX\)"' \([A-Z]\)[0-9]* / \1 \2 \3# /'
edb0c724
JH
4compare_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
3af82863 12 test_cmp .tmp-1 .tmp-2 && rm -f .tmp-1 .tmp-2
edb0c724
JH
13}
14
2ece6ad2 15sanitize_diff_raw_z='/^:/s/ '"$OID_REGEX"' '"$OID_REGEX"' \([A-Z]\)[0-9]*$/ X X \1#/'
edb0c724
JH
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
e85fe4d8
JK
22 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
3af82863 24 test_cmp .tmp-1 .tmp-2 && rm -f .tmp-1 .tmp-2
edb0c724
JH
25}
26
27compare_diff_patch () {
28 # When heuristics are improved, the score numbers would change.
29 # Ignore them while comparing.
ec1fcc16
JH
30 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
3af82863 38 test_cmp .tmp-1 .tmp-2 && rm -f .tmp-1 .tmp-2
edb0c724 39}