Subject: Re: [PATCH v17 1/2] refactor format_branch_comparison in preparation

From: Patrick Steinhardt <[email-masked]>
Date: Fri, 9 Jan 2026 17:32:39 +0100

On Fri, Jan 09, 2026 at 11:22:33AM -0500, Ben Knoble wrote:
> 
> > Le 9 janv. 2026 à 11:07, Harald Nordgren <[email-masked]> a écrit :
> > 
> > 
> >> 
> >> Using an enum for a set of flags is a bit confusing.
> > 
> > The point of the flag and the bitmasking is to selectively turn off the push
> > and pull advice advice from the relevant branch when the push branch
> > comparison is active.
> > 
> > In an earlier implementation the advice logic was moved to the caller
> > instead 'format_branch_comparison', but it's more faithful to the original
> > to have the advice logic inside 'format_branch_comparison'. Maybe I
> > misunderstood your comments around this?
> > 
> > Would happily take a suggestion on a nicer way to handle it.
> 
> I think other uses in Git declare a bunch of integer constants for the
> bitfields, not an enum. Why? Because or-ing flags together creates a
> value not in the enum…

We nowadays typically declare the flags as enum, but when accepting the
bitfield we use `unsigned`.

Patrick