summaryrefslogtreecommitdiff
path: root/src/buildtool/file_system/git_repo.hpp
diff options
context:
space:
mode:
authorMaksim Denisov <denisov.maksim@huawei.com>2025-01-13 15:06:24 +0100
committerMaksim Denisov <denisov.maksim@huawei.com>2025-01-15 16:43:56 +0100
commitc7a103104b03f8a014755ee01f691f0c728ec0bb (patch)
tree74c335c07c71d64f7068bb49307cb316ba4f75b0 /src/buildtool/file_system/git_repo.hpp
parent5ee5f8f37bd9a1881db9801c428d0d108da93239 (diff)
downloadjustbuild-c7a103104b03f8a014755ee01f691f0c728ec0bb.tar.gz
Add to GitRepo common implementation IsTreeInRepo
Diffstat (limited to 'src/buildtool/file_system/git_repo.hpp')
-rw-r--r--src/buildtool/file_system/git_repo.hpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/buildtool/file_system/git_repo.hpp b/src/buildtool/file_system/git_repo.hpp
index 1e403fbe..f8591d75 100644
--- a/src/buildtool/file_system/git_repo.hpp
+++ b/src/buildtool/file_system/git_repo.hpp
@@ -330,6 +330,13 @@ class GitRepo {
gsl::not_null<std::mutex*> const& tagging_lock) noexcept
-> expected<std::string, std::string>;
+ /// \brief Check that the given repository contains the given tree
+ /// \returns Flag reflecting whether the tree is present in the repository
+ /// or an error message on failure.
+ [[nodiscard]] static auto IsTreeInRepo(std::filesystem::path const& repo,
+ std::string const& tree_id) noexcept
+ -> expected<bool, std::string>;
+
private:
GitCASPtr git_cas_;
// default to real repo, as that is non-thread-safe