Skip to content

Commit c8e52bf

Browse files
Copilotdschoderrickstolee
committed
scalar: work around GVFS Protocol HTTP/2 failures
Work around failures when using the GVFS Protocol with Azure DevOps URLs (dev.azure.com and *.visualstudio.com) due to incomplete HTTP/2 support on the server side. Configure http.<url>.version=HTTP/1.1 for these remotes when setting up or reconfiguring a Scalar enlistment. This ensures that Scalar and GVFS continue to function correctly with Azure-hosted repositories, without affecting other remotes. This fixes #752 Co-authored-by: Johannes Schindelin <johannes.schindelin@gmx.de> Co-authored-by: Derrick Stolee <stolee@gmail.com> Signed-off-by: Derrick Stolee <stolee@gmail.com> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
1 parent 26a1353 commit c8e52bf

2 files changed

Lines changed: 57 additions & 2 deletions

File tree

‎scalar.c‎

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,33 @@ static int set_recommended_config(int reconfigure)
226226
fsmonitor.key, fsmonitor.value);
227227
}
228228

229+
/*
230+
* Set HTTP/1.1 for Azure DevOps URLs
231+
* We check for dev.azure.com/ and .visualstudio.com/ patterns
232+
* which are sufficient to identify ADO URLs (including formats like
233+
* https://orgname@dev.azure.com/...)
234+
*/
235+
if (!repo_config_get_string(the_repository, "remote.origin.url", &value)) {
236+
if (starts_with(value, "https://dev.azure.com/") ||
237+
strstr(value, "@dev.azure.com/") ||
238+
strstr(value, ".visualstudio.com/")) {
239+
struct strbuf key = STRBUF_INIT;
240+
strbuf_addf(&key, "http.%s.version", value);
241+
FREE_AND_NULL(value);
242+
243+
if (reconfigure || repo_config_get_string(the_repository, key.buf, &value)) {
244+
trace2_data_string("scalar", the_repository, key.buf, "created");
245+
if (repo_config_set_gently(the_repository, key.buf, "HTTP/1.1") < 0) {
246+
strbuf_release(&key);
247+
return error(_("could not configure %s=%s"),
248+
key.buf, "HTTP/1.1");
249+
}
250+
}
251+
strbuf_release(&key);
252+
}
253+
FREE_AND_NULL(value);
254+
}
255+
229256
/*
230257
* The `log.excludeDecoration` setting is special because it allows
231258
* for multiple values.
@@ -882,7 +909,7 @@ static int cmd_clone(int argc, const char **argv)
882909
/* Is --[no-]gvfs-protocol unspecified? Infer from url. */
883910
if (gvfs_protocol < 0) {
884911
if (cache_server_url ||
885-
strstr(url, "dev.azure.com") ||
912+
strstr(url, "dev.azure.com/") ||
886913
strstr(url, "visualstudio.com"))
887914
gvfs_protocol = 1;
888915
else
@@ -899,7 +926,7 @@ static int cmd_clone(int argc, const char **argv)
899926
cache_server_url = default_cache_server_url;
900927
if (set_config("core.useGVFSHelper=true") ||
901928
set_config("core.gvfs=150") ||
902-
set_config("http.version=HTTP/1.1")) {
929+
set_config("http.%s.version=HTTP/1.1", url)) {
903930
res = error(_("could not turn on GVFS helper"));
904931
goto cleanup;
905932
}

‎t/t9210-scalar.sh‎

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,29 @@ test_expect_success 'scalar reconfigure --all with detached HEADs' '
276276
done
277277
'
278278

279+
test_expect_success 'verify http.<url>.version=HTTP/1.1 for ADO URLs' '
280+
test_when_finished rm -rf test-http-url-config &&
281+
282+
# Create a test repository
283+
git init test-http-url-config &&
284+
285+
# Test both URL types
286+
for url in "https://test@dev.azure.com/test/project/_git/repo" \
287+
"https://contoso.visualstudio.com/project/_git/repo"
288+
do
289+
# Set URL as remote
290+
git -C test-http-url-config config set remote.origin.url "$url" &&
291+
292+
# Run scalar reconfigure
293+
scalar reconfigure test-http-url-config &&
294+
295+
# Verify URL-specific HTTP version setting
296+
git -C test-http-url-config config "http.$url.version" >actual &&
297+
echo "HTTP/1.1" >expect &&
298+
test_cmp expect actual || return 1
299+
done
300+
'
301+
279302
test_expect_success '`reconfigure -a` removes stale config entries' '
280303
git init stale/src &&
281304
scalar register stale &&
@@ -415,6 +438,11 @@ test_expect_success '`scalar clone` with GVFS-enabled server' '
415438
git -C using-gvfs/src config gvfs.sharedCache >actual &&
416439
test_cmp expect actual &&
417440
441+
: verify that URL-specific HTTP version setting is configured for GVFS URLs in clone &&
442+
git -C using-gvfs/src config "http.http://$HOST_PORT/.version" >actual &&
443+
echo "HTTP/1.1" >expect &&
444+
test_cmp expect actual &&
445+
418446
second=$(git rev-parse --verify second:second.t) &&
419447
(
420448
cd using-gvfs/src &&

0 commit comments

Comments
 (0)