git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Dec 1, 2010, 21:07 UTC
Message-ID
<20101201210700.GC27845@burratino>
In-Reply-To
<AANLkTinLuF74UKaTMNX84FJt+PNoKkkOr3LaXDSCFqdz@mail.gmail.com>
Hi Ralf,
Ralf Thielow wrote:
Show 5 quoted lines
> 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

Previous: Ralf ThielowNext: Junio C Hamano
Message 6 of 8 in “commit: Remove backward goto in read_craft_line()”
  1. commit: Remove backward goto in read_craft_line()Ralf Thielow, Dec 1, 2010
  2. Jonathan NiederDec 1, 2010
  3. Junio C HamanoDec 1, 2010
  4. Jonathan NiederDec 1, 2010
  5. Ralf ThielowDec 1, 2010
  6. Trivial patches (Re: [PATCH] commit: Remove backward goto in read_craft_line())Jonathan Nieder, Dec 1, 2010
  7. Junio C HamanoDec 1, 2010
  8. Ralf ThielowDec 1, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.