rugged 0.28.4 → 0.28.4.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 (350) hide show
  1. checksums.yaml +4 -4
  2. data/lib/rugged/version.rb +1 -1
  3. data/vendor/libgit2/AUTHORS +0 -1
  4. data/vendor/libgit2/CMakeLists.txt +16 -36
  5. data/vendor/libgit2/COPYING +0 -28
  6. data/vendor/libgit2/cmake/Modules/EnableWarnings.cmake +1 -5
  7. data/vendor/libgit2/cmake/Modules/FindCoreFoundation.cmake +2 -2
  8. data/vendor/libgit2/cmake/Modules/FindGSSAPI.cmake +1 -1
  9. data/vendor/libgit2/cmake/Modules/FindSecurity.cmake +2 -2
  10. data/vendor/libgit2/cmake/Modules/FindStatNsec.cmake +0 -6
  11. data/vendor/libgit2/deps/http-parser/http_parser.c +6 -11
  12. data/vendor/libgit2/deps/regex/CMakeLists.txt +2 -0
  13. data/vendor/libgit2/deps/regex/COPYING +502 -0
  14. data/vendor/libgit2/deps/regex/config.h +7 -0
  15. data/vendor/libgit2/deps/regex/regcomp.c +3857 -0
  16. data/vendor/libgit2/deps/regex/regex.c +92 -0
  17. data/vendor/libgit2/deps/regex/regex.h +582 -0
  18. data/vendor/libgit2/deps/regex/regex_internal.c +1744 -0
  19. data/vendor/libgit2/deps/regex/regex_internal.h +819 -0
  20. data/vendor/libgit2/deps/regex/regexec.c +4369 -0
  21. data/vendor/libgit2/deps/zlib/adler32.c +7 -0
  22. data/vendor/libgit2/deps/zlib/crc32.c +7 -0
  23. data/vendor/libgit2/include/git2.h +0 -2
  24. data/vendor/libgit2/include/git2/apply.h +2 -22
  25. data/vendor/libgit2/include/git2/attr.h +12 -19
  26. data/vendor/libgit2/include/git2/blame.h +2 -2
  27. data/vendor/libgit2/include/git2/blob.h +12 -44
  28. data/vendor/libgit2/include/git2/buffer.h +14 -20
  29. data/vendor/libgit2/include/git2/checkout.h +14 -46
  30. data/vendor/libgit2/include/git2/cherrypick.h +3 -3
  31. data/vendor/libgit2/include/git2/clone.h +2 -2
  32. data/vendor/libgit2/include/git2/commit.h +1 -23
  33. data/vendor/libgit2/include/git2/common.h +5 -7
  34. data/vendor/libgit2/include/git2/config.h +12 -12
  35. data/vendor/libgit2/include/git2/deprecated.h +3 -243
  36. data/vendor/libgit2/include/git2/describe.h +4 -4
  37. data/vendor/libgit2/include/git2/diff.h +14 -16
  38. data/vendor/libgit2/include/git2/filter.h +0 -8
  39. data/vendor/libgit2/include/git2/index.h +1 -2
  40. data/vendor/libgit2/include/git2/indexer.h +4 -48
  41. data/vendor/libgit2/include/git2/inttypes.h +309 -0
  42. data/vendor/libgit2/include/git2/merge.h +10 -6
  43. data/vendor/libgit2/include/git2/net.h +5 -0
  44. data/vendor/libgit2/include/git2/object.h +14 -2
  45. data/vendor/libgit2/include/git2/odb.h +2 -3
  46. data/vendor/libgit2/include/git2/odb_backend.h +4 -5
  47. data/vendor/libgit2/include/git2/oid.h +1 -1
  48. data/vendor/libgit2/include/git2/pack.h +1 -12
  49. data/vendor/libgit2/include/git2/proxy.h +3 -5
  50. data/vendor/libgit2/include/git2/rebase.h +2 -46
  51. data/vendor/libgit2/include/git2/refs.h +0 -19
  52. data/vendor/libgit2/include/git2/remote.h +12 -35
  53. data/vendor/libgit2/include/git2/repository.h +2 -24
  54. data/vendor/libgit2/include/git2/revert.h +1 -1
  55. data/vendor/libgit2/include/git2/stash.h +3 -3
  56. data/vendor/libgit2/include/git2/status.h +16 -25
  57. data/vendor/libgit2/include/git2/submodule.h +3 -20
  58. data/vendor/libgit2/include/git2/sys/alloc.h +9 -9
  59. data/vendor/libgit2/include/git2/sys/odb_backend.h +4 -48
  60. data/vendor/libgit2/include/git2/sys/refdb_backend.h +21 -57
  61. data/vendor/libgit2/include/git2/sys/repository.h +1 -5
  62. data/vendor/libgit2/include/git2/sys/time.h +31 -0
  63. data/vendor/libgit2/include/git2/sys/transport.h +2 -2
  64. data/vendor/libgit2/include/git2/tag.h +2 -11
  65. data/vendor/libgit2/include/git2/trace.h +2 -2
  66. data/vendor/libgit2/include/git2/transport.h +340 -11
  67. data/vendor/libgit2/include/git2/tree.h +1 -1
  68. data/vendor/libgit2/include/git2/types.h +89 -4
  69. data/vendor/libgit2/include/git2/version.h +2 -2
  70. data/vendor/libgit2/include/git2/worktree.h +5 -5
  71. data/vendor/libgit2/libgit2.pc.in +13 -0
  72. data/vendor/libgit2/src/CMakeLists.txt +222 -88
  73. data/vendor/libgit2/src/alloc.c +14 -2
  74. data/vendor/libgit2/src/apply.c +30 -60
  75. data/vendor/libgit2/src/attr.c +64 -70
  76. data/vendor/libgit2/src/attr_file.c +96 -189
  77. data/vendor/libgit2/src/attr_file.h +9 -9
  78. data/vendor/libgit2/src/attrcache.c +46 -44
  79. data/vendor/libgit2/src/attrcache.h +1 -2
  80. data/vendor/libgit2/src/blame.c +5 -17
  81. data/vendor/libgit2/src/blame.h +1 -1
  82. data/vendor/libgit2/src/blame_git.c +7 -21
  83. data/vendor/libgit2/src/blob.c +17 -81
  84. data/vendor/libgit2/src/blob.h +2 -2
  85. data/vendor/libgit2/src/branch.c +5 -29
  86. data/vendor/libgit2/src/buffer.c +7 -14
  87. data/vendor/libgit2/src/cache.c +33 -26
  88. data/vendor/libgit2/src/cache.h +1 -1
  89. data/vendor/libgit2/src/cc-compat.h +0 -5
  90. data/vendor/libgit2/src/checkout.c +16 -26
  91. data/vendor/libgit2/src/cherrypick.c +3 -9
  92. data/vendor/libgit2/src/clone.c +7 -29
  93. data/vendor/libgit2/src/clone.h +0 -4
  94. data/vendor/libgit2/src/commit.c +21 -69
  95. data/vendor/libgit2/src/commit.h +0 -6
  96. data/vendor/libgit2/src/commit_list.c +76 -28
  97. data/vendor/libgit2/src/commit_list.h +2 -2
  98. data/vendor/libgit2/src/common.h +75 -3
  99. data/vendor/libgit2/src/config.c +40 -31
  100. data/vendor/libgit2/src/config.h +6 -7
  101. data/vendor/libgit2/src/config_backend.h +0 -12
  102. data/vendor/libgit2/src/config_cache.c +39 -39
  103. data/vendor/libgit2/src/config_entries.c +99 -69
  104. data/vendor/libgit2/src/config_entries.h +0 -1
  105. data/vendor/libgit2/src/config_file.c +380 -337
  106. data/vendor/libgit2/src/config_mem.c +16 -12
  107. data/vendor/libgit2/src/config_parse.c +29 -49
  108. data/vendor/libgit2/src/config_parse.h +12 -13
  109. data/vendor/libgit2/src/crlf.c +14 -14
  110. data/vendor/libgit2/src/describe.c +20 -21
  111. data/vendor/libgit2/src/diff.c +58 -43
  112. data/vendor/libgit2/src/diff.h +1 -2
  113. data/vendor/libgit2/src/diff_driver.c +38 -37
  114. data/vendor/libgit2/src/diff_file.c +7 -9
  115. data/vendor/libgit2/src/diff_file.h +1 -1
  116. data/vendor/libgit2/src/diff_generate.c +85 -135
  117. data/vendor/libgit2/src/diff_generate.h +2 -2
  118. data/vendor/libgit2/src/diff_parse.c +1 -1
  119. data/vendor/libgit2/src/diff_print.c +13 -25
  120. data/vendor/libgit2/src/diff_stats.c +1 -1
  121. data/vendor/libgit2/src/diff_tform.c +4 -4
  122. data/vendor/libgit2/src/errors.c +22 -12
  123. data/vendor/libgit2/src/features.h.in +2 -9
  124. data/vendor/libgit2/src/fetch.c +2 -7
  125. data/vendor/libgit2/src/fetchhead.c +1 -1
  126. data/vendor/libgit2/src/filebuf.c +10 -6
  127. data/vendor/libgit2/src/filebuf.h +2 -2
  128. data/vendor/libgit2/src/{futils.c → fileops.c} +17 -21
  129. data/vendor/libgit2/src/{futils.h → fileops.h} +5 -5
  130. data/vendor/libgit2/src/filter.c +8 -16
  131. data/vendor/libgit2/src/fnmatch.c +248 -0
  132. data/vendor/libgit2/src/fnmatch.h +48 -0
  133. data/vendor/libgit2/src/global.c +40 -12
  134. data/vendor/libgit2/src/global.h +2 -0
  135. data/vendor/libgit2/src/hash.c +0 -61
  136. data/vendor/libgit2/src/hash.h +21 -19
  137. data/vendor/libgit2/src/hash/{sha1/collisiondetect.c → hash_collisiondetect.h} +17 -14
  138. data/vendor/libgit2/src/hash/{sha1/common_crypto.c → hash_common_crypto.h} +19 -15
  139. data/vendor/libgit2/src/hash/{sha1/generic.c → hash_generic.c} +10 -22
  140. data/vendor/libgit2/src/hash/{sha1/generic.h → hash_generic.h} +14 -4
  141. data/vendor/libgit2/src/hash/{sha1/mbedtls.c → hash_mbedtls.c} +7 -15
  142. data/vendor/libgit2/src/hash/{sha1/mbedtls.h → hash_mbedtls.h} +11 -6
  143. data/vendor/libgit2/src/hash/{sha1/openssl.c → hash_openssl.h} +18 -14
  144. data/vendor/libgit2/src/hash/{sha1/win32.c → hash_win32.c} +24 -34
  145. data/vendor/libgit2/src/hash/{sha1/win32.h → hash_win32.h} +19 -6
  146. data/vendor/libgit2/src/hash/{sha1/sha1dc → sha1dc}/sha1.c +3 -14
  147. data/vendor/libgit2/src/hash/{sha1/sha1dc → sha1dc}/sha1.h +0 -0
  148. data/vendor/libgit2/src/hash/{sha1/sha1dc → sha1dc}/ubc_check.c +0 -0
  149. data/vendor/libgit2/src/hash/{sha1/sha1dc → sha1dc}/ubc_check.h +0 -0
  150. data/vendor/libgit2/src/hashsig.c +1 -1
  151. data/vendor/libgit2/src/idxmap.c +65 -91
  152. data/vendor/libgit2/src/idxmap.h +15 -151
  153. data/vendor/libgit2/src/ignore.c +38 -32
  154. data/vendor/libgit2/src/index.c +43 -66
  155. data/vendor/libgit2/src/index.h +1 -1
  156. data/vendor/libgit2/src/indexer.c +70 -69
  157. data/vendor/libgit2/src/integer.h +4 -39
  158. data/vendor/libgit2/src/iterator.c +22 -27
  159. data/vendor/libgit2/src/map.h +1 -1
  160. data/vendor/libgit2/src/merge.c +44 -58
  161. data/vendor/libgit2/src/merge_driver.c +4 -4
  162. data/vendor/libgit2/src/merge_file.c +1 -1
  163. data/vendor/libgit2/src/mwindow.c +23 -18
  164. data/vendor/libgit2/src/mwindow.h +4 -4
  165. data/vendor/libgit2/src/netops.c +165 -55
  166. data/vendor/libgit2/src/netops.h +25 -3
  167. data/vendor/libgit2/src/notes.c +2 -2
  168. data/vendor/libgit2/src/object.c +2 -2
  169. data/vendor/libgit2/src/object.h +0 -2
  170. data/vendor/libgit2/src/odb.c +23 -41
  171. data/vendor/libgit2/src/odb.h +2 -3
  172. data/vendor/libgit2/src/odb_loose.c +10 -17
  173. data/vendor/libgit2/src/odb_mempack.c +23 -10
  174. data/vendor/libgit2/src/odb_pack.c +4 -4
  175. data/vendor/libgit2/src/offmap.c +55 -43
  176. data/vendor/libgit2/src/offmap.h +24 -102
  177. data/vendor/libgit2/src/oid.c +1 -6
  178. data/vendor/libgit2/src/oidmap.c +57 -39
  179. data/vendor/libgit2/src/oidmap.h +19 -99
  180. data/vendor/libgit2/src/pack-objects.c +32 -25
  181. data/vendor/libgit2/src/pack-objects.h +1 -1
  182. data/vendor/libgit2/src/pack.c +47 -45
  183. data/vendor/libgit2/src/pack.h +14 -12
  184. data/vendor/libgit2/src/parse.c +0 -10
  185. data/vendor/libgit2/src/parse.h +3 -3
  186. data/vendor/libgit2/src/patch.c +1 -1
  187. data/vendor/libgit2/src/patch_generate.c +2 -2
  188. data/vendor/libgit2/src/patch_parse.c +31 -124
  189. data/vendor/libgit2/src/path.c +6 -43
  190. data/vendor/libgit2/src/path.h +0 -2
  191. data/vendor/libgit2/src/pathspec.c +13 -13
  192. data/vendor/libgit2/src/pool.c +22 -26
  193. data/vendor/libgit2/src/pool.h +7 -7
  194. data/vendor/libgit2/src/posix.c +7 -7
  195. data/vendor/libgit2/src/posix.h +1 -12
  196. data/vendor/libgit2/src/proxy.c +2 -7
  197. data/vendor/libgit2/src/push.c +5 -10
  198. data/vendor/libgit2/src/reader.c +2 -2
  199. data/vendor/libgit2/src/rebase.c +7 -66
  200. data/vendor/libgit2/src/refdb.c +0 -12
  201. data/vendor/libgit2/src/refdb_fs.c +165 -214
  202. data/vendor/libgit2/src/reflog.c +13 -11
  203. data/vendor/libgit2/src/refs.c +18 -24
  204. data/vendor/libgit2/src/refspec.c +16 -9
  205. data/vendor/libgit2/src/remote.c +52 -50
  206. data/vendor/libgit2/src/remote.h +2 -2
  207. data/vendor/libgit2/src/repository.c +100 -115
  208. data/vendor/libgit2/src/repository.h +40 -49
  209. data/vendor/libgit2/src/revert.c +3 -8
  210. data/vendor/libgit2/src/revparse.c +19 -18
  211. data/vendor/libgit2/src/revwalk.c +30 -63
  212. data/vendor/libgit2/src/revwalk.h +0 -20
  213. data/vendor/libgit2/src/settings.c +0 -5
  214. data/vendor/libgit2/src/sortedcache.c +26 -12
  215. data/vendor/libgit2/src/sortedcache.h +1 -1
  216. data/vendor/libgit2/src/stash.c +65 -45
  217. data/vendor/libgit2/src/status.c +9 -15
  218. data/vendor/libgit2/src/{allocators/stdalloc.c → stdalloc.c} +4 -3
  219. data/vendor/libgit2/src/{allocators/stdalloc.h → stdalloc.h} +4 -4
  220. data/vendor/libgit2/src/streams/openssl.c +0 -20
  221. data/vendor/libgit2/src/streams/socket.c +2 -2
  222. data/vendor/libgit2/src/strmap.c +84 -37
  223. data/vendor/libgit2/src/strmap.h +33 -105
  224. data/vendor/libgit2/src/submodule.c +70 -102
  225. data/vendor/libgit2/src/submodule.h +1 -1
  226. data/vendor/libgit2/src/sysdir.c +1 -11
  227. data/vendor/libgit2/src/tag.c +2 -10
  228. data/vendor/libgit2/src/trace.c +1 -1
  229. data/vendor/libgit2/src/trace.h +2 -2
  230. data/vendor/libgit2/src/trailer.c +32 -46
  231. data/vendor/libgit2/src/transaction.c +9 -10
  232. data/vendor/libgit2/src/transports/auth.c +9 -10
  233. data/vendor/libgit2/src/transports/auth.h +4 -11
  234. data/vendor/libgit2/src/transports/auth_negotiate.c +9 -23
  235. data/vendor/libgit2/src/transports/auth_negotiate.h +2 -2
  236. data/vendor/libgit2/src/transports/cred.c +6 -6
  237. data/vendor/libgit2/src/{allocators/win32_crtdbg.h → transports/cred.h} +4 -5
  238. data/vendor/libgit2/src/transports/git.c +16 -11
  239. data/vendor/libgit2/src/transports/http.c +276 -419
  240. data/vendor/libgit2/src/transports/http.h +1 -1
  241. data/vendor/libgit2/src/transports/local.c +9 -9
  242. data/vendor/libgit2/src/transports/smart.c +17 -17
  243. data/vendor/libgit2/src/transports/smart.h +2 -2
  244. data/vendor/libgit2/src/transports/smart_protocol.c +60 -36
  245. data/vendor/libgit2/src/transports/ssh.c +36 -46
  246. data/vendor/libgit2/src/transports/winhttp.c +207 -231
  247. data/vendor/libgit2/src/tree-cache.c +7 -14
  248. data/vendor/libgit2/src/tree.c +24 -10
  249. data/vendor/libgit2/src/unix/map.c +1 -1
  250. data/vendor/libgit2/src/unix/posix.h +11 -1
  251. data/vendor/libgit2/src/userdiff.h +1 -3
  252. data/vendor/libgit2/src/util.c +53 -51
  253. data/vendor/libgit2/src/util.h +21 -16
  254. data/vendor/libgit2/src/win32/map.c +5 -3
  255. data/vendor/libgit2/src/win32/path_w32.c +2 -12
  256. data/vendor/libgit2/src/win32/path_w32.h +29 -0
  257. data/vendor/libgit2/src/win32/posix.h +4 -1
  258. data/vendor/libgit2/src/win32/posix_w32.c +5 -40
  259. data/vendor/libgit2/src/win32/precompiled.h +2 -0
  260. data/vendor/libgit2/src/win32/thread.c +10 -5
  261. data/vendor/libgit2/src/win32/w32_buffer.c +3 -7
  262. data/vendor/libgit2/src/win32/w32_crtdbg_stacktrace.c +93 -0
  263. data/vendor/libgit2/src/win32/w32_crtdbg_stacktrace.h +2 -0
  264. data/vendor/libgit2/src/win32/w32_stack.c +9 -4
  265. data/vendor/libgit2/src/win32/w32_stack.h +3 -3
  266. data/vendor/libgit2/src/win32/w32_util.c +0 -31
  267. data/vendor/libgit2/src/win32/w32_util.h +32 -6
  268. data/vendor/libgit2/src/worktree.c +22 -36
  269. data/vendor/libgit2/src/xdiff/xdiffi.c +1 -1
  270. data/vendor/libgit2/src/xdiff/xmerge.c +0 -12
  271. data/vendor/libgit2/src/xdiff/xpatience.c +0 -3
  272. metadata +34 -98
  273. data/vendor/libgit2/cmake/Modules/FindGSSFramework.cmake +0 -28
  274. data/vendor/libgit2/cmake/Modules/FindPCRE.cmake +0 -38
  275. data/vendor/libgit2/cmake/Modules/FindPCRE2.cmake +0 -37
  276. data/vendor/libgit2/cmake/Modules/PkgBuildConfig.cmake +0 -110
  277. data/vendor/libgit2/cmake/Modules/SelectGSSAPI.cmake +0 -53
  278. data/vendor/libgit2/cmake/Modules/SelectHTTPSBackend.cmake +0 -124
  279. data/vendor/libgit2/cmake/Modules/SelectHashes.cmake +0 -66
  280. data/vendor/libgit2/deps/ntlmclient/CMakeLists.txt +0 -21
  281. data/vendor/libgit2/deps/ntlmclient/compat.h +0 -33
  282. data/vendor/libgit2/deps/ntlmclient/crypt.h +0 -64
  283. data/vendor/libgit2/deps/ntlmclient/crypt_commoncrypto.c +0 -120
  284. data/vendor/libgit2/deps/ntlmclient/crypt_commoncrypto.h +0 -18
  285. data/vendor/libgit2/deps/ntlmclient/crypt_mbedtls.c +0 -145
  286. data/vendor/libgit2/deps/ntlmclient/crypt_mbedtls.h +0 -18
  287. data/vendor/libgit2/deps/ntlmclient/crypt_openssl.c +0 -130
  288. data/vendor/libgit2/deps/ntlmclient/crypt_openssl.h +0 -21
  289. data/vendor/libgit2/deps/ntlmclient/ntlm.c +0 -1420
  290. data/vendor/libgit2/deps/ntlmclient/ntlm.h +0 -174
  291. data/vendor/libgit2/deps/ntlmclient/ntlmclient.h +0 -320
  292. data/vendor/libgit2/deps/ntlmclient/unicode.h +0 -36
  293. data/vendor/libgit2/deps/ntlmclient/unicode_builtin.c +0 -445
  294. data/vendor/libgit2/deps/ntlmclient/unicode_iconv.c +0 -201
  295. data/vendor/libgit2/deps/ntlmclient/utf8.h +0 -1257
  296. data/vendor/libgit2/deps/ntlmclient/util.c +0 -21
  297. data/vendor/libgit2/deps/ntlmclient/util.h +0 -14
  298. data/vendor/libgit2/deps/pcre/CMakeLists.txt +0 -140
  299. data/vendor/libgit2/deps/pcre/COPYING +0 -5
  300. data/vendor/libgit2/deps/pcre/cmake/COPYING-CMAKE-SCRIPTS +0 -22
  301. data/vendor/libgit2/deps/pcre/cmake/FindEditline.cmake +0 -17
  302. data/vendor/libgit2/deps/pcre/cmake/FindPackageHandleStandardArgs.cmake +0 -58
  303. data/vendor/libgit2/deps/pcre/cmake/FindReadline.cmake +0 -29
  304. data/vendor/libgit2/deps/pcre/config.h.in +0 -57
  305. data/vendor/libgit2/deps/pcre/pcre.h +0 -641
  306. data/vendor/libgit2/deps/pcre/pcre_byte_order.c +0 -319
  307. data/vendor/libgit2/deps/pcre/pcre_chartables.c +0 -198
  308. data/vendor/libgit2/deps/pcre/pcre_compile.c +0 -9800
  309. data/vendor/libgit2/deps/pcre/pcre_config.c +0 -190
  310. data/vendor/libgit2/deps/pcre/pcre_dfa_exec.c +0 -3676
  311. data/vendor/libgit2/deps/pcre/pcre_exec.c +0 -7173
  312. data/vendor/libgit2/deps/pcre/pcre_fullinfo.c +0 -245
  313. data/vendor/libgit2/deps/pcre/pcre_get.c +0 -669
  314. data/vendor/libgit2/deps/pcre/pcre_globals.c +0 -86
  315. data/vendor/libgit2/deps/pcre/pcre_internal.h +0 -2787
  316. data/vendor/libgit2/deps/pcre/pcre_jit_compile.c +0 -11913
  317. data/vendor/libgit2/deps/pcre/pcre_maketables.c +0 -156
  318. data/vendor/libgit2/deps/pcre/pcre_newline.c +0 -210
  319. data/vendor/libgit2/deps/pcre/pcre_ord2utf8.c +0 -94
  320. data/vendor/libgit2/deps/pcre/pcre_printint.c +0 -834
  321. data/vendor/libgit2/deps/pcre/pcre_refcount.c +0 -92
  322. data/vendor/libgit2/deps/pcre/pcre_string_utils.c +0 -211
  323. data/vendor/libgit2/deps/pcre/pcre_study.c +0 -1686
  324. data/vendor/libgit2/deps/pcre/pcre_tables.c +0 -727
  325. data/vendor/libgit2/deps/pcre/pcre_ucd.c +0 -3644
  326. data/vendor/libgit2/deps/pcre/pcre_valid_utf8.c +0 -301
  327. data/vendor/libgit2/deps/pcre/pcre_version.c +0 -98
  328. data/vendor/libgit2/deps/pcre/pcre_xclass.c +0 -268
  329. data/vendor/libgit2/deps/pcre/pcreposix.c +0 -421
  330. data/vendor/libgit2/deps/pcre/pcreposix.h +0 -117
  331. data/vendor/libgit2/deps/pcre/ucp.h +0 -224
  332. data/vendor/libgit2/include/git2/cert.h +0 -135
  333. data/vendor/libgit2/include/git2/cred.h +0 -308
  334. data/vendor/libgit2/include/git2/sys/cred.h +0 -90
  335. data/vendor/libgit2/src/allocators/win32_crtdbg.c +0 -118
  336. data/vendor/libgit2/src/config_snapshot.c +0 -206
  337. data/vendor/libgit2/src/errors.h +0 -81
  338. data/vendor/libgit2/src/hash/sha1.h +0 -38
  339. data/vendor/libgit2/src/hash/sha1/collisiondetect.h +0 -19
  340. data/vendor/libgit2/src/hash/sha1/common_crypto.h +0 -19
  341. data/vendor/libgit2/src/hash/sha1/openssl.h +0 -19
  342. data/vendor/libgit2/src/net.c +0 -184
  343. data/vendor/libgit2/src/net.h +0 -36
  344. data/vendor/libgit2/src/regexp.c +0 -221
  345. data/vendor/libgit2/src/regexp.h +0 -97
  346. data/vendor/libgit2/src/transports/auth_ntlm.c +0 -223
  347. data/vendor/libgit2/src/transports/auth_ntlm.h +0 -35
  348. data/vendor/libgit2/src/wildmatch.c +0 -320
  349. data/vendor/libgit2/src/wildmatch.h +0 -23
  350. data/vendor/libgit2/src/win32/w32_common.h +0 -39
