[PATCH] Add Makefile target glossary.html
[git/dkf.git] / t / diff-lib.sh
bloba912f435aa67d7b2cde09f0b8c9855442c6c2377
3 _x40='[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]'
4 _x40="$_x40$_x40$_x40$_x40$_x40$_x40$_x40$_x40"
5 sanitize_diff_raw='/^:/s/ '"$_x40"' '"$_x40"' \([A-Z]\)[0-9]* / X X \1# /'
6 compare_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
12 sed -e "$sanitize_diff_raw" <"$1" >.tmp-1
13 sed -e "$sanitize_diff_raw" <"$2" >.tmp-2
14 diff -u .tmp-1 .tmp-2 && rm -f .tmp-1 .tmp-2
17 sanitize_diff_raw_z='/^:/s/ '"$_x40"' '"$_x40"' \([A-Z]\)[0-9]*$/ X X \1#/'
18 compare_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
24 tr '\0' '\012' <"$1" | sed -e "$sanitize_diff_raw_z" >.tmp-1
25 tr '\0' '\012' <"$2" | sed -e "$sanitize_diff_raw_z" >.tmp-2
26 diff -u .tmp-1 .tmp-2 && rm -f .tmp-1 .tmp-2
29 compare_diff_patch () {
30 # When heuristics are improved, the score numbers would change.
31 # Ignore them while comparing.
32 sed -e '/^[dis]*imilarity index [0-9]*%$/d' <"$1" >.tmp-1
33 sed -e '/^[dis]*imilarity index [0-9]*%$/d' <"$2" >.tmp-2
34 diff -u .tmp-1 .tmp-2 && rm -f .tmp-1 .tmp-2