Atousa Duprat <atousa.p@xxxxxxxxx> writes: > Here is my first attempt at fixing the issue. > > There are two problems in ref-filter.c: > > First, copy_subject() has been modified to turn '\n' into a space and > every other ascii control character to be ignored. > > Second, find_subpos() doesn't realize that a line that only contains a > '\r\n' is a blank line – at least when using crlf convention. > I have changed things so that a sequence of either '\n' or "\r\n" > separate the subject from the body of the commit message. > I am not looking at the crlf setting because it doesn't seem like a > useful distinction – when one would we ever care for \r\n not to be a > blank line? But it could be done... > > Both fixes are minimal, but it feels like they are a issues with the > specific encoding. Does git mandate ascii or utf-8 commit messages? > If not, there may be a larger issue here with encodings and line-end > conventions at the very least in ref-filter.c > Guidance would be appreciated for how to deal with this issue... > > Patch attached. Doesn't this share the problem I pointed out in the other attempt in https://public-inbox.org/git/xmqqy3tppu13.fsf@xxxxxxxxxxxxxxxxxxxxxxxxxxx/ In short, any patch that special cases CR will not get the original behaviour back correctly. The original never special cased CR; it stripped isspace() at the end of lines, and turning of CRLF into LF is merely just one effect of it. You can apply the attached patch and see what "git branch -v" produces. We should only see "one", not "one line3_long line4", for branch-two in the output. Then replace the SP between %s and \n in the printf thing with \r and repeat the experiment. Thanks. t/t3203-branch-output.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/t/t3203-branch-output.sh b/t/t3203-branch-output.sh index a428ae6703..79b80a2d3f 100755 --- a/t/t3203-branch-output.sh +++ b/t/t3203-branch-output.sh @@ -13,7 +13,8 @@ test_expect_success 'make commits' ' test_expect_success 'make branches' ' git branch branch-one && - git branch branch-two HEAD^ + git branch branch-two $(printf "%s \n" one "" line3_long line4 | + git commit-tree HEAD:) ' test_expect_success 'make remote branches' '