diff options
author | Patrick Steinhardt <ps@pks.im> | 2024-09-12 13:30:21 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2024-09-12 19:15:43 +0200 |
commit | 8e2e8a33f3558524adeceeb1e2e7b64a367b0d08 (patch) | |
tree | ac073e084b58e7fb5a33ca95e3478e0fb1cf82b8 /refs | |
parent | environment: stop storing "core.logAllRefUpdates" globally (diff) | |
download | git-8e2e8a33f3558524adeceeb1e2e7b64a367b0d08.tar.xz git-8e2e8a33f3558524adeceeb1e2e7b64a367b0d08.zip |
environment: stop storing "core.preferSymlinkRefs" globally
Same as the preceding commit, storing the "core.preferSymlinkRefs" value
globally is misdesigned as this setting may be set per repository.
There is only a single user of this value anyway, namely the "files"
backend. So let's just remove the global variable and read the value of
this setting when initializing the backend.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to '')
-rw-r--r-- | refs/files-backend.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/refs/files-backend.c b/refs/files-backend.c index a536d7d1b5..e5b0aff00d 100644 --- a/refs/files-backend.c +++ b/refs/files-backend.c @@ -1,6 +1,7 @@ #define USE_THE_REPOSITORY_VARIABLE #include "../git-compat-util.h" +#include "../config.h" #include "../copy.h" #include "../environment.h" #include "../gettext.h" @@ -76,6 +77,7 @@ struct files_ref_store { char *gitcommondir; enum log_refs_config log_all_ref_updates; + int prefer_symlink_refs; struct ref_cache *loose; @@ -109,6 +111,7 @@ static struct ref_store *files_ref_store_init(struct repository *repo, refs->packed_ref_store = packed_ref_store_init(repo, refs->gitcommondir, flags); refs->log_all_ref_updates = repo_settings_get_log_all_ref_updates(repo); + repo_config_get_bool(repo, "core.prefersymlinkrefs", &refs->prefer_symlink_refs); chdir_notify_reparent("files-backend $GIT_DIR", &refs->base.gitdir); chdir_notify_reparent("files-backend $GIT_COMMONDIR", @@ -2942,7 +2945,7 @@ static int files_transaction_finish(struct ref_store *ref_store, * We try creating a symlink, if that succeeds we continue to the * next update. If not, we try and create a regular symref. */ - if (update->new_target && prefer_symlink_refs) + if (update->new_target && refs->prefer_symlink_refs) if (!create_ref_symlink(lock, update->new_target)) continue; |