(CommandList children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:test_description) op: Equal rhs: {(SQ <"test refspec written by clone-command">)} spids: [4] ) ] spids: [4] ) (C {(.)} {(./test-lib.sh)}) (C {(test_expect_success)} {(SQ <setup>)} { (SQ <"\n"> <"\t# Make two branches, \"master\" and \"side\"\n"> <"\techo one >file &&\n"> <"\tgit add file &&\n"> <"\tgit commit -m one &&\n"> <"\techo two >file &&\n"> <"\tgit commit -a -m two &&\n"> <"\tgit tag two &&\n"> <"\techo three >file &&\n"> <"\tgit commit -a -m three &&\n"> <"\tgit checkout -b side &&\n"> <"\techo four >file &&\n"> <"\tgit commit -a -m four &&\n"> <"\tgit checkout master &&\n"> <"\n"> <"\t# default clone\n"> <"\tgit clone . dir_all &&\n"> <"\n"> <"\t# default --single that follows HEAD=master\n"> <"\tgit clone --single-branch . dir_master &&\n"> <"\n"> <"\t# default --single that follows HEAD=side\n"> <"\tgit checkout side &&\n"> <"\tgit clone --single-branch . dir_side &&\n"> <"\n"> <"\t# explicit --single that follows side\n"> <"\tgit checkout master &&\n"> <"\tgit clone --single-branch --branch side . dir_side2 &&\n"> <"\n"> <"\t# default --single with --mirror\n"> <"\tgit clone --single-branch --mirror . dir_mirror &&\n"> <"\n"> <"\t# default --single with --branch and --mirror\n"> <"\tgit clone --single-branch --mirror --branch side . dir_mirror_side &&\n"> <"\n"> <"\t# --single that does not know what branch to follow\n"> <"\tgit checkout two^ &&\n"> <"\tgit clone --single-branch . dir_detached &&\n"> <"\n"> <"\t# explicit --single with tag\n"> <"\tgit clone --single-branch --branch two . dir_tag &&\n"> <"\n"> <"\t# advance both \"master\" and \"side\" branches\n"> <"\tgit checkout side &&\n"> <"\techo five >file &&\n"> <"\tgit commit -a -m five &&\n"> <"\tgit checkout master &&\n"> <"\techo six >file &&\n"> <"\tgit commit -a -m six &&\n"> <"\n"> <"\t# update tag\n"> <"\tgit tag -d two && git tag two\n"> ) } ) (C {(test_expect_success)} {(SQ <"by default all branches will be kept updated">)} { (SQ <"\n"> <"\t(\n"> <"\t\tcd dir_all && git fetch &&\n"> <"\t\tgit for-each-ref refs/remotes/origin |\n"> <"\t\tsed -e \"/HEAD$/d\" \\\n"> <"\t\t -e \"s|/remotes/origin/|/heads/|\" >../actual\n"> <"\t) &&\n"> <"\t# follow both master and side\n"> <"\tgit for-each-ref refs/heads >expect &&\n"> <"\ttest_cmp expect actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"by default no tags will be kept updated">)} { (SQ <"\n"> <"\t(\n"> <"\t\tcd dir_all && git fetch &&\n"> <"\t\tgit for-each-ref refs/tags >../actual\n"> <"\t) &&\n"> <"\tgit for-each-ref refs/tags >expect &&\n"> <"\ttest_must_fail test_cmp expect actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"--single-branch while HEAD pointing at master">)} { (SQ <"\n"> <"\t(\n"> <"\t\tcd dir_master && git fetch &&\n"> <"\t\tgit for-each-ref refs/remotes/origin |\n"> <"\t\tsed -e \"/HEAD$/d\" \\\n"> <"\t\t -e \"s|/remotes/origin/|/heads/|\" >../actual\n"> <"\t) &&\n"> <"\t# only follow master\n"> <"\tgit for-each-ref refs/heads/master >expect &&\n"> <"\ttest_cmp expect actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"--single-branch while HEAD pointing at side">)} { (SQ <"\n"> <"\t(\n"> <"\t\tcd dir_side && git fetch &&\n"> <"\t\tgit for-each-ref refs/remotes/origin |\n"> <"\t\tsed -e \"/HEAD$/d\" \\\n"> <"\t\t -e \"s|/remotes/origin/|/heads/|\" >../actual\n"> <"\t) &&\n"> <"\t# only follow side\n"> <"\tgit for-each-ref refs/heads/side >expect &&\n"> <"\ttest_cmp expect actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"--single-branch with explicit --branch side">)} { (SQ <"\n"> <"\t(\n"> <"\t\tcd dir_side2 && git fetch &&\n"> <"\t\tgit for-each-ref refs/remotes/origin |\n"> <"\t\tsed -e \"/HEAD$/d\" \\\n"> <"\t\t -e \"s|/remotes/origin/|/heads/|\" >../actual\n"> <"\t) &&\n"> <"\t# only follow side\n"> <"\tgit for-each-ref refs/heads/side >expect &&\n"> <"\ttest_cmp expect actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"--single-branch with explicit --branch with tag fetches updated tag">)} { (SQ <"\n"> <"\t(\n"> <"\t\tcd dir_tag && git fetch &&\n"> <"\t\tgit for-each-ref refs/tags >../actual\n"> <"\t) &&\n"> <"\tgit for-each-ref refs/tags >expect &&\n"> <"\ttest_cmp expect actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"--single-branch with --mirror">)} { (SQ <"\n"> <"\t(\n"> <"\t\tcd dir_mirror && git fetch &&\n"> <"\t\tgit for-each-ref refs > ../actual\n"> <"\t) &&\n"> <"\tgit for-each-ref refs >expect &&\n"> <"\ttest_cmp expect actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"--single-branch with explicit --branch and --mirror">)} { (SQ <"\n"> <"\t(\n"> <"\t\tcd dir_mirror_side && git fetch &&\n"> <"\t\tgit for-each-ref refs > ../actual\n"> <"\t) &&\n"> <"\tgit for-each-ref refs >expect &&\n"> <"\ttest_cmp expect actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"--single-branch with detached">)} { (SQ <"\n"> <"\t(\n"> <"\t\tcd dir_detached && git fetch &&\n"> <"\t\tgit for-each-ref refs/remotes/origin |\n"> <"\t\tsed -e \"/HEAD$/d\" \\\n"> <"\t\t -e \"s|/remotes/origin/|/heads/|\" >../actual\n"> <"\t) &&\n"> <"\t# nothing\n"> <"\t>expect &&\n"> <"\ttest_cmp expect actual\n"> ) } ) (C {(test_done)}) ] )