summaryrefslogtreecommitdiff
path: root/repository.h
diff options
context:
space:
mode:
authorBrandon Williams <bmwill@google.com>2017-06-22 18:43:42 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-06-24 01:24:34 (GMT)
commit3b256228a66f8587661481ef3e08259864f3ba2a (patch)
tree48cfbc45513a2a89479c3a39b8f1d76e13135c04 /repository.h
parentb42b0c09199db794b2a34ae9ce293d6711fb6a4f (diff)
downloadgit-3b256228a66f8587661481ef3e08259864f3ba2a.zip
git-3b256228a66f8587661481ef3e08259864f3ba2a.tar.gz
git-3b256228a66f8587661481ef3e08259864f3ba2a.tar.bz2
config: read config from a repository object
Teach the config machinery to read config information from a repository object. This involves storing a 'struct config_set' inside the repository object and adding a number of functions (repo_config*) to be able to query a repository's config. The current config API enables lazy-loading of the config. This means that when 'git_config_get_int()' is called, if the_config_set hasn't been populated yet, then it will be populated and properly initialized by reading the necessary config files (system wide .gitconfig, user's home .gitconfig, and the repository's config). To maintain this paradigm, the new API to read from a repository object's config will also perform this lazy-initialization. Since both APIs (git_config_get* and repo_config_get*) have the same semantics we can migrate the default config to be stored within 'the_repository' and just have the 'git_config_get*' family of functions redirect to the 'repo_config_get*' functions. Signed-off-by: Brandon Williams <bmwill@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'repository.h')
-rw-r--r--repository.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/repository.h b/repository.h
index 0a1db96..8ae5e86 100644
--- a/repository.h
+++ b/repository.h
@@ -1,6 +1,8 @@
#ifndef REPOSITORY_H
#define REPOSITORY_H
+struct config_set;
+
struct repository {
/* Environment */
/*
@@ -39,6 +41,14 @@ struct repository {
*/
char *worktree;
+ /* Subsystems */
+ /*
+ * Repository's config which contains key-value pairs from the usual
+ * set of config files (i.e. repo specific .git/config, user wide
+ * ~/.gitconfig, XDG config file and the global /etc/gitconfig)
+ */
+ struct config_set *config;
+
/* Configurations */
/*
* Bit used during initialization to indicate if repository state (like