(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 <'Format-patch numbering options'>)} spids: [13] ) ] redirects: [] ) (C {<.>} {<'./test-lib.sh'>}) (C {<test_expect_success>} {<setup>} { (SQ <'\n'> <'\n'> <'\techo A > file &&\n'> <'\tgit add file &&\n'> <'\tgit commit -m First &&\n'> <'\n'> <'\techo B >> file &&\n'> <'\tgit commit -a -m Second &&\n'> <'\n'> <'\techo C >> file &&\n'> <'\tgit commit -a -m Third\n'> <'\n'> ) } ) (command.ShFunction name: test_num_no_numbered body: (BraceGroup left: <Id.Lit_LBrace '{'> children: [ (command.AndOr ops: [Id.Op_DAmp] children: [ (command.ShAssignment pairs: [ (assign_pair lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'cnt='> name:cnt) op: assign_op.Equal rhs: { (command_sub left_token: <Id.Left_DollarParen '$('> child: (command.Pipeline children: [ (C {<grep>} { (DQ <'^Subject: '> <Id.Lit_BadBackslash '\\'> <'[PATCH'> <Id.Lit_BadBackslash '\\'> <']'> ) } {($ Id.VSub_Number 1)} ) (C {<wc>} {<-l>}) ] negated: F stderr_indices: [] ) right: <Id.Eof_RParen _> ) } spids: [55] ) ] redirects: [] ) (C {<test>} {($ Id.VSub_DollarName cnt)} {<Id.Lit_Equals '='>} {($ Id.VSub_Number 2)}) ] ) ] redirects: [] right: <Id.Lit_RBrace '}'> ) ) (command.ShFunction name: test_single_no_numbered body: (BraceGroup left: <Id.Lit_LBrace '{'> children: [(C {<test_num_no_numbered>} {($ Id.VSub_Number 1)} {<1>})] redirects: [] right: <Id.Lit_RBrace '}'> ) ) (command.ShFunction name: test_no_numbered body: (BraceGroup left: <Id.Lit_LBrace '{'> children: [(C {<test_num_no_numbered>} {($ Id.VSub_Number 1)} {<2>})] redirects: [] right: <Id.Lit_RBrace '}'> ) ) (command.ShFunction name: test_single_cover_letter_numbered body: (BraceGroup left: <Id.Lit_LBrace '{'> children: [ (command.AndOr ops: [Id.Op_DAmp] children: [ (C {<grep>} { (DQ <'^Subject: '> <Id.Lit_BadBackslash '\\'> <'[PATCH 0/1'> <Id.Lit_BadBackslash '\\'> <']'> ) } {($ Id.VSub_Number 1)} ) (C {<grep>} { (DQ <'^Subject: '> <Id.Lit_BadBackslash '\\'> <'[PATCH 1/1'> <Id.Lit_BadBackslash '\\'> <']'> ) } {($ Id.VSub_Number 1)} ) ] ) ] redirects: [] right: <Id.Lit_RBrace '}'> ) ) (command.ShFunction name: test_single_numbered body: (BraceGroup left: <Id.Lit_LBrace '{'> children: [ (C {<grep>} { (DQ <'^Subject: '> <Id.Lit_BadBackslash '\\'> <'[PATCH 1/1'> <Id.Lit_BadBackslash '\\'> <']'> ) } {($ Id.VSub_Number 1)} ) ] redirects: [] right: <Id.Lit_RBrace '}'> ) ) (command.ShFunction name: test_numbered body: (BraceGroup left: <Id.Lit_LBrace '{'> children: [ (command.AndOr ops: [Id.Op_DAmp] children: [ (C {<grep>} { (DQ <'^Subject: '> <Id.Lit_BadBackslash '\\'> <'[PATCH 1/2'> <Id.Lit_BadBackslash '\\'> <']'> ) } {($ Id.VSub_Number 1)} ) (C {<grep>} { (DQ <'^Subject: '> <Id.Lit_BadBackslash '\\'> <'[PATCH 2/2'> <Id.Lit_BadBackslash '\\'> <']'> ) } {($ Id.VSub_Number 1)} ) ] ) ] redirects: [] right: <Id.Lit_RBrace '}'> ) ) (C {<test_expect_success>} {(SQ <'single patch defaults to no numbers'>)} { (SQ <'\n'> <'\tgit format-patch --stdout HEAD~1 >patch0.single &&\n'> <'\ttest_single_no_numbered patch0.single\n'> ) } ) (C {<test_expect_success>} {(SQ <'multiple patch defaults to numbered'>)} { (SQ <'\n'> <'\n'> <'\tgit format-patch --stdout HEAD~2 >patch0.multiple &&\n'> <'\ttest_numbered patch0.multiple\n'> <'\n'> ) } ) (C {<test_expect_success>} {(SQ <'Use --numbered'>)} { (SQ <'\n'> <'\n'> <'\tgit format-patch --numbered --stdout HEAD~1 >patch1 &&\n'> <'\ttest_single_numbered patch1\n'> <'\n'> ) } ) (C {<test_expect_success>} {(SQ <'format.numbered = true'>)} { (SQ <'\n'> <'\n'> <'\tgit config format.numbered true &&\n'> <'\tgit format-patch --stdout HEAD~2 >patch2 &&\n'> <'\ttest_numbered patch2\n'> <'\n'> ) } ) (C {<test_expect_success>} {(SQ <'format.numbered && single patch'>)} { (SQ <'\n'> <'\n'> <'\tgit format-patch --stdout HEAD^ > patch3 &&\n'> <'\ttest_single_numbered patch3\n'> <'\n'> ) } ) (C {<test_expect_success>} {(SQ <'format.numbered && --no-numbered'>)} { (SQ <'\n'> <'\n'> <'\tgit format-patch --no-numbered --stdout HEAD~2 >patch4 &&\n'> <'\ttest_no_numbered patch4\n'> <'\n'> ) } ) (C {<test_expect_success>} {(SQ <'format.numbered && --keep-subject'>)} { (SQ <'\n'> <'\n'> <'\tgit format-patch --keep-subject --stdout HEAD^ >patch4a &&\n'> <'\tgrep "^Subject: Third" patch4a\n'> <'\n'> ) } ) (C {<test_expect_success>} {(SQ <'format.numbered = auto'>)} { (SQ <'\n'> <'\n'> <'\tgit config format.numbered auto &&\n'> <'\tgit format-patch --stdout HEAD~2 > patch5 &&\n'> <'\ttest_numbered patch5\n'> <'\n'> ) } ) (C {<test_expect_success>} {(SQ <'format.numbered = auto && single patch'>)} { (SQ <'\n'> <'\n'> <'\tgit format-patch --stdout HEAD^ > patch6 &&\n'> <'\ttest_single_no_numbered patch6\n'> <'\n'> ) } ) (C {<test_expect_success>} {(SQ <'format.numbered = auto && --no-numbered'>)} { (SQ <'\n'> <'\n'> <'\tgit format-patch --no-numbered --stdout HEAD~2 > patch7 &&\n'> <'\ttest_no_numbered patch7\n'> <'\n'> ) } ) (C {<test_expect_success>} {(SQ <'--start-number && --numbered'>)} { (SQ <'\n'> <'\n'> <'\tgit format-patch --start-number 3 --numbered --stdout HEAD~1 > patch8 &&\n'> <'\tgrep "^Subject: \\[PATCH 3/3\\]" patch8\n'> ) } ) (C {<test_expect_success>} {(SQ <'single patch with cover-letter defaults to numbers'>)} { (SQ <'\n'> <'\tgit format-patch --cover-letter --stdout HEAD~1 >patch9.single &&\n'> <'\ttest_single_cover_letter_numbered patch9.single\n'> ) } ) (C {<test_expect_success>} {(SQ <'Use --no-numbered and --cover-letter single patch'>)} { (SQ <'\n'> <'\tgit format-patch --no-numbered --stdout --cover-letter HEAD~1 >patch10 &&\n'> <'\ttest_no_numbered patch10\n'> ) } ) (C {<test_done>}) ] )