From 4ce6ec5563c0aa277b455c9c1ded7e8556402c68 Mon Sep 17 00:00:00 2001 From: Sascha Roloff Date: Tue, 5 Jul 2022 19:46:33 +0200 Subject: Git tree can return size --- src/buildtool/file_system/git_tree.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/buildtool/file_system/git_tree.cpp') diff --git a/src/buildtool/file_system/git_tree.cpp b/src/buildtool/file_system/git_tree.cpp index 8d220e30..30c98261 100644 --- a/src/buildtool/file_system/git_tree.cpp +++ b/src/buildtool/file_system/git_tree.cpp @@ -78,6 +78,13 @@ auto GitTree::LookupEntryByPath( return LookupEntryPyPath(*this, resolved.begin(), resolved.end()); } +auto GitTree::Size() const noexcept -> std::optional { + if (auto header = cas_->ReadHeader(raw_id_)) { + return header->first; + } + return std::nullopt; +} + auto GitTreeEntry::Blob() const noexcept -> std::optional { if (not IsBlob()) { return std::nullopt; -- cgit v1.2.3