log, show: add tests for messages containing CRLF
A previous commit adjusted the code in ref-filter.c so that messages containing CRLF are now correctly parsed and displayed. Add tests to also check that `git log` and `git show` correctly handle such messages, to prevent futur regressions if these commands are refactored to use the ref-filter API. Signed-off-by: Philippe Blain <levraiphilippeblain@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Philippe Blain committed
Oct 29, 2020 at 12:48 UTC
e2f89586fa6d22bfb176e2f679584464fa1a282d
1 file changed
+18
t/t3920-crlf-messages.sh
+18
@@ -105,4 +105,22 @@ test_crlf_subject_body_and_contents tag --list tag-crlf*
105
106
test_crlf_subject_body_and_contents for-each-ref refs/heads/crlf*
107
108
+test_expect_success 'log: --oneline works with messages using CRLF' '
109
+ for branch in $LIB_CRLF_BRANCHES
110
+ do
111
+ cat .crlf-subject-${branch}.txt >expect &&
112
+ printf "\n" >>expect &&
113
+ git log --oneline -1 ${branch} >tmp-branch &&
114
+ git log --oneline -1 tag-${branch} >tmp-tag &&
115
+ cut -d" " -f2- <tmp-branch >actual-branch &&
116
+ cut -d" " -f2- <tmp-tag >actual-tag &&
117
+ test_cmp expect actual-branch &&
118
+ test_cmp expect actual-tag || return 1
119
+ done
120
+'
121
+
122
+test_crlf_subject_body_and_contents log --all --reverse --grep Subject
123
+
124
+test_crlf_subject_body_and_contents show $LIB_CRLF_BRANCHES
125
+
126
test_done