Skip to content

Commit e2f8958

Browse files
phil-blaingitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 9f75ce3 commit e2f8958

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

t/t3920-crlf-messages.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,4 +105,22 @@ test_crlf_subject_body_and_contents tag --list tag-crlf*
105105

106106
test_crlf_subject_body_and_contents for-each-ref refs/heads/crlf*
107107

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+
108126
test_done

0 commit comments

Comments
 (0)