(CommandList children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:test_description) op: Equal rhs: {(SQ <"git p4 options">)} spids: [4] ) ] spids: [4] ) (C {(.)} {(./lib-git-p4.sh)}) (C {(test_expect_success)} {(SQ <"start p4d">)} {(SQ <"\n"> <"\tstart_p4d\n">)}) (C {(test_expect_success)} {(SQ <"init depot">)} { (SQ <"\n"> <"\t(\n"> <"\t\tcd \"$cli\" &&\n"> <"\t\techo file1 >file1 &&\n"> <"\t\tp4 add file1 &&\n"> <"\t\tp4 submit -d \"change 1\" &&\n"> <"\t\techo file2 >file2 &&\n"> <"\t\tp4 add file2 &&\n"> <"\t\tp4 submit -d \"change 2\" &&\n"> <"\t\techo file3 >file3 &&\n"> <"\t\tp4 add file3 &&\n"> <"\t\tp4 submit -d \"change 3\"\n"> <"\t)\n"> ) } ) (C {(test_expect_success)} {(SQ <"clone no --git-dir">)} {(SQ <"\n"> <"\ttest_must_fail git p4 clone --git-dir=xx //depot\n">)} ) (C {(test_expect_success)} {(SQ <"clone --branch should checkout master">)} { (SQ <"\n"> <"\tgit p4 clone --branch=refs/remotes/p4/sb --dest=\"$git\" //depot &&\n"> <"\ttest_when_finished cleanup_git &&\n"> <"\t(\n"> <"\t\tcd \"$git\" &&\n"> <"\t\tgit rev-parse refs/remotes/p4/sb >sb &&\n"> <"\t\tgit rev-parse refs/heads/master >master &&\n"> <"\t\ttest_cmp sb master &&\n"> <"\t\tgit rev-parse HEAD >head &&\n"> <"\t\ttest_cmp sb head\n"> <"\t)\n"> ) } ) (C {(test_expect_success)} {(SQ <"sync when no master branch prints a nice error">)} { (SQ <"\n"> <"\ttest_when_finished cleanup_git &&\n"> <"\tgit p4 clone --branch=refs/remotes/p4/sb --dest=\"$git\" //depot@2 &&\n"> <"\t(\n"> <"\t\tcd \"$git\" &&\n"> <"\t\ttest_must_fail git p4 sync 2>err &&\n"> <"\t\tgrep \"Error: no branch refs/remotes/p4/master\" err\n"> <"\t)\n"> ) } ) (C {(test_expect_success)} {(SQ <"sync --branch builds the full ref name correctly">)} { (SQ <"\n"> <"\ttest_when_finished cleanup_git &&\n"> <"\t(\n"> <"\t\tcd \"$git\" &&\n"> <"\t\tgit init &&\n"> <"\n"> <"\t\tgit p4 sync --branch=b1 //depot &&\n"> <"\t\tgit rev-parse --verify refs/remotes/p4/b1 &&\n"> <"\t\tgit p4 sync --branch=p4/b2 //depot &&\n"> <"\t\tgit rev-parse --verify refs/remotes/p4/b2 &&\n"> <"\n"> <"\t\tgit p4 sync --import-local --branch=h1 //depot &&\n"> <"\t\tgit rev-parse --verify refs/heads/p4/h1 &&\n"> <"\t\tgit p4 sync --import-local --branch=p4/h2 //depot &&\n"> <"\t\tgit rev-parse --verify refs/heads/p4/h2 &&\n"> <"\n"> <"\t\tgit p4 sync --branch=refs/stuff //depot &&\n"> <"\t\tgit rev-parse --verify refs/stuff\n"> <"\t)\n"> ) } ) (C {(test_expect_success)} {(SQ <"sync when two branches but no master should noop">)} { (SQ <"\n"> <"\ttest_when_finished cleanup_git &&\n"> <"\t(\n"> <"\t\tcd \"$git\" &&\n"> <"\t\tgit init &&\n"> <"\t\tgit p4 sync --branch=refs/remotes/p4/b1 //depot@2 &&\n"> <"\t\tgit p4 sync --branch=refs/remotes/p4/b2 //depot@2 &&\n"> <"\t\tgit p4 sync &&\n"> <"\t\tgit show -s --format=%s refs/remotes/p4/b1 >show &&\n"> <"\t\tgrep \"Initial import\" show &&\n"> <"\t\tgit show -s --format=%s refs/remotes/p4/b2 >show &&\n"> <"\t\tgrep \"Initial import\" show\n"> <"\t)\n"> ) } ) (C {(test_expect_success)} {(SQ <"sync --branch updates specific branch, no detection">)} { (SQ <"\n"> <"\ttest_when_finished cleanup_git &&\n"> <"\t(\n"> <"\t\tcd \"$git\" &&\n"> <"\t\tgit init &&\n"> <"\t\tgit p4 sync --branch=b1 //depot@2 &&\n"> <"\t\tgit p4 sync --branch=b2 //depot@2 &&\n"> <"\t\tgit p4 sync --branch=b2 &&\n"> <"\t\tgit show -s --format=%s refs/remotes/p4/b1 >show &&\n"> <"\t\tgrep \"Initial import\" show &&\n"> <"\t\tgit show -s --format=%s refs/remotes/p4/b2 >show &&\n"> <"\t\tgrep \"change 3\" show\n"> <"\t)\n"> ) } ) (C {(test_expect_success)} {(SQ <"clone creates HEAD symbolic reference">)} { (SQ <"\n"> <"\tgit p4 clone --dest=\"$git\" //depot &&\n"> <"\ttest_when_finished cleanup_git &&\n"> <"\t(\n"> <"\t\tcd \"$git\" &&\n"> <"\t\tgit rev-parse --verify refs/remotes/p4/master >master &&\n"> <"\t\tgit rev-parse --verify p4 >p4 &&\n"> <"\t\ttest_cmp master p4\n"> <"\t)\n"> ) } ) (C {(test_expect_success)} {(SQ <"clone --branch creates HEAD symbolic reference">)} { (SQ <"\n"> <"\tgit p4 clone --branch=refs/remotes/p4/sb --dest=\"$git\" //depot &&\n"> <"\ttest_when_finished cleanup_git &&\n"> <"\t(\n"> <"\t\tcd \"$git\" &&\n"> <"\t\tgit rev-parse --verify refs/remotes/p4/sb >sb &&\n"> <"\t\tgit rev-parse --verify p4 >p4 &&\n"> <"\t\ttest_cmp sb p4\n"> <"\t)\n"> ) } ) (C {(test_expect_success)} {(SQ <"clone --changesfile">)} { (SQ <"\n"> <"\ttest_when_finished \"rm cf\" &&\n"> <"\tprintf \"1\\n3\\n\" >cf &&\n"> <"\tgit p4 clone --changesfile=\"$TRASH_DIRECTORY/cf\" --dest=\"$git\" //depot &&\n"> <"\ttest_when_finished cleanup_git &&\n"> <"\t(\n"> <"\t\tcd \"$git\" &&\n"> <"\t\tgit log --oneline p4/master >lines &&\n"> <"\t\ttest_line_count = 2 lines\n"> <"\t\ttest_path_is_file file1 &&\n"> <"\t\ttest_path_is_missing file2 &&\n"> <"\t\ttest_path_is_file file3\n"> <"\t)\n"> ) } ) (C {(test_expect_success)} {(SQ <"clone --changesfile, @all">)} { (SQ <"\n"> <"\ttest_when_finished \"rm cf\" &&\n"> <"\tprintf \"1\\n3\\n\" >cf &&\n"> < "\ttest_must_fail git p4 clone --changesfile=\"$TRASH_DIRECTORY/cf\" --dest=\"$git\" //depot@all\n" > ) } ) (C {(test_expect_success)} {(SQ <"clone/sync --import-local">)} { (SQ <"\n"> <"\tgit p4 clone --import-local --dest=\"$git\" //depot@1,2 &&\n"> <"\ttest_when_finished cleanup_git &&\n"> <"\t(\n"> <"\t\tcd \"$git\" &&\n"> <"\t\tgit log --oneline refs/heads/master >lines &&\n"> <"\t\ttest_line_count = 2 lines &&\n"> <"\t\tgit log --oneline refs/heads/p4/master >lines &&\n"> <"\t\ttest_line_count = 2 lines &&\n"> <"\t\ttest_must_fail git p4 sync &&\n"> <"\n"> <"\t\tgit p4 sync --import-local &&\n"> <"\t\tgit log --oneline refs/heads/master >lines &&\n"> <"\t\ttest_line_count = 2 lines &&\n"> <"\t\tgit log --oneline refs/heads/p4/master >lines &&\n"> <"\t\ttest_line_count = 3 lines\n"> <"\t)\n"> ) } ) (C {(test_expect_success)} {(SQ <"clone --max-changes">)} { (SQ <"\n"> <"\tgit p4 clone --dest=\"$git\" --max-changes 2 //depot@all &&\n"> <"\ttest_when_finished cleanup_git &&\n"> <"\t(\n"> <"\t\tcd \"$git\" &&\n"> <"\t\tgit log --oneline refs/heads/master >lines &&\n"> <"\t\ttest_line_count = 2 lines\n"> <"\t)\n"> ) } ) (C {(test_expect_success)} {(SQ <"clone --keep-path">)} { (SQ <"\n"> <"\t(\n"> <"\t\tcd \"$cli\" &&\n"> <"\t\tmkdir -p sub/dir &&\n"> <"\t\techo f4 >sub/dir/f4 &&\n"> <"\t\tp4 add sub/dir/f4 &&\n"> <"\t\tp4 submit -d \"change 4\"\n"> <"\t) &&\n"> <"\tgit p4 clone --dest=\"$git\" --keep-path //depot/sub/dir@all &&\n"> <"\ttest_when_finished cleanup_git &&\n"> <"\t(\n"> <"\t\tcd \"$git\" &&\n"> <"\t\ttest_path_is_missing f4 &&\n"> <"\t\ttest_path_is_file sub/dir/f4\n"> <"\t) &&\n"> <"\tcleanup_git &&\n"> <"\tgit p4 clone --dest=\"$git\" //depot/sub/dir@all &&\n"> <"\t(\n"> <"\t\tcd \"$git\" &&\n"> <"\t\ttest_path_is_file f4 &&\n"> <"\t\ttest_path_is_missing sub/dir/f4\n"> <"\t)\n"> ) } ) (C {(test_expect_success)} {(SQ <"clone --use-client-spec">)} { (SQ <"\n"> <"\t(\n"> <"\t\t# big usage message\n"> <"\t\texec >/dev/null &&\n"> <"\t\ttest_must_fail git p4 clone --dest=\"$git\" --use-client-spec\n"> <"\t) &&\n"> <"\t# build a different client\n"> <"\tcli2=\"$TRASH_DIRECTORY/cli2\" &&\n"> <"\tmkdir -p \"$cli2\" &&\n"> <"\ttest_when_finished \"rmdir \\\"$cli2\\\"\" &&\n"> <"\ttest_when_finished cleanup_git &&\n"> <"\t(\n"> <"\t\t# group P4CLIENT and cli changes in a sub-shell\n"> <"\t\tP4CLIENT=client2 &&\n"> <"\t\tcli=\"$cli2\" &&\n"> <"\t\tclient_view \"//depot/sub/... //client2/bus/...\" &&\n"> <"\t\tgit p4 clone --dest=\"$git\" --use-client-spec //depot/... &&\n"> <"\t\t(\n"> <"\t\t\tcd \"$git\" &&\n"> <"\t\t\ttest_path_is_file bus/dir/f4 &&\n"> <"\t\t\ttest_path_is_missing file1\n"> <"\t\t) &&\n"> <"\t\tcleanup_git &&\n"> <"\t\t# same thing again, this time with variable instead of option\n"> <"\t\t(\n"> <"\t\t\tcd \"$git\" &&\n"> <"\t\t\tgit init &&\n"> <"\t\t\tgit config git-p4.useClientSpec true &&\n"> <"\t\t\tgit p4 sync //depot/... &&\n"> <"\t\t\tgit checkout -b master p4/master &&\n"> <"\t\t\ttest_path_is_file bus/dir/f4 &&\n"> <"\t\t\ttest_path_is_missing file1\n"> <"\t\t)\n"> <"\t)\n"> ) } ) (C {(test_expect_success)} {(SQ <"submit works with no p4/master">)} { (SQ <"\n"> <"\ttest_when_finished cleanup_git &&\n"> <"\tgit p4 clone --branch=b1 //depot@1,2 --destination=\"$git\" &&\n"> <"\t(\n"> <"\t\tcd \"$git\" &&\n"> <"\t\ttest_commit submit-1-branch &&\n"> <"\t\tgit config git-p4.skipSubmitEdit true &&\n"> <"\t\tgit p4 submit --branch=b1\n"> <"\t)\n"> ) } ) (C {(test_expect_success)} {(SQ <"submit works with two branches">)} { (SQ <"\n"> <"\ttest_when_finished cleanup_git &&\n"> <"\tgit p4 clone --branch=b1 //depot@1,2 --destination=\"$git\" &&\n"> <"\t(\n"> <"\t\tcd \"$git\" &&\n"> <"\t\tgit p4 sync --branch=b2 //depot@1,3 &&\n"> <"\t\ttest_commit submit-2-branches &&\n"> <"\t\tgit config git-p4.skipSubmitEdit true &&\n"> <"\t\tgit p4 submit\n"> <"\t)\n"> ) } ) (C {(test_expect_success)} {(SQ <"kill p4d">)} {(SQ <"\n"> <"\tkill_p4d\n">)}) (C {(test_done)}) ] )