Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 7 additions & 13 deletions src/wasm/stream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
}

Expand Down
11 changes: 11 additions & 0 deletions test/test_clone.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"


Expand Down Expand Up @@ -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()