summaryrefslogtreecommitdiff
path: root/src/buildtool/file_system/git_utils.hpp
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_utils.hpp
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_utils.hpp')
-rw-r--r--src/buildtool/file_system/git_utils.hpp13
1 files changed, 13 insertions, 0 deletions
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 <optional>
+
#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<git_oid>;
+
+/// \brief Retrieve error message of last libgit2 call.
+[[nodiscard]] auto GitLastError() noexcept -> std::string;
+
void repo_closer(gsl::owner<git_repository*> repo);
void odb_closer(gsl::owner<git_odb*> odb);