summaryrefslogtreecommitdiff
path: root/pcr/guile-git-lib/guile-git-lib-merge-32-libgit2-1.2.0.patch
blob: d1ec2328143512dca7cc24b425e2e0b297756359 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
From 278d23a18df6913bfe87c214d0e6dbeee6996f1d Mon Sep 17 00:00:00 2001
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Date: Mon, 22 Nov 2021 22:08:31 -0500
Subject: [PATCH 1/3] structs: Adjust %remote-callbacks for libgit2 v1.2.0.

Fixes <https://gitlab.com/guile-git/guile-git/-/issues/23>.

* configure.ac (AC_CHECK_MEMBER)
<git_remote_callbacks.remote_ready>: New member check.
<git_remote_callbacks.resolve_url>: Streamline.
* git/config.scm.in (%have-remote-callbacks-remote-ready?): New variable.
* git/structs.scm (%remote-callbacks): Conditionally add the new
callback 'remote_ready' callback field.
---
 configure.ac             | 18 ++++++++++++------
 git/configuration.scm.in |  6 ++++++
 git/structs.scm          |  6 ++++++
 3 files changed, 24 insertions(+), 6 deletions(-)

diff --git a/configure.ac b/configure.ac
index 107e6ca..20e9019 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2,6 +2,7 @@ dnl Guile-Git --- GNU Guile bindings of libgit2
 dnl Copyright © 2016-2018 Erik Edrosa <erik.edrosa@gmail.com>
 dnl Copyright © 2017, 2019, 2020, 2021 Ludovic Courtès <ludo@gnu.org>
 dnl Copyright © 2019 Mathieu Othacehe <m.othacehe@gmail.com>
+dnl Copyright © 2021 Maxim Cournoyer <maxim.cournoyer@gmail.com>
 dnl
 dnl This file is part of Guile-Git.
 dnl
@@ -43,15 +44,20 @@ AS_IF([test "x$LIBGIT2_LIBDIR" = "x"], [
 ])
 AC_SUBST([LIBGIT2_LIBDIR])
 
+dnl Does the 'git_remote_callbacks' struct have a 'remote_ready' field?
+dnl It was added in 1.2.0, obsoleting 'resolve_url'.
+AC_CHECK_MEMBER([git_remote_callbacks.remote_ready],
+  [HAVE_REMOTE_CALLBACKS_REMOTE_READY="#true"],
+  [HAVE_REMOTE_CALLBACKS_REMOTE_READY="#false"],
+  [[#include <git2.h>]])
+AC_SUBST([HAVE_REMOTE_CALLBACKS_REMOTE_READY])
+
 dnl Does the 'git_remote_callbacks' struct have a 'resolve_url' field?
 dnl It's missing in libgit2 0.28.5, added in 1.0.
-AC_CHECK_MEMBER([git_remote_callbacks.resolve_url], [], [],
+AC_CHECK_MEMBER([git_remote_callbacks.resolve_url],
+  [HAVE_REMOTE_CALLBACKS_RESOLVE_URL="#true"],
+  [HAVE_REMOTE_CALLBACKS_RESOLVE_URL="#false"],
   [[#include <git2.h>]])
-if test "x$ac_cv_member_git_remote_callbacks_resolve_url" = "xyes"; then
-  HAVE_REMOTE_CALLBACKS_RESOLVE_URL="#true"
-else
-  HAVE_REMOTE_CALLBACKS_RESOLVE_URL="#false"
-fi
 AC_SUBST([HAVE_REMOTE_CALLBACKS_RESOLVE_URL])
 
 dnl Those binaries are required for ssh authentication tests.
diff --git a/git/configuration.scm.in b/git/configuration.scm.in
index c45f698..64c4360 100644
--- a/git/configuration.scm.in
+++ b/git/configuration.scm.in
@@ -19,11 +19,17 @@
 
 (define-module (git configuration)
   #:export (%libgit2
+            %have-remote-callbacks-remote-ready?
             %have-remote-callbacks-resolve-url?))
 
 (define %libgit2
   "@LIBGIT2_LIBDIR@/libgit2")
 
+(define %have-remote-callbacks-remote-ready?
+  ;; True if the 'git_remote_callbacks' struct has a
+  ;; 'remote_ready' field.
+  @HAVE_REMOTE_CALLBACKS_REMOTE_READY@)
+
 (define %have-remote-callbacks-resolve-url?
   ;; True if the 'git_remote_callbacks' struct has a 'resolve_url' field.
   @HAVE_REMOTE_CALLBACKS_RESOLVE_URL@)
diff --git a/git/structs.scm b/git/structs.scm
index ca51728..be3d050 100644
--- a/git/structs.scm
+++ b/git/structs.scm
@@ -637,6 +637,12 @@ type to 'specified for this to take effect."
                (push-update-reference ,(bs:pointer uint8))
                (push-negotiation ,(bs:pointer uint8))
                (transport ,(bs:pointer uint8))
+
+               ;; Added in libgit2 1.2.0.
+               ,@(if %have-remote-callbacks-remote-ready?
+                     `((remote-ready ,(bs:pointer uint8)))
+                     '())
+
                (payload ,(bs:pointer uint8))
 
                ;; libgit2 1.0 added this field, which is missing from 0.28.5,
-- 
GitLab