summaryrefslogtreecommitdiffstats
path: root/trace2/tr2_cfg.c
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2024-09-12 13:29:45 +0200
committerJunio C Hamano <gitster@pobox.com>2024-09-12 19:15:40 +0200
commitb92266b79c7bb741e3600e9dc206b693d8062fa9 (patch)
tree33f43c13c0dd58b470e91cab1caf0bccf24422ab /trace2/tr2_cfg.c
parentconfig: document `read_early_config()` and `read_very_early_config()` (diff)
downloadgit-b92266b79c7bb741e3600e9dc206b693d8062fa9.tar.xz
git-b92266b79c7bb741e3600e9dc206b693d8062fa9.zip
config: make dependency on repo in `read_early_config()` explicit
The `read_early_config()` function can be used to read configuration where a repository has not yet been set up. As such, it is optional whether or not `the_repository` has already been initialized. If it was initialized we use its commondir and gitdir. If not, the function will try to detect the Git directories by itself and, if found, also parse their config files. This means that we implicitly rely on `the_repository`. Make this dependency explicit by passing a `struct repository`. This allows us to again drop the `USE_THE_REPOSITORY_VARIABLE` define in "config.c". Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to '')
-rw-r--r--trace2/tr2_cfg.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/trace2/tr2_cfg.c b/trace2/tr2_cfg.c
index d96d908bb9..22a99a0682 100644
--- a/trace2/tr2_cfg.c
+++ b/trace2/tr2_cfg.c
@@ -1,3 +1,5 @@
+#define USE_THE_REPOSITORY_VARIABLE
+
#include "git-compat-util.h"
#include "config.h"
#include "strbuf.h"
@@ -124,7 +126,7 @@ void tr2_cfg_list_config_fl(const char *file, int line)
struct tr2_cfg_data data = { file, line };
if (tr2_cfg_load_patterns() > 0)
- read_early_config(tr2_cfg_cb, &data);
+ read_early_config(the_repository, tr2_cfg_cb, &data);
}
void tr2_list_env_vars_fl(const char *file, int line)