rugged 1.9.0 → 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.
Files changed (188) hide show
  1. checksums.yaml +4 -4
  2. data/ext/rugged/extconf.rb +4 -4
  3. data/ext/rugged/rugged.c +12 -1
  4. data/ext/rugged/rugged_blame.c +22 -6
  5. data/ext/rugged/rugged_blob.c +24 -9
  6. data/ext/rugged/rugged_branch.c +10 -7
  7. data/ext/rugged/rugged_branch_collection.c +8 -6
  8. data/ext/rugged/rugged_commit.c +7 -6
  9. data/ext/rugged/rugged_config.c +20 -11
  10. data/ext/rugged/rugged_diff.c +26 -12
  11. data/ext/rugged/rugged_diff_hunk.c +2 -1
  12. data/ext/rugged/rugged_index.c +39 -29
  13. data/ext/rugged/rugged_note.c +7 -6
  14. data/ext/rugged/rugged_object.c +3 -2
  15. data/ext/rugged/rugged_patch.c +23 -9
  16. data/ext/rugged/rugged_rebase.c +22 -10
  17. data/ext/rugged/rugged_reference.c +22 -13
  18. data/ext/rugged/rugged_reference_collection.c +9 -7
  19. data/ext/rugged/rugged_remote.c +23 -12
  20. data/ext/rugged/rugged_remote_collection.c +11 -9
  21. data/ext/rugged/rugged_repo.c +60 -45
  22. data/ext/rugged/rugged_revwalk.c +22 -12
  23. data/ext/rugged/rugged_submodule.c +23 -20
  24. data/ext/rugged/rugged_submodule_collection.c +20 -9
  25. data/ext/rugged/rugged_tag.c +6 -4
  26. data/ext/rugged/rugged_tag_collection.c +7 -5
  27. data/ext/rugged/rugged_tree.c +27 -15
  28. data/lib/rugged/version.rb +1 -1
  29. data/vendor/libgit2/AUTHORS +2 -0
  30. data/vendor/libgit2/CMakeLists.txt +1 -1
  31. data/vendor/libgit2/COPYING +83 -11
  32. data/vendor/libgit2/cmake/DefaultCFlags.cmake +4 -1
  33. data/vendor/libgit2/cmake/SelectRegex.cmake +8 -3
  34. data/vendor/libgit2/cmake/SelectSSH.cmake +9 -3
  35. data/vendor/libgit2/deps/pcre2/CMakeLists.txt +110 -0
  36. data/vendor/libgit2/deps/pcre2/LICENCE.md +104 -0
  37. data/vendor/libgit2/deps/pcre2/config.h.in +54 -0
  38. data/vendor/libgit2/deps/pcre2/pcre2.h +1079 -0
  39. data/vendor/libgit2/deps/pcre2/pcre2_auto_possess.c +1416 -0
  40. data/vendor/libgit2/deps/{pcre/pcre_chartables.c → pcre2/pcre2_chartables.c} +41 -47
  41. data/vendor/libgit2/deps/{pcre/pcre_ord2utf8.c → pcre2/pcre2_chkdint.c} +36 -36
  42. data/vendor/libgit2/deps/pcre2/pcre2_compile.c +11345 -0
  43. data/vendor/libgit2/deps/pcre2/pcre2_compile.h +356 -0
  44. data/vendor/libgit2/deps/pcre2/pcre2_compile_cgroup.c +632 -0
  45. data/vendor/libgit2/deps/pcre2/pcre2_compile_class.c +2777 -0
  46. data/vendor/libgit2/deps/pcre2/pcre2_config.c +250 -0
  47. data/vendor/libgit2/deps/pcre2/pcre2_context.c +557 -0
  48. data/vendor/libgit2/deps/pcre2/pcre2_convert.c +1263 -0
  49. data/vendor/libgit2/deps/{pcre/pcre_dfa_exec.c → pcre2/pcre2_dfa_match.c} +1402 -943
  50. data/vendor/libgit2/deps/pcre2/pcre2_error.c +384 -0
  51. data/vendor/libgit2/deps/pcre2/pcre2_extuni.c +159 -0
  52. data/vendor/libgit2/deps/pcre2/pcre2_find_bracket.c +217 -0
  53. data/vendor/libgit2/deps/pcre2/pcre2_fuzzsupport.c +844 -0
  54. data/vendor/libgit2/deps/pcre2/pcre2_internal.h +2353 -0
  55. data/vendor/libgit2/deps/pcre2/pcre2_intmodedep.h +1044 -0
  56. data/vendor/libgit2/deps/pcre2/pcre2_maketables.c +177 -0
  57. data/vendor/libgit2/deps/pcre2/pcre2_match.c +8244 -0
  58. data/vendor/libgit2/deps/pcre2/pcre2_match_data.c +184 -0
  59. data/vendor/libgit2/deps/pcre2/pcre2_match_next.c +171 -0
  60. data/vendor/libgit2/deps/{pcre/pcre_newline.c → pcre2/pcre2_newline.c} +92 -63
  61. data/vendor/libgit2/deps/{pcre/pcre_refcount.c → pcre2/pcre2_ord2utf.c} +64 -38
  62. data/vendor/libgit2/deps/pcre2/pcre2_pattern_info.c +430 -0
  63. data/vendor/libgit2/deps/pcre2/pcre2_printint_inc.h +1098 -0
  64. data/vendor/libgit2/deps/pcre2/pcre2_script_run.c +344 -0
  65. data/vendor/libgit2/deps/pcre2/pcre2_serialize.c +284 -0
  66. data/vendor/libgit2/deps/pcre2/pcre2_string_utils.c +199 -0
  67. data/vendor/libgit2/deps/pcre2/pcre2_study.c +2087 -0
  68. data/vendor/libgit2/deps/pcre2/pcre2_substitute.c +1761 -0
  69. data/vendor/libgit2/deps/pcre2/pcre2_substring.c +553 -0
  70. data/vendor/libgit2/deps/pcre2/pcre2_tables.c +310 -0
  71. data/vendor/libgit2/deps/pcre2/pcre2_ucd.c +5805 -0
  72. data/vendor/libgit2/deps/pcre2/pcre2_ucp.h +408 -0
  73. data/vendor/libgit2/deps/pcre2/pcre2_ucptables_inc.h +1596 -0
  74. data/vendor/libgit2/deps/pcre2/pcre2_util.h +179 -0
  75. data/vendor/libgit2/deps/pcre2/pcre2_valid_utf.c +397 -0
  76. data/vendor/libgit2/deps/pcre2/pcre2_xclass.c +547 -0
  77. data/vendor/libgit2/deps/xdiff/CMakeLists.txt +1 -1
  78. data/vendor/libgit2/deps/xdiff/xmerge.c +14 -10
  79. data/vendor/libgit2/include/git2/common.h +13 -1
  80. data/vendor/libgit2/include/git2/deprecated.h +1 -1
  81. data/vendor/libgit2/include/git2/index.h +1 -1
  82. data/vendor/libgit2/include/git2/merge.h +4 -2
  83. data/vendor/libgit2/include/git2/oid.h +0 -1
  84. data/vendor/libgit2/include/git2/proxy.h +2 -3
  85. data/vendor/libgit2/include/git2/remote.h +19 -7
  86. data/vendor/libgit2/include/git2/stdint.h +1 -1
  87. data/vendor/libgit2/include/git2/sys/transport.h +1 -1
  88. data/vendor/libgit2/include/git2/version.h +4 -2
  89. data/vendor/libgit2/src/cli/CMakeLists.txt +1 -2
  90. data/vendor/libgit2/src/cli/opt.c +3 -3
  91. data/vendor/libgit2/src/cli/opt_usage.c +1 -1
  92. data/vendor/libgit2/src/libgit2/CMakeLists.txt +32 -16
  93. data/vendor/libgit2/src/libgit2/attr_file.c +10 -3
  94. data/vendor/libgit2/src/libgit2/blame.c +6 -0
  95. data/vendor/libgit2/src/libgit2/clone.c +6 -0
  96. data/vendor/libgit2/src/libgit2/commit.c +1 -1
  97. data/vendor/libgit2/src/libgit2/commit_graph.c +1 -2
  98. data/vendor/libgit2/src/libgit2/config.c +1 -1
  99. data/vendor/libgit2/src/libgit2/config_file.c +2 -1
  100. data/vendor/libgit2/src/libgit2/config_mem.c +1 -0
  101. data/vendor/libgit2/src/libgit2/config_parse.c +2 -1
  102. data/vendor/libgit2/src/libgit2/delta.c +13 -1
  103. data/vendor/libgit2/src/libgit2/diff_driver.c +1 -1
  104. data/vendor/libgit2/src/libgit2/diff_stats.c +19 -12
  105. data/vendor/libgit2/src/libgit2/fetchhead.c +1 -1
  106. data/vendor/libgit2/src/libgit2/index.c +8 -8
  107. data/vendor/libgit2/src/libgit2/index.h +3 -0
  108. data/vendor/libgit2/src/libgit2/indexer.c +5 -4
  109. data/vendor/libgit2/src/libgit2/merge.c +1 -1
  110. data/vendor/libgit2/src/libgit2/merge.h +4 -0
  111. data/vendor/libgit2/src/libgit2/merge_file.c +43 -30
  112. data/vendor/libgit2/src/libgit2/message.c +1 -1
  113. data/vendor/libgit2/src/libgit2/midx.c +2 -3
  114. data/vendor/libgit2/src/libgit2/odb.c +2 -6
  115. data/vendor/libgit2/src/libgit2/odb_loose.c +24 -14
  116. data/vendor/libgit2/src/libgit2/oid.c +4 -5
  117. data/vendor/libgit2/src/libgit2/pack-objects.c +2 -4
  118. data/vendor/libgit2/src/libgit2/pack.c +3 -0
  119. data/vendor/libgit2/src/libgit2/refs.c +15 -6
  120. data/vendor/libgit2/src/libgit2/remote.c +4 -1
  121. data/vendor/libgit2/src/libgit2/remote.h +0 -1
  122. data/vendor/libgit2/src/libgit2/repository.c +5 -4
  123. data/vendor/libgit2/src/libgit2/settings.c +9 -0
  124. data/vendor/libgit2/src/libgit2/streams/openssl.c +4 -1
  125. data/vendor/libgit2/src/libgit2/streams/socket.c +30 -0
  126. data/vendor/libgit2/src/libgit2/submodule.c +89 -17
  127. data/vendor/libgit2/src/libgit2/tag.c +3 -1
  128. data/vendor/libgit2/src/libgit2/transports/auth_sspi.c +2 -0
  129. data/vendor/libgit2/src/libgit2/transports/credential.c +1 -1
  130. data/vendor/libgit2/src/libgit2/transports/git.c +1 -1
  131. data/vendor/libgit2/src/libgit2/transports/http.c +4 -4
  132. data/vendor/libgit2/src/libgit2/transports/httpclient.c +12 -9
  133. data/vendor/libgit2/src/libgit2/transports/local.c +8 -1
  134. data/vendor/libgit2/src/libgit2/transports/smart.c +5 -5
  135. data/vendor/libgit2/src/libgit2/transports/smart_pkt.c +5 -4
  136. data/vendor/libgit2/src/libgit2/transports/ssh_exec.c +57 -18
  137. data/vendor/libgit2/src/libgit2/transports/ssh_libssh2.c +3 -3
  138. data/vendor/libgit2/src/util/CMakeLists.txt +3 -4
  139. data/vendor/libgit2/src/util/fs_path.c +66 -6
  140. data/vendor/libgit2/src/util/fs_path.h +16 -10
  141. data/vendor/libgit2/src/util/futils.h +11 -3
  142. data/vendor/libgit2/src/util/hash/builtin.c +14 -4
  143. data/vendor/libgit2/src/util/hash/openssl.c +0 -4
  144. data/vendor/libgit2/src/util/hash/rfc6234/sha224-256.c +8 -6
  145. data/vendor/libgit2/src/util/hashmap.h +1 -0
  146. data/vendor/libgit2/src/util/net.c +5 -5
  147. data/vendor/libgit2/src/util/process.h +2 -1
  148. data/vendor/libgit2/src/util/regexp.c +27 -12
  149. data/vendor/libgit2/src/util/regexp.h +7 -2
  150. data/vendor/libgit2/src/util/runtime.c +2 -2
  151. data/vendor/libgit2/src/util/str.c +18 -6
  152. data/vendor/libgit2/src/util/str.h +5 -3
  153. data/vendor/libgit2/src/util/unix/process.c +92 -15
  154. data/vendor/libgit2/src/util/util.c +16 -3
  155. data/vendor/libgit2/src/util/util.h +1 -0
  156. data/vendor/libgit2/src/util/win32/path_w32.c +81 -5
  157. data/vendor/libgit2/src/util/win32/process.c +22 -6
  158. metadata +59 -41
  159. data/vendor/libgit2/deps/pcre/CMakeLists.txt +0 -141
  160. data/vendor/libgit2/deps/pcre/COPYING +0 -5
  161. data/vendor/libgit2/deps/pcre/LICENCE +0 -93
  162. data/vendor/libgit2/deps/pcre/cmake/COPYING-CMAKE-SCRIPTS +0 -22
  163. data/vendor/libgit2/deps/pcre/cmake/FindEditline.cmake +0 -17
  164. data/vendor/libgit2/deps/pcre/cmake/FindPackageHandleStandardArgs.cmake +0 -58
  165. data/vendor/libgit2/deps/pcre/cmake/FindReadline.cmake +0 -29
  166. data/vendor/libgit2/deps/pcre/config.h.in +0 -57
  167. data/vendor/libgit2/deps/pcre/pcre.h +0 -641
  168. data/vendor/libgit2/deps/pcre/pcre_byte_order.c +0 -319
  169. data/vendor/libgit2/deps/pcre/pcre_compile.c +0 -9815
  170. data/vendor/libgit2/deps/pcre/pcre_config.c +0 -190
  171. data/vendor/libgit2/deps/pcre/pcre_exec.c +0 -7173
  172. data/vendor/libgit2/deps/pcre/pcre_fullinfo.c +0 -245
  173. data/vendor/libgit2/deps/pcre/pcre_get.c +0 -669
  174. data/vendor/libgit2/deps/pcre/pcre_globals.c +0 -86
  175. data/vendor/libgit2/deps/pcre/pcre_internal.h +0 -2787
  176. data/vendor/libgit2/deps/pcre/pcre_jit_compile.c +0 -11913
  177. data/vendor/libgit2/deps/pcre/pcre_maketables.c +0 -156
  178. data/vendor/libgit2/deps/pcre/pcre_printint.c +0 -834
  179. data/vendor/libgit2/deps/pcre/pcre_string_utils.c +0 -211
  180. data/vendor/libgit2/deps/pcre/pcre_study.c +0 -1686
  181. data/vendor/libgit2/deps/pcre/pcre_tables.c +0 -727
  182. data/vendor/libgit2/deps/pcre/pcre_ucd.c +0 -3644
  183. data/vendor/libgit2/deps/pcre/pcre_valid_utf8.c +0 -301
  184. data/vendor/libgit2/deps/pcre/pcre_version.c +0 -98
  185. data/vendor/libgit2/deps/pcre/pcre_xclass.c +0 -268
  186. data/vendor/libgit2/deps/pcre/pcreposix.c +0 -420
  187. data/vendor/libgit2/deps/pcre/pcreposix.h +0 -117
  188. data/vendor/libgit2/deps/pcre/ucp.h +0 -224
