(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 - test patch id computation'>)} spids: [4] ) ] redirects: [] ) (C {<.>} {<'./test-lib.sh'>}) (command.ShFunction name: count body: (BraceGroup left: <Id.Lit_LBrace '{'> children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'i='> name:i) op: assign_op.Equal rhs: {<0>} spids: [23] ) ] redirects: [] ) (command.WhileUntil keyword: <Id.KW_While while> cond: (condition.Shell commands: [(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 left:<Id.Lit_VarLike 'i='> name:i) op: assign_op.Equal rhs: { (word_part.ArithSub anode: (arith_expr.Binary op_id: Id.Arith_Plus left: {($ Id.VSub_DollarName i)} right: {<Id.Lit_Digits 1>} ) ) } spids: [48] ) ] redirects: [] ) ] ) redirects: [] ) ] redirects: [] right: <Id.Lit_RBrace '}'> ) ) (command.ShFunction name: scramble body: (BraceGroup left: <Id.Lit_LBrace '{'> children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'i='> name:i) op: assign_op.Equal rhs: {<0>} spids: [70] ) ] redirects: [] ) (command.WhileUntil keyword: <Id.KW_While while> cond: (condition.Shell commands:[(C {<read>} {<x>})]) body: (command.DoGroup children: [ (command.If arms: [ (if_arm cond: (condition.Shell commands: [(C {<test>} {($ Id.VSub_DollarName i)} {<-ne>} {<0>})] ) action: [(C {<echo>} {(DQ ($ Id.VSub_DollarName x))})] spids: [84 95] ) ] else_action: [] redirects: [] ) (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'i='> 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: {($ Id.VSub_DollarName i)} right: {<Id.Lit_Digits 1>} ) right: {<Id.Lit_Digits 10>} ) ) } spids: [108] ) ] redirects: [] ) ] ) redirects: [ (redir op: <Id.Redir_Less '<'> loc: (redir_loc.Fd fd:0) arg: {(DQ ($ Id.VSub_Number 1))} ) (redir op: <Id.Redir_Great '>'> loc: (redir_loc.Fd fd:1) arg: {(DQ ($ Id.VSub_Number 1) <.new>)} ) ] ) (C {<mv>} {<-f>} {(DQ ($ Id.VSub_Number 1) <.new>)} {(DQ ($ Id.VSub_Number 1))}) ] redirects: [] right: <Id.Lit_RBrace '}'> ) ) (command.ShFunction name: run body: (BraceGroup left: <Id.Lit_LBrace '{'> children: [ (C {<echo>} {(word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\$'> ch:'$')} {(DQ ($ Id.VSub_At '@'))} ) (command.Simple words: [{<'/usr/bin/time'>} {(DQ ($ Id.VSub_At '@'))}] redirects: [(redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<'/dev/null'>})] more_env: [] do_fork: T ) ] redirects: [] right: <Id.Lit_RBrace '}'> ) ) (C {<test_expect_success>} {(SQ <setup>)} {(SQ <'\n'> <'\tgit commit --allow-empty -m initial &&\n'> <'\tgit tag root\n'>)} ) (command.ShFunction name: do_tests body: (BraceGroup left: <Id.Lit_LBrace '{'> children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'nlines='> name:nlines) op: assign_op.Equal rhs: {($ Id.VSub_Number 1)} spids: [203] ) (assign_pair lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'pr='> name:pr) op: assign_op.Equal rhs: { (braced_var_sub left: <Id.Left_DollarBrace '${'> token: <Id.VSub_Number 2> var_name: 2 suffix_op: (suffix_op.Unary op:<Id.VTest_Hyphen _> arg_word:{}) right: <Id.Right_DollarBrace '}'> ) } spids: [206] ) ] redirects: [] ) (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_BadBackslash '\\'> <'!\n'> <'\t'>)} ) (C {<test_expect_success>} {($ Id.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>} {($ Id.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>} {($ Id.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'> ) } ) ] redirects: [] right: <Id.Lit_RBrace '}'> ) ) (C {<do_tests>} {<500>}) (C {<do_tests>} {<50000>} {<EXPENSIVE>}) (C {<test_done>}) ] )