@@ -93,29 +93,29 @@ test_expect_success "setup for testing promisor remote advertisement" '
93
93
94
94
test_expect_success " clone with promisor.advertise set to 'true'" '
95
95
git -C server config promisor.advertise true &&
96
+ test_when_finished "rm -rf client" &&
96
97
97
98
# Clone from server to create a client
98
99
GIT_NO_LAZY_FETCH=0 git clone -c remote.lop.promisor=true \
99
100
-c remote.lop.fetch="+refs/heads/*:refs/remotes/lop/*" \
100
101
-c remote.lop.url="file://$(pwd)/lop" \
101
102
-c promisor.acceptfromserver=All \
102
103
--no-local --filter="blob:limit=5k" server client &&
103
- test_when_finished "rm -rf client" &&
104
104
105
105
# Check that the largest object is still missing on the server
106
106
check_missing_objects server 1 "$oid"
107
107
'
108
108
109
109
test_expect_success " clone with promisor.advertise set to 'false'" '
110
110
git -C server config promisor.advertise false &&
111
+ test_when_finished "rm -rf client" &&
111
112
112
113
# Clone from server to create a client
113
114
GIT_NO_LAZY_FETCH=0 git clone -c remote.lop.promisor=true \
114
115
-c remote.lop.fetch="+refs/heads/*:refs/remotes/lop/*" \
115
116
-c remote.lop.url="file://$(pwd)/lop" \
116
117
-c promisor.acceptfromserver=All \
117
118
--no-local --filter="blob:limit=5k" server client &&
118
- test_when_finished "rm -rf client" &&
119
119
120
120
# Check that the largest object is not missing on the server
121
121
check_missing_objects server 0 "" &&
@@ -126,14 +126,14 @@ test_expect_success "clone with promisor.advertise set to 'false'" '
126
126
127
127
test_expect_success " clone with promisor.acceptfromserver set to 'None'" '
128
128
git -C server config promisor.advertise true &&
129
+ test_when_finished "rm -rf client" &&
129
130
130
131
# Clone from server to create a client
131
132
GIT_NO_LAZY_FETCH=0 git clone -c remote.lop.promisor=true \
132
133
-c remote.lop.fetch="+refs/heads/*:refs/remotes/lop/*" \
133
134
-c remote.lop.url="file://$(pwd)/lop" \
134
135
-c promisor.acceptfromserver=None \
135
136
--no-local --filter="blob:limit=5k" server client &&
136
- test_when_finished "rm -rf client" &&
137
137
138
138
# Check that the largest object is not missing on the server
139
139
check_missing_objects server 0 "" &&
@@ -144,8 +144,8 @@ test_expect_success "clone with promisor.acceptfromserver set to 'None'" '
144
144
145
145
test_expect_success " init + fetch with promisor.advertise set to 'true'" '
146
146
git -C server config promisor.advertise true &&
147
-
148
147
test_when_finished "rm -rf client" &&
148
+
149
149
mkdir client &&
150
150
git -C client init &&
151
151
git -C client config remote.lop.promisor true &&
@@ -162,30 +162,49 @@ test_expect_success "init + fetch with promisor.advertise set to 'true'" '
162
162
163
163
test_expect_success " clone with promisor.acceptfromserver set to 'KnownName'" '
164
164
git -C server config promisor.advertise true &&
165
+ test_when_finished "rm -rf client" &&
165
166
166
167
# Clone from server to create a client
167
168
GIT_NO_LAZY_FETCH=0 git clone -c remote.lop.promisor=true \
168
169
-c remote.lop.fetch="+refs/heads/*:refs/remotes/lop/*" \
169
170
-c remote.lop.url="file://$(pwd)/lop" \
170
171
-c promisor.acceptfromserver=KnownName \
171
172
--no-local --filter="blob:limit=5k" server client &&
172
- test_when_finished "rm -rf client" &&
173
173
174
174
# Check that the largest object is still missing on the server
175
175
check_missing_objects server 1 "$oid"
176
176
'
177
177
178
178
test_expect_success " clone with 'KnownName' and different remote names" '
179
179
git -C server config promisor.advertise true &&
180
+ test_when_finished "rm -rf client" &&
180
181
181
182
# Clone from server to create a client
182
183
GIT_NO_LAZY_FETCH=0 git clone -c remote.serverTwo.promisor=true \
183
184
-c remote.serverTwo.fetch="+refs/heads/*:refs/remotes/lop/*" \
184
185
-c remote.serverTwo.url="file://$(pwd)/lop" \
185
186
-c promisor.acceptfromserver=KnownName \
186
187
--no-local --filter="blob:limit=5k" server client &&
188
+
189
+ # Check that the largest object is not missing on the server
190
+ check_missing_objects server 0 "" &&
191
+
192
+ # Reinitialize server so that the largest object is missing again
193
+ initialize_server 1 "$oid"
194
+ '
195
+
196
+ test_expect_success " clone with 'KnownName' and missing URL in the config" '
197
+ git -C server config promisor.advertise true &&
187
198
test_when_finished "rm -rf client" &&
188
199
200
+ # Clone from server to create a client
201
+ # Lazy fetching by the client from the LOP will fail because of the
202
+ # missing URL in the client config, so the server will have to lazy
203
+ # fetch from the LOP.
204
+ GIT_NO_LAZY_FETCH=0 git clone -c remote.lop.promisor=true \
205
+ -c promisor.acceptfromserver=KnownName \
206
+ --no-local --filter="blob:limit=5k" server client &&
207
+
189
208
# Check that the largest object is not missing on the server
190
209
check_missing_objects server 0 "" &&
191
210
@@ -195,14 +214,14 @@ test_expect_success "clone with 'KnownName' and different remote names" '
195
214
196
215
test_expect_success " clone with promisor.acceptfromserver set to 'KnownUrl'" '
197
216
git -C server config promisor.advertise true &&
217
+ test_when_finished "rm -rf client" &&
198
218
199
219
# Clone from server to create a client
200
220
GIT_NO_LAZY_FETCH=0 git clone -c remote.lop.promisor=true \
201
221
-c remote.lop.fetch="+refs/heads/*:refs/remotes/lop/*" \
202
222
-c remote.lop.url="file://$(pwd)/lop" \
203
223
-c promisor.acceptfromserver=KnownUrl \
204
224
--no-local --filter="blob:limit=5k" server client &&
205
- test_when_finished "rm -rf client" &&
206
225
207
226
# Check that the largest object is still missing on the server
208
227
check_missing_objects server 1 "$oid"
@@ -212,14 +231,14 @@ test_expect_success "clone with 'KnownUrl' and different remote urls" '
212
231
ln -s lop serverTwo &&
213
232
214
233
git -C server config promisor.advertise true &&
234
+ test_when_finished "rm -rf client" &&
215
235
216
236
# Clone from server to create a client
217
237
GIT_NO_LAZY_FETCH=0 git clone -c remote.lop.promisor=true \
218
238
-c remote.lop.fetch="+refs/heads/*:refs/remotes/lop/*" \
219
239
-c remote.lop.url="file://$(pwd)/serverTwo" \
220
240
-c promisor.acceptfromserver=KnownUrl \
221
241
--no-local --filter="blob:limit=5k" server client &&
222
- test_when_finished "rm -rf client" &&
223
242
224
243
# Check that the largest object is not missing on the server
225
244
check_missing_objects server 0 "" &&
@@ -228,6 +247,48 @@ test_expect_success "clone with 'KnownUrl' and different remote urls" '
228
247
initialize_server 1 "$oid"
229
248
'
230
249
250
+ test_expect_success " clone with 'KnownUrl' and url not configured on the server" '
251
+ git -C server config promisor.advertise true &&
252
+ test_when_finished "rm -rf client" &&
253
+
254
+ test_when_finished "git -C server config set remote.lop.url \"file://$(pwd)/lop\"" &&
255
+ git -C server config unset remote.lop.url &&
256
+
257
+ # Clone from server to create a client
258
+ # It should fail because the client will reject the LOP as URLs are
259
+ # different, and the server cannot lazy fetch as the LOP URL is
260
+ # missing, so the remote name will be used instead which will fail.
261
+ test_must_fail env GIT_NO_LAZY_FETCH=0 git clone -c remote.lop.promisor=true \
262
+ -c remote.lop.fetch="+refs/heads/*:refs/remotes/lop/*" \
263
+ -c remote.lop.url="file://$(pwd)/lop" \
264
+ -c promisor.acceptfromserver=KnownUrl \
265
+ --no-local --filter="blob:limit=5k" server client &&
266
+
267
+ # Check that the largest object is still missing on the server
268
+ check_missing_objects server 1 "$oid"
269
+ '
270
+
271
+ test_expect_success " clone with 'KnownUrl' and empty url, so not advertised" '
272
+ git -C server config promisor.advertise true &&
273
+ test_when_finished "rm -rf client" &&
274
+
275
+ test_when_finished "git -C server config set remote.lop.url \"file://$(pwd)/lop\"" &&
276
+ git -C server config set remote.lop.url "" &&
277
+
278
+ # Clone from server to create a client
279
+ # It should fail because the client will reject the LOP as an empty URL is
280
+ # not advertised, and the server cannot lazy fetch as the LOP URL is empty,
281
+ # so the remote name will be used instead which will fail.
282
+ test_must_fail env GIT_NO_LAZY_FETCH=0 git clone -c remote.lop.promisor=true \
283
+ -c remote.lop.fetch="+refs/heads/*:refs/remotes/lop/*" \
284
+ -c remote.lop.url="file://$(pwd)/lop" \
285
+ -c promisor.acceptfromserver=KnownUrl \
286
+ --no-local --filter="blob:limit=5k" server client &&
287
+
288
+ # Check that the largest object is still missing on the server
289
+ check_missing_objects server 1 "$oid"
290
+ '
291
+
231
292
test_expect_success " clone with promisor.advertise set to 'true' but don't delete the client" '
232
293
git -C server config promisor.advertise true &&
233
294
0 commit comments