From: Ben Knoble Date: Fri, 09 Jan 2026 16:22:33 GMT Subject: Re: [PATCH v17 1/2] refactor format_branch_comparison in preparation Message-ID: <848006C9-FD1B-4E73-935F-D4A338AF2EC9@gmail.com> In-Reply-To: <20260109160037.2067-1-haraldnordgren@gmail.com> > Le 9 janv. 2026 à 11:07, Harald Nordgren 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… >> Here we set an enum to a value that is not a member of the enum. > > I use bitmasking to enable both modes by default. But see my comments above > maybe there is a nicer way to handle all of this. …which explains this comment. IOW: set of flags makes sense, but there’s a more usual way to set that up?