9
. ./test-lib.sh
10
11
cat > a1 << EOF
12
+Some title
13
+==========
14
Whether 'tis nobler in the mind to suffer
15
The slings and arrows of outrageous fortune,
16
Or to take arms against a sea of troubles,
26
27
git checkout -b first
28
cat >> a1 << EOF
29
+Some title
30
+==========
31
To die, to sleep;
32
To sleep: perchance to dream: ay, there's the rub;
33
For in that sleep of death what dreams may come
39
40
git checkout -b second master
41
git show first:a1 |
38
-sed -e 's/To die, t/To die! T/' > a1
42
+sed -e 's/To die, t/To die! T/' -e 's/Some title/Some Title/' > a1
43
echo "* END *" >>a1
44
git commit -q -a -m second
45
59
60
sha1=$(sed -e 's/ .*//' .git/rr-cache/MERGE_RR)
61
rr=.git/rr-cache/$sha1
58
-test_expect_success 'recorded preimage' "grep ======= $rr/preimage"
62
+test_expect_success 'recorded preimage' "grep ^=======$ $rr/preimage"
63
64
test_expect_success 'rerere.enabled works, too' '
65
rm -rf .git/rr-cache &&
66
git config rerere.enabled true &&
67
git reset --hard &&
68
! git merge first &&
65
- grep ======= $rr/preimage
69
+ grep ^=======$ $rr/preimage
70
'
71
72
test_expect_success 'no postimage or thisimage yet' \
75
test_expect_success 'preimage has right number of lines' '
76
77
cnt=$(sed -ne "/^<<<<<<</,/^>>>>>>>/p" $rr/preimage | wc -l) &&
74
- test $cnt = 9
78
+ test $cnt = 13
79
80
'
81
84
cat > expect << EOF
85
--- a/a1
86
+++ b/a1
83
-@@ -6,17 +6,9 @@
87
+@@ -1,4 +1,4 @@
88
+-Some Title
89
++Some title
90
+ ==========
91
+ Whether 'tis nobler in the mind to suffer
92
+ The slings and arrows of outrageous fortune,
93
+@@ -8,21 +8,11 @@
94
The heart-ache and the thousand natural shocks
95
That flesh is heir to, 'tis a consummation
96
Devoutly to be wish'd.
97
-<<<<<<<
98
+-Some Title
99
+-==========
100
-To die! To sleep;
101
-=======
102
+ Some title
103
+ ==========
104
To die, to sleep;
105
->>>>>>>
106
To sleep: perchance to dream: ay, there's the rub;
138
'
139
140
git show first:a1 | sed 's/To die: t/To die! T/' > expect
127
-test_expect_success 'rerere kicked in' "! grep ======= a1"
141
+test_expect_success 'rerere kicked in' "! grep ^=======$ a1"
142
143
test_expect_success 'rerere prefers first change' 'test_cmp a1 expect'
144