summaryrefslogtreecommitdiff
path: root/builtin/config.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2016-02-26 21:37:26 (GMT)
committerJunio C Hamano <gitster@pobox.com>2016-02-26 21:37:26 (GMT)
commitd3faba840e758e6b5340b59a69e919fec77ce1c3 (patch)
treef1df2fc257a55cc1d2f31f8c99a7f93904fcd0e0 /builtin/config.c
parent8ef250c55908d1c752267ea4a05e0a421a729723 (diff)
parent638fa623d5b5fb392a062edf61ccf086d35ab26b (diff)
downloadgit-d3faba840e758e6b5340b59a69e919fec77ce1c3.zip
git-d3faba840e758e6b5340b59a69e919fec77ce1c3.tar.gz
git-d3faba840e758e6b5340b59a69e919fec77ce1c3.tar.bz2
Merge branch 'js/config-set-in-non-repository'
"git config section.var value" to set a value in per-repository configuration file failed when it was run outside any repository, but didn't say the reason correctly. * js/config-set-in-non-repository: git config: report when trying to modify a non-existing repo config
Diffstat (limited to 'builtin/config.c')
-rw-r--r--builtin/config.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/builtin/config.c b/builtin/config.c
index 8602b21..ca9f834 100644
--- a/builtin/config.c
+++ b/builtin/config.c
@@ -377,6 +377,9 @@ static int get_colorbool(const char *var, int print)
static void check_write(void)
{
+ if (!given_config_source.file && !startup_info->have_repository)
+ die("not in a git directory");
+
if (given_config_source.use_stdin)
die("writing to stdin is not supported");