Subject: Trivial patches (Re: [PATCH] commit: Remove backward goto in read_craft_line())

From: Jonathan Nieder <[email-masked]>
Date: Wed, 1 Dec 2010 15:07:00 -0600

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