Skip to content

Commit

Permalink
Another compilation fix for older libgit2 versions
Browse files Browse the repository at this point in the history
  • Loading branch information
codereader committed Oct 3, 2022
1 parent 788a975 commit d95a3c2
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions plugins/vcs/Repository.cpp
Expand Up @@ -13,6 +13,11 @@
#include "os/file.h"
#include "fmt/format.h"

#if LIBGIT2_VER_MAJOR <= 0 && LIBGIT2_VER_MINOR < 28
// Compatibility to older libgit2
#define GIT_OBJECT_COMMIT GIT_OBJ_COMMIT
#endif

namespace vcs
{

Expand Down Expand Up @@ -104,7 +109,11 @@ std::string Repository::getUpstreamRemoteName(const Reference& reference)
GitException::ThrowOnError(error);

std::string upstreamRemote = buf.ptr;
#if LIBGIT2_VER_MAJOR <= 0 && LIBGIT2_VER_MINOR < 28
git_buf_free(&buf); // git_buf_dispose was introduced in 0.28
#else
git_buf_dispose(&buf);
#endif

return upstreamRemote;
}
Expand Down

0 comments on commit d95a3c2

Please sign in to comment.