summaryrefslogtreecommitdiff
path: root/src/buildtool/file_system/git_cas.cpp
diff options
context:
space:
mode:
authorPaul Cristian Sarbu <paul.cristian.sarbu@huawei.com>2023-02-15 17:12:15 +0100
committerPaul Cristian Sarbu <paul.cristian.sarbu@huawei.com>2023-02-17 16:27:50 +0100
commit65944566d8d3ae81d3dc3acb8c82944f5698ca5d (patch)
tree9700c15732d21dc03fd2f33c600e2ead80694c2c /src/buildtool/file_system/git_cas.cpp
parentebe7695ee5803dd3c2bb4f22f5e12d776c985d56 (diff)
downloadjustbuild-65944566d8d3ae81d3dc3acb8c82944f5698ca5d.tar.gz
structure cleanup: move remote operations of GitRepo to other_tools...
...in order to not include unwanted dependencies in just proper. The new class extends the GitRepo class used for just's Git tree operations and gets used in all of just-mr's async maps.
Diffstat (limited to 'src/buildtool/file_system/git_cas.cpp')
-rw-r--r--src/buildtool/file_system/git_cas.cpp38
1 files changed, 0 insertions, 38 deletions
diff --git a/src/buildtool/file_system/git_cas.cpp b/src/buildtool/file_system/git_cas.cpp
index efb464ef..2a4a7142 100644
--- a/src/buildtool/file_system/git_cas.cpp
+++ b/src/buildtool/file_system/git_cas.cpp
@@ -30,44 +30,6 @@ extern "C" {
namespace {
-constexpr std::size_t kOIDRawSize{GIT_OID_RAWSZ};
-constexpr std::size_t kOIDHexSize{GIT_OID_HEXSZ};
-
-[[nodiscard]] auto GitLastError() noexcept -> std::string {
- git_error const* err{nullptr};
- if ((err = git_error_last()) != nullptr and err->message != nullptr) {
- return fmt::format("error code {}: {}", err->klass, err->message);
- }
- return "<unknown error>";
-}
-
-[[nodiscard]] auto GitObjectID(std::string const& id,
- bool is_hex_id = false) noexcept
- -> std::optional<git_oid> {
- if (id.size() < (is_hex_id ? kOIDHexSize : kOIDRawSize)) {
- Logger::Log(LogLevel::Error,
- "invalid git object id {}",
- is_hex_id ? id : ToHexString(id));
- return std::nullopt;
- }
- git_oid oid{};
- if (is_hex_id and git_oid_fromstr(&oid, id.c_str()) == 0) {
- return oid;
- }
- if (not is_hex_id and
- git_oid_fromraw(
- &oid,
- reinterpret_cast<unsigned char const*>(id.data()) // NOLINT
- ) == 0) {
- return oid;
- }
- Logger::Log(LogLevel::Error,
- "parsing git object id {} failed with:\n{}",
- is_hex_id ? id : ToHexString(id),
- GitLastError());
- return std::nullopt;
-}
-
[[nodiscard]] auto GitTypeToObjectType(git_object_t const& type) noexcept
-> std::optional<ObjectType> {
switch (type) {