diff options
author | Maksim Denisov <denisov.maksim@huawei.com> | 2024-12-04 13:12:15 +0100 |
---|---|---|
committer | Maksim Denisov <denisov.maksim@huawei.com> | 2024-12-05 11:07:10 +0100 |
commit | 99860b78304817c4d5b27ec4c661b733e30a430a (patch) | |
tree | dc4ae56e2046e43ee9ea11590e9ba5c8d42300a0 /src/buildtool/file_system/git_cas.hpp | |
parent | f40780393d68e2ebb866d8b941b5a30f0ea5f0de (diff) | |
download | justbuild-99860b78304817c4d5b27ec4c661b733e30a430a.tar.gz |
GitCAS: implement method for creation of an empty GitCAS
...and use it in GitRepo to set custom backends.
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 8751b1e6..10a43111 100644 --- a/src/buildtool/file_system/git_cas.hpp +++ b/src/buildtool/file_system/git_cas.hpp @@ -23,6 +23,7 @@ #include <string> #include <utility> +#include "gsl/gsl" #include "src/buildtool/file_system/git_utils.hpp" #include "src/buildtool/file_system/object_type.hpp" @@ -35,6 +36,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; @@ -44,6 +47,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. |