summaryrefslogtreecommitdiff
path: root/t/t1305-config-include.sh
diff options
context:
space:
mode:
authorKirill A. Shutemov <kirill@shutemov.name>2014-02-18 22:58:55 (GMT)
committerJunio C Hamano <gitster@pobox.com>2014-02-19 00:12:14 (GMT)
commit3caec73b5568341c5d8f303692423a8e9fb0cb39 (patch)
tree469a2cb5f3e8bdaf95832eaf846ba76926b8751c /t/t1305-config-include.sh
parentc8985ce05360857733738561dd6cdf964470cbdf (diff)
downloadgit-3caec73b5568341c5d8f303692423a8e9fb0cb39.zip
git-3caec73b5568341c5d8f303692423a8e9fb0cb39.tar.gz
git-3caec73b5568341c5d8f303692423a8e9fb0cb39.tar.bz2
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/t1305-config-include.sh')
-rwxr-xr-xt/t1305-config-include.sh16
1 files changed, 15 insertions, 1 deletions
diff --git a/t/t1305-config-include.sh b/t/t1305-config-include.sh
index 6edd38b..9ba2ba1 100755
--- a/t/t1305-config-include.sh
+++ b/t/t1305-config-include.sh
@@ -113,7 +113,7 @@ test_expect_success 'missing include files are ignored' '
test_expect_success 'absolute includes from command line work' '
echo "[test]one = 1" >one &&
echo 1 >expect &&
- git -c include.path="$PWD/one" config test.one >actual &&
+ git -c include.path="$(pwd)/one" config test.one >actual &&
test_cmp expect actual
'
@@ -138,6 +138,20 @@ test_expect_success 'relative includes from blobs fail' '
test_must_fail git config --blob=$blob test.one
'
+test_expect_success 'absolute includes from stdin work' '
+ echo "[test]one = 1" >one &&
+ echo 1 >expect &&
+ echo "[include]path=\"$(pwd)/one\"" |
+ git config --file - test.one >actual &&
+ test_cmp expect actual
+'
+
+test_expect_success 'relative includes from stdin line fail' '
+ echo "[test]one = 1" >one &&
+ echo "[include]path=one" |
+ test_must_fail git config --file - test.one
+'
+
test_expect_success 'include cycles are detected' '
cat >.gitconfig <<-\EOF &&
[test]value = gitconfig