diff --git a/src/wasm/stream.cpp b/src/wasm/stream.cpp index b5a19de..d96b309 100644 --- a/src/wasm/stream.cpp +++ b/src/wasm/stream.cpp @@ -337,20 +337,14 @@ static int read(wasm_http_stream* stream, read_buffer_t& read_buffer, bool is_re } else { - if (stream->m_request_index != -1) - { - git_error_set( - GIT_ERROR_HTTP, - "read called with pending request to %s", - stream->m_unconverted_url.c_str() - ); - return -1; - } - - if (create_request(stream, stream->m_service.m_response_type.c_str()) < 0) + if (stream->m_request_index == -1) { - convert_js_to_git_error(stream); - return -1; + // Send http(s) request if have not already done so. + if (create_request(stream, stream->m_service.m_response_type.c_str()) < 0) + { + convert_js_to_git_error(stream); + return -1; + } } } diff --git a/test/test_clone.py b/test/test_clone.py index bf4fe31..82db23f 100644 --- a/test/test_clone.py +++ b/test/test_clone.py @@ -4,6 +4,7 @@ from .conftest import GIT2CPP_TEST_WASM +xsimd_url = "https://github.com/xtensor-stack/xsimd.git" xtl_url = "https://github.com/xtensor-stack/xtl.git" @@ -218,3 +219,13 @@ def test_clone_negative_timeout_ignored(git2cpp_path, tmp_path, run_in_tmp_path) "environment variable GIT_HTTP_TIMEOUT must be a positive number of seconds" in p_clone.stdout ) + + +def test_clone_large_repo(git2cpp_path, tmp_path, run_in_tmp_path): + clone_cmd = [git2cpp_path, "clone", xsimd_url] + p_clone = subprocess.run(clone_cmd, capture_output=True, cwd=tmp_path, text=True) + assert p_clone.returncode == 0 + + assert (tmp_path / "xsimd").exists() + assert (tmp_path / "xsimd/include").exists() + assert (tmp_path / "xsimd/xsimdConfig.cmake.in").exists()