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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
|
diff --git a/stdlib/LibGit2/src/consts.jl b/stdlib/LibGit2/src/consts.jl
index 5a5b8b74e7127..8c140e8c2aa30 100644
--- a/stdlib/LibGit2/src/consts.jl
+++ b/stdlib/LibGit2/src/consts.jl
@@ -417,7 +417,32 @@ Option flags for `GitRepo`.
FEATURE_SSH = Cuint(1 << 2),
FEATURE_NSEC = Cuint(1 << 3))
-if version() >= v"0.24.0"
+if version() >= v"1.8.0"
+ @doc """
+ Priority level of a config file.
+
+ These priority levels correspond to the natural escalation logic (from higher to lower) when searching for config entries in git.
+
+ * `CONFIG_LEVEL_DEFAULT` - Open the global, XDG and system configuration files if any available.
+ * `CONFIG_LEVEL_PROGRAMDATA` - System-wide on Windows, for compatibility with portable git
+ * `CONFIG_LEVEL_SYSTEM` - System-wide configuration file; `/etc/gitconfig` on Linux systems
+ * `CONFIG_LEVEL_XDG` - XDG compatible configuration file; typically `~/.config/git/config`
+ * `CONFIG_LEVEL_GLOBAL` - User-specific configuration file (also called Global configuration file); typically `~/.gitconfig`
+ * `CONFIG_LEVEL_LOCAL` - Repository specific configuration file; `\$WORK_DIR/.git/config` on non-bare repos
+ * `CONFIG_LEVEL_WORKTREE` - Worktree specific configuration file; `\$GIT_DIR/config.worktree`
+ * `CONFIG_LEVEL_APP` - Application specific configuration file; freely defined by applications
+ * `CONFIG_HIGHEST_LEVEL` - Represents the highest level available config file (i.e. the most specific config file available that actually is loaded)
+ """
+ @enum(GIT_CONFIG, CONFIG_LEVEL_DEFAULT = 0,
+ CONFIG_LEVEL_PROGRAMDATA = 1,
+ CONFIG_LEVEL_SYSTEM = 2,
+ CONFIG_LEVEL_XDG = 3,
+ CONFIG_LEVEL_GLOBAL = 4,
+ CONFIG_LEVEL_LOCAL = 5,
+ CONFIG_LEVEL_WORKTREE = 6,
+ CONFIG_LEVEL_APP = 7,
+ CONFIG_HIGHEST_LEVEL =-1)
+elseif version() >= v"0.24.0"
@doc """
Priority level of a config file.
diff --git a/stdlib/LibGit2/src/types.jl b/stdlib/LibGit2/src/types.jl
index 96cea96d013e5..b0b463c69e2f1 100644
--- a/stdlib/LibGit2/src/types.jl
+++ b/stdlib/LibGit2/src/types.jl
@@ -678,6 +678,8 @@ The fields represent:
for more information.
* `custom_headers`: only relevant if the LibGit2 version is greater than or equal to `0.24.0`.
Extra headers needed for the push operation.
+ * `remote_push_options`: only relevant if the LibGit2 version is greater than or equal to `1.8.0`.
+ "Push options" to deliver to the remote.
"""
@kwdef struct PushOptions
version::Cuint = Cuint(1)
@@ -692,6 +694,9 @@ The fields represent:
@static if LibGit2.VERSION >= v"0.24.0"
custom_headers::StrArrayStruct = StrArrayStruct()
end
+ @static if LibGit2.VERSION >= v"1.8.0"
+ remote_push_options::StrArrayStruct = StrArrayStruct()
+ end
end
@assert Base.allocatedinline(PushOptions)
@@ -913,10 +918,17 @@ Matches the [`git_config_entry`](https://libgit2.org/libgit2/#HEAD/type/git_conf
struct ConfigEntry
name::Cstring
value::Cstring
+ @static if LibGit2.VERSION >= v"1.8.0"
+ backend_type::Cstring
+ origin_path::Cstring
+ end
include_depth::Cuint
level::GIT_CONFIG
free::Ptr{Cvoid}
- payload::Ptr{Cvoid} # User is not permitted to read or write this field
+ @static if LibGit2.VERSION < v"1.8.0"
+ # In 1.8.0, the unused payload value has been removed
+ payload::Ptr{Cvoid}
+ end
end
@assert Base.allocatedinline(ConfigEntry)
From 18dde6ec3605cf43b8ceaa4f892662b0392aa475 Mon Sep 17 00:00:00 2001
From: Chengyu Han <cyhan.dev@outlook.com>
Date: Fri, 6 Dec 2024 11:42:43 +0800
Subject: [PATCH 1/5] libgit2: update enums from v1.8.0
---
stdlib/LibGit2/src/error.jl | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/stdlib/LibGit2/src/error.jl b/stdlib/LibGit2/src/error.jl
index 1a493006ea1b5..d21fbd9c01d75 100644
--- a/stdlib/LibGit2/src/error.jl
+++ b/stdlib/LibGit2/src/error.jl
@@ -27,6 +27,11 @@ export GitError
EAPPLIED = Cint(-18), # patch/merge has already been applied
EPEEL = Cint(-19), # the requested peel operation is not possible
EEOF = Cint(-20), # unexpected EOF
+ EINVALID = Cint(-21), # Invalid operation or input
+ EUNCOMMITTED = Cint(-22), # Uncommitted changes in index prevented operation
+ EDIRECTORY = Cint(-23), # The operation is not valid for a directory
+ EMERGECONFLICT = Cint(-24), # A merge conflict exists and cannot continue
+
PASSTHROUGH = Cint(-30), # internal only
ITEROVER = Cint(-31), # signals end of iteration
RETRY = Cint(-32), # internal only
@@ -34,7 +39,11 @@ export GitError
EINDEXDIRTY = Cint(-34), # unsaved changes in the index would be overwritten
EAPPLYFAIL = Cint(-35), # patch application failed
EOWNER = Cint(-36), # the object is not owned by the current user
- TIMEOUT = Cint(-37)) # The operation timed out
+ TIMEOUT = Cint(-37), # The operation timed out
+ EUNCHANGED = Cint(-38), # There were no changes
+ ENOTSUPPORTED = Cint(-39), # An option is not supported
+ EREADONLY = Cint(-40), # The subject is read-only
+)
@enum(Class, None,
NoMemory,
From ade0d3925b4c6019c5b6dfd5f9e120ce512bdd00 Mon Sep 17 00:00:00 2001
From: Chengyu Han <cyhan.dev@outlook.com>
Date: Fri, 6 Dec 2024 11:56:44 +0800
Subject: [PATCH 2/5] libgit2: replace deprecated function call
dep warn: https://github.com/libgit2/libgit2/blob/v1.8.0/src/util/errors.c#L376-L385
---
stdlib/LibGit2/src/error.jl | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/stdlib/LibGit2/src/error.jl b/stdlib/LibGit2/src/error.jl
index d21fbd9c01d75..4cc7620a8a07e 100644
--- a/stdlib/LibGit2/src/error.jl
+++ b/stdlib/LibGit2/src/error.jl
@@ -97,7 +97,7 @@ Base.show(io::IO, err::GitError) = print(io, "GitError(Code:$(err.code), Class:$
function last_error()
ensure_initialized()
- err = ccall((:giterr_last, libgit2), Ptr{ErrorStruct}, ())
+ err = ccall((:git_error_last, libgit2), Ptr{ErrorStruct}, ())
if err != C_NULL
err_obj = unsafe_load(err)
err_class = Class(err_obj.class)
From 01cc37f3a2dab25f8cbbe9bebfcc77c735daea98 Mon Sep 17 00:00:00 2001
From: Chengyu Han <cyhan.dev@outlook.com>
Date: Fri, 6 Dec 2024 12:27:12 +0800
Subject: [PATCH 3/5] libgit2: replace deprecated call `giterr_set_str`
---
stdlib/LibGit2/src/callbacks.jl | 8 ++++----
stdlib/LibGit2/test/libgit2-tests.jl | 2 +-
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/stdlib/LibGit2/src/callbacks.jl b/stdlib/LibGit2/src/callbacks.jl
index 043e04e0dfad6..c4156d4a44c71 100644
--- a/stdlib/LibGit2/src/callbacks.jl
+++ b/stdlib/LibGit2/src/callbacks.jl
@@ -43,7 +43,7 @@ end
function user_abort()
ensure_initialized()
# Note: Potentially it could be better to just throw a Julia error.
- ccall((:giterr_set_str, libgit2), Cvoid,
+ ccall((:git_error_set_str, libgit2), Cvoid,
(Cint, Cstring), Cint(Error.Callback),
"Aborting, user cancelled credential request.")
return Cint(Error.EUSER)
@@ -51,7 +51,7 @@ end
function prompt_limit()
ensure_initialized()
- ccall((:giterr_set_str, libgit2), Cvoid,
+ ccall((:git_error_set_str, libgit2), Cvoid,
(Cint, Cstring), Cint(Error.Callback),
"Aborting, maximum number of prompts reached.")
return Cint(Error.EAUTH)
@@ -59,7 +59,7 @@ end
function exhausted_abort()
ensure_initialized()
- ccall((:giterr_set_str, libgit2), Cvoid,
+ ccall((:git_error_set_str, libgit2), Cvoid,
(Cint, Cstring), Cint(Error.Callback),
"All authentication methods have failed.")
return Cint(Error.EAUTH)
@@ -339,7 +339,7 @@ function credentials_callback(libgit2credptr::Ptr{Ptr{Cvoid}}, url_ptr::Cstring,
if err == 0
if p.explicit !== nothing
ensure_initialized()
- ccall((:giterr_set_str, libgit2), Cvoid, (Cint, Cstring), Cint(Error.Callback),
+ ccall((:git_error_set_str, libgit2), Cvoid, (Cint, Cstring), Cint(Error.Callback),
"The explicitly provided credential is incompatible with the requested " *
"authentication methods.")
end
diff --git a/stdlib/LibGit2/test/libgit2-tests.jl b/stdlib/LibGit2/test/libgit2-tests.jl
index 9ab75ed1dc39b..1dfa5429368b6 100644
--- a/stdlib/LibGit2/test/libgit2-tests.jl
+++ b/stdlib/LibGit2/test/libgit2-tests.jl
@@ -1070,7 +1070,7 @@ mktempdir() do dir
# test workaround for git_tree_walk issue
# https://github.com/libgit2/libgit2/issues/4693
- ccall((:giterr_set_str, libgit2), Cvoid, (Cint, Cstring),
+ ccall((:git_error_set_str, libgit2), Cvoid, (Cint, Cstring),
Cint(LibGit2.Error.Invalid), "previous error")
try
# file needs to exist in tree in order to trigger the stop walk condition
From e657f964f170a7419cf7ae4792a998cef81e4f57 Mon Sep 17 00:00:00 2001
From: CY Han <git@wo-class.cn>
Date: Fri, 6 Dec 2024 12:33:56 +0800
Subject: [PATCH 4/5] Update stdlib/LibGit2/src/error.jl
---
stdlib/LibGit2/src/error.jl | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/stdlib/LibGit2/src/error.jl b/stdlib/LibGit2/src/error.jl
index 4cc7620a8a07e..4c7493ee6518a 100644
--- a/stdlib/LibGit2/src/error.jl
+++ b/stdlib/LibGit2/src/error.jl
@@ -43,7 +43,7 @@ export GitError
EUNCHANGED = Cint(-38), # There were no changes
ENOTSUPPORTED = Cint(-39), # An option is not supported
EREADONLY = Cint(-40), # The subject is read-only
-)
+)
@enum(Class, None,
NoMemory,
From 6b47c70b16975131e29f62d6c757caebb1a66ae7 Mon Sep 17 00:00:00 2001
From: Chengyu Han <cyhan.dev@outlook.com>
Date: Fri, 6 Dec 2024 12:48:28 +0800
Subject: [PATCH 5/5] libgit2: fix dup enum `ECONFLICT`
---
stdlib/LibGit2/src/error.jl | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/stdlib/LibGit2/src/error.jl b/stdlib/LibGit2/src/error.jl
index 4cc7620a8a07e..790f3b66d563b 100644
--- a/stdlib/LibGit2/src/error.jl
+++ b/stdlib/LibGit2/src/error.jl
@@ -19,7 +19,7 @@ export GitError
EUNMERGED = Cint(-10), # merge in progress prevented op
ENONFASTFORWARD = Cint(-11), # ref not fast-forwardable
EINVALIDSPEC = Cint(-12), # name / ref not in valid format
- EMERGECONFLICT = Cint(-13), # merge conflict prevented op
+ ECONFLICT = Cint(-13), # Checkout conflicts prevented operation
ELOCKED = Cint(-14), # lock file prevented op
EMODIFIED = Cint(-15), # ref value does not match expected
EAUTH = Cint(-16), # authentication error
|