(command.CommandList children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:test_description) op: assign_op.Equal rhs: {(SQ <'check that certain rev-parse options work outside repo'>)} spids: [4] ) ] ) (C {<.>} {<'./test-lib.sh'>}) (C {<test_expect_success>} {(SQ <'set up non-repo directory'>)} { (SQ <'\n'> <'\tGIT_CEILING_DIRECTORIES=$(pwd) &&\n'> <'\texport GIT_CEILING_DIRECTORIES &&\n'> <'\tmkdir non-repo &&\n'> <'\tcd non-repo &&\n'> <'\t# confirm that git does not find a repo\n'> <'\ttest_must_fail git rev-parse --git-dir\n'> ) } ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:tricky) op: assign_op.Equal rhs: { (DQ <'really tricky with '> (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\\\'>) <' and '> (word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\"'>) <' and \''> ) } spids: [40] ) ] ) (command.ShFunction name: dump_args body: (BraceGroup children: [ (command.ForEach iter_name: i iter_words: [{(DQ ($ Id.VSub_At '$@'))}] do_arg_iter: F body: (command.DoGroup children: [(C {<echo>} {(DQ <'arg: '> ($ Id.VSub_DollarName '$i'))})] ) ) ] ) ) (C {<test_expect_success>} {(SQ <'rev-parse --sq-quote'>)} { (SQ <'\n'> <'\tdump_args "$tricky" easy >expect &&\n'> <'\teval "dump_args $(git rev-parse --sq-quote "$tricky" easy)" >actual &&\n'> <'\ttest_cmp expect actual\n'> ) } ) (C {<test_expect_success>} {(SQ <'rev-parse --local-env-vars'>)} { (SQ <'\n'> <'\tgit rev-parse --local-env-vars >actual &&\n'> <'\t# we do not want to depend on the complete list here,\n'> <'\t# so just look for something plausible\n'> <'\tgrep ^GIT_DIR actual\n'> ) } ) (C {<test_expect_success>} {(SQ <'rev-parse --resolve-git-dir'>)} { (SQ <'\n'> <'\tgit init --separate-git-dir repo dir &&\n'> <'\ttest_must_fail git rev-parse --resolve-git-dir . &&\n'> <'\techo "$(pwd)/repo" >expect &&\n'> <'\tgit rev-parse --resolve-git-dir dir/.git >actual &&\n'> <'\ttest_cmp expect actual\n'> ) } ) (C {<test_done>}) ] )