diff options
author | Johannes Schindelin <johannes.schindelin@gmx.de> | 2016-02-24 13:48:11 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2016-02-25 10:52:32 -0800 |
commit | 638fa623d5b5fb392a062edf61ccf086d35ab26b (patch) | |
tree | 84302c056b5ea59b7e0dd1079b8dc1d14b869ab5 /builtin/config.c | |
parent | Git 2.7.2 (diff) | |
download | tgif-638fa623d5b5fb392a062edf61ccf086d35ab26b.tar.xz |
git config: report when trying to modify a non-existing repo config
It is a pilot error to call `git config section.key value` outside of
any Git worktree. The message
error: could not lock config file .git/config: No such file or
directory
is not very helpful in that situation, though. Let's print a helpful
message instead.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/config.c')
-rw-r--r-- | builtin/config.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/builtin/config.c b/builtin/config.c index adc772786a..78aab956ad 100644 --- a/builtin/config.c +++ b/builtin/config.c @@ -352,6 +352,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"); |