Re: [PATCH v17 1/2] refactor format_branch_comparison in preparation
From: Ben Knoble <hidden>
Date: 2026-01-09 16:22:44
Le 9 janv. 2026 à 11:07, Harald Nordgren [off-list ref] a écrit : quoted
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…
quoted
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?