libgit2-glib: add patch for libgit2 1.9.0

This commit is contained in:
Emily
2025-01-24 20:18:37 -07:00
committed by Audrey Dutcher
parent 396775bc8d
commit dbb5895438
2 changed files with 157 additions and 6 deletions
@@ -0,0 +1,153 @@
From 46bad01581bca5bc64f6499eb1222ff067721a63 Mon Sep 17 00:00:00 2001
From: Dominique Leuenberger <dimstar@opensuse.org>
Date: Fri, 5 Apr 2024 10:28:16 +0200
Subject: [PATCH 1/2] build: Fix build against, and require, libgit2 1.8.0
---
libgit2-glib/ggit-clone-options.c | 1 +
libgit2-glib/ggit-cred-ssh-interactive.c | 2 +-
libgit2-glib/ggit-remote-callbacks.h | 1 +
libgit2-glib/ggit-repository.c | 4 ++--
libgit2-glib/ggit-types.h | 3 ++-
meson.build | 2 +-
6 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/libgit2-glib/ggit-clone-options.c b/libgit2-glib/ggit-clone-options.c
index b47fdb1..30c7d86 100644
--- a/libgit2-glib/ggit-clone-options.c
+++ b/libgit2-glib/ggit-clone-options.c
@@ -19,6 +19,7 @@
*/
#include <git2.h>
+#include <git2/sys/errors.h>
#include <gio/gio.h>
#include "ggit-clone-options.h"
diff --git a/libgit2-glib/ggit-cred-ssh-interactive.c b/libgit2-glib/ggit-cred-ssh-interactive.c
index 4f60f8b..0bdca95 100644
--- a/libgit2-glib/ggit-cred-ssh-interactive.c
+++ b/libgit2-glib/ggit-cred-ssh-interactive.c
@@ -191,7 +191,7 @@ callback_wrapper (const char *name,
{
gchar *text;
- text = g_strndup (prompts[i].text, prompts[i].length);
+ text = g_strndup ((const gchar *)prompts[i].text, prompts[i].length);
wprompts[i] = ggit_cred_ssh_interactive_prompt_new (wname,
winstruction,
diff --git a/libgit2-glib/ggit-remote-callbacks.h b/libgit2-glib/ggit-remote-callbacks.h
index 3005ff4..2340712 100644
--- a/libgit2-glib/ggit-remote-callbacks.h
+++ b/libgit2-glib/ggit-remote-callbacks.h
@@ -24,6 +24,7 @@
#include <glib-object.h>
#include <git2.h>
+#include <git2/sys/errors.h>
#include <libgit2-glib/ggit-cred.h>
G_BEGIN_DECLS
diff --git a/libgit2-glib/ggit-repository.c b/libgit2-glib/ggit-repository.c
index bf099f6..936c6fc 100644
--- a/libgit2-glib/ggit-repository.c
+++ b/libgit2-glib/ggit-repository.c
@@ -3182,7 +3182,7 @@ ggit_repository_create_commit (GgitRepository *repository,
message,
_ggit_native_get (tree),
parent_count,
- (const git_commit **)parents_native);
+ (gpointer)parents_native);
g_free (parents_native);
@@ -3323,7 +3323,7 @@ ggit_repository_create_commit_buffer(GgitRepository *repository,
message,
_ggit_tree_get_tree (tree),
parent_count,
- (git_commit const **)parents_native);
+ (gpointer)parents_native);
g_free (parents_native);
diff --git a/libgit2-glib/ggit-types.h b/libgit2-glib/ggit-types.h
index 7e28975..2a2ed99 100644
--- a/libgit2-glib/ggit-types.h
+++ b/libgit2-glib/ggit-types.h
@@ -355,7 +355,8 @@ typedef enum
GGIT_CONFIG_LEVEL_XDG = 3,
GGIT_CONFIG_LEVEL_GLOBAL = 4,
GGIT_CONFIG_LEVEL_LOCAL = 5,
- GGIT_CONFIG_LEVEL_APP = 6,
+ GGIT_CONFIG_LEVEL_WORKTREE = 6,
+ GGIT_CONFIG_LEVEL_APP = 7,
GGIT_CONFIG_LEVEL_HIGHEST = -1
} GgitConfigLevel;
diff --git a/meson.build b/meson.build
index e54a8b4..c21107d 100644
--- a/meson.build
+++ b/meson.build
@@ -126,7 +126,7 @@ glib_dep = dependency('glib-2.0', version: '>=' + glib_req)
gobject_dep = dependency('gobject-2.0', version: '>=' + glib_req)
gio_dep = dependency('gio-2.0', version: '>=' + glib_req)
-libgit2_dep = dependency('libgit2', version: '>= 0.25.0')
+libgit2_dep = dependency('libgit2', version: '>= 1.8.0')
# XXX: Not nice, but probably our best option
enable_gir = get_option('introspection') and find_program('g-ir-scanner', required: false).found()
--
GitLab
From 93685d4297e425af67ac6888d6b66dfbcd4b95c8 Mon Sep 17 00:00:00 2001
From: Rui Chen <rui@chenrui.dev>
Date: Mon, 13 Jan 2025 21:23:50 -0500
Subject: [PATCH 2/2] chore: support libgit2 1.9
Signed-off-by: Rui Chen <rui@chenrui.dev>
---
libgit2-glib/ggit-types.h | 4 ++--
meson.build | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/libgit2-glib/ggit-types.h b/libgit2-glib/ggit-types.h
index 2a2ed99..184c3e6 100644
--- a/libgit2-glib/ggit-types.h
+++ b/libgit2-glib/ggit-types.h
@@ -990,8 +990,7 @@ typedef enum
typedef enum
{
- GGIT_CHECKOUT_NONE = 0,
- GGIT_CHECKOUT_SAFE = (1u << 0),
+ GGIT_CHECKOUT_SAFE = 0,
GGIT_CHECKOUT_FORCE = (1u << 1),
GGIT_CHECKOUT_RECREATE_MISSING = (1u << 2),
GGIT_CHECKOUT_ALLOW_CONFLICTS = (1u << 4),
@@ -1010,6 +1009,7 @@ typedef enum
GGIT_CHECKOUT_CONFLICT_STYLE_DIFF3 = (1u << 21),
GGIT_CHECKOUT_DONT_REMOVE_EXISTING = (1u << 22),
GGIT_CHECKOUT_DONT_WRITE_INDEX = (1u << 23),
+ GGIT_CHECKOUT_NONE = (1u << 30),
GGIT_CHECKOUT_UPDATE_SUBMODULES = (1u << 16),
GGIT_CHECKOUT_UPDATE_SUBMODULES_IF_CHANGED = (1u << 17)
} GgitCheckoutStrategy;
diff --git a/meson.build b/meson.build
index c21107d..9cd26f8 100644
--- a/meson.build
+++ b/meson.build
@@ -126,7 +126,7 @@ glib_dep = dependency('glib-2.0', version: '>=' + glib_req)
gobject_dep = dependency('gobject-2.0', version: '>=' + glib_req)
gio_dep = dependency('gio-2.0', version: '>=' + glib_req)
-libgit2_dep = dependency('libgit2', version: '>= 1.8.0')
+libgit2_dep = dependency('libgit2', version: '>= 1.9.0')
# XXX: Not nice, but probably our best option
enable_gir = get_option('introspection') and find_program('g-ir-scanner', required: false).found()
--
GitLab
+4 -6
View File
@@ -33,12 +33,10 @@ stdenv.mkDerivation rec {
};
patches = [
(fetchpatch {
name = "support-libgit2-1.8.patch";
# https://gitlab.gnome.org/GNOME/libgit2-glib/-/merge_requests/40
url = "https://gitlab.gnome.org/GNOME/libgit2-glib/-/commit/a76fdf96c3af9ce9d21a3985c4be8a1aa6eea661.patch";
hash = "sha256-ysU8pAixyftensfEC9bE0RUFMPMei0jYT26WKN5uOFE=";
})
# See:
# * <https://gitlab.gnome.org/GNOME/libgit2-glib/-/merge_requests/40>
# * <https://gitlab.gnome.org/GNOME/libgit2-glib/-/merge_requests/46>
./libgit2-1.9.0.patch
];
nativeBuildInputs = [