summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarlos Martín Nieto <carlos@cmartin.tk>2011-09-12 17:25:46 +0200
committerCarlos Martín Nieto <carlos@cmartin.tk>2011-09-12 17:25:46 +0200
commitf9d4b0c39569148c1fe5a4e48c00f26325f2875f (patch)
treef96015ca8e33906603fadd527e5d3998fdaa024b /src
parent3f3f6225f8237e974b135de30eaac731c929936e (diff)
downloadlibgit2-f9d4b0c39569148c1fe5a4e48c00f26325f2875f.tar.gz
git_repository_config: open global config file automatically
If the global configuration file is missing, it is ignored. Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
Diffstat (limited to 'src')
-rw-r--r--src/repository.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/repository.c b/src/repository.c
index 1b06c4f03..db7a5df0a 100644
--- a/src/repository.c
+++ b/src/repository.c
@@ -288,7 +288,6 @@ cleanup:
int git_repository_config(
git_config **out,
git_repository *repo,
- const char *user_config_path,
const char *system_config_path)
{
char config_path[GIT_PATH_MAX];
@@ -305,10 +304,9 @@ int git_repository_config(
if (error < GIT_SUCCESS)
goto cleanup;
- if (user_config_path != NULL) {
- error = git_config_add_file_ondisk(*out, user_config_path, 2);
- if (error < GIT_SUCCESS)
- goto cleanup;
+ error = git_config_find_global(config_path);
+ if (error == GIT_SUCCESS) {
+ error = git_config_add_file_ondisk(*out, config_path, 2);
}
if (system_config_path != NULL) {