From: DOAN Tran Cong Danh <congdanhqx@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, animi.vulpis@gmail.com, j6t@kdbg.org,
Karthik Nayak <karthik.188@gmail.com>
Subject: Re: [PATCH] ref-filter: treat CRLF as same as LF in find_subpos
Date: Mon, 22 May 2017 19:29:49 +0800 [thread overview]
Message-ID: <9d42e133-75aa-d20a-0d38-bfbdc64d46fa@gmail.com> (raw)
In-Reply-To: <xmqqy3tppu13.fsf@gitster.mtv.corp.google.com>
On 05/22/2017 09:19 AM, Junio C Hamano wrote:
> If you look at how `git branch -v` before that problematic change
> removed the extra CR, you would notice that pretty_print_commit()
> was used for that, which eventually called format_subject() with
> "one\r\n\r\nline3...", got one line "one\r\n" by calling
> get_one_line(), adjusted the line length from 5 to 3 by calling
> is_blank_line() which as a side effect trims all whitespaces (not
> just LF and CR), and emitted "one". The reason why the next \r\n
> was not mistaken as a non-empty line is the same---is_blank_line()
> call onthe next line said that "\r\n" is an all-white space line.
>
> So, while I think the realization that we have a problem, and the
> analysis above i.e. "emptiness of the line matters", are both good,
> but I do not think this is suffucient to get back the old behaviour.
>
> The thing is, we never treated CRLF as line separator in this code.
> What we did was to treat LF as line separator, but trimmed trailing
> bytes that are isspace(). That is what the analysis you quoted from
> J6t says.
If I understand correctly, we should trim all whitespaces at the end of
subject line, and we should treat lines contain only whitespaces as
empty lines, right?
> Here is your test addition:
> If you change this test to
>
>> + git branch branch-two $(printf "%s\n" one " " line3_long line4 |
>> + git commit-tree HEAD:)
>
> then the old code before the problematic change will only show the
> first line i.e. "one" in "branch -v" output. I think with or
> without your code change, the new code would still show line3_long
> and line4 in the output.
Agree!
If you could confirm my understand, I would happily provide new patch
to trim all trailing whitespaces at the end of subject line
and treat next all-whitespace-line as empty line.
next prev parent reply other threads:[~2017-05-22 11:29 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-16 23:22 [Bug] git branch -v has problems with carriage returns Animi Vulpis
[not found] ` <CA+izobutP-JY84RGG-JbPA5twbckL1uVwxknBRLVTuGG0MEJcg@mail.gmail.com>
[not found] ` <CA+izobuSKtoQzNJuvuisjh7h3FF=nbt8u-hOHfdeFp8ZjgZF+Q@mail.gmail.com>
[not found] ` <591f6844.82dcca0a.451e5.8f76.GMRIR@mx.google.com>
2017-05-19 21:51 ` Delivery Status Notification (Failure) Atousa Duprat
2017-05-19 21:55 ` [Bug] git branch -v has problems with carriage returns Atousa Duprat
2017-05-19 23:20 ` Animi Vulpis
2017-05-20 6:48 ` Johannes Sixt
2017-05-31 5:32 ` Atousa Duprat
2017-05-31 20:58 ` Stefan Beller
2017-06-01 1:31 ` Junio C Hamano
2017-05-21 13:42 ` [PATCH] ref-filter: treat CRLF as same as LF in find_subpos DOAN Tran Cong Danh
2017-05-22 1:19 ` Junio C Hamano
2017-05-22 11:29 ` DOAN Tran Cong Danh [this message]
2017-05-22 20:12 ` Jeff King
2017-05-23 1:49 ` Junio C Hamano
2017-05-23 2:01 ` Junio C Hamano
2017-05-23 3:01 ` Junio C Hamano
2017-05-21 14:10 ` DOAN Tran Cong Danh
2017-05-22 14:57 ` [PATCH v2] ref-filter: trim end whitespace in subject DOAN Tran Cong Danh
2017-05-22 17:10 ` [PATCH v3] " DOAN Tran Cong Danh
2017-05-22 19:47 ` Johannes Sixt
2017-05-22 19:53 ` Jeff King
2017-05-22 20:19 ` Johannes Sixt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9d42e133-75aa-d20a-0d38-bfbdc64d46fa@gmail.com \
--to=congdanhqx@gmail.com \
--cc=animi.vulpis@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=j6t@kdbg.org \
--cc=karthik.188@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).