From a3064e549eb666c162c5bd333a17598355620d63 Mon Sep 17 00:00:00 2001 From: Oliver Reiche Date: Mon, 11 Jul 2022 10:54:57 +0200 Subject: GitCAS: Add create tree via libgit2's treebuilder --- src/buildtool/file_system/git_cas.hpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/buildtool/file_system/git_cas.hpp') diff --git a/src/buildtool/file_system/git_cas.hpp b/src/buildtool/file_system/git_cas.hpp index 051e40f1..df077daf 100644 --- a/src/buildtool/file_system/git_cas.hpp +++ b/src/buildtool/file_system/git_cas.hpp @@ -77,6 +77,16 @@ class GitCAS { bool is_hex_id = false) const noexcept -> std::optional; + /// \brief Create a flat tree from entries and store tree in CAS. + /// Creating a tree must be backed by an object database. Therefore, a valid + /// instance of this class is required. Furthermore, all entries must be + /// available in the underlying object database and object types must + /// correctly reflect the type of the object found in the database. + /// \param entries The entries to create the tree from. + /// \returns The raw object id as string, if successful. + [[nodiscard]] auto CreateTree(GitCAS::tree_entries_t const& entries) + const noexcept -> std::optional; + private: git_odb* odb_{nullptr}; bool initialized_{false}; -- cgit v1.2.3