Skip to content

Commit 747e250

Browse files
bebarinogitster
authored andcommitted
format-patch: --numbered-files and --stdout aren't mutually exclusive
For example: git format-patch --numbered-files --stdout --attach HEAD~~ will create two messages with files 1 and 2 attached respectively. There is no effect when using --numbered-files and --stdout together without an --attach or --inline, the --numbered-files option will be ignored. Add a test to show this. Signed-off-by: Stephen Boyd <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 108dab2 commit 747e250

File tree

2 files changed

+171
-1
lines changed

2 files changed

+171
-1
lines changed

t/t4013-diff-various.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ format-patch --attach --stdout initial..master^
251251
format-patch --attach --stdout initial..master
252252
format-patch --inline --stdout initial..side
253253
format-patch --inline --stdout initial..master^
254-
format-patch --inline --stdout initial..master
254+
format-patch --inline --stdout --numbered-files initial..master
255255
format-patch --inline --stdout initial..master
256256
format-patch --inline --stdout --subject-prefix=TESTCASE initial..master
257257
config format.subjectprefix DIFFERENT_PREFIX
Lines changed: 170 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,170 @@
1+
$ git format-patch --inline --stdout --numbered-files initial..master
2+
From 1bde4ae5f36c8d9abe3a0fce0c6aab3c4a12fe44 Mon Sep 17 00:00:00 2001
3+
From: A U Thor <[email protected]>
4+
Date: Mon, 26 Jun 2006 00:01:00 +0000
5+
Subject: [PATCH 1/3] Second
6+
MIME-Version: 1.0
7+
Content-Type: multipart/mixed; boundary="------------g-i-t--v-e-r-s-i-o-n"
8+
9+
This is a multi-part message in MIME format.
10+
--------------g-i-t--v-e-r-s-i-o-n
11+
Content-Type: text/plain; charset=UTF-8; format=fixed
12+
Content-Transfer-Encoding: 8bit
13+
14+
15+
This is the second commit.
16+
---
17+
dir/sub | 2 ++
18+
file0 | 3 +++
19+
file2 | 3 ---
20+
3 files changed, 5 insertions(+), 3 deletions(-)
21+
delete mode 100644 file2
22+
23+
24+
--------------g-i-t--v-e-r-s-i-o-n
25+
Content-Type: text/x-patch; name="1"
26+
Content-Transfer-Encoding: 8bit
27+
Content-Disposition: inline; filename="1"
28+
29+
diff --git a/dir/sub b/dir/sub
30+
index 35d242b..8422d40 100644
31+
--- a/dir/sub
32+
+++ b/dir/sub
33+
@@ -1,2 +1,4 @@
34+
A
35+
B
36+
+C
37+
+D
38+
diff --git a/file0 b/file0
39+
index 01e79c3..b414108 100644
40+
--- a/file0
41+
+++ b/file0
42+
@@ -1,3 +1,6 @@
43+
1
44+
2
45+
3
46+
+4
47+
+5
48+
+6
49+
diff --git a/file2 b/file2
50+
deleted file mode 100644
51+
index 01e79c3..0000000
52+
--- a/file2
53+
+++ /dev/null
54+
@@ -1,3 +0,0 @@
55+
-1
56+
-2
57+
-3
58+
59+
--------------g-i-t--v-e-r-s-i-o-n--
60+
61+
62+
63+
From 9a6d4949b6b76956d9d5e26f2791ec2ceff5fdc0 Mon Sep 17 00:00:00 2001
64+
From: A U Thor <[email protected]>
65+
Date: Mon, 26 Jun 2006 00:02:00 +0000
66+
Subject: [PATCH 2/3] Third
67+
MIME-Version: 1.0
68+
Content-Type: multipart/mixed; boundary="------------g-i-t--v-e-r-s-i-o-n"
69+
70+
This is a multi-part message in MIME format.
71+
--------------g-i-t--v-e-r-s-i-o-n
72+
Content-Type: text/plain; charset=UTF-8; format=fixed
73+
Content-Transfer-Encoding: 8bit
74+
75+
---
76+
dir/sub | 2 ++
77+
file1 | 3 +++
78+
2 files changed, 5 insertions(+), 0 deletions(-)
79+
create mode 100644 file1
80+
81+
82+
--------------g-i-t--v-e-r-s-i-o-n
83+
Content-Type: text/x-patch; name="2"
84+
Content-Transfer-Encoding: 8bit
85+
Content-Disposition: inline; filename="2"
86+
87+
diff --git a/dir/sub b/dir/sub
88+
index 8422d40..cead32e 100644
89+
--- a/dir/sub
90+
+++ b/dir/sub
91+
@@ -2,3 +2,5 @@ A
92+
B
93+
C
94+
D
95+
+E
96+
+F
97+
diff --git a/file1 b/file1
98+
new file mode 100644
99+
index 0000000..b1e6722
100+
--- /dev/null
101+
+++ b/file1
102+
@@ -0,0 +1,3 @@
103+
+A
104+
+B
105+
+C
106+
107+
--------------g-i-t--v-e-r-s-i-o-n--
108+
109+
110+
111+
From c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a Mon Sep 17 00:00:00 2001
112+
From: A U Thor <[email protected]>
113+
Date: Mon, 26 Jun 2006 00:03:00 +0000
114+
Subject: [PATCH 3/3] Side
115+
MIME-Version: 1.0
116+
Content-Type: multipart/mixed; boundary="------------g-i-t--v-e-r-s-i-o-n"
117+
118+
This is a multi-part message in MIME format.
119+
--------------g-i-t--v-e-r-s-i-o-n
120+
Content-Type: text/plain; charset=UTF-8; format=fixed
121+
Content-Transfer-Encoding: 8bit
122+
123+
---
124+
dir/sub | 2 ++
125+
file0 | 3 +++
126+
file3 | 4 ++++
127+
3 files changed, 9 insertions(+), 0 deletions(-)
128+
create mode 100644 file3
129+
130+
131+
--------------g-i-t--v-e-r-s-i-o-n
132+
Content-Type: text/x-patch; name="3"
133+
Content-Transfer-Encoding: 8bit
134+
Content-Disposition: inline; filename="3"
135+
136+
diff --git a/dir/sub b/dir/sub
137+
index 35d242b..7289e35 100644
138+
--- a/dir/sub
139+
+++ b/dir/sub
140+
@@ -1,2 +1,4 @@
141+
A
142+
B
143+
+1
144+
+2
145+
diff --git a/file0 b/file0
146+
index 01e79c3..f4615da 100644
147+
--- a/file0
148+
+++ b/file0
149+
@@ -1,3 +1,6 @@
150+
1
151+
2
152+
3
153+
+A
154+
+B
155+
+C
156+
diff --git a/file3 b/file3
157+
new file mode 100644
158+
index 0000000..7289e35
159+
--- /dev/null
160+
+++ b/file3
161+
@@ -0,0 +1,4 @@
162+
+A
163+
+B
164+
+1
165+
+2
166+
167+
--------------g-i-t--v-e-r-s-i-o-n--
168+
169+
170+
$

0 commit comments

Comments
 (0)