Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVictoria Dye <vdye@github.com>2023-05-26 04:32:59 +0300
committerJunio C Hamano <gitster@pobox.com>2023-05-26 07:53:40 +0300
commit9b6b06c159e0a389aaafbce91dd85bb5244ac5ad (patch)
tree5875e2fc20d4a01508acecee679a17cc04b1d61c /config.h
parent847d0027d277f5748e9073aed8deb8b81af32ee7 (diff)
config: pass 'repo' directly to 'config_with_options()'
Add a 'struct repository' argument to 'config_with_options()' and remove the 'repo' field from 'struct git_config_source'. A 'struct repository' instance was originally added to the config source in e3e8bf046e9 (submodule-config: pass repo upon blob config read, 2021-08-16) to improve how submodule blob config content was accessed. At the time, this was the only use for a 'repository' instance, so it was naturally added only where it was needed: to 'struct git_config_source'. However, in upcoming patches, 'config_with_options()' will need the repository instance to access extension information (regardless of whether a 'config_source' exists). To make the 'struct repository' instance more easily accessible, move it into the function's arguments. Update all callers of 'config_with_options()' to pass the appropriate 'repo' value: * in 'builtin/config.c', use 'the_repository' * in 'submodule--config.c', use the 'repo' arg in 'config_from_gitmodules()' * in 'read_[very_]early_config()' & 'read_protected_config()', set 'repo' to NULL (repository instances aren't available there) * in 'populate_remote_urls()', use the repo instance that has been added to the 'struct config_include_data' * in 'repo_read_config()', use the given 'repo' arg Finally, note that this patch eliminates the fallback to 'the_repository' that previously existed for the 'config_source' repo instance if it was NULL. The fallback is no longer necessary, as the 'repo' is set explicitly in all cases where it is needed. Signed-off-by: Victoria Dye <vdye@github.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'config.h')
-rw-r--r--config.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/config.h b/config.h
index 247b572b37..d1c5577589 100644
--- a/config.h
+++ b/config.h
@@ -3,6 +3,7 @@
#include "hashmap.h"
#include "string-list.h"
+#include "repository.h"
/**
@@ -49,8 +50,6 @@ const char *config_scope_name(enum config_scope scope);
struct git_config_source {
unsigned int use_stdin:1;
const char *file;
- /* The repository if blob is not NULL; leave blank for the_repository */
- struct repository *repo;
const char *blob;
enum config_scope scope;
};
@@ -196,6 +195,7 @@ void git_config(config_fn_t fn, void *);
*/
int config_with_options(config_fn_t fn, void *,
struct git_config_source *config_source,
+ struct repository *repo,
const struct config_options *opts);
/**