Browse Source

src/git.cc: Fix API compatibility with libgit2 0.28

merge-requests/394/head
maxice8 7 years ago
parent
commit
3e1ed92cc1
No known key found for this signature in database
GPG Key ID: 543B9D4F4299F06B
  1. 8
      src/git.cc

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

Loading…
Cancel
Save