summaryrefslogtreecommitdiff
path: root/src/config.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/config.c')
-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);