summaryrefslogtreecommitdiffstats
path: root/refs.c
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2024-09-12 13:30:13 +0200
committerJunio C Hamano <gitster@pobox.com>2024-09-12 19:15:43 +0200
commit9a20b889e8703482162d9d1487b876be42564a78 (patch)
tree04e8121ac4dbbb63b03559b6b8485ae285065f73 /refs.c
parentbranch: stop modifying `log_all_ref_updates` variable (diff)
downloadgit-9a20b889e8703482162d9d1487b876be42564a78.tar.xz
git-9a20b889e8703482162d9d1487b876be42564a78.zip
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 <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'refs.c')
-rw-r--r--refs.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/refs.c b/refs.c
index ceb72d4bd7..d7402bcd19 100644
--- a/refs.c
+++ b/refs.c
@@ -24,7 +24,7 @@
#include "submodule.h"
#include "worktree.h"
#include "strvec.h"
-#include "repository.h"
+#include "repo-settings.h"
#include "setup.h"
#include "sigchain.h"
#include "date.h"
@@ -958,7 +958,8 @@ static char *normalize_reflog_message(const char *msg)
return strbuf_detach(&sb, NULL);
}
-int should_autocreate_reflog(const char *refname)
+int should_autocreate_reflog(enum log_refs_config log_all_ref_updates,
+ const char *refname)
{
switch (log_all_ref_updates) {
case LOG_REFS_ALWAYS: