diff options
author | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2024-01-03 11:56:30 +0100 |
---|---|---|
committer | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2024-01-08 17:07:03 +0100 |
commit | 36566b7bc7d7ee12ddb876609eedc74d14d7811f (patch) | |
tree | 208f49525e21197ea6e8b18804a6a9ba83e70a2d /src/buildtool/file_system/git_repo.hpp | |
parent | 4606302a46f8448fb7db0a1f73fcaa61eeffc8e6 (diff) | |
download | justbuild-36566b7bc7d7ee12ddb876609eedc74d14d7811f.tar.gz |
GitRepo: Add blob lookup method
Diffstat (limited to 'src/buildtool/file_system/git_repo.hpp')
-rw-r--r-- | src/buildtool/file_system/git_repo.hpp | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/src/buildtool/file_system/git_repo.hpp b/src/buildtool/file_system/git_repo.hpp index 9c31f21b..05bcfaf3 100644 --- a/src/buildtool/file_system/git_repo.hpp +++ b/src/buildtool/file_system/git_repo.hpp @@ -234,12 +234,21 @@ class GitRepo { -> std::optional<bool>; /// \brief Check if given blob ID is present in the directory structure of - /// the local repository and try to return it. + /// the local repository. /// Calling it from a fake repository allows thread-safe use. - /// Returns a pair of a success flag, stating that no errors occurred while - /// performing the libgit2 calls, and an optional string containing the - /// content of the blob, if the blob is found. It guarantees the logger is - /// called exactly once with fatal if failure. + /// Returns a status of blob presence, or nullopt if failure. + /// It guarantees the logger is called exactly once with fatal if failure. + [[nodiscard]] auto CheckBlobExists(std::string const& blob_id, + anon_logger_ptr const& logger) noexcept + -> std::optional<bool>; + + /// \brief Check if given blob ID is present in the directory structure + /// of the local repository and try to return it. Calling it from a fake + /// repository allows thread-safe use. Returns a pair of a success flag, + /// stating that no errors occurred while performing the libgit2 calls, + /// and an optional string containing the content of the blob, if the + /// blob is found. It guarantees the logger is called exactly once with + /// fatal if failure. [[nodiscard]] auto TryReadBlob(std::string const& blob_id, anon_logger_ptr const& logger) noexcept -> std::pair<bool, std::optional<std::string>>; |