(command.CommandList children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:test_description) op: assign_op.Equal rhs: {(SQ (Token id:Id.Lit_Chars val:'git rebase - test patch id computation' span_id:6))} spids: [4] ) ] ) (C {(.)} {(./test-lib.sh)}) (command.ShFunction name: count body: (command.BraceGroup children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:i) op: assign_op.Equal rhs: {(0)} spids: [23] ) ] ) (command.WhileUntil keyword: (Token id:Id.KW_While val:while span_id:27) cond: [(C {(test)} {($ Id.VSub_DollarName '$i')} {(-lt)} {($ Id.VSub_Number '$1')})] body: (command.DoGroup children: [ (C {(echo)} {(DQ ($ Id.VSub_DollarName '$i'))}) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:i) op: assign_op.Equal rhs: { (word_part.ArithSub anode: (arith_expr.Binary op_id: Id.Arith_Plus left: (arith_expr.ArithWord w:{($ Id.VSub_DollarName '$i')}) right: (arith_expr.ArithWord w:{(Id.Lit_Digits 1)}) ) ) } spids: [48] ) ] ) ] ) ) ] ) ) (command.ShFunction name: scramble body: (command.BraceGroup children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:i) op: assign_op.Equal rhs: {(0)} spids: [70] ) ] ) (command.WhileUntil keyword: (Token id:Id.KW_While val:while span_id:74) cond: [(C {(read)} {(x)})] body: (command.DoGroup children: [ (command.If arms: [ (if_arm cond: [(C {(test)} {($ Id.VSub_DollarName '$i')} {(-ne)} {(0)})] action: [(C {(echo)} {(DQ ($ Id.VSub_DollarName '$x'))})] spids: [84 95] ) ] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:i) op: assign_op.Equal rhs: { (word_part.ArithSub anode: (arith_expr.Binary op_id: Id.Arith_Percent left: (arith_expr.Binary op_id: Id.Arith_Plus left: (arith_expr.ArithWord w:{($ Id.VSub_DollarName '$i')}) right: (arith_expr.ArithWord w:{(Id.Lit_Digits 1)}) ) right: (arith_expr.ArithWord w:{(Id.Lit_Digits 10)}) ) ) } spids: [108] ) ] ) ] ) redirects: [ (redir.Redir op: (Token id:Id.Redir_Less val:'<' span_id:125) fd: -1 arg_word: {(DQ ($ Id.VSub_Number '$1'))} ) (redir.Redir op: (Token id:Id.Redir_Great val:'>' span_id:130) fd: -1 arg_word: {(DQ ($ Id.VSub_Number '$1') (.new))} ) ] ) (C {(mv)} {(-f)} {(DQ ($ Id.VSub_Number '$1') (.new))} {(DQ ($ Id.VSub_Number '$1'))}) ] ) ) (command.ShFunction name: run body: (command.BraceGroup children: [ (C {(echo)} {(word_part.EscapedLiteral token:(Token id:Id.Lit_EscapedChar val:'\\$' span_id:163))} {(DQ ($ Id.VSub_At '$@'))} ) (command.Simple words: [{(/usr/bin/time)} {(DQ ($ Id.VSub_At '$@'))}] redirects: [ (redir.Redir op: (Token id:Id.Redir_Great val:'>' span_id:176) fd: -1 arg_word: {(/dev/null)} ) ] ) ] ) ) (C {(test_expect_success)} {(SQ (Token id:Id.Lit_Chars val:setup span_id:185))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:189) (Token id: Id.Lit_Chars val: '\tgit commit --allow-empty -m initial &&\n' span_id: 190 ) (Token id:Id.Lit_Chars val:'\tgit tag root\n' span_id:191) ) } ) (command.ShFunction name: do_tests body: (command.BraceGroup children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:nlines) op: assign_op.Equal rhs: {($ Id.VSub_Number '$1')} spids: [203] ) (assign_pair lhs: (sh_lhs_expr.Name name:pr) op: assign_op.Equal rhs: { (braced_var_sub token: (Token id:Id.VSub_Number val:2 span_id:208) suffix_op: (suffix_op.Unary op_id:Id.VTest_Hyphen arg_word:{}) ) } spids: [206] ) ] ) (C {(test_expect_success)} {($ Id.VSub_DollarName '$pr')} {(DQ ('setup: ') ($ Id.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 ') ($ Id.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^') (Id.Lit_Other '\\') ('!\n') ('\t'))} ) (C {(test_expect_success)} {($ Id.VSub_DollarName '$pr')} {(SQ (Token id:Id.Lit_Chars val:'setup attributes' span_id:268))} {(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)} {($ Id.VSub_DollarName '$pr')} {(SQ (Token id:Id.Lit_Chars val:'detect upstream patch' span_id:295))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:299) (Token id: Id.Lit_Chars val: '\t\tgit checkout -q master &&\n' span_id: 300 ) (Token id:Id.Lit_Chars val:'\t\tscramble file &&\n' span_id:301) (Token id:Id.Lit_Chars val:'\t\tgit add file &&\n' span_id:302) (Token id:Id.Lit_Chars val:'\t\tgit commit -q -m "change big file again" &&\n' span_id:303) (Token id: Id.Lit_Chars val: '\t\tgit checkout -q other^{} &&\n' span_id: 304 ) (Token id:Id.Lit_Chars val:'\t\tgit rebase master &&\n' span_id:305) (Token id: Id.Lit_Chars val: '\t\ttest_must_fail test -n "$(git rev-list master...HEAD~)"\n' span_id: 306 ) (Token id:Id.Lit_Chars val:'\t' span_id:307) ) } ) (C {(test_expect_success)} {($ Id.VSub_DollarName '$pr')} {(SQ (Token id:Id.Lit_Chars val:'do not drop patch' span_id:317))} { (SQ (Token id:Id.Lit_Chars val:'\n' span_id:321) (Token id: Id.Lit_Chars val: '\t\tgit branch -f squashed master &&\n' span_id: 322 ) (Token id:Id.Lit_Chars val:'\t\tgit checkout -q -f squashed &&\n' span_id:323) (Token id: Id.Lit_Chars val: '\t\tgit reset -q --soft HEAD~2 &&\n' span_id: 324 ) (Token id:Id.Lit_Chars val:'\t\tgit commit -q -m squashed &&\n' span_id:325) (Token id: Id.Lit_Chars val: '\t\tgit checkout -q other^{} &&\n' span_id: 326 ) (Token id:Id.Lit_Chars val:'\t\ttest_must_fail git rebase squashed &&\n' span_id:327) (Token id: Id.Lit_Chars val: '\t\trm -rf .git/rebase-apply\n' span_id: 328 ) (Token id:Id.Lit_Chars val:'\t' span_id:329) ) } ) ] ) ) (C {(do_tests)} {(500)}) (C {(do_tests)} {(50000)} {(EXPENSIVE)}) (C {(test_done)}) ] )