From 2c994adbd2d5778bb881bd792a57294f86e143b1 Mon Sep 17 00:00:00 2001 From: Paul Cristian Sarbu Date: Mon, 29 Aug 2022 19:01:36 +0200 Subject: Git: Wrap libgit2 raw pointers --- src/buildtool/file_system/git_cas.hpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (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 0d637c5e..58e07616 100644 --- a/src/buildtool/file_system/git_cas.hpp +++ b/src/buildtool/file_system/git_cas.hpp @@ -22,12 +22,9 @@ #include #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; @@ -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 odb_{nullptr, odb_closer}; // git folder path of repo; used for logging std::filesystem::path git_path_{}; -- cgit v1.2.3