diff options
author | Kirill A. Shutemov <kirill@shutemov.name> | 2014-02-19 00:58:55 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2014-02-18 16:12:14 -0800 |
commit | 3caec73b5568341c5d8f303692423a8e9fb0cb39 (patch) | |
tree | 469a2cb5f3e8bdaf95832eaf846ba76926b8751c /t/t1305-config-include.sh | |
parent | c8985ce05360857733738561dd6cdf964470cbdf (diff) | |
download | git-3caec73b5568341c5d8f303692423a8e9fb0cb39.tar.gz |
config: teach "git config --file -" to read from the standard inputks/config-file-stdin
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-x | t/t1305-config-include.sh | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/t/t1305-config-include.sh b/t/t1305-config-include.sh index 6edd38b39a..9ba2ba11c3 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 |