Compatibility with old libgit2

This commit is contained in:
Matthias Koefferlein 2023-10-25 23:03:18 +02:00
parent 17fd5e9238
commit 73460016c0
2 changed files with 5 additions and 0 deletions

View File

@ -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 ""

View File

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