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

Re: [PATCH v2] commit-reach: early exit paint_down_to_common for single merge-base

From
Patrick Steinhardt <ps@pks.im>
Date
May 11, 2026, 07:22 UTC
Message-ID
<agGDu4Nc5sBjpf_B@pks.im>
In-Reply-To
<pull.2109.v2.git.1778480348118.gitgitgadget@gmail.com>
On Mon, May 11, 2026 at 06:19:08AM +0000, Kristofer Karlsson via GitGitGadget wrote:
Show 13 quoted lines
> diff --git a/commit-reach.c b/commit-reach.c
> index d3a9b3ed6f..b4ca00bb7e 100644
> --- a/commit-reach.c
> +++ b/commit-reach.c
> @@ -165,7 +175,7 @@ static int merge_bases_many(struct repository *r,
>  				     oid_to_hex(&twos[i]->object.oid));
>  	}
>  
> -	if (paint_down_to_common(r, one, n, twos, 0, 0, &list)) {
> +	if (paint_down_to_common(r, one, n, twos, 0, 0, find_all, &list)) {
>  		commit_list_free(list);
>  		return -1;
>  	}

Callsites like this are quite hard to read now with these boolean flags. Would it be preferable to instead use flags?

    enum paint_down_to_common_flags {
        PAINT_DOWN_TO_COMMON_IGNORE_MISSING_COMMITS = (1 << 0),
        PAINT_DOWN_TO_COMMON_FIND_ALL = (1 << 1),
    };
It's more verbose of course, but that's kind of the point.

Only weirdness is that we don't only accept these flags in `paint_down_to_common()`, but also in other functions that pass those flags down.

Patrick
Previous: Kristofer Karlsson via GitGitGadgetNext: Kristofer Karlsson via GitGitGadget
Message 4 of 11 in “commit-reach: early exit paint_down_to_common for single merge-base”
  1. commit-reach: early exit paint_down_to_common for single merge-baseKristofer Karlsson via GitGitGadget, May 8, 2026
  2. Junio C HamanoMay 11, 2026
  3. commit-reach: early exit paint_down_to_common for single merge-baseKristofer Karlsson via GitGitGadget, May 11, 2026
  4. Patrick SteinhardtMay 11, 2026
  5. commit-reach: early exit paint_down_to_common for single merge-baseKristofer Karlsson via GitGitGadget, May 11, 2026
  6. Patrick SteinhardtMay 11, 2026
  7. 0/2 [RFC] commit-reach: skip STALE drain when only one merge-base neededKristofer Karlsson via GitGitGadget, May 11, 2026
  8. 1/2 commit-reach: introduce merge_base_flags enumKristofer Karlsson via GitGitGadget, May 11, 2026
  9. 2/2 commit-reach: early exit paint_down_to_common for single merge-baseKristofer Karlsson via GitGitGadget, May 11, 2026
  10. Junio C HamanoMay 12, 2026
  11. Kristofer KarlssonMay 12, 2026

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.