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:
@ -602,6 +602,9 @@ int cmd_config(int argc, const char **argv, const char *prefix)
|
|||||||
if (use_local_config && nongit)
|
if (use_local_config && nongit)
|
||||||
die(_("--local can only be used inside a git repository"));
|
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 &&
|
if (given_config_source.file &&
|
||||||
!strcmp(given_config_source.file, "-")) {
|
!strcmp(given_config_source.file, "-")) {
|
||||||
given_config_source.file = NULL;
|
given_config_source.file = NULL;
|
||||||
|
@ -73,4 +73,8 @@ test_expect_success 'can parse blob ending with CR' '
|
|||||||
test_cmp expect actual
|
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
|
test_done
|
||||||
|
Reference in New Issue
Block a user