]> git.ipfire.org Git - thirdparty/git.git/blob - t/lib-bitmap.sh
Merge branch 'en/ort-perf-batch-9'
[thirdparty/git.git] / t / lib-bitmap.sh
1 # Compare a file containing rev-list bitmap traversal output to its non-bitmap
2 # counterpart. You can't just use test_cmp for this, because the two produce
3 # subtly different output:
4 #
5 # - regular output is in traversal order, whereas bitmap is split by type,
6 # with non-packed objects at the end
7 #
8 # - regular output has a space and the pathname appended to non-commit
9 # objects; bitmap output omits this
10 #
11 # This function normalizes and compares the two. The second file should
12 # always be the bitmap output.
13 test_bitmap_traversal () {
14 if test "$1" = "--no-confirm-bitmaps"
15 then
16 shift
17 elif cmp "$1" "$2"
18 then
19 echo >&2 "identical raw outputs; are you sure bitmaps were used?"
20 return 1
21 fi &&
22 cut -d' ' -f1 "$1" | sort >"$1.normalized" &&
23 sort "$2" >"$2.normalized" &&
24 test_cmp "$1.normalized" "$2.normalized" &&
25 rm -f "$1.normalized" "$2.normalized"
26 }