From 73460016c05a11e3421733dacde82c9dde99cd88 Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Wed, 25 Oct 2023 23:03:18 +0200 Subject: [PATCH] Compatibility with old libgit2 --- build.sh | 1 + src/tl/tl/tlGit.cc | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/build.sh b/build.sh index a2b7c9280..e6d0d096f 100755 --- a/build.sh +++ b/build.sh @@ -269,6 +269,7 @@ while [ "$*" != "" ]; do echo " -libcurl Use libcurl instead of QtNetwork (for Qt<4.7)" echo " -libexpat Use libexpat instead of QtXml" echo " -libpng Use libpng instead of Qt for PNG generation" + echo " -nolibgit2 Do not include libgit2 for Git package support" echo "" echo "Environment Variables:" echo "" diff --git a/src/tl/tl/tlGit.cc b/src/tl/tl/tlGit.cc index bb0182640..a93282621 100644 --- a/src/tl/tl/tlGit.cc +++ b/src/tl/tl/tlGit.cc @@ -182,7 +182,11 @@ GitObject::read (const std::string &org_url, const std::string &org_filter, cons git_repository *cloned_repo = NULL; int error = git_clone (&cloned_repo, url.c_str (), m_local_path.c_str (), &clone_opts); if (error != 0) { +#if LIBGIT2_VER_MAJOR > 0 || (LIBGIT2_VER_MAJOR == 0 && LIBGIT2_VER_MINOR >= 28) const git_error *err = git_error_last (); +#else + const git_error *err = giterr_last (); +#endif throw tl::Exception (tl::to_string (tr ("Error cloning Git repo: %s")), (const char *) err->message); }