From 98f1e8224753e7d7bfaf697012302887d85bff6c Mon Sep 17 00:00:00 2001 From: Maksim Denisov Date: Wed, 4 Dec 2024 13:12:15 +0100 Subject: GitCAS: implement method for creation of an empty GitCAS ...and use it in GitRepo to set custom backends. (cherry-picked 99860b78304817c4d5b27ec4c661b733e30a430a) --- src/buildtool/file_system/git_cas.hpp | 7 +++++++ 1 file changed, 7 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 78cb6d0c..f358e65b 100644 --- a/src/buildtool/file_system/git_cas.hpp +++ b/src/buildtool/file_system/git_cas.hpp @@ -24,6 +24,7 @@ #include #include +#include "gsl/gsl" #include "src/buildtool/file_system/git_context.hpp" #include "src/buildtool/file_system/git_utils.hpp" @@ -36,6 +37,8 @@ class GitCAS { [[nodiscard]] static auto Open( std::filesystem::path const& repo_path) noexcept -> GitCASPtr; + [[nodiscard]] static auto CreateEmpty() noexcept -> GitCASPtr; + GitCAS() noexcept; ~GitCAS() noexcept = default; @@ -45,6 +48,10 @@ class GitCAS { auto operator=(GitCAS const&) = delete; auto operator=(GitCAS&& other) = delete; + [[nodiscard]] auto GetODB() const noexcept -> gsl::not_null { + return odb_.get(); + } + /// \brief Read object from CAS. /// \param id The object id. /// \param is_hex_id Specify whether `id` is hex string or raw. -- cgit v1.2.3