Re: [PATCH v17 1/2] refactor format_branch_comparison in preparation
- From
Patrick Steinhardt <ps@pks.im>
- Date
- Jan 9, 2026, 16:32 UTC
- Message-ID
- <aWEtp77UB30SbKle@pks.im>
- In-Reply-To
- <848006C9-FD1B-4E73-935F-D4A338AF2EC9@gmail.com>
On Fri, Jan 09, 2026 at 11:22:33AM -0500, Ben Knoble wrote:
Show 21 quoted lines
> > > Le 9 janv. 2026 à 11:07, Harald Nordgren <haraldnordgren@gmail.com> 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