File: 0005-structs-Add-update-refs-field-to-remote-callbacks-on.patch

package info (click to toggle)
guile-git 0.9.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 892 kB
  • sloc: lisp: 6,231; makefile: 132; sh: 8
file content (84 lines) | stat: -rw-r--r-- 2,966 bytes parent folder | download
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
From fced7556bc0d53c7bbb96ee51f65027f210e3a82 Mon Sep 17 00:00:00 2001
From: Emily <hello@emily.moe>
Date: Wed, 22 Jan 2025 23:55:45 +0000
Subject: [PATCH 05/21] =?UTF-8?q?structs:=20Add=20=E2=80=98update-refs?=
 =?UTF-8?q?=E2=80=99=20field=20to=20=E2=80=98%remote-callbacks=E2=80=99=20?=
 =?UTF-8?q?on=20libgit2=201.9+.?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

* configure.ac: Check for the ‘update_refs’ field of
‘git_remote_callbacks’.
* git/configuration.scm.in (%have-remote-callbacks-update-refs?): New
variable.
* git/structs.scm (%remote-callbacks): Add ‘update-refs’ field
conditionally.
---
 configure.ac             | 10 ++++++++++
 git/configuration.scm.in |  4 ++++
 git/structs.scm          |  5 ++++-
 3 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index 7f8f0b9..a2575f4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -107,6 +107,16 @@ else
 fi
 AC_SUBST([HAVE_DIFF_OPTIONS_OID_TYPE])
 
+dnl Does 'git_remote_callbacks' have 'update_refs'?  New in 1.9.
+AC_CHECK_MEMBER([git_remote_callbacks.update_refs], [], [],
+  [[#include <git2.h>]])
+if test "x$ac_cv_member_git_remote_callbacks_update_refs" = "xyes"; then
+  HAVE_REMOTE_CALLBACKS_UPDATE_REFS="#true"
+else
+  HAVE_REMOTE_CALLBACKS_UPDATE_REFS="#false"
+fi
+AC_SUBST([HAVE_REMOTE_CALLBACKS_UPDATE_REFS])
+
 dnl 'GIT_OPT_SET_SERVER_CONNECT_TIMEOUT' & co. are new in 1.7.
 GUILE_GIT_CHECK_DECLARATION([GIT_OPT_SET_SERVER_CONNECT_TIMEOUT])
 
diff --git a/git/configuration.scm.in b/git/configuration.scm.in
index 864b9ff..1e82c24 100644
--- a/git/configuration.scm.in
+++ b/git/configuration.scm.in
@@ -25,6 +25,7 @@
             %have-diff-options-oid-type?
             %have-config-entry-backend-type?
             %have-config-entry-free?
+            %have-remote-callbacks-update-refs?
             %have-GIT_OPT_SET_SERVER_CONNECT_TIMEOUT?
             %have-GIT_OPT_SET_HOMEDIR?
             %have-GIT_OPT_SET_USER_AGENT_PRODUCT?))
@@ -52,6 +53,9 @@
 (define %have-config-entry-free?
   @HAVE_CONFIG_ENTRY_FREE@)
 
+(define %have-remote-callbacks-update-refs?
+  @HAVE_REMOTE_CALLBACKS_UPDATE_REFS@)
+
 (define %have-GIT_OPT_SET_SERVER_CONNECT_TIMEOUT?
   @HAVE_GIT_OPT_SET_SERVER_CONNECT_TIMEOUT@)
 
diff --git a/git/structs.scm b/git/structs.scm
index 1b2d38b..90c9d59 100644
--- a/git/structs.scm
+++ b/git/structs.scm
@@ -670,7 +670,10 @@ type to 'specified for this to take effect."
                (transport ,(bs:pointer uint8))
                (remote-ready ,(bs:pointer void))
                (payload ,(bs:pointer uint8))
-               (resolve-url ,(bs:pointer uint8)))))
+               (resolve-url ,(bs:pointer uint8))
+               ,@(if %have-remote-callbacks-update-refs?
+                     `((update-refs ,(bs:pointer uint8)))
+                     '()))))
 
 (define-record-type <remote-callbacks>
   (%make-remote-callbacks bytestructure)
-- 
2.39.5