summaryrefslogtreecommitdiff
path: root/src/buildtool/file_system/git_tree.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/buildtool/file_system/git_tree.cpp')
-rw-r--r--src/buildtool/file_system/git_tree.cpp7
1 files changed, 7 insertions, 0 deletions
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<std::size_t> {
+ if (auto header = cas_->ReadHeader(raw_id_)) {
+ return header->first;
+ }
+ return std::nullopt;
+}
+
auto GitTreeEntry::Blob() const noexcept -> std::optional<std::string> {
if (not IsBlob()) {
return std::nullopt;