From d95a3c2e6db53b02c21f5bfe22ae30ee325c8d31 Mon Sep 17 00:00:00 2001 From: codereader Date: Mon, 3 Oct 2022 19:27:04 +0200 Subject: [PATCH] Another compilation fix for older libgit2 versions --- plugins/vcs/Repository.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/plugins/vcs/Repository.cpp b/plugins/vcs/Repository.cpp index 91e3b9c18a..26f3b25544 100644 --- a/plugins/vcs/Repository.cpp +++ b/plugins/vcs/Repository.cpp @@ -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 { @@ -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; }