(command.CommandList children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:test_description) op: assign_op.Equal rhs: {(SQ <'test local clone'>)} spids: [4] ) ] ) (C {<.>} {<'./test-lib.sh'>}) (command.ShFunction name: repo_is_hardlinked body: (BraceGroup children: [ (command.AndOr ops: [Id.Op_DAmp] children: [ (command.Simple words: [ {<find>} {(DQ ($ Id.VSub_Number '$1') <'/objects'>)} {<-type>} {<f>} {<-links>} {<1>} ] redirects: [(redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<output>})] do_fork: T ) (C {<test_line_count>} {<Id.Lit_Equals '='>} {<0>} {<output>}) ] ) ] ) ) (C {<test_expect_success>} {(SQ <'preparing origin repository'>)} { (SQ <'\n'> <'\t: >file && git add . && git commit -m1 &&\n'> <'\tgit clone --bare . a.git &&\n'> <'\tgit clone --bare . x &&\n'> <'\ttest "$(cd a.git && git config --bool core.bare)" = true &&\n'> <'\ttest "$(cd x && git config --bool core.bare)" = true &&\n'> <'\tgit bundle create b1.bundle --all &&\n'> <'\tgit bundle create b2.bundle master &&\n'> <'\tmkdir dir &&\n'> <'\tcp b1.bundle dir/b3 &&\n'> <'\tcp b1.bundle b4\n'> ) } ) (C {<test_expect_success>} {(SQ <'local clone without .git suffix'>)} { (SQ <'\n'> <'\tgit clone -l -s a b &&\n'> <'\t(cd b &&\n'> <'\ttest "$(git config --bool core.bare)" = false &&\n'> <'\tgit fetch)\n'> ) } ) (C {<test_expect_success>} {(SQ <'local clone with .git suffix'>)} {(SQ <'\n'> <'\tgit clone -l -s a.git c &&\n'> <'\t(cd c && git fetch)\n'>)} ) (C {<test_expect_success>} {(SQ <'local clone from x'>)} {(SQ <'\n'> <'\tgit clone -l -s x y &&\n'> <'\t(cd y && git fetch)\n'>)} ) (C {<test_expect_success>} {(SQ <'local clone from x.git that does not exist'>)} {(SQ <'\n'> <'\ttest_must_fail git clone -l -s x.git z\n'>)} ) (C {<test_expect_success>} {(SQ <'With -no-hardlinks, local will make a copy'>)} {(SQ <'\n'> <'\tgit clone --bare --no-hardlinks x w &&\n'> <'\t! repo_is_hardlinked w\n'>)} ) (C {<test_expect_success>} {(SQ <'Even without -l, local will make a hardlink'>)} { (SQ <'\n'> <'\trm -fr w &&\n'> <'\tgit clone -l --bare x w &&\n'> <'\trepo_is_hardlinked w\n'>) } ) (C {<test_expect_success>} {(SQ <'local clone of repo with nonexistent ref in HEAD'>)} { (SQ <'\n'> <'\techo "ref: refs/heads/nonexistent" > a.git/HEAD &&\n'> <'\tgit clone a d &&\n'> <'\t(cd d &&\n'> <'\tgit fetch &&\n'> <'\ttest ! -e .git/refs/remotes/origin/HEAD)\n'> ) } ) (C {<test_expect_success>} {(SQ <'bundle clone without .bundle suffix'>)} {(SQ <'\n'> <'\tgit clone dir/b3 &&\n'> <'\t(cd b3 && git fetch)\n'>)} ) (C {<test_expect_success>} {(SQ <'bundle clone with .bundle suffix'>)} {(SQ <'\n'> <'\tgit clone b1.bundle &&\n'> <'\t(cd b1 && git fetch)\n'>)} ) (C {<test_expect_success>} {(SQ <'bundle clone from b4'>)} {(SQ <'\n'> <'\tgit clone b4 bdl &&\n'> <'\t(cd bdl && git fetch)\n'>)} ) (C {<test_expect_success>} {(SQ <'bundle clone from b4.bundle that does not exist'>)} {(SQ <'\n'> <'\ttest_must_fail git clone b4.bundle bb\n'>)} ) (C {<test_expect_success>} {(SQ <'bundle clone with nonexistent HEAD'>)} { (SQ <'\n'> <'\tgit clone b2.bundle b2 &&\n'> <'\t(cd b2 &&\n'> <'\tgit fetch &&\n'> <'\ttest_must_fail git rev-parse --verify refs/heads/master)\n'> ) } ) (C {<test_expect_success>} {(SQ <'clone empty repository'>)} { (SQ <'\n'> <'\tmkdir empty &&\n'> <'\t(cd empty &&\n'> <'\t git init &&\n'> <'\t git config receive.denyCurrentBranch warn) &&\n'> <'\tgit clone empty empty-clone &&\n'> <'\ttest_tick &&\n'> <'\t(cd empty-clone\n'> <'\t echo "content" >> foo &&\n'> <'\t git add foo &&\n'> <'\t git commit -m "Initial commit" &&\n'> <'\t git push origin master &&\n'> <'\t expected=$(git rev-parse master) &&\n'> <'\t actual=$(git --git-dir=../empty/.git rev-parse master) &&\n'> <'\t test $actual = $expected)\n'> ) } ) (C {<test_expect_success>} {(SQ <'clone empty repository, and then push should not segfault.'>)} { (SQ <'\n'> <'\trm -fr empty/ empty-clone/ &&\n'> <'\tmkdir empty &&\n'> <'\t(cd empty && git init) &&\n'> <'\tgit clone empty empty-clone &&\n'> <'\t(cd empty-clone &&\n'> <'\ttest_must_fail git push)\n'> ) } ) (C {<test_expect_success>} {(SQ <'cloning non-existent directory fails'>)} {(SQ <'\n'> <'\trm -rf does-not-exist &&\n'> <'\ttest_must_fail git clone does-not-exist\n'>)} ) (C {<test_expect_success>} {(SQ <'cloning non-git directory fails'>)} { (SQ <'\n'> <'\trm -rf not-a-git-repo not-a-git-repo-clone &&\n'> <'\tmkdir not-a-git-repo &&\n'> <'\ttest_must_fail git clone not-a-git-repo not-a-git-repo-clone\n'> ) } ) (C {<test_expect_success>} {(SQ <'cloning file:// does not hardlink'>)} { (SQ <'\n'> <'\tgit clone --bare file://"$(pwd)"/a non-local &&\n'> <'\t! repo_is_hardlinked non-local\n'> ) } ) (C {<test_expect_success>} {(SQ <'cloning a local path with --no-local does not hardlink'>)} { (SQ <'\n'> <'\tgit clone --bare --no-local a force-nonlocal &&\n'> <'\t! repo_is_hardlinked force-nonlocal\n'> ) } ) (C {<test_expect_success>} {(SQ <'cloning locally respects "-u" for fetching refs'>)} {(SQ <'\n'> <'\ttest_must_fail git clone --bare -u false a should_not_work.git\n'>)} ) (C {<test_done>}) ] )