[libgit2-glib] Compatibility with libgit2 0.28
- From: Alberto Fanjul <albfan src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgit2-glib] Compatibility with libgit2 0.28
- Date: Tue, 26 Feb 2019 10:30:57 +0000 (UTC)
commit 4e913cdfe09c8e10506111210e4328ac4f54bf08
Author: maxice8 <thinkabit ukim gmail com>
Date: Mon Feb 11 23:30:10 2019 -0200
Compatibility with libgit2 0.28
The git_buf_free API is deprecated; it has been renamed to
git_buf_dispose for consistency. The git_buf_free API will be
retained for backward compatibility for the foreseeable future.
The error functions and enumeration values have been renamed for
consistency. The giterr_ functions and values prefix have been
renamed to be prefixed with git_error_; similarly, the GITERR_
constants have been renamed to be prefixed with GIT_ERROR_.
The old enumerations and macros will be retained for backward
compatibility for the foreseeable future.
libgit2-glib/ggit-clone-options.c | 8 ++++++++
libgit2-glib/ggit-config.c | 8 ++++++++
libgit2-glib/ggit-diff.c | 8 ++++++++
libgit2-glib/ggit-error.c | 4 ++++
libgit2-glib/ggit-message.c | 4 ++++
libgit2-glib/ggit-patch.c | 4 ++++
libgit2-glib/ggit-remote-callbacks.c | 4 ++++
libgit2-glib/ggit-repository.c | 8 ++++++++
8 files changed, 48 insertions(+)
---
diff --git a/libgit2-glib/ggit-clone-options.c b/libgit2-glib/ggit-clone-options.c
index 1288a82..5e69eec 100644
--- a/libgit2-glib/ggit-clone-options.c
+++ b/libgit2-glib/ggit-clone-options.c
@@ -149,7 +149,11 @@ create_repository_wrapper (git_repository **out,
if (error != NULL)
{
+#if LIBGIT2_SOVERSION >= 28
+ git_error_set_str (GIT_ERROR, error->message);
+#else
giterr_set_str (GIT_ERROR, error->message);
+#endif
g_error_free (error);
if (repository != NULL)
@@ -187,7 +191,11 @@ create_remote_wrapper (git_remote **out,
if (error)
{
+#if LIBGIT2_SOVERSION >= 28
+ git_error_set_str (GIT_ERROR, error->message);
+#else
giterr_set_str (GIT_ERROR, error->message);
+#endif
g_error_free (error);
if (remote != NULL)
diff --git a/libgit2-glib/ggit-config.c b/libgit2-glib/ggit-config.c
index acdad95..626f7f0 100644
--- a/libgit2-glib/ggit-config.c
+++ b/libgit2-glib/ggit-config.c
@@ -191,7 +191,11 @@ ggit_config_find_global (void)
if (git_config_find_global (&buf) == GIT_OK)
{
path = g_file_new_for_path (buf.ptr);
+#if LIBGIT2_SOVERSION >= 28
+ git_buf_dispose (&buf);
+#else
git_buf_free (&buf);
+#endif
}
return path;
@@ -220,7 +224,11 @@ ggit_config_find_system (void)
if (git_config_find_system (&buf) == GIT_OK)
{
path = g_file_new_for_path (buf.ptr);
+#if LIBGIT2_SOVERSION >= 28
+ git_buf_dispose (&buf);
+#else
git_buf_free (&buf);
+#endif
}
return path;
diff --git a/libgit2-glib/ggit-diff.c b/libgit2-glib/ggit-diff.c
index db9361d..43fa6cf 100644
--- a/libgit2-glib/ggit-diff.c
+++ b/libgit2-glib/ggit-diff.c
@@ -786,13 +786,21 @@ ggit_diff_format_email (GgitDiff *diff,
if (ret != GIT_OK)
{
+#if LIBGIT2_SOVERSION >= 28
+ git_buf_dispose (&buf);
+#else
git_buf_free (&buf);
+#endif
_ggit_error_set (error, ret);
return NULL;
}
retval = g_strndup (buf.ptr, buf.size);
+#if LIBGIT2_SOVERSION >= 28
+ git_buf_dispose (&buf);
+#else
git_buf_free (&buf);
+#endif
return retval;
}
diff --git a/libgit2-glib/ggit-error.c b/libgit2-glib/ggit-error.c
index 06a21a7..9247064 100644
--- a/libgit2-glib/ggit-error.c
+++ b/libgit2-glib/ggit-error.c
@@ -51,7 +51,11 @@ _ggit_error_set (GError **error,
g_return_if_fail (err < 0);
/* TODO: add more kind of errors, see git_error_t */
+#if LIBGIT2_SOVERSION >= 28
+ git2_err = git_error_last ();
+#else
git2_err = giterr_last ();
+#endif
g_set_error_literal (error, GGIT_ERROR,
err,
git2_err == NULL ? "" : git2_err->message);
diff --git a/libgit2-glib/ggit-message.c b/libgit2-glib/ggit-message.c
index 0fa9e8c..7bd6983 100644
--- a/libgit2-glib/ggit-message.c
+++ b/libgit2-glib/ggit-message.c
@@ -46,7 +46,11 @@ ggit_message_prettify (const gchar *message,
git_message_prettify (&buf, message, strip_comments, comment_char);
d = g_strdup (buf.ptr);
+#if LIBGIT2_SOVERSION >= 28
+ git_buf_dispose (&buf);
+#else
git_buf_free (&buf);
+#endif
return d;
}
diff --git a/libgit2-glib/ggit-patch.c b/libgit2-glib/ggit-patch.c
index ee04e4d..cd35be7 100644
--- a/libgit2-glib/ggit-patch.c
+++ b/libgit2-glib/ggit-patch.c
@@ -194,7 +194,11 @@ ggit_patch_to_string (GgitPatch *patch,
if (ret == GIT_OK)
{
result = g_strdup (buf.ptr);
+#if LIBGIT2_SOVERSION >= 28
+ git_buf_dispose (&buf);
+#else
git_buf_free (&buf);
+#endif
}
return result;
diff --git a/libgit2-glib/ggit-remote-callbacks.c b/libgit2-glib/ggit-remote-callbacks.c
index a4bc130..7956f8b 100644
--- a/libgit2-glib/ggit-remote-callbacks.c
+++ b/libgit2-glib/ggit-remote-callbacks.c
@@ -160,7 +160,11 @@ credentials_wrap (git_cred **cred,
{
if (error)
{
+#if LIBGIT2_SOVERSION >= 28
+ git_error_set_str (GIT_ERROR, error->message);
+#else
giterr_set_str (GIT_ERROR, error->message);
+#endif
g_error_free (error);
return GIT_ERROR;
diff --git a/libgit2-glib/ggit-repository.c b/libgit2-glib/ggit-repository.c
index b9bd2b7..722ab18 100644
--- a/libgit2-glib/ggit-repository.c
+++ b/libgit2-glib/ggit-repository.c
@@ -1013,7 +1013,11 @@ ggit_repository_discover_full (GFile *location,
if (ret == GIT_OK)
{
rep = g_file_new_for_path (buf.ptr);
+#if LIBGIT2_SOVERSION >= 28
+ git_buf_dispose (&buf);
+#else
git_buf_free (&buf);
+#endif
}
else
{
@@ -3680,7 +3684,11 @@ ggit_repository_get_default_notes_ref (GgitRepository *repository,
}
ref = g_strdup (buf.ptr);
+#if LIBGIT2_SOVERSION >= 28
+ git_buf_dispose (&buf);
+#else
git_buf_free (&buf);
+#endif
return ref;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]