summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorLars Schneider <larsxschneider@gmail.com>2016-02-19 09:16:01 (GMT)
committerJunio C Hamano <gitster@pobox.com>2016-02-22 17:36:33 (GMT)
commit473166b99078a2724b4fcda11a6a5327b9af60da (patch)
treed20463aea79f73f32735816143441b67e7eca6a5 /t
parent7454ee3c623a6788d91fd3c97af134de33996cfa (diff)
downloadgit-473166b99078a2724b4fcda11a6a5327b9af60da.zip
git-473166b99078a2724b4fcda11a6a5327b9af60da.tar.gz
git-473166b99078a2724b4fcda11a6a5327b9af60da.tar.bz2
config: add 'origin_type' to config_source struct
Use the config origin_type to print more detailed error messages that inform the user about the origin of a config error (file, stdin, blob). Helped-by: Ramsay Jones <ramsay@ramsayjones.plus.com> Signed-off-by: Lars Schneider <larsxschneider@gmail.com> Acked-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rwxr-xr-xt/t1300-repo-config.sh8
-rwxr-xr-xt/t1308-config-set.sh4
2 files changed, 9 insertions, 3 deletions
diff --git a/t/t1300-repo-config.sh b/t/t1300-repo-config.sh
index 1782add..b9d9398 100755
--- a/t/t1300-repo-config.sh
+++ b/t/t1300-repo-config.sh
@@ -700,12 +700,18 @@ test_expect_success 'invalid unit' '
git config aninvalid.unit >actual &&
test_cmp expect actual &&
cat >expect <<-\EOF &&
- fatal: bad numeric config value '\''1auto'\'' for '\''aninvalid.unit'\'' in .git/config: invalid unit
+ fatal: bad numeric config value '\''1auto'\'' for '\''aninvalid.unit'\'' in file .git/config: invalid unit
EOF
test_must_fail git config --int --get aninvalid.unit 2>actual &&
test_i18ncmp expect actual
'
+test_expect_success 'invalid stdin config' '
+ echo "fatal: bad config line 1 in standard input " >expect &&
+ echo "[broken" | test_must_fail git config --list --file - >output 2>&1 &&
+ test_cmp expect output
+'
+
cat > expect << EOF
true
false
diff --git a/t/t1308-config-set.sh b/t/t1308-config-set.sh
index 91235b7..82f82a1 100755
--- a/t/t1308-config-set.sh
+++ b/t/t1308-config-set.sh
@@ -195,14 +195,14 @@ test_expect_success 'proper error on error in default config files' '
cp .git/config .git/config.old &&
test_when_finished "mv .git/config.old .git/config" &&
echo "[" >>.git/config &&
- echo "fatal: bad config file line 34 in .git/config" >expect &&
+ echo "fatal: bad config line 34 in file .git/config" >expect &&
test_expect_code 128 test-config get_value foo.bar 2>actual &&
test_cmp expect actual
'
test_expect_success 'proper error on error in custom config files' '
echo "[" >>syntax-error &&
- echo "fatal: bad config file line 1 in syntax-error" >expect &&
+ echo "fatal: bad config line 1 in file syntax-error" >expect &&
test_expect_code 128 test-config configset_get_value foo.bar syntax-error 2>actual &&
test_cmp expect actual
'