rugged 1.9.4 → 1.9.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/rugged/version.rb +1 -1
- data/vendor/libgit2/CMakeLists.txt +1 -1
- data/vendor/libgit2/COPYING +83 -11
- data/vendor/libgit2/cmake/SelectRegex.cmake +8 -3
- data/vendor/libgit2/deps/pcre2/CMakeLists.txt +110 -0
- data/vendor/libgit2/deps/pcre2/LICENCE.md +104 -0
- data/vendor/libgit2/deps/pcre2/config.h.in +54 -0
- data/vendor/libgit2/deps/pcre2/pcre2.h +1079 -0
- data/vendor/libgit2/deps/pcre2/pcre2_auto_possess.c +1416 -0
- data/vendor/libgit2/deps/{pcre/pcre_chartables.c → pcre2/pcre2_chartables.c} +41 -47
- data/vendor/libgit2/deps/{pcre/pcre_ord2utf8.c → pcre2/pcre2_chkdint.c} +36 -36
- data/vendor/libgit2/deps/pcre2/pcre2_compile.c +11345 -0
- data/vendor/libgit2/deps/pcre2/pcre2_compile.h +356 -0
- data/vendor/libgit2/deps/pcre2/pcre2_compile_cgroup.c +632 -0
- data/vendor/libgit2/deps/pcre2/pcre2_compile_class.c +2777 -0
- data/vendor/libgit2/deps/pcre2/pcre2_config.c +250 -0
- data/vendor/libgit2/deps/pcre2/pcre2_context.c +557 -0
- data/vendor/libgit2/deps/pcre2/pcre2_convert.c +1263 -0
- data/vendor/libgit2/deps/{pcre/pcre_dfa_exec.c → pcre2/pcre2_dfa_match.c} +1402 -943
- data/vendor/libgit2/deps/pcre2/pcre2_error.c +384 -0
- data/vendor/libgit2/deps/pcre2/pcre2_extuni.c +159 -0
- data/vendor/libgit2/deps/pcre2/pcre2_find_bracket.c +217 -0
- data/vendor/libgit2/deps/pcre2/pcre2_fuzzsupport.c +844 -0
- data/vendor/libgit2/deps/pcre2/pcre2_internal.h +2353 -0
- data/vendor/libgit2/deps/pcre2/pcre2_intmodedep.h +1044 -0
- data/vendor/libgit2/deps/pcre2/pcre2_maketables.c +177 -0
- data/vendor/libgit2/deps/pcre2/pcre2_match.c +8244 -0
- data/vendor/libgit2/deps/pcre2/pcre2_match_data.c +184 -0
- data/vendor/libgit2/deps/pcre2/pcre2_match_next.c +171 -0
- data/vendor/libgit2/deps/{pcre/pcre_newline.c → pcre2/pcre2_newline.c} +92 -63
- data/vendor/libgit2/deps/{pcre/pcre_refcount.c → pcre2/pcre2_ord2utf.c} +64 -38
- data/vendor/libgit2/deps/pcre2/pcre2_pattern_info.c +430 -0
- data/vendor/libgit2/deps/pcre2/pcre2_printint_inc.h +1098 -0
- data/vendor/libgit2/deps/pcre2/pcre2_script_run.c +344 -0
- data/vendor/libgit2/deps/pcre2/pcre2_serialize.c +284 -0
- data/vendor/libgit2/deps/pcre2/pcre2_string_utils.c +199 -0
- data/vendor/libgit2/deps/pcre2/pcre2_study.c +2087 -0
- data/vendor/libgit2/deps/pcre2/pcre2_substitute.c +1761 -0
- data/vendor/libgit2/deps/pcre2/pcre2_substring.c +553 -0
- data/vendor/libgit2/deps/pcre2/pcre2_tables.c +310 -0
- data/vendor/libgit2/deps/pcre2/pcre2_ucd.c +5805 -0
- data/vendor/libgit2/deps/pcre2/pcre2_ucp.h +408 -0
- data/vendor/libgit2/deps/pcre2/pcre2_ucptables_inc.h +1596 -0
- data/vendor/libgit2/deps/pcre2/pcre2_util.h +179 -0
- data/vendor/libgit2/deps/pcre2/pcre2_valid_utf.c +397 -0
- data/vendor/libgit2/deps/pcre2/pcre2_xclass.c +547 -0
- data/vendor/libgit2/include/git2/common.h +13 -1
- data/vendor/libgit2/include/git2/version.h +2 -2
- data/vendor/libgit2/src/libgit2/blame.c +6 -0
- data/vendor/libgit2/src/libgit2/delta.c +8 -0
- data/vendor/libgit2/src/libgit2/indexer.c +3 -2
- data/vendor/libgit2/src/libgit2/settings.c +9 -0
- data/vendor/libgit2/src/libgit2/streams/openssl.c +4 -1
- data/vendor/libgit2/src/libgit2/submodule.c +77 -12
- data/vendor/libgit2/src/libgit2/transports/http.c +4 -4
- data/vendor/libgit2/src/libgit2/transports/smart_pkt.c +2 -1
- data/vendor/libgit2/src/util/fs_path.h +10 -10
- data/vendor/libgit2/src/util/regexp.c +27 -12
- data/vendor/libgit2/src/util/regexp.h +7 -2
- metadata +44 -37
- data/vendor/libgit2/deps/pcre/CMakeLists.txt +0 -140
- data/vendor/libgit2/deps/pcre/COPYING +0 -5
- data/vendor/libgit2/deps/pcre/LICENCE +0 -93
- data/vendor/libgit2/deps/pcre/cmake/COPYING-CMAKE-SCRIPTS +0 -22
- data/vendor/libgit2/deps/pcre/cmake/FindEditline.cmake +0 -17
- data/vendor/libgit2/deps/pcre/cmake/FindPackageHandleStandardArgs.cmake +0 -58
- data/vendor/libgit2/deps/pcre/cmake/FindReadline.cmake +0 -29
- data/vendor/libgit2/deps/pcre/config.h.in +0 -57
- data/vendor/libgit2/deps/pcre/pcre.h +0 -641
- data/vendor/libgit2/deps/pcre/pcre_byte_order.c +0 -319
- data/vendor/libgit2/deps/pcre/pcre_compile.c +0 -9815
- data/vendor/libgit2/deps/pcre/pcre_config.c +0 -190
- data/vendor/libgit2/deps/pcre/pcre_exec.c +0 -7173
- data/vendor/libgit2/deps/pcre/pcre_fullinfo.c +0 -245
- data/vendor/libgit2/deps/pcre/pcre_get.c +0 -669
- data/vendor/libgit2/deps/pcre/pcre_globals.c +0 -86
- data/vendor/libgit2/deps/pcre/pcre_internal.h +0 -2787
- data/vendor/libgit2/deps/pcre/pcre_jit_compile.c +0 -11913
- data/vendor/libgit2/deps/pcre/pcre_maketables.c +0 -156
- data/vendor/libgit2/deps/pcre/pcre_printint.c +0 -834
- data/vendor/libgit2/deps/pcre/pcre_string_utils.c +0 -211
- data/vendor/libgit2/deps/pcre/pcre_study.c +0 -1686
- data/vendor/libgit2/deps/pcre/pcre_tables.c +0 -727
- data/vendor/libgit2/deps/pcre/pcre_ucd.c +0 -3644
- data/vendor/libgit2/deps/pcre/pcre_valid_utf8.c +0 -301
- data/vendor/libgit2/deps/pcre/pcre_version.c +0 -98
- data/vendor/libgit2/deps/pcre/pcre_xclass.c +0 -268
- data/vendor/libgit2/deps/pcre/pcreposix.c +0 -420
- data/vendor/libgit2/deps/pcre/pcreposix.h +0 -117
- data/vendor/libgit2/deps/pcre/ucp.h +0 -224
|
@@ -77,6 +77,7 @@ static void submodule_get_index_status(unsigned int *, git_submodule *);
|
|
|
77
77
|
static void submodule_get_wd_status(unsigned int *, git_submodule *, git_repository *, git_submodule_ignore_t);
|
|
78
78
|
static void submodule_update_from_index_entry(git_submodule *sm, const git_index_entry *ie);
|
|
79
79
|
static void submodule_update_from_head_data(git_submodule *sm, mode_t mode, const git_oid *id);
|
|
80
|
+
static int path_is_valid(git_repository *repo, const char *path);
|
|
80
81
|
|
|
81
82
|
static int submodule_cmp(const void *a, const void *b)
|
|
82
83
|
{
|
|
@@ -221,6 +222,7 @@ static int load_submodule_names(git_submodule_namemap **out, git_repository *rep
|
|
|
221
222
|
|
|
222
223
|
while ((error = git_config_next(&entry, iter)) == 0) {
|
|
223
224
|
const char *fdot, *ldot;
|
|
225
|
+
|
|
224
226
|
fdot = strchr(entry->name, '.');
|
|
225
227
|
ldot = strrchr(entry->name, '.');
|
|
226
228
|
|
|
@@ -233,6 +235,7 @@ static int load_submodule_names(git_submodule_namemap **out, git_repository *rep
|
|
|
233
235
|
|
|
234
236
|
git_str_clear(&buf);
|
|
235
237
|
git_str_put(&buf, fdot + 1, ldot - fdot - 1);
|
|
238
|
+
|
|
236
239
|
isvalid = git_submodule_name_is_valid(repo, buf.ptr, 0);
|
|
237
240
|
if (isvalid < 0) {
|
|
238
241
|
error = isvalid;
|
|
@@ -241,6 +244,14 @@ static int load_submodule_names(git_submodule_namemap **out, git_repository *rep
|
|
|
241
244
|
if (!isvalid)
|
|
242
245
|
continue;
|
|
243
246
|
|
|
247
|
+
isvalid = path_is_valid(repo, entry->value);
|
|
248
|
+
if (isvalid < 0) {
|
|
249
|
+
error = isvalid;
|
|
250
|
+
goto out;
|
|
251
|
+
}
|
|
252
|
+
if (!isvalid)
|
|
253
|
+
continue;
|
|
254
|
+
|
|
244
255
|
if ((value = git__strdup(entry->value)) == NULL) {
|
|
245
256
|
error = -1;
|
|
246
257
|
goto out;
|
|
@@ -319,9 +330,9 @@ int git_submodule__lookup_with_cache(
|
|
|
319
330
|
const char *name, /* trailing slash is allowed */
|
|
320
331
|
git_submodule_cache *cache)
|
|
321
332
|
{
|
|
322
|
-
int error;
|
|
323
|
-
unsigned int location;
|
|
324
333
|
git_submodule *sm;
|
|
334
|
+
unsigned int location;
|
|
335
|
+
int error;
|
|
325
336
|
|
|
326
337
|
GIT_ASSERT_ARG(repo);
|
|
327
338
|
GIT_ASSERT_ARG(name);
|
|
@@ -344,7 +355,17 @@ int git_submodule__lookup_with_cache(
|
|
|
344
355
|
if ((error = submodule_alloc(&sm, repo, name)) < 0)
|
|
345
356
|
return error;
|
|
346
357
|
|
|
347
|
-
|
|
358
|
+
/*
|
|
359
|
+
* Only try to reload if they gave us a valid _name_; if this is a
|
|
360
|
+
* path, we'll do some lookups then try to reload to populate.
|
|
361
|
+
*/
|
|
362
|
+
if (git_submodule_name_is_valid(sm->repo, name, 0) <= 0) {
|
|
363
|
+
error = GIT_ENOTFOUND;
|
|
364
|
+
} else {
|
|
365
|
+
error = git_submodule_reload(sm, false);
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
if (error < 0 && error != GIT_ENOTFOUND) {
|
|
348
369
|
git_submodule_free(sm);
|
|
349
370
|
return error;
|
|
350
371
|
}
|
|
@@ -403,6 +424,7 @@ int git_submodule__lookup_with_cache(
|
|
|
403
424
|
/* If we still haven't found it, do the WD check */
|
|
404
425
|
if (location == 0 || location == GIT_SUBMODULE_STATUS_IN_WD) {
|
|
405
426
|
git_submodule_free(sm);
|
|
427
|
+
git_error_set(GIT_ERROR_SUBMODULE, "invalid submodule name: '%s'", name);
|
|
406
428
|
error = GIT_ENOTFOUND;
|
|
407
429
|
|
|
408
430
|
/* If it's not configured, we still check if there's a repo at the path */
|
|
@@ -454,6 +476,27 @@ int git_submodule_name_is_valid(git_repository *repo, const char *name, int flag
|
|
|
454
476
|
return isvalid;
|
|
455
477
|
}
|
|
456
478
|
|
|
479
|
+
static int path_is_valid(git_repository *repo, const char *path)
|
|
480
|
+
{
|
|
481
|
+
git_str buf = GIT_STR_INIT;
|
|
482
|
+
int flags = GIT_FS_PATH_REJECT_FILESYSTEM_DEFAULTS &
|
|
483
|
+
~GIT_FS_PATH_REJECT_EMPTY_COMPONENT;
|
|
484
|
+
int error, isvalid;
|
|
485
|
+
|
|
486
|
+
/* Avoid allocating a new string if we can avoid it */
|
|
487
|
+
if (strchr(path, '\\') != NULL) {
|
|
488
|
+
if ((error = git_fs_path_normalize_slashes(&buf, path)) < 0)
|
|
489
|
+
return error;
|
|
490
|
+
} else {
|
|
491
|
+
git_str_attach_notowned(&buf, path, strlen(path));
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
isvalid = git_path_is_valid(repo, buf.ptr, 0, flags);
|
|
495
|
+
git_str_dispose(&buf);
|
|
496
|
+
|
|
497
|
+
return isvalid;
|
|
498
|
+
}
|
|
499
|
+
|
|
457
500
|
static void submodule_free_dup(void *sm)
|
|
458
501
|
{
|
|
459
502
|
git_submodule_free(sm);
|
|
@@ -1721,18 +1764,34 @@ static int submodule_update_head(git_submodule *submodule)
|
|
|
1721
1764
|
return 0;
|
|
1722
1765
|
}
|
|
1723
1766
|
|
|
1767
|
+
static int submodule_name_error(const char *name)
|
|
1768
|
+
{
|
|
1769
|
+
git_error_set(GIT_ERROR_SUBMODULE,
|
|
1770
|
+
"invalid value for submodule name: '%s'", name);
|
|
1771
|
+
return GIT_EINVALID;
|
|
1772
|
+
}
|
|
1773
|
+
|
|
1774
|
+
static int submodule_config_error(const char *property, const char *value)
|
|
1775
|
+
{
|
|
1776
|
+
git_error_set(GIT_ERROR_SUBMODULE,
|
|
1777
|
+
"invalid value for submodule '%s' property: '%s'", property, value);
|
|
1778
|
+
return GIT_EINVALID;
|
|
1779
|
+
}
|
|
1780
|
+
|
|
1724
1781
|
int git_submodule_reload(git_submodule *sm, int force)
|
|
1725
1782
|
{
|
|
1726
1783
|
git_config *mods = NULL;
|
|
1727
|
-
int error;
|
|
1784
|
+
int valid, error = 0;
|
|
1728
1785
|
|
|
1729
1786
|
GIT_UNUSED(force);
|
|
1730
1787
|
|
|
1731
1788
|
GIT_ASSERT_ARG(sm);
|
|
1732
1789
|
|
|
1733
|
-
if ((
|
|
1790
|
+
if ((valid = git_submodule_name_is_valid(sm->repo, sm->name, 0)) <= 0) {
|
|
1734
1791
|
/* This should come with a warning, but we've no API for that */
|
|
1792
|
+
error = valid ? valid : submodule_name_error(sm->name);
|
|
1735
1793
|
goto out;
|
|
1794
|
+
}
|
|
1736
1795
|
|
|
1737
1796
|
if (git_repository_is_bare(sm->repo))
|
|
1738
1797
|
goto out;
|
|
@@ -1755,6 +1814,12 @@ int git_submodule_reload(git_submodule *sm, int force)
|
|
|
1755
1814
|
(error = submodule_update_head(sm)) < 0)
|
|
1756
1815
|
goto out;
|
|
1757
1816
|
|
|
1817
|
+
if ((valid = path_is_valid(sm->repo, sm->path)) <= 0) {
|
|
1818
|
+
/* This should come with a warning, but we've no API for that */
|
|
1819
|
+
error = valid ? valid : submodule_config_error("path", sm->path);
|
|
1820
|
+
goto out;
|
|
1821
|
+
}
|
|
1822
|
+
|
|
1758
1823
|
out:
|
|
1759
1824
|
git_config_free(mods);
|
|
1760
1825
|
return error;
|
|
@@ -1938,13 +2003,6 @@ void git_submodule_free(git_submodule *sm)
|
|
|
1938
2003
|
GIT_REFCOUNT_DEC(sm, submodule_release);
|
|
1939
2004
|
}
|
|
1940
2005
|
|
|
1941
|
-
static int submodule_config_error(const char *property, const char *value)
|
|
1942
|
-
{
|
|
1943
|
-
git_error_set(GIT_ERROR_INVALID,
|
|
1944
|
-
"invalid value for submodule '%s' property: '%s'", property, value);
|
|
1945
|
-
return -1;
|
|
1946
|
-
}
|
|
1947
|
-
|
|
1948
2006
|
int git_submodule_parse_ignore(git_submodule_ignore_t *out, const char *value)
|
|
1949
2007
|
{
|
|
1950
2008
|
int val;
|
|
@@ -2143,6 +2201,13 @@ static int submodule_load_each(const git_config_entry *entry, void *payload)
|
|
|
2143
2201
|
goto done;
|
|
2144
2202
|
}
|
|
2145
2203
|
|
|
2204
|
+
isvalid = path_is_valid(data->repo, sm->path);
|
|
2205
|
+
if (isvalid <= 0) {
|
|
2206
|
+
git_submodule_free(sm);
|
|
2207
|
+
error = isvalid;
|
|
2208
|
+
goto done;
|
|
2209
|
+
}
|
|
2210
|
+
|
|
2146
2211
|
if ((error = git_submodule_cache_put(cache, sm->name, sm)) < 0)
|
|
2147
2212
|
goto done;
|
|
2148
2213
|
|
|
@@ -130,12 +130,12 @@ GIT_INLINE(void) free_cred(git_credential **cred)
|
|
|
130
130
|
static int handle_auth(
|
|
131
131
|
http_server *server,
|
|
132
132
|
const char *server_type,
|
|
133
|
-
const char *url,
|
|
134
133
|
unsigned int allowed_schemetypes,
|
|
135
134
|
unsigned int allowed_credtypes,
|
|
136
135
|
git_credential_acquire_cb callback,
|
|
137
136
|
void *callback_payload)
|
|
138
137
|
{
|
|
138
|
+
git_str server_url = GIT_STR_INIT;
|
|
139
139
|
int error = 1;
|
|
140
140
|
|
|
141
141
|
if (server->cred)
|
|
@@ -154,7 +154,8 @@ static int handle_auth(
|
|
|
154
154
|
}
|
|
155
155
|
|
|
156
156
|
if (error > 0 && callback) {
|
|
157
|
-
error =
|
|
157
|
+
if ((error = git_net_url_fmt(&server_url, &server->url)) == 0)
|
|
158
|
+
error = callback(&server->cred, server_url.ptr, server->url.username, allowed_credtypes, callback_payload);
|
|
158
159
|
|
|
159
160
|
/* treat GIT_PASSTHROUGH as if callback isn't set */
|
|
160
161
|
if (error == GIT_PASSTHROUGH)
|
|
@@ -169,6 +170,7 @@ static int handle_auth(
|
|
|
169
170
|
if (!error)
|
|
170
171
|
server->auth_schemetypes = allowed_schemetypes;
|
|
171
172
|
|
|
173
|
+
git_str_dispose(&server_url);
|
|
172
174
|
return error;
|
|
173
175
|
}
|
|
174
176
|
|
|
@@ -188,7 +190,6 @@ GIT_INLINE(int) handle_remote_auth(
|
|
|
188
190
|
return handle_auth(
|
|
189
191
|
&transport->server,
|
|
190
192
|
SERVER_TYPE_REMOTE,
|
|
191
|
-
transport->owner->url,
|
|
192
193
|
response->server_auth_schemetypes,
|
|
193
194
|
response->server_auth_credtypes,
|
|
194
195
|
connect_opts->callbacks.credentials,
|
|
@@ -211,7 +212,6 @@ GIT_INLINE(int) handle_proxy_auth(
|
|
|
211
212
|
return handle_auth(
|
|
212
213
|
&transport->proxy,
|
|
213
214
|
SERVER_TYPE_PROXY,
|
|
214
|
-
connect_opts->proxy_opts.url,
|
|
215
215
|
response->server_auth_schemetypes,
|
|
216
216
|
response->proxy_auth_credtypes,
|
|
217
217
|
connect_opts->proxy_opts.credentials,
|
|
@@ -236,7 +236,8 @@ static int set_data(
|
|
|
236
236
|
len > (size_t)((caps - line) + 1)) {
|
|
237
237
|
caps++;
|
|
238
238
|
|
|
239
|
-
if (
|
|
239
|
+
if (len - (caps - line) >= CONST_STRLEN("object-format=") &&
|
|
240
|
+
strncmp(caps, "object-format=", CONST_STRLEN("object-format=")) == 0)
|
|
240
241
|
format_str = caps + CONST_STRLEN("object-format=");
|
|
241
242
|
else if ((format_str = git__memmem(caps, len - (caps - line), " object-format=", CONST_STRLEN(" object-format="))) != NULL)
|
|
242
243
|
format_str += CONST_STRLEN(" object-format=");
|
|
@@ -638,18 +638,18 @@ extern int git_fs_path_from_url_or_path(git_str *local_path_out, const char *url
|
|
|
638
638
|
*/
|
|
639
639
|
#ifdef GIT_WIN32
|
|
640
640
|
# define GIT_FS_PATH_REJECT_FILESYSTEM_DEFAULTS \
|
|
641
|
-
GIT_FS_PATH_REJECT_EMPTY_COMPONENT | \
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
641
|
+
(GIT_FS_PATH_REJECT_EMPTY_COMPONENT | \
|
|
642
|
+
GIT_FS_PATH_REJECT_TRAVERSAL | \
|
|
643
|
+
GIT_FS_PATH_REJECT_BACKSLASH | \
|
|
644
|
+
GIT_FS_PATH_REJECT_TRAILING_DOT | \
|
|
645
|
+
GIT_FS_PATH_REJECT_TRAILING_SPACE | \
|
|
646
|
+
GIT_FS_PATH_REJECT_TRAILING_COLON | \
|
|
647
|
+
GIT_FS_PATH_REJECT_DOS_PATHS | \
|
|
648
|
+
GIT_FS_PATH_REJECT_NT_CHARS)
|
|
649
649
|
#else
|
|
650
650
|
# define GIT_FS_PATH_REJECT_FILESYSTEM_DEFAULTS \
|
|
651
|
-
GIT_FS_PATH_REJECT_EMPTY_COMPONENT | \
|
|
652
|
-
|
|
651
|
+
(GIT_FS_PATH_REJECT_EMPTY_COMPONENT | \
|
|
652
|
+
GIT_FS_PATH_REJECT_TRAVERSAL)
|
|
653
653
|
#endif
|
|
654
654
|
|
|
655
655
|
/**
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
#include "regexp.h"
|
|
9
9
|
|
|
10
|
-
#if defined(
|
|
10
|
+
#if defined(GIT_REGEX_PCRE)
|
|
11
11
|
|
|
12
12
|
int git_regexp_compile(git_regexp *r, const char *pattern, int flags)
|
|
13
13
|
{
|
|
@@ -73,7 +73,7 @@ out:
|
|
|
73
73
|
return 0;
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
-
#elif defined(GIT_REGEX_PCRE2)
|
|
76
|
+
#elif defined(GIT_REGEX_BUILTIN) || defined(GIT_REGEX_PCRE2)
|
|
77
77
|
|
|
78
78
|
int git_regexp_compile(git_regexp *r, const char *pattern, int flags)
|
|
79
79
|
{
|
|
@@ -84,8 +84,9 @@ int git_regexp_compile(git_regexp *r, const char *pattern, int flags)
|
|
|
84
84
|
if (flags & GIT_REGEXP_ICASE)
|
|
85
85
|
cflags |= PCRE2_CASELESS;
|
|
86
86
|
|
|
87
|
-
if ((*r = pcre2_compile((const unsigned char *) pattern,
|
|
88
|
-
|
|
87
|
+
if ((*r = pcre2_compile((const unsigned char *) pattern,
|
|
88
|
+
PCRE2_ZERO_TERMINATED,
|
|
89
|
+
cflags, &error, &erroff, NULL)) == NULL) {
|
|
89
90
|
pcre2_get_error_message(error, errmsg, sizeof(errmsg));
|
|
90
91
|
git_error_set_str(GIT_ERROR_REGEX, (char *) errmsg);
|
|
91
92
|
return GIT_EINVALIDSPEC;
|
|
@@ -110,37 +111,51 @@ int git_regexp_match(const git_regexp *r, const char *string)
|
|
|
110
111
|
|
|
111
112
|
error = pcre2_match(*r, (const unsigned char *) string, strlen(string), 0, 0, data, NULL);
|
|
112
113
|
pcre2_match_data_free(data);
|
|
114
|
+
|
|
113
115
|
if (error < 0)
|
|
114
116
|
return (error == PCRE2_ERROR_NOMATCH) ? GIT_ENOTFOUND : GIT_EINVALIDSPEC;
|
|
115
117
|
|
|
116
118
|
return 0;
|
|
117
119
|
}
|
|
118
120
|
|
|
119
|
-
int git_regexp_search(
|
|
121
|
+
int git_regexp_search(
|
|
122
|
+
const git_regexp *r,
|
|
123
|
+
const char *string,
|
|
124
|
+
size_t given_nmatches,
|
|
125
|
+
git_regmatch *matches)
|
|
120
126
|
{
|
|
121
127
|
pcre2_match_data *data = NULL;
|
|
122
128
|
PCRE2_SIZE *ovec;
|
|
129
|
+
size_t i, captures;
|
|
130
|
+
uint32_t nmatches;
|
|
123
131
|
int error;
|
|
124
|
-
|
|
132
|
+
|
|
133
|
+
GIT_ASSERT(given_nmatches <= UINT32_MAX);
|
|
134
|
+
|
|
135
|
+
nmatches = (uint32_t) given_nmatches;
|
|
125
136
|
|
|
126
137
|
if ((data = pcre2_match_data_create(nmatches, NULL)) == NULL) {
|
|
127
138
|
git_error_set_oom();
|
|
128
139
|
return -1;
|
|
129
140
|
}
|
|
130
141
|
|
|
131
|
-
if ((error = pcre2_match(*r, (const unsigned char *) string,
|
|
132
|
-
|
|
142
|
+
if ((error = pcre2_match(*r, (const unsigned char *) string,
|
|
143
|
+
strlen(string), 0, 0, data, NULL)) < 0)
|
|
133
144
|
goto out;
|
|
134
145
|
|
|
135
|
-
|
|
136
|
-
|
|
146
|
+
captures = (size_t) error;
|
|
147
|
+
|
|
148
|
+
if (!captures || captures > nmatches)
|
|
149
|
+
captures = nmatches;
|
|
150
|
+
|
|
137
151
|
ovec = pcre2_get_ovector_pointer(data);
|
|
138
152
|
|
|
139
|
-
for (i = 0; i <
|
|
153
|
+
for (i = 0; i < captures; i++) {
|
|
140
154
|
matches[i].start = (ovec[i * 2] == PCRE2_UNSET) ? -1 : (ssize_t) ovec[i * 2];
|
|
141
155
|
matches[i].end = (ovec[i * 2 + 1] == PCRE2_UNSET) ? -1 : (ssize_t) ovec[i * 2 + 1];
|
|
142
156
|
}
|
|
143
|
-
|
|
157
|
+
|
|
158
|
+
for (i = captures; i < nmatches; i++)
|
|
144
159
|
matches[i].start = matches[i].end = -1;
|
|
145
160
|
|
|
146
161
|
out:
|
|
@@ -10,8 +10,13 @@
|
|
|
10
10
|
|
|
11
11
|
#include "git2_util.h"
|
|
12
12
|
|
|
13
|
-
#if defined(GIT_REGEX_BUILTIN)
|
|
14
|
-
#
|
|
13
|
+
#if defined(GIT_REGEX_BUILTIN)
|
|
14
|
+
# define PCRE2_CODE_UNIT_WIDTH 8
|
|
15
|
+
# include "pcre2.h"
|
|
16
|
+
typedef pcre2_code *git_regexp;
|
|
17
|
+
# define GIT_REGEX_INIT NULL
|
|
18
|
+
#elif defined(GIT_REGEX_PCRE)
|
|
19
|
+
# include <pcre.h>
|
|
15
20
|
typedef pcre *git_regexp;
|
|
16
21
|
# define GIT_REGEX_INIT NULL
|
|
17
22
|
#elif defined(GIT_REGEX_PCRE2)
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rugged
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.9.
|
|
4
|
+
version: 1.9.5.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Scott Chacon
|
|
8
8
|
- Vicent Marti
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-
|
|
11
|
+
date: 2026-07-19 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rake-compiler
|
|
@@ -195,41 +195,48 @@ files:
|
|
|
195
195
|
- vendor/libgit2/deps/ntlmclient/utf8.h
|
|
196
196
|
- vendor/libgit2/deps/ntlmclient/util.c
|
|
197
197
|
- vendor/libgit2/deps/ntlmclient/util.h
|
|
198
|
-
- vendor/libgit2/deps/
|
|
199
|
-
- vendor/libgit2/deps/
|
|
200
|
-
- vendor/libgit2/deps/
|
|
201
|
-
- vendor/libgit2/deps/
|
|
202
|
-
- vendor/libgit2/deps/
|
|
203
|
-
- vendor/libgit2/deps/
|
|
204
|
-
- vendor/libgit2/deps/
|
|
205
|
-
- vendor/libgit2/deps/
|
|
206
|
-
- vendor/libgit2/deps/
|
|
207
|
-
- vendor/libgit2/deps/
|
|
208
|
-
- vendor/libgit2/deps/
|
|
209
|
-
- vendor/libgit2/deps/
|
|
210
|
-
- vendor/libgit2/deps/
|
|
211
|
-
- vendor/libgit2/deps/
|
|
212
|
-
- vendor/libgit2/deps/
|
|
213
|
-
- vendor/libgit2/deps/
|
|
214
|
-
- vendor/libgit2/deps/
|
|
215
|
-
- vendor/libgit2/deps/
|
|
216
|
-
- vendor/libgit2/deps/
|
|
217
|
-
- vendor/libgit2/deps/
|
|
218
|
-
- vendor/libgit2/deps/
|
|
219
|
-
- vendor/libgit2/deps/
|
|
220
|
-
- vendor/libgit2/deps/
|
|
221
|
-
- vendor/libgit2/deps/
|
|
222
|
-
- vendor/libgit2/deps/
|
|
223
|
-
- vendor/libgit2/deps/
|
|
224
|
-
- vendor/libgit2/deps/
|
|
225
|
-
- vendor/libgit2/deps/
|
|
226
|
-
- vendor/libgit2/deps/
|
|
227
|
-
- vendor/libgit2/deps/
|
|
228
|
-
- vendor/libgit2/deps/
|
|
229
|
-
- vendor/libgit2/deps/
|
|
230
|
-
- vendor/libgit2/deps/
|
|
231
|
-
- vendor/libgit2/deps/
|
|
232
|
-
- vendor/libgit2/deps/
|
|
198
|
+
- vendor/libgit2/deps/pcre2/CMakeLists.txt
|
|
199
|
+
- vendor/libgit2/deps/pcre2/LICENCE.md
|
|
200
|
+
- vendor/libgit2/deps/pcre2/config.h.in
|
|
201
|
+
- vendor/libgit2/deps/pcre2/pcre2.h
|
|
202
|
+
- vendor/libgit2/deps/pcre2/pcre2_auto_possess.c
|
|
203
|
+
- vendor/libgit2/deps/pcre2/pcre2_chartables.c
|
|
204
|
+
- vendor/libgit2/deps/pcre2/pcre2_chkdint.c
|
|
205
|
+
- vendor/libgit2/deps/pcre2/pcre2_compile.c
|
|
206
|
+
- vendor/libgit2/deps/pcre2/pcre2_compile.h
|
|
207
|
+
- vendor/libgit2/deps/pcre2/pcre2_compile_cgroup.c
|
|
208
|
+
- vendor/libgit2/deps/pcre2/pcre2_compile_class.c
|
|
209
|
+
- vendor/libgit2/deps/pcre2/pcre2_config.c
|
|
210
|
+
- vendor/libgit2/deps/pcre2/pcre2_context.c
|
|
211
|
+
- vendor/libgit2/deps/pcre2/pcre2_convert.c
|
|
212
|
+
- vendor/libgit2/deps/pcre2/pcre2_dfa_match.c
|
|
213
|
+
- vendor/libgit2/deps/pcre2/pcre2_error.c
|
|
214
|
+
- vendor/libgit2/deps/pcre2/pcre2_extuni.c
|
|
215
|
+
- vendor/libgit2/deps/pcre2/pcre2_find_bracket.c
|
|
216
|
+
- vendor/libgit2/deps/pcre2/pcre2_fuzzsupport.c
|
|
217
|
+
- vendor/libgit2/deps/pcre2/pcre2_internal.h
|
|
218
|
+
- vendor/libgit2/deps/pcre2/pcre2_intmodedep.h
|
|
219
|
+
- vendor/libgit2/deps/pcre2/pcre2_maketables.c
|
|
220
|
+
- vendor/libgit2/deps/pcre2/pcre2_match.c
|
|
221
|
+
- vendor/libgit2/deps/pcre2/pcre2_match_data.c
|
|
222
|
+
- vendor/libgit2/deps/pcre2/pcre2_match_next.c
|
|
223
|
+
- vendor/libgit2/deps/pcre2/pcre2_newline.c
|
|
224
|
+
- vendor/libgit2/deps/pcre2/pcre2_ord2utf.c
|
|
225
|
+
- vendor/libgit2/deps/pcre2/pcre2_pattern_info.c
|
|
226
|
+
- vendor/libgit2/deps/pcre2/pcre2_printint_inc.h
|
|
227
|
+
- vendor/libgit2/deps/pcre2/pcre2_script_run.c
|
|
228
|
+
- vendor/libgit2/deps/pcre2/pcre2_serialize.c
|
|
229
|
+
- vendor/libgit2/deps/pcre2/pcre2_string_utils.c
|
|
230
|
+
- vendor/libgit2/deps/pcre2/pcre2_study.c
|
|
231
|
+
- vendor/libgit2/deps/pcre2/pcre2_substitute.c
|
|
232
|
+
- vendor/libgit2/deps/pcre2/pcre2_substring.c
|
|
233
|
+
- vendor/libgit2/deps/pcre2/pcre2_tables.c
|
|
234
|
+
- vendor/libgit2/deps/pcre2/pcre2_ucd.c
|
|
235
|
+
- vendor/libgit2/deps/pcre2/pcre2_ucp.h
|
|
236
|
+
- vendor/libgit2/deps/pcre2/pcre2_ucptables_inc.h
|
|
237
|
+
- vendor/libgit2/deps/pcre2/pcre2_util.h
|
|
238
|
+
- vendor/libgit2/deps/pcre2/pcre2_valid_utf.c
|
|
239
|
+
- vendor/libgit2/deps/pcre2/pcre2_xclass.c
|
|
233
240
|
- vendor/libgit2/deps/winhttp/CMakeLists.txt
|
|
234
241
|
- vendor/libgit2/deps/winhttp/COPYING.GPL
|
|
235
242
|
- vendor/libgit2/deps/winhttp/COPYING.LGPL
|
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
include(CheckIncludeFile)
|
|
2
|
-
include(CheckFunctionExists)
|
|
3
|
-
include(CheckTypeSize)
|
|
4
|
-
|
|
5
|
-
check_include_file(dirent.h HAVE_DIRENT_H)
|
|
6
|
-
check_include_file(stdint.h HAVE_STDINT_H)
|
|
7
|
-
check_include_file(inttypes.h HAVE_INTTYPES_H)
|
|
8
|
-
check_include_file(sys/stat.h HAVE_SYS_STAT_H)
|
|
9
|
-
check_include_file(sys/types.h HAVE_SYS_TYPES_H)
|
|
10
|
-
check_include_file(unistd.h HAVE_UNISTD_H)
|
|
11
|
-
check_include_file(windows.h HAVE_WINDOWS_H)
|
|
12
|
-
|
|
13
|
-
check_function_exists(bcopy HAVE_BCOPY)
|
|
14
|
-
check_function_exists(memmove HAVE_MEMMOVE)
|
|
15
|
-
check_function_exists(strerror HAVE_STRERROR)
|
|
16
|
-
check_function_exists(strtoll HAVE_STRTOLL)
|
|
17
|
-
check_function_exists(strtoq HAVE_STRTOQ)
|
|
18
|
-
check_function_exists(_strtoi64 HAVE__STRTOI64)
|
|
19
|
-
|
|
20
|
-
check_type_size("long long" LONG_LONG)
|
|
21
|
-
check_type_size("unsigned long long" UNSIGNED_LONG_LONG)
|
|
22
|
-
|
|
23
|
-
disable_warnings(unused-function)
|
|
24
|
-
disable_warnings(implicit-fallthrough)
|
|
25
|
-
disable_warnings(unused-but-set-variable)
|
|
26
|
-
disable_warnings(dangling-pointer)
|
|
27
|
-
|
|
28
|
-
# User-configurable options
|
|
29
|
-
|
|
30
|
-
set(SUPPORT_PCRE8 1)
|
|
31
|
-
set(PCRE_LINK_SIZE "2")
|
|
32
|
-
set(PCRE_PARENS_NEST_LIMIT "250")
|
|
33
|
-
set(PCRE_MATCH_LIMIT "10000000")
|
|
34
|
-
set(PCRE_MATCH_LIMIT_RECURSION "MATCH_LIMIT")
|
|
35
|
-
set(PCRE_NEWLINE "LF")
|
|
36
|
-
set(NO_RECURSE 1)
|
|
37
|
-
set(PCRE_POSIX_MALLOC_THRESHOLD "10")
|
|
38
|
-
set(BSR_ANYCRLF 0)
|
|
39
|
-
|
|
40
|
-
if(MINGW)
|
|
41
|
-
option(NON_STANDARD_LIB_PREFIX
|
|
42
|
-
"ON=Shared libraries built in mingw will be named pcre.dll, etc., instead of libpcre.dll, etc."
|
|
43
|
-
OFF)
|
|
44
|
-
|
|
45
|
-
option(NON_STANDARD_LIB_SUFFIX
|
|
46
|
-
"ON=Shared libraries built in mingw will be named libpcre-0.dll, etc., instead of libpcre.dll, etc."
|
|
47
|
-
OFF)
|
|
48
|
-
endif(MINGW)
|
|
49
|
-
|
|
50
|
-
# Prepare build configuration
|
|
51
|
-
|
|
52
|
-
set(pcre_have_long_long 0)
|
|
53
|
-
set(pcre_have_ulong_long 0)
|
|
54
|
-
|
|
55
|
-
if(HAVE_LONG_LONG)
|
|
56
|
-
set(pcre_have_long_long 1)
|
|
57
|
-
endif(HAVE_LONG_LONG)
|
|
58
|
-
|
|
59
|
-
if(HAVE_UNSIGNED_LONG_LONG)
|
|
60
|
-
set(pcre_have_ulong_long 1)
|
|
61
|
-
endif(HAVE_UNSIGNED_LONG_LONG)
|
|
62
|
-
|
|
63
|
-
set(NEWLINE "")
|
|
64
|
-
|
|
65
|
-
if(PCRE_NEWLINE STREQUAL "LF")
|
|
66
|
-
set(NEWLINE "10")
|
|
67
|
-
endif(PCRE_NEWLINE STREQUAL "LF")
|
|
68
|
-
if(PCRE_NEWLINE STREQUAL "CR")
|
|
69
|
-
set(NEWLINE "13")
|
|
70
|
-
endif(PCRE_NEWLINE STREQUAL "CR")
|
|
71
|
-
if(PCRE_NEWLINE STREQUAL "CRLF")
|
|
72
|
-
set(NEWLINE "3338")
|
|
73
|
-
endif(PCRE_NEWLINE STREQUAL "CRLF")
|
|
74
|
-
if(PCRE_NEWLINE STREQUAL "ANY")
|
|
75
|
-
set(NEWLINE "-1")
|
|
76
|
-
endif(PCRE_NEWLINE STREQUAL "ANY")
|
|
77
|
-
if(PCRE_NEWLINE STREQUAL "ANYCRLF")
|
|
78
|
-
set(NEWLINE "-2")
|
|
79
|
-
endif(PCRE_NEWLINE STREQUAL "ANYCRLF")
|
|
80
|
-
|
|
81
|
-
if(NEWLINE STREQUAL "")
|
|
82
|
-
message(FATAL_ERROR "The PCRE_NEWLINE variable must be set to one of the following values: \"LF\", \"CR\", \"CRLF\", \"ANY\", \"ANYCRLF\".")
|
|
83
|
-
endif(NEWLINE STREQUAL "")
|
|
84
|
-
|
|
85
|
-
# Output files
|
|
86
|
-
configure_file(config.h.in
|
|
87
|
-
${PROJECT_BINARY_DIR}/src/pcre/config.h
|
|
88
|
-
@ONLY)
|
|
89
|
-
|
|
90
|
-
# Source code
|
|
91
|
-
|
|
92
|
-
set(PCRE_HEADERS ${PROJECT_BINARY_DIR}/src/pcre/config.h)
|
|
93
|
-
|
|
94
|
-
set(PCRE_SOURCES
|
|
95
|
-
pcre_byte_order.c
|
|
96
|
-
pcre_chartables.c
|
|
97
|
-
pcre_compile.c
|
|
98
|
-
pcre_config.c
|
|
99
|
-
pcre_dfa_exec.c
|
|
100
|
-
pcre_exec.c
|
|
101
|
-
pcre_fullinfo.c
|
|
102
|
-
pcre_get.c
|
|
103
|
-
pcre_globals.c
|
|
104
|
-
pcre_jit_compile.c
|
|
105
|
-
pcre_maketables.c
|
|
106
|
-
pcre_newline.c
|
|
107
|
-
pcre_ord2utf8.c
|
|
108
|
-
pcre_refcount.c
|
|
109
|
-
pcre_string_utils.c
|
|
110
|
-
pcre_study.c
|
|
111
|
-
pcre_tables.c
|
|
112
|
-
pcre_ucd.c
|
|
113
|
-
pcre_valid_utf8.c
|
|
114
|
-
pcre_version.c
|
|
115
|
-
pcre_xclass.c
|
|
116
|
-
)
|
|
117
|
-
|
|
118
|
-
set(PCREPOSIX_HEADERS pcreposix.h)
|
|
119
|
-
|
|
120
|
-
set(PCREPOSIX_SOURCES pcreposix.c)
|
|
121
|
-
|
|
122
|
-
# Fix static compilation with MSVC: https://bugs.exim.org/show_bug.cgi?id=1681
|
|
123
|
-
# This code was taken from the CMake wiki, not from WebM.
|
|
124
|
-
|
|
125
|
-
# Build setup
|
|
126
|
-
|
|
127
|
-
add_definitions(-DHAVE_CONFIG_H)
|
|
128
|
-
|
|
129
|
-
if(MSVC)
|
|
130
|
-
add_definitions(-D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS)
|
|
131
|
-
endif()
|
|
132
|
-
|
|
133
|
-
set(CMAKE_INCLUDE_CURRENT_DIR 1)
|
|
134
|
-
|
|
135
|
-
set(targets)
|
|
136
|
-
|
|
137
|
-
# Libraries
|
|
138
|
-
# pcre
|
|
139
|
-
include_directories(${PROJECT_BINARY_DIR}/src/pcre)
|
|
140
|
-
add_library(pcre OBJECT ${PCRE_HEADERS} ${PCRE_SOURCES} ${PCREPOSIX_SOURCES})
|