From 3e1ed92cc10ec7b6f09a46fc1d86bead3f9a1795 Mon Sep 17 00:00:00 2001 From: maxice8 Date: Tue, 12 Feb 2019 05:40:18 -0200 Subject: [PATCH] src/git.cc: Fix API compatibility with libgit2 0.28 --- src/git.cc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/git.cc b/src/git.cc index b6fe6c9..514bbbd 100644 --- a/src/git.cc +++ b/src/git.cc @@ -6,7 +6,11 @@ bool Git::initialized = false; std::mutex Git::mutex; std::string Git::Error::message() noexcept { +#if LIBGIT2_VER_MAJOR == 0 && LIBGIT2_VER_MINOR >= 28 + const git_error *last_error = git_error_last(); +#else const git_error *last_error = giterr_last(); +#endif if(last_error == nullptr) return std::string(); else @@ -244,7 +248,11 @@ boost::filesystem::path Git::Repository::get_root_path(const boost::filesystem:: throw std::runtime_error(error.message()); } auto root_path = Git::path(root.ptr, root.size); +#if LIBGIT2_VER_MAJOR == 0 && LIBGIT2_VER_MINOR >= 28 + git_buf_dispose(&root); +#else git_buf_free(&root); +#endif return root_path; }