aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--remote-curl.c7
-rwxr-xr-xt/t5551-http-fetch-smart.sh7
2 files changed, 14 insertions, 0 deletions
diff --git a/remote-curl.c b/remote-curl.c
index 69f919454a..a489cbe6f4 100644
--- a/remote-curl.c
+++ b/remote-curl.c
@@ -1551,6 +1551,13 @@ int cmd_main(int argc, const char **argv)
goto cleanup;
}
+ /*
+ * yuck, see 9e89dcb66a (builtin/ls-remote: fall back to SHA1 outside
+ * of a repo, 2024-08-02)
+ */
+ if (nongit)
+ repo_set_hash_algo(the_repository, GIT_HASH_DEFAULT);
+
options.verbosity = 1;
options.progress = !!isatty(2);
options.thin = 1;
diff --git a/t/t5551-http-fetch-smart.sh b/t/t5551-http-fetch-smart.sh
index 73cf531580..a26b6c2844 100755
--- a/t/t5551-http-fetch-smart.sh
+++ b/t/t5551-http-fetch-smart.sh
@@ -782,4 +782,11 @@ test_expect_success 'tag following always works over v0 http' '
test_cmp expect actual
'
+test_expect_success 'ls-remote outside repo does not segfault with fetch refspec' '
+ nongit git \
+ -c remote.origin.url="$HTTPD_URL/smart/repo.git" \
+ -c remote.origin.fetch=anything \
+ ls-remote origin
+'
+
test_done