* Replacing strbuf_getline_lf() by strbuf_getline() in wt-status.c
@ 2016-01-30 14:30 Moritz Neeb
2016-01-30 22:49 ` Moritz Neeb
2016-01-31 16:59 ` Junio C Hamano
0 siblings, 2 replies; 3+ messages in thread
From: Moritz Neeb @ 2016-01-30 14:30 UTC (permalink / raw)
To: git@vger.kernel.org
Currently I am working on replacing strbuf_getline_lf() by
strbuf_getline() in places where the input is trimmed immediately after
reading, cf. $gmane/284104, "Notes on the remaining strbuf_getline_lf()
callers", 2nd point.
One instance I found was in wt-status.c. In read_rebase_todolist() the
lines are read, checked for a comment_line_char and then trimmed. I
wonder why the input is not trimmed before checking for this character?
Is it safe to replace strbuf_getline_lf() by strbuf_getline() anyway?
The only case I can imagine that could lead to unexpected behaviour then
would be when someone sets the comment_line_char to CR. How likely is that?
Why is the trim after checking for the comment char anyway? Should
something like " # foobar" not be considered as comment?
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Replacing strbuf_getline_lf() by strbuf_getline() in wt-status.c
2016-01-30 14:30 Replacing strbuf_getline_lf() by strbuf_getline() in wt-status.c Moritz Neeb
@ 2016-01-30 22:49 ` Moritz Neeb
2016-01-31 16:59 ` Junio C Hamano
1 sibling, 0 replies; 3+ messages in thread
From: Moritz Neeb @ 2016-01-30 22:49 UTC (permalink / raw)
To: git@vger.kernel.org
On 01/30/2016 03:30 PM, Moritz Neeb wrote:
> Currently I am working on replacing strbuf_getline_lf() by
> strbuf_getline() in places where the input is trimmed immediately after
> reading, cf. $gmane/284104, "Notes on the remaining strbuf_getline_lf()
> callers", 2nd point.
This thread turned obsolete, as I decided to post a patch to focus the
discussion a bit more:
http://thread.gmane.org/gmane.comp.version-control.git/285118
-Moritz
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Replacing strbuf_getline_lf() by strbuf_getline() in wt-status.c
2016-01-30 14:30 Replacing strbuf_getline_lf() by strbuf_getline() in wt-status.c Moritz Neeb
2016-01-30 22:49 ` Moritz Neeb
@ 2016-01-31 16:59 ` Junio C Hamano
1 sibling, 0 replies; 3+ messages in thread
From: Junio C Hamano @ 2016-01-31 16:59 UTC (permalink / raw)
To: Moritz Neeb; +Cc: git@vger.kernel.org
Moritz Neeb <lists@moritzneeb.de> writes:
> Currently I am working on replacing strbuf_getline_lf() by
> strbuf_getline() in places where the input is trimmed immediately after
> reading, cf. $gmane/284104, "Notes on the remaining strbuf_getline_lf()
> callers", 2nd point.
>
> One instance I found was in wt-status.c. In read_rebase_todolist() the
> lines are read, checked for a comment_line_char and then trimmed. I
> wonder why the input is not trimmed before checking for this character?
> Is it safe to replace strbuf_getline_lf() by strbuf_getline() anyway?
>
> The only case I can imagine that could lead to unexpected behaviour then
> would be when someone sets the comment_line_char to CR. How likely is that?
>
> Why is the trim after checking for the comment char anyway? Should
> something like " # foobar" not be considered as comment?
That is debatable, I would think, as "git commit" and others do not
generally accept a line that does not begin with a comment char as a
comment.
I however think we made an exception for the rebase-i's insn file
due to a mistake we made long time ago that allowed such line,
caused people to build a workflow around the assumption that it is
OK to prefix a comment line with whitespaces.
Cf. the last paragraph of 1db168ee (rebase-i: loosen over-eager
check_bad_cmd check, 2015-10-01).
Cf. http://thread.gmane.org/gmane.comp.version-control.git/278841
So we probably want to be consistent with that in this codepath.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-01-31 17:00 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-30 14:30 Replacing strbuf_getline_lf() by strbuf_getline() in wt-status.c Moritz Neeb
2016-01-30 22:49 ` Moritz Neeb
2016-01-31 16:59 ` Junio C Hamano
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).