diff options
author | Junio C Hamano <gitster@pobox.com> | 2020-09-19 00:58:06 (GMT) |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2020-09-19 00:58:06 (GMT) |
commit | 80cacaec41b0fde4900ffef5f4374a9365db0755 (patch) | |
tree | edbb800295481c48be275e8ffe056809801b5d85 /builtin | |
parent | 52bcf6e181eabe55266e6c8e85cfaf336a013f3d (diff) | |
parent | 378fe5fc3d5e415b2d7062e29bc99029dc3418d5 (diff) | |
download | git-80cacaec41b0fde4900ffef5f4374a9365db0755.zip git-80cacaec41b0fde4900ffef5f4374a9365db0755.tar.gz git-80cacaec41b0fde4900ffef5f4374a9365db0755.tar.bz2 |
Merge branch 'mt/config-fail-nongit-early'
Unlike "git config --local", "git config --worktree" did not fail
early and cleanly when started outside a git repository.
* mt/config-fail-nongit-early:
config: complain about --worktree outside of a git repo
Diffstat (limited to 'builtin')
-rw-r--r-- | builtin/config.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/builtin/config.c b/builtin/config.c index 5e39f61..53e411d 100644 --- a/builtin/config.c +++ b/builtin/config.c @@ -628,11 +628,15 @@ int cmd_config(int argc, const char **argv, const char *prefix) usage_builtin_config(); } - if (use_local_config && nongit) - die(_("--local can only be used inside a git repository")); + if (nongit) { + if (use_local_config) + die(_("--local can only be used inside a git repository")); + if (given_config_source.blob) + die(_("--blob can only be used inside a git repository")); + if (use_worktree_config) + die(_("--worktree can only be used inside a git repository")); - if (given_config_source.blob && nongit) - die(_("--blob can only be used inside a git repository")); + } if (given_config_source.file && !strcmp(given_config_source.file, "-")) { |