From: Jonathan Nieder <jrnieder@gmail.com>
To: Ralf Thielow <ralf.thielow@googlemail.com>
Cc: Junio C Hamano <gitster@pobox.com>, git@vger.kernel.org
Subject: Trivial patches (Re: [PATCH] commit: Remove backward goto in read_craft_line())
Date: Wed, 1 Dec 2010 15:07:00 -0600 [thread overview]
Message-ID: <20101201210700.GC27845@burratino> (raw)
In-Reply-To: <AANLkTinLuF74UKaTMNX84FJt+PNoKkkOr3LaXDSCFqdz@mail.gmail.com>
Hi Ralf,
Ralf Thielow wrote:
> In fact the "--show-c-function" output is the problem. But I think that
> a change can't be rejected because of another issue.
> The style of placing "goto"-statements, which leave a function to the
> end of that is used in many other projects. And I think
> it's very usefull.
Thinking more about your patch reminds me of something that can be
confusing to new contributors. Sometimes it is hard for a trivial
patch to be accepted than one which makes a larger change, requires
more time reviewing it, and has more potential for catastrophic
breakage.
Why is that? Resistance to trivial changes is in my opinion a good
thing and I'd like to emphasize that now, since my feeling about
this patch is borderline.[1]
In this case, the patch is changing code like this:
do something
if (error) {
error_case:
report error;
free resources;
return -1;
}
do something else
if (error)
goto error_case;
if (other error)
goto error_case;
return result;
into the more usual simulated exception handling:
do something
if (error)
goto error_case;
do something else
if (error)
goto error_case;
...
return result;
error_case:
report error;
free resources;
return -1;
The latter is not really much clearer than the former, just less
unusual. Changing the code means patches are less likely to apply
to both the before and after. Changing the code requires time to
review it and to explain why this kind of change is okay in this
case but in other cases it wouldn't be.
So it would be much easier to like this if the change fixed a
noticeable problem (in user-visible behavior, maintainability,
or clarity).
Sorry for the mixed message. Partly I really _wanted_ to like
this because it is in better taste than some of the trivial patches
the git list has received before. As far as applying this one, I
suppose I would not mind either way.
Anyway, I hope that makes the underlying principles a bit clearer.
Thanks for a useful example.
Jonathan
[1] Linux has a "maintainer of trivial" that takes care of such
patches while minimizing the damage to bystanders. Traditionally
there were some pretty rigid guidelines for what patches in this
area were accepted, which was probably a good idea.
ftp://ftp.kernel.org/pub/linux/kernel/people/rusty/trivial/template-index.html
next prev parent reply other threads:[~2010-12-01 21:07 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-12-01 19:15 [PATCH] commit: Remove backward goto in read_craft_line() Ralf Thielow
2010-12-01 19:44 ` Jonathan Nieder
2010-12-01 20:19 ` Junio C Hamano
2010-12-01 20:31 ` Jonathan Nieder
2010-12-01 20:44 ` Ralf Thielow
2010-12-01 21:07 ` Jonathan Nieder [this message]
2010-12-01 21:19 ` Junio C Hamano
2010-12-01 21:40 ` Ralf Thielow
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=20101201210700.GC27845@burratino \
--to=jrnieder@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=ralf.thielow@googlemail.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).