(command.CommandList children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'test_description='> name:test_description) op: assign_op.Equal rhs: {(SQ <'git rebase --merge test'>)} spids: [13] ) ] redirects: [] ) (C {<.>} {<'./test-lib.sh'>}) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'T='> name:T) op: assign_op.Equal rhs: {(DQ <'A quick brown fox\n'> <'jumps over the lazy dog.'>)} spids: [24] ) ] redirects: [] ) (command.ForEach iter_names: [i] iterable: (for_iter.Words words:[{<1>} {<2>} {<3>} {<4>} {<5>} {<6>} {<7>} {<8>} {<9>} {<10>}]) body: (command.DoGroup children: [(C {<echo>} {(DQ ($ Id.VSub_DollarName i) <' '> ($ Id.VSub_DollarName T))})] ) redirects: [(redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<original>})] ) (C {<test_expect_success>} {<setup>} { (SQ <'\n'> <'\tgit add original &&\n'> <'\tgit commit -m"initial" &&\n'> <'\tgit branch side &&\n'> <'\techo "11 $T" >>original &&\n'> <'\tgit commit -a -m"master updates a bit." &&\n'> <'\n'> <'\techo "12 $T" >>original &&\n'> <'\tgit commit -a -m"master updates a bit more." &&\n'> <'\n'> <'\tgit checkout side &&\n'> <'\t(echo "0 $T" ; cat original) >renamed &&\n'> <'\tgit add renamed &&\n'> <'\tgit update-index --force-remove original &&\n'> <'\tgit commit -a -m"side renames and edits." &&\n'> <'\n'> <'\ttr "[a-z]" "[A-Z]" <original >newfile &&\n'> <'\tgit add newfile &&\n'> <'\tgit commit -a -m"side edits further." &&\n'> <'\tgit branch second-side &&\n'> <'\n'> <'\ttr "[a-m]" "[A-M]" <original >newfile &&\n'> <'\trm -f original &&\n'> <'\tgit commit -a -m"side edits once again." &&\n'> <'\n'> <'\tgit branch test-rebase side &&\n'> <'\tgit branch test-rebase-pick side &&\n'> <'\tgit branch test-reference-pick side &&\n'> <'\tgit branch test-conflicts side &&\n'> <'\tgit checkout -b test-merge side\n'> ) } ) (C {<test_expect_success>} {(SQ <'reference merge'>)} {(SQ <'\n'> <'\tgit merge -s recursive -m "reference merge" master\n'>)} ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'PRE_REBASE='> name:PRE_REBASE) op: assign_op.Equal rhs: { (command_sub left_token: <Id.Left_DollarParen '$('> child: (C {<git>} {<rev-parse>} {<test-rebase>}) right: <Id.Eof_RParen _> ) } spids: [123] ) ] redirects: [] ) (C {<test_expect_success>} {<rebase>} {(SQ <'\n'> <'\tgit checkout test-rebase &&\n'> <'\tGIT_TRACE=1 git rebase --merge master\n'>)} ) (C {<test_expect_success>} {(SQ <'test-rebase@{1} is pre rebase'>)} {(SQ <'\n'> <'\ttest $PRE_REBASE = $(git rev-parse test-rebase@{1})\n'>)} ) (C {<test_expect_success>} {(SQ <'merge and rebase should match'>)} { (SQ <'\n'> <'\tgit diff-tree -r test-rebase test-merge >difference &&\n'> <'\tif test -s difference\n'> <'\tthen\n'> <'\t\tcat difference\n'> <'\t\t(exit 1)\n'> <'\telse\n'> <'\t\techo happy\n'> <'\tfi\n'> ) } ) (C {<test_expect_success>} {(SQ <'rebase the other way'>)} {(SQ <'\n'> <'\tgit reset --hard master &&\n'> <'\tgit rebase --merge side\n'>)} ) (C {<test_expect_success>} {(SQ <'rebase -Xtheirs'>)} { (SQ <'\n'> <'\tgit checkout -b conflicting master~2 &&\n'> <'\techo "AB $T" >> original &&\n'> <'\tgit commit -mconflicting original &&\n'> <'\tgit rebase -Xtheirs master &&\n'> <'\tgrep AB original &&\n'> <'\t! grep 11 original\n'> ) } ) (C {<test_expect_success>} {(SQ <'rebase -Xtheirs from orphan'>)} { (SQ <'\n'> <'\tgit checkout --orphan orphan-conflicting master~2 &&\n'> <'\techo "AB $T" >> original &&\n'> <'\tgit commit -morphan-conflicting original &&\n'> <'\tgit rebase -Xtheirs master &&\n'> <'\tgrep AB original &&\n'> <'\t! grep 11 original\n'> ) } ) (C {<test_expect_success>} {(SQ <'merge and rebase should match'>)} { (SQ <'\n'> <'\tgit diff-tree -r test-rebase test-merge >difference &&\n'> <'\tif test -s difference\n'> <'\tthen\n'> <'\t\tcat difference\n'> <'\t\t(exit 1)\n'> <'\telse\n'> <'\t\techo happy\n'> <'\tfi\n'> ) } ) (C {<test_expect_success>} {(SQ <'picking rebase'>)} { (SQ <'\n'> <'\tgit reset --hard side &&\n'> <'\tgit rebase --merge --onto master side^^ &&\n'> <'\tmb=$(git merge-base master HEAD) &&\n'> <'\tif test "$mb" = "$(git rev-parse master)"\n'> <'\tthen\n'> <'\t\techo happy\n'> <'\telse\n'> <'\t\tgit show-branch\n'> <'\t\t(exit 1)\n'> <'\tfi &&\n'> <'\tf=$(git diff-tree --name-only HEAD^ HEAD) &&\n'> <'\tg=$(git diff-tree --name-only HEAD^^ HEAD^) &&\n'> <'\tcase "$f,$g" in\n'> <'\tnewfile,newfile)\n'> <'\t\techo happy ;;\n'> <'\t*)\n'> <'\t\techo "$f"\n'> <'\t\techo "$g"\n'> <'\t\t(exit 1)\n'> <'\tesac\n'> ) } ) (C {<test_expect_success>} {(SQ <'rebase -s funny -Xopt'>)} { (SQ <'\n'> <'\ttest_when_finished "rm -fr test-bin funny.was.run" &&\n'> <'\tmkdir test-bin &&\n'> <'\tcat >test-bin/git-merge-funny <<-EOF &&\n'> <'\t#!$SHELL_PATH\n'> <'\tcase "\\$1" in --opt) ;; *) exit 2 ;; esac\n'> <'\tshift &&\n'> <'\t>funny.was.run &&\n'> <'\texec git merge-recursive "\\$@"\n'> <'\tEOF\n'> <'\tchmod +x test-bin/git-merge-funny &&\n'> <'\tgit reset --hard &&\n'> <'\tgit checkout -b test-funny master^ &&\n'> <'\ttest_commit funny &&\n'> <'\t(\n'> <'\t\tPATH=./test-bin:$PATH\n'> <'\t\tgit rebase -s funny -Xopt master\n'> <'\t) &&\n'> <'\ttest -f funny.was.run\n'> ) } ) (C {<test_expect_success>} {(SQ <'rebase --skip works with two conflicts in a row'>)} { (SQ <'\n'> <'\tgit checkout second-side &&\n'> <'\ttr "[A-Z]" "[a-z]" <newfile >tmp &&\n'> <'\tmv tmp newfile &&\n'> <'\tgit commit -a -m"edit conflicting with side" &&\n'> <'\ttr "[d-f]" "[D-F]" <newfile >tmp &&\n'> <'\tmv tmp newfile &&\n'> <'\tgit commit -a -m"another edit conflicting with side" &&\n'> <'\ttest_must_fail git rebase --merge test-conflicts &&\n'> <'\ttest_must_fail git rebase --skip &&\n'> <'\tgit rebase --skip\n'> ) } ) (C {<test_done>}) ] )