summaryrefslogtreecommitdiffstats
path: root/alias.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 /alias.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 'alias.c')
-rw-r--r--alias.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/alias.c b/alias.c
index 4daafd9bda..1a1a141a0a 100644
--- a/alias.c
+++ b/alias.c
@@ -1,3 +1,5 @@
+#define USE_THE_REPOSITORY_VARIABLE
+
#include "git-compat-util.h"
#include "alias.h"
#include "config.h"
@@ -37,7 +39,7 @@ char *alias_lookup(const char *alias)
{
struct config_alias_data data = { alias, NULL };
- read_early_config(config_alias_cb, &data);
+ read_early_config(the_repository, config_alias_cb, &data);
return data.v;
}
@@ -46,7 +48,7 @@ void list_aliases(struct string_list *list)
{
struct config_alias_data data = { NULL, NULL, list };
- read_early_config(config_alias_cb, &data);
+ read_early_config(the_repository, config_alias_cb, &data);
}
void quote_cmdline(struct strbuf *buf, const char **argv)