Rename diff.suppress-blank-empty to diff.suppressBlankEmpty
[git/platforms.git] / t / t4021-format-patch-numbered.sh
blob390af2389f3b9559fcfebe1e21a24317562ab7af
1 #!/bin/sh
3 # Copyright (c) 2006 Brian C Gernhardt
6 test_description='Format-patch numbering options'
8 . ./test-lib.sh
10 test_expect_success setup '
12 echo A > file &&
13 git add file &&
14 git commit -m First &&
16 echo B >> file &&
17 git commit -a -m Second &&
19 echo C >> file &&
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) &&
28 test $cnt = $2
31 test_single_no_numbered() {
32 test_num_no_numbered $1 1
35 test_no_numbered() {
36 test_num_no_numbered $1 2
39 test_single_numbered() {
40 grep "^Subject: \[PATCH 1/1\]" $1
43 test_numbered() {
44 grep "^Subject: \[PATCH 1/2\]" $1 &&
45 grep "^Subject: \[PATCH 2/2\]" $1
48 test_expect_success 'single patch defaults to no numbers' '
49 git format-patch --stdout HEAD~1 >patch0.single &&
50 test_single_no_numbered patch0.single
53 test_expect_success 'multiple patch defaults to numbered' '
55 git format-patch --stdout HEAD~2 >patch0.multiple &&
56 test_numbered patch0.multiple
60 test_expect_success 'Use --numbered' '
62 git format-patch --numbered --stdout HEAD~1 >patch1 &&
63 test_single_numbered patch1
67 test_expect_success 'format.numbered = true' '
69 git config format.numbered true &&
70 git format-patch --stdout HEAD~2 >patch2 &&
71 test_numbered patch2
75 test_expect_success 'format.numbered && single patch' '
77 git format-patch --stdout HEAD^ > patch3 &&
78 test_single_numbered patch3
82 test_expect_success 'format.numbered && --no-numbered' '
84 git format-patch --no-numbered --stdout HEAD~2 >patch4 &&
85 test_no_numbered patch4
89 test_expect_success 'format.numbered = auto' '
91 git config format.numbered auto
92 git format-patch --stdout HEAD~2 > patch5 &&
93 test_numbered patch5
97 test_expect_success 'format.numbered = auto && single patch' '
99 git format-patch --stdout HEAD^ > patch6 &&
100 test_single_no_numbered patch6
104 test_expect_success 'format.numbered = auto && --no-numbered' '
106 git format-patch --no-numbered --stdout HEAD~2 > patch7 &&
107 test_no_numbered patch7
111 test_done