From 9a20b889e8703482162d9d1487b876be42564a78 Mon Sep 17 00:00:00 2001 From: Patrick Steinhardt Date: Thu, 12 Sep 2024 13:30:13 +0200 Subject: refs: stop modifying global `log_all_ref_updates` variable In refs-related code we modify the global `log_all_ref_updates` variable, which is done because `should_autocreate_reflog()` does not accept passing an `enum log_refs_config` but instead accesses the global variable. Adapt its interface such that the value is provided by the caller, which allows us to compute the proper value locally without having to modify global state. This change requires us to move the enum to "repo-settings.h", or otherwise we get compilation errors due to include cycles. We're about to fully move this setting into the repo-settings subsystem anyway, so this is fine. Signed-off-by: Patrick Steinhardt Signed-off-by: Junio C Hamano --- refs.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'refs.h') diff --git a/refs.h b/refs.h index f8b919a138..f2c4ccde61 100644 --- a/refs.h +++ b/refs.h @@ -3,6 +3,7 @@ #include "commit.h" #include "repository.h" +#include "repo-settings.h" struct fsck_options; struct object_id; @@ -111,7 +112,8 @@ int refs_verify_refname_available(struct ref_store *refs, int refs_ref_exists(struct ref_store *refs, const char *refname); -int should_autocreate_reflog(const char *refname); +int should_autocreate_reflog(enum log_refs_config log_all_ref_updates, + const char *refname); int is_branch(const char *refname); -- cgit v1.2.3