Skip to content

Commit af04d8f

Browse files
sorganovgitster
authored andcommitted
t4013: add tests for --diff-merges=first-parent
This new option provides essential new functionality, changing diff output to first parent only, without changing history traversal mode, so it deserves its own test. As we do it, add additional test that --diff-merges=first-parent by itself doesn't imply -p and only outputs diffs for merge commits. Signed-off-by: Sergey Organov <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 1d24509 commit af04d8f

File tree

3 files changed

+195
-0
lines changed

3 files changed

+195
-0
lines changed

t/t4013-diff-various.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,8 @@ log --no-diff-merges -p --first-parent master
327327
log --diff-merges=off -p --first-parent master
328328
log --first-parent --diff-merges=off -p master
329329
log -p --first-parent master
330+
log -p --diff-merges=first-parent master
331+
log --diff-merges=first-parent master
330332
log -m -p --first-parent master
331333
log -m -p master
332334
log --cc -m -p master
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
$ git log --diff-merges=first-parent master
2+
commit 59d314ad6f356dd08601a4cd5e530381da3e3c64
3+
Merge: 9a6d494 c7a2ab9
4+
Author: A U Thor <[email protected]>
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 c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a
32+
Author: A U Thor <[email protected]>
33+
Date: Mon Jun 26 00:03:00 2006 +0000
34+
35+
Side
36+
37+
commit 9a6d4949b6b76956d9d5e26f2791ec2ceff5fdc0
38+
Author: A U Thor <[email protected]>
39+
Date: Mon Jun 26 00:02:00 2006 +0000
40+
41+
Third
42+
43+
commit 1bde4ae5f36c8d9abe3a0fce0c6aab3c4a12fe44
44+
Author: A U Thor <[email protected]>
45+
Date: Mon Jun 26 00:01:00 2006 +0000
46+
47+
Second
48+
49+
This is the second commit.
50+
51+
commit 444ac553ac7612cc88969031b02b3767fb8a353a
52+
Author: A U Thor <[email protected]>
53+
Date: Mon Jun 26 00:00:00 2006 +0000
54+
55+
Initial
56+
$
Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
$ git log -p --diff-merges=first-parent master
2+
commit 59d314ad6f356dd08601a4cd5e530381da3e3c64
3+
Merge: 9a6d494 c7a2ab9
4+
Author: A U Thor <[email protected]>
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 c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a
32+
Author: A U Thor <[email protected]>
33+
Date: Mon Jun 26 00:03:00 2006 +0000
34+
35+
Side
36+
37+
diff --git a/dir/sub b/dir/sub
38+
index 35d242b..7289e35 100644
39+
--- a/dir/sub
40+
+++ b/dir/sub
41+
@@ -1,2 +1,4 @@
42+
A
43+
B
44+
+1
45+
+2
46+
diff --git a/file0 b/file0
47+
index 01e79c3..f4615da 100644
48+
--- a/file0
49+
+++ b/file0
50+
@@ -1,3 +1,6 @@
51+
1
52+
2
53+
3
54+
+A
55+
+B
56+
+C
57+
diff --git a/file3 b/file3
58+
new file mode 100644
59+
index 0000000..7289e35
60+
--- /dev/null
61+
+++ b/file3
62+
@@ -0,0 +1,4 @@
63+
+A
64+
+B
65+
+1
66+
+2
67+
68+
commit 9a6d4949b6b76956d9d5e26f2791ec2ceff5fdc0
69+
Author: A U Thor <[email protected]>
70+
Date: Mon Jun 26 00:02:00 2006 +0000
71+
72+
Third
73+
74+
diff --git a/dir/sub b/dir/sub
75+
index 8422d40..cead32e 100644
76+
--- a/dir/sub
77+
+++ b/dir/sub
78+
@@ -2,3 +2,5 @@ A
79+
B
80+
C
81+
D
82+
+E
83+
+F
84+
diff --git a/file1 b/file1
85+
new file mode 100644
86+
index 0000000..b1e6722
87+
--- /dev/null
88+
+++ b/file1
89+
@@ -0,0 +1,3 @@
90+
+A
91+
+B
92+
+C
93+
94+
commit 1bde4ae5f36c8d9abe3a0fce0c6aab3c4a12fe44
95+
Author: A U Thor <[email protected]>
96+
Date: Mon Jun 26 00:01:00 2006 +0000
97+
98+
Second
99+
100+
This is the second commit.
101+
102+
diff --git a/dir/sub b/dir/sub
103+
index 35d242b..8422d40 100644
104+
--- a/dir/sub
105+
+++ b/dir/sub
106+
@@ -1,2 +1,4 @@
107+
A
108+
B
109+
+C
110+
+D
111+
diff --git a/file0 b/file0
112+
index 01e79c3..b414108 100644
113+
--- a/file0
114+
+++ b/file0
115+
@@ -1,3 +1,6 @@
116+
1
117+
2
118+
3
119+
+4
120+
+5
121+
+6
122+
diff --git a/file2 b/file2
123+
deleted file mode 100644
124+
index 01e79c3..0000000
125+
--- a/file2
126+
+++ /dev/null
127+
@@ -1,3 +0,0 @@
128+
-1
129+
-2
130+
-3
131+
132+
commit 444ac553ac7612cc88969031b02b3767fb8a353a
133+
Author: A U Thor <[email protected]>
134+
Date: Mon Jun 26 00:00:00 2006 +0000
135+
136+
Initial
137+
$

0 commit comments

Comments
 (0)