@@ -55,7 +55,7 @@ int git_diff_file_stats__full_to_buf(
55
55
  {
56
56
  const char *old_path = NULL, *new_path = NULL;
57
57
  size_t padding;
58
- git_object_size_t old_size, new_size;
58
+ git_off_t old_size, new_size;
59
59
 
60
60
  old_path = delta->old_file.path;
61
61
  new_path = delta->new_file.path;
@@ -14,7 +14,7 @@
14
14
  #include "diff.h"
15
15
  #include "diff_generate.h"
16
16
  #include "path.h"
17
- #include "futils.h"
17
+ #include "fileops.h"
18
18
  #include "config.h"
19
19
 
20
20
  git_diff_delta *git_diff__delta_dup(
@@ -510,7 +510,7 @@ static int similarity_sig(
510
510
  if (file->size != git_blob_rawsize(info->blob))
511
511
  file->size = git_blob_rawsize(info->blob);
512
512
 
513
- sz = git__is_sizet(file->size) ? (size_t)file->size : (size_t)-1;
513
+ sz = (size_t)(git__is_sizet(file->size) ? file->size : -1);
514
514
 
515
515
  error = opts->metric->buffer_signature(
516
516
  &cache[info->idx], info->file,
@@ -560,13 +560,13 @@ static int similarity_measure(
560
560
 
561
561
  /* if exact match is requested, force calculation of missing OIDs now */
562
562
  if (exact_match) {
563
- if (git_oid_is_zero(&a_file->id) &&
563
+ if (git_oid_iszero(&a_file->id) &&
564
564
  diff->old_src == GIT_ITERATOR_TYPE_WORKDIR &&
565
565
  !git_diff__oid_for_file(&a_file->id,
566
566
  diff, a_file->path, a_file->mode, a_file->size))
567
567
  a_file->flags |= GIT_DIFF_FLAG_VALID_ID;
568
568
 
569
- if (git_oid_is_zero(&b_file->id) &&
569
+ if (git_oid_iszero(&b_file->id) &&
570
570
  diff->new_src == GIT_ITERATOR_TYPE_WORKDIR &&
571
571
  !git_diff__oid_for_file(&b_file->id,
572
572
  diff, b_file->path, b_file->mode, b_file->size))
@@ -49,17 +49,9 @@ void git_error_set_oom(void)
49
49
  GIT_GLOBAL->last_error = &g_git_oom_error;
50
50
  }
51
51
 
52
- void git_error_set(int error_class, const char *fmt, ...)
53
- {
54
- va_list ap;
55
-
56
- va_start(ap, fmt);
57
- git_error_vset(error_class, fmt, ap);
58
- va_end(ap);
59
- }
60
-
61
- void git_error_vset(int error_class, const char *fmt, va_list ap)
52
+ void git_error_set(int error_class, const char *string, ...)
62
53
  {
54
+ va_list arglist;
63
55
  #ifdef GIT_WIN32
64
56
  DWORD win32_error_code = (error_class == GIT_ERROR_OS) ? GetLastError() : 0;
65
57
  #endif
@@ -67,8 +59,11 @@ void git_error_vset(int error_class, const char *fmt, va_list ap)
67
59
  git_buf *buf = &GIT_GLOBAL->error_buf;
68
60
 
69
61
  git_buf_clear(buf);
70
- if (fmt) {
71
- git_buf_vprintf(buf, fmt, ap);
62
+ if (string) {
63
+ va_start(arglist, string);
64
+ git_buf_vprintf(buf, string, arglist);
65
+ va_end(arglist);
66
+
72
67
  if (error_class == GIT_ERROR_OS)
73
68
  git_buf_PUTS(buf, ": ");
74
69
  }
@@ -110,6 +105,21 @@ void git_error_set_str(int error_class, const char *string)
110
105
  set_error_from_buffer(error_class);
111
106
  }
112
107
 
108
+ int git_error_set_regex(const regex_t *regex, int error_code)
109
+ {
110
+ char error_buf[1024];
111
+
112
+ assert(error_code);
113
+
114
+ regerror(error_code, regex, error_buf, sizeof(error_buf));
115
+ git_error_set_str(GIT_ERROR_REGEX, error_buf);
116
+
117
+ if (error_code == REG_NOMATCH)
118
+ return GIT_ENOTFOUND;
119
+
120
+ return GIT_EINVALIDSPEC;
121
+ }
122
+
113
123
  void git_error_clear(void)
114
124
  {
115
125
  if (GIT_GLOBAL->last_error != NULL) {
@@ -15,21 +15,14 @@
15
15
  #cmakedefine GIT_USE_STAT_MTIMESPEC 1
16
16
  #cmakedefine GIT_USE_STAT_MTIME_NSEC 1
17
17
  #cmakedefine GIT_USE_FUTIMENS 1
18
-
19
- #cmakedefine GIT_REGEX_REGCOMP_L
20
- #cmakedefine GIT_REGEX_REGCOMP
21
- #cmakedefine GIT_REGEX_PCRE
22
- #cmakedefine GIT_REGEX_PCRE2
23
- #cmakedefine GIT_REGEX_BUILTIN 1
18
+ #cmakedefine GIT_USE_REGCOMP_L 1
24
19
 
25
20
  #cmakedefine GIT_SSH 1
26
21
  #cmakedefine GIT_SSH_MEMORY_CREDENTIALS 1
27
22
 
28
- #cmakedefine GIT_NTLM 1
29
23
  #cmakedefine GIT_GSSAPI 1
30
- #cmakedefine GIT_GSSFRAMEWORK 1
31
-
32
24
  #cmakedefine GIT_WINHTTP 1
25
+
33
26
  #cmakedefine GIT_HTTPS 1
34
27
  #cmakedefine GIT_OPENSSL 1
35
28
  #cmakedefine GIT_SECURE_TRANSPORT 1
@@ -134,7 +134,7 @@ int git_fetch_negotiate(git_remote *remote, const git_fetch_options *opts)
134
134
  int git_fetch_download_pack(git_remote *remote, const git_remote_callbacks *callbacks)
135
135
  {
136
136
  git_transport *t = remote->transport;
137
- git_indexer_progress_cb progress = NULL;
137
+ git_transfer_progress_cb progress = NULL;
138
138
  void *payload = NULL;
139
139
 
140
140
  if (!remote->need_pack)
@@ -148,14 +148,9 @@ int git_fetch_download_pack(git_remote *remote, const git_remote_callbacks *call
148
148
  return t->download_pack(t, remote->repo, &remote->stats, progress, payload);
149
149
  }
150
150
 
151
- int git_fetch_options_init(git_fetch_options *opts, unsigned int version)
151
+ int git_fetch_init_options(git_fetch_options *opts, unsigned int version)
152
152
  {
153
153
  GIT_INIT_STRUCTURE_FROM_TEMPLATE(
154
154
  opts, version, git_fetch_options, GIT_FETCH_OPTIONS_INIT);
155
155
  return 0;
156
156
  }
157
-
158
- int git_fetch_init_options(git_fetch_options *opts, unsigned int version)
159
- {
160
- return git_fetch_options_init(opts, version);
161
- }
@@ -11,7 +11,7 @@
11
11
  #include "git2/oid.h"
12
12
 
13
13
  #include "buffer.h"
14
- #include "futils.h"
14
+ #include "fileops.h"
15
15
  #include "filebuf.h"
16
16
  #include "refs.h"
17
17
  #include "repository.h"
@@ -7,7 +7,7 @@
7
7
 
8
8
  #include "filebuf.h"
9
9
 
10
- #include "futils.h"
10
+ #include "fileops.h"
11
11
 
12
12
  static const size_t WRITE_BUFFER_SIZE = (4096 * 2);
13
13
 
@@ -44,14 +44,18 @@ static int verify_last_error(git_filebuf *file)
44
44
  static int lock_file(git_filebuf *file, int flags, mode_t mode)
45
45
  {
46
46
  if (git_path_exists(file->path_lock) == true) {
47
- git_error_clear(); /* actual OS error code just confuses */
48
- git_error_set(GIT_ERROR_OS,
49
- "failed to lock file '%s' for writing", file->path_lock);
50
- return GIT_ELOCKED;
47
+ if (flags & GIT_FILEBUF_FORCE)
48
+ p_unlink(file->path_lock);
49
+ else {
50
+ git_error_clear(); /* actual OS error code just confuses */
51
+ git_error_set(GIT_ERROR_OS,
52
+ "failed to lock file '%s' for writing", file->path_lock);
53
+ return GIT_ELOCKED;
54
+ }
51
55
  }
52
56
 
53
57
  /* create path to the file buffer is required */
54
- if (flags & GIT_FILEBUF_CREATE_LEADING_DIRS) {
58
+ if (flags & GIT_FILEBUF_FORCE) {
55
59
  /* XXX: Should dirmode here be configurable? Or is 0777 always fine? */
56
60
  file->fd = git_futils_creat_locked_withpath(file->path_lock, 0777, mode);
57
61
  } else {
@@ -9,7 +9,7 @@
9
9
 
10
10
  #include "common.h"
11
11
 
12
- #include "futils.h"
12
+ #include "fileops.h"
13
13
  #include "hash.h"
14
14
  #include <zlib.h>
15
15
 
@@ -19,7 +19,7 @@
19
19
 
20
20
  #define GIT_FILEBUF_HASH_CONTENTS (1 << 0)
21
21
  #define GIT_FILEBUF_APPEND (1 << 2)
22
- #define GIT_FILEBUF_CREATE_LEADING_DIRS (1 << 3)
22
+ #define GIT_FILEBUF_FORCE (1 << 3)
23
23
  #define GIT_FILEBUF_TEMPORARY (1 << 4)
24
24
  #define GIT_FILEBUF_DO_NOT_BUFFER (1 << 5)
25
25
  #define GIT_FILEBUF_FSYNC (1 << 6)
@@ -5,7 +5,7 @@
5
5
  * a Linking Exception. For full terms see the included COPYING file.
6
6
  */
7
7
 
8
- #include "futils.h"
8
+ #include "fileops.h"
9
9
 
10
10
  #include "global.h"
11
11
  #include "strmap.h"
@@ -112,7 +112,7 @@ int git_futils_truncate(const char *path, int mode)
112
112
  return 0;
113
113
  }
114
114
 
115
- int git_futils_filesize(uint64_t *out, git_file fd)
115
+ git_off_t git_futils_filesize(git_file fd)
116
116
  {
117
117
  struct stat sb;
118
118
 
@@ -121,13 +121,7 @@ int git_futils_filesize(uint64_t *out, git_file fd)
121
121
  return -1;
122
122
  }
123
123
 
124
- if (sb.st_size < 0) {
125
- git_error_set(GIT_ERROR_INVALID, "invalid file size");
126
- return -1;
127
- }
128
-
129
- *out = sb.st_size;
130
- return 0;
124
+ return sb.st_size;
131
125
  }
132
126
 
133
127
  mode_t git_futils_canonical_mode(mode_t raw_mode)
@@ -307,7 +301,7 @@ int git_futils_mv_withpath(const char *from, const char *to, const mode_t dirmod
307
301
  return 0;
308
302
  }
309
303
 
310
- int git_futils_mmap_ro(git_map *out, git_file fd, off64_t begin, size_t len)
304
+ int git_futils_mmap_ro(git_map *out, git_file fd, git_off_t begin, size_t len)
311
305
  {
312
306
  return p_mmap(out, len, GIT_PROT_READ, GIT_MAP_SHARED, fd, begin);
313
307
  }
@@ -315,14 +309,16 @@ int git_futils_mmap_ro(git_map *out, git_file fd, off64_t begin, size_t len)
315
309
  int git_futils_mmap_ro_file(git_map *out, const char *path)
316
310
  {
317
311
  git_file fd = git_futils_open_ro(path);
318
- uint64_t len;
312
+ git_off_t len;
319
313
  int result;
320
314
 
321
315
  if (fd < 0)
322
316
  return fd;
323
317
 
324
- if ((result = git_futils_filesize(&len, fd)) < 0)
318
+ if ((len = git_futils_filesize(fd)) < 0) {
319
+ result = -1;
325
320
  goto out;
321
+ }
326
322
 
327
323
  if (!git__is_sizet(len)) {
328
324
  git_error_set(GIT_ERROR_OS, "file `%s` too large to mmap", path);
@@ -480,7 +476,6 @@ int git_futils_mkdir(
480
476
  break;
481
477
  } else if (errno != ENOENT) {
482
478
  git_error_set(GIT_ERROR_OS, "failed to stat '%s'", parent_path.ptr);
483
- error = -1;
484
479
  goto done;
485
480
  }
486
481
 
@@ -500,9 +495,7 @@ int git_futils_mkdir(
500
495
  * equal to length of the root path). The path may be less than the
501
496
  * root path length on Windows, where `C:` == `C:/`.
502
497
  */
503
- if ((len == 1 && parent_path.ptr[0] == '.') ||
504
- (len == 1 && parent_path.ptr[0] == '/') ||
505
- len <= root_len) {
498
+ if ((len == 1 && parent_path.ptr[0] == '.') || len <= root_len) {
506
499
  relative = make_path.ptr;
507
500
  break;
508
501
  }
@@ -643,12 +636,15 @@ retry_lstat:
643
636
  size_t alloc_size;
644
637
 
645
638
  GIT_ERROR_CHECK_ALLOC_ADD(&alloc_size, make_path.size, 1);
646
- cache_path = git_pool_malloc(opts->pool, alloc_size);
639
+ if (!git__is_uint32(alloc_size))
640
+ return -1;
641
+ cache_path = git_pool_malloc(opts->pool, (uint32_t)alloc_size);
647
642
  GIT_ERROR_CHECK_ALLOC(cache_path);
648
643
 
649
644
  memcpy(cache_path, make_path.ptr, make_path.size + 1);
650
645
 
651
- if ((error = git_strmap_set(opts->dir_map, cache_path, cache_path)) < 0)
646
+ git_strmap_insert(opts->dir_map, cache_path, cache_path, &error);
647
+ if (error < 0)
652
648
  goto done;
653
649
  }
654
650
  }
@@ -1110,7 +1106,7 @@ int git_futils_filestamp_check(
1110
1106
  #if defined(GIT_USE_NSEC)
1111
1107
  stamp->mtime.tv_nsec == st.st_mtime_nsec &&
1112
1108
  #endif
1113
- stamp->size == (uint64_t)st.st_size &&
1109
+ stamp->size == (git_off_t)st.st_size &&
1114
1110
  stamp->ino == (unsigned int)st.st_ino)
1115
1111
  return 0;
1116
1112
 
@@ -1118,7 +1114,7 @@ int git_futils_filestamp_check(
1118
1114
  #if defined(GIT_USE_NSEC)
1119
1115
  stamp->mtime.tv_nsec = st.st_mtime_nsec;
1120
1116
  #endif
1121
- stamp->size = (uint64_t)st.st_size;
1117
+ stamp->size = (git_off_t)st.st_size;
1122
1118
  stamp->ino = (unsigned int)st.st_ino;
1123
1119
 
1124
1120
  return 1;
@@ -1146,7 +1142,7 @@ void git_futils_filestamp_set_from_stat(
1146
1142
  #else
1147
1143
  stamp->mtime.tv_nsec = 0;
1148
1144
  #endif
1149
- stamp->size = (uint64_t)st->st_size;
1145
+ stamp->size = (git_off_t)st->st_size;
1150
1146
  stamp->ino = (unsigned int)st->st_ino;
1151
1147
  } else {
1152
1148
  memset(stamp, 0, sizeof(*stamp));
@@ -4,8 +4,8 @@
4
4
  * This file is part of libgit2, distributed under the GNU GPL v2 with
5
5
  * a Linking Exception. For full terms see the included COPYING file.
6
6
  */
7
- #ifndef INCLUDE_futils_h__
8
- #define INCLUDE_futils_h__
7
+ #ifndef INCLUDE_fileops_h__
8
+ #define INCLUDE_fileops_h__
9
9
 
10
10
  #include "common.h"
11
11
 
@@ -255,7 +255,7 @@ extern int git_futils_truncate(const char *path, int mode);
255
255
  /**
256
256
  * Get the filesize in bytes of a file
257
257
  */
258
- extern int git_futils_filesize(uint64_t *out, git_file fd);
258
+ extern git_off_t git_futils_filesize(git_file fd);
259
259
 
260
260
  #define GIT_PERMS_IS_EXEC(MODE) (((MODE) & 0111) != 0)
261
261
  #define GIT_PERMS_CANONICAL(MODE) (GIT_PERMS_IS_EXEC(MODE) ? 0755 : 0644)
@@ -290,7 +290,7 @@ extern mode_t git_futils_canonical_mode(mode_t raw_mode);
290
290
  extern int git_futils_mmap_ro(
291
291
  git_map *out,
292
292
  git_file fd,
293
- off64_t begin,
293
+ git_off_t begin,
294
294
  size_t len);
295
295
 
296
296
  /**
@@ -330,7 +330,7 @@ extern int git_futils_fake_symlink(const char *new, const char *old);
330
330
  */
331
331
  typedef struct {
332
332
  struct timespec mtime;
333
- uint64_t size;
333
+ git_off_t size;
334
334
  unsigned int ino;
335
335
  } git_futils_filestamp;
336
336
 
@@ -8,7 +8,7 @@
8
8
  #include "filter.h"
9
9
 
10
10
  #include "common.h"
11
- #include "futils.h"
11
+ #include "fileops.h"
12
12
  #include "hash.h"
13
13
  #include "repository.h"
14
14
  #include "global.h"
@@ -385,7 +385,7 @@ uint16_t git_filter_source_filemode(const git_filter_source *src)
385
385
 
386
386
  const git_oid *git_filter_source_id(const git_filter_source *src)
387
387
  {
388
- return git_oid_is_zero(&src->oid) ? NULL : &src->oid;
388
+ return git_oid_iszero(&src->oid) ? NULL : &src->oid;
389
389
  }
390
390
 
391
391
  git_filter_mode_t git_filter_source_mode(const git_filter_source *src)
@@ -428,21 +428,13 @@ static int filter_list_check_attributes(
428
428
  git_filter_def *fdef,
429
429
  const git_filter_source *src)
430
430
  {
431
- const char **strs = git__calloc(fdef->nattrs, sizeof(const char *));
432
- uint32_t flags = 0;
433
- size_t i;
434
431
  int error;
435
-
432
+ size_t i;
433
+ const char **strs = git__calloc(fdef->nattrs, sizeof(const char *));
436
434
  GIT_ERROR_CHECK_ALLOC(strs);
437
435
 
438
- if ((src->flags & GIT_FILTER_NO_SYSTEM_ATTRIBUTES) != 0)
439
- flags |= GIT_ATTR_CHECK_NO_SYSTEM;
440
-
441
- if ((src->flags & GIT_FILTER_ATTRIBUTES_FROM_HEAD) != 0)
442
- flags |= GIT_ATTR_CHECK_INCLUDE_HEAD;
443
-
444
436
  error = git_attr_get_many_with_session(
445
- strs, repo, attr_session, flags, src->path, fdef->nattrs, fdef->attrs);
437
+ strs, repo, attr_session, 0, src->path, fdef->nattrs, fdef->attrs);
446
438
 
447
439
  /* if no values were found but no matches are needed, it's okay! */
448
440
  if (error == GIT_ENOTFOUND && !fdef->nmatches) {
@@ -453,7 +445,7 @@ static int filter_list_check_attributes(
453
445
 
454
446
  for (i = 0; !error && i < fdef->nattrs; ++i) {
455
447
  const char *want = fdef->attrs[fdef->nattrs + i];
456
- git_attr_value_t want_type, found_type;
448
+ git_attr_t want_type, found_type;
457
449
 
458
450
  if (!want)
459
451
  continue;
@@ -463,7 +455,7 @@ static int filter_list_check_attributes(
463
455
 
464
456
  if (want_type != found_type)
465
457
  error = GIT_ENOTFOUND;
466
- else if (want_type == GIT_ATTR_VALUE_STRING &&
458
+ else if (want_type == GIT_ATTR_VALUE_T &&
467
459
  strcmp(want, strs[i]) &&
468
460
  strcmp(want, "*"))
469
461
  error = GIT_ENOTFOUND;
@@ -764,7 +756,7 @@ int git_filter_list_apply_to_file(
764
756
 
765
757
  static int buf_from_blob(git_buf *out, git_blob *blob)
766
758
  {
767
- git_object_size_t rawsize = git_blob_rawsize(blob);
759
+ git_off_t rawsize = git_blob_rawsize(blob);
768
760
 
769
761
  if (!git__is_sizet(rawsize)) {
770
762
  git_error_set(GIT_ERROR_OS, "blob is too large to filter");
@@ -0,0 +1,248 @@
1
+ /*
2
+ * Copyright (C) the libgit2 contributors. All rights reserved.
3
+ *
4
+ * This file is part of libgit2, distributed under the GNU GPL v2 with
5
+ * a Linking Exception. For full terms see the included COPYING file.
6
+ */
7
+
8
+ /*
9
+ * This file contains code originally derrived from OpenBSD fnmatch.c
10
+ *
11
+ * Copyright (c) 1989, 1993, 1994
12
+ * The Regents of the University of California. All rights reserved.
13
+ *
14
+ * This code is derived from software contributed to Berkeley by
15
+ * Guido van Rossum.
16
+ *
17
+ * Redistribution and use in source and binary forms, with or without
18
+ * modification, are permitted provided that the following conditions
19
+ * are met:
20
+ * 1. Redistributions of source code must retain the above copyright
21
+ * notice, this list of conditions and the following disclaimer.
22
+ * 2. Redistributions in binary form must reproduce the above copyright
23
+ * notice, this list of conditions and the following disclaimer in the
24
+ * documentation and/or other materials provided with the distribution.
25
+ * 3. Neither the name of the University nor the names of its contributors
26
+ * may be used to endorse or promote products derived from this software
27
+ * without specific prior written permission.
28
+ *
29
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
30
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
31
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
32
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
33
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
34
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
35
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
36
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
37
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
38
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
39
+ * SUCH DAMAGE.
40
+ */
41
+
42
+ /*
43
+ * Function fnmatch() as specified in POSIX 1003.2-1992, section B.6.
44
+ * Compares a filename or pathname to a pattern.
45
+ */
46
+
47
+ #include "fnmatch.h"
48
+
49
+ #include <ctype.h>
50
+ #include <stdio.h>
51
+ #include <string.h>
52
+
53
+ #define EOS '\0'
54
+
55
+ #define RANGE_MATCH 1
56
+ #define RANGE_NOMATCH 0
57
+ #define RANGE_ERROR (-1)
58
+
59
+ static int rangematch(const char *, char, int, char **);
60
+
61
+ static int
62
+ p_fnmatchx(const char *pattern, const char *string, int flags, size_t recurs)
63
+ {
64
+ const char *stringstart;
65
+ char *newp;
66
+ char c, test;
67
+ int recurs_flags = flags & ~FNM_PERIOD;
68
+
69
+ if (recurs-- == 0)
70
+ return FNM_NORES;
71
+
72
+ for (stringstart = string;;)
73
+ switch (c = *pattern++) {
74
+ case EOS:
75
+ if ((flags & FNM_LEADING_DIR) && *string == '/')
76
+ return (0);
77
+ return (*string == EOS ? 0 : FNM_NOMATCH);
78
+ case '?':
79
+ if (*string == EOS)
80
+ return (FNM_NOMATCH);
81
+ if (*string == '/' && (flags & FNM_PATHNAME))
82
+ return (FNM_NOMATCH);
83
+ if (*string == '.' && (flags & FNM_PERIOD) &&
84
+ (string == stringstart ||
85
+ ((flags & FNM_PATHNAME) && *(string - 1) == '/')))
86
+ return (FNM_NOMATCH);
87
+ ++string;
88
+ break;
89
+ case '*':
90
+ c = *pattern;
91
+
92
+ /* Let '**' override PATHNAME match for this segment.
93
+ * It will be restored if/when we recurse below.
94
+ */
95
+ if (c == '*') {
96
+ c = *++pattern;
97
+ /* star-star-slash is at the end, match by default */
98
+ if (c == EOS)
99
+ return 0;
100
+ /* Double-star must be at end or between slashes */
101
+ if (c != '/')
102
+ return (FNM_NOMATCH);
103
+
104
+ c = *++pattern;
105
+ do {
106
+ int e = p_fnmatchx(pattern, string, recurs_flags, recurs);
107
+ if (e != FNM_NOMATCH)
108
+ return e;
109
+ string = strchr(string, '/');
110
+ } while (string++);
111
+
112
+ /* If we get here, we didn't find a match */
113
+ return FNM_NOMATCH;
114
+ }
115
+
116
+ if (*string == '.' && (flags & FNM_PERIOD) &&
117
+ (string == stringstart ||
118
+ ((flags & FNM_PATHNAME) && *(string - 1) == '/')))
119
+ return (FNM_NOMATCH);
120
+
121
+ /* Optimize for pattern with * at end or before /. */
122
+ if (c == EOS) {
123
+ if (flags & FNM_PATHNAME)
124
+ return ((flags & FNM_LEADING_DIR) ||
125
+ strchr(string, '/') == NULL ?
126
+ 0 : FNM_NOMATCH);
127
+ else
128
+ return (0);
129
+ } else if (c == '/' && (flags & FNM_PATHNAME)) {
130
+ if ((string = strchr(string, '/')) == NULL)
131
+ return (FNM_NOMATCH);
132
+ break;
133
+ }
134
+
135
+ /* General case, use recursion. */
136
+ while ((test = *string) != EOS) {
137
+ int e;
138
+
139
+ e = p_fnmatchx(pattern, string, recurs_flags, recurs);
140
+ if (e != FNM_NOMATCH)
141
+ return e;
142
+ if (test == '/' && (flags & FNM_PATHNAME))
143
+ break;
144
+ ++string;
145
+ }
146
+ return (FNM_NOMATCH);
147
+ case '[':
148
+ if (*string == EOS)
149
+ return (FNM_NOMATCH);
150
+ if (*string == '/' && (flags & FNM_PATHNAME))
151
+ return (FNM_NOMATCH);
152
+ if (*string == '.' && (flags & FNM_PERIOD) &&
153
+ (string == stringstart ||
154
+ ((flags & FNM_PATHNAME) && *(string - 1) == '/')))
155
+ return (FNM_NOMATCH);
156
+
157
+ switch (rangematch(pattern, *string, flags, &newp)) {
158
+ case RANGE_ERROR:
159
+ /* not a good range, treat as normal text */
160
+ goto normal;
161
+ case RANGE_MATCH:
162
+ pattern = newp;
163
+ break;
164
+ case RANGE_NOMATCH:
165
+ return (FNM_NOMATCH);
166
+ }
167
+ ++string;
168
+ break;
169
+ case '\\':
170
+ if (!(flags & FNM_NOESCAPE)) {
171
+ if ((c = *pattern++) == EOS) {
172
+ c = '\\';
173
+ --pattern;
174
+ }
175
+ }
176
+ /* FALLTHROUGH */
177
+ default:
178
+ normal:
179
+ if (c != *string && !((flags & FNM_CASEFOLD) &&
180
+ (git__tolower((unsigned char)c) ==
181
+ git__tolower((unsigned char)*string))))
182
+ return (FNM_NOMATCH);
183
+ ++string;
184
+ break;
185
+ }
186
+ /* NOTREACHED */
187
+ }
188
+
189
+ static int
190
+ rangematch(const char *pattern, char test, int flags, char **newp)
191
+ {
192
+ int negate, ok;
193
+ char c, c2;
194
+
195
+ /*
196
+ * A bracket expression starting with an unquoted circumflex
197
+ * character produces unspecified results (IEEE 1003.2-1992,
198
+ * 3.13.2). This implementation treats it like '!', for
199
+ * consistency with the regular expression syntax.
200
+ * J.T. Conklin (conklin@ngai.kaleida.com)
201
+ */
202
+ if ((negate = (*pattern == '!' || *pattern == '^')) != 0)
203
+ ++pattern;
204
+
205
+ if (flags & FNM_CASEFOLD)
206
+ test = (char)git__tolower((unsigned char)test);
207
+
208
+ /*
209
+ * A right bracket shall lose its special meaning and represent
210
+ * itself in a bracket expression if it occurs first in the list.
211
+ * -- POSIX.2 2.8.3.2
212
+ */
213
+ ok = 0;
214
+ c = *pattern++;
215
+ do {
216
+ if (c == '\\' && !(flags & FNM_NOESCAPE))
217
+ c = *pattern++;
218
+ if (c == EOS)
219
+ return (RANGE_ERROR);
220
+ if (c == '/' && (flags & FNM_PATHNAME))
221
+ return (RANGE_NOMATCH);
222
+ if ((flags & FNM_CASEFOLD))
223
+ c = (char)git__tolower((unsigned char)c);
224
+ if (*pattern == '-'
225
+ && (c2 = *(pattern+1)) != EOS && c2 != ']') {
226
+ pattern += 2;
227
+ if (c2 == '\\' && !(flags & FNM_NOESCAPE))
228
+ c2 = *pattern++;
229
+ if (c2 == EOS)
230
+ return (RANGE_ERROR);
231
+ if (flags & FNM_CASEFOLD)
232
+ c2 = (char)git__tolower((unsigned char)c2);
233
+ if (c <= test && test <= c2)
234
+ ok = 1;
235
+ } else if (c == test)
236
+ ok = 1;
237
+ } while ((c = *pattern++) != ']');
238
+
239
+ *newp = (char *)pattern;
240
+ return (ok == negate ? RANGE_NOMATCH : RANGE_MATCH);
241
+ }
242
+
243
+ int
244
+ p_fnmatch(const char *pattern, const char *string, int flags)
245
+ {
246
+ return p_fnmatchx(pattern, string, flags, 64);
247
+ }
248
+