3 # Copyright (c) 2006 Brian C Gernhardt
6 test_description
='Format-patch numbering options'
10 test_expect_success setup
'
14 git commit -m First &&
17 git commit -a -m Second &&
20 git commit -a -m Third
24 # Each of these gets used multiple times.
26 test_num_no_numbered
() {
27 cnt
=$
(grep "^Subject: \[PATCH\]" $1 |
wc -l) &&
31 test_single_no_numbered
() {
32 test_num_no_numbered
$1 1
36 test_num_no_numbered
$1 2
39 test_single_numbered
() {
40 grep "^Subject: \[PATCH 1/1\]" $1
44 grep "^Subject: \[PATCH 1/2\]" $1 &&
45 grep "^Subject: \[PATCH 2/2\]" $1
48 test_expect_success
'Default: no numbered' '
50 git format-patch --stdout HEAD~2 >patch0 &&
51 test_no_numbered patch0
55 test_expect_success
'Use --numbered' '
57 git format-patch --numbered --stdout HEAD~2 >patch1 &&
62 test_expect_success
'format.numbered = true' '
64 git config format.numbered true &&
65 git format-patch --stdout HEAD~2 >patch2 &&
70 test_expect_success
'format.numbered && single patch' '
72 git format-patch --stdout HEAD^ > patch3 &&
73 test_single_numbered patch3
77 test_expect_success
'format.numbered && --no-numbered' '
79 git format-patch --no-numbered --stdout HEAD~2 >patch4 &&
80 test_no_numbered patch4
84 test_expect_success
'format.numbered = auto' '
86 git config format.numbered auto
87 git format-patch --stdout HEAD~2 > patch5 &&
92 test_expect_success
'format.numbered = auto && single patch' '
94 git format-patch --stdout HEAD^ > patch6 &&
95 test_single_no_numbered patch6
99 test_expect_success
'format.numbered = auto && --no-numbered' '
101 git format-patch --no-numbered --stdout HEAD~2 > patch7 &&
102 test_no_numbered patch7