зеркало из https://github.com/microsoft/git.git
Merge branch 'jc/diff-test' into jc/diff-test-updates
* jc/diff-test: t4013: add format-patch tests.
This commit is contained in:
Коммит
6adc876016
|
@ -85,6 +85,7 @@ test_expect_success setup '
|
|||
+*+ [initial] Initial
|
||||
EOF
|
||||
|
||||
V=`git version | sed -e 's/^git version //'`
|
||||
while read cmd
|
||||
do
|
||||
case "$cmd" in
|
||||
|
@ -99,7 +100,7 @@ do
|
|||
test_expect_success "git $cmd" '
|
||||
{
|
||||
echo "\$ git $cmd"
|
||||
git $cmd
|
||||
git $cmd | sed -e "s/$V/g-i-t--v-e-r-s-i-o-n/"
|
||||
echo "\$"
|
||||
} >"$actual" &&
|
||||
if test -f "$expect"
|
||||
|
@ -219,6 +220,13 @@ show --patch-with-stat side
|
|||
show --patch-with-raw side
|
||||
show --patch-with-stat --summary side
|
||||
|
||||
format-patch --stdout initial..side
|
||||
format-patch --stdout initial..master^
|
||||
format-patch --stdout initial..master
|
||||
format-patch --attach --stdout initial..side
|
||||
format-patch --attach --stdout initial..master^
|
||||
format-patch --attach --stdout initial..master
|
||||
|
||||
EOF
|
||||
|
||||
test_done
|
||||
|
|
|
@ -0,0 +1,165 @@
|
|||
$ git format-patch --attach --stdout initial..master
|
||||
From 7952a93e09bf565b5592766a438b40cd81f4846f Mon Sep 17 00:00:00 2001
|
||||
From: A U Thor <author@example.com>
|
||||
Date: Mon, 26 Jun 2006 00:01:00 +0000
|
||||
Subject: [PATCH] Second
|
||||
MIME-Version: 1.0
|
||||
Content-Type: multipart/mixed;
|
||||
boundary="------------g-i-t--v-e-r-s-i-o-n"
|
||||
|
||||
This is a multi-part message in MIME format.
|
||||
--------------g-i-t--v-e-r-s-i-o-n
|
||||
Content-Type: text/plain; charset=UTF-8; format=fixed
|
||||
Content-Transfer-Encoding: 8bit
|
||||
---
|
||||
dir/sub | 2 ++
|
||||
file0 | 3 +++
|
||||
file2 | 3 ---
|
||||
3 files changed, 5 insertions(+), 3 deletions(-)
|
||||
--------------g-i-t--v-e-r-s-i-o-n
|
||||
Content-Type: text/x-patch;
|
||||
name="7952a93e09bf565b5592766a438b40cd81f4846f.diff"
|
||||
Content-Transfer-Encoding: 8bit
|
||||
Content-Disposition: inline;
|
||||
filename="7952a93e09bf565b5592766a438b40cd81f4846f.diff"
|
||||
|
||||
diff --git a/dir/sub b/dir/sub
|
||||
index 35d242b..8422d40 100644
|
||||
--- a/dir/sub
|
||||
+++ b/dir/sub
|
||||
@@ -1,2 +1,4 @@
|
||||
A
|
||||
B
|
||||
+C
|
||||
+D
|
||||
diff --git a/file0 b/file0
|
||||
index 01e79c3..b414108 100644
|
||||
--- a/file0
|
||||
+++ b/file0
|
||||
@@ -1,3 +1,6 @@
|
||||
1
|
||||
2
|
||||
3
|
||||
+4
|
||||
+5
|
||||
+6
|
||||
diff --git a/file2 b/file2
|
||||
deleted file mode 100644
|
||||
index 01e79c3..0000000
|
||||
--- a/file2
|
||||
+++ /dev/null
|
||||
@@ -1,3 +0,0 @@
|
||||
-1
|
||||
-2
|
||||
-3
|
||||
|
||||
--------------g-i-t--v-e-r-s-i-o-n--
|
||||
|
||||
|
||||
|
||||
From 889b315013ef9f2e2f90aa0b054b267c8a557847 Mon Sep 17 00:00:00 2001
|
||||
From: A U Thor <author@example.com>
|
||||
Date: Mon, 26 Jun 2006 00:02:00 +0000
|
||||
Subject: [PATCH] Third
|
||||
MIME-Version: 1.0
|
||||
Content-Type: multipart/mixed;
|
||||
boundary="------------g-i-t--v-e-r-s-i-o-n"
|
||||
|
||||
This is a multi-part message in MIME format.
|
||||
--------------g-i-t--v-e-r-s-i-o-n
|
||||
Content-Type: text/plain; charset=UTF-8; format=fixed
|
||||
Content-Transfer-Encoding: 8bit
|
||||
---
|
||||
dir/sub | 2 ++
|
||||
file1 | 3 +++
|
||||
2 files changed, 5 insertions(+), 0 deletions(-)
|
||||
--------------g-i-t--v-e-r-s-i-o-n
|
||||
Content-Type: text/x-patch;
|
||||
name="889b315013ef9f2e2f90aa0b054b267c8a557847.diff"
|
||||
Content-Transfer-Encoding: 8bit
|
||||
Content-Disposition: inline;
|
||||
filename="889b315013ef9f2e2f90aa0b054b267c8a557847.diff"
|
||||
|
||||
diff --git a/dir/sub b/dir/sub
|
||||
index 8422d40..cead32e 100644
|
||||
--- a/dir/sub
|
||||
+++ b/dir/sub
|
||||
@@ -2,3 +2,5 @@ A
|
||||
B
|
||||
C
|
||||
D
|
||||
+E
|
||||
+F
|
||||
diff --git a/file1 b/file1
|
||||
new file mode 100644
|
||||
index 0000000..b1e6722
|
||||
--- /dev/null
|
||||
+++ b/file1
|
||||
@@ -0,0 +1,3 @@
|
||||
+A
|
||||
+B
|
||||
+C
|
||||
|
||||
--------------g-i-t--v-e-r-s-i-o-n--
|
||||
|
||||
|
||||
|
||||
From c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a Mon Sep 17 00:00:00 2001
|
||||
From: A U Thor <author@example.com>
|
||||
Date: Mon, 26 Jun 2006 00:03:00 +0000
|
||||
Subject: [PATCH] Side
|
||||
MIME-Version: 1.0
|
||||
Content-Type: multipart/mixed;
|
||||
boundary="------------g-i-t--v-e-r-s-i-o-n"
|
||||
|
||||
This is a multi-part message in MIME format.
|
||||
--------------g-i-t--v-e-r-s-i-o-n
|
||||
Content-Type: text/plain; charset=UTF-8; format=fixed
|
||||
Content-Transfer-Encoding: 8bit
|
||||
---
|
||||
dir/sub | 2 ++
|
||||
file0 | 3 +++
|
||||
file3 | 4 ++++
|
||||
3 files changed, 9 insertions(+), 0 deletions(-)
|
||||
--------------g-i-t--v-e-r-s-i-o-n
|
||||
Content-Type: text/x-patch;
|
||||
name="c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a.diff"
|
||||
Content-Transfer-Encoding: 8bit
|
||||
Content-Disposition: inline;
|
||||
filename="c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a.diff"
|
||||
|
||||
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
|
||||
|
||||
--------------g-i-t--v-e-r-s-i-o-n--
|
||||
|
||||
|
||||
$
|
|
@ -0,0 +1,106 @@
|
|||
$ git format-patch --attach --stdout initial..master^
|
||||
From 7952a93e09bf565b5592766a438b40cd81f4846f Mon Sep 17 00:00:00 2001
|
||||
From: A U Thor <author@example.com>
|
||||
Date: Mon, 26 Jun 2006 00:01:00 +0000
|
||||
Subject: [PATCH] Second
|
||||
MIME-Version: 1.0
|
||||
Content-Type: multipart/mixed;
|
||||
boundary="------------g-i-t--v-e-r-s-i-o-n"
|
||||
|
||||
This is a multi-part message in MIME format.
|
||||
--------------g-i-t--v-e-r-s-i-o-n
|
||||
Content-Type: text/plain; charset=UTF-8; format=fixed
|
||||
Content-Transfer-Encoding: 8bit
|
||||
---
|
||||
dir/sub | 2 ++
|
||||
file0 | 3 +++
|
||||
file2 | 3 ---
|
||||
3 files changed, 5 insertions(+), 3 deletions(-)
|
||||
--------------g-i-t--v-e-r-s-i-o-n
|
||||
Content-Type: text/x-patch;
|
||||
name="7952a93e09bf565b5592766a438b40cd81f4846f.diff"
|
||||
Content-Transfer-Encoding: 8bit
|
||||
Content-Disposition: inline;
|
||||
filename="7952a93e09bf565b5592766a438b40cd81f4846f.diff"
|
||||
|
||||
diff --git a/dir/sub b/dir/sub
|
||||
index 35d242b..8422d40 100644
|
||||
--- a/dir/sub
|
||||
+++ b/dir/sub
|
||||
@@ -1,2 +1,4 @@
|
||||
A
|
||||
B
|
||||
+C
|
||||
+D
|
||||
diff --git a/file0 b/file0
|
||||
index 01e79c3..b414108 100644
|
||||
--- a/file0
|
||||
+++ b/file0
|
||||
@@ -1,3 +1,6 @@
|
||||
1
|
||||
2
|
||||
3
|
||||
+4
|
||||
+5
|
||||
+6
|
||||
diff --git a/file2 b/file2
|
||||
deleted file mode 100644
|
||||
index 01e79c3..0000000
|
||||
--- a/file2
|
||||
+++ /dev/null
|
||||
@@ -1,3 +0,0 @@
|
||||
-1
|
||||
-2
|
||||
-3
|
||||
|
||||
--------------g-i-t--v-e-r-s-i-o-n--
|
||||
|
||||
|
||||
|
||||
From 889b315013ef9f2e2f90aa0b054b267c8a557847 Mon Sep 17 00:00:00 2001
|
||||
From: A U Thor <author@example.com>
|
||||
Date: Mon, 26 Jun 2006 00:02:00 +0000
|
||||
Subject: [PATCH] Third
|
||||
MIME-Version: 1.0
|
||||
Content-Type: multipart/mixed;
|
||||
boundary="------------g-i-t--v-e-r-s-i-o-n"
|
||||
|
||||
This is a multi-part message in MIME format.
|
||||
--------------g-i-t--v-e-r-s-i-o-n
|
||||
Content-Type: text/plain; charset=UTF-8; format=fixed
|
||||
Content-Transfer-Encoding: 8bit
|
||||
---
|
||||
dir/sub | 2 ++
|
||||
file1 | 3 +++
|
||||
2 files changed, 5 insertions(+), 0 deletions(-)
|
||||
--------------g-i-t--v-e-r-s-i-o-n
|
||||
Content-Type: text/x-patch;
|
||||
name="889b315013ef9f2e2f90aa0b054b267c8a557847.diff"
|
||||
Content-Transfer-Encoding: 8bit
|
||||
Content-Disposition: inline;
|
||||
filename="889b315013ef9f2e2f90aa0b054b267c8a557847.diff"
|
||||
|
||||
diff --git a/dir/sub b/dir/sub
|
||||
index 8422d40..cead32e 100644
|
||||
--- a/dir/sub
|
||||
+++ b/dir/sub
|
||||
@@ -2,3 +2,5 @@ A
|
||||
B
|
||||
C
|
||||
D
|
||||
+E
|
||||
+F
|
||||
diff --git a/file1 b/file1
|
||||
new file mode 100644
|
||||
index 0000000..b1e6722
|
||||
--- /dev/null
|
||||
+++ b/file1
|
||||
@@ -0,0 +1,3 @@
|
||||
+A
|
||||
+B
|
||||
+C
|
||||
|
||||
--------------g-i-t--v-e-r-s-i-o-n--
|
||||
|
||||
|
||||
$
|
|
@ -0,0 +1,60 @@
|
|||
$ git format-patch --attach --stdout initial..side
|
||||
From c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a Mon Sep 17 00:00:00 2001
|
||||
From: A U Thor <author@example.com>
|
||||
Date: Mon, 26 Jun 2006 00:03:00 +0000
|
||||
Subject: [PATCH] Side
|
||||
MIME-Version: 1.0
|
||||
Content-Type: multipart/mixed;
|
||||
boundary="------------g-i-t--v-e-r-s-i-o-n"
|
||||
|
||||
This is a multi-part message in MIME format.
|
||||
--------------g-i-t--v-e-r-s-i-o-n
|
||||
Content-Type: text/plain; charset=UTF-8; format=fixed
|
||||
Content-Transfer-Encoding: 8bit
|
||||
---
|
||||
dir/sub | 2 ++
|
||||
file0 | 3 +++
|
||||
file3 | 4 ++++
|
||||
3 files changed, 9 insertions(+), 0 deletions(-)
|
||||
--------------g-i-t--v-e-r-s-i-o-n
|
||||
Content-Type: text/x-patch;
|
||||
name="c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a.diff"
|
||||
Content-Transfer-Encoding: 8bit
|
||||
Content-Disposition: inline;
|
||||
filename="c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a.diff"
|
||||
|
||||
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
|
||||
|
||||
--------------g-i-t--v-e-r-s-i-o-n--
|
||||
|
||||
|
||||
$
|
|
@ -0,0 +1,120 @@
|
|||
$ git format-patch --stdout initial..master
|
||||
From 7952a93e09bf565b5592766a438b40cd81f4846f Mon Sep 17 00:00:00 2001
|
||||
From: A U Thor <author@example.com>
|
||||
Date: Mon, 26 Jun 2006 00:01:00 +0000
|
||||
Subject: [PATCH] Second
|
||||
---
|
||||
dir/sub | 2 ++
|
||||
file0 | 3 +++
|
||||
file2 | 3 ---
|
||||
3 files changed, 5 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/dir/sub b/dir/sub
|
||||
index 35d242b..8422d40 100644
|
||||
--- a/dir/sub
|
||||
+++ b/dir/sub
|
||||
@@ -1,2 +1,4 @@
|
||||
A
|
||||
B
|
||||
+C
|
||||
+D
|
||||
diff --git a/file0 b/file0
|
||||
index 01e79c3..b414108 100644
|
||||
--- a/file0
|
||||
+++ b/file0
|
||||
@@ -1,3 +1,6 @@
|
||||
1
|
||||
2
|
||||
3
|
||||
+4
|
||||
+5
|
||||
+6
|
||||
diff --git a/file2 b/file2
|
||||
deleted file mode 100644
|
||||
index 01e79c3..0000000
|
||||
--- a/file2
|
||||
+++ /dev/null
|
||||
@@ -1,3 +0,0 @@
|
||||
-1
|
||||
-2
|
||||
-3
|
||||
--
|
||||
g-i-t--v-e-r-s-i-o-n
|
||||
|
||||
|
||||
From 889b315013ef9f2e2f90aa0b054b267c8a557847 Mon Sep 17 00:00:00 2001
|
||||
From: A U Thor <author@example.com>
|
||||
Date: Mon, 26 Jun 2006 00:02:00 +0000
|
||||
Subject: [PATCH] Third
|
||||
---
|
||||
dir/sub | 2 ++
|
||||
file1 | 3 +++
|
||||
2 files changed, 5 insertions(+), 0 deletions(-)
|
||||
|
||||
diff --git a/dir/sub b/dir/sub
|
||||
index 8422d40..cead32e 100644
|
||||
--- a/dir/sub
|
||||
+++ b/dir/sub
|
||||
@@ -2,3 +2,5 @@ A
|
||||
B
|
||||
C
|
||||
D
|
||||
+E
|
||||
+F
|
||||
diff --git a/file1 b/file1
|
||||
new file mode 100644
|
||||
index 0000000..b1e6722
|
||||
--- /dev/null
|
||||
+++ b/file1
|
||||
@@ -0,0 +1,3 @@
|
||||
+A
|
||||
+B
|
||||
+C
|
||||
--
|
||||
g-i-t--v-e-r-s-i-o-n
|
||||
|
||||
|
||||
From c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a Mon Sep 17 00:00:00 2001
|
||||
From: A U Thor <author@example.com>
|
||||
Date: Mon, 26 Jun 2006 00:03:00 +0000
|
||||
Subject: [PATCH] Side
|
||||
---
|
||||
dir/sub | 2 ++
|
||||
file0 | 3 +++
|
||||
file3 | 4 ++++
|
||||
3 files changed, 9 insertions(+), 0 deletions(-)
|
||||
|
||||
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
|
||||
--
|
||||
g-i-t--v-e-r-s-i-o-n
|
||||
|
||||
$
|
|
@ -0,0 +1,76 @@
|
|||
$ git format-patch --stdout initial..master^
|
||||
From 7952a93e09bf565b5592766a438b40cd81f4846f Mon Sep 17 00:00:00 2001
|
||||
From: A U Thor <author@example.com>
|
||||
Date: Mon, 26 Jun 2006 00:01:00 +0000
|
||||
Subject: [PATCH] Second
|
||||
---
|
||||
dir/sub | 2 ++
|
||||
file0 | 3 +++
|
||||
file2 | 3 ---
|
||||
3 files changed, 5 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/dir/sub b/dir/sub
|
||||
index 35d242b..8422d40 100644
|
||||
--- a/dir/sub
|
||||
+++ b/dir/sub
|
||||
@@ -1,2 +1,4 @@
|
||||
A
|
||||
B
|
||||
+C
|
||||
+D
|
||||
diff --git a/file0 b/file0
|
||||
index 01e79c3..b414108 100644
|
||||
--- a/file0
|
||||
+++ b/file0
|
||||
@@ -1,3 +1,6 @@
|
||||
1
|
||||
2
|
||||
3
|
||||
+4
|
||||
+5
|
||||
+6
|
||||
diff --git a/file2 b/file2
|
||||
deleted file mode 100644
|
||||
index 01e79c3..0000000
|
||||
--- a/file2
|
||||
+++ /dev/null
|
||||
@@ -1,3 +0,0 @@
|
||||
-1
|
||||
-2
|
||||
-3
|
||||
--
|
||||
g-i-t--v-e-r-s-i-o-n
|
||||
|
||||
|
||||
From 889b315013ef9f2e2f90aa0b054b267c8a557847 Mon Sep 17 00:00:00 2001
|
||||
From: A U Thor <author@example.com>
|
||||
Date: Mon, 26 Jun 2006 00:02:00 +0000
|
||||
Subject: [PATCH] Third
|
||||
---
|
||||
dir/sub | 2 ++
|
||||
file1 | 3 +++
|
||||
2 files changed, 5 insertions(+), 0 deletions(-)
|
||||
|
||||
diff --git a/dir/sub b/dir/sub
|
||||
index 8422d40..cead32e 100644
|
||||
--- a/dir/sub
|
||||
+++ b/dir/sub
|
||||
@@ -2,3 +2,5 @@ A
|
||||
B
|
||||
C
|
||||
D
|
||||
+E
|
||||
+F
|
||||
diff --git a/file1 b/file1
|
||||
new file mode 100644
|
||||
index 0000000..b1e6722
|
||||
--- /dev/null
|
||||
+++ b/file1
|
||||
@@ -0,0 +1,3 @@
|
||||
+A
|
||||
+B
|
||||
+C
|
||||
--
|
||||
g-i-t--v-e-r-s-i-o-n
|
||||
|
||||
$
|
|
@ -0,0 +1,45 @@
|
|||
$ git format-patch --stdout initial..side
|
||||
From c7a2ab9e8eac7b117442a607d5a9b3950ae34d5a Mon Sep 17 00:00:00 2001
|
||||
From: A U Thor <author@example.com>
|
||||
Date: Mon, 26 Jun 2006 00:03:00 +0000
|
||||
Subject: [PATCH] Side
|
||||
---
|
||||
dir/sub | 2 ++
|
||||
file0 | 3 +++
|
||||
file3 | 4 ++++
|
||||
3 files changed, 9 insertions(+), 0 deletions(-)
|
||||
|
||||
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
|
||||
--
|
||||
g-i-t--v-e-r-s-i-o-n
|
||||
|
||||
$
|
Загрузка…
Ссылка в новой задаче