Skip to content

Commit c2f1d39

Browse files
bedhangergitster
authored andcommitted
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 <[email protected]> Signed-off-by: Ann T Ropea <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 7cb6ac1 commit c2f1d39

15 files changed

+253
-1
lines changed

t/t4013-diff-various.sh

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ do
140140
expect="$TEST_DIRECTORY/t4013/diff.$test"
141141
actual="$pfx-diff.$test"
142142

143-
test_expect_success "git $cmd" '
143+
test_expect_success "git $cmd # magic is ${magic:-"(not used)"}" '
144144
{
145145
echo "$ git $cmd"
146146
case "$magic" in
@@ -175,9 +175,12 @@ diff-tree -r --abbrev initial
175175
diff-tree -r --abbrev=4 initial
176176
diff-tree --root initial
177177
diff-tree --root --abbrev initial
178+
:noellipses diff-tree --root --abbrev initial
178179
diff-tree --root -r initial
179180
diff-tree --root -r --abbrev initial
181+
:noellipses diff-tree --root -r --abbrev initial
180182
diff-tree --root -r --abbrev=4 initial
183+
:noellipses diff-tree --root -r --abbrev=4 initial
181184
diff-tree -p initial
182185
diff-tree --root -p initial
183186
diff-tree --patch-with-stat initial
@@ -226,6 +229,7 @@ diff-tree -p master
226229
diff-tree -p -m master
227230
diff-tree -c master
228231
diff-tree -c --abbrev master
232+
:noellipses diff-tree -c --abbrev master
229233
diff-tree --cc master
230234
# stat only should show the diffstat with the first parent
231235
diff-tree -c --stat master
@@ -272,8 +276,10 @@ rev-list --parents HEAD
272276
rev-list --children HEAD
273277
274278
whatchanged master
279+
:noellipses whatchanged master
275280
whatchanged -p master
276281
whatchanged --root master
282+
:noellipses whatchanged --root master
277283
whatchanged --root -p master
278284
whatchanged --patch-with-stat master
279285
whatchanged --root --patch-with-stat master
@@ -283,6 +289,7 @@ whatchanged --root -c --patch-with-stat --summary master
283289
# improved by Timo's patch
284290
whatchanged --root --cc --patch-with-stat --summary master
285291
whatchanged -SF master
292+
:noellipses whatchanged -SF master
286293
whatchanged -SF -p master
287294
288295
log --patch-with-stat master -- dir/
@@ -301,6 +308,7 @@ show --stat side
301308
show --stat --summary side
302309
show --patch-with-stat side
303310
show --patch-with-raw side
311+
:noellipses show --patch-with-raw side
304312
show --patch-with-stat --summary side
305313
306314
format-patch --stdout initial..side
@@ -328,8 +336,10 @@ diff -r --stat initial..side
328336
diff initial..side
329337
diff --patch-with-stat initial..side
330338
diff --patch-with-raw initial..side
339+
:noellipses diff --patch-with-raw initial..side
331340
diff --patch-with-stat -r initial..side
332341
diff --patch-with-raw -r initial..side
342+
:noellipses diff --patch-with-raw -r initial..side
333343
diff --name-status dir2 dir
334344
diff --no-index --name-status dir2 dir
335345
diff --no-index --name-status -- dir2 dir
@@ -342,10 +352,14 @@ diff --dirstat initial rearrange
342352
diff --dirstat-by-file initial rearrange
343353
# No-index --abbrev and --no-abbrev
344354
diff --raw initial
355+
:noellipses diff --raw initial
345356
diff --raw --abbrev=4 initial
357+
:noellipses diff --raw --abbrev=4 initial
346358
diff --raw --no-abbrev initial
347359
diff --no-index --raw dir2 dir
360+
:noellipses diff --no-index --raw dir2 dir
348361
diff --no-index --raw --abbrev=4 dir2 dir
362+
:noellipses diff --no-index --raw --abbrev=4 dir2 dir
349363
diff --no-index --raw --no-abbrev dir2 dir
350364
EOF
351365

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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+
$
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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+
$
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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+
$
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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+
$
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
$ git diff --no-index --raw --abbrev=4 dir2 dir
2+
:000000 100644 0000 0000 A dir/sub
3+
$
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
$ git diff --no-index --raw dir2 dir
2+
:000000 100644 0000000 0000000 A dir/sub
3+
$
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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+
$
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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+
$
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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+
$

0 commit comments

Comments
 (0)