aboutsummaryrefslogtreecommitdiff
path: root/object-name.h
diff options
context:
space:
mode:
authorJialong Wang <jerrywang183@yahoo.com>2026-03-18 15:09:42 -0400
committerJunio C Hamano <gitster@pobox.com>2026-03-18 12:52:29 -0700
commitc5fc44f54595f123c277e5839cbafa1bc9c8c050 (patch)
tree4956573f4efd25c79ae9f535e192d97fbeaca8a7 /object-name.h
parentca1db8a0f7dc0dbea892e99f5b37c5fe5861be71 (diff)
downloadgit-c5fc44f54595f123c277e5839cbafa1bc9c8c050.tar.xz
object-name: turn INTERPRET_BRANCH_* constants into enum values
Replace the INTERPRET_BRANCH_* preprocessor constants with enum values and use that type where these flags are stored or passed around. These flags describe which kinds of branches may be considered during branch-name interpretation, so represent them as an enum describing branch kinds while keeping the existing bitmask semantics and INTERPRET_BRANCH_* element names. Signed-off-by: Jialong Wang <jerrywang183@yahoo.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'object-name.h')
-rw-r--r--object-name.h11
1 files changed, 7 insertions, 4 deletions
diff --git a/object-name.h b/object-name.h
index cda4934cd5..167a9154ea 100644
--- a/object-name.h
+++ b/object-name.h
@@ -101,9 +101,12 @@ int set_disambiguate_hint_config(const char *var, const char *value);
* If the input was ok but there are not N branch switches in the
* reflog, it returns 0.
*/
-#define INTERPRET_BRANCH_LOCAL (1<<0)
-#define INTERPRET_BRANCH_REMOTE (1<<1)
-#define INTERPRET_BRANCH_HEAD (1<<2)
+enum interpret_branch_kind {
+ INTERPRET_BRANCH_LOCAL = (1 << 0),
+ INTERPRET_BRANCH_REMOTE = (1 << 1),
+ INTERPRET_BRANCH_HEAD = (1 << 2),
+};
+
struct interpret_branch_name_options {
/*
* If "allowed" is non-zero, it is a treated as a bitfield of allowable
@@ -111,7 +114,7 @@ struct interpret_branch_name_options {
* ("refs/remotes/"), or "HEAD". If no "allowed" bits are set, any expansion is
* allowed, even ones to refs outside of those namespaces.
*/
- unsigned allowed;
+ enum interpret_branch_kind allowed;
/*
* If ^{upstream} or ^{push} (or equivalent) is requested, and the