diff options
author | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2023-03-21 14:02:44 +0100 |
---|---|---|
committer | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2023-03-22 17:35:18 +0100 |
commit | 17143ed02545efab55c175db66a9e31db4cce0f0 (patch) | |
tree | 953bb233a3b0fcd7b3bd3bec04ef196f6739ab82 /test/other_tools/git_operations/git_repo_remote.test.cpp | |
parent | 854745ad36f54559360a7dfc937c382cd0faf057 (diff) | |
download | justbuild-17143ed02545efab55c175db66a9e31db4cce0f0.tar.gz |
just-mr: Shell out to system Git for fetches over SSH...
...due to limited SSH support in libgit2. In order to allow the
fetches to still be parallel, we execute:
git fetch --no-auto-gc --no-write-fetch-head <repo> [<branch>]
This only fetches the packs without updating any refs, at the slight
cost of sometimes fetching some redundant information, which for our
purposes is practically a non-issue.
(If really needed, a 'git gc' call can be done eventually to try to
compact the fetched packs, although a save in disk space is not
actually guaranteed.)
Diffstat (limited to 'test/other_tools/git_operations/git_repo_remote.test.cpp')
-rw-r--r-- | test/other_tools/git_operations/git_repo_remote.test.cpp | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/test/other_tools/git_operations/git_repo_remote.test.cpp b/test/other_tools/git_operations/git_repo_remote.test.cpp index 6850355e..1cdf643d 100644 --- a/test/other_tools/git_operations/git_repo_remote.test.cpp +++ b/test/other_tools/git_operations/git_repo_remote.test.cpp @@ -244,11 +244,12 @@ TEST_CASE("Single-threaded fake repository operations", "[git_repo_remote]") { CHECK_FALSE( *repo_fetch_all->CheckCommitExists(kRootCommit, logger)); - // create path for tmp repo to use for fetch + // create tmp dir to use for fetch auto tmp_path_fetch_all = TestUtils::GetRepoPath(); - // fetch with base refspecs + REQUIRE(FileSystemManager::CreateDirectory(tmp_path_fetch_all)); + // fetch all with base refspecs REQUIRE(repo_fetch_all->FetchViaTmpRepo( - tmp_path_fetch_all, *repo_path, std::nullopt, logger)); + tmp_path_fetch_all, *repo_path, std::nullopt, {}, logger)); // check commit is there after fetch CHECK(*repo_fetch_all->CheckCommitExists(kRootCommit, logger)); @@ -265,11 +266,13 @@ TEST_CASE("Single-threaded fake repository operations", "[git_repo_remote]") { CHECK_FALSE( *repo_fetch_wRefspec->CheckCommitExists(kRootCommit, logger)); - // create path for tmp repo to use for fetch + // create tmp dir to use for fetch auto tmp_path_fetch_wRefspec = TestUtils::GetRepoPath(); + REQUIRE( + FileSystemManager::CreateDirectory(tmp_path_fetch_wRefspec)); // fetch all REQUIRE(repo_fetch_wRefspec->FetchViaTmpRepo( - tmp_path_fetch_wRefspec, *repo_path, "master", logger)); + tmp_path_fetch_wRefspec, *repo_path, "master", {}, logger)); // check commit is there after fetch CHECK(*repo_fetch_wRefspec->CheckCommitExists(kRootCommit, logger)); @@ -345,24 +348,30 @@ TEST_CASE("Multi-threaded fake repository operations", "[git_repo_remote]") { // something } break; case 1: { - // create path for tmp repo to use for fetch + // create tmp dir to use for fetch auto tmp_path_fetch_all = TestUtils::GetRepoPath(); + REQUIRE(FileSystemManager::CreateDirectory( + tmp_path_fetch_all)); // fetch with base refspecs CHECK( target_repo->FetchViaTmpRepo(tmp_path_fetch_all, *remote_repo_path, std::nullopt, + {}, logger)); } break; case 2: { - // create path for tmp repo to use for fetch + // create tmp dir to use for fetch auto tmp_path_fetch_wRefspec = TestUtils::GetRepoPath(); + REQUIRE(FileSystemManager::CreateDirectory( + tmp_path_fetch_wRefspec)); // fetch specific branch CHECK(target_repo->FetchViaTmpRepo( tmp_path_fetch_wRefspec, *remote_repo_path, "master", + {}, logger)); } break; case 3: { |