[libgit2-glib] Detect libgit2 version



commit c4eb90d627c8b041b29242b84b93ee4990ec7073
Author: Alberto Fanjul <albertofanjul gmail com>
Date:   Fri Feb 21 13:32:52 2020 +0100

    Detect libgit2 version
    
    libgit to change SOVERSION from int to string. Relay on MAJOR MINOR VERSION

 libgit2-glib/ggit-clone-options.c    | 4 ++--
 libgit2-glib/ggit-config.c           | 6 +++---
 libgit2-glib/ggit-diff.c             | 6 +++---
 libgit2-glib/ggit-error.c            | 2 +-
 libgit2-glib/ggit-message.c          | 2 +-
 libgit2-glib/ggit-patch.c            | 2 +-
 libgit2-glib/ggit-remote-callbacks.c | 2 +-
 libgit2-glib/ggit-repository.c       | 4 ++--
 8 files changed, 14 insertions(+), 14 deletions(-)
---
diff --git a/libgit2-glib/ggit-clone-options.c b/libgit2-glib/ggit-clone-options.c
index 5e69eec..19b4824 100644
--- a/libgit2-glib/ggit-clone-options.c
+++ b/libgit2-glib/ggit-clone-options.c
@@ -149,7 +149,7 @@ create_repository_wrapper (git_repository **out,
 
        if (error != NULL)
        {
-#if LIBGIT2_SOVERSION >= 28
+#if LIBGIT2_VER_MAJOR > 0 || (LIBGIT2_VER_MAJOR == 0 && LIBGIT_VER_MINOR >= 28)
                git_error_set_str (GIT_ERROR, error->message);
 #else
                giterr_set_str (GIT_ERROR, error->message);
@@ -191,7 +191,7 @@ create_remote_wrapper (git_remote     **out,
 
        if (error)
        {
-#if LIBGIT2_SOVERSION >= 28
+#if LIBGIT2_VER_MAJOR > 0 || (LIBGIT2_VER_MAJOR == 0 && LIBGIT_VER_MINOR >= 28)
                git_error_set_str (GIT_ERROR, error->message);
 #else
                giterr_set_str (GIT_ERROR, error->message);
diff --git a/libgit2-glib/ggit-config.c b/libgit2-glib/ggit-config.c
index 626f7f0..42dd1ad 100644
--- a/libgit2-glib/ggit-config.c
+++ b/libgit2-glib/ggit-config.c
@@ -191,7 +191,7 @@ 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
+#if LIBGIT2_VER_MAJOR > 0 || (LIBGIT2_VER_MAJOR == 0 && LIBGIT2_VER_MINOR >= 28)
                git_buf_dispose (&buf);
 #else
                git_buf_free (&buf);
@@ -224,7 +224,7 @@ 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
+#if LIBGIT2_VER_MAJOR > 0 || (LIBGIT2_VER_MAJOR == 0 && LIBGIT2_VER_MINOR >= 28)
                git_buf_dispose (&buf);
 #else
                git_buf_free (&buf);
@@ -303,7 +303,7 @@ ggit_config_add_file (GgitConfig      *config,
        ret = git_config_add_file_ondisk (_ggit_native_get (config),
                                          path,
                                          (git_config_level_t)level,
-#if LIBGIT2_SOVERSION >= 27
+#if LIBGIT2_VER_MAJOR > 0 || (LIBGIT2_VER_MAJOR == 0 && LIBGIT2_VER_MINOR >= 27)
                                          NULL,
 #endif
                                          force);
diff --git a/libgit2-glib/ggit-diff.c b/libgit2-glib/ggit-diff.c
index 4df4efd..3448290 100644
--- a/libgit2-glib/ggit-diff.c
+++ b/libgit2-glib/ggit-diff.c
@@ -786,7 +786,7 @@ ggit_diff_format_email (GgitDiff                    *diff,
 
        if (ret != GIT_OK)
        {
-#if LIBGIT2_SOVERSION >= 28
+#if LIBGIT2_VER_MAJOR > 0 || (LIBGIT2_VER_MAJOR == 0 && LIBGIT2_VER_MINOR >= 28)
                git_buf_dispose (&buf);
 #else
                git_buf_free (&buf);
@@ -796,7 +796,7 @@ ggit_diff_format_email (GgitDiff                    *diff,
        }
 
        retval = g_strndup (buf.ptr, buf.size);
-#if LIBGIT2_SOVERSION >= 28
+#if LIBGIT2_VER_MAJOR > 0 || (LIBGIT2_VER_MAJOR == 0 && LIBGIT2_VER_MINOR >= 28)
        git_buf_dispose (&buf);
 #else
        git_buf_free (&buf);
@@ -1016,7 +1016,7 @@ ggit_diff_new_buffers (const guint8          *buffer1,
        }
 
        git_patch_free(patch);
-#if LIBGIT2_SOVERSION >= 28
+#if LIBGIT2_VER_MAJOR > 0 || (LIBGIT2_VER_MAJOR == 0 && LIBGIT2_VER_MINOR >= 28)
        git_buf_dispose (&buf);
 #else
        git_buf_free (&buf);
diff --git a/libgit2-glib/ggit-error.c b/libgit2-glib/ggit-error.c
index 9247064..dbdaf4e 100644
--- a/libgit2-glib/ggit-error.c
+++ b/libgit2-glib/ggit-error.c
@@ -51,7 +51,7 @@ _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
+#if LIBGIT2_VER_MAJOR > 0 || (LIBGIT2_VER_MAJOR == 0 && LIBGIT2_VER_MINOR >= 28)
        git2_err = git_error_last ();
 #else
        git2_err = giterr_last ();
diff --git a/libgit2-glib/ggit-message.c b/libgit2-glib/ggit-message.c
index 7bd6983..4d1b1b8 100644
--- a/libgit2-glib/ggit-message.c
+++ b/libgit2-glib/ggit-message.c
@@ -46,7 +46,7 @@ ggit_message_prettify (const gchar *message,
        git_message_prettify (&buf, message, strip_comments, comment_char);
 
        d = g_strdup (buf.ptr);
-#if LIBGIT2_SOVERSION >= 28
+#if LIBGIT2_VER_MAJOR > 0 || (LIBGIT2_VER_MAJOR == 0 && LIBGIT2_VER_MINOR >= 28)
        git_buf_dispose (&buf);
 #else
        git_buf_free (&buf);
diff --git a/libgit2-glib/ggit-patch.c b/libgit2-glib/ggit-patch.c
index cd35be7..b544591 100644
--- a/libgit2-glib/ggit-patch.c
+++ b/libgit2-glib/ggit-patch.c
@@ -194,7 +194,7 @@ ggit_patch_to_string (GgitPatch  *patch,
        if (ret == GIT_OK)
        {
                result = g_strdup (buf.ptr);
-#if LIBGIT2_SOVERSION >= 28
+#if LIBGIT2_VER_MAJOR > 0 || (LIBGIT2_VER_MAJOR == 0 && LIBGIT2_VER_MINOR >= 28)
                git_buf_dispose (&buf);
 #else
                git_buf_free (&buf);
diff --git a/libgit2-glib/ggit-remote-callbacks.c b/libgit2-glib/ggit-remote-callbacks.c
index 7956f8b..a1e7b7d 100644
--- a/libgit2-glib/ggit-remote-callbacks.c
+++ b/libgit2-glib/ggit-remote-callbacks.c
@@ -160,7 +160,7 @@ credentials_wrap (git_cred     **cred,
                {
                        if (error)
                        {
-#if LIBGIT2_SOVERSION >= 28
+#if LIBGIT2_VER_MAJOR > 0 || (LIBGIT2_VER_MAJOR == 0 && LIBGIT2_VER_MINOR >= 28)
                                git_error_set_str (GIT_ERROR, error->message);
 #else
                                giterr_set_str (GIT_ERROR, error->message);
diff --git a/libgit2-glib/ggit-repository.c b/libgit2-glib/ggit-repository.c
index e09f729..4273bd0 100644
--- a/libgit2-glib/ggit-repository.c
+++ b/libgit2-glib/ggit-repository.c
@@ -1013,7 +1013,7 @@ ggit_repository_discover_full (GFile        *location,
        if (ret == GIT_OK)
        {
                rep = g_file_new_for_path (buf.ptr);
-#if LIBGIT2_SOVERSION >= 28
+#if LIBGIT2_VER_MAJOR > 0 || (LIBGIT2_VER_MAJOR == 0 && LIBGIT2_VER_MINOR >= 28)
                git_buf_dispose (&buf);
 #else
                git_buf_free (&buf);
@@ -3791,7 +3791,7 @@ ggit_repository_get_default_notes_ref (GgitRepository  *repository,
        }
 
        ref = g_strdup (buf.ptr);
-#if LIBGIT2_SOVERSION >= 28
+#if LIBGIT2_VER_MAJOR > 0 || (LIBGIT2_VER_MAJOR == 0 && LIBGIT2_VER_MINOR >= 28)
        git_buf_dispose (&buf);
 #else
        git_buf_free (&buf);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]