(command.CommandList children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:test_description) op: assign_op.Equal rhs: {(SQ <'Testing multi_ack pack fetching'>)} spids: [13] ) ] ) (C {<.>} {<'./test-lib.sh'>}) (command.ShFunction name: add body: (BraceGroup children: [ (command.AndOr ops: [ Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp ] children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:name) op: assign_op.Equal rhs: {($ Id.VSub_Number '$1')} spids: [40] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:text) op: assign_op.Equal rhs: {(DQ ($ Id.VSub_At '$@'))} spids: [46] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:branch) op: assign_op.Equal rhs: { (command_sub left_token: <Id.Left_DollarParen '$('> child: (command.Pipeline children: [ (C {<echo>} {($ Id.VSub_DollarName '$name')}) (C {<sed>} {<-e>} {(SQ <'s/^\\(.\\).*$/\\1/'>)}) ] negated: F ) ) } spids: [54] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:parents) op: assign_op.Equal rhs: {(DQ )} spids: [74] ) ] ) (C {<shift>}) (command.WhileUntil keyword: <Id.KW_While while> cond: [ (command.Sentence child: (C {<test>} {($ Id.VSub_Number '$1')}) terminator: <Id.Op_Semi _> ) ] body: (command.DoGroup children: [ (command.AndOr ops: [Id.Op_DAmp] children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:parents) op: assign_op.Equal rhs: { (DQ ($ Id.VSub_DollarName '$parents') <' -p '> ($ Id.VSub_Number '$1') ) } spids: [97] ) ] ) (C {<shift>}) ] ) ] ) ) (command.Simple words: [{<echo>} {(DQ ($ Id.VSub_DollarName '$text'))}] redirects: [(redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<test.txt>})] do_fork: T ) (C {<git>} {<update-index>} {<--add>} {<test.txt>}) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:tree) op: assign_op.Equal rhs: { (command_sub left_token: <Id.Left_DollarParen '$('> child: (C {<git>} {<write-tree>}) ) } spids: [140] ) ] ) (C {<test_tick>}) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:commit) op: assign_op.Equal rhs: { (command_sub left_token: <Id.Left_DollarParen '$('> child: (command.Pipeline children: [ (C {<echo>} {(DQ ($ Id.VSub_DollarName '$text'))}) (C {<git>} {<commit-tree>} {($ Id.VSub_DollarName '$tree')} {($ Id.VSub_DollarName '$parents')} ) ] negated: F ) ) } spids: [159] ) ] ) (C {<eval>} { (DQ ($ Id.VSub_DollarName '$name') <'='> ($ Id.VSub_DollarName '$commit') <'; export '> ($ Id.VSub_DollarName '$name') ) } ) (command.Simple words: [{<echo>} {($ Id.VSub_DollarName '$commit')}] redirects: [ (redir op: <Id.Redir_Great '>'> loc: (redir_loc.Fd fd:1) arg: {<'.git/refs/heads/'> ($ Id.VSub_DollarName '$branch')} ) ] do_fork: T ) (C {<eval>} {(${ Id.VSub_Name branch) <Id.Lit_VarLike 'TIP='> ($ Id.VSub_DollarName '$commit')} ) ] ) ] ) ) (command.ShFunction name: pull_to_client body: (BraceGroup children: [ (command.AndOr ops: [Id.Op_DAmp Id.Op_DAmp Id.Op_DAmp] children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:number) op: assign_op.Equal rhs: {($ Id.VSub_Number '$1')} spids: [225] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:heads) op: assign_op.Equal rhs: {($ Id.VSub_Number '$2')} spids: [231] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:count) op: assign_op.Equal rhs: {($ Id.VSub_Number '$3')} spids: [237] ) ] ) (C {<test_expect_success>} {(DQ ($ Id.VSub_DollarName '$number') <' pull'>)} { (SQ <'\n'> <'\t\t(\n'> <'\t\t\tcd client &&\n'> <'\t\t\tgit fetch-pack -k -v .. $heads &&\n'> <'\n'> <'\t\t\tcase "$heads" in\n'> <'\t\t\t *A*)\n'> <'\t\t\t\t echo $ATIP > .git/refs/heads/A;;\n'> <'\t\t\tesac &&\n'> <'\t\t\tcase "$heads" in *B*)\n'> <'\t\t\t echo $BTIP > .git/refs/heads/B;;\n'> <'\t\t\tesac &&\n'> <'\t\t\tgit symbolic-ref HEAD refs/heads/$(echo $heads \\\n'> <'\t\t\t\t| sed -e "s/^\\(.\\).*$/\\1/") &&\n'> <'\n'> <'\t\t\tgit fsck --full &&\n'> <'\n'> <'\t\t\tmv .git/objects/pack/pack-* . &&\n'> <'\t\t\tp=$(ls -1 pack-*.pack) &&\n'> <'\t\t\tgit unpack-objects <$p &&\n'> <'\t\t\tgit fsck --full &&\n'> <'\n'> <'\t\t\tidx=$(echo pack-*.idx) &&\n'> <'\t\t\tpack_count=$(git show-index <$idx | wc -l) &&\n'> <'\t\t\ttest $pack_count = $count &&\n'> <'\t\t\trm -f pack-*\n'> <'\t\t)\n'> <'\t'> ) } ) ] ) ] ) ) (C {<test_expect_success>} {(SQ <setup>)} { (SQ <'\n'> <'\tmkdir client &&\n'> <'\t(\n'> <'\t\tcd client &&\n'> <'\t\tgit init &&\n'> <'\t\tgit config transfer.unpacklimit 0\n'> <'\t) &&\n'> <'\tadd A1 &&\n'> <'\tprev=1 &&\n'> <'\tcur=2 &&\n'> <'\twhile [ $cur -le 10 ]; do\n'> <'\t\tadd A$cur $(eval echo \\$A$prev) &&\n'> <'\t\tprev=$cur &&\n'> <'\t\tcur=$(($cur+1))\n'> <'\tdone &&\n'> <'\tadd B1 $A1 &&\n'> <'\techo $ATIP > .git/refs/heads/A &&\n'> <'\techo $BTIP > .git/refs/heads/B &&\n'> <'\tgit symbolic-ref HEAD refs/heads/B\n'> ) } ) (C {<pull_to_client>} {<1st>} {(DQ <'refs/heads/B refs/heads/A'>)} { (word_part.ArithSub anode: (arith_expr.Binary op_id: Id.Arith_Star left: {<Id.Lit_Digits 11>} right: {<Id.Lit_Digits 3>} ) ) } ) (C {<test_expect_success>} {(SQ <'post 1st pull setup'>)} { (SQ <'\n'> <'\tadd A11 $A10 &&\n'> <'\tprev=1 &&\n'> <'\tcur=2 &&\n'> <'\twhile [ $cur -le 65 ]; do\n'> <'\t\tadd B$cur $(eval echo \\$B$prev) &&\n'> <'\t\tprev=$cur &&\n'> <'\t\tcur=$(($cur+1))\n'> <'\tdone\n'> ) } ) (C {<pull_to_client>} {<2nd>} {(DQ <'refs/heads/B'>)} { (word_part.ArithSub anode: (arith_expr.Binary op_id: Id.Arith_Star left: {<Id.Lit_Digits 64>} right: {<Id.Lit_Digits 3>} ) ) } ) (C {<pull_to_client>} {<3rd>} {(DQ <'refs/heads/A'>)} { (word_part.ArithSub anode: (arith_expr.Binary op_id: Id.Arith_Star left: {<Id.Lit_Digits 1>} right: {<Id.Lit_Digits 3>} ) ) } ) (C {<test_expect_success>} {(SQ <'single branch clone'>)} {(SQ <'\n'> <'\tgit clone --single-branch "file://$(pwd)/." singlebranch\n'>)} ) (C {<test_expect_success>} {(SQ <'single branch object count'>)} { (SQ <'\n'> <'\tGIT_DIR=singlebranch/.git git count-objects -v |\n'> <'\t\tgrep "^in-pack:" > count.singlebranch &&\n'> <'\techo "in-pack: 198" >expected &&\n'> <'\ttest_cmp expected count.singlebranch\n'> ) } ) (C {<test_expect_success>} {(SQ <'single given branch clone'>)} { (SQ <'\n'> <'\tgit clone --single-branch --branch A "file://$(pwd)/." branch-a &&\n'> <'\ttest_must_fail git --git-dir=branch-a/.git rev-parse origin/B\n'> ) } ) (C {<test_expect_success>} {(SQ <'clone shallow depth 1'>)} { (SQ <'\n'> <'\tgit clone --no-single-branch --depth 1 "file://$(pwd)/." shallow0 &&\n'> <'\ttest "$(git --git-dir=shallow0/.git rev-list --count HEAD)" = 1\n'> ) } ) (C {<test_expect_success>} {(SQ <'clone shallow depth 1 with fsck'>)} { (SQ <'\n'> <'\tgit config --global fetch.fsckobjects true &&\n'> <'\tgit clone --no-single-branch --depth 1 "file://$(pwd)/." shallow0fsck &&\n'> <'\ttest "$(git --git-dir=shallow0fsck/.git rev-list --count HEAD)" = 1 &&\n'> <'\tgit config --global --unset fetch.fsckobjects\n'> ) } ) (C {<test_expect_success>} {(SQ <'clone shallow'>)} {(SQ <'\n'> <'\tgit clone --no-single-branch --depth 2 "file://$(pwd)/." shallow\n'>)} ) (C {<test_expect_success>} {(SQ <'clone shallow depth count'>)} {(SQ <'\n'> <'\ttest "$(git --git-dir=shallow/.git rev-list --count HEAD)" = 2\n'>)} ) (C {<test_expect_success>} {(SQ <'clone shallow object count'>)} { (SQ <'\n'> <'\t(\n'> <'\t\tcd shallow &&\n'> <'\t\tgit count-objects -v\n'> <'\t) > count.shallow &&\n'> <'\tgrep "^in-pack: 12" count.shallow\n'> ) } ) (C {<test_expect_success>} {(SQ <'clone shallow object count (part 2)'>)} { (SQ <'\n'> <'\tsed -e "/^in-pack:/d" -e "/^packs:/d" -e "/^size-pack:/d" \\\n'> <'\t -e "/: 0$/d" count.shallow > count_output &&\n'> <'\t! test -s count_output\n'> ) } ) (C {<test_expect_success>} {(SQ <'fsck in shallow repo'>)} {(SQ <'\n'> <'\t(\n'> <'\t\tcd shallow &&\n'> <'\t\tgit fsck --full\n'> <'\t)\n'>)} ) (C {<test_expect_success>} {(SQ <'simple fetch in shallow repo'>)} {(SQ <'\n'> <'\t(\n'> <'\t\tcd shallow &&\n'> <'\t\tgit fetch\n'> <'\t)\n'>)} ) (C {<test_expect_success>} {(SQ <'no changes expected'>)} { (SQ <'\n'> <'\t(\n'> <'\t\tcd shallow &&\n'> <'\t\tgit count-objects -v\n'> <'\t) > count.shallow.2 &&\n'> <'\tcmp count.shallow count.shallow.2\n'> ) } ) (C {<test_expect_success>} {(SQ <'fetch same depth in shallow repo'>)} {(SQ <'\n'> <'\t(\n'> <'\t\tcd shallow &&\n'> <'\t\tgit fetch --depth=2\n'> <'\t)\n'>)} ) (C {<test_expect_success>} {(SQ <'no changes expected'>)} { (SQ <'\n'> <'\t(\n'> <'\t\tcd shallow &&\n'> <'\t\tgit count-objects -v\n'> <'\t) > count.shallow.3 &&\n'> <'\tcmp count.shallow count.shallow.3\n'> ) } ) (C {<test_expect_success>} {(SQ <'add two more'>)} {(SQ <'\n'> <'\tadd B66 $B65 &&\n'> <'\tadd B67 $B66\n'>)} ) (C {<test_expect_success>} {(SQ <'pull in shallow repo'>)} {(SQ <'\n'> <'\t(\n'> <'\t\tcd shallow &&\n'> <'\t\tgit pull .. B\n'> <'\t)\n'>)} ) (C {<test_expect_success>} {(SQ <'clone shallow object count'>)} { (SQ <'\n'> <'\t(\n'> <'\t\tcd shallow &&\n'> <'\t\tgit count-objects -v\n'> <'\t) > count.shallow &&\n'> <'\tgrep "^count: 6" count.shallow\n'> ) } ) (C {<test_expect_success>} {(SQ <'add two more (part 2)'>)} {(SQ <'\n'> <'\tadd B68 $B67 &&\n'> <'\tadd B69 $B68\n'>)} ) (C {<test_expect_success>} {(SQ <'deepening pull in shallow repo'>)} {(SQ <'\n'> <'\t(\n'> <'\t\tcd shallow &&\n'> <'\t\tgit pull --depth 4 .. B\n'> <'\t)\n'>)} ) (C {<test_expect_success>} {(SQ <'clone shallow object count'>)} { (SQ <'\n'> <'\t(\n'> <'\t\tcd shallow &&\n'> <'\t\tgit count-objects -v\n'> <'\t) > count.shallow &&\n'> <'\tgrep "^count: 12" count.shallow\n'> ) } ) (C {<test_expect_success>} {(SQ <'deepening fetch in shallow repo'>)} {(SQ <'\n'> <'\t(\n'> <'\t\tcd shallow &&\n'> <'\t\tgit fetch --depth 4 .. A:A\n'> <'\t)\n'>)} ) (C {<test_expect_success>} {(SQ <'clone shallow object count'>)} { (SQ <'\n'> <'\t(\n'> <'\t\tcd shallow &&\n'> <'\t\tgit count-objects -v\n'> <'\t) > count.shallow &&\n'> <'\tgrep "^count: 18" count.shallow\n'> ) } ) (C {<test_expect_success>} {(SQ <'pull in shallow repo with missing merge base'>)} { (SQ <'\n'> <'\t(\n'> <'\t\tcd shallow &&\n'> <'\t\tgit fetch --depth 4 .. A\n'> <'\t\ttest_must_fail git merge --allow-unrelated-histories FETCH_HEAD\n'> <'\t)\n'> ) } ) (C {<test_expect_success>} {(SQ <'additional simple shallow deepenings'>)} { (SQ <'\n'> <'\t(\n'> <'\t\tcd shallow &&\n'> <'\t\tgit fetch --depth=8 &&\n'> <'\t\tgit fetch --depth=10 &&\n'> <'\t\tgit fetch --depth=11\n'> <'\t)\n'> ) } ) (C {<test_expect_success>} {(SQ <'clone shallow depth count'>)} {(SQ <'\n'> <'\ttest "$(git --git-dir=shallow/.git rev-list --count HEAD)" = 11\n'>)} ) (C {<test_expect_success>} {(SQ <'clone shallow object count'>)} { (SQ <'\n'> <'\t(\n'> <'\t\tcd shallow &&\n'> <'\t\tgit prune &&\n'> <'\t\tgit count-objects -v\n'> <'\t) > count.shallow &&\n'> <'\tgrep "^count: 54" count.shallow\n'> ) } ) (C {<test_expect_success>} {(SQ <'fetch --no-shallow on full repo'>)} {(SQ <'\n'> <'\ttest_must_fail git fetch --noshallow\n'>)} ) (C {<test_expect_success>} {(SQ <'fetch --depth --no-shallow'>)} { (SQ <'\n'> <'\t(\n'> <'\t\tcd shallow &&\n'> <'\t\ttest_must_fail git fetch --depth=1 --noshallow\n'> <'\t)\n'> ) } ) (C {<test_expect_success>} {(SQ <'turn shallow to complete repository'>)} { (SQ <'\n'> <'\t(\n'> <'\t\tcd shallow &&\n'> <'\t\tgit fetch --unshallow &&\n'> <'\t\t! test -f .git/shallow &&\n'> <'\t\tgit fsck --full\n'> <'\t)\n'> ) } ) (C {<test_expect_success>} {(SQ <'clone shallow without --no-single-branch'>)} {(SQ <'\n'> <'\tgit clone --depth 1 "file://$(pwd)/." shallow2\n'>)} ) (C {<test_expect_success>} {(SQ <'clone shallow object count'>)} { (SQ <'\n'> <'\t(\n'> <'\t\tcd shallow2 &&\n'> <'\t\tgit count-objects -v\n'> <'\t) > count.shallow2 &&\n'> <'\tgrep "^in-pack: 3" count.shallow2\n'> ) } ) (C {<test_expect_success>} {(SQ <'clone shallow with --branch'>)} {(SQ <'\n'> <'\tgit clone --depth 1 --branch A "file://$(pwd)/." shallow3\n'>)} ) (C {<test_expect_success>} {(SQ <'clone shallow object count'>)} { (SQ <'\n'> <'\techo "in-pack: 3" > count3.expected &&\n'> <'\tGIT_DIR=shallow3/.git git count-objects -v |\n'> <'\t\tgrep "^in-pack" > count3.actual &&\n'> <'\ttest_cmp count3.expected count3.actual\n'> ) } ) (C {<test_expect_success>} {(SQ <'clone shallow with detached HEAD'>)} { (SQ <'\n'> <'\tgit checkout HEAD^ &&\n'> <'\tgit clone --depth 1 "file://$(pwd)/." shallow5 &&\n'> <'\tgit checkout - &&\n'> <'\tGIT_DIR=shallow5/.git git rev-parse HEAD >actual &&\n'> <'\tgit rev-parse HEAD^ >expected &&\n'> <'\ttest_cmp expected actual\n'> ) } ) (C {<test_expect_success>} {(SQ <'shallow clone pulling tags'>)} { (SQ <'\n'> <'\tgit tag -a -m A TAGA1 A &&\n'> <'\tgit tag -a -m B TAGB1 B &&\n'> <'\tgit tag TAGA2 A &&\n'> <'\tgit tag TAGB2 B &&\n'> <'\tgit clone --depth 1 "file://$(pwd)/." shallow6 &&\n'> <'\n'> <'\tcat >taglist.expected <<\\EOF &&\n'> <'TAGB1\n'> <'TAGB2\n'> <'EOF\n'> <'\tGIT_DIR=shallow6/.git git tag -l >taglist.actual &&\n'> <'\ttest_cmp taglist.expected taglist.actual &&\n'> <'\n'> <'\techo "in-pack: 4" > count6.expected &&\n'> <'\tGIT_DIR=shallow6/.git git count-objects -v |\n'> <'\t\tgrep "^in-pack" > count6.actual &&\n'> <'\ttest_cmp count6.expected count6.actual\n'> ) } ) (C {<test_expect_success>} {(SQ <'shallow cloning single tag'>)} { (SQ <'\n'> <'\tgit clone --depth 1 --branch=TAGB1 "file://$(pwd)/." shallow7 &&\n'> <'\tcat >taglist.expected <<\\EOF &&\n'> <'TAGB1\n'> <'TAGB2\n'> <'EOF\n'> <'\tGIT_DIR=shallow7/.git git tag -l >taglist.actual &&\n'> <'\ttest_cmp taglist.expected taglist.actual &&\n'> <'\n'> <'\techo "in-pack: 4" > count7.expected &&\n'> <'\tGIT_DIR=shallow7/.git git count-objects -v |\n'> <'\t\tgrep "^in-pack" > count7.actual &&\n'> <'\ttest_cmp count7.expected count7.actual\n'> ) } ) (C {<test_expect_success>} {(SQ <'clone shallow with packed refs'>)} { (SQ <'\n'> <'\tgit pack-refs --all &&\n'> <'\tgit clone --depth 1 --branch A "file://$(pwd)/." shallow8 &&\n'> <'\techo "in-pack: 4" > count8.expected &&\n'> <'\tGIT_DIR=shallow8/.git git count-objects -v |\n'> <'\t\tgrep "^in-pack" > count8.actual &&\n'> <'\ttest_cmp count8.expected count8.actual\n'> ) } ) (C {<test_expect_success>} {(SQ <'fetch in shallow repo unreachable shallow objects'>)} { (SQ <'\n'> <'\t(\n'> <'\t\tgit clone --bare --branch B --single-branch "file://$(pwd)/." no-reflog &&\n'> <'\t\tgit clone --depth 1 "file://$(pwd)/no-reflog" shallow9 &&\n'> <'\t\tcd no-reflog &&\n'> <'\t\tgit tag -d TAGB1 TAGB2 &&\n'> <'\t\tgit update-ref refs/heads/B B~~ &&\n'> <'\t\tgit gc --prune=now &&\n'> <'\t\tcd ../shallow9 &&\n'> <'\t\tgit fetch origin &&\n'> <'\t\tgit fsck --no-dangling\n'> <'\t)\n'> ) } ) (C {<test_expect_success>} {(SQ <'fetch creating new shallow root'>)} { (SQ <'\n'> <'\t(\n'> <'\t\tgit clone "file://$(pwd)/." shallow10 &&\n'> <'\t\tgit commit --allow-empty -m empty &&\n'> <'\t\tcd shallow10 &&\n'> <'\t\tgit fetch --depth=1 --progress 2>actual &&\n'> <'\t\t# This should fetch only the empty commit, no tree or\n'> <'\t\t# blob objects\n'> <'\t\tgrep "remote: Total 1" actual\n'> <'\t)\n'> ) } ) (C {<test_expect_success>} {(SQ <'setup tests for the --stdin parameter'>)} { (SQ <'\n'> <'\tfor head in C D E F\n'> <'\tdo\n'> <'\t\tadd $head\n'> <'\tdone &&\n'> <'\tfor head in A B C D E F\n'> <'\tdo\n'> <'\t\tgit tag $head $head\n'> <'\tdone &&\n'> <'\tcat >input <<-\\EOF &&\n'> <'\trefs/heads/C\n'> <'\trefs/heads/A\n'> <'\trefs/heads/D\n'> <'\trefs/tags/C\n'> <'\trefs/heads/B\n'> <'\trefs/tags/A\n'> <'\trefs/heads/E\n'> <'\trefs/tags/B\n'> <'\trefs/tags/E\n'> <'\trefs/tags/D\n'> <'\tEOF\n'> <'\tsort <input >expect &&\n'> <'\t(\n'> <'\t\techo refs/heads/E &&\n'> <'\t\techo refs/tags/E &&\n'> <'\t\tcat input\n'> <'\t) >input.dup\n'> ) } ) (C {<test_expect_success>} {(SQ <'fetch refs from cmdline'>)} { (SQ <'\n'> <'\t(\n'> <'\t\tcd client &&\n'> <'\t\tgit fetch-pack --no-progress .. $(cat ../input)\n'> <'\t) >output &&\n'> <'\tcut -d " " -f 2 <output | sort >actual &&\n'> <'\ttest_cmp expect actual\n'> ) } ) (C {<test_expect_success>} {(SQ <'fetch refs from stdin'>)} { (SQ <'\n'> <'\t(\n'> <'\t\tcd client &&\n'> <'\t\tgit fetch-pack --stdin --no-progress .. <../input\n'> <'\t) >output &&\n'> <'\tcut -d " " -f 2 <output | sort >actual &&\n'> <'\ttest_cmp expect actual\n'> ) } ) (C {<test_expect_success>} {(SQ <'fetch mixed refs from cmdline and stdin'>)} { (SQ <'\n'> <'\t(\n'> <'\t\tcd client &&\n'> <'\t\ttail -n +5 ../input |\n'> <'\t\tgit fetch-pack --stdin --no-progress .. $(head -n 4 ../input)\n'> <'\t) >output &&\n'> <'\tcut -d " " -f 2 <output | sort >actual &&\n'> <'\ttest_cmp expect actual\n'> ) } ) (C {<test_expect_success>} {(SQ <'test duplicate refs from stdin'>)} { (SQ <'\n'> <'\t(\n'> <'\tcd client &&\n'> <'\tgit fetch-pack --stdin --no-progress .. <../input.dup\n'> <'\t) >output &&\n'> <'\tcut -d " " -f 2 <output | sort >actual &&\n'> <'\ttest_cmp expect actual\n'> ) } ) (C {<test_expect_success>} {(SQ <'set up tests of missing reference'>)} { (SQ <'\n'> <'\tcat >expect-error <<-\\EOF\n'> <'\terror: no such remote ref refs/heads/xyzzy\n'> <'\tEOF\n'> ) } ) (C {<test_expect_success>} {(SQ <'test lonely missing ref'>)} { (SQ <'\n'> <'\t(\n'> <'\t\tcd client &&\n'> <'\t\ttest_must_fail git fetch-pack --no-progress .. refs/heads/xyzzy\n'> <'\t) >/dev/null 2>error-m &&\n'> <'\ttest_cmp expect-error error-m\n'> ) } ) (C {<test_expect_success>} {(SQ <'test missing ref after existing'>)} { (SQ <'\n'> <'\t(\n'> <'\t\tcd client &&\n'> <'\t\ttest_must_fail git fetch-pack --no-progress .. refs/heads/A refs/heads/xyzzy\n'> <'\t) >/dev/null 2>error-em &&\n'> <'\ttest_cmp expect-error error-em\n'> ) } ) (C {<test_expect_success>} {(SQ <'test missing ref before existing'>)} { (SQ <'\n'> <'\t(\n'> <'\t\tcd client &&\n'> <'\t\ttest_must_fail git fetch-pack --no-progress .. refs/heads/xyzzy refs/heads/A\n'> <'\t) >/dev/null 2>error-me &&\n'> <'\ttest_cmp expect-error error-me\n'> ) } ) (C {<test_expect_success>} {(SQ <'test --all, --depth, and explicit head'>)} { (SQ <'\n'> <'\t(\n'> <'\t\tcd client &&\n'> <'\t\tgit fetch-pack --no-progress --all --depth=1 .. refs/heads/A\n'> <'\t) >out-adh 2>error-adh\n'> ) } ) (C {<test_expect_success>} {(SQ <'test --all, --depth, and explicit tag'>)} { (SQ <'\n'> <'\tgit tag OLDTAG refs/heads/B~5 &&\n'> <'\t(\n'> <'\t\tcd client &&\n'> <'\t\tgit fetch-pack --no-progress --all --depth=1 .. refs/tags/OLDTAG\n'> <'\t) >out-adt 2>error-adt\n'> ) } ) (C {<test_expect_success>} {(SQ <'shallow fetch with tags does not break the repository'>)} { (SQ <'\n'> <'\tmkdir repo1 &&\n'> <'\t(\n'> <'\t\tcd repo1 &&\n'> <'\t\tgit init &&\n'> <'\t\ttest_commit 1 &&\n'> <'\t\ttest_commit 2 &&\n'> <'\t\ttest_commit 3 &&\n'> <'\t\tmkdir repo2 &&\n'> <'\t\tcd repo2 &&\n'> <'\t\tgit init &&\n'> <'\t\tgit fetch --depth=2 ../.git master:branch &&\n'> <'\t\tgit fsck\n'> <'\t)\n'> ) } ) (C {<test_expect_success>} {(SQ <'fetch-pack can fetch a raw sha1'>)} { (SQ <'\n'> <'\tgit init hidden &&\n'> <'\t(\n'> <'\t\tcd hidden &&\n'> <'\t\ttest_commit 1 &&\n'> <'\t\ttest_commit 2 &&\n'> <'\t\tgit update-ref refs/hidden/one HEAD^ &&\n'> <'\t\tgit config transfer.hiderefs refs/hidden &&\n'> <'\t\tgit config uploadpack.allowtipsha1inwant true\n'> <'\t) &&\n'> <'\tgit fetch-pack hidden $(git -C hidden rev-parse refs/hidden/one)\n'> ) } ) (command.ShFunction name: check_prot_path body: (BraceGroup children: [ (command.AndOr ops: [Id.Op_DAmp Id.Op_DAmp] children: [ (command.Simple words: [{<cat>}] redirects: [ (redir op: <Id.Redir_Great '>'> loc: (redir_loc.Fd fd:1) arg: {<expected>} ) (redir op: <Id.Redir_DLessDash '<<-'> loc: (redir_loc.Fd fd:0) arg: (redir_param.MultiLine here_begin: {<EOF>} here_end_span_id: 1275 stdin_parts: [ <'Diag: url='> ($ Id.VSub_Number '$1') <'\n'> <'Diag: protocol='> ($ Id.VSub_Number '$2') <'\n'> <'Diag: path='> ($ Id.VSub_Number '$3') <'\n'> ] ) ) ] do_fork: T ) (command.Pipeline children: [ (C {<git>} {<fetch-pack>} {<--diag-url>} {(DQ ($ Id.VSub_Number '$1'))}) (command.Simple words: [{<grep>} {<-v>} {<Id.Lit_VarLike 'hostandport='>}] redirects: [ (redir op: <Id.Redir_Great '>'> loc: (redir_loc.Fd fd:1) arg: {<actual>} ) ] do_fork: T ) ] negated: F ) (C {<test_cmp>} {<expected>} {<actual>}) ] ) ] ) ) (command.ShFunction name: check_prot_host_port_path body: (BraceGroup children: [ (command.Case to_match: {(DQ ($ Id.VSub_Number '$2'))} arms: [ (case_arm pat_list: [{<Id.Lit_Star '*'> <ssh> <Id.Lit_Star '*'>}] action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:pp) op: assign_op.Equal rhs: {<ssh>} spids: [1333] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:uah) op: assign_op.Equal rhs: {<userandhost>} spids: [1337] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:ehost) op: assign_op.Equal rhs: { (command_sub left_token: <Id.Left_DollarParen '$('> child: (command.Pipeline children: [ (C {<echo>} {($ Id.VSub_Number '$3')}) (C {<tr>} {<-d>} {(DQ <'[]'>)}) ] negated: F ) ) } spids: [1341] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:diagport) op: assign_op.Equal rhs: {(DQ <'Diag: port='> ($ Id.VSub_Number '$4'))} spids: [1359] ) ] ) ] spids: [1327 1330 1366 -1] ) (case_arm pat_list: [{<Id.Lit_Star '*'>}] action: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:pp) op: assign_op.Equal rhs: {($ Id.VSub_DollarName '$p')} spids: [1373] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:uah) op: assign_op.Equal rhs: {<hostandport>} spids: [1377] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:ehost) op: assign_op.Equal rhs: { (command_sub left_token: <Id.Left_DollarParen '$('> child: (command.Pipeline children: [ (C {<echo>} {($ Id.VSub_Number '$3') ($ Id.VSub_Number '$4')}) (C {<sed>} {<-e>} {(DQ <'s/22'> <Id.Lit_Other '$'> <'/:22/'>)} {<-e>} {(DQ <'s/NONE//'>)} ) ] negated: F ) ) } spids: [1381] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:diagport) op: assign_op.Equal rhs: {(DQ )} spids: [1408] ) ] ) ] spids: [1369 1370 1413 -1] ) ] ) (command.AndOr ops: [Id.Op_DAmp] children: [ (command.Simple words: [{<cat>}] redirects: [ (redir op: <Id.Redir_Great '>'> loc: (redir_loc.Fd fd:1) arg: {<exp>} ) (redir op: <Id.Redir_DLessDash '<<-'> loc: (redir_loc.Fd fd:0) arg: (redir_param.MultiLine here_begin: {<EOF>} here_end_span_id: 1446 stdin_parts: [ <'Diag: url='> ($ Id.VSub_Number '$1') <'\n'> <'Diag: protocol='> ($ Id.VSub_DollarName '$pp') <'\n'> <'Diag: '> ($ Id.VSub_DollarName '$uah') <'='> ($ Id.VSub_DollarName '$ehost') <'\n'> ($ Id.VSub_DollarName '$diagport') <'\n'> <'Diag: path='> ($ Id.VSub_Number '$5') <'\n'> ] ) ) ] do_fork: T ) (command.Simple words: [{<grep>} {<-v>} {(DQ <'^'> <Id.Lit_Other '$'>)} {<exp>}] redirects: [(redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<expected>})] do_fork: T ) ] ) (command.AndOr ops: [Id.Op_DAmp] children: [ (command.Simple words: [{<git>} {<fetch-pack>} {<--diag-url>} {(DQ ($ Id.VSub_Number '$1'))}] redirects: [(redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<actual>})] do_fork: T ) (C {<test_cmp>} {<expected>} {<actual>}) ] ) ] ) ) (command.ForEach iter_name: r iter_words: [{<repo>} {<re> <Id.Lit_Colon ':'> <po>} {<'re/po'>}] do_arg_iter: F body: (command.DoGroup children: [ (command.ForEach iter_name: p iter_words: [{(DQ <'ssh+git'>)} {(DQ <'git+ssh'>)} {<git>} {<ssh>}] do_arg_iter: F body: (command.DoGroup children: [ (command.ForEach iter_name: h iter_words: [ {<host>} {<user> <Id.Lit_Splice '@host'>} {<user> <Id.Lit_Other '@'> <Id.Lit_LBracket '['> <Id.Lit_Colon ':'> <Id.Lit_Colon ':'> <1> <Id.Lit_RBracket ']'> } {<user> <Id.Lit_Other '@'> <Id.Lit_Colon ':'> <Id.Lit_Colon ':'> <1>} ] do_arg_iter: F body: (command.DoGroup children: [ (command.ForEach iter_name: c iter_words: [{(DQ )} {<Id.Lit_Colon ':'>}] do_arg_iter: F body: (command.DoGroup children: [ (C {<test_expect_success>} { (DQ <'fetch-pack --diag-url '> ($ Id.VSub_DollarName '$p') <'://'> ($ Id.VSub_DollarName '$h') ($ Id.VSub_DollarName '$c') <'/'> ($ Id.VSub_DollarName '$r') ) } {(SQ <'\n'> <'\t\t\t\t\tcheck_prot_host_port_path $p://$h/$r $p "$h" NONE "/$r"\n'> <'\t\t\t\t'>)} ) (C {<test_expect_success>} { (DQ <'fetch-pack --diag-url '> ($ Id.VSub_DollarName '$p') <'://'> ($ Id.VSub_DollarName '$h') ($ Id.VSub_DollarName '$c') <'/~'> ($ Id.VSub_DollarName '$r') ) } {(SQ <'\n'> <'\t\t\t\t\tcheck_prot_host_port_path $p://$h/~$r $p "$h" NONE "~$r"\n'> <'\t\t\t\t'>)} ) ] ) ) ] ) ) (command.ForEach iter_name: h iter_words: [ {<host>} {<User> <Id.Lit_Splice '@host'>} {<User> <Id.Lit_Other '@'> <Id.Lit_LBracket '['> <Id.Lit_Colon ':'> <Id.Lit_Colon ':'> <1> <Id.Lit_RBracket ']'> } ] do_arg_iter: F body: (command.DoGroup children: [ (C {<test_expect_success>} { (DQ <'fetch-pack --diag-url '> ($ Id.VSub_DollarName '$p') <'://'> ($ Id.VSub_DollarName '$h') <':22/'> ($ Id.VSub_DollarName '$r') ) } {(SQ <'\n'> <'\t\t\t\tcheck_prot_host_port_path $p://$h:22/$r $p "$h" 22 "/$r"\n'> <'\t\t\t'>)} ) ] ) ) ] ) ) (command.ForEach iter_name: p iter_words: [{<file>}] do_arg_iter: F body: (command.DoGroup children: [ (C {<test_expect_success>} { (DQ <'fetch-pack --diag-url '> ($ Id.VSub_DollarName '$p') <'://'> ($ Id.VSub_DollarName '$h') <'/'> ($ Id.VSub_DollarName '$r') ) } {(SQ <'\n'> <'\t\t\tcheck_prot_path $p://$h/$r $p "/$r"\n'> <'\t\t'>)} ) (C {<test_expect_success>} { (DQ <'fetch-pack --diag-url '> ($ Id.VSub_DollarName '$p') <'://'> ($ Id.VSub_DollarName '$h') <'/~'> ($ Id.VSub_DollarName '$r') ) } {(SQ <'\n'> <'\t\t\tcheck_prot_path $p://$h/~$r $p "/~$r"\n'> <'\t\t'>)} ) ] ) ) (command.ForEach iter_name: h iter_words: [ {<nohost>} {<nohost> <Id.Lit_Colon ':'> <12>} {<Id.Lit_LBracket '['> <Id.Lit_Colon ':'> <Id.Lit_Colon ':'> <1> <Id.Lit_RBracket ']'>} {<Id.Lit_LBracket '['> <Id.Lit_Colon ':'> <Id.Lit_Colon ':'> <1> <Id.Lit_RBracket ']'> <Id.Lit_Colon ':'> <23> } {<Id.Lit_LBracket '['>} {<Id.Lit_LBracket '['> <Id.Lit_Colon ':'> <aa>} ] do_arg_iter: F body: (command.DoGroup children: [ (C {<test_expect_success>} { (DQ <'fetch-pack --diag-url ./'> ($ Id.VSub_DollarName '$h') <':'> ($ Id.VSub_DollarName '$r') ) } {(SQ <'\n'> <'\t\t\tcheck_prot_path ./$h:$r $p "./$h:$r"\n'> <'\t\t'>)} ) (C {<test_expect_success>} { (DQ <'fetch-pack --diag-url ./'> ($ Id.VSub_DollarName '$p') <':'> ($ Id.VSub_DollarName '$h') <'/~'> ($ Id.VSub_DollarName '$r') ) } {(SQ <'\n'> <'\t\tcheck_prot_path ./$p:$h/~$r $p "./$p:$h/~$r"\n'> <'\t\t'>)} ) ] ) ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:p) op: assign_op.Equal rhs: {<ssh>} spids: [1814] ) ] ) (command.ForEach iter_name: h iter_words: [ {<host>} {<Id.Lit_LBracket '['> <Id.Lit_Colon ':'> <Id.Lit_Colon ':'> <1> <Id.Lit_RBracket ']'>} ] do_arg_iter: F body: (command.DoGroup children: [ (C {<test_expect_success>} { (DQ <'fetch-pack --diag-url '> ($ Id.VSub_DollarName '$h') <':'> ($ Id.VSub_DollarName '$r') ) } {(SQ <'\n'> <'\t\t\tcheck_prot_host_port_path $h:$r $p "$h" NONE "$r"\n'> <'\t\t'>)} ) (C {<test_expect_success>} { (DQ <'fetch-pack --diag-url '> ($ Id.VSub_DollarName '$h') <':/~'> ($ Id.VSub_DollarName '$r') ) } {(SQ <'\n'> <'\t\t\tcheck_prot_host_port_path $h:/~$r $p "$h" NONE "~$r"\n'> <'\t\t'>)} ) ] ) ) ] ) ) (C {<test_expect_success>} {<MINGW>} {(SQ <'fetch-pack --diag-url file://c:/repo'>)} {(SQ <'\n'> <'\tcheck_prot_path file://c:/repo file c:/repo\n'>)} ) (C {<test_expect_success>} {<MINGW>} {(SQ <'fetch-pack --diag-url c:repo'>)} {(SQ <'\n'> <'\tcheck_prot_path c:repo file c:repo\n'>)} ) (C {<test_expect_success>} {(SQ <'clone shallow since ...'>)} { (SQ <'\n'> <'\ttest_create_repo shallow-since &&\n'> <'\t(\n'> <'\tcd shallow-since &&\n'> <'\tGIT_COMMITTER_DATE="100000000 +0700" git commit --allow-empty -m one &&\n'> <'\tGIT_COMMITTER_DATE="200000000 +0700" git commit --allow-empty -m two &&\n'> <'\tGIT_COMMITTER_DATE="300000000 +0700" git commit --allow-empty -m three &&\n'> <'\tgit clone --shallow-since "300000000 +0700" "file://$(pwd)/." ../shallow11 &&\n'> <'\tgit -C ../shallow11 log --pretty=tformat:%s HEAD >actual &&\n'> <'\techo three >expected &&\n'> <'\ttest_cmp expected actual\n'> <'\t)\n'> ) } ) (C {<test_expect_success>} {(SQ <'fetch shallow since ...'>)} { (SQ <'\n'> <'\tgit -C shallow11 fetch --shallow-since "200000000 +0700" origin &&\n'> <'\tgit -C shallow11 log --pretty=tformat:%s origin/master >actual &&\n'> <'\tcat >expected <<-\\EOF &&\n'> <'\tthree\n'> <'\ttwo\n'> <'\tEOF\n'> <'\ttest_cmp expected actual\n'> ) } ) (C {<test_expect_success>} {(SQ <'shallow clone exclude tag two'>)} { (SQ <'\n'> <'\ttest_create_repo shallow-exclude &&\n'> <'\t(\n'> <'\tcd shallow-exclude &&\n'> <'\ttest_commit one &&\n'> <'\ttest_commit two &&\n'> <'\ttest_commit three &&\n'> <'\tgit clone --shallow-exclude two "file://$(pwd)/." ../shallow12 &&\n'> <'\tgit -C ../shallow12 log --pretty=tformat:%s HEAD >actual &&\n'> <'\techo three >expected &&\n'> <'\ttest_cmp expected actual\n'> <'\t)\n'> ) } ) (C {<test_expect_success>} {(SQ <'fetch exclude tag one'>)} { (SQ <'\n'> <'\tgit -C shallow12 fetch --shallow-exclude one origin &&\n'> <'\tgit -C shallow12 log --pretty=tformat:%s origin/master >actual &&\n'> <'\ttest_write_lines three two >expected &&\n'> <'\ttest_cmp expected actual\n'> ) } ) (C {<test_expect_success>} {(SQ <'fetching deepen'>)} { (SQ <'\n'> <'\ttest_create_repo shallow-deepen &&\n'> <'\t(\n'> <'\tcd shallow-deepen &&\n'> <'\ttest_commit one &&\n'> <'\ttest_commit two &&\n'> <'\ttest_commit three &&\n'> <'\tgit clone --depth 1 "file://$(pwd)/." deepen &&\n'> <'\ttest_commit four &&\n'> <'\tgit -C deepen log --pretty=tformat:%s master >actual &&\n'> <'\techo three >expected &&\n'> <'\ttest_cmp expected actual &&\n'> <'\tgit -C deepen fetch --deepen=1 &&\n'> <'\tgit -C deepen log --pretty=tformat:%s origin/master >actual &&\n'> <'\tcat >expected <<-\\EOF &&\n'> <'\tfour\n'> <'\tthree\n'> <'\ttwo\n'> <'\tEOF\n'> <'\ttest_cmp expected actual\n'> <'\t)\n'> ) } ) (C {<test_done>}) ] )