1# Helps shared by the test scripts for comparing log graphs. 2 3sanitize_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 12lib_test_cmp_graph () { 13 git log --graph "$@" >output && 14 sed 's/ *$//' >output.sanitized <output && 15 test_cmp expect output.sanitized 16} 17 18lib_test_cmp_short_graph () { 19 git log --graph --pretty=short "$@" >output && 20 sanitize_log_output >output.sanitized <output && 21 test_cmp expect output.sanitized 22} 23 24lib_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} 29