@matheusbsbs / matheus-bagliano / commits / d410e43b35
Fork 0

t4013: add format-patch tests.

Signed-off-by: Junio C Hamano <junkio@cox.net>

Junio C Hamano committed Jun 29, 2006 at 00:01 UTC d410e43b35a8044472606a7e7018aa64d96a5f0f
7 files changed +581 -1
t/t4013-diff-various.sh
+9 -1
@@ -85,6 +85,7 @@ test_expect_success setup '
85 +*+ [initial] Initial
86 EOF
87
88 +V=`git version | sed -e 's/^git version //'`
89 while read cmd
90 do
91 case "$cmd" in
@@ -99,7 +100,7 @@ do
100 test_expect_success "git $cmd" '
101 {
102 echo "\$ git $cmd"
102 - git $cmd
103 + git $cmd | sed -e "s/$V/g-i-t--v-e-r-s-i-o-n/"
104 echo "\$"
105 } >"$actual" &&
106 if test -f "$expect"
@@ -219,6 +220,13 @@ show --patch-with-stat side
220 show --patch-with-raw side
221 show --patch-with-stat --summary side
222
223 +format-patch --stdout initial..side
224 +format-patch --stdout initial..master^
225 +format-patch --stdout initial..master
226 +format-patch --attach --stdout initial..side
227 +format-patch --attach --stdout initial..master^
228 +format-patch --attach --stdout initial..master
229 +
230 EOF
231
232 test_done
t/t4013/diff.format-patch_--attach_--stdout_initial..master new
+165
@@ -0,0 +1,165 @@
1 +$ git format-patch --attach --stdout initial..master
2 +From 7952a93e09bf565b5592766a438b40cd81f4846f Mon Sep 17 00:00:00 2001
3 +From: A U Thor <author@example.com>
4 +Date: Mon, 26 Jun 2006 00:01:00 +0000
5 +Subject: [PATCH] Second
6 +MIME-Version: 1.0
7 +Content-Type: multipart/mixed;
8 + boundary="------------g-i-t--v-e-r-s-i-o-n"
9 +
10 +This is a multi-part message in MIME format.
11 +--------------g-i-t--v-e-r-s-i-o-n
12 +Content-Type: text/plain; charset=UTF-8; format=fixed
13 +Content-Transfer-Encoding: 8bit
14 +---
15 + dir/sub | 2 ++
16 + file0 | 3 +++
17 + file2 | 3 ---
18 + 3 files changed, 5 insertions(+), 3 deletions(-)
19 +--------------g-i-t--v-e-r-s-i-o-n
20 +Content-Type: text/x-patch;
21 + name="7952a93e09bf565b5592766a438b40cd81f4846f.diff"
22 +Content-Transfer-Encoding: 8bit
23 +Content-Disposition: inline;
24 + filename="7952a93e09bf565b5592766a438b40cd81f4846f.diff"
25 +
26 +diff --git a/dir/sub b/dir/sub
27 +index 35d242b..8422d40 100644
28 +--- a/dir/sub
29 ++++ b/dir/sub
30 +@@ -1,2 +1,4 @@
31 + A
32 + B
33 ++C
34 ++D
35 +diff --git a/file0 b/file0
36 +index 01e79c3..b414108 100644
37 +--- a/file0
38 ++++ b/file0
39 +@@ -1,3 +1,6 @@
40 + 1
41 + 2
42 + 3
43 ++4
44 ++5
45 ++6
46 +diff --git a/file2 b/file2
47 +deleted file mode 100644
48 +index 01e79c3..0000000
49 +--- a/file2
50 ++++ /dev/null
51 +@@ -1,3 +0,0 @@
52 +-1
53 +-2
54 +-3
55 +
56 +--------------g-i-t--v-e-r-s-i-o-n--
57 +
58 +
59 +
60 +From 889b315013ef9f2e2f90aa0b054b267c8a557847 Mon Sep 17 00:00:00 2001
61 +From: A U Thor <author@example.com>
62 +Date: Mon, 26 Jun 2006 00:02:00 +0000
63 +Subject: [PATCH] Third
64 +MIME-Version: 1.0
65 +Content-Type: multipart/mixed;
66 + boundary="------------g-i-t--v-e-r-s-i-o-n"
67 +
68 +This is a multi-part message in MIME format.
69 +--------------g-i-t--v-e-r-s-i-o-n
70 +Content-Type: text/plain; charset=UTF-8; format=fixed
71 +Content-Transfer-Encoding: 8bit
72 +---
73 + dir/sub | 2 ++
74 + file1 | 3 +++
75 + 2 files changed, 5 insertions(+), 0 deletions(-)
76 +--------------g-i-t--v-e-r-s-i-o-n
77 +Content-Type: text/x-patch;
78 + name="889b315013ef9f2e2f90aa0b054b267c8a557847.diff"
79 +Content-Transfer-Encoding: 8bit
80 +Content-Disposition: inline;
81 + filename="889b315013ef9f2e2f90aa0b054b267c8a557847.diff"
82 +
83 +diff --git a/dir/sub b/dir/sub
84 +index 8422d40..cead32e 100644
85 +--- a/dir/sub
86 ++++ b/dir/sub
87 +@@ -2,3 +2,5 @@ A
88 + B
89 + C
90 + D
91 ++E
92 ++F
93 +diff --git a/file1 b/file1
94 +new file mode 100644
95 +index 0000000..b1e6722
96 +--- /dev/null
97 ++++ b/file1
98 +@@ -0,0 +1,3 @@
99 ++A
100 ++B
101 ++C
102 +
103 +--------------g-i-t--v-e-r-s-i-o-n--
104 +
105 +
106 +
107 +From c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a Mon Sep 17 00:00:00 2001
108 +From: A U Thor <author@example.com>
109 +Date: Mon, 26 Jun 2006 00:03:00 +0000
110 +Subject: [PATCH] Side
111 +MIME-Version: 1.0
112 +Content-Type: multipart/mixed;
113 + boundary="------------g-i-t--v-e-r-s-i-o-n"
114 +
115 +This is a multi-part message in MIME format.
116 +--------------g-i-t--v-e-r-s-i-o-n
117 +Content-Type: text/plain; charset=UTF-8; format=fixed
118 +Content-Transfer-Encoding: 8bit
119 +---
120 + dir/sub | 2 ++
121 + file0 | 3 +++
122 + file3 | 4 ++++
123 + 3 files changed, 9 insertions(+), 0 deletions(-)
124 +--------------g-i-t--v-e-r-s-i-o-n
125 +Content-Type: text/x-patch;
126 + name="c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a.diff"
127 +Content-Transfer-Encoding: 8bit
128 +Content-Disposition: inline;
129 + filename="c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a.diff"
130 +
131 +diff --git a/dir/sub b/dir/sub
132 +index 35d242b..7289e35 100644
133 +--- a/dir/sub
134 ++++ b/dir/sub
135 +@@ -1,2 +1,4 @@
136 + A
137 + B
138 ++1
139 ++2
140 +diff --git a/file0 b/file0
141 +index 01e79c3..f4615da 100644
142 +--- a/file0
143 ++++ b/file0
144 +@@ -1,3 +1,6 @@
145 + 1
146 + 2
147 + 3
148 ++A
149 ++B
150 ++C
151 +diff --git a/file3 b/file3
152 +new file mode 100644
153 +index 0000000..7289e35
154 +--- /dev/null
155 ++++ b/file3
156 +@@ -0,0 +1,4 @@
157 ++A
158 ++B
159 ++1
160 ++2
161 +
162 +--------------g-i-t--v-e-r-s-i-o-n--
163 +
164 +
165 +$
t/t4013/diff.format-patch_--attach_--stdout_initial..master^ new
+106
@@ -0,0 +1,106 @@
1 +$ git format-patch --attach --stdout initial..master^
2 +From 7952a93e09bf565b5592766a438b40cd81f4846f Mon Sep 17 00:00:00 2001
3 +From: A U Thor <author@example.com>
4 +Date: Mon, 26 Jun 2006 00:01:00 +0000
5 +Subject: [PATCH] Second
6 +MIME-Version: 1.0
7 +Content-Type: multipart/mixed;
8 + boundary="------------g-i-t--v-e-r-s-i-o-n"
9 +
10 +This is a multi-part message in MIME format.
11 +--------------g-i-t--v-e-r-s-i-o-n
12 +Content-Type: text/plain; charset=UTF-8; format=fixed
13 +Content-Transfer-Encoding: 8bit
14 +---
15 + dir/sub | 2 ++
16 + file0 | 3 +++
17 + file2 | 3 ---
18 + 3 files changed, 5 insertions(+), 3 deletions(-)
19 +--------------g-i-t--v-e-r-s-i-o-n
20 +Content-Type: text/x-patch;
21 + name="7952a93e09bf565b5592766a438b40cd81f4846f.diff"
22 +Content-Transfer-Encoding: 8bit
23 +Content-Disposition: inline;
24 + filename="7952a93e09bf565b5592766a438b40cd81f4846f.diff"
25 +
26 +diff --git a/dir/sub b/dir/sub
27 +index 35d242b..8422d40 100644
28 +--- a/dir/sub
29 ++++ b/dir/sub
30 +@@ -1,2 +1,4 @@
31 + A
32 + B
33 ++C
34 ++D
35 +diff --git a/file0 b/file0
36 +index 01e79c3..b414108 100644
37 +--- a/file0
38 ++++ b/file0
39 +@@ -1,3 +1,6 @@
40 + 1
41 + 2
42 + 3
43 ++4
44 ++5
45 ++6
46 +diff --git a/file2 b/file2
47 +deleted file mode 100644
48 +index 01e79c3..0000000
49 +--- a/file2
50 ++++ /dev/null
51 +@@ -1,3 +0,0 @@
52 +-1
53 +-2
54 +-3
55 +
56 +--------------g-i-t--v-e-r-s-i-o-n--
57 +
58 +
59 +
60 +From 889b315013ef9f2e2f90aa0b054b267c8a557847 Mon Sep 17 00:00:00 2001
61 +From: A U Thor <author@example.com>
62 +Date: Mon, 26 Jun 2006 00:02:00 +0000
63 +Subject: [PATCH] Third
64 +MIME-Version: 1.0
65 +Content-Type: multipart/mixed;
66 + boundary="------------g-i-t--v-e-r-s-i-o-n"
67 +
68 +This is a multi-part message in MIME format.
69 +--------------g-i-t--v-e-r-s-i-o-n
70 +Content-Type: text/plain; charset=UTF-8; format=fixed
71 +Content-Transfer-Encoding: 8bit
72 +---
73 + dir/sub | 2 ++
74 + file1 | 3 +++
75 + 2 files changed, 5 insertions(+), 0 deletions(-)
76 +--------------g-i-t--v-e-r-s-i-o-n
77 +Content-Type: text/x-patch;
78 + name="889b315013ef9f2e2f90aa0b054b267c8a557847.diff"
79 +Content-Transfer-Encoding: 8bit
80 +Content-Disposition: inline;
81 + filename="889b315013ef9f2e2f90aa0b054b267c8a557847.diff"
82 +
83 +diff --git a/dir/sub b/dir/sub
84 +index 8422d40..cead32e 100644
85 +--- a/dir/sub
86 ++++ b/dir/sub
87 +@@ -2,3 +2,5 @@ A
88 + B
89 + C
90 + D
91 ++E
92 ++F
93 +diff --git a/file1 b/file1
94 +new file mode 100644
95 +index 0000000..b1e6722
96 +--- /dev/null
97 ++++ b/file1
98 +@@ -0,0 +1,3 @@
99 ++A
100 ++B
101 ++C
102 +
103 +--------------g-i-t--v-e-r-s-i-o-n--
104 +
105 +
106 +$
t/t4013/diff.format-patch_--attach_--stdout_initial..side new
+60
@@ -0,0 +1,60 @@
1 +$ git format-patch --attach --stdout initial..side
2 +From c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a Mon Sep 17 00:00:00 2001
3 +From: A U Thor <author@example.com>
4 +Date: Mon, 26 Jun 2006 00:03:00 +0000
5 +Subject: [PATCH] Side
6 +MIME-Version: 1.0
7 +Content-Type: multipart/mixed;
8 + boundary="------------g-i-t--v-e-r-s-i-o-n"
9 +
10 +This is a multi-part message in MIME format.
11 +--------------g-i-t--v-e-r-s-i-o-n
12 +Content-Type: text/plain; charset=UTF-8; format=fixed
13 +Content-Transfer-Encoding: 8bit
14 +---
15 + dir/sub | 2 ++
16 + file0 | 3 +++
17 + file3 | 4 ++++
18 + 3 files changed, 9 insertions(+), 0 deletions(-)
19 +--------------g-i-t--v-e-r-s-i-o-n
20 +Content-Type: text/x-patch;
21 + name="c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a.diff"
22 +Content-Transfer-Encoding: 8bit
23 +Content-Disposition: inline;
24 + filename="c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a.diff"
25 +
26 +diff --git a/dir/sub b/dir/sub
27 +index 35d242b..7289e35 100644
28 +--- a/dir/sub
29 ++++ b/dir/sub
30 +@@ -1,2 +1,4 @@
31 + A
32 + B
33 ++1
34 ++2
35 +diff --git a/file0 b/file0
36 +index 01e79c3..f4615da 100644
37 +--- a/file0
38 ++++ b/file0
39 +@@ -1,3 +1,6 @@
40 + 1
41 + 2
42 + 3
43 ++A
44 ++B
45 ++C
46 +diff --git a/file3 b/file3
47 +new file mode 100644
48 +index 0000000..7289e35
49 +--- /dev/null
50 ++++ b/file3
51 +@@ -0,0 +1,4 @@
52 ++A
53 ++B
54 ++1
55 ++2
56 +
57 +--------------g-i-t--v-e-r-s-i-o-n--
58 +
59 +
60 +$
t/t4013/diff.format-patch_--stdout_initial..master new
+120
@@ -0,0 +1,120 @@
1 +$ git format-patch --stdout initial..master
2 +From 7952a93e09bf565b5592766a438b40cd81f4846f Mon Sep 17 00:00:00 2001
3 +From: A U Thor <author@example.com>
4 +Date: Mon, 26 Jun 2006 00:01:00 +0000
5 +Subject: [PATCH] Second
6 +---
7 + dir/sub | 2 ++
8 + file0 | 3 +++
9 + file2 | 3 ---
10 + 3 files changed, 5 insertions(+), 3 deletions(-)
11 +
12 +diff --git a/dir/sub b/dir/sub
13 +index 35d242b..8422d40 100644
14 +--- a/dir/sub
15 ++++ b/dir/sub
16 +@@ -1,2 +1,4 @@
17 + A
18 + B
19 ++C
20 ++D
21 +diff --git a/file0 b/file0
22 +index 01e79c3..b414108 100644
23 +--- a/file0
24 ++++ b/file0
25 +@@ -1,3 +1,6 @@
26 + 1
27 + 2
28 + 3
29 ++4
30 ++5
31 ++6
32 +diff --git a/file2 b/file2
33 +deleted file mode 100644
34 +index 01e79c3..0000000
35 +--- a/file2
36 ++++ /dev/null
37 +@@ -1,3 +0,0 @@
38 +-1
39 +-2
40 +-3
41 +--
42 +g-i-t--v-e-r-s-i-o-n
43 +
44 +
45 +From 889b315013ef9f2e2f90aa0b054b267c8a557847 Mon Sep 17 00:00:00 2001
46 +From: A U Thor <author@example.com>
47 +Date: Mon, 26 Jun 2006 00:02:00 +0000
48 +Subject: [PATCH] Third
49 +---
50 + dir/sub | 2 ++
51 + file1 | 3 +++
52 + 2 files changed, 5 insertions(+), 0 deletions(-)
53 +
54 +diff --git a/dir/sub b/dir/sub
55 +index 8422d40..cead32e 100644
56 +--- a/dir/sub
57 ++++ b/dir/sub
58 +@@ -2,3 +2,5 @@ A
59 + B
60 + C
61 + D
62 ++E
63 ++F
64 +diff --git a/file1 b/file1
65 +new file mode 100644
66 +index 0000000..b1e6722
67 +--- /dev/null
68 ++++ b/file1
69 +@@ -0,0 +1,3 @@
70 ++A
71 ++B
72 ++C
73 +--
74 +g-i-t--v-e-r-s-i-o-n
75 +
76 +
77 +From c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a Mon Sep 17 00:00:00 2001
78 +From: A U Thor <author@example.com>
79 +Date: Mon, 26 Jun 2006 00:03:00 +0000
80 +Subject: [PATCH] Side
81 +---
82 + dir/sub | 2 ++
83 + file0 | 3 +++
84 + file3 | 4 ++++
85 + 3 files changed, 9 insertions(+), 0 deletions(-)
86 +
87 +diff --git a/dir/sub b/dir/sub
88 +index 35d242b..7289e35 100644
89 +--- a/dir/sub
90 ++++ b/dir/sub
91 +@@ -1,2 +1,4 @@
92 + A
93 + B
94 ++1
95 ++2
96 +diff --git a/file0 b/file0
97 +index 01e79c3..f4615da 100644
98 +--- a/file0
99 ++++ b/file0
100 +@@ -1,3 +1,6 @@
101 + 1
102 + 2
103 + 3
104 ++A
105 ++B
106 ++C
107 +diff --git a/file3 b/file3
108 +new file mode 100644
109 +index 0000000..7289e35
110 +--- /dev/null
111 ++++ b/file3
112 +@@ -0,0 +1,4 @@
113 ++A
114 ++B
115 ++1
116 ++2
117 +--
118 +g-i-t--v-e-r-s-i-o-n
119 +
120 +$
t/t4013/diff.format-patch_--stdout_initial..master^ new
+76
@@ -0,0 +1,76 @@
1 +$ git format-patch --stdout initial..master^
2 +From 7952a93e09bf565b5592766a438b40cd81f4846f Mon Sep 17 00:00:00 2001
3 +From: A U Thor <author@example.com>
4 +Date: Mon, 26 Jun 2006 00:01:00 +0000
5 +Subject: [PATCH] Second
6 +---
7 + dir/sub | 2 ++
8 + file0 | 3 +++
9 + file2 | 3 ---
10 + 3 files changed, 5 insertions(+), 3 deletions(-)
11 +
12 +diff --git a/dir/sub b/dir/sub
13 +index 35d242b..8422d40 100644
14 +--- a/dir/sub
15 ++++ b/dir/sub
16 +@@ -1,2 +1,4 @@
17 + A
18 + B
19 ++C
20 ++D
21 +diff --git a/file0 b/file0
22 +index 01e79c3..b414108 100644
23 +--- a/file0
24 ++++ b/file0
25 +@@ -1,3 +1,6 @@
26 + 1
27 + 2
28 + 3
29 ++4
30 ++5
31 ++6
32 +diff --git a/file2 b/file2
33 +deleted file mode 100644
34 +index 01e79c3..0000000
35 +--- a/file2
36 ++++ /dev/null
37 +@@ -1,3 +0,0 @@
38 +-1
39 +-2
40 +-3
41 +--
42 +g-i-t--v-e-r-s-i-o-n
43 +
44 +
45 +From 889b315013ef9f2e2f90aa0b054b267c8a557847 Mon Sep 17 00:00:00 2001
46 +From: A U Thor <author@example.com>
47 +Date: Mon, 26 Jun 2006 00:02:00 +0000
48 +Subject: [PATCH] Third
49 +---
50 + dir/sub | 2 ++
51 + file1 | 3 +++
52 + 2 files changed, 5 insertions(+), 0 deletions(-)
53 +
54 +diff --git a/dir/sub b/dir/sub
55 +index 8422d40..cead32e 100644
56 +--- a/dir/sub
57 ++++ b/dir/sub
58 +@@ -2,3 +2,5 @@ A
59 + B
60 + C
61 + D
62 ++E
63 ++F
64 +diff --git a/file1 b/file1
65 +new file mode 100644
66 +index 0000000..b1e6722
67 +--- /dev/null
68 ++++ b/file1
69 +@@ -0,0 +1,3 @@
70 ++A
71 ++B
72 ++C
73 +--
74 +g-i-t--v-e-r-s-i-o-n
75 +
76 +$
t/t4013/diff.format-patch_--stdout_initial..side new
+45
@@ -0,0 +1,45 @@
1 +$ git format-patch --stdout initial..side
2 +From c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a Mon Sep 17 00:00:00 2001
3 +From: A U Thor <author@example.com>
4 +Date: Mon, 26 Jun 2006 00:03:00 +0000
5 +Subject: [PATCH] Side
6 +---
7 + dir/sub | 2 ++
8 + file0 | 3 +++
9 + file3 | 4 ++++
10 + 3 files changed, 9 insertions(+), 0 deletions(-)
11 +
12 +diff --git a/dir/sub b/dir/sub
13 +index 35d242b..7289e35 100644
14 +--- a/dir/sub
15 ++++ b/dir/sub
16 +@@ -1,2 +1,4 @@
17 + A
18 + B
19 ++1
20 ++2
21 +diff --git a/file0 b/file0
22 +index 01e79c3..f4615da 100644
23 +--- a/file0
24 ++++ b/file0
25 +@@ -1,3 +1,6 @@
26 + 1
27 + 2
28 + 3
29 ++A
30 ++B
31 ++C
32 +diff --git a/file3 b/file3
33 +new file mode 100644
34 +index 0000000..7289e35
35 +--- /dev/null
36 ++++ b/file3
37 +@@ -0,0 +1,4 @@
38 ++A
39 ++B
40 ++1
41 ++2
42 +--
43 +g-i-t--v-e-r-s-i-o-n
44 +
45 +$