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

From: Patrick Steinhardt <[email-masked]>
Date: Mon, 11 May 2026 09:22:35 +0200

On Mon, May 11, 2026 at 06:19:08AM +0000, Kristofer Karlsson via GitGitGadget wrote:
> 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