summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorVicent Martí <vicent@github.com>2013-04-30 03:28:56 -0700
committerVicent Martí <vicent@github.com>2013-04-30 03:28:56 -0700
commit099c1b747a15d3267dc4be533f08fe8435251708 (patch)
treecf129ba2df0a75873edc84579f72ea29044747de /src
parent4157851076d476b3b7f9a8bb9b85497517b14cdf (diff)
parent0a1755c045b930de474883eb6e7fedcc3403b494 (diff)
downloadlibgit2-099c1b747a15d3267dc4be533f08fe8435251708.tar.gz
Merge pull request #1522 from arrbee/repo-open-with-no-config
Catch issue in config set with no config file
Diffstat (limited to 'src')
-rw-r--r--src/config.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/config.c b/src/config.c
index 3c0bbe9a7..2e1268ef3 100644
--- a/src/config.c
+++ b/src/config.c
@@ -373,6 +373,12 @@ int git_config_set_string(git_config *cfg, const char *name, const char *value)
}
internal = git_vector_get(&cfg->files, 0);
+ if (!internal) {
+ /* Should we auto-vivify .git/config? Tricky from this location */
+ giterr_set(GITERR_CONFIG, "Cannot set value when no config files exist");
+ return GIT_ENOTFOUND;
+ }
+
file = internal->file;
error = file->set(file, name, value);