File: 0004-structs-Omit-free-field-from-config-entry-on-libgit2.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 (82 lines) | stat: -rw-r--r-- 2,845 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
From f7cb884c38ef103300f952400d3c560b268e6376 Mon Sep 17 00:00:00 2001
From: Emily <hello@emily.moe>
Date: Wed, 22 Jan 2025 23:25:51 +0000
Subject: [PATCH 04/21] =?UTF-8?q?structs:=20Omit=20=E2=80=98free=E2=80=99?=
 =?UTF-8?q?=20field=20from=20=E2=80=98%config-entry=E2=80=99=20on=20libgit?=
 =?UTF-8?q?2=201.9+.?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

* configure.ac: Check for the ‘free’ field of ‘git_config_entry’.
* git/configuration.scm.in (%have-config-entry-free?): New variable.
* git/structs.scm (%config-entry): Omit ‘free’ field conditionally.

Modified-by: Ludovic Courtès <ludo@gnu.org>
---
 configure.ac             | 10 ++++++++++
 git/configuration.scm.in |  4 ++++
 git/structs.scm          |  4 +++-
 3 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index b04ca6b..7f8f0b9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -87,6 +87,16 @@ else
 fi
 AC_SUBST([HAVE_CONFIG_ENTRY_BACKEND_TYPE])
 
+dnl Does 'git_config_entry' have 'free'?  Removed in 1.9.
+AC_CHECK_MEMBER([git_config_entry.free], [], [],
+  [[#include <git2.h>]])
+if test "x$ac_cv_member_git_config_entry_free" = "xyes"; then
+  HAVE_CONFIG_ENTRY_FREE="#true"
+else
+  HAVE_CONFIG_ENTRY_FREE="#false"
+fi
+AC_SUBST([HAVE_CONFIG_ENTRY_FREE])
+
 dnl Does 'git_diff_options' have 'oid_type'? It's new in 1.7.
 AC_CHECK_MEMBER([git_diff_options.oid_type], [], [],
   [[#include <git2.h>]])
diff --git a/git/configuration.scm.in b/git/configuration.scm.in
index e10b195..864b9ff 100644
--- a/git/configuration.scm.in
+++ b/git/configuration.scm.in
@@ -24,6 +24,7 @@
             %have-fetch-options-depth?
             %have-diff-options-oid-type?
             %have-config-entry-backend-type?
+            %have-config-entry-free?
             %have-GIT_OPT_SET_SERVER_CONNECT_TIMEOUT?
             %have-GIT_OPT_SET_HOMEDIR?
             %have-GIT_OPT_SET_USER_AGENT_PRODUCT?))
@@ -48,6 +49,9 @@
 (define %have-config-entry-backend-type?
   @HAVE_CONFIG_ENTRY_BACKEND_TYPE@)
 
+(define %have-config-entry-free?
+  @HAVE_CONFIG_ENTRY_FREE@)
+
 (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 beebd11..1b2d38b 100644
--- a/git/structs.scm
+++ b/git/structs.scm
@@ -505,7 +505,9 @@
                      '())
                (include-depth ,unsigned-int)
                (level ,int)                       ;git_config_level_t
-               (free ,(bs:pointer int))
+               ,@(if %have-config-entry-free?
+                     `((free ,(bs:pointer int)))
+                     '())
                ,@(if %have-config-entry-backend-type?
                      '()
                      `((payload ,(bs:pointer int))))))) ;removed in 1.8
-- 
2.39.5