mirror of
https://github.com/git/git.git
synced 2026-01-10 10:13:33 +00:00
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>
This commit is contained in:
committed by
Junio C Hamano
parent
118fd1a26d
commit
9a20b889e8
@@ -23,6 +23,7 @@
|
||||
#include "read-cache.h"
|
||||
#include "refs.h"
|
||||
#include "remote.h"
|
||||
#include "repo-settings.h"
|
||||
#include "resolve-undo.h"
|
||||
#include "revision.h"
|
||||
#include "setup.h"
|
||||
@@ -954,7 +955,7 @@ static void update_refs_for_switch(const struct checkout_opts *opts,
|
||||
|
||||
refname = mkpathdup("refs/heads/%s", opts->new_orphan_branch);
|
||||
if (opts->new_branch_log &&
|
||||
!should_autocreate_reflog(refname)) {
|
||||
!should_autocreate_reflog(log_all_ref_updates, refname)) {
|
||||
int ret;
|
||||
struct strbuf err = STRBUF_INIT;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user