t4013: test new output from diff --abbrev --raw

Use newly-introduced finely-grained control to teach the diff-family to honor the new environment GIT_PRINT_SHA1_ELLIPSIS and remove the ellipses when it is not set. Mentored-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Ann T Ropea <bedhanger@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Ann T Ropea committed Dec 3, 2017 at 22:27 UTC c2f1d39897535cfc0a6427aa2d5cb32043749397
15 files changed +253 -1
t/t4013-diff-various.sh
+15 -1
@@ -140,7 +140,7 @@ do
140 expect="$TEST_DIRECTORY/t4013/diff.$test"
141 actual="$pfx-diff.$test"
142
143 - test_expect_success "git $cmd" '
143 + test_expect_success "git $cmd # magic is ${magic:-"(not used)"}" '
144 {
145 echo "$ git $cmd"
146 case "$magic" in
@@ -175,9 +175,12 @@ diff-tree -r --abbrev initial
175 diff-tree -r --abbrev=4 initial
176 diff-tree --root initial
177 diff-tree --root --abbrev initial
178 +:noellipses diff-tree --root --abbrev initial
179 diff-tree --root -r initial
180 diff-tree --root -r --abbrev initial
181 +:noellipses diff-tree --root -r --abbrev initial
182 diff-tree --root -r --abbrev=4 initial
183 +:noellipses diff-tree --root -r --abbrev=4 initial
184 diff-tree -p initial
185 diff-tree --root -p initial
186 diff-tree --patch-with-stat initial
@@ -226,6 +229,7 @@ diff-tree -p master
229 diff-tree -p -m master
230 diff-tree -c master
231 diff-tree -c --abbrev master
232 +:noellipses diff-tree -c --abbrev master
233 diff-tree --cc master
234 # stat only should show the diffstat with the first parent
235 diff-tree -c --stat master
@@ -272,8 +276,10 @@ rev-list --parents HEAD
276 rev-list --children HEAD
277
278 whatchanged master
279 +:noellipses whatchanged master
280 whatchanged -p master
281 whatchanged --root master
282 +:noellipses whatchanged --root master
283 whatchanged --root -p master
284 whatchanged --patch-with-stat master
285 whatchanged --root --patch-with-stat master
@@ -283,6 +289,7 @@ whatchanged --root -c --patch-with-stat --summary master
289 # improved by Timo's patch
290 whatchanged --root --cc --patch-with-stat --summary master
291 whatchanged -SF master
292 +:noellipses whatchanged -SF master
293 whatchanged -SF -p master
294
295 log --patch-with-stat master -- dir/
@@ -301,6 +308,7 @@ show --stat side
308 show --stat --summary side
309 show --patch-with-stat side
310 show --patch-with-raw side
311 +:noellipses show --patch-with-raw side
312 show --patch-with-stat --summary side
313
314 format-patch --stdout initial..side
@@ -328,8 +336,10 @@ diff -r --stat initial..side
336 diff initial..side
337 diff --patch-with-stat initial..side
338 diff --patch-with-raw initial..side
339 +:noellipses diff --patch-with-raw initial..side
340 diff --patch-with-stat -r initial..side
341 diff --patch-with-raw -r initial..side
342 +:noellipses diff --patch-with-raw -r initial..side
343 diff --name-status dir2 dir
344 diff --no-index --name-status dir2 dir
345 diff --no-index --name-status -- dir2 dir
@@ -342,10 +352,14 @@ diff --dirstat initial rearrange
352 diff --dirstat-by-file initial rearrange
353 # No-index --abbrev and --no-abbrev
354 diff --raw initial
355 +:noellipses diff --raw initial
356 diff --raw --abbrev=4 initial
357 +:noellipses diff --raw --abbrev=4 initial
358 diff --raw --no-abbrev initial
359 diff --no-index --raw dir2 dir
360 +:noellipses diff --no-index --raw dir2 dir
361 diff --no-index --raw --abbrev=4 dir2 dir
362 +:noellipses diff --no-index --raw --abbrev=4 dir2 dir
363 diff --no-index --raw --no-abbrev dir2 dir
364 EOF
365
t/t4013/diff.noellipses-diff-tree_--root_--abbrev_initial new
+6
@@ -0,0 +1,6 @@
1 +$ git diff-tree --root --abbrev initial
2 +444ac553ac7612cc88969031b02b3767fb8a353a
3 +:000000 040000 0000000 da7a33f A dir
4 +:000000 100644 0000000 01e79c3 A file0
5 +:000000 100644 0000000 01e79c3 A file2
6 +$
t/t4013/diff.noellipses-diff-tree_--root_-r_--abbrev=4_initial new
+6
@@ -0,0 +1,6 @@
1 +$ git diff-tree --root -r --abbrev=4 initial
2 +444ac553ac7612cc88969031b02b3767fb8a353a
3 +:000000 100644 0000 35d2 A dir/sub
4 +:000000 100644 0000 01e7 A file0
5 +:000000 100644 0000 01e7 A file2
6 +$
t/t4013/diff.noellipses-diff-tree_--root_-r_--abbrev_initial new
+6
@@ -0,0 +1,6 @@
1 +$ git diff-tree --root -r --abbrev initial
2 +444ac553ac7612cc88969031b02b3767fb8a353a
3 +:000000 100644 0000000 35d242b A dir/sub
4 +:000000 100644 0000000 01e79c3 A file0
5 +:000000 100644 0000000 01e79c3 A file2
6 +$
t/t4013/diff.noellipses-diff-tree_-c_--abbrev_master new
+5
@@ -0,0 +1,5 @@
1 +$ git diff-tree -c --abbrev master
2 +59d314ad6f356dd08601a4cd5e530381da3e3c64
3 +::100644 100644 100644 cead32e 7289e35 992913c MM dir/sub
4 +::100644 100644 100644 b414108 f4615da 10a8a9f MM file0
5 +$
t/t4013/diff.noellipses-diff_--no-index_--raw_--abbrev=4_dir2_dir new
+3
@@ -0,0 +1,3 @@
1 +$ git diff --no-index --raw --abbrev=4 dir2 dir
2 +:000000 100644 0000 0000 A dir/sub
3 +$
t/t4013/diff.noellipses-diff_--no-index_--raw_dir2_dir new
+3
@@ -0,0 +1,3 @@
1 +$ git diff --no-index --raw dir2 dir
2 +:000000 100644 0000000 0000000 A dir/sub
3 +$
t/t4013/diff.noellipses-diff_--patch-with-raw_-r_initial..side new
+36
@@ -0,0 +1,36 @@
1 +$ git diff --patch-with-raw -r initial..side
2 +:100644 100644 35d242b 7289e35 M dir/sub
3 +:100644 100644 01e79c3 f4615da M file0
4 +:000000 100644 0000000 7289e35 A file3
5 +
6 +diff --git a/dir/sub b/dir/sub
7 +index 35d242b..7289e35 100644
8 +--- a/dir/sub
9 ++++ b/dir/sub
10 +@@ -1,2 +1,4 @@
11 + A
12 + B
13 ++1
14 ++2
15 +diff --git a/file0 b/file0
16 +index 01e79c3..f4615da 100644
17 +--- a/file0
18 ++++ b/file0
19 +@@ -1,3 +1,6 @@
20 + 1
21 + 2
22 + 3
23 ++A
24 ++B
25 ++C
26 +diff --git a/file3 b/file3
27 +new file mode 100644
28 +index 0000000..7289e35
29 +--- /dev/null
30 ++++ b/file3
31 +@@ -0,0 +1,4 @@
32 ++A
33 ++B
34 ++1
35 ++2
36 +$
t/t4013/diff.noellipses-diff_--patch-with-raw_initial..side new
+36
@@ -0,0 +1,36 @@
1 +$ git diff --patch-with-raw initial..side
2 +:100644 100644 35d242b 7289e35 M dir/sub
3 +:100644 100644 01e79c3 f4615da M file0
4 +:000000 100644 0000000 7289e35 A file3
5 +
6 +diff --git a/dir/sub b/dir/sub
7 +index 35d242b..7289e35 100644
8 +--- a/dir/sub
9 ++++ b/dir/sub
10 +@@ -1,2 +1,4 @@
11 + A
12 + B
13 ++1
14 ++2
15 +diff --git a/file0 b/file0
16 +index 01e79c3..f4615da 100644
17 +--- a/file0
18 ++++ b/file0
19 +@@ -1,3 +1,6 @@
20 + 1
21 + 2
22 + 3
23 ++A
24 ++B
25 ++C
26 +diff --git a/file3 b/file3
27 +new file mode 100644
28 +index 0000000..7289e35
29 +--- /dev/null
30 ++++ b/file3
31 +@@ -0,0 +1,4 @@
32 ++A
33 ++B
34 ++1
35 ++2
36 +$
t/t4013/diff.noellipses-diff_--raw_--abbrev=4_initial new
+6
@@ -0,0 +1,6 @@
1 +$ git diff --raw --abbrev=4 initial
2 +:100644 100644 35d2 9929 M dir/sub
3 +:100644 100644 01e7 10a8 M file0
4 +:000000 100644 0000 b1e6 A file1
5 +:100644 000000 01e7 0000 D file2
6 +$
t/t4013/diff.noellipses-diff_--raw_initial new
+6
@@ -0,0 +1,6 @@
1 +$ git diff --raw initial
2 +:100644 100644 35d242b 992913c M dir/sub
3 +:100644 100644 01e79c3 10a8a9f M file0
4 +:000000 100644 0000000 b1e6722 A file1
5 +:100644 000000 01e79c3 0000000 D file2
6 +$
t/t4013/diff.noellipses-show_--patch-with-raw_side new
+42
@@ -0,0 +1,42 @@
1 +$ git show --patch-with-raw side
2 +commit c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a
3 +Author: A U Thor <author@example.com>
4 +Date: Mon Jun 26 00:03:00 2006 +0000
5 +
6 + Side
7 +
8 +:100644 100644 35d242b 7289e35 M dir/sub
9 +:100644 100644 01e79c3 f4615da M file0
10 +:000000 100644 0000000 7289e35 A file3
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 +$
t/t4013/diff.noellipses-whatchanged_--root_master new
+42
@@ -0,0 +1,42 @@
1 +$ git whatchanged --root master
2 +commit c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a
3 +Author: A U Thor <author@example.com>
4 +Date: Mon Jun 26 00:03:00 2006 +0000
5 +
6 + Side
7 +
8 +:100644 100644 35d242b 7289e35 M dir/sub
9 +:100644 100644 01e79c3 f4615da M file0
10 +:000000 100644 0000000 7289e35 A file3
11 +
12 +commit 9a6d4949b6b76956d9d5e26f2791ec2ceff5fdc0
13 +Author: A U Thor <author@example.com>
14 +Date: Mon Jun 26 00:02:00 2006 +0000
15 +
16 + Third
17 +
18 +:100644 100644 8422d40 cead32e M dir/sub
19 +:000000 100644 0000000 b1e6722 A file1
20 +
21 +commit 1bde4ae5f36c8d9abe3a0fce0c6aab3c4a12fe44
22 +Author: A U Thor <author@example.com>
23 +Date: Mon Jun 26 00:01:00 2006 +0000
24 +
25 + Second
26 +
27 + This is the second commit.
28 +
29 +:100644 100644 35d242b 8422d40 M dir/sub
30 +:100644 100644 01e79c3 b414108 M file0
31 +:100644 000000 01e79c3 0000000 D file2
32 +
33 +commit 444ac553ac7612cc88969031b02b3767fb8a353a
34 +Author: A U Thor <author@example.com>
35 +Date: Mon Jun 26 00:00:00 2006 +0000
36 +
37 + Initial
38 +
39 +:000000 100644 0000000 35d242b A dir/sub
40 +:000000 100644 0000000 01e79c3 A file0
41 +:000000 100644 0000000 01e79c3 A file2
42 +$
t/t4013/diff.noellipses-whatchanged_-SF_master new
+9
@@ -0,0 +1,9 @@
1 +$ git whatchanged -SF master
2 +commit 9a6d4949b6b76956d9d5e26f2791ec2ceff5fdc0
3 +Author: A U Thor <author@example.com>
4 +Date: Mon Jun 26 00:02:00 2006 +0000
5 +
6 + Third
7 +
8 +:100644 100644 8422d40 cead32e M dir/sub
9 +$
t/t4013/diff.noellipses-whatchanged_master new
+32
@@ -0,0 +1,32 @@
1 +$ git whatchanged master
2 +commit c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a
3 +Author: A U Thor <author@example.com>
4 +Date: Mon Jun 26 00:03:00 2006 +0000
5 +
6 + Side
7 +
8 +:100644 100644 35d242b 7289e35 M dir/sub
9 +:100644 100644 01e79c3 f4615da M file0
10 +:000000 100644 0000000 7289e35 A file3
11 +
12 +commit 9a6d4949b6b76956d9d5e26f2791ec2ceff5fdc0
13 +Author: A U Thor <author@example.com>
14 +Date: Mon Jun 26 00:02:00 2006 +0000
15 +
16 + Third
17 +
18 +:100644 100644 8422d40 cead32e M dir/sub
19 +:000000 100644 0000000 b1e6722 A file1
20 +
21 +commit 1bde4ae5f36c8d9abe3a0fce0c6aab3c4a12fe44
22 +Author: A U Thor <author@example.com>
23 +Date: Mon Jun 26 00:01:00 2006 +0000
24 +
25 + Second
26 +
27 + This is the second commit.
28 +
29 +:100644 100644 35d242b 8422d40 M dir/sub
30 +:100644 100644 01e79c3 b414108 M file0
31 +:100644 000000 01e79c3 0000000 D file2
32 +$