(command.CommandList children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'test_description='> name:test_description) op: assign_op.Equal rhs: {(SQ <'checkout and pathspecs/refspecs ambiguities'>)} spids: [4] ) ] redirects: [] ) (C {<.>} {<'./test-lib.sh'>}) (C {<test_expect_success>} {(SQ <setup>)} { (SQ <'\n'> <'\techo hello >world &&\n'> <'\techo hello >all &&\n'> <'\tgit add all world &&\n'> <'\tgit commit -m initial &&\n'> <'\tgit branch world\n'> ) } ) (C {<test_expect_success>} {(SQ <'reference must be a tree'>)} {(SQ <'\n'> <'\ttest_must_fail git checkout $(git hash-object ./all) --\n'>)} ) (C {<test_expect_success>} {(SQ <'branch switching'>)} { (SQ <'\n'> <'\ttest "refs/heads/master" = "$(git symbolic-ref HEAD)" &&\n'> <'\tgit checkout world -- &&\n'> <'\ttest "refs/heads/world" = "$(git symbolic-ref HEAD)"\n'> ) } ) (C {<test_expect_success>} {(SQ <'checkout world from the index'>)} { (SQ <'\n'> <'\techo bye > world &&\n'> <'\tgit checkout -- world &&\n'> <'\tgit diff --exit-code --quiet\n'> ) } ) (C {<test_expect_success>} {(SQ <'non ambiguous call'>)} {(SQ <'\n'> <'\tgit checkout all\n'>)}) (C {<test_expect_success>} {(SQ <'allow the most common case'>)} { (SQ <'\n'> <'\tgit checkout world &&\n'> <'\ttest "refs/heads/world" = "$(git symbolic-ref HEAD)"\n'> ) } ) (C {<test_expect_success>} {(SQ <'check ambiguity'>)} {(SQ <'\n'> <'\ttest_must_fail git checkout world all\n'>)} ) (C {<test_expect_success>} {(SQ <'check ambiguity in subdir'>)} { (SQ <'\n'> <'\tmkdir sub &&\n'> <'\t# not ambiguous because sub/world does not exist\n'> <'\tgit -C sub checkout world ../all &&\n'> <'\techo hello >sub/world &&\n'> <'\t# ambiguous because sub/world does exist\n'> <'\ttest_must_fail git -C sub checkout world ../all\n'> ) } ) (C {<test_expect_success>} {(SQ <'disambiguate checking out from a tree-ish'>)} { (SQ <'\n'> <'\techo bye > world &&\n'> <'\tgit checkout world -- world &&\n'> <'\tgit diff --exit-code --quiet\n'> ) } ) (C {<test_expect_success>} {(SQ <'accurate error message with more than one ref'>)} { (SQ <'\n'> <'\ttest_must_fail git checkout HEAD master -- 2>actual &&\n'> <'\ttest_i18ngrep 2 actual &&\n'> <'\ttest_i18ngrep "one reference expected, 2 given" actual\n'> ) } ) (C {<test_done>}) ] )