diff options
author | Maksim Denisov <denisov.maksim@huawei.com> | 2024-12-04 13:12:15 +0100 |
---|---|---|
committer | Klaus Aehlig <klaus.aehlig@huawei.com> | 2025-01-13 16:21:08 +0100 |
commit | 98f1e8224753e7d7bfaf697012302887d85bff6c (patch) | |
tree | 5430fa4e9f8d971d8e8043e62e3aa57aef231217 /src/buildtool/file_system/git_cas.hpp | |
parent | 0c50b8a6a181795697be882bd62c0d37efab078c (diff) | |
download | justbuild-98f1e8224753e7d7bfaf697012302887d85bff6c.tar.gz |
GitCAS: implement method for creation of an empty GitCAS
...and use it in GitRepo to set custom backends.
(cherry-picked 99860b78304817c4d5b27ec4c661b733e30a430a)
Diffstat (limited to 'src/buildtool/file_system/git_cas.hpp')
-rw-r--r-- | src/buildtool/file_system/git_cas.hpp | 7 |
1 files changed, 7 insertions, 0 deletions
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 <utility> #include <vector> +#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<git_odb*> { + 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. |