@@ -24,8 +24,12 @@ test_set_port GIT_TEST_GVFS_PROTOCOL_PORT
24
24
# actually use it). We are only testing explicit object
25
25
# fetching using gvfs-helper.exe in isolation.
26
26
#
27
+ # repo_t2:
28
+ # Another empty repo to use after we contaminate t1.
29
+ #
27
30
REPO_SRC=" $( pwd) " /repo_src
28
31
REPO_T1=" $( pwd) " /repo_t1
32
+ REPO_T2=" $( pwd) " /repo_t2
29
33
30
34
# Setup some loopback URLs where test-gvfs-protocol.exe will be
31
35
# listening. We will spawn it directly inside the repo_src directory,
@@ -45,6 +49,7 @@ ORIGIN_URL=http://$HOST_PORT/servertype/origin
45
49
CACHE_URL=http://$HOST_PORT /servertype/cache
46
50
47
51
SHARED_CACHE_T1=" $( pwd) " /shared_cache_t1
52
+ SHARED_CACHE_T2=" $( pwd) " /shared_cache_t2
48
53
49
54
# The pid-file is created by test-gvfs-protocol.exe when it starts.
50
55
# The server will shut down if/when we delete it. (This is a little
@@ -182,6 +187,10 @@ test_expect_success 'setup repos' '
182
187
mkdir "$SHARED_CACHE_T1/pack" &&
183
188
mkdir "$SHARED_CACHE_T1/info" &&
184
189
#
190
+ mkdir "$SHARED_CACHE_T2" &&
191
+ mkdir "$SHARED_CACHE_T2/pack" &&
192
+ mkdir "$SHARED_CACHE_T2/info" &&
193
+ #
185
194
# setup repo_t1 and point all of the gvfs.* values to repo_src.
186
195
#
187
196
test_create_repo "$REPO_T1" &&
@@ -191,6 +200,13 @@ test_expect_success 'setup repos' '
191
200
git -C "$REPO_T1" config --local gvfs.sharedCache "$SHARED_CACHE_T1" &&
192
201
echo "$SHARED_CACHE_T1" >> "$REPO_T1"/.git/objects/info/alternates &&
193
202
#
203
+ test_create_repo "$REPO_T2" &&
204
+ git -C "$REPO_T2" branch -M main &&
205
+ git -C "$REPO_T2" remote add origin $ORIGIN_URL &&
206
+ git -C "$REPO_T2" config --local gvfs.cache-server $CACHE_URL &&
207
+ git -C "$REPO_T2" config --local gvfs.sharedCache "$SHARED_CACHE_T2" &&
208
+ echo "$SHARED_CACHE_T2" >> "$REPO_T2"/.git/objects/info/alternates &&
209
+ #
194
210
#
195
211
#
196
212
cat <<-EOF >creds.txt &&
@@ -203,6 +219,7 @@ test_expect_success 'setup repos' '
203
219
EOF
204
220
chmod 755 creds.sh &&
205
221
git -C "$REPO_T1" config --local credential.helper "!f() { cat \"$(pwd)\"/creds.txt; }; f" &&
222
+ git -C "$REPO_T2" config --local credential.helper "!f() { cat \"$(pwd)\"/creds.txt; }; f" &&
206
223
#
207
224
# Create some test data sets.
208
225
#
@@ -1246,6 +1263,77 @@ test_expect_success 'integration: fully implicit: diff 2 commits' '
1246
1263
>OUT.output 2>OUT.stderr
1247
1264
'
1248
1265
1266
+ # T1 should be considered contaminated at this point.
1267
+
1268
+ # ################################################################
1269
+ # gvfs-helper.exe defaults to no fallback.
1270
+ # gvfs-helper-client.c defaults to adding `--fallback` to child process.
1271
+ #
1272
+ # `gvfs.fallback` was added to change the default behavior in the
1273
+ # gvfs-helper-client.c code to add either `--fallback` or `--no-fallback`
1274
+ # (for origin server load reasons).
1275
+ #
1276
+ # When `gvfs.fallback` is unset, we default to TRUE and pass `--fallback`.
1277
+ # Otherwise, we use the boolean value to decide.
1278
+ # ################################################################
1279
+
1280
+ test_expect_success ' integration: implicit-get: http_503: diff 2 commits' '
1281
+ test_when_finished "per_test_cleanup" &&
1282
+
1283
+ # Tell both servers to always send 503.
1284
+ start_gvfs_protocol_server_with_mayhem http_503 &&
1285
+
1286
+ # Implicitly demand-load everything without any pre-seeding.
1287
+ # (We cannot tell from whether fallback was used or not in this
1288
+ # limited test.)
1289
+ #
1290
+ test_must_fail \
1291
+ git -C "$REPO_T2" -c core.useGVFSHelper=true \
1292
+ diff $(cat m1.branch)..$(cat m3.branch) \
1293
+ >OUT.output 2>OUT.stderr &&
1294
+
1295
+ stop_gvfs_protocol_server
1296
+ '
1297
+
1298
+ test_expect_success ' integration: implicit-get: cache_http_503,no-fallback: diff 2 commits' '
1299
+ test_when_finished "per_test_cleanup" &&
1300
+
1301
+ # Tell cache server to send 503 and origin server to send 200.
1302
+ start_gvfs_protocol_server_with_mayhem cache_http_503 &&
1303
+
1304
+ # Implicitly demand-load everything without any pre-seeding.
1305
+ # This should fail because we do not allow fallback.
1306
+ #
1307
+ test_must_fail \
1308
+ git -C "$REPO_T2" \
1309
+ -c core.useGVFSHelper=true \
1310
+ -c gvfs.fallback=false \
1311
+ diff $(cat m1.branch)..$(cat m3.branch) \
1312
+ >OUT.output 2>OUT.stderr &&
1313
+
1314
+ stop_gvfs_protocol_server
1315
+ '
1316
+
1317
+ test_expect_success ' integration: implicit-get: cache_http_503,with-fallback: diff 2 commits' '
1318
+ test_when_finished "per_test_cleanup" &&
1319
+
1320
+ # Tell cache server to send 503 and origin server to send 200.
1321
+ start_gvfs_protocol_server_with_mayhem cache_http_503 &&
1322
+
1323
+ # Implicitly demand-load everything without any pre-seeding.
1324
+ #
1325
+ git -C "$REPO_T2" \
1326
+ -c core.useGVFSHelper=true \
1327
+ -c gvfs.fallback=true \
1328
+ diff $(cat m1.branch)..$(cat m3.branch) \
1329
+ >OUT.output 2>OUT.stderr &&
1330
+
1331
+ stop_gvfs_protocol_server
1332
+ '
1333
+
1334
+ # T2 should be considered contaminated at this point.
1335
+
1336
+
1249
1337
# ################################################################
1250
1338
# Duplicate packfile tests.
1251
1339
#
0 commit comments