Merge branch 'jk/config-blob-sans-repo'

Error codepath fix.

* jk/config-blob-sans-repo:
  config: die when --blob is used outside a repository
This commit is contained in:
Junio C Hamano 2018-05-30 21:51:27 +09:00
commit b2fd659294
2 changed files with 7 additions and 0 deletions

View File

@ -602,6 +602,9 @@ int cmd_config(int argc, const char **argv, const char *prefix)
if (use_local_config && nongit)
die(_("--local 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, "-")) {
given_config_source.file = NULL;

View File

@ -73,4 +73,8 @@ test_expect_success 'can parse blob ending with CR' '
test_cmp expect actual
'
test_expect_success 'config --blob outside of a repository is an error' '
test_must_fail nongit git config --blob=foo --list
'
test_done