Skip to content

Commit b2fd659

Browse files
committed
Merge branch 'jk/config-blob-sans-repo'
Error codepath fix. * jk/config-blob-sans-repo: config: die when --blob is used outside a repository
2 parents 0821b73 + 17b8a2d commit b2fd659

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

builtin/config.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -602,6 +602,9 @@ int cmd_config(int argc, const char **argv, const char *prefix)
602602
if (use_local_config && nongit)
603603
die(_("--local can only be used inside a git repository"));
604604

605+
if (given_config_source.blob && nongit)
606+
die(_("--blob can only be used inside a git repository"));
607+
605608
if (given_config_source.file &&
606609
!strcmp(given_config_source.file, "-")) {
607610
given_config_source.file = NULL;

t/t1307-config-blob.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,4 +73,8 @@ test_expect_success 'can parse blob ending with CR' '
7373
test_cmp expect actual
7474
'
7575

76+
test_expect_success 'config --blob outside of a repository is an error' '
77+
test_must_fail nongit git config --blob=foo --list
78+
'
79+
7680
test_done

0 commit comments

Comments
 (0)