1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-05-28 18:36:46 +02:00

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>
This commit is contained in:
Ann T Ropea 2017-12-03 22:27:43 +01:00 committed by Junio C Hamano
parent 7cb6ac1e4b
commit c2f1d39897
15 changed files with 253 additions and 1 deletions

View File

@ -140,7 +140,7 @@ do
expect="$TEST_DIRECTORY/t4013/diff.$test"
actual="$pfx-diff.$test"
test_expect_success "git $cmd" '
test_expect_success "git $cmd # magic is ${magic:-"(not used)"}" '
{
echo "$ git $cmd"
case "$magic" in
@ -175,9 +175,12 @@ diff-tree -r --abbrev initial
diff-tree -r --abbrev=4 initial
diff-tree --root initial
diff-tree --root --abbrev initial
:noellipses diff-tree --root --abbrev initial
diff-tree --root -r initial
diff-tree --root -r --abbrev initial
:noellipses diff-tree --root -r --abbrev initial
diff-tree --root -r --abbrev=4 initial
:noellipses diff-tree --root -r --abbrev=4 initial
diff-tree -p initial
diff-tree --root -p initial
diff-tree --patch-with-stat initial
@ -226,6 +229,7 @@ diff-tree -p master
diff-tree -p -m master
diff-tree -c master
diff-tree -c --abbrev master
:noellipses diff-tree -c --abbrev master
diff-tree --cc master
# stat only should show the diffstat with the first parent
diff-tree -c --stat master
@ -272,8 +276,10 @@ rev-list --parents HEAD
rev-list --children HEAD
whatchanged master
:noellipses whatchanged master
whatchanged -p master
whatchanged --root master
:noellipses whatchanged --root master
whatchanged --root -p master
whatchanged --patch-with-stat master
whatchanged --root --patch-with-stat master
@ -283,6 +289,7 @@ whatchanged --root -c --patch-with-stat --summary master
# improved by Timo's patch
whatchanged --root --cc --patch-with-stat --summary master
whatchanged -SF master
:noellipses whatchanged -SF master
whatchanged -SF -p master
log --patch-with-stat master -- dir/
@ -301,6 +308,7 @@ show --stat side
show --stat --summary side
show --patch-with-stat side
show --patch-with-raw side
:noellipses show --patch-with-raw side
show --patch-with-stat --summary side
format-patch --stdout initial..side
@ -328,8 +336,10 @@ diff -r --stat initial..side
diff initial..side
diff --patch-with-stat initial..side
diff --patch-with-raw initial..side
:noellipses diff --patch-with-raw initial..side
diff --patch-with-stat -r initial..side
diff --patch-with-raw -r initial..side
:noellipses diff --patch-with-raw -r initial..side
diff --name-status dir2 dir
diff --no-index --name-status dir2 dir
diff --no-index --name-status -- dir2 dir
@ -342,10 +352,14 @@ diff --dirstat initial rearrange
diff --dirstat-by-file initial rearrange
# No-index --abbrev and --no-abbrev
diff --raw initial
:noellipses diff --raw initial
diff --raw --abbrev=4 initial
:noellipses diff --raw --abbrev=4 initial
diff --raw --no-abbrev initial
diff --no-index --raw dir2 dir
:noellipses diff --no-index --raw dir2 dir
diff --no-index --raw --abbrev=4 dir2 dir
:noellipses diff --no-index --raw --abbrev=4 dir2 dir
diff --no-index --raw --no-abbrev dir2 dir
EOF

View File

@ -0,0 +1,6 @@
$ git diff-tree --root --abbrev initial
444ac553ac7612cc88969031b02b3767fb8a353a
:000000 040000 0000000 da7a33f A dir
:000000 100644 0000000 01e79c3 A file0
:000000 100644 0000000 01e79c3 A file2
$

View File

@ -0,0 +1,6 @@
$ git diff-tree --root -r --abbrev=4 initial
444ac553ac7612cc88969031b02b3767fb8a353a
:000000 100644 0000 35d2 A dir/sub
:000000 100644 0000 01e7 A file0
:000000 100644 0000 01e7 A file2
$

View File

@ -0,0 +1,6 @@
$ git diff-tree --root -r --abbrev initial
444ac553ac7612cc88969031b02b3767fb8a353a
:000000 100644 0000000 35d242b A dir/sub
:000000 100644 0000000 01e79c3 A file0
:000000 100644 0000000 01e79c3 A file2
$

View File

@ -0,0 +1,5 @@
$ git diff-tree -c --abbrev master
59d314ad6f356dd08601a4cd5e530381da3e3c64
::100644 100644 100644 cead32e 7289e35 992913c MM dir/sub
::100644 100644 100644 b414108 f4615da 10a8a9f MM file0
$

View File

@ -0,0 +1,3 @@
$ git diff --no-index --raw --abbrev=4 dir2 dir
:000000 100644 0000 0000 A dir/sub
$

View File

@ -0,0 +1,3 @@
$ git diff --no-index --raw dir2 dir
:000000 100644 0000000 0000000 A dir/sub
$

View File

@ -0,0 +1,36 @@
$ git diff --patch-with-raw -r initial..side
:100644 100644 35d242b 7289e35 M dir/sub
:100644 100644 01e79c3 f4615da M file0
:000000 100644 0000000 7289e35 A file3
diff --git a/dir/sub b/dir/sub
index 35d242b..7289e35 100644
--- a/dir/sub
+++ b/dir/sub
@@ -1,2 +1,4 @@
A
B
+1
+2
diff --git a/file0 b/file0
index 01e79c3..f4615da 100644
--- a/file0
+++ b/file0
@@ -1,3 +1,6 @@
1
2
3
+A
+B
+C
diff --git a/file3 b/file3
new file mode 100644
index 0000000..7289e35
--- /dev/null
+++ b/file3
@@ -0,0 +1,4 @@
+A
+B
+1
+2
$

View File

@ -0,0 +1,36 @@
$ git diff --patch-with-raw initial..side
:100644 100644 35d242b 7289e35 M dir/sub
:100644 100644 01e79c3 f4615da M file0
:000000 100644 0000000 7289e35 A file3
diff --git a/dir/sub b/dir/sub
index 35d242b..7289e35 100644
--- a/dir/sub
+++ b/dir/sub
@@ -1,2 +1,4 @@
A
B
+1
+2
diff --git a/file0 b/file0
index 01e79c3..f4615da 100644
--- a/file0
+++ b/file0
@@ -1,3 +1,6 @@
1
2
3
+A
+B
+C
diff --git a/file3 b/file3
new file mode 100644
index 0000000..7289e35
--- /dev/null
+++ b/file3
@@ -0,0 +1,4 @@
+A
+B
+1
+2
$

View File

@ -0,0 +1,6 @@
$ git diff --raw --abbrev=4 initial
:100644 100644 35d2 9929 M dir/sub
:100644 100644 01e7 10a8 M file0
:000000 100644 0000 b1e6 A file1
:100644 000000 01e7 0000 D file2
$

View File

@ -0,0 +1,6 @@
$ git diff --raw initial
:100644 100644 35d242b 992913c M dir/sub
:100644 100644 01e79c3 10a8a9f M file0
:000000 100644 0000000 b1e6722 A file1
:100644 000000 01e79c3 0000000 D file2
$

View File

@ -0,0 +1,42 @@
$ git show --patch-with-raw side
commit c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a
Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:03:00 2006 +0000
Side
:100644 100644 35d242b 7289e35 M dir/sub
:100644 100644 01e79c3 f4615da M file0
:000000 100644 0000000 7289e35 A file3
diff --git a/dir/sub b/dir/sub
index 35d242b..7289e35 100644
--- a/dir/sub
+++ b/dir/sub
@@ -1,2 +1,4 @@
A
B
+1
+2
diff --git a/file0 b/file0
index 01e79c3..f4615da 100644
--- a/file0
+++ b/file0
@@ -1,3 +1,6 @@
1
2
3
+A
+B
+C
diff --git a/file3 b/file3
new file mode 100644
index 0000000..7289e35
--- /dev/null
+++ b/file3
@@ -0,0 +1,4 @@
+A
+B
+1
+2
$

View File

@ -0,0 +1,42 @@
$ git whatchanged --root master
commit c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a
Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:03:00 2006 +0000
Side
:100644 100644 35d242b 7289e35 M dir/sub
:100644 100644 01e79c3 f4615da M file0
:000000 100644 0000000 7289e35 A file3
commit 9a6d4949b6b76956d9d5e26f2791ec2ceff5fdc0
Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:02:00 2006 +0000
Third
:100644 100644 8422d40 cead32e M dir/sub
:000000 100644 0000000 b1e6722 A file1
commit 1bde4ae5f36c8d9abe3a0fce0c6aab3c4a12fe44
Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:01:00 2006 +0000
Second
This is the second commit.
:100644 100644 35d242b 8422d40 M dir/sub
:100644 100644 01e79c3 b414108 M file0
:100644 000000 01e79c3 0000000 D file2
commit 444ac553ac7612cc88969031b02b3767fb8a353a
Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:00:00 2006 +0000
Initial
:000000 100644 0000000 35d242b A dir/sub
:000000 100644 0000000 01e79c3 A file0
:000000 100644 0000000 01e79c3 A file2
$

View File

@ -0,0 +1,9 @@
$ git whatchanged -SF master
commit 9a6d4949b6b76956d9d5e26f2791ec2ceff5fdc0
Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:02:00 2006 +0000
Third
:100644 100644 8422d40 cead32e M dir/sub
$

View File

@ -0,0 +1,32 @@
$ git whatchanged master
commit c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a
Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:03:00 2006 +0000
Side
:100644 100644 35d242b 7289e35 M dir/sub
:100644 100644 01e79c3 f4615da M file0
:000000 100644 0000000 7289e35 A file3
commit 9a6d4949b6b76956d9d5e26f2791ec2ceff5fdc0
Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:02:00 2006 +0000
Third
:100644 100644 8422d40 cead32e M dir/sub
:000000 100644 0000000 b1e6722 A file1
commit 1bde4ae5f36c8d9abe3a0fce0c6aab3c4a12fe44
Author: A U Thor <author@example.com>
Date: Mon Jun 26 00:01:00 2006 +0000
Second
This is the second commit.
:100644 100644 35d242b 8422d40 M dir/sub
:100644 100644 01e79c3 b414108 M file0
:100644 000000 01e79c3 0000000 D file2
$