(CommandList children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:test_description) op: Equal rhs: {(SQ <"checkout from unborn branch">)} spids: [4] ) ] spids: [4] ) (C {(.)} {(./test-lib.sh)}) (C {(test_expect_success)} {(SQ <setup>)} { (SQ <"\n"> <"\tmkdir parent &&\n"> <"\t(cd parent &&\n"> <"\t git init &&\n"> <"\t echo content >file &&\n"> <"\t git add file &&\n"> <"\t git commit -m base\n"> <"\t) &&\n"> <"\tgit fetch parent master:origin\n"> ) } ) (C {(test_expect_success)} {(SQ <"checkout from unborn preserves untracked files">)} { (SQ <"\n"> <"\techo precious >expect &&\n"> <"\techo precious >file &&\n"> <"\ttest_must_fail git checkout -b new origin &&\n"> <"\ttest_cmp expect file\n"> ) } ) (C {(test_expect_success)} {(SQ <"checkout from unborn preserves index contents">)} { (SQ <"\n"> <"\techo precious >expect &&\n"> <"\techo precious >file &&\n"> <"\tgit add file &&\n"> <"\ttest_must_fail git checkout -b new origin &&\n"> <"\ttest_cmp expect file &&\n"> <"\tgit show :file >file &&\n"> <"\ttest_cmp expect file\n"> ) } ) (C {(test_expect_success)} {(SQ <"checkout from unborn merges identical index contents">)} { (SQ <"\n"> <"\techo content >file &&\n"> <"\tgit add file &&\n"> <"\tgit checkout -b new origin\n"> ) } ) (C {(test_expect_success)} {(SQ <"checking out another branch from unborn state">)} { (SQ <"\n"> <"\tgit checkout --orphan newroot &&\n"> <"\tgit checkout -b anothername &&\n"> <"\ttest_must_fail git show-ref --verify refs/heads/newroot &&\n"> <"\tgit symbolic-ref HEAD >actual &&\n"> <"\techo refs/heads/anothername >expect &&\n"> <"\ttest_cmp expect actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"checking out in a newly created repo">)} { (SQ <"\n"> <"\ttest_create_repo empty &&\n"> <"\t(\n"> <"\t\tcd empty &&\n"> <"\t\tgit symbolic-ref HEAD >expect &&\n"> <"\t\ttest_must_fail git checkout &&\n"> <"\t\tgit symbolic-ref HEAD >actual &&\n"> <"\t\ttest_cmp expect actual\n"> <"\t)\n"> ) } ) (C {(test_done)}) ] )