(CommandList children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:test_description) op: Equal rhs: {(SQ <'pushing to a mirror repository'>)} spids: [4] ) ] spids: [4] ) (C {(.)} {(./test-lib.sh)}) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:D) op: Equal rhs: { (CommandSubPart command_list: (CommandList children:[(C {(pwd)})]) left_token: <Left_CommandSub '$('> spids: [16 18] ) } spids: [15] ) ] spids: [15] ) (FuncDef name: invert body: (BraceGroup children: [ (If arms: [ (if_arm cond: [(Sentence child:(C {(DQ ($ VSub_At '$@'))}) terminator:<Op_Semi ';'>)] action: [(ControlFlow token:<ControlFlow_Return return> arg_word:{(1)})] spids: [-1 36] ) ] else_action: [(ControlFlow token:<ControlFlow_Return return> arg_word:{(0)})] spids: [44 52] ) ] spids: [26] ) spids: [21 25] ) (FuncDef name: mk_repo_pair body: (BraceGroup children: [ (AndOr children: [ (C {(rm)} {(-rf)} {(master)} {(mirror)}) (AndOr children: [ (C {(mkdir)} {(mirror)}) (AndOr children: [ (Subshell child: (AndOr children: [ (C {(cd)} {(mirror)}) (AndOr children: [ (C {(git)} {(init)}) (C {(git)} {(config)} {(receive.denyCurrentBranch)} {(warn)}) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) spids: [83 109] ) (AndOr children: [ (C {(mkdir)} {(master)}) (Subshell child: (AndOr children: [ (C {(cd)} {(master)}) (AndOr children: [ (C {(git)} {(init)}) (C {(git)} {(remote)} {(add)} {($ VSub_Number '$1')} {(up)} {(../mirror)} ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) spids: [121 151] ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] op_id: Op_DAmp ) ] spids: [62] ) spids: [57 61] ) (C {(test_expect_success)} {(SQ <'push mirror creates new branches'>)} { (SQ <'\n'> <'\n'> <'\tmk_repo_pair &&\n'> <'\t(\n'> <'\t\tcd master &&\n'> <'\t\techo one >foo && git add foo && git commit -m one &&\n'> <'\t\tgit push --mirror up\n'> <'\t) &&\n'> <'\tmaster_master=$(cd master && git show-ref -s --verify refs/heads/master) &&\n'> <'\tmirror_master=$(cd mirror && git show-ref -s --verify refs/heads/master) &&\n'> <'\ttest "$master_master" = "$mirror_master"\n'> <'\n'> ) } ) (C {(test_expect_success)} {(SQ <'push mirror updates existing branches'>)} { (SQ <'\n'> <'\n'> <'\tmk_repo_pair &&\n'> <'\t(\n'> <'\t\tcd master &&\n'> <'\t\techo one >foo && git add foo && git commit -m one &&\n'> <'\t\tgit push --mirror up &&\n'> <'\t\techo two >foo && git add foo && git commit -m two &&\n'> <'\t\tgit push --mirror up\n'> <'\t) &&\n'> <'\tmaster_master=$(cd master && git show-ref -s --verify refs/heads/master) &&\n'> <'\tmirror_master=$(cd mirror && git show-ref -s --verify refs/heads/master) &&\n'> <'\ttest "$master_master" = "$mirror_master"\n'> <'\n'> ) } ) (C {(test_expect_success)} {(SQ <'push mirror force updates existing branches'>)} { (SQ <'\n'> <'\n'> <'\tmk_repo_pair &&\n'> <'\t(\n'> <'\t\tcd master &&\n'> <'\t\techo one >foo && git add foo && git commit -m one &&\n'> <'\t\tgit push --mirror up &&\n'> <'\t\techo two >foo && git add foo && git commit -m two &&\n'> <'\t\tgit push --mirror up &&\n'> <'\t\tgit reset --hard HEAD^\n'> <'\t\tgit push --mirror up\n'> <'\t) &&\n'> <'\tmaster_master=$(cd master && git show-ref -s --verify refs/heads/master) &&\n'> <'\tmirror_master=$(cd mirror && git show-ref -s --verify refs/heads/master) &&\n'> <'\ttest "$master_master" = "$mirror_master"\n'> <'\n'> ) } ) (C {(test_expect_success)} {(SQ <'push mirror removes branches'>)} { (SQ <'\n'> <'\n'> <'\tmk_repo_pair &&\n'> <'\t(\n'> <'\t\tcd master &&\n'> <'\t\techo one >foo && git add foo && git commit -m one &&\n'> <'\t\tgit branch remove master &&\n'> <'\t\tgit push --mirror up &&\n'> <'\t\tgit branch -D remove\n'> <'\t\tgit push --mirror up\n'> <'\t) &&\n'> <'\t(\n'> <'\t\tcd mirror &&\n'> <'\t\tinvert git show-ref -s --verify refs/heads/remove\n'> <'\t)\n'> <'\n'> ) } ) (C {(test_expect_success)} {(SQ <'push mirror adds, updates and removes branches together'>)} { (SQ <'\n'> <'\n'> <'\tmk_repo_pair &&\n'> <'\t(\n'> <'\t\tcd master &&\n'> <'\t\techo one >foo && git add foo && git commit -m one &&\n'> <'\t\tgit branch remove master &&\n'> <'\t\tgit push --mirror up &&\n'> <'\t\tgit branch -D remove &&\n'> <'\t\tgit branch add master &&\n'> <'\t\techo two >foo && git add foo && git commit -m two &&\n'> <'\t\tgit push --mirror up\n'> <'\t) &&\n'> <'\tmaster_master=$(cd master && git show-ref -s --verify refs/heads/master) &&\n'> <'\tmaster_add=$(cd master && git show-ref -s --verify refs/heads/add) &&\n'> <'\tmirror_master=$(cd mirror && git show-ref -s --verify refs/heads/master) &&\n'> <'\tmirror_add=$(cd mirror && git show-ref -s --verify refs/heads/add) &&\n'> <'\ttest "$master_master" = "$mirror_master" &&\n'> <'\ttest "$master_add" = "$mirror_add" &&\n'> <'\t(\n'> <'\t\tcd mirror &&\n'> <'\t\tinvert git show-ref -s --verify refs/heads/remove\n'> <'\t)\n'> <'\n'> ) } ) (C {(test_expect_success)} {(SQ <'push mirror creates new tags'>)} { (SQ <'\n'> <'\n'> <'\tmk_repo_pair &&\n'> <'\t(\n'> <'\t\tcd master &&\n'> <'\t\techo one >foo && git add foo && git commit -m one &&\n'> <'\t\tgit tag -f tmaster master &&\n'> <'\t\tgit push --mirror up\n'> <'\t) &&\n'> <'\tmaster_master=$(cd master && git show-ref -s --verify refs/tags/tmaster) &&\n'> <'\tmirror_master=$(cd mirror && git show-ref -s --verify refs/tags/tmaster) &&\n'> <'\ttest "$master_master" = "$mirror_master"\n'> <'\n'> ) } ) (C {(test_expect_success)} {(SQ <'push mirror updates existing tags'>)} { (SQ <'\n'> <'\n'> <'\tmk_repo_pair &&\n'> <'\t(\n'> <'\t\tcd master &&\n'> <'\t\techo one >foo && git add foo && git commit -m one &&\n'> <'\t\tgit tag -f tmaster master &&\n'> <'\t\tgit push --mirror up &&\n'> <'\t\techo two >foo && git add foo && git commit -m two &&\n'> <'\t\tgit tag -f tmaster master &&\n'> <'\t\tgit push --mirror up\n'> <'\t) &&\n'> <'\tmaster_master=$(cd master && git show-ref -s --verify refs/tags/tmaster) &&\n'> <'\tmirror_master=$(cd mirror && git show-ref -s --verify refs/tags/tmaster) &&\n'> <'\ttest "$master_master" = "$mirror_master"\n'> <'\n'> ) } ) (C {(test_expect_success)} {(SQ <'push mirror force updates existing tags'>)} { (SQ <'\n'> <'\n'> <'\tmk_repo_pair &&\n'> <'\t(\n'> <'\t\tcd master &&\n'> <'\t\techo one >foo && git add foo && git commit -m one &&\n'> <'\t\tgit tag -f tmaster master &&\n'> <'\t\tgit push --mirror up &&\n'> <'\t\techo two >foo && git add foo && git commit -m two &&\n'> <'\t\tgit tag -f tmaster master &&\n'> <'\t\tgit push --mirror up &&\n'> <'\t\tgit reset --hard HEAD^\n'> <'\t\tgit tag -f tmaster master &&\n'> <'\t\tgit push --mirror up\n'> <'\t) &&\n'> <'\tmaster_master=$(cd master && git show-ref -s --verify refs/tags/tmaster) &&\n'> <'\tmirror_master=$(cd mirror && git show-ref -s --verify refs/tags/tmaster) &&\n'> <'\ttest "$master_master" = "$mirror_master"\n'> <'\n'> ) } ) (C {(test_expect_success)} {(SQ <'push mirror removes tags'>)} { (SQ <'\n'> <'\n'> <'\tmk_repo_pair &&\n'> <'\t(\n'> <'\t\tcd master &&\n'> <'\t\techo one >foo && git add foo && git commit -m one &&\n'> <'\t\tgit tag -f tremove master &&\n'> <'\t\tgit push --mirror up &&\n'> <'\t\tgit tag -d tremove\n'> <'\t\tgit push --mirror up\n'> <'\t) &&\n'> <'\t(\n'> <'\t\tcd mirror &&\n'> <'\t\tinvert git show-ref -s --verify refs/tags/tremove\n'> <'\t)\n'> <'\n'> ) } ) (C {(test_expect_success)} {(SQ <'push mirror adds, updates and removes tags together'>)} { (SQ <'\n'> <'\n'> <'\tmk_repo_pair &&\n'> <'\t(\n'> <'\t\tcd master &&\n'> <'\t\techo one >foo && git add foo && git commit -m one &&\n'> <'\t\tgit tag -f tmaster master &&\n'> <'\t\tgit tag -f tremove master &&\n'> <'\t\tgit push --mirror up &&\n'> <'\t\tgit tag -d tremove &&\n'> <'\t\tgit tag tadd master &&\n'> <'\t\techo two >foo && git add foo && git commit -m two &&\n'> <'\t\tgit tag -f tmaster master &&\n'> <'\t\tgit push --mirror up\n'> <'\t) &&\n'> <'\tmaster_master=$(cd master && git show-ref -s --verify refs/tags/tmaster) &&\n'> <'\tmaster_add=$(cd master && git show-ref -s --verify refs/tags/tadd) &&\n'> <'\tmirror_master=$(cd mirror && git show-ref -s --verify refs/tags/tmaster) &&\n'> <'\tmirror_add=$(cd mirror && git show-ref -s --verify refs/tags/tadd) &&\n'> <'\ttest "$master_master" = "$mirror_master" &&\n'> <'\ttest "$master_add" = "$mirror_add" &&\n'> <'\t(\n'> <'\t\tcd mirror &&\n'> <'\t\tinvert git show-ref -s --verify refs/tags/tremove\n'> <'\t)\n'> <'\n'> ) } ) (C {(test_expect_success)} {(SQ <'remote.foo.mirror adds and removes branches'>)} { (SQ <'\n'> <'\n'> <'\tmk_repo_pair --mirror &&\n'> <'\t(\n'> <'\t\tcd master &&\n'> <'\t\techo one >foo && git add foo && git commit -m one &&\n'> <'\t\tgit branch keep master &&\n'> <'\t\tgit branch remove master &&\n'> <'\t\tgit push up &&\n'> <'\t\tgit branch -D remove\n'> <'\t\tgit push up\n'> <'\t) &&\n'> <'\t(\n'> <'\t\tcd mirror &&\n'> <'\t\tgit show-ref -s --verify refs/heads/keep &&\n'> <'\t\tinvert git show-ref -s --verify refs/heads/remove\n'> <'\t)\n'> <'\n'> ) } ) (C {(test_expect_success)} {(SQ <'remote.foo.mirror=no has no effect'>)} { (SQ <'\n'> <'\n'> <'\tmk_repo_pair &&\n'> <'\t(\n'> <'\t\tcd master &&\n'> <'\t\techo one >foo && git add foo && git commit -m one &&\n'> <'\t\tgit config --add remote.up.mirror no &&\n'> <'\t\tgit branch keep master &&\n'> <'\t\tgit push --mirror up &&\n'> <'\t\tgit branch -D keep &&\n'> <'\t\tgit push up :\n'> <'\t) &&\n'> <'\t(\n'> <'\t\tcd mirror &&\n'> <'\t\tgit show-ref -s --verify refs/heads/keep\n'> <'\t)\n'> <'\n'> ) } ) (C {(test_done)}) ] )