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

Re: [PATCH 4/4] line-log: simplify condition checking for merge commits

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 25, 2025, 21:57 UTC
Message-ID
<xmqqqzwznjya.fsf@gitster.g>
In-Reply-To
<f98f3db4-cd36-4a24-903f-7aebf6af3d51@gmail.com>
Derrick Stolee <stolee@gmail.com> writes:
> ... but the negation and OR condition made me need to pause and
> think about it, while the positive of "does it have a parent and
> a second parent?" was something that flowed naturally when I read
> it.
Yeah, that I 100% agree with.  If it were
	if (!(c->parent && c->parent->next))
		handle_ordinary_commit();
	else
		handle_merge_commit();

that would have been very easy to grok. I do not have a strong preference between that and

	if (c->parent && c->parent->next)
		handle_merge_commit();
	else
		handle_ordinary_commit();

myself, but I always felt that handling ordinary commits was the primary thing in this code path, which made me react to the swapping of orders of these two calls.

> Definitely a taste thing, so I could see you wanting to skip this
> one on a pure "don't touch what's not broken" policy.

True, too, but the code that fails to be in a readable shape too falls into the "broken" category, so in that sense I do not mind queuing the patch, either (and indeed tonight's 'seen' will include this step in the topic).

Thanks.
Previous: Derrick StoleeNext: Derrick Stolee
Message 11 of 12 in “line-log: optimize merge commit processing”
  1. 0/4 line-log: optimize merge commit processingSZEDER Gábor, Aug 24, 2025
  2. 1/4 line-log: avoid unnecessary tree diffs when processing merge commitsSZEDER Gábor, Aug 24, 2025
  3. Derrick StoleeAug 25, 2025
  4. Junio C HamanoAug 25, 2025
  5. SZEDER GáborAug 28, 2025
  6. 2/4 line-log: get rid of the parents array in process_ranges_merge_commit()SZEDER Gábor, Aug 24, 2025
  7. 3/4 line-log: initialize diff queue in process_ranges_ordinary_commit()SZEDER Gábor, Aug 24, 2025
  8. 4/4 line-log: simplify condition checking for merge commitsSZEDER Gábor, Aug 24, 2025
  9. Junio C HamanoAug 25, 2025
  10. Derrick StoleeAug 25, 2025
  11. Junio C HamanoAug 25, 2025
  12. Derrick StoleeAug 25, 2025

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.