t4014: add format-patch --ignore-if-in-upstream test
Signed-off-by: Junio C Hamano <junkio@cox.net>
Junio C Hamano committed
Jun 26, 2006 at 15:40 UTC
ece3c67f9c8f0074cae76204a648cbfc6075bb44
1 file changed
+69
t/t4014-format-patch.sh
new
+69
@@ -0,0 +1,69 @@
1
+#!/bin/sh
2
+#
3
+# Copyright (c) 2006 Junio C Hamano
4
+#
5
+
6
+test_description='Format-patch skipping already incorporated patches'
7
+
8
+. ./test-lib.sh
9
+
10
+test_expect_success setup '
11
+
12
+ for i in 1 2 3 4 5 6 7 8 9 10; do echo "$i"; done >file &&
13
+ git add file &&
14
+ git commit -m Initial &&
15
+ git checkout -b side &&
16
+
17
+ for i in 1 2 5 6 A B C 7 8 9 10; do echo "$i"; done >file &&
18
+ git update-index file &&
19
+ git commit -m "Side change #1" &&
20
+
21
+ for i in D E F; do echo "$i"; done >>file &&
22
+ git update-index file &&
23
+ git commit -m "Side change #2" &&
24
+ git tag C1 &&
25
+
26
+ for i in 5 6 1 2 3 A 4 B C 7 8 9 10 D E F; do echo "$i"; done >file &&
27
+ git update-index file &&
28
+ git commit -m "Side change #3" &&
29
+
30
+ git checkout master &&
31
+ git diff-tree -p C1 | git apply --index &&
32
+ git commit -m "Master accepts moral equivalent of #1"
33
+
34
+'
35
+
36
+test_expect_success "format-patch --ignore-if-in-upstream" '
37
+
38
+ git format-patch --stdout master..side >patch0 &&
39
+ cnt=`grep "^From " patch0 | wc -l` &&
40
+ test "$cnt" = 3
41
+
42
+'
43
+
44
+test_expect_success "format-patch --ignore-if-in-upstream" '
45
+
46
+ git format-patch --stdout \
47
+ --ignore-if-in-upstream master..side >patch1 &&
48
+ cnt=`grep "^From " patch1 | wc -l` &&
49
+ test "$cnt" = 2
50
+
51
+'
52
+
53
+test_expect_success "format-patch result applies" '
54
+
55
+ git checkout -b rebuild-0 master &&
56
+ git am -3 patch0 &&
57
+ cnt=`git rev-list master.. | wc -l` &&
58
+ test "$cnt" = 2
59
+'
60
+
61
+test_expect_success "format-patch --ignore-if-in-upstream result applies" '
62
+
63
+ git checkout -b rebuild-1 master &&
64
+ git am -3 patch1 &&
65
+ cnt=`git rev-list master.. | wc -l` &&
66
+ test "$cnt" = 2
67
+'
68
+
69
+test_done