diff options
author | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2023-02-27 16:17:11 +0100 |
---|---|---|
committer | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2023-03-08 12:22:14 +0100 |
commit | 27576086dcbb7abdb68d129cc101ff81587a5901 (patch) | |
tree | a9e845a2e630faee9bb4812004391d48ed3228bb /src/buildtool/file_system/git_repo.hpp | |
parent | 3c2185bf17b1c1a631366aa11591da3e3beb51eb (diff) | |
download | justbuild-27576086dcbb7abdb68d129cc101ff81587a5901.tar.gz |
GitRepo: Add method to check existence of a Git tree
Diffstat (limited to 'src/buildtool/file_system/git_repo.hpp')
-rw-r--r-- | src/buildtool/file_system/git_repo.hpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/buildtool/file_system/git_repo.hpp b/src/buildtool/file_system/git_repo.hpp index a5a8da7a..eba826d9 100644 --- a/src/buildtool/file_system/git_repo.hpp +++ b/src/buildtool/file_system/git_repo.hpp @@ -186,6 +186,15 @@ class GitRepo { anon_logger_ptr const& logger) noexcept -> std::optional<std::filesystem::path>; + /// \brief Check if given tree ID is present in the directory structure of + /// the local repository. + /// Calling it from a fake repository allows thread-safe use. + /// Returns a status of tree presence, or nullopt if failure. + /// It guarantees the logger is called exactly once with fatal if failure. + [[nodiscard]] auto CheckTreeExists(std::string const& tree_id, + anon_logger_ptr const& logger) noexcept + -> std::optional<bool>; + private: // IMPORTANT! The GitCAS object must be defined before the repo object to // keep the GitContext alive until cleanup ends. |