From 65944566d8d3ae81d3dc3acb8c82944f5698ca5d Mon Sep 17 00:00:00 2001 From: Paul Cristian Sarbu Date: Wed, 15 Feb 2023 17:12:15 +0100 Subject: 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. --- src/buildtool/file_system/git_utils.hpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/buildtool/file_system/git_utils.hpp') diff --git a/src/buildtool/file_system/git_utils.hpp b/src/buildtool/file_system/git_utils.hpp index 74f21500..d301912a 100644 --- a/src/buildtool/file_system/git_utils.hpp +++ b/src/buildtool/file_system/git_utils.hpp @@ -15,9 +15,13 @@ #ifndef INCLUDED_SRC_BUILDTOOL_FILE_SYSTEM_GIT_UTILS_HPP #define INCLUDED_SRC_BUILDTOOL_FILE_SYSTEM_GIT_UTILS_HPP +#include + #include "gsl-lite/gsl-lite.hpp" +#include "src/buildtool/file_system/object_type.hpp" extern "C" { +struct git_oid; struct git_odb; struct git_repository; struct git_tree; @@ -31,6 +35,15 @@ struct git_commit; struct git_tree_entry; } +constexpr std::size_t kWaitTime{2}; // time in ms between tries for git locks + +[[nodiscard]] auto GitObjectID(std::string const& id, + bool is_hex_id = false) noexcept + -> std::optional; + +/// \brief Retrieve error message of last libgit2 call. +[[nodiscard]] auto GitLastError() noexcept -> std::string; + void repo_closer(gsl::owner repo); void odb_closer(gsl::owner odb); -- cgit v1.2.3