diff options
author | Patrick Steinhardt <ps@pks.im> | 2017-05-23 11:51:00 +0200 |
---|---|---|
committer | Patrick Steinhardt <ps@pks.im> | 2017-10-09 11:19:42 +0200 |
commit | 529e873cef18ec98246d32d28c7a0b0e3467fe27 (patch) | |
tree | f810490f62966f39ea9c86e041b8102956d2306f /include/git2/config.h | |
parent | d02cf564a012ea8f6d4d4fd70a3102b94058f759 (diff) | |
download | libgit2-529e873cef18ec98246d32d28c7a0b0e3467fe27.tar.gz |
config: pass repository when opening config files
Our current configuration logic is completely oblivious of any
repository, but only cares for actual file paths. Unfortunately, we are
forced to break this assumption by the introduction of conditional
includes, which are evaluated in the context of a repository. Right now,
only one conditional exists with "gitdir:" -- it will only include the
configuration if the current repository's git directory matches the
value passed to "gitdir:".
To support these conditionals, we have to break our API and make the
repository available when opening a configuration file. This commit
extends the `open` call of configuration backends to include another
repository and adjusts existing code to have it available. This includes
the user-visible functions `git_config_add_file_ondisk` and
`git_config_add_backend`.
Diffstat (limited to 'include/git2/config.h')
-rw-r--r-- | include/git2/config.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/include/git2/config.h b/include/git2/config.h index d0f1ba1b3..d812e16bd 100644 --- a/include/git2/config.h +++ b/include/git2/config.h @@ -199,6 +199,8 @@ GIT_EXTERN(int) git_config_new(git_config **out); * @param path path to the configuration file to add * @param level the priority level of the backend * @param force replace config file at the given priority level + * @param repo optional repository to allow parsing of + * conditional includes * @return 0 on success, GIT_EEXISTS when adding more than one file * for a given priority level (and force_replace set to 0), * GIT_ENOTFOUND when the file doesn't exist or error code @@ -207,6 +209,7 @@ GIT_EXTERN(int) git_config_add_file_ondisk( git_config *cfg, const char *path, git_config_level_t level, + const git_repository *repo, int force); /** |