diff options
author | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2024-02-20 12:22:10 +0100 |
---|---|---|
committer | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2024-02-27 14:35:44 +0100 |
commit | 123d56036e8fffe2c5d9e5e24504d6230883e582 (patch) | |
tree | ac34ed928c25f86ead75b0d19ed138a3fd1600ec | |
parent | f78b3ce6b90ccb9b86b01b3cd6644b853960b7c3 (diff) | |
download | justbuild-123d56036e8fffe2c5d9e5e24504d6230883e582.tar.gz |
just-mr: Fix correct CAS storage location is used
just-mr should always operate with the CAS location corresponding
to the native protocol, i.e., using Git hashes. This way all the
checks and transactions between local CAS and the Git cache are
correct.
The commit fixes the issue by ensuring we don't set globally the
compatibility mode or hashing function if being passed the
--compatible flag, as this flag should only be used to check
comaptibility with any given remote endpoint and not affect the
local CAS location used by just-mr.
-rw-r--r-- | src/other_tools/just_mr/main.cpp | 11 | ||||
-rw-r--r-- | src/other_tools/ops_maps/git_tree_fetch_map.cpp | 10 |
2 files changed, 6 insertions, 15 deletions
diff --git a/src/other_tools/just_mr/main.cpp b/src/other_tools/just_mr/main.cpp index 2d1c7328..5dc6cc0f 100644 --- a/src/other_tools/just_mr/main.cpp +++ b/src/other_tools/just_mr/main.cpp @@ -303,11 +303,6 @@ auto main(int argc, char* argv[]) -> int { return kExitGenericFailure; } - // set remote execution protocol compatibility - if (arguments.common.compatible == true) { - Compatibility::SetCompatible(); - } - /** * The current implementation of libgit2 uses pthread_key_t incorrectly * on POSIX systems to handle thread-specific data, which requires us to @@ -320,7 +315,7 @@ auto main(int argc, char* argv[]) -> int { if (arguments.cmd == SubCommand::kJustDo or arguments.cmd == SubCommand::kJustSubCmd) { // check setup configuration arguments for validity - if (Compatibility::IsCompatible() and + if (arguments.common.compatible == true and arguments.common.fetch_absent) { Logger::Log(LogLevel::Error, "Fetching absent repositories only available in " @@ -350,7 +345,7 @@ auto main(int argc, char* argv[]) -> int { if (arguments.cmd == SubCommand::kSetup or arguments.cmd == SubCommand::kSetupEnv) { // check setup configuration arguments for validity - if (Compatibility::IsCompatible() and + if (arguments.common.compatible == true and arguments.common.fetch_absent) { Logger::Log(LogLevel::Error, "Fetching absent repositories only available in " @@ -385,7 +380,7 @@ auto main(int argc, char* argv[]) -> int { // Run subcommand `fetch` if (arguments.cmd == SubCommand::kFetch) { // check fetch configuration arguments for validity - if (Compatibility::IsCompatible()) { + if (arguments.common.compatible == true) { if (arguments.common.remote_execution_address and arguments.fetch.backup_to_remote) { Logger::Log( diff --git a/src/other_tools/ops_maps/git_tree_fetch_map.cpp b/src/other_tools/ops_maps/git_tree_fetch_map.cpp index ac76155b..6298acca 100644 --- a/src/other_tools/ops_maps/git_tree_fetch_map.cpp +++ b/src/other_tools/ops_maps/git_tree_fetch_map.cpp @@ -106,8 +106,7 @@ void MoveCASTreeToGit( return; } // backup to remote if needed and in compatibility mode - if (backup_to_remote and remote_api != std::nullopt and - not Compatibility::IsCompatible()) { + if (backup_to_remote and remote_api) { BackupToRemote(tree_id, *remote_api, logger); } (*setter)(false /*no cache hit*/); @@ -205,8 +204,7 @@ auto CreateGitTreeFetchMap( } if (*tree_found) { // backup to remote if needed and in native mode - if (backup_to_remote and remote_api != std::nullopt and - not Compatibility::IsCompatible()) { + if (backup_to_remote and remote_api) { BackupToRemote(key.hash, *remote_api, logger); } // success @@ -471,9 +469,7 @@ auto CreateGitTreeFetchMap( JustMRProgress::Instance().TaskTracker().Stop( key.origin); // backup to remote if needed and in native mode - if (backup_to_remote and - remote_api != std::nullopt and - not Compatibility::IsCompatible()) { + if (backup_to_remote and remote_api) { BackupToRemote( key.hash, *remote_api, logger); } |