diff options
author | Maksim Denisov <denisov.maksim@huawei.com> | 2024-12-18 12:46:40 +0100 |
---|---|---|
committer | Maksim Denisov <denisov.maksim@huawei.com> | 2024-12-19 16:37:59 +0100 |
commit | 0000839adc5805997d5afdda924fb6f5e45e0a90 (patch) | |
tree | be07bb22134a50f599d8202a84d31779ee03d537 /src | |
parent | b3c863abc09f9f81150e21af2cc89d75bee98db2 (diff) | |
download | justbuild-0000839adc5805997d5afdda924fb6f5e45e0a90.tar.gz |
FileRoot: disclose RootGit data.
Diffstat (limited to 'src')
-rw-r--r-- | src/buildtool/file_system/file_root.hpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/buildtool/file_system/file_root.hpp b/src/buildtool/file_system/file_root.hpp index cabd2aae..68ca7533 100644 --- a/src/buildtool/file_system/file_root.hpp +++ b/src/buildtool/file_system/file_root.hpp @@ -393,6 +393,25 @@ class FileRoot { return std::nullopt; } + [[nodiscard]] auto GetTreeHash() const noexcept + -> std::optional<std::string> { + if (auto const* root_git = std::get_if<RootGit>(&root_)) { + return root_git->tree->FileRootHash(); + } + if (auto const* absent_root = std::get_if<absent_root_t>(&root_)) { + return *absent_root; + } + return std::nullopt; + } + + [[nodiscard]] auto GetGitCasRoot() const noexcept + -> std::optional<std::filesystem::path> { + if (auto const* git_root = std::get_if<RootGit>(&root_)) { + return git_root->cas->GetPath(); + } + return std::nullopt; + } + // Indicates that subsequent calls to `Exists()`, `IsFile()`, // `IsDirectory()`, and `BlobType()` on contents of the same directory will // be served without any additional file system lookups. |