@@ -36,21 +36,22 @@ prime_resolve_undo () {
36
36
test_must_fail git merge third^0 &&
37
37
echo merge does not leave anything &&
38
38
check_resolve_undo empty &&
39
- echo different > file &&
40
- git add file &&
39
+ echo different > fi/le &&
40
+ git add fi/le &&
41
41
echo resolving records &&
42
- check_resolve_undo recorded file initial:file second:file third:file
42
+ check_resolve_undo recorded fi/le initial:fi/le second:fi/le third:fi/le
43
43
}
44
44
45
45
test_expect_success setup '
46
- test_commit initial file first &&
46
+ mkdir fi &&
47
+ test_commit initial fi/le first &&
47
48
git branch side &&
48
49
git branch another &&
49
- test_commit second file second &&
50
+ test_commit second fi/le second &&
50
51
git checkout side &&
51
- test_commit third file third &&
52
+ test_commit third fi/le third &&
52
53
git checkout another &&
53
- test_commit fourth file fourth &&
54
+ test_commit fourth fi/le fourth &&
54
55
git checkout master
55
56
'
56
57
@@ -59,7 +60,7 @@ test_expect_success 'add records switch clears' '
59
60
test_tick &&
60
61
git commit -m merged &&
61
62
echo committing keeps &&
62
- check_resolve_undo kept file initial:file second:file third:file &&
63
+ check_resolve_undo kept fi/le initial:fi/le second:fi/le third:fi/le &&
63
64
git checkout second^0 &&
64
65
echo switching clears &&
65
66
check_resolve_undo cleared
@@ -70,15 +71,15 @@ test_expect_success 'rm records reset clears' '
70
71
test_tick &&
71
72
git commit -m merged &&
72
73
echo committing keeps &&
73
- check_resolve_undo kept file initial:file second:file third:file &&
74
+ check_resolve_undo kept fi/le initial:fi/le second:fi/le third:fi/le &&
74
75
75
76
echo merge clears upfront &&
76
77
test_must_fail git merge fourth^0 &&
77
78
check_resolve_undo nuked &&
78
79
79
- git rm -f file &&
80
+ git rm -f fi/le &&
80
81
echo resolving records &&
81
- check_resolve_undo recorded file initial:file HEAD:file fourth:file &&
82
+ check_resolve_undo recorded fi/le initial:fi/le HEAD:fi/le fourth:fi/le &&
82
83
83
84
git reset --hard &&
84
85
echo resetting discards &&
@@ -90,7 +91,7 @@ test_expect_success 'plumbing clears' '
90
91
test_tick &&
91
92
git commit -m merged &&
92
93
echo committing keeps &&
93
- check_resolve_undo kept file initial:file second:file third:file &&
94
+ check_resolve_undo kept fi/le initial:fi/le second:fi/le third:fi/le &&
94
95
95
96
echo plumbing clear &&
96
97
git update-index --clear-resolve-undo &&
@@ -100,7 +101,7 @@ test_expect_success 'plumbing clears' '
100
101
test_expect_success ' add records checkout -m undoes' '
101
102
prime_resolve_undo &&
102
103
git diff HEAD &&
103
- git checkout --conflict=merge file &&
104
+ git checkout --conflict=merge fi/le &&
104
105
echo checkout used the record and removed it &&
105
106
check_resolve_undo removed &&
106
107
echo the index and the work tree is unmerged again &&
@@ -110,33 +111,59 @@ test_expect_success 'add records checkout -m undoes' '
110
111
111
112
test_expect_success ' unmerge with plumbing' '
112
113
prime_resolve_undo &&
113
- git update-index --unresolve file &&
114
+ git update-index --unresolve fi/le &&
114
115
git ls-files -u >actual &&
115
116
test $(wc -l <actual) = 3
116
117
'
117
118
118
- test_expect_success ' rerere and rerere -- forget' '
119
+ test_expect_success ' rerere and rerere forget' '
119
120
mkdir .git/rr-cache &&
120
121
prime_resolve_undo &&
121
122
echo record the resolution &&
122
123
git rerere &&
123
124
rerere_id=$(cd .git/rr-cache && echo */postimage) &&
124
125
rerere_id=${rerere_id%/postimage} &&
125
126
test -f .git/rr-cache/$rerere_id/postimage &&
126
- git checkout -m file &&
127
+ git checkout -m fi/le &&
127
128
echo resurrect the conflict &&
128
- grep "^=======" file &&
129
+ grep "^=======" fi/le &&
129
130
echo reresolve the conflict &&
130
131
git rerere &&
131
- test "z$(cat file )" = zdifferent &&
132
+ test "z$(cat fi/le )" = zdifferent &&
132
133
echo register the resolution again &&
133
- git add file &&
134
- check_resolve_undo kept file initial:file second:file third:file &&
134
+ git add fi/le &&
135
+ check_resolve_undo kept fi/le initial:fi/le second:fi/le third:fi/le &&
135
136
test -z "$(git ls-files -u)" &&
136
- git rerere forget file &&
137
+ git rerere forget fi/le &&
137
138
! test -f .git/rr-cache/$rerere_id/postimage &&
138
139
tr "\0" "\n" <.git/MERGE_RR >actual &&
139
- echo "$rerere_id file" >expect &&
140
+ echo "$rerere_id fi/le" >expect &&
141
+ test_cmp expect actual
142
+ '
143
+
144
+ test_expect_success ' rerere and rerere forget (subdirectory)' '
145
+ rm -fr .git/rr-cache &&
146
+ mkdir .git/rr-cache &&
147
+ prime_resolve_undo &&
148
+ echo record the resolution &&
149
+ (cd fi && git rerere) &&
150
+ rerere_id=$(cd .git/rr-cache && echo */postimage) &&
151
+ rerere_id=${rerere_id%/postimage} &&
152
+ test -f .git/rr-cache/$rerere_id/postimage &&
153
+ (cd fi && git checkout -m le) &&
154
+ echo resurrect the conflict &&
155
+ grep "^=======" fi/le &&
156
+ echo reresolve the conflict &&
157
+ (cd fi && git rerere) &&
158
+ test "z$(cat fi/le)" = zdifferent &&
159
+ echo register the resolution again &&
160
+ (cd fi && git add le) &&
161
+ check_resolve_undo kept fi/le initial:fi/le second:fi/le third:fi/le &&
162
+ test -z "$(git ls-files -u)" &&
163
+ (cd fi && git rerere forget le) &&
164
+ ! test -f .git/rr-cache/$rerere_id/postimage &&
165
+ tr "\0" "\n" <.git/MERGE_RR >actual &&
166
+ echo "$rerere_id fi/le" >expect &&
140
167
test_cmp expect actual
141
168
'
142
169
0 commit comments