aboutsummaryrefslogtreecommitdiff
path: root/t/t1300-repo-config.sh
diff options
context:
space:
mode:
authorKirill A. Shutemov <kirill@shutemov.name>2014-02-19 00:58:55 +0200
committerJunio C Hamano <gitster@pobox.com>2014-02-18 16:12:14 -0800
commit3caec73b5568341c5d8f303692423a8e9fb0cb39 (patch)
tree469a2cb5f3e8bdaf95832eaf846ba76926b8751c /t/t1300-repo-config.sh
parentc8985ce05360857733738561dd6cdf964470cbdf (diff)
downloadgit-3caec73b5568341c5d8f303692423a8e9fb0cb39.tar.gz
git-3caec73b5568341c5d8f303692423a8e9fb0cb39.tar.xz
config: teach "git config --file -" to read from the standard input
The patch extends git config --file interface to allow read config from stdin. Editing stdin or setting value in stdin is an error. Include by absolute path is allowed in stdin config, but not by relative path. Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t1300-repo-config.sh')
-rwxr-xr-xt/t1300-repo-config.sh17
1 files changed, 15 insertions, 2 deletions
diff --git a/t/t1300-repo-config.sh b/t/t1300-repo-config.sh
index 967359344..c9c426c27 100755
--- a/t/t1300-repo-config.sh
+++ b/t/t1300-repo-config.sh
@@ -475,15 +475,28 @@ ein.bahn=strasse
EOF
test_expect_success 'alternative GIT_CONFIG' '
- GIT_CONFIG=other-config git config -l >output &&
+ GIT_CONFIG=other-config git config --list >output &&
test_cmp expect output
'
test_expect_success 'alternative GIT_CONFIG (--file)' '
- git config --file other-config -l > output &&
+ git config --file other-config --list >output &&
test_cmp expect output
'
+test_expect_success 'alternative GIT_CONFIG (--file=-)' '
+ git config --file - --list <other-config >output &&
+ test_cmp expect output
+'
+
+test_expect_success 'setting a value in stdin is an error' '
+ test_must_fail git config --file - some.value foo
+'
+
+test_expect_success 'editing stdin is an error' '
+ test_must_fail git config --file - --edit
+'
+
test_expect_success 'refer config from subdirectory' '
mkdir x &&
(