Abhishek Kumar | 989eea9 | 2020-02-24 19:08:13 +0530 | [diff] [blame] | 1 | # Helps shared by the test scripts for comparing log graphs. |
| 2 | |
| 3 | sanitize_log_output () { |
| 4 | sed -e 's/ *$//' \ |
| 5 | -e 's/commit [0-9a-f]*$/commit COMMIT_OBJECT_NAME/' \ |
| 6 | -e 's/Merge: [ 0-9a-f]*$/Merge: MERGE_PARENTS/' \ |
| 7 | -e 's/Merge tag.*/Merge HEADS DESCRIPTION/' \ |
| 8 | -e 's/Merge commit.*/Merge HEADS DESCRIPTION/' \ |
| 9 | -e 's/index [0-9a-f]*\.\.[0-9a-f]*/index BEFORE..AFTER/' |
| 10 | } |
| 11 | |
| 12 | lib_test_cmp_graph () { |
| 13 | git log --graph "$@" >output && |
| 14 | sed 's/ *$//' >output.sanitized <output && |
Ævar Arnfjörð Bjarmason | 1108cea | 2021-02-11 02:53:53 +0100 | [diff] [blame] | 15 | test_cmp expect output.sanitized |
Abhishek Kumar | 989eea9 | 2020-02-24 19:08:13 +0530 | [diff] [blame] | 16 | } |
| 17 | |
| 18 | lib_test_cmp_short_graph () { |
| 19 | git log --graph --pretty=short "$@" >output && |
| 20 | sanitize_log_output >output.sanitized <output && |
Ævar Arnfjörð Bjarmason | 1108cea | 2021-02-11 02:53:53 +0100 | [diff] [blame] | 21 | test_cmp expect output.sanitized |
Abhishek Kumar | 989eea9 | 2020-02-24 19:08:13 +0530 | [diff] [blame] | 22 | } |
Abhishek Kumar | ffe0055 | 2020-02-24 19:08:14 +0530 | [diff] [blame] | 23 | |
| 24 | lib_test_cmp_colored_graph () { |
| 25 | git log --graph --color=always "$@" >output.colors.raw && |
| 26 | test_decode_color <output.colors.raw | sed "s/ *\$//" >output.colors && |
| 27 | test_cmp expect.colors output.colors |
| 28 | } |