(CommandList children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:test_description spids:[4]) op: Equal rhs: {(SQ <'test config file include directives'>)} spids: [4] ) ] spids: [4] ) (C {(.)} {(./test-lib.sh)}) (C {(test_expect_success)} {(SQ <'include file by absolute path'>)} { (SQ <'\n'> <'\techo "[test]one = 1" >one &&\n'> <'\techo "[include]path = \\"$(pwd)/one\\"" >.gitconfig &&\n'> <'\techo 1 >expect &&\n'> <'\tgit config test.one >actual &&\n'> <'\ttest_cmp expect actual\n'> ) } ) (C {(test_expect_success)} {(SQ <'include file by relative path'>)} { (SQ <'\n'> <'\techo "[test]one = 1" >one &&\n'> <'\techo "[include]path = one" >.gitconfig &&\n'> <'\techo 1 >expect &&\n'> <'\tgit config test.one >actual &&\n'> <'\ttest_cmp expect actual\n'> ) } ) (C {(test_expect_success)} {(SQ <'chained relative paths'>)} { (SQ <'\n'> <'\tmkdir subdir &&\n'> <'\techo "[test]three = 3" >subdir/three &&\n'> <'\techo "[include]path = three" >subdir/two &&\n'> <'\techo "[include]path = subdir/two" >.gitconfig &&\n'> <'\techo 3 >expect &&\n'> <'\tgit config test.three >actual &&\n'> <'\ttest_cmp expect actual\n'> ) } ) (C {(test_expect_success)} {(SQ <'include paths get tilde-expansion'>)} { (SQ <'\n'> <'\techo "[test]one = 1" >one &&\n'> <'\techo "[include]path = ~/one" >.gitconfig &&\n'> <'\techo 1 >expect &&\n'> <'\tgit config test.one >actual &&\n'> <'\ttest_cmp expect actual\n'> ) } ) (C {(test_expect_success)} {(SQ <'include options can still be examined'>)} { (SQ <'\n'> <'\techo "[test]one = 1" >one &&\n'> <'\techo "[include]path = one" >.gitconfig &&\n'> <'\techo one >expect &&\n'> <'\tgit config include.path >actual &&\n'> <'\ttest_cmp expect actual\n'> ) } ) (C {(test_expect_success)} {(SQ <'listing includes option and expansion'>)} { (SQ <'\n'> <'\techo "[test]one = 1" >one &&\n'> <'\techo "[include]path = one" >.gitconfig &&\n'> <'\tcat >expect <<-\\EOF &&\n'> <'\tinclude.path=one\n'> <'\ttest.one=1\n'> <'\tEOF\n'> <'\tgit config --list >actual.full &&\n'> <'\tgrep -v ^core actual.full >actual &&\n'> <'\ttest_cmp expect actual\n'> ) } ) (C {(test_expect_success)} {(SQ <'single file lookup does not expand includes by default'>)} { (SQ <'\n'> <'\techo "[test]one = 1" >one &&\n'> <'\techo "[include]path = one" >.gitconfig &&\n'> <'\ttest_must_fail git config -f .gitconfig test.one &&\n'> <'\ttest_must_fail git config --global test.one &&\n'> <'\techo 1 >expect &&\n'> <'\tgit config --includes -f .gitconfig test.one >actual &&\n'> <'\ttest_cmp expect actual\n'> ) } ) (C {(test_expect_success)} {(SQ <'single file list does not expand includes by default'>)} { (SQ <'\n'> <'\techo "[test]one = 1" >one &&\n'> <'\techo "[include]path = one" >.gitconfig &&\n'> <'\techo "include.path=one" >expect &&\n'> <'\tgit config -f .gitconfig --list >actual &&\n'> <'\ttest_cmp expect actual\n'> ) } ) (C {(test_expect_success)} {(SQ <'writing config file does not expand includes'>)} { (SQ <'\n'> <'\techo "[test]one = 1" >one &&\n'> <'\techo "[include]path = one" >.gitconfig &&\n'> <'\tgit config test.two 2 &&\n'> <'\techo 2 >expect &&\n'> <'\tgit config --no-includes test.two >actual &&\n'> <'\ttest_cmp expect actual &&\n'> <'\ttest_must_fail git config --no-includes test.one\n'> ) } ) (C {(test_expect_success)} {(SQ <'config modification does not affect includes'>)} { (SQ <'\n'> <'\techo "[test]one = 1" >one &&\n'> <'\techo "[include]path = one" >.gitconfig &&\n'> <'\tgit config test.one 2 &&\n'> <'\techo 1 >expect &&\n'> <'\tgit config -f one test.one >actual &&\n'> <'\ttest_cmp expect actual &&\n'> <'\tcat >expect <<-\\EOF &&\n'> <'\t1\n'> <'\t2\n'> <'\tEOF\n'> <'\tgit config --get-all test.one >actual &&\n'> <'\ttest_cmp expect actual\n'> ) } ) (C {(test_expect_success)} {(SQ <'missing include files are ignored'>)} { (SQ <'\n'> <'\tcat >.gitconfig <<-\\EOF &&\n'> <'\t[include]path = foo\n'> <'\t[test]value = yes\n'> <'\tEOF\n'> <'\techo yes >expect &&\n'> <'\tgit config test.value >actual &&\n'> <'\ttest_cmp expect actual\n'> ) } ) (C {(test_expect_success)} {(SQ <'absolute includes from command line work'>)} { (SQ <'\n'> <'\techo "[test]one = 1" >one &&\n'> <'\techo 1 >expect &&\n'> <'\tgit -c include.path="$(pwd)/one" config test.one >actual &&\n'> <'\ttest_cmp expect actual\n'> ) } ) (C {(test_expect_success)} {(SQ <'relative includes from command line fail'>)} { (SQ <'\n'> <'\techo "[test]one = 1" >one &&\n'> <'\ttest_must_fail git -c include.path=one config test.one\n'> ) } ) (C {(test_expect_success)} {(SQ <'absolute includes from blobs work'>)} { (SQ <'\n'> <'\techo "[test]one = 1" >one &&\n'> <'\techo "[include]path=$(pwd)/one" >blob &&\n'> <'\tblob=$(git hash-object -w blob) &&\n'> <'\techo 1 >expect &&\n'> <'\tgit config --blob=$blob test.one >actual &&\n'> <'\ttest_cmp expect actual\n'> ) } ) (C {(test_expect_success)} {(SQ <'relative includes from blobs fail'>)} { (SQ <'\n'> <'\techo "[test]one = 1" >one &&\n'> <'\techo "[include]path=one" >blob &&\n'> <'\tblob=$(git hash-object -w blob) &&\n'> <'\ttest_must_fail git config --blob=$blob test.one\n'> ) } ) (C {(test_expect_success)} {(SQ <'absolute includes from stdin work'>)} { (SQ <'\n'> <'\techo "[test]one = 1" >one &&\n'> <'\techo 1 >expect &&\n'> <'\techo "[include]path=\\"$(pwd)/one\\"" |\n'> <'\tgit config --file - test.one >actual &&\n'> <'\ttest_cmp expect actual\n'> ) } ) (C {(test_expect_success)} {(SQ <'relative includes from stdin line fail'>)} { (SQ <'\n'> <'\techo "[test]one = 1" >one &&\n'> <'\techo "[include]path=one" |\n'> <'\ttest_must_fail git config --file - test.one\n'> ) } ) (C {(test_expect_success)} {(SQ <'include cycles are detected'>)} { (SQ <'\n'> <'\tcat >.gitconfig <<-\\EOF &&\n'> <'\t[test]value = gitconfig\n'> <'\t[include]path = cycle\n'> <'\tEOF\n'> <'\tcat >cycle <<-\\EOF &&\n'> <'\t[test]value = cycle\n'> <'\t[include]path = .gitconfig\n'> <'\tEOF\n'> <'\tcat >expect <<-\\EOF &&\n'> <'\tgitconfig\n'> <'\tcycle\n'> <'\tEOF\n'> <'\ttest_must_fail git config --get-all test.value 2>stderr &&\n'> <'\tgrep "exceeded maximum include depth" stderr\n'> ) } ) (C {(test_done)}) ] )