@@ -0,0 +1,547 @@
1
+ /*************************************************
2
+ * Perl-Compatible Regular Expressions *
3
+ *************************************************/
4
+
5
+ /* PCRE is a library of functions to support regular expressions whose syntax
6
+ and semantics are as close as possible to those of the Perl 5 language.
7
+
8
+ Written by Philip Hazel
9
+ Original API code Copyright (c) 1997-2012 University of Cambridge
10
+ New API code Copyright (c) 2016-2024 University of Cambridge
11
+
12
+ -----------------------------------------------------------------------------
13
+ Redistribution and use in source and binary forms, with or without
14
+ modification, are permitted provided that the following conditions are met:
15
+
16
+ * Redistributions of source code must retain the above copyright notice,
17
+ this list of conditions and the following disclaimer.
18
+
19
+ * Redistributions in binary form must reproduce the above copyright
20
+ notice, this list of conditions and the following disclaimer in the
21
+ documentation and/or other materials provided with the distribution.
22
+
23
+ * Neither the name of the University of Cambridge nor the names of its
24
+ contributors may be used to endorse or promote products derived from
25
+ this software without specific prior written permission.
26
+
27
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
28
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
29
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
30
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
31
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
32
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
33
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
34
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
35
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
36
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
37
+ POSSIBILITY OF SUCH DAMAGE.
38
+ -----------------------------------------------------------------------------
39
+ */
40
+
41
+
42
+ /* This module contains two internal functions that are used to match
43
+ OP_XCLASS and OP_ECLASS. It is used by pcre2_auto_possessify() and by both
44
+ pcre2_match() and pcre2_dfa_match(). */
45
+
46
+
47
+ #include "pcre2_internal.h"
48
+
49
+
50
+
51
+ /*************************************************
52
+ * Match character against an XCLASS *
53
+ *************************************************/
54
+
55
+ /* This function is called to match a character against an extended class that
56
+ might contain codepoints above 255 and/or Unicode properties.
57
+
58
+ Arguments:
59
+ c the character
60
+ data points to the flag code unit of the XCLASS data
61
+ utf TRUE if in UTF mode
62
+
63
+ Returns: TRUE if character matches, else FALSE
64
+ */
65
+
66
+ BOOL
67
+ PRIV(xclass)(uint32_t c, PCRE2_SPTR data, const uint8_t *char_lists_end, BOOL utf)
68
+ {
69
+ /* Update PRIV(update_classbits) when this function is changed. */
70
+ PCRE2_UCHAR t;
71
+ BOOL not_negated = (*data & XCL_NOT) == 0;
72
+ uint32_t type, max_index, min_index, value;
73
+ const uint8_t *next_char;
74
+
75
+ #if PCRE2_CODE_UNIT_WIDTH == 8
76
+ /* In 8 bit mode, this must always be TRUE. Help the compiler to know that. */
77
+ utf = TRUE;
78
+ #endif
79
+
80
+ /* Code points < 256 are matched against a bitmap, if one is present. */
81
+
82
+ if ((*data++ & XCL_MAP) != 0)
83
+ {
84
+ if (c < 256)
85
+ return (((const uint8_t *)data)[c/8] & (1u << (c&7))) != 0;
86
+ /* Skip bitmap. */
87
+ data += 32 / sizeof(PCRE2_UCHAR);
88
+ }
89
+
90
+ /* Match against the list of Unicode properties. We won't ever
91
+ encounter XCL_PROP or XCL_NOTPROP when UTF support is not compiled. */
92
+ #ifdef SUPPORT_UNICODE
93
+ if (*data == XCL_PROP || *data == XCL_NOTPROP)
94
+ {
95
+ /* The UCD record is the same for all properties. */
96
+ const ucd_record *prop = GET_UCD(c);
97
+
98
+ do
99
+ {
100
+ int chartype;
101
+ BOOL isprop = (*data++) == XCL_PROP;
102
+ BOOL ok;
103
+
104
+ switch(*data)
105
+ {
106
+ case PT_LAMP:
107
+ chartype = prop->chartype;
108
+ if ((chartype == ucp_Lu || chartype == ucp_Ll ||
109
+ chartype == ucp_Lt) == isprop) return not_negated;
110
+ break;
111
+
112
+ case PT_GC:
113
+ if ((data[1] == PRIV(ucp_gentype)[prop->chartype]) == isprop)
114
+ return not_negated;
115
+ break;
116
+
117
+ case PT_PC:
118
+ if ((data[1] == prop->chartype) == isprop) return not_negated;
119
+ break;
120
+
121
+ case PT_SC:
122
+ if ((data[1] == prop->script) == isprop) return not_negated;
123
+ break;
124
+
125
+ case PT_SCX:
126
+ ok = (data[1] == prop->script ||
127
+ MAPBIT(PRIV(ucd_script_sets) + UCD_SCRIPTX_PROP(prop), data[1]) != 0);
128
+ if (ok == isprop) return not_negated;
129
+ break;
130
+
131
+ case PT_ALNUM:
132
+ chartype = prop->chartype;
133
+ if ((PRIV(ucp_gentype)[chartype] == ucp_L ||
134
+ PRIV(ucp_gentype)[chartype] == ucp_N) == isprop)
135
+ return not_negated;
136
+ break;
137
+
138
+ /* Perl space used to exclude VT, but from Perl 5.18 it is included,
139
+ which means that Perl space and POSIX space are now identical. PCRE
140
+ was changed at release 8.34. */
141
+
142
+ case PT_SPACE: /* Perl space */
143
+ case PT_PXSPACE: /* POSIX space */
144
+ switch(c)
145
+ {
146
+ HSPACE_CASES:
147
+ VSPACE_CASES:
148
+ if (isprop) return not_negated;
149
+ break;
150
+
151
+ default:
152
+ if ((PRIV(ucp_gentype)[prop->chartype] == ucp_Z) == isprop)
153
+ return not_negated;
154
+ break;
155
+ }
156
+ break;
157
+
158
+ case PT_WORD:
159
+ chartype = prop->chartype;
160
+ if ((PRIV(ucp_gentype)[chartype] == ucp_L ||
161
+ PRIV(ucp_gentype)[chartype] == ucp_N ||
162
+ chartype == ucp_Mn || chartype == ucp_Pc) == isprop)
163
+ return not_negated;
164
+ break;
165
+
166
+ case PT_UCNC:
167
+ if (c < 0xa0)
168
+ {
169
+ if ((c == CHAR_DOLLAR_SIGN || c == CHAR_COMMERCIAL_AT ||
170
+ c == CHAR_GRAVE_ACCENT) == isprop)
171
+ return not_negated;
172
+ }
173
+ else
174
+ {
175
+ if ((c < 0xd800 || c > 0xdfff) == isprop)
176
+ return not_negated;
177
+ }
178
+ break;
179
+
180
+ case PT_BIDICL:
181
+ if ((UCD_BIDICLASS_PROP(prop) == data[1]) == isprop)
182
+ return not_negated;
183
+ break;
184
+
185
+ case PT_BOOL:
186
+ ok = MAPBIT(PRIV(ucd_boolprop_sets) +
187
+ UCD_BPROPS_PROP(prop), data[1]) != 0;
188
+ if (ok == isprop) return not_negated;
189
+ break;
190
+
191
+ /* The following three properties can occur only in an XCLASS, as there
192
+ is no \p or \P coding for them. */
193
+
194
+ /* Graphic character. Implement this as not Z (space or separator) and
195
+ not C (other), except for Cf (format) with a few exceptions. This seems
196
+ to be what Perl does. The exceptional characters are:
197
+
198
+ U+061C Arabic Letter Mark
199
+ U+180E Mongolian Vowel Separator
200
+ U+2066 - U+2069 Various "isolate"s
201
+ */
202
+
203
+ case PT_PXGRAPH:
204
+ chartype = prop->chartype;
205
+ if ((PRIV(ucp_gentype)[chartype] != ucp_Z &&
206
+ (PRIV(ucp_gentype)[chartype] != ucp_C ||
207
+ (chartype == ucp_Cf &&
208
+ c != 0x061c && c != 0x180e && (c < 0x2066 || c > 0x2069))
209
+ )) == isprop)
210
+ return not_negated;
211
+ break;
212
+
213
+ /* Printable character: same as graphic, with the addition of Zs, i.e.
214
+ not Zl and not Zp, and U+180E. */
215
+
216
+ case PT_PXPRINT:
217
+ chartype = prop->chartype;
218
+ if ((chartype != ucp_Zl &&
219
+ chartype != ucp_Zp &&
220
+ (PRIV(ucp_gentype)[chartype] != ucp_C ||
221
+ (chartype == ucp_Cf &&
222
+ c != 0x061c && (c < 0x2066 || c > 0x2069))
223
+ )) == isprop)
224
+ return not_negated;
225
+ break;
226
+
227
+ /* Punctuation: all Unicode punctuation, plus ASCII characters that
228
+ Unicode treats as symbols rather than punctuation, for Perl
229
+ compatibility (these are $+<=>^`|~). */
230
+
231
+ case PT_PXPUNCT:
232
+ chartype = prop->chartype;
233
+ if ((PRIV(ucp_gentype)[chartype] == ucp_P ||
234
+ (c < 128 && PRIV(ucp_gentype)[chartype] == ucp_S)) == isprop)
235
+ return not_negated;
236
+ break;
237
+
238
+ /* Perl has two sets of hex digits */
239
+
240
+ case PT_PXXDIGIT:
241
+ if (((c >= CHAR_0 && c <= CHAR_9) ||
242
+ (c >= CHAR_A && c <= CHAR_F) ||
243
+ (c >= CHAR_a && c <= CHAR_f) ||
244
+ (c >= 0xff10 && c <= 0xff19) || /* Fullwidth digits */
245
+ (c >= 0xff21 && c <= 0xff26) || /* Fullwidth letters */
246
+ (c >= 0xff41 && c <= 0xff46)) == isprop)
247
+ return not_negated;
248
+ break;
249
+
250
+ /* This should never occur, but compilers may mutter if there is no
251
+ default. */
252
+
253
+ /* LCOV_EXCL_START */
254
+ default:
255
+ PCRE2_DEBUG_UNREACHABLE();
256
+ return FALSE;
257
+ /* LCOV_EXCL_STOP */
258
+ }
259
+
260
+ data += 2;
261
+ }
262
+ while (*data == XCL_PROP || *data == XCL_NOTPROP);
263
+ }
264
+ #else
265
+ (void)utf; /* Avoid compiler warning */
266
+ #endif /* SUPPORT_UNICODE */
267
+
268
+ /* Match against large chars or ranges that end with a large char. */
269
+ if (*data < XCL_LIST)
270
+ {
271
+ while ((t = *data++) != XCL_END)
272
+ {
273
+ uint32_t x, y;
274
+
275
+ #ifdef SUPPORT_UNICODE
276
+ if (utf)
277
+ {
278
+ GETCHARINC(x, data); /* macro generates multiple statements */
279
+ }
280
+ else
281
+ #endif
282
+ x = *data++;
283
+
284
+ if (t == XCL_SINGLE)
285
+ {
286
+ /* Since character ranges follow the properties, and they are
287
+ sorted, early return is possible for all characters <= x. */
288
+ if (c <= x) return (c == x) ? not_negated : !not_negated;
289
+ continue;
290
+ }
291
+
292
+ PCRE2_ASSERT(t == XCL_RANGE);
293
+ #ifdef SUPPORT_UNICODE
294
+ if (utf)
295
+ {
296
+ GETCHARINC(y, data); /* macro generates multiple statements */
297
+ }
298
+ else
299
+ #endif
300
+ y = *data++;
301
+
302
+ /* Since character ranges follow the properties, and they are
303
+ sorted, early return is possible for all characters <= y. */
304
+ if (c <= y) return (c >= x) ? not_negated : !not_negated;
305
+ }
306
+
307
+ return !not_negated; /* char did not match */
308
+ }
309
+
310
+ #if PCRE2_CODE_UNIT_WIDTH == 8
311
+ type = (uint32_t)(data[0] << 8) | data[1];
312
+ data += 2;
313
+ #else
314
+ type = data[0];
315
+ data++;
316
+ #endif /* CODE_UNIT_WIDTH */
317
+
318
+ /* Align characters. */
319
+ next_char = char_lists_end - (GET(data, 0) << 1);
320
+ type &= XCL_TYPE_MASK;
321
+
322
+ /* Alignment check. */
323
+ PCRE2_ASSERT(((uintptr_t)next_char & 0x1) == 0);
324
+
325
+ if (c >= XCL_CHAR_LIST_HIGH_16_START)
326
+ {
327
+ max_index = type & XCL_ITEM_COUNT_MASK;
328
+ if (max_index == XCL_ITEM_COUNT_MASK)
329
+ {
330
+ max_index = *(const uint16_t*)next_char;
331
+ PCRE2_ASSERT(max_index >= XCL_ITEM_COUNT_MASK);
332
+ next_char += 2;
333
+ }
334
+
335
+ next_char += max_index << 1;
336
+ type >>= XCL_TYPE_BIT_LEN;
337
+ }
338
+
339
+ if (c < XCL_CHAR_LIST_LOW_32_START)
340
+ {
341
+ max_index = type & XCL_ITEM_COUNT_MASK;
342
+
343
+ c = (uint16_t)((c << XCL_CHAR_SHIFT) | XCL_CHAR_END);
344
+
345
+ if (max_index == XCL_ITEM_COUNT_MASK)
346
+ {
347
+ max_index = *(const uint16_t*)next_char;
348
+ PCRE2_ASSERT(max_index >= XCL_ITEM_COUNT_MASK);
349
+ next_char += 2;
350
+ }
351
+
352
+ if (max_index == 0 || c < *(const uint16_t*)next_char)
353
+ return ((type & XCL_BEGIN_WITH_RANGE) != 0) == not_negated;
354
+
355
+ min_index = 0;
356
+ value = ((const uint16_t*)next_char)[--max_index];
357
+ if (c >= value)
358
+ return (value == c || (value & XCL_CHAR_END) == 0) == not_negated;
359
+
360
+ max_index--;
361
+
362
+ /* Binary search of a range. */
363
+ while (TRUE)
364
+ {
365
+ uint32_t mid_index = (min_index + max_index) >> 1;
366
+ value = ((const uint16_t*)next_char)[mid_index];
367
+
368
+ if (c < value)
369
+ max_index = mid_index - 1;
370
+ else if (((const uint16_t*)next_char)[mid_index + 1] <= c)
371
+ min_index = mid_index + 1;
372
+ else
373
+ return (value == c || (value & XCL_CHAR_END) == 0) == not_negated;
374
+ }
375
+ }
376
+
377
+ /* Skip the 16 bit ranges. */
378
+ max_index = type & XCL_ITEM_COUNT_MASK;
379
+ if (max_index == XCL_ITEM_COUNT_MASK)
380
+ {
381
+ max_index = *(const uint16_t*)next_char;
382
+ PCRE2_ASSERT(max_index >= XCL_ITEM_COUNT_MASK);
383
+ next_char += 2;
384
+ }
385
+
386
+ next_char += (max_index << 1);
387
+ type >>= XCL_TYPE_BIT_LEN;
388
+
389
+ /* Alignment check. */
390
+ PCRE2_ASSERT(((uintptr_t)next_char & 0x3) == 0);
391
+
392
+ max_index = type & XCL_ITEM_COUNT_MASK;
393
+
394
+ #if PCRE2_CODE_UNIT_WIDTH == 32
395
+ if (c >= XCL_CHAR_LIST_HIGH_32_START)
396
+ {
397
+ if (max_index == XCL_ITEM_COUNT_MASK)
398
+ {
399
+ max_index = *(const uint32_t*)next_char;
400
+ PCRE2_ASSERT(max_index >= XCL_ITEM_COUNT_MASK);
401
+ next_char += 4;
402
+ }
403
+
404
+ next_char += max_index << 2;
405
+ type >>= XCL_TYPE_BIT_LEN;
406
+ max_index = type & XCL_ITEM_COUNT_MASK;
407
+ }
408
+ #endif
409
+
410
+ c = (uint32_t)((c << XCL_CHAR_SHIFT) | XCL_CHAR_END);
411
+
412
+ if (max_index == XCL_ITEM_COUNT_MASK)
413
+ {
414
+ max_index = *(const uint32_t*)next_char;
415
+ next_char += 4;
416
+ }
417
+
418
+ if (max_index == 0 || c < *(const uint32_t*)next_char)
419
+ return ((type & XCL_BEGIN_WITH_RANGE) != 0) == not_negated;
420
+
421
+ min_index = 0;
422
+ value = ((const uint32_t*)next_char)[--max_index];
423
+ if (c >= value)
424
+ return (value == c || (value & XCL_CHAR_END) == 0) == not_negated;
425
+
426
+ max_index--;
427
+
428
+ /* Binary search of a range. */
429
+ while (TRUE)
430
+ {
431
+ uint32_t mid_index = (min_index + max_index) >> 1;
432
+ value = ((const uint32_t*)next_char)[mid_index];
433
+
434
+ if (c < value)
435
+ max_index = mid_index - 1;
436
+ else if (((const uint32_t*)next_char)[mid_index + 1] <= c)
437
+ min_index = mid_index + 1;
438
+ else
439
+ return (value == c || (value & XCL_CHAR_END) == 0) == not_negated;
440
+ }
441
+ }
442
+
443
+
444
+
445
+ /*************************************************
446
+ * Match character against an ECLASS *
447
+ *************************************************/
448
+
449
+ /* This function is called to match a character against an extended class
450
+ used for describing characters using boolean operations on sets.
451
+
452
+ Arguments:
453
+ c the character
454
+ data_start points to the start of the ECLASS data
455
+ data_end points one-past-the-last of the ECLASS data
456
+ utf TRUE if in UTF mode
457
+
458
+ Returns: TRUE if character matches, else FALSE
459
+ */
460
+
461
+ BOOL
462
+ PRIV(eclass)(uint32_t c, PCRE2_SPTR data_start, PCRE2_SPTR data_end,
463
+ const uint8_t *char_lists_end, BOOL utf)
464
+ {
465
+ PCRE2_SPTR ptr = data_start;
466
+ PCRE2_UCHAR flags;
467
+ uint32_t stack = 0;
468
+ int stack_depth = 0;
469
+
470
+ PCRE2_ASSERT(data_start < data_end);
471
+ flags = *ptr++;
472
+ PCRE2_ASSERT((flags & ECL_MAP) == 0 ||
473
+ (data_end - ptr) >= 32 / (int)sizeof(PCRE2_UCHAR));
474
+
475
+ /* Code points < 256 are matched against a bitmap, if one is present.
476
+ Otherwise all codepoints are checked later. */
477
+
478
+ if ((flags & ECL_MAP) != 0)
479
+ {
480
+ if (c < 256)
481
+ return (((const uint8_t *)ptr)[c/8] & (1u << (c&7))) != 0;
482
+
483
+ /* Skip the bitmap. */
484
+ ptr += 32 / sizeof(PCRE2_UCHAR);
485
+ }
486
+
487
+ /* Do a little loop, until we reach the end of the ECLASS. */
488
+ while (ptr < data_end)
489
+ {
490
+ switch (*ptr)
491
+ {
492
+ case ECL_AND:
493
+ ++ptr;
494
+ stack = (stack >> 1) & (stack | ~(uint32_t)1u);
495
+ PCRE2_ASSERT(stack_depth >= 2);
496
+ --stack_depth;
497
+ break;
498
+
499
+ case ECL_OR:
500
+ ++ptr;
501
+ stack = (stack >> 1) | (stack & (uint32_t)1u);
502
+ PCRE2_ASSERT(stack_depth >= 2);
503
+ --stack_depth;
504
+ break;
505
+
506
+ case ECL_XOR:
507
+ ++ptr;
508
+ stack = (stack >> 1) ^ (stack & (uint32_t)1u);
509
+ PCRE2_ASSERT(stack_depth >= 2);
510
+ --stack_depth;
511
+ break;
512
+
513
+ case ECL_NOT:
514
+ ++ptr;
515
+ stack ^= (uint32_t)1u;
516
+ PCRE2_ASSERT(stack_depth >= 1);
517
+ break;
518
+
519
+ case ECL_XCLASS:
520
+ {
521
+ uint32_t matched = PRIV(xclass)(c, ptr + 1 + LINK_SIZE, char_lists_end, utf);
522
+
523
+ ptr += GET(ptr, 1);
524
+ stack = (stack << 1) | matched;
525
+ ++stack_depth;
526
+ break;
527
+ }
528
+
529
+ /* This should never occur, but compilers may mutter if there is no
530
+ default. */
531
+
532
+ /* LCOV_EXCL_START */
533
+ default:
534
+ PCRE2_DEBUG_UNREACHABLE();
535
+ return FALSE;
536
+ /* LCOV_EXCL_STOP */
537
+ }
538
+ }
539
+
540
+ PCRE2_ASSERT(stack_depth == 1);
541
+ (void)stack_depth; /* Ignore unused variable, if assertions are disabled. */
542
+
543
+ /* The final bit left on the stack now holds the match result. */
544
+ return (stack & 1u) != 0;
545
+ }
546
+
547
+ /* End of pcre2_xclass.c */
@@ -6,7 +6,7 @@ add_library(xdiff OBJECT ${SRC_XDIFF})
6
6
  target_include_directories(xdiff SYSTEM PRIVATE
7
7
  "${PROJECT_SOURCE_DIR}/include"
8
8
  "${PROJECT_SOURCE_DIR}/src/util"
9
- "${PROJECT_BINARY_DIR}/src/util"
9
+ "${PROJECT_BINARY_DIR}/gen_headers"
10
10
  ${LIBGIT2_SYSTEM_INCLUDES}
11
11
  ${LIBGIT2_DEPENDENCY_INCLUDES})
