(command.CommandList children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name name:test_description) op: assign_op.Equal rhs: {(SQ <'git rebase - test patch id computation'>)} spids: [4] ) ] ) (C {<.>} {<'./test-lib.sh'>}) (command.ShFunction name: count body: (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: <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 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] ) ] ) ] ) ) ] ) ) (command.ShFunction name: scramble body: (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: <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] ) ] ) (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: {($ Id.VSub_DollarName '$i')} right: {<Id.Lit_Digits 1>} ) right: {<Id.Lit_Digits 10>} ) ) } spids: [108] ) ] ) ] ) 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'))}) ] ) ) (command.ShFunction name: run body: (BraceGroup children: [ (C {<echo>} {(word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\$'>)} {(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'>})] do_fork: T ) ] ) ) (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 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: <Id.VSub_Number 2> 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_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'> ) } ) ] ) ) (C {<do_tests>} {<500>}) (C {<do_tests>} {<50000>} {<EXPENSIVE>}) (C {<test_done>}) ] )