(command.CommandList children: [ (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:test_description spids:[12]) op: Equal rhs: {(SQ <'fetch/push involving alternates'>)} spids: [12] ) ] spids: [12] ) (C {(.)} {(./test-lib.sh)}) (command.FuncDef name: count_objects body: (command.BraceGroup children: [ (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:loose spids:[30]) op: Equal rhs: {(0)} spids: [30] ) (assign_pair lhs: (lhs_expr.LhsName name:inpack spids:[33]) op: Equal rhs: {(0)} spids: [33] ) ] spids: [30] ) (command.AndOr ops: [Op_DAmp] children: [ (C {(eval)} { (DQ (word_part.CommandSubPart command_list: (command.CommandList children: [ (command.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: F ) ] ) left_token: <Left_CommandSub '$('> spids: [40 71] ) ) } ) (C {(echo)} { (word_part.ArithSubPart anode: (arith_expr.ArithBinary op_id: Arith_Plus left: (arith_expr.ArithWord w:{($ VSub_Name '$loose')}) right: (arith_expr.ArithWord w:{($ VSub_Name '$inpack')}) ) spids: [79 88] ) } ) ] ) ] spids: [27] ) spids: [22 26] ) (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)}) ] )