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; }