summaryrefslogtreecommitdiff
path: root/src/other_tools/root_maps/root_utils.cpp
diff options
context:
space:
mode:
authorMaksim Denisov <denisov.maksim@huawei.com>2024-09-11 14:26:02 +0200
committerMaksim Denisov <denisov.maksim@huawei.com>2024-09-11 14:52:07 +0200
commitfaed6b210a213ecb0c52a397c99c62d39df07bb2 (patch)
tree5fa7cd230745a5b68d51e4ed5b31e4cc4a43e17e /src/other_tools/root_maps/root_utils.cpp
parent6d0d9197e3b25f528ff966081b6752a91c429e1a (diff)
downloadjustbuild-faed6b210a213ecb0c52a397c99c62d39df07bb2.tar.gz
Use ArtifactDigestFactory in just-mr maps
...to create ArtifactDigests.
Diffstat (limited to 'src/other_tools/root_maps/root_utils.cpp')
-rw-r--r--src/other_tools/root_maps/root_utils.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/other_tools/root_maps/root_utils.cpp b/src/other_tools/root_maps/root_utils.cpp
index 6e77cae8..4173a00d 100644
--- a/src/other_tools/root_maps/root_utils.cpp
+++ b/src/other_tools/root_maps/root_utils.cpp
@@ -17,7 +17,9 @@
#include "fmt/core.h"
#include "src/buildtool/common/artifact.hpp"
#include "src/buildtool/common/artifact_digest.hpp"
+#include "src/buildtool/common/artifact_digest_factory.hpp"
#include "src/buildtool/common/repository_config.hpp"
+#include "src/buildtool/crypto/hash_function.hpp"
#include "src/buildtool/execution_api/git/git_api.hpp"
#include "src/buildtool/file_system/object_type.hpp"
@@ -50,12 +52,14 @@ auto EnsureAbsentRootOnServe(ServeApi const& serve,
/*fatal=*/true);
return false;
}
+ auto const digest = ArtifactDigestFactory::Create(
+ HashFunction::Type::GitSHA1, tree_id, 0, /*is_tree=*/true);
+
auto git_api = GitApi{&repo};
- if (not git_api.RetrieveToCas(
- {Artifact::ObjectInfo{
- .digest = ArtifactDigest{tree_id, 0, /*is_tree=*/true},
- .type = ObjectType::Tree}},
- *remote_api)) {
+ if (not digest or not git_api.RetrieveToCas(
+ {Artifact::ObjectInfo{.digest = *digest,
+ .type = ObjectType::Tree}},
+ *remote_api)) {
(*logger)(fmt::format("Failed to sync tree {} from repository {}",
tree_id,
repo_path.string()),