diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/buildtool/file_system/git_tree.cpp | 8 | ||||
-rw-r--r-- | src/buildtool/file_system/git_tree.hpp | 2 |
2 files changed, 10 insertions, 0 deletions
diff --git a/src/buildtool/file_system/git_tree.cpp b/src/buildtool/file_system/git_tree.cpp index 30c98261..d7a33f39 100644 --- a/src/buildtool/file_system/git_tree.cpp +++ b/src/buildtool/file_system/git_tree.cpp @@ -85,6 +85,10 @@ auto GitTree::Size() const noexcept -> std::optional<std::size_t> { return std::nullopt; } +auto GitTree::RawData() const noexcept -> std::optional<std::string> { + return cas_->ReadObject(raw_id_); +} + auto GitTreeEntry::Blob() const noexcept -> std::optional<std::string> { if (not IsBlob()) { return std::nullopt; @@ -109,3 +113,7 @@ auto GitTreeEntry::Size() const noexcept -> std::optional<std::size_t> { } return std::nullopt; } + +auto GitTreeEntry::RawData() const noexcept -> std::optional<std::string> { + return cas_->ReadObject(raw_id_); +} diff --git a/src/buildtool/file_system/git_tree.hpp b/src/buildtool/file_system/git_tree.hpp index 25218634..fa4f83d6 100644 --- a/src/buildtool/file_system/git_tree.hpp +++ b/src/buildtool/file_system/git_tree.hpp @@ -48,6 +48,7 @@ class GitTree { [[nodiscard]] auto Hash() const noexcept { return ToHexString(raw_id_); } [[nodiscard]] auto RawHash() const noexcept { return raw_id_; } [[nodiscard]] auto Size() const noexcept -> std::optional<std::size_t>; + [[nodiscard]] auto RawData() const noexcept -> std::optional<std::string>; private: gsl::not_null<GitCASPtr> cas_; @@ -101,6 +102,7 @@ class GitTreeEntry { // Use with care. Implementation might read entire object to obtain // size. Consider using Blob()->size() instead. [[nodiscard]] auto Size() const noexcept -> std::optional<std::size_t>; + [[nodiscard]] auto RawData() const noexcept -> std::optional<std::string>; private: gsl::not_null<GitCASPtr> cas_; |