t4013: add tests for -m failing to override -c/--cc

Logically, -m, -c, --cc specify 3 different formats for representing merge commits, yet -m doesn't in fact override -c or --cc, that makes no sense. Add 2 expected to fail tests that demonstrate the problem. Signed-off-by: Sergey Organov <sorganov@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Sergey Organov committed Dec 21, 2020 at 18:19 UTC ec315c66bb73e26542b7b3de8abaffa310c4380e
3 files changed +402
t/t4013-diff-various.sh
+2
@@ -329,6 +329,8 @@ log --first-parent --diff-merges=off -p master
329 log -p --first-parent master
330 log -m -p --first-parent master
331 log -m -p master
332 +:failure log --cc -m -p master
333 +:failure log -c -m -p master
334 log -SF master
335 log -S F master
336 log -SF -p master
t/t4013/diff.log_--cc_-m_-p_master new
+200
@@ -0,0 +1,200 @@
1 +$ git log --cc -m -p master
2 +commit 59d314ad6f356dd08601a4cd5e530381da3e3c64 (from 9a6d4949b6b76956d9d5e26f2791ec2ceff5fdc0)
3 +Merge: 9a6d494 c7a2ab9
4 +Author: A U Thor <author@example.com>
5 +Date: Mon Jun 26 00:04:00 2006 +0000
6 +
7 + Merge branch 'side'
8 +
9 +diff --git a/dir/sub b/dir/sub
10 +index cead32e..992913c 100644
11 +--- a/dir/sub
12 ++++ b/dir/sub
13 +@@ -4,3 +4,5 @@ C
14 + D
15 + E
16 + F
17 ++1
18 ++2
19 +diff --git a/file0 b/file0
20 +index b414108..10a8a9f 100644
21 +--- a/file0
22 ++++ b/file0
23 +@@ -4,3 +4,6 @@
24 + 4
25 + 5
26 + 6
27 ++A
28 ++B
29 ++C
30 +
31 +commit 59d314ad6f356dd08601a4cd5e530381da3e3c64 (from c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a)
32 +Merge: 9a6d494 c7a2ab9
33 +Author: A U Thor <author@example.com>
34 +Date: Mon Jun 26 00:04:00 2006 +0000
35 +
36 + Merge branch 'side'
37 +
38 +diff --git a/dir/sub b/dir/sub
39 +index 7289e35..992913c 100644
40 +--- a/dir/sub
41 ++++ b/dir/sub
42 +@@ -1,4 +1,8 @@
43 + A
44 + B
45 ++C
46 ++D
47 ++E
48 ++F
49 + 1
50 + 2
51 +diff --git a/file0 b/file0
52 +index f4615da..10a8a9f 100644
53 +--- a/file0
54 ++++ b/file0
55 +@@ -1,6 +1,9 @@
56 + 1
57 + 2
58 + 3
59 ++4
60 ++5
61 ++6
62 + A
63 + B
64 + C
65 +diff --git a/file1 b/file1
66 +new file mode 100644
67 +index 0000000..b1e6722
68 +--- /dev/null
69 ++++ b/file1
70 +@@ -0,0 +1,3 @@
71 ++A
72 ++B
73 ++C
74 +diff --git a/file2 b/file2
75 +deleted file mode 100644
76 +index 01e79c3..0000000
77 +--- a/file2
78 ++++ /dev/null
79 +@@ -1,3 +0,0 @@
80 +-1
81 +-2
82 +-3
83 +diff --git a/file3 b/file3
84 +deleted file mode 100644
85 +index 7289e35..0000000
86 +--- a/file3
87 ++++ /dev/null
88 +@@ -1,4 +0,0 @@
89 +-A
90 +-B
91 +-1
92 +-2
93 +
94 +commit c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a
95 +Author: A U Thor <author@example.com>
96 +Date: Mon Jun 26 00:03:00 2006 +0000
97 +
98 + Side
99 +
100 +diff --git a/dir/sub b/dir/sub
101 +index 35d242b..7289e35 100644
102 +--- a/dir/sub
103 ++++ b/dir/sub
104 +@@ -1,2 +1,4 @@
105 + A
106 + B
107 ++1
108 ++2
109 +diff --git a/file0 b/file0
110 +index 01e79c3..f4615da 100644
111 +--- a/file0
112 ++++ b/file0
113 +@@ -1,3 +1,6 @@
114 + 1
115 + 2
116 + 3
117 ++A
118 ++B
119 ++C
120 +diff --git a/file3 b/file3
121 +new file mode 100644
122 +index 0000000..7289e35
123 +--- /dev/null
124 ++++ b/file3
125 +@@ -0,0 +1,4 @@
126 ++A
127 ++B
128 ++1
129 ++2
130 +
131 +commit 9a6d4949b6b76956d9d5e26f2791ec2ceff5fdc0
132 +Author: A U Thor <author@example.com>
133 +Date: Mon Jun 26 00:02:00 2006 +0000
134 +
135 + Third
136 +
137 +diff --git a/dir/sub b/dir/sub
138 +index 8422d40..cead32e 100644
139 +--- a/dir/sub
140 ++++ b/dir/sub
141 +@@ -2,3 +2,5 @@ A
142 + B
143 + C
144 + D
145 ++E
146 ++F
147 +diff --git a/file1 b/file1
148 +new file mode 100644
149 +index 0000000..b1e6722
150 +--- /dev/null
151 ++++ b/file1
152 +@@ -0,0 +1,3 @@
153 ++A
154 ++B
155 ++C
156 +
157 +commit 1bde4ae5f36c8d9abe3a0fce0c6aab3c4a12fe44
158 +Author: A U Thor <author@example.com>
159 +Date: Mon Jun 26 00:01:00 2006 +0000
160 +
161 + Second
162 +
163 + This is the second commit.
164 +
165 +diff --git a/dir/sub b/dir/sub
166 +index 35d242b..8422d40 100644
167 +--- a/dir/sub
168 ++++ b/dir/sub
169 +@@ -1,2 +1,4 @@
170 + A
171 + B
172 ++C
173 ++D
174 +diff --git a/file0 b/file0
175 +index 01e79c3..b414108 100644
176 +--- a/file0
177 ++++ b/file0
178 +@@ -1,3 +1,6 @@
179 + 1
180 + 2
181 + 3
182 ++4
183 ++5
184 ++6
185 +diff --git a/file2 b/file2
186 +deleted file mode 100644
187 +index 01e79c3..0000000
188 +--- a/file2
189 ++++ /dev/null
190 +@@ -1,3 +0,0 @@
191 +-1
192 +-2
193 +-3
194 +
195 +commit 444ac553ac7612cc88969031b02b3767fb8a353a
196 +Author: A U Thor <author@example.com>
197 +Date: Mon Jun 26 00:00:00 2006 +0000
198 +
199 + Initial
200 +$
t/t4013/diff.log_-c_-m_-p_master new
+200
@@ -0,0 +1,200 @@
1 +$ git log -c -m -p master
2 +commit 59d314ad6f356dd08601a4cd5e530381da3e3c64 (from 9a6d4949b6b76956d9d5e26f2791ec2ceff5fdc0)
3 +Merge: 9a6d494 c7a2ab9
4 +Author: A U Thor <author@example.com>
5 +Date: Mon Jun 26 00:04:00 2006 +0000
6 +
7 + Merge branch 'side'
8 +
9 +diff --git a/dir/sub b/dir/sub
10 +index cead32e..992913c 100644
11 +--- a/dir/sub
12 ++++ b/dir/sub
13 +@@ -4,3 +4,5 @@ C
14 + D
15 + E
16 + F
17 ++1
18 ++2
19 +diff --git a/file0 b/file0
20 +index b414108..10a8a9f 100644
21 +--- a/file0
22 ++++ b/file0
23 +@@ -4,3 +4,6 @@
24 + 4
25 + 5
26 + 6
27 ++A
28 ++B
29 ++C
30 +
31 +commit 59d314ad6f356dd08601a4cd5e530381da3e3c64 (from c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a)
32 +Merge: 9a6d494 c7a2ab9
33 +Author: A U Thor <author@example.com>
34 +Date: Mon Jun 26 00:04:00 2006 +0000
35 +
36 + Merge branch 'side'
37 +
38 +diff --git a/dir/sub b/dir/sub
39 +index 7289e35..992913c 100644
40 +--- a/dir/sub
41 ++++ b/dir/sub
42 +@@ -1,4 +1,8 @@
43 + A
44 + B
45 ++C
46 ++D
47 ++E
48 ++F
49 + 1
50 + 2
51 +diff --git a/file0 b/file0
52 +index f4615da..10a8a9f 100644
53 +--- a/file0
54 ++++ b/file0
55 +@@ -1,6 +1,9 @@
56 + 1
57 + 2
58 + 3
59 ++4
60 ++5
61 ++6
62 + A
63 + B
64 + C
65 +diff --git a/file1 b/file1
66 +new file mode 100644
67 +index 0000000..b1e6722
68 +--- /dev/null
69 ++++ b/file1
70 +@@ -0,0 +1,3 @@
71 ++A
72 ++B
73 ++C
74 +diff --git a/file2 b/file2
75 +deleted file mode 100644
76 +index 01e79c3..0000000
77 +--- a/file2
78 ++++ /dev/null
79 +@@ -1,3 +0,0 @@
80 +-1
81 +-2
82 +-3
83 +diff --git a/file3 b/file3
84 +deleted file mode 100644
85 +index 7289e35..0000000
86 +--- a/file3
87 ++++ /dev/null
88 +@@ -1,4 +0,0 @@
89 +-A
90 +-B
91 +-1
92 +-2
93 +
94 +commit c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a
95 +Author: A U Thor <author@example.com>
96 +Date: Mon Jun 26 00:03:00 2006 +0000
97 +
98 + Side
99 +
100 +diff --git a/dir/sub b/dir/sub
101 +index 35d242b..7289e35 100644
102 +--- a/dir/sub
103 ++++ b/dir/sub
104 +@@ -1,2 +1,4 @@
105 + A
106 + B
107 ++1
108 ++2
109 +diff --git a/file0 b/file0
110 +index 01e79c3..f4615da 100644
111 +--- a/file0
112 ++++ b/file0
113 +@@ -1,3 +1,6 @@
114 + 1
115 + 2
116 + 3
117 ++A
118 ++B
119 ++C
120 +diff --git a/file3 b/file3
121 +new file mode 100644
122 +index 0000000..7289e35
123 +--- /dev/null
124 ++++ b/file3
125 +@@ -0,0 +1,4 @@
126 ++A
127 ++B
128 ++1
129 ++2
130 +
131 +commit 9a6d4949b6b76956d9d5e26f2791ec2ceff5fdc0
132 +Author: A U Thor <author@example.com>
133 +Date: Mon Jun 26 00:02:00 2006 +0000
134 +
135 + Third
136 +
137 +diff --git a/dir/sub b/dir/sub
138 +index 8422d40..cead32e 100644
139 +--- a/dir/sub
140 ++++ b/dir/sub
141 +@@ -2,3 +2,5 @@ A
142 + B
143 + C
144 + D
145 ++E
146 ++F
147 +diff --git a/file1 b/file1
148 +new file mode 100644
149 +index 0000000..b1e6722
150 +--- /dev/null
151 ++++ b/file1
152 +@@ -0,0 +1,3 @@
153 ++A
154 ++B
155 ++C
156 +
157 +commit 1bde4ae5f36c8d9abe3a0fce0c6aab3c4a12fe44
158 +Author: A U Thor <author@example.com>
159 +Date: Mon Jun 26 00:01:00 2006 +0000
160 +
161 + Second
162 +
163 + This is the second commit.
164 +
165 +diff --git a/dir/sub b/dir/sub
166 +index 35d242b..8422d40 100644
167 +--- a/dir/sub
168 ++++ b/dir/sub
169 +@@ -1,2 +1,4 @@
170 + A
171 + B
172 ++C
173 ++D
174 +diff --git a/file0 b/file0
175 +index 01e79c3..b414108 100644
176 +--- a/file0
177 ++++ b/file0
178 +@@ -1,3 +1,6 @@
179 + 1
180 + 2
181 + 3
182 ++4
183 ++5
184 ++6
185 +diff --git a/file2 b/file2
186 +deleted file mode 100644
187 +index 01e79c3..0000000
188 +--- a/file2
189 ++++ /dev/null
190 +@@ -1,3 +0,0 @@
191 +-1
192 +-2
193 +-3
194 +
195 +commit 444ac553ac7612cc88969031b02b3767fb8a353a
196 +Author: A U Thor <author@example.com>
197 +Date: Mon Jun 26 00:00:00 2006 +0000
198 +
199 + Initial
200 +$