1
1
# Helpers shared by the test scripts for comparing log graphs.
2
2
3
- sanitize_output () {
3
+ sanitize_output () {
4
+ # Versions of Git that predate 7f814632 ("Use correct grammar
5
+ # in diffstat summary line", 2012-02-01) did not correctly use
6
+ # singular when one path was involved, and a handful of rules
7
+ # were added to work with both older and newer versions of Git
8
+ # back then. These are probably not relevant anymore, and
9
+ # we'd want to lose them someday...
4
10
sed -e ' s/ *$//' \
5
11
-e ' s/commit [0-9a-f]*$/commit COMMIT_OBJECT_NAME/' \
6
12
-e ' s/Merge: [ 0-9a-f]*$/Merge: MERGE_PARENTS/' \
@@ -15,25 +21,25 @@ sanitize_output() {
15
21
}
16
22
17
23
# Assume expected graph is in file `expect`
18
- test_cmp_graph_file () {
24
+ test_cmp_graph_file () {
19
25
git log --graph " $@ " > output &&
20
- sanitize_output > output.trimmed < output &&
21
- test_i18ncmp expect output.trimmed
26
+ sanitize_output > output.sanitized < output &&
27
+ test_i18ncmp expect output.sanitized
22
28
}
23
29
24
- test_cmp_graph () {
30
+ test_cmp_graph () {
25
31
cat > expect &&
26
32
test_cmp_graph_file " $@ "
27
33
}
28
34
29
35
# Assume expected graph is in file `expect.colors`
30
- test_cmp_colored_graph_file () {
36
+ test_cmp_colored_graph_file () {
31
37
git log --graph --color=always " $@ " > output.colors.raw &&
32
38
test_decode_color < output.colors.raw | sed " s/ *\$ //" > output.colors &&
33
39
test_cmp expect.colors output.colors
34
40
}
35
41
36
- test_cmp_colored_graph () {
42
+ test_cmp_colored_graph () {
37
43
cat > expect.colors &&
38
44
test_cmp_colored_graph_file " $@ "
39
45
}
0 commit comments