12
12
 
@@ -709,19 +709,23 @@ int xdl_merge(mmfile_t *orig, mmfile_t *mf1, mmfile_t *mf2,
709
709
  goto out;
710
710
 
711
711
  if (!xscr1) {
712
- result->ptr = xdl_malloc(mf2->size);
713
- if (!result->ptr)
714
- goto out;
712
+ if (mf2->size) {
713
+ result->ptr = xdl_malloc(mf2->size);
714
+ if (!result->ptr)
715
+ goto out;
716
+ memcpy(result->ptr, mf2->ptr, mf2->size);
717
+ result->size = mf2->size;
718
+ }
715
719
  status = 0;
716
- memcpy(result->ptr, mf2->ptr, mf2->size);
717
- result->size = mf2->size;
718
720
  } else if (!xscr2) {
719
- result->ptr = xdl_malloc(mf1->size);
720
- if (!result->ptr)
721
- goto out;
721
+ if (mf1->size) {
722
+ result->ptr = xdl_malloc(mf1->size);
723
+ if (!result->ptr)
724
+ goto out;
725
+ memcpy(result->ptr, mf1->ptr, mf1->size);
726
+ result->size = mf1->size;
727
+ }
722
728
  status = 0;
723
- memcpy(result->ptr, mf1->ptr, mf1->size);
724
- result->size = mf1->size;
725
729
  } else {
726
730
  status = xdl_do_merge(&xe1, xscr1,
727
731
  &xe2, xscr2,
@@ -257,7 +257,9 @@ typedef enum {
257
257
  GIT_OPT_GET_SERVER_TIMEOUT,
258
258
  GIT_OPT_SET_USER_AGENT_PRODUCT,
259
259
  GIT_OPT_GET_USER_AGENT_PRODUCT,
260
- GIT_OPT_ADD_SSL_X509_CERT
260
+ GIT_OPT_ADD_SSL_X509_CERT,
261
+ GIT_OPT_GET_PACK_MAX_OBJECT_SIZE,
262
+ GIT_OPT_SET_PACK_MAX_OBJECT_SIZE
261
263
  } git_libgit2_opt_t;
262
264
 
263
265
  /**
@@ -563,6 +565,16 @@ typedef enum {
563
565
  * > Sets the timeout (in milliseconds) for reading from and writing
564
566
  * > to a remote server. Set to 0 to use the system default.
565
567
  *
568
+ * opts(GIT_OPT_GET_PACK_MAX_OBJECT_SIZE, size_t *out)
569
+ * > Gets the maximum size of a declared packfile object. This can
570
+ * > be used to limit maximum memory usage when fetching from a
571
+ * > remote.
572
+ *
573
+ * opts(GIT_OPT_SET_PACK_MAX_OBJECT_SIZE, size_t object_size)
574
+ * > Set the maximum size of an object that libgit2 will allow in
575
+ * > a pack file when downloading a pack file from a remote.
576
+ * > The default is 2 GiB.
577
+ *
566
578
  * @param option Option key
567
579
  * @return 0 on success, <0 on failure
568
580
  */
@@ -503,7 +503,7 @@ GIT_EXTERN(int) git_diff_format_email_options_init(
503
503
  GIT_EXTERN(const git_error *) giterr_last(void);
504
504
 
505
505
  /**
506
- * Clear the last error. This is an alias of `git_error_last` and is
506
+ * Clear the last error. This is an alias of `git_error_clear` and is
507
507
  * preserved for backward compatibility.
508
508
  *
509
509
  * This function is deprecated, but there is no plan to remove this
@@ -39,7 +39,7 @@ typedef struct {
39
39
  *
40
40
  * This is a public structure that represents a file entry in the index.
41
41
  * The meaning of the fields corresponds to core Git's documentation (in
42
- * "Documentation/technical/index-format.txt").
42
+ * "Documentation/gitformat-index.adoc").
43
43
  *
44
44
  * The `flags` field consists of a number of bit fields which can be
45
45
  * accessed via the first set of `GIT_INDEX_ENTRY_...` bitmasks below.
@@ -568,8 +568,10 @@ GIT_EXTERN(int) git_merge_file(
568
568
  /**
569
569
  * Merge two files as they exist in the index, using the given common
570
570
  * ancestor as the baseline, producing a `git_merge_file_result` that
571
- * reflects the merge result. The `git_merge_file_result` must be freed with
572
- * `git_merge_file_result_free`.
571
+ * reflects the merge result. The `git_merge_file_result` must be
572
+ * freed with `git_merge_file_result_free`.
573
+ *
574
+ * At least one of `ancestor`, `ours`, or `theirs` must be non-null.
573
575
  *
574
576
  * @param out The git_merge_file_result to be filled in
575
577
  * @param repo The repository
@@ -8,7 +8,6 @@
8
8
  #define INCLUDE_git_oid_h__
9
9
 
10
10
  #include "common.h"
11
- #include "types.h"
12
11
  #include "experimental.h"
13
12
 
14
13
  /**
@@ -70,9 +70,8 @@ typedef struct {
70
70
  git_credential_acquire_cb credentials;
71
71
 
72
72
  /**
73
- * If cert verification fails, this will be called to let the
74
- * user make the final decision of whether to allow the
75
- * connection to proceed. Returns 0 to allow the connection
73
+ * This will be called to let the user make the final decision of whether
74
+ * to allow the connection to proceed. Returns 0 to allow the connection
76
75
  * or a negative value to indicate an error.
77
76
  */
78
77
  git_transport_certificate_check_cb certificate_check;