(CommandList children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:test_description) op: Equal rhs: {(SQ <"fetch/push involving alternates">)} spids: [4] ) ] spids: [4] ) (C {(.)} {(./test-lib.sh)}) (FuncDef name: count_objects body: (BraceGroup children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs:(LhsName name:loose) op:Equal rhs:{(0)} spids:[22]) (assign_pair lhs:(LhsName name:inpack) op:Equal rhs:{(0)} spids:[25]) ] spids: [22] ) (AndOr children: [ (C {(eval)} { (DQ (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (C {(git)} {(count-objects)} {(-v)}) (C {(sed)} {(-n)} {(-e)} {(SQ <"s/^count: \\(.*\\)/loose=\\1/p">)} {(-e)} {(SQ <"s/^in-pack: \\(.*\\)/inpack=\\1/p">)} ) ] negated: False ) ] ) left_token: <Left_CommandSub "$("> spids: [32 63] ) ) } ) (C {(echo)} { (ArithSubPart anode: (ArithBinary op_id: Arith_Plus left: (ArithWord w:{($ VSub_Name "$loose")}) right: (ArithWord w:{($ VSub_Name "$inpack")}) ) spids: [71 80] ) } ) ] op_id: Op_DAmp ) ] spids: [19] ) spids: [14 18] ) (C {(test_expect_success)} {(setup)} { (SQ <"\n"> <"\t(\n"> <"\t\tgit init original &&\n"> <"\t\tcd original &&\n"> <"\t\ti=0 &&\n"> <"\t\twhile test $i -le 100\n"> <"\t\tdo\n"> <"\t\t\techo \"$i\" >count &&\n"> <"\t\t\tgit add count &&\n"> <"\t\t\tgit commit -m \"$i\" || exit\n"> <"\t\t\ti=$(($i + 1))\n"> <"\t\tdone\n"> <"\t) &&\n"> <"\t(\n"> <"\t\tgit clone --reference=original \"file://$(pwd)/original\" one &&\n"> <"\t\tcd one &&\n"> <"\t\techo Z >count &&\n"> <"\t\tgit add count &&\n"> <"\t\tgit commit -m Z &&\n"> <"\t\tcount_objects >../one.count\n"> <"\t) &&\n"> <"\tA=$(pwd)/original/.git/objects &&\n"> <"\tgit init receiver &&\n"> <"\techo \"$A\" >receiver/.git/objects/info/alternates &&\n"> <"\tgit init fetcher &&\n"> <"\techo \"$A\" >fetcher/.git/objects/info/alternates\n"> ) } ) (C {(test_expect_success)} {(SQ <"pushing into a repository with the same alternate">)} { (SQ <"\n"> <"\t(\n"> <"\t\tcd one &&\n"> <"\t\tgit push ../receiver master:refs/heads/it\n"> <"\t) &&\n"> <"\t(\n"> <"\t\tcd receiver &&\n"> <"\t\tcount_objects >../receiver.count\n"> <"\t) &&\n"> <"\ttest_cmp one.count receiver.count\n"> ) } ) (C {(test_expect_success)} {(SQ <"fetching from a repository with the same alternate">)} { (SQ <"\n"> <"\t(\n"> <"\t\tcd fetcher &&\n"> <"\t\tgit fetch ../one master:refs/heads/it &&\n"> <"\t\tcount_objects >../fetcher.count\n"> <"\t) &&\n"> <"\ttest_cmp one.count fetcher.count\n"> ) } ) (C {(test_done)}) ] )