summaryrefslogtreecommitdiff
path: root/src/buildtool/file_system/git_tree.hpp
diff options
context:
space:
mode:
authorKlaus Aehlig <klaus.aehlig@huawei.com>2022-06-13 13:30:13 +0200
committerOliver Reiche <oliver.reiche@huawei.com>2022-06-13 13:30:13 +0200
commit454cfcf66efc6ff5f42253431c6033e1e21044cf (patch)
treedd19c080220547807b3c3c916ca1a12cc6eabcd6 /src/buildtool/file_system/git_tree.hpp
parentf5c12e59e34107f1fc16349d843a8f64d7dd5459 (diff)
downloadjustbuild-454cfcf66efc6ff5f42253431c6033e1e21044cf.tar.gz
Include raw identifier to GitTree
In this way, we have it available when needed, e.g., to get identifers for file roots or to get whole trees as source artifacts.
Diffstat (limited to 'src/buildtool/file_system/git_tree.hpp')
-rw-r--r--src/buildtool/file_system/git_tree.hpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/buildtool/file_system/git_tree.hpp b/src/buildtool/file_system/git_tree.hpp
index 57cb3b52..8371d785 100644
--- a/src/buildtool/file_system/git_tree.hpp
+++ b/src/buildtool/file_system/git_tree.hpp
@@ -45,13 +45,20 @@ class GitTree {
[[nodiscard]] auto begin() const noexcept { return entries_.begin(); }
[[nodiscard]] auto end() const noexcept { return entries_.end(); }
+ [[nodiscard]] auto Hash() const noexcept { return ToHexString(raw_id_); }
+ [[nodiscard]] auto RawHash() const noexcept { return raw_id_; }
private:
gsl::not_null<GitCASPtr> cas_;
entries_t entries_;
+ std::string raw_id_;
- GitTree(gsl::not_null<GitCASPtr> cas, entries_t&& entries) noexcept
- : cas_{std::move(cas)}, entries_{std::move(entries)} {}
+ GitTree(gsl::not_null<GitCASPtr> cas,
+ entries_t&& entries,
+ std::string raw_id) noexcept
+ : cas_{std::move(cas)},
+ entries_{std::move(entries)},
+ raw_id_{std::move(raw_id)} {}
};
class GitTreeEntry {