(command.CommandList children: [ (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:test_description) op: Equal rhs: {(SQ <'git rebase - test patch id computation'>)} ) ] ) (C {(.)} {(./test-lib.sh)}) (command.FuncDef name: count body: (command.BraceGroup children: [ (command.Assignment keyword: Assign_None pairs: [(assign_pair lhs:(lhs_expr.LhsName name:i) op:Equal rhs:{(0)})] ) (command.WhileUntil keyword: <KW_While while> cond: [(C {(test)} {($ VSub_DollarName '$i')} {(-lt)} {($ VSub_Number '$1')})] body: (command.DoGroup children: [ (C {(echo)} {(DQ ($ VSub_DollarName '$i'))}) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:i) op: Equal rhs: { (word_part.ArithSubPart anode: (arith_expr.ArithBinary op_id: Arith_Plus left: (arith_expr.ArithWord w:{($ VSub_DollarName '$i')}) right: (arith_expr.ArithWord w:{(Lit_Digits 1)}) ) ) } ) ] ) ] ) ) ] ) ) (command.FuncDef name: scramble body: (command.BraceGroup children: [ (command.Assignment keyword: Assign_None pairs: [(assign_pair lhs:(lhs_expr.LhsName name:i) op:Equal rhs:{(0)})] ) (command.WhileUntil keyword: <KW_While while> cond: [(C {(read)} {(x)})] body: (command.DoGroup children: [ (command.If arms: [ (if_arm cond: [(C {(test)} {($ VSub_DollarName '$i')} {(-ne)} {(0)})] action: [(C {(echo)} {(DQ ($ VSub_DollarName '$x'))})] ) ] ) (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:i) op: Equal rhs: { (word_part.ArithSubPart anode: (arith_expr.ArithBinary op_id: Arith_Percent left: (arith_expr.ArithBinary op_id: Arith_Plus left: (arith_expr.ArithWord w:{($ VSub_DollarName '$i')}) right: (arith_expr.ArithWord w:{(Lit_Digits 1)}) ) right: (arith_expr.ArithWord w:{(Lit_Digits 10)}) ) ) } ) ] ) ] ) redirects: [ (redir.Redir op: <Redir_Less '<'> fd: 16777215 arg_word: {(DQ ($ VSub_Number '$1'))} ) (redir.Redir op: <Redir_Great '>'> fd: 16777215 arg_word: {(DQ ($ VSub_Number '$1') (.new))} ) ] ) (C {(mv)} {(-f)} {(DQ ($ VSub_Number '$1') (.new))} {(DQ ($ VSub_Number '$1'))}) ] ) ) (command.FuncDef name: run body: (command.BraceGroup children: [ (C {(echo)} {(word_part.EscapedLiteralPart token:<Lit_EscapedChar '\\$'>)} {(DQ ($ VSub_At '$@'))} ) (command.SimpleCommand words: [{(/usr/bin/time)} {(DQ ($ VSub_At '$@'))}] redirects: [(redir.Redir op:<Redir_Great '>'> fd:16777215 arg_word:{(/dev/null)})] ) ] ) ) (C {(test_expect_success)} {(SQ <setup>)} {(SQ <'\n'> <'\tgit commit --allow-empty -m initial &&\n'> <'\tgit tag root\n'>)} ) (command.FuncDef name: do_tests body: (command.BraceGroup children: [ (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:nlines) op: Equal rhs: {($ VSub_Number '$1')} ) (assign_pair lhs: (lhs_expr.LhsName name:pr) op: Equal rhs: { (word_part.BracedVarSub token: <VSub_Number 2> suffix_op: (suffix_op.StringUnary op_id:VTest_Hyphen arg_word:{}) ) } ) ] ) (C {(test_expect_success)} {($ VSub_DollarName '$pr')} {(DQ ('setup: ') ($ VSub_DollarName '$nlines') (' lines'))} { (DQ ('\n') ('\t\trm -f .gitattributes &&\n') ('\t\tgit checkout -q -f master &&\n') ('\t\tgit reset --hard root &&\n') ('\t\tcount ') ($ VSub_DollarName '$nlines') (' >file &&\n') ('\t\tgit add file &&\n') ('\t\tgit commit -q -m initial &&\n') ('\t\tgit branch -f other &&\n') ('\n') ('\t\tscramble file &&\n') ('\t\tgit add file &&\n') ("\t\tgit commit -q -m 'change big file' &&\n") ('\n') ('\t\tgit checkout -q other &&\n') ('\t\t: >newfile &&\n') ('\t\tgit add newfile &&\n') ("\t\tgit commit -q -m 'add small file' &&\n") ('\n') ('\t\tgit cherry-pick master >/dev/null 2>&1\n') ('\t') ) } ) (C {(test_debug)} {(DQ ('\n') ('\t\trun git diff master^') (Lit_Other '\\') ('!\n') ('\t'))}) (C {(test_expect_success)} {($ VSub_DollarName '$pr')} {(SQ <'setup attributes'>)} {(DQ ('\n') ("\t\techo 'file binary' >.gitattributes\n") ('\t'))} ) (C {(test_debug)} { (DQ ('\n') ('\t\trun git format-patch --stdout master &&\n') ('\t\trun git format-patch --stdout --ignore-if-in-upstream master\n') ('\t') ) } ) (C {(test_expect_success)} {($ VSub_DollarName '$pr')} {(SQ <'detect upstream patch'>)} { (SQ <'\n'> <'\t\tgit checkout -q master &&\n'> <'\t\tscramble file &&\n'> <'\t\tgit add file &&\n'> <'\t\tgit commit -q -m "change big file again" &&\n'> <'\t\tgit checkout -q other^{} &&\n'> <'\t\tgit rebase master &&\n'> <'\t\ttest_must_fail test -n "$(git rev-list master...HEAD~)"\n'> <'\t'> ) } ) (C {(test_expect_success)} {($ VSub_DollarName '$pr')} {(SQ <'do not drop patch'>)} { (SQ <'\n'> <'\t\tgit branch -f squashed master &&\n'> <'\t\tgit checkout -q -f squashed &&\n'> <'\t\tgit reset -q --soft HEAD~2 &&\n'> <'\t\tgit commit -q -m squashed &&\n'> <'\t\tgit checkout -q other^{} &&\n'> <'\t\ttest_must_fail git rebase squashed &&\n'> <'\t\trm -rf .git/rebase-apply\n'> <'\t'> ) } ) ] ) ) (C {(do_tests)} {(500)}) (C {(do_tests)} {(50000)} {(EXPENSIVE)}) (C {(test_done)}) ] )