(CommandList children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:test_description) op: Equal rhs: {(SQ <'Testing multi_ack pack fetching'>)} spids: [13] ) ] spids: [13] ) (C {(.)} {(./test-lib.sh)}) (FuncDef name: add body: (BraceGroup children: [ (AndOr children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:name) op: Equal rhs: {($ VSub_Number '$1')} spids: [40] ) ] spids: [40] ) (AndOr children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:text) op: Equal rhs: {(DQ ($ VSub_At '$@'))} spids: [46] ) ] spids: [46] ) (AndOr children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:branch) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (C {(echo)} {($ VSub_Name '$name')}) (C {(sed)} {(-e)} {(SQ <'s/^\\(.\\).*$/\\1/'>)}) ] negated: False ) ] ) left_token: <Left_CommandSub '$('> spids: [55 69] ) } spids: [54] ) ] spids: [54] ) (AndOr children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:parents) op: Equal rhs: {(DQ )} spids: [74] ) ] spids: [74] ) (AndOr children: [ (C {(shift)}) (AndOr children: [ (While cond: [ (Sentence child: (C {(test)} {($ VSub_Number '$1')}) terminator: <Op_Semi ';'> ) ] body: (DoGroup children: [ (AndOr children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:parents) op: Equal rhs: { (DQ ($ VSub_Name '$parents') (' -p ') ($ VSub_Number '$1') ) } spids: [97] ) ] spids: [97] ) (C {(shift)}) ] op_id: Op_DAmp ) ] spids: [94 110] ) ) (AndOr children: [ (SimpleCommand words: [{(echo)} {(DQ ($ VSub_Name '$text'))}] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {(test.txt)} spids: [122] ) ] ) (AndOr children: [ (C {(git)} {(update-index)} {(--add)} {(test.txt)}) (AndOr children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:tree) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [(C {(git)} {(write-tree)})] ) left_token: <Left_CommandSub '$('> spids: [141 145] ) } spids: [140] ) ] spids: [140] ) (AndOr children: [ (C {(test_tick)}) (AndOr children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:commit) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (C {(echo)} { (DQ ($ VSub_Name '$text' ) ) } ) (C {(git)} {(commit-tree)} {($ VSub_Name '$tree')} {($ VSub_Name '$parents')} ) ] negated: False ) ] ) left_token: <Left_CommandSub '$('> spids: [160 176] ) } spids: [159] ) ] spids: [159] ) (AndOr children: [ (C {(eval)} { (DQ ($ VSub_Name '$name') ('=') ($ VSub_Name '$commit') ('; export ') ($ VSub_Name '$name') ) } ) (AndOr children: [ (SimpleCommand words: [ {(echo)} {($ VSub_Name '$commit')} ] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {(.git/refs/heads/) ($ VSub_Name '$branch') } spids: [198] ) ] ) (C {(eval)} {(${ VSub_Name branch) (Lit_VarLike 'TIP=') ($ VSub_Name '$commit') } ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] spids: [37] ) spids: [32 36] ) (FuncDef name: pull_to_client body: (BraceGroup children: [ (AndOr children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:number) op: Equal rhs: {($ VSub_Number '$1')} spids: [225] ) ] spids: [225] ) (AndOr children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:heads) op: Equal rhs: {($ VSub_Number '$2')} spids: [231] ) ] spids: [231] ) (AndOr children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:count) op: Equal rhs: {($ VSub_Number '$3')} spids: [237] ) ] spids: [237] ) (C {(test_expect_success)} {(DQ ($ VSub_Name '$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'> ) } ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] spids: [222] ) spids: [217 221] ) (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'))} { (ArithSubPart anode: (ArithBinary op_id: Arith_Star left: (ArithWord w:{(Lit_Digits 11)}) right: (ArithWord w:{(Lit_Digits 3)}) ) spids: [339 344] ) } ) (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))} { (ArithSubPart anode: (ArithBinary op_id: Arith_Star left: (ArithWord w:{(Lit_Digits 64)}) right: (ArithWord w:{(Lit_Digits 3)}) ) spids: [374 379] ) } ) (C {(pull_to_client)} {(3rd)} {(DQ (refs/heads/A))} { (ArithSubPart anode: (ArithBinary op_id: Arith_Star left: (ArithWord w:{(Lit_Digits 1)}) right: (ArithWord w:{(Lit_Digits 3)}) ) spids: [390 395] ) } ) (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'> ) } ) (FuncDef name: check_prot_path body: (BraceGroup children: [ (AndOr children: [ (SimpleCommand words: [{(cat)}] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {(expected)} spids: [1257] ) (HereDoc op_id: Redir_DLessDash fd: -1 body: { (DQ ('Diag: url=') ($ VSub_Number '$1') ('\n') ('Diag: protocol=') ($ VSub_Number '$2') ('\n') ('Diag: path=') ($ VSub_Number '$3') ('\n') ) } do_expansion: True here_end: EOF was_filled: True spids: [1260] ) ] ) (AndOr children: [ (Pipeline children: [ (C {(git)} {(fetch-pack)} {(--diag-url)} {(DQ ($ VSub_Number '$1'))}) (SimpleCommand words: [{(grep)} {(-v)} {(Lit_VarLike 'hostandport=')}] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {(actual)} spids: [1294] ) ] ) ] negated: False ) (C {(test_cmp)} {(expected)} {(actual)}) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] spids: [1252] ) spids: [1247 1251] ) (FuncDef name: check_prot_host_port_path body: (BraceGroup children: [ (Case to_match: {(DQ ($ VSub_Number '$2'))} arms: [ (case_arm pat_list: [{(Lit_Other '*') (ssh) (Lit_Other '*')}] action: [ (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:pp) op:Equal rhs:{(ssh)} spids:[1332])] spids: [1332] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:uah) op: Equal rhs: {(userandhost)} spids: [1336] ) ] spids: [1336] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:ehost) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (C {(echo)} {($ VSub_Number '$3')}) (C {(tr)} {(-d)} {(DQ ('[]'))}) ] negated: False ) ] ) left_token: <Left_CommandSub '$('> spids: [1341 1355] ) } spids: [1340] ) ] spids: [1340] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:diagport) op: Equal rhs: {(DQ ('Diag: port=') ($ VSub_Number '$4'))} spids: [1358] ) ] spids: [1358] ) ] spids: [1326 1329 1365 -1] ) (case_arm pat_list: [{(Lit_Other '*')}] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:pp) op: Equal rhs: {($ VSub_Name '$p')} spids: [1372] ) ] spids: [1372] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:uah) op: Equal rhs: {(hostandport)} spids: [1376] ) ] spids: [1376] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:ehost) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (C {(echo)} {($ VSub_Number '$3') ($ VSub_Number '$4')}) (C {(sed)} {(-e)} {(DQ (s/22) (Lit_Other '$') ('/:22/'))} {(-e)} {(DQ (s/NONE//))} ) ] negated: False ) ] ) left_token: <Left_CommandSub '$('> spids: [1381 1404] ) } spids: [1380] ) ] spids: [1380] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:diagport) op: Equal rhs: {(DQ )} spids: [1407] ) ] spids: [1407] ) ] spids: [1368 1369 1412 -1] ) ] spids: [1317 1323 1415] ) (AndOr children: [ (SimpleCommand words: [{(cat)}] redirects: [ (Redir op_id:Redir_Great fd:-1 arg_word:{(exp)} spids:[1420]) (HereDoc op_id: Redir_DLessDash fd: -1 body: { (DQ ('Diag: url=') ($ VSub_Number '$1') ('\n') ('Diag: protocol=') ($ VSub_Name '$pp') ('\n') ('Diag: ') ($ VSub_Name '$uah') ('=') ($ VSub_Name '$ehost') ('\n') ($ VSub_Name '$diagport') ('\n') ('Diag: path=') ($ VSub_Number '$5') ('\n') ) } do_expansion: True here_end: EOF was_filled: True spids: [1423] ) ] ) (SimpleCommand words: [{(grep)} {(-v)} {(DQ ('^') (Lit_Other '$'))} {(exp)}] redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(expected)} spids:[1457])] ) ] op_id: Op_DAmp ) (AndOr children: [ (SimpleCommand words: [{(git)} {(fetch-pack)} {(--diag-url)} {(DQ ($ VSub_Number '$1'))}] redirects: [(Redir op_id:Redir_Great fd:-1 arg_word:{(actual)} spids:[1471])] ) (C {(test_cmp)} {(expected)} {(actual)}) ] op_id: Op_DAmp ) ] spids: [1314] ) spids: [1309 1313] ) (ForEach iter_name: r iter_words: [{(repo)} {(re) (Lit_Other ':') (po)} {(re/po)}] do_arg_iter: False body: (DoGroup children: [ (ForEach iter_name: p iter_words: [{(DQ ('ssh+git'))} {(DQ ('git+ssh'))} {(git)} {(ssh)}] do_arg_iter: False body: (DoGroup children: [ (ForEach iter_name: h iter_words: [ {(host)} {(user) (Lit_Other '@') (host)} {(user) (Lit_Other '@') (Lit_Other '[') (Lit_Other ':') (Lit_Other ':') (1) (Lit_Other ']') } {(user) (Lit_Other '@') (Lit_Other ':') (Lit_Other ':') (1)} ] do_arg_iter: False body: (DoGroup children: [ (ForEach iter_name: c iter_words: [{(DQ )} {(Lit_Other ':')}] do_arg_iter: False body: (DoGroup children: [ (C {(test_expect_success)} { (DQ ('fetch-pack --diag-url ') ($ VSub_Name '$p') ('://') ($ VSub_Name '$h') ($ VSub_Name '$c') (/) ($ VSub_Name '$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 ') ($ VSub_Name '$p') ('://') ($ VSub_Name '$h') ($ VSub_Name '$c') ('/~') ($ VSub_Name '$r') ) } {(SQ <'\n'> <'\t\t\t\t\tcheck_prot_host_port_path $p://$h/~$r $p "$h" NONE "~$r"\n'> <'\t\t\t\t'>)} ) ] spids: [1571 1616] ) spids: [1564 -1] ) ] spids: [1556 1619] ) spids: [1534 -1] ) (ForEach iter_name: h iter_words: [ {(host)} {(User) (Lit_Other '@') (host)} {(User) (Lit_Other '@') (Lit_Other '[') (Lit_Other ':') (Lit_Other ':') (1) (Lit_Other ']') } ] do_arg_iter: False body: (DoGroup children: [ (C {(test_expect_success)} { (DQ ('fetch-pack --diag-url ') ($ VSub_Name '$p') ('://') ($ VSub_Name '$h') (':22/') ($ VSub_Name '$r') ) } {(SQ <'\n'> <'\t\t\t\tcheck_prot_host_port_path $p://$h:22/$r $p "$h" 22 "/$r"\n'> <'\t\t\t'>)} ) ] spids: [1643 1664] ) spids: [1627 -1] ) ] spids: [1526 1667] ) spids: [1512 -1] ) (ForEach iter_name: p iter_words: [{(file)}] do_arg_iter: False body: (DoGroup children: [ (C {(test_expect_success)} { (DQ ('fetch-pack --diag-url ') ($ VSub_Name '$p') ('://') ($ VSub_Name '$h') (/) ($ VSub_Name '$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 ') ($ VSub_Name '$p') ('://') ($ VSub_Name '$h') ('/~') ($ VSub_Name '$r') ) } {(SQ <'\n'> <'\t\t\tcheck_prot_path $p://$h/~$r $p "/~$r"\n'> <'\t\t'>)} ) ] spids: [1683 1726] ) spids: [1679 -1] ) (ForEach iter_name: h iter_words: [ {(nohost)} {(nohost) (Lit_Other ':') (12)} {(Lit_Other '[') (Lit_Other ':') (Lit_Other ':') (1) (Lit_Other ']')} {(Lit_Other '[') (Lit_Other ':') (Lit_Other ':') (1) (Lit_Other ']') (Lit_Other ':') (23)} {(Lit_Other '[')} {(Lit_Other '[') (Lit_Other ':') (aa)} ] do_arg_iter: False body: (DoGroup children: [ (C {(test_expect_success)} {(DQ ('fetch-pack --diag-url ./') ($ VSub_Name '$h') (':') ($ VSub_Name '$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 ./') ($ VSub_Name '$p') (':') ($ VSub_Name '$h') ('/~') ($ VSub_Name '$r') ) } {(SQ <'\n'> <'\t\tcheck_prot_path ./$p:$h/~$r $p "./$p:$h/~$r"\n'> <'\t\t'>)} ) ] spids: [1766 1807] ) spids: [1738 -1] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:p) op:Equal rhs:{(ssh)} spids:[1814])] spids: [1814] ) (ForEach iter_name: h iter_words: [ {(host)} {(Lit_Other '[') (Lit_Other ':') (Lit_Other ':') (1) (Lit_Other ']')} ] do_arg_iter: False body: (DoGroup children: [ (C {(test_expect_success)} {(DQ ('fetch-pack --diag-url ') ($ VSub_Name '$h') (':') ($ VSub_Name '$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 ') ($ VSub_Name '$h') (':/~') ($ VSub_Name '$r'))} {(SQ <'\n'> <'\t\t\tcheck_prot_host_port_path $h:/~$r $p "$h" NONE "~$r"\n'> <'\t\t'>)} ) ] spids: [1833 1872] ) spids: [1823 -1] ) ] spids: [1500 1874] ) spids: [1491 -1] ) (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)}) ] )