diff options
author | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2022-08-29 19:01:36 +0200 |
---|---|---|
committer | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2022-12-21 14:44:08 +0100 |
commit | 2c994adbd2d5778bb881bd792a57294f86e143b1 (patch) | |
tree | 653250cbd6c5c38667ac69de406be4735ba4f541 /src/buildtool/file_system/git_cas.hpp | |
parent | ecff253633ada6ca88db8ab207c593ebde033044 (diff) | |
download | justbuild-2c994adbd2d5778bb881bd792a57294f86e143b1.tar.gz |
Git: Wrap libgit2 raw pointers
Diffstat (limited to 'src/buildtool/file_system/git_cas.hpp')
-rw-r--r-- | src/buildtool/file_system/git_cas.hpp | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/src/buildtool/file_system/git_cas.hpp b/src/buildtool/file_system/git_cas.hpp index 0d637c5e..58e07616 100644 --- a/src/buildtool/file_system/git_cas.hpp +++ b/src/buildtool/file_system/git_cas.hpp @@ -22,12 +22,9 @@ #include <vector> #include "src/buildtool/file_system/git_context.hpp" +#include "src/buildtool/file_system/git_utils.hpp" #include "src/buildtool/file_system/object_type.hpp" -extern "C" { -using git_odb = struct git_odb; -} - class GitCAS; using GitCASPtr = std::shared_ptr<GitCAS const>; @@ -38,7 +35,7 @@ class GitCAS { -> GitCASPtr; GitCAS() noexcept = default; - ~GitCAS() noexcept; + ~GitCAS() noexcept = default; // prohibit moves and copies GitCAS(GitCAS const&) = delete; @@ -67,7 +64,7 @@ class GitCAS { private: // IMPORTANT: the GitContext needs to be initialized before any git object! GitContext git_context_{}; // maintains a Git context while CAS is alive - git_odb* odb_{nullptr}; + std::unique_ptr<git_odb, decltype(&odb_closer)> odb_{nullptr, odb_closer}; // git folder path of repo; used for logging std::filesystem::path git_path_{}; |