rugged 0.27.7 → 0.27.10

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 (409) hide show
  1. checksums.yaml +4 -4
  2. data/lib/rugged/version.rb +1 -1
  3. data/vendor/libgit2/AUTHORS +1 -0
  4. data/vendor/libgit2/CMakeLists.txt +99 -51
  5. data/vendor/libgit2/COPYING +28 -0
  6. data/vendor/libgit2/cmake/Modules/AddCFlagIfSupported.cmake +15 -1
  7. data/vendor/libgit2/cmake/Modules/CheckPrototypeDefinition.c.in +29 -0
  8. data/vendor/libgit2/cmake/Modules/CheckPrototypeDefinition.cmake +96 -0
  9. data/vendor/libgit2/cmake/Modules/EnableWarnings.cmake +9 -8
  10. data/vendor/libgit2/cmake/Modules/FindCoreFoundation.cmake +2 -2
  11. data/vendor/libgit2/cmake/Modules/FindGSSAPI.cmake +1 -1
  12. data/vendor/libgit2/cmake/Modules/FindGSSFramework.cmake +28 -0
  13. data/vendor/libgit2/cmake/Modules/FindIconv.cmake +11 -6
  14. data/vendor/libgit2/cmake/Modules/FindPCRE.cmake +38 -0
  15. data/vendor/libgit2/cmake/Modules/FindPCRE2.cmake +37 -0
  16. data/vendor/libgit2/cmake/Modules/FindSecurity.cmake +2 -2
  17. data/vendor/libgit2/cmake/Modules/FindStatNsec.cmake +6 -0
  18. data/vendor/libgit2/cmake/Modules/PkgBuildConfig.cmake +110 -0
  19. data/vendor/libgit2/cmake/Modules/SelectGSSAPI.cmake +53 -0
  20. data/vendor/libgit2/cmake/Modules/SelectHTTPSBackend.cmake +124 -0
  21. data/vendor/libgit2/cmake/Modules/SelectHashes.cmake +66 -0
  22. data/vendor/libgit2/deps/http-parser/http_parser.c +11 -6
  23. data/vendor/libgit2/deps/ntlmclient/CMakeLists.txt +21 -0
  24. data/vendor/libgit2/deps/ntlmclient/compat.h +33 -0
  25. data/vendor/libgit2/deps/ntlmclient/crypt.h +64 -0
  26. data/vendor/libgit2/deps/ntlmclient/crypt_commoncrypto.c +120 -0
  27. data/vendor/libgit2/deps/ntlmclient/crypt_commoncrypto.h +18 -0
  28. data/vendor/libgit2/deps/ntlmclient/crypt_mbedtls.c +145 -0
  29. data/vendor/libgit2/deps/ntlmclient/crypt_mbedtls.h +18 -0
  30. data/vendor/libgit2/deps/ntlmclient/crypt_openssl.c +130 -0
  31. data/vendor/libgit2/deps/ntlmclient/crypt_openssl.h +21 -0
  32. data/vendor/libgit2/deps/ntlmclient/ntlm.c +1420 -0
  33. data/vendor/libgit2/deps/ntlmclient/ntlm.h +174 -0
  34. data/vendor/libgit2/deps/ntlmclient/ntlmclient.h +320 -0
  35. data/vendor/libgit2/deps/ntlmclient/unicode.h +36 -0
  36. data/vendor/libgit2/deps/ntlmclient/unicode_builtin.c +445 -0
  37. data/vendor/libgit2/deps/ntlmclient/unicode_iconv.c +201 -0
  38. data/vendor/libgit2/deps/ntlmclient/utf8.h +1257 -0
  39. data/vendor/libgit2/deps/ntlmclient/util.c +21 -0
  40. data/vendor/libgit2/deps/ntlmclient/util.h +14 -0
  41. data/vendor/libgit2/deps/pcre/CMakeLists.txt +140 -0
  42. data/vendor/libgit2/deps/pcre/COPYING +5 -0
  43. data/vendor/libgit2/deps/pcre/cmake/COPYING-CMAKE-SCRIPTS +22 -0
  44. data/vendor/libgit2/deps/pcre/cmake/FindEditline.cmake +17 -0
  45. data/vendor/libgit2/deps/pcre/cmake/FindPackageHandleStandardArgs.cmake +58 -0
  46. data/vendor/libgit2/deps/pcre/cmake/FindReadline.cmake +29 -0
  47. data/vendor/libgit2/deps/pcre/config.h.in +57 -0
  48. data/vendor/libgit2/deps/pcre/pcre.h +641 -0
  49. data/vendor/libgit2/deps/pcre/pcre_byte_order.c +319 -0
  50. data/vendor/libgit2/deps/pcre/pcre_chartables.c +198 -0
  51. data/vendor/libgit2/deps/pcre/pcre_compile.c +9800 -0
  52. data/vendor/libgit2/deps/pcre/pcre_config.c +190 -0
  53. data/vendor/libgit2/deps/pcre/pcre_dfa_exec.c +3676 -0
  54. data/vendor/libgit2/deps/pcre/pcre_exec.c +7173 -0
  55. data/vendor/libgit2/deps/pcre/pcre_fullinfo.c +245 -0
  56. data/vendor/libgit2/deps/pcre/pcre_get.c +669 -0
  57. data/vendor/libgit2/deps/pcre/pcre_globals.c +86 -0
  58. data/vendor/libgit2/deps/pcre/pcre_internal.h +2787 -0
  59. data/vendor/libgit2/deps/pcre/pcre_jit_compile.c +11913 -0
  60. data/vendor/libgit2/deps/pcre/pcre_maketables.c +156 -0
  61. data/vendor/libgit2/deps/pcre/pcre_newline.c +210 -0
  62. data/vendor/libgit2/deps/pcre/pcre_ord2utf8.c +94 -0
  63. data/vendor/libgit2/deps/pcre/pcre_printint.c +834 -0
  64. data/vendor/libgit2/deps/pcre/pcre_refcount.c +92 -0
  65. data/vendor/libgit2/deps/pcre/pcre_string_utils.c +211 -0
  66. data/vendor/libgit2/deps/pcre/pcre_study.c +1686 -0
  67. data/vendor/libgit2/deps/pcre/pcre_tables.c +727 -0
  68. data/vendor/libgit2/deps/pcre/pcre_ucd.c +3644 -0
  69. data/vendor/libgit2/deps/pcre/pcre_valid_utf8.c +301 -0
  70. data/vendor/libgit2/deps/pcre/pcre_version.c +98 -0
  71. data/vendor/libgit2/deps/pcre/pcre_xclass.c +268 -0
  72. data/vendor/libgit2/deps/pcre/pcreposix.c +421 -0
  73. data/vendor/libgit2/deps/pcre/pcreposix.h +117 -0
  74. data/vendor/libgit2/deps/pcre/ucp.h +224 -0
  75. data/vendor/libgit2/deps/winhttp/COPYING.GPL +993 -0
  76. data/vendor/libgit2/deps/winhttp/COPYING.LGPL +502 -0
  77. data/vendor/libgit2/deps/zlib/CMakeLists.txt +1 -0
  78. data/vendor/libgit2/deps/zlib/COPYING +27 -0
  79. data/vendor/libgit2/deps/zlib/adler32.c +0 -7
  80. data/vendor/libgit2/deps/zlib/crc32.c +0 -7
  81. data/vendor/libgit2/include/git2/annotated_commit.h +9 -0
  82. data/vendor/libgit2/include/git2/apply.h +149 -0
  83. data/vendor/libgit2/include/git2/attr.h +20 -13
  84. data/vendor/libgit2/include/git2/blame.h +4 -4
  85. data/vendor/libgit2/include/git2/blob.h +44 -12
  86. data/vendor/libgit2/include/git2/buffer.h +20 -26
  87. data/vendor/libgit2/include/git2/cert.h +135 -0
  88. data/vendor/libgit2/include/git2/checkout.h +53 -21
  89. data/vendor/libgit2/include/git2/cherrypick.h +3 -3
  90. data/vendor/libgit2/include/git2/clone.h +5 -5
  91. data/vendor/libgit2/include/git2/commit.h +25 -3
  92. data/vendor/libgit2/include/git2/common.h +35 -10
  93. data/vendor/libgit2/include/git2/config.h +29 -19
  94. data/vendor/libgit2/include/git2/cred.h +308 -0
  95. data/vendor/libgit2/include/git2/deprecated.h +493 -0
  96. data/vendor/libgit2/include/git2/describe.h +4 -4
  97. data/vendor/libgit2/include/git2/diff.h +177 -135
  98. data/vendor/libgit2/include/git2/errors.h +53 -46
  99. data/vendor/libgit2/include/git2/filter.h +8 -0
  100. data/vendor/libgit2/include/git2/index.h +74 -52
  101. data/vendor/libgit2/include/git2/indexer.h +76 -6
  102. data/vendor/libgit2/include/git2/merge.h +25 -10
  103. data/vendor/libgit2/include/git2/net.h +0 -5
  104. data/vendor/libgit2/include/git2/notes.h +1 -1
  105. data/vendor/libgit2/include/git2/object.h +17 -29
  106. data/vendor/libgit2/include/git2/odb.h +12 -11
  107. data/vendor/libgit2/include/git2/odb_backend.h +10 -9
  108. data/vendor/libgit2/include/git2/oid.h +2 -2
  109. data/vendor/libgit2/include/git2/pack.h +14 -3
  110. data/vendor/libgit2/include/git2/proxy.h +5 -3
  111. data/vendor/libgit2/include/git2/rebase.h +46 -2
  112. data/vendor/libgit2/include/git2/refs.h +34 -16
  113. data/vendor/libgit2/include/git2/remote.h +111 -14
  114. data/vendor/libgit2/include/git2/repository.h +69 -34
  115. data/vendor/libgit2/include/git2/revert.h +1 -1
  116. data/vendor/libgit2/include/git2/revwalk.h +7 -7
  117. data/vendor/libgit2/include/git2/signature.h +2 -2
  118. data/vendor/libgit2/include/git2/stash.h +5 -5
  119. data/vendor/libgit2/include/git2/status.h +26 -17
  120. data/vendor/libgit2/include/git2/submodule.h +23 -6
  121. data/vendor/libgit2/include/git2/sys/alloc.h +18 -18
  122. data/vendor/libgit2/include/git2/sys/commit.h +1 -1
  123. data/vendor/libgit2/include/git2/sys/config.h +13 -13
  124. data/vendor/libgit2/include/git2/sys/cred.h +90 -0
  125. data/vendor/libgit2/include/git2/sys/filter.h +6 -6
  126. data/vendor/libgit2/include/git2/sys/merge.h +3 -3
  127. data/vendor/libgit2/include/git2/sys/odb_backend.h +66 -22
  128. data/vendor/libgit2/include/git2/sys/path.h +14 -5
  129. data/vendor/libgit2/include/git2/sys/refdb_backend.h +76 -40
  130. data/vendor/libgit2/include/git2/sys/repository.h +5 -1
  131. data/vendor/libgit2/include/git2/sys/stream.h +92 -12
  132. data/vendor/libgit2/include/git2/sys/transport.h +129 -83
  133. data/vendor/libgit2/include/git2/tag.h +13 -4
  134. data/vendor/libgit2/include/git2/trace.h +2 -2
  135. data/vendor/libgit2/include/git2/transport.h +11 -311
  136. data/vendor/libgit2/include/git2/tree.h +4 -4
  137. data/vendor/libgit2/include/git2/types.h +25 -106
  138. data/vendor/libgit2/include/git2/version.h +3 -3
  139. data/vendor/libgit2/include/git2/worktree.h +5 -5
  140. data/vendor/libgit2/include/git2.h +4 -0
  141. data/vendor/libgit2/src/CMakeLists.txt +104 -235
  142. data/vendor/libgit2/src/alloc.c +14 -18
  143. data/vendor/libgit2/src/{stdalloc.c → allocators/stdalloc.c} +7 -8
  144. data/vendor/libgit2/src/{stdalloc.h → allocators/stdalloc.h} +4 -4
  145. data/vendor/libgit2/src/allocators/win32_crtdbg.c +118 -0
  146. data/vendor/libgit2/src/{transports/cred.h → allocators/win32_crtdbg.h} +5 -4
  147. data/vendor/libgit2/src/annotated_commit.c +18 -11
  148. data/vendor/libgit2/src/apply.c +535 -28
  149. data/vendor/libgit2/src/apply.h +3 -1
  150. data/vendor/libgit2/src/array.h +2 -2
  151. data/vendor/libgit2/src/attr.c +77 -71
  152. data/vendor/libgit2/src/attr_file.c +203 -117
  153. data/vendor/libgit2/src/attr_file.h +9 -9
  154. data/vendor/libgit2/src/attrcache.c +49 -51
  155. data/vendor/libgit2/src/attrcache.h +2 -1
  156. data/vendor/libgit2/src/blame.c +38 -18
  157. data/vendor/libgit2/src/blame.h +1 -1
  158. data/vendor/libgit2/src/blame_git.c +29 -15
  159. data/vendor/libgit2/src/blob.c +123 -37
  160. data/vendor/libgit2/src/blob.h +19 -2
  161. data/vendor/libgit2/src/branch.c +47 -23
  162. data/vendor/libgit2/src/buf_text.c +7 -6
  163. data/vendor/libgit2/src/buffer.c +60 -53
  164. data/vendor/libgit2/src/cache.c +38 -45
  165. data/vendor/libgit2/src/cache.h +3 -3
  166. data/vendor/libgit2/src/cc-compat.h +20 -3
  167. data/vendor/libgit2/src/checkout.c +77 -67
  168. data/vendor/libgit2/src/cherrypick.c +12 -6
  169. data/vendor/libgit2/src/clone.c +36 -14
  170. data/vendor/libgit2/src/clone.h +4 -0
  171. data/vendor/libgit2/src/commit.c +103 -48
  172. data/vendor/libgit2/src/commit.h +7 -0
  173. data/vendor/libgit2/src/commit_list.c +36 -78
  174. data/vendor/libgit2/src/commit_list.h +2 -2
  175. data/vendor/libgit2/src/common.h +24 -90
  176. data/vendor/libgit2/src/config.c +203 -176
  177. data/vendor/libgit2/src/config.h +8 -20
  178. data/vendor/libgit2/src/config_backend.h +96 -0
  179. data/vendor/libgit2/src/config_cache.c +41 -35
  180. data/vendor/libgit2/src/config_entries.c +229 -0
  181. data/vendor/libgit2/src/config_entries.h +24 -0
  182. data/vendor/libgit2/src/config_file.c +422 -680
  183. data/vendor/libgit2/src/config_mem.c +220 -0
  184. data/vendor/libgit2/src/config_parse.c +96 -68
  185. data/vendor/libgit2/src/config_parse.h +15 -14
  186. data/vendor/libgit2/src/config_snapshot.c +206 -0
  187. data/vendor/libgit2/src/crlf.c +219 -196
  188. data/vendor/libgit2/src/delta.c +25 -18
  189. data/vendor/libgit2/src/describe.c +42 -41
  190. data/vendor/libgit2/src/diff.c +52 -67
  191. data/vendor/libgit2/src/diff.h +2 -1
  192. data/vendor/libgit2/src/diff_driver.c +44 -46
  193. data/vendor/libgit2/src/diff_file.c +16 -14
  194. data/vendor/libgit2/src/diff_file.h +1 -1
  195. data/vendor/libgit2/src/diff_generate.c +158 -103
  196. data/vendor/libgit2/src/diff_generate.h +3 -3
  197. data/vendor/libgit2/src/diff_parse.c +4 -4
  198. data/vendor/libgit2/src/diff_print.c +34 -22
  199. data/vendor/libgit2/src/diff_stats.c +22 -7
  200. data/vendor/libgit2/src/diff_tform.c +18 -16
  201. data/vendor/libgit2/src/diff_xdiff.c +3 -3
  202. data/vendor/libgit2/src/errors.c +51 -39
  203. data/vendor/libgit2/src/errors.h +81 -0
  204. data/vendor/libgit2/src/features.h.in +9 -3
  205. data/vendor/libgit2/src/fetch.c +8 -3
  206. data/vendor/libgit2/src/fetchhead.c +12 -12
  207. data/vendor/libgit2/src/filebuf.c +28 -32
  208. data/vendor/libgit2/src/filebuf.h +2 -2
  209. data/vendor/libgit2/src/filter.c +47 -33
  210. data/vendor/libgit2/src/filter.h +0 -10
  211. data/vendor/libgit2/src/{fileops.c → futils.c} +70 -63
  212. data/vendor/libgit2/src/{fileops.h → futils.h} +6 -6
  213. data/vendor/libgit2/src/global.c +35 -55
  214. data/vendor/libgit2/src/global.h +0 -2
  215. data/vendor/libgit2/src/hash/sha1/collisiondetect.c +48 -0
  216. data/vendor/libgit2/src/hash/sha1/collisiondetect.h +19 -0
  217. data/vendor/libgit2/src/hash/{hash_common_crypto.h → sha1/common_crypto.c} +17 -17
  218. data/vendor/libgit2/src/hash/sha1/common_crypto.h +19 -0
  219. data/vendor/libgit2/src/hash/{hash_generic.c → sha1/generic.c} +22 -10
  220. data/vendor/libgit2/src/hash/{hash_generic.h → sha1/generic.h} +4 -10
  221. data/vendor/libgit2/src/hash/{hash_mbedtls.c → sha1/mbedtls.c} +15 -7
  222. data/vendor/libgit2/src/hash/{hash_mbedtls.h → sha1/mbedtls.h} +6 -7
  223. data/vendor/libgit2/src/hash/sha1/openssl.c +59 -0
  224. data/vendor/libgit2/src/hash/sha1/openssl.h +19 -0
  225. data/vendor/libgit2/src/hash/{sha1dc → sha1/sha1dc}/sha1.c +14 -3
  226. data/vendor/libgit2/src/hash/{hash_win32.c → sha1/win32.c} +47 -37
  227. data/vendor/libgit2/src/hash/{hash_win32.h → sha1/win32.h} +6 -19
  228. data/vendor/libgit2/src/hash/sha1.h +38 -0
  229. data/vendor/libgit2/src/hash.c +61 -0
  230. data/vendor/libgit2/src/hash.h +20 -21
  231. data/vendor/libgit2/src/hashsig.c +5 -5
  232. data/vendor/libgit2/src/idxmap.c +107 -61
  233. data/vendor/libgit2/src/idxmap.h +153 -31
  234. data/vendor/libgit2/src/ignore.c +38 -42
  235. data/vendor/libgit2/src/index.c +264 -199
  236. data/vendor/libgit2/src/index.h +7 -1
  237. data/vendor/libgit2/src/indexer.c +338 -167
  238. data/vendor/libgit2/src/integer.h +71 -26
  239. data/vendor/libgit2/src/iterator.c +134 -62
  240. data/vendor/libgit2/src/iterator.h +15 -0
  241. data/vendor/libgit2/src/mailmap.c +8 -8
  242. data/vendor/libgit2/src/map.h +1 -1
  243. data/vendor/libgit2/src/merge.c +137 -93
  244. data/vendor/libgit2/src/merge_driver.c +11 -11
  245. data/vendor/libgit2/src/merge_file.c +2 -2
  246. data/vendor/libgit2/src/mwindow.c +24 -29
  247. data/vendor/libgit2/src/mwindow.h +4 -4
  248. data/vendor/libgit2/src/net.c +184 -0
  249. data/vendor/libgit2/src/net.h +36 -0
  250. data/vendor/libgit2/src/netops.c +55 -156
  251. data/vendor/libgit2/src/netops.h +3 -23
  252. data/vendor/libgit2/src/notes.c +14 -9
  253. data/vendor/libgit2/src/object.c +120 -69
  254. data/vendor/libgit2/src/object.h +22 -9
  255. data/vendor/libgit2/src/object_api.c +8 -8
  256. data/vendor/libgit2/src/odb.c +111 -88
  257. data/vendor/libgit2/src/odb.h +8 -7
  258. data/vendor/libgit2/src/odb_loose.c +58 -47
  259. data/vendor/libgit2/src/odb_mempack.c +21 -34
  260. data/vendor/libgit2/src/odb_pack.c +17 -13
  261. data/vendor/libgit2/src/offmap.c +53 -35
  262. data/vendor/libgit2/src/offmap.h +108 -21
  263. data/vendor/libgit2/src/oid.c +12 -7
  264. data/vendor/libgit2/src/oidmap.c +49 -47
  265. data/vendor/libgit2/src/oidmap.h +101 -24
  266. data/vendor/libgit2/src/pack-objects.c +87 -86
  267. data/vendor/libgit2/src/pack-objects.h +2 -8
  268. data/vendor/libgit2/src/pack.c +94 -96
  269. data/vendor/libgit2/src/pack.h +16 -18
  270. data/vendor/libgit2/src/parse.c +17 -4
  271. data/vendor/libgit2/src/parse.h +3 -3
  272. data/vendor/libgit2/src/patch.c +3 -3
  273. data/vendor/libgit2/src/patch_generate.c +18 -18
  274. data/vendor/libgit2/src/patch_parse.c +147 -79
  275. data/vendor/libgit2/src/path.c +207 -62
  276. data/vendor/libgit2/src/path.h +14 -0
  277. data/vendor/libgit2/src/pathspec.c +18 -18
  278. data/vendor/libgit2/src/pool.c +26 -22
  279. data/vendor/libgit2/src/pool.h +7 -7
  280. data/vendor/libgit2/src/posix.c +10 -10
  281. data/vendor/libgit2/src/posix.h +12 -1
  282. data/vendor/libgit2/src/proxy.c +8 -3
  283. data/vendor/libgit2/src/push.c +35 -29
  284. data/vendor/libgit2/src/push.h +2 -1
  285. data/vendor/libgit2/src/reader.c +265 -0
  286. data/vendor/libgit2/src/reader.h +107 -0
  287. data/vendor/libgit2/src/rebase.c +97 -38
  288. data/vendor/libgit2/src/refdb.c +15 -3
  289. data/vendor/libgit2/src/refdb_fs.c +318 -222
  290. data/vendor/libgit2/src/reflog.c +13 -15
  291. data/vendor/libgit2/src/refs.c +122 -89
  292. data/vendor/libgit2/src/refs.h +5 -3
  293. data/vendor/libgit2/src/refspec.c +27 -33
  294. data/vendor/libgit2/src/regexp.c +221 -0
  295. data/vendor/libgit2/src/regexp.h +97 -0
  296. data/vendor/libgit2/src/remote.c +229 -178
  297. data/vendor/libgit2/src/remote.h +11 -2
  298. data/vendor/libgit2/src/repository.c +227 -172
  299. data/vendor/libgit2/src/repository.h +52 -40
  300. data/vendor/libgit2/src/reset.c +7 -7
  301. data/vendor/libgit2/src/revert.c +11 -6
  302. data/vendor/libgit2/src/revparse.c +46 -46
  303. data/vendor/libgit2/src/revwalk.c +89 -54
  304. data/vendor/libgit2/src/revwalk.h +20 -0
  305. data/vendor/libgit2/src/settings.c +22 -9
  306. data/vendor/libgit2/src/signature.c +15 -13
  307. data/vendor/libgit2/src/sortedcache.c +22 -36
  308. data/vendor/libgit2/src/sortedcache.h +1 -1
  309. data/vendor/libgit2/src/stash.c +56 -76
  310. data/vendor/libgit2/src/status.c +27 -21
  311. data/vendor/libgit2/src/stream.h +17 -2
  312. data/vendor/libgit2/src/streams/mbedtls.c +100 -80
  313. data/vendor/libgit2/src/streams/mbedtls.h +5 -2
  314. data/vendor/libgit2/src/streams/openssl.c +93 -81
  315. data/vendor/libgit2/src/streams/openssl.h +5 -2
  316. data/vendor/libgit2/src/streams/registry.c +118 -0
  317. data/vendor/libgit2/src/streams/registry.h +19 -0
  318. data/vendor/libgit2/src/streams/socket.c +55 -30
  319. data/vendor/libgit2/src/streams/stransport.c +57 -32
  320. data/vendor/libgit2/src/streams/stransport.h +5 -0
  321. data/vendor/libgit2/src/streams/tls.c +48 -20
  322. data/vendor/libgit2/src/streams/tls.h +12 -4
  323. data/vendor/libgit2/src/strmap.c +47 -74
  324. data/vendor/libgit2/src/strmap.h +108 -33
  325. data/vendor/libgit2/src/submodule.c +190 -169
  326. data/vendor/libgit2/src/submodule.h +1 -1
  327. data/vendor/libgit2/src/sysdir.c +25 -15
  328. data/vendor/libgit2/src/tag.c +39 -26
  329. data/vendor/libgit2/src/tag.h +2 -1
  330. data/vendor/libgit2/src/trace.c +2 -2
  331. data/vendor/libgit2/src/trace.h +2 -2
  332. data/vendor/libgit2/src/trailer.c +46 -32
  333. data/vendor/libgit2/src/transaction.c +30 -29
  334. data/vendor/libgit2/src/transport.c +3 -3
  335. data/vendor/libgit2/src/transports/auth.c +14 -10
  336. data/vendor/libgit2/src/transports/auth.h +10 -3
  337. data/vendor/libgit2/src/transports/auth_negotiate.c +31 -16
  338. data/vendor/libgit2/src/transports/auth_negotiate.h +2 -2
  339. data/vendor/libgit2/src/transports/auth_ntlm.c +223 -0
  340. data/vendor/libgit2/src/transports/auth_ntlm.h +35 -0
  341. data/vendor/libgit2/src/transports/cred.c +24 -24
  342. data/vendor/libgit2/src/transports/git.c +25 -30
  343. data/vendor/libgit2/src/transports/http.c +871 -335
  344. data/vendor/libgit2/src/transports/http.h +2 -0
  345. data/vendor/libgit2/src/transports/local.c +28 -28
  346. data/vendor/libgit2/src/transports/smart.c +64 -46
  347. data/vendor/libgit2/src/transports/smart.h +5 -6
  348. data/vendor/libgit2/src/transports/smart_pkt.c +162 -151
  349. data/vendor/libgit2/src/transports/smart_protocol.c +64 -94
  350. data/vendor/libgit2/src/transports/ssh.c +76 -65
  351. data/vendor/libgit2/src/transports/winhttp.c +328 -319
  352. data/vendor/libgit2/src/tree-cache.c +21 -14
  353. data/vendor/libgit2/src/tree.c +119 -112
  354. data/vendor/libgit2/src/tree.h +1 -0
  355. data/vendor/libgit2/src/unix/map.c +3 -3
  356. data/vendor/libgit2/src/unix/posix.h +1 -11
  357. data/vendor/libgit2/src/userdiff.h +3 -1
  358. data/vendor/libgit2/src/util.c +154 -93
  359. data/vendor/libgit2/src/util.h +19 -23
  360. data/vendor/libgit2/src/vector.c +15 -10
  361. data/vendor/libgit2/src/wildmatch.c +320 -0
  362. data/vendor/libgit2/src/wildmatch.h +23 -0
  363. data/vendor/libgit2/src/win32/dir.c +3 -3
  364. data/vendor/libgit2/src/win32/findfile.c +1 -1
  365. data/vendor/libgit2/src/win32/map.c +9 -11
  366. data/vendor/libgit2/src/win32/msvc-compat.h +6 -0
  367. data/vendor/libgit2/src/win32/path_w32.c +113 -9
  368. data/vendor/libgit2/src/win32/path_w32.h +18 -29
  369. data/vendor/libgit2/src/win32/posix.h +1 -4
  370. data/vendor/libgit2/src/win32/posix_w32.c +69 -44
  371. data/vendor/libgit2/src/win32/precompiled.h +0 -2
  372. data/vendor/libgit2/src/win32/thread.c +5 -10
  373. data/vendor/libgit2/src/win32/w32_buffer.c +9 -5
  374. data/vendor/libgit2/src/win32/w32_common.h +39 -0
  375. data/vendor/libgit2/src/win32/w32_crtdbg_stacktrace.c +2 -95
  376. data/vendor/libgit2/src/win32/w32_crtdbg_stacktrace.h +0 -2
  377. data/vendor/libgit2/src/win32/w32_stack.c +6 -11
  378. data/vendor/libgit2/src/win32/w32_stack.h +3 -3
  379. data/vendor/libgit2/src/win32/w32_util.c +27 -64
  380. data/vendor/libgit2/src/win32/w32_util.h +5 -49
  381. data/vendor/libgit2/src/worktree.c +44 -30
  382. data/vendor/libgit2/src/xdiff/xdiffi.c +5 -5
  383. data/vendor/libgit2/src/xdiff/xhistogram.c +1 -1
  384. data/vendor/libgit2/src/xdiff/xmerge.c +27 -15
  385. data/vendor/libgit2/src/xdiff/xpatience.c +3 -0
  386. data/vendor/libgit2/src/zstream.c +4 -4
  387. metadata +115 -38
  388. data/vendor/libgit2/deps/regex/CMakeLists.txt +0 -2
  389. data/vendor/libgit2/deps/regex/config.h +0 -7
  390. data/vendor/libgit2/deps/regex/regcomp.c +0 -3857
  391. data/vendor/libgit2/deps/regex/regex.c +0 -92
  392. data/vendor/libgit2/deps/regex/regex.h +0 -582
  393. data/vendor/libgit2/deps/regex/regex_internal.c +0 -1744
  394. data/vendor/libgit2/deps/regex/regex_internal.h +0 -819
  395. data/vendor/libgit2/deps/regex/regexec.c +0 -4369
  396. data/vendor/libgit2/include/git2/inttypes.h +0 -309
  397. data/vendor/libgit2/include/git2/sys/time.h +0 -31
  398. data/vendor/libgit2/libgit2.pc.in +0 -13
  399. data/vendor/libgit2/src/config_file.h +0 -73
  400. data/vendor/libgit2/src/fnmatch.c +0 -248
  401. data/vendor/libgit2/src/fnmatch.h +0 -48
  402. data/vendor/libgit2/src/hash/hash_collisiondetect.h +0 -47
  403. data/vendor/libgit2/src/hash/hash_openssl.h +0 -59
  404. data/vendor/libgit2/src/streams/curl.c +0 -385
  405. data/vendor/libgit2/src/streams/curl.h +0 -17
  406. /data/vendor/libgit2/deps/http-parser/{LICENSE-MIT → COPYING} +0 -0
  407. /data/vendor/libgit2/src/hash/{sha1dc → sha1/sha1dc}/sha1.h +0 -0
  408. /data/vendor/libgit2/src/hash/{sha1dc → sha1/sha1dc}/ubc_check.c +0 -0
  409. /data/vendor/libgit2/src/hash/{sha1dc → sha1/sha1dc}/ubc_check.h +0 -0
@@ -7,13 +7,15 @@
7
7
 
8
8
  #include "config.h"
9
9
 
10
- #include "sysdir.h"
11
10
  #include "git2/config.h"
12
11
  #include "git2/sys/config.h"
13
- #include "vector.h"
12
+
14
13
  #include "buf_text.h"
15
- #include "config_file.h"
14
+ #include "config_backend.h"
15
+ #include "regexp.h"
16
+ #include "sysdir.h"
16
17
  #include "transaction.h"
18
+ #include "vector.h"
17
19
  #if GIT_WIN32
18
20
  # include <windows.h>
19
21
  #endif
@@ -31,30 +33,30 @@ void git_config_entry_free(git_config_entry *entry)
31
33
  typedef struct {
32
34
  git_refcount rc;
33
35
 
34
- git_config_backend *file;
36
+ git_config_backend *backend;
35
37
  git_config_level_t level;
36
- } file_internal;
38
+ } backend_internal;
37
39
 
38
- static void file_internal_free(file_internal *internal)
40
+ static void backend_internal_free(backend_internal *internal)
39
41
  {
40
- git_config_backend *file;
42
+ git_config_backend *backend;
41
43
 
42
- file = internal->file;
43
- file->free(file);
44
+ backend = internal->backend;
45
+ backend->free(backend);
44
46
  git__free(internal);
45
47
  }
46
48
 
47
49
  static void config_free(git_config *cfg)
48
50
  {
49
51
  size_t i;
50
- file_internal *internal;
52
+ backend_internal *internal;
51
53
 
52
- for (i = 0; i < cfg->files.length; ++i) {
53
- internal = git_vector_get(&cfg->files, i);
54
- GIT_REFCOUNT_DEC(internal, file_internal_free);
54
+ for (i = 0; i < cfg->backends.length; ++i) {
55
+ internal = git_vector_get(&cfg->backends, i);
56
+ GIT_REFCOUNT_DEC(internal, backend_internal_free);
55
57
  }
56
58
 
57
- git_vector_free(&cfg->files);
59
+ git_vector_free(&cfg->backends);
58
60
 
59
61
  git__memzero(cfg, sizeof(*cfg));
60
62
  git__free(cfg);
@@ -70,8 +72,8 @@ void git_config_free(git_config *cfg)
70
72
 
71
73
  static int config_backend_cmp(const void *a, const void *b)
72
74
  {
73
- const file_internal *bk_a = (const file_internal *)(a);
74
- const file_internal *bk_b = (const file_internal *)(b);
75
+ const backend_internal *bk_a = (const backend_internal *)(a);
76
+ const backend_internal *bk_b = (const backend_internal *)(b);
75
77
 
76
78
  return bk_b->level - bk_a->level;
77
79
  }
@@ -81,11 +83,11 @@ int git_config_new(git_config **out)
81
83
  git_config *cfg;
82
84
 
83
85
  cfg = git__malloc(sizeof(git_config));
84
- GITERR_CHECK_ALLOC(cfg);
86
+ GIT_ERROR_CHECK_ALLOC(cfg);
85
87
 
86
88
  memset(cfg, 0x0, sizeof(git_config));
87
89
 
88
- if (git_vector_init(&cfg->files, 3, config_backend_cmp) < 0) {
90
+ if (git_vector_init(&cfg->backends, 3, config_backend_cmp) < 0) {
89
91
  git__free(cfg);
90
92
  return -1;
91
93
  }
@@ -109,12 +111,12 @@ int git_config_add_file_ondisk(
109
111
  assert(cfg && path);
110
112
 
111
113
  res = p_stat(path, &st);
112
- if (res < 0 && errno != ENOENT) {
113
- giterr_set(GITERR_CONFIG, "failed to stat '%s'", path);
114
+ if (res < 0 && errno != ENOENT && errno != ENOTDIR) {
115
+ git_error_set(GIT_ERROR_CONFIG, "failed to stat '%s'", path);
114
116
  return -1;
115
117
  }
116
118
 
117
- if (git_config_file__ondisk(&file, path) < 0)
119
+ if (git_config_backend_from_file(&file, path) < 0)
118
120
  return -1;
119
121
 
120
122
  if ((res = git_config_add_backend(cfg, file, level, repo, force)) < 0) {
@@ -151,7 +153,7 @@ int git_config_snapshot(git_config **out, git_config *in)
151
153
  {
152
154
  int error = 0;
153
155
  size_t i;
154
- file_internal *internal;
156
+ backend_internal *internal;
155
157
  git_config *config;
156
158
 
157
159
  *out = NULL;
@@ -159,10 +161,10 @@ int git_config_snapshot(git_config **out, git_config *in)
159
161
  if (git_config_new(&config) < 0)
160
162
  return -1;
161
163
 
162
- git_vector_foreach(&in->files, i, internal) {
164
+ git_vector_foreach(&in->backends, i, internal) {
163
165
  git_config_backend *b;
164
166
 
165
- if ((error = internal->file->snapshot(&b, internal->file)) < 0)
167
+ if ((error = internal->backend->snapshot(&b, internal->backend)) < 0)
166
168
  break;
167
169
 
168
170
  if ((error = git_config_add_backend(config, b, internal->level, NULL, 0)) < 0) {
@@ -179,59 +181,59 @@ int git_config_snapshot(git_config **out, git_config *in)
179
181
  return error;
180
182
  }
181
183
 
182
- static int find_internal_file_by_level(
183
- file_internal **internal_out,
184
+ static int find_backend_by_level(
185
+ backend_internal **out,
184
186
  const git_config *cfg,
185
187
  git_config_level_t level)
186
188
  {
187
189
  int pos = -1;
188
- file_internal *internal;
190
+ backend_internal *internal;
189
191
  size_t i;
190
192
 
191
- /* when passing GIT_CONFIG_HIGHEST_LEVEL, the idea is to get the config file
192
- * which has the highest level. As config files are stored in a vector
193
- * sorted by decreasing order of level, getting the file at position 0
193
+ /* when passing GIT_CONFIG_HIGHEST_LEVEL, the idea is to get the config backend
194
+ * which has the highest level. As config backends are stored in a vector
195
+ * sorted by decreasing order of level, getting the backend at position 0
194
196
  * will do the job.
195
197
  */
196
198
  if (level == GIT_CONFIG_HIGHEST_LEVEL) {
197
199
  pos = 0;
198
200
  } else {
199
- git_vector_foreach(&cfg->files, i, internal) {
201
+ git_vector_foreach(&cfg->backends, i, internal) {
200
202
  if (internal->level == level)
201
203
  pos = (int)i;
202
204
  }
203
205
  }
204
206
 
205
207
  if (pos == -1) {
206
- giterr_set(GITERR_CONFIG,
207
- "no config file exists for the given level '%i'", (int)level);
208
+ git_error_set(GIT_ERROR_CONFIG,
209
+ "no configuration exists for the given level '%i'", (int)level);
208
210
  return GIT_ENOTFOUND;
209
211
  }
210
212
 
211
- *internal_out = git_vector_get(&cfg->files, pos);
213
+ *out = git_vector_get(&cfg->backends, pos);
212
214
 
213
215
  return 0;
214
216
  }
215
217
 
216
218
  static int duplicate_level(void **old_raw, void *new_raw)
217
219
  {
218
- file_internal **old = (file_internal **)old_raw;
220
+ backend_internal **old = (backend_internal **)old_raw;
219
221
 
220
222
  GIT_UNUSED(new_raw);
221
223
 
222
- giterr_set(GITERR_CONFIG, "a file with the same level (%i) has already been added to the config", (int)(*old)->level);
224
+ git_error_set(GIT_ERROR_CONFIG, "there already exists a configuration for the given level (%i)", (int)(*old)->level);
223
225
  return GIT_EEXISTS;
224
226
  }
225
227
 
226
- static void try_remove_existing_file_internal(
228
+ static void try_remove_existing_backend(
227
229
  git_config *cfg,
228
230
  git_config_level_t level)
229
231
  {
230
232
  int pos = -1;
231
- file_internal *internal;
233
+ backend_internal *internal;
232
234
  size_t i;
233
235
 
234
- git_vector_foreach(&cfg->files, i, internal) {
236
+ git_vector_foreach(&cfg->backends, i, internal) {
235
237
  if (internal->level == level)
236
238
  pos = (int)i;
237
239
  }
@@ -239,32 +241,32 @@ static void try_remove_existing_file_internal(
239
241
  if (pos == -1)
240
242
  return;
241
243
 
242
- internal = git_vector_get(&cfg->files, pos);
244
+ internal = git_vector_get(&cfg->backends, pos);
243
245
 
244
- if (git_vector_remove(&cfg->files, pos) < 0)
246
+ if (git_vector_remove(&cfg->backends, pos) < 0)
245
247
  return;
246
248
 
247
- GIT_REFCOUNT_DEC(internal, file_internal_free);
249
+ GIT_REFCOUNT_DEC(internal, backend_internal_free);
248
250
  }
249
251
 
250
252
  static int git_config__add_internal(
251
253
  git_config *cfg,
252
- file_internal *internal,
254
+ backend_internal *internal,
253
255
  git_config_level_t level,
254
256
  int force)
255
257
  {
256
258
  int result;
257
259
 
258
- /* delete existing config file for level if it exists */
260
+ /* delete existing config backend for level if it exists */
259
261
  if (force)
260
- try_remove_existing_file_internal(cfg, level);
262
+ try_remove_existing_backend(cfg, level);
261
263
 
262
- if ((result = git_vector_insert_sorted(&cfg->files,
264
+ if ((result = git_vector_insert_sorted(&cfg->backends,
263
265
  internal, &duplicate_level)) < 0)
264
266
  return result;
265
267
 
266
- git_vector_sort(&cfg->files);
267
- internal->file->cfg = cfg;
268
+ git_vector_sort(&cfg->backends);
269
+ internal->backend->cfg = cfg;
268
270
 
269
271
  GIT_REFCOUNT_INC(internal);
270
272
 
@@ -285,10 +287,10 @@ int git_config_open_level(
285
287
  git_config_level_t level)
286
288
  {
287
289
  git_config *cfg;
288
- file_internal *internal;
290
+ backend_internal *internal;
289
291
  int res;
290
292
 
291
- if ((res = find_internal_file_by_level(&internal, cfg_parent, level)) < 0)
293
+ if ((res = find_backend_by_level(&internal, cfg_parent, level)) < 0)
292
294
  return res;
293
295
 
294
296
  if ((res = git_config_new(&cfg)) < 0)
@@ -306,27 +308,27 @@ int git_config_open_level(
306
308
 
307
309
  int git_config_add_backend(
308
310
  git_config *cfg,
309
- git_config_backend *file,
311
+ git_config_backend *backend,
310
312
  git_config_level_t level,
311
313
  const git_repository *repo,
312
314
  int force)
313
315
  {
314
- file_internal *internal;
316
+ backend_internal *internal;
315
317
  int result;
316
318
 
317
- assert(cfg && file);
319
+ assert(cfg && backend);
318
320
 
319
- GITERR_CHECK_VERSION(file, GIT_CONFIG_BACKEND_VERSION, "git_config_backend");
321
+ GIT_ERROR_CHECK_VERSION(backend, GIT_CONFIG_BACKEND_VERSION, "git_config_backend");
320
322
 
321
- if ((result = file->open(file, level, repo)) < 0)
323
+ if ((result = backend->open(backend, level, repo)) < 0)
322
324
  return result;
323
325
 
324
- internal = git__malloc(sizeof(file_internal));
325
- GITERR_CHECK_ALLOC(internal);
326
+ internal = git__malloc(sizeof(backend_internal));
327
+ GIT_ERROR_CHECK_ALLOC(internal);
326
328
 
327
- memset(internal, 0x0, sizeof(file_internal));
329
+ memset(internal, 0x0, sizeof(backend_internal));
328
330
 
329
- internal->file = file;
331
+ internal->backend = backend;
330
332
  internal->level = level;
331
333
 
332
334
  if ((result = git_config__add_internal(cfg, internal, level, force)) < 0) {
@@ -345,17 +347,17 @@ typedef struct {
345
347
  git_config_iterator parent;
346
348
  git_config_iterator *current;
347
349
  const git_config *cfg;
348
- regex_t regex;
350
+ git_regexp regex;
349
351
  size_t i;
350
352
  } all_iter;
351
353
 
352
354
  static int find_next_backend(size_t *out, const git_config *cfg, size_t i)
353
355
  {
354
- file_internal *internal;
356
+ backend_internal *internal;
355
357
 
356
358
  for (; i > 0; --i) {
357
- internal = git_vector_get(&cfg->files, i - 1);
358
- if (!internal || !internal->file)
359
+ internal = git_vector_get(&cfg->backends, i - 1);
360
+ if (!internal || !internal->backend)
359
361
  continue;
360
362
 
361
363
  *out = i;
@@ -368,7 +370,7 @@ static int find_next_backend(size_t *out, const git_config *cfg, size_t i)
368
370
  static int all_iter_next(git_config_entry **entry, git_config_iterator *_iter)
369
371
  {
370
372
  all_iter *iter = (all_iter *) _iter;
371
- file_internal *internal;
373
+ backend_internal *internal;
372
374
  git_config_backend *backend;
373
375
  size_t i;
374
376
  int error = 0;
@@ -385,8 +387,8 @@ static int all_iter_next(git_config_entry **entry, git_config_iterator *_iter)
385
387
  if (find_next_backend(&i, iter->cfg, iter->i) < 0)
386
388
  return GIT_ITEROVER;
387
389
 
388
- internal = git_vector_get(&iter->cfg->files, i - 1);
389
- backend = internal->file;
390
+ internal = git_vector_get(&iter->cfg->backends, i - 1);
391
+ backend = internal->backend;
390
392
  iter->i = i - 1;
391
393
 
392
394
  if (iter->current)
@@ -423,7 +425,7 @@ static int all_iter_glob_next(git_config_entry **entry, git_config_iterator *_it
423
425
  */
424
426
  while ((error = all_iter_next(entry, _iter)) == 0) {
425
427
  /* skip non-matching keys if regexp was provided */
426
- if (regexec(&iter->regex, (*entry)->name, 0, NULL, 0) != 0)
428
+ if (git_regexp_match(&iter->regex, (*entry)->name) != 0)
427
429
  continue;
428
430
 
429
431
  /* and simply return if we like the entry's name */
@@ -447,7 +449,7 @@ static void all_iter_glob_free(git_config_iterator *_iter)
447
449
  {
448
450
  all_iter *iter = (all_iter *) _iter;
449
451
 
450
- regfree(&iter->regex);
452
+ git_regexp_dispose(&iter->regex);
451
453
  all_iter_free(_iter);
452
454
  }
453
455
 
@@ -456,12 +458,12 @@ int git_config_iterator_new(git_config_iterator **out, const git_config *cfg)
456
458
  all_iter *iter;
457
459
 
458
460
  iter = git__calloc(1, sizeof(all_iter));
459
- GITERR_CHECK_ALLOC(iter);
461
+ GIT_ERROR_CHECK_ALLOC(iter);
460
462
 
461
463
  iter->parent.free = all_iter_free;
462
464
  iter->parent.next = all_iter_next;
463
465
 
464
- iter->i = cfg->files.length;
466
+ iter->i = cfg->backends.length;
465
467
  iter->cfg = cfg;
466
468
 
467
469
  *out = (git_config_iterator *) iter;
@@ -478,17 +480,16 @@ int git_config_iterator_glob_new(git_config_iterator **out, const git_config *cf
478
480
  return git_config_iterator_new(out, cfg);
479
481
 
480
482
  iter = git__calloc(1, sizeof(all_iter));
481
- GITERR_CHECK_ALLOC(iter);
483
+ GIT_ERROR_CHECK_ALLOC(iter);
482
484
 
483
- if ((result = p_regcomp(&iter->regex, regexp, REG_EXTENDED)) != 0) {
484
- giterr_set_regex(&iter->regex, result);
485
+ if ((result = git_regexp_compile(&iter->regex, regexp, 0)) < 0) {
485
486
  git__free(iter);
486
487
  return -1;
487
488
  }
488
489
 
489
490
  iter->parent.next = all_iter_glob_next;
490
491
  iter->parent.free = all_iter_glob_free;
491
- iter->i = cfg->files.length;
492
+ iter->i = cfg->backends.length;
492
493
  iter->cfg = cfg;
493
494
 
494
495
  *out = (git_config_iterator *) iter;
@@ -510,16 +511,13 @@ int git_config_backend_foreach_match(
510
511
  {
511
512
  git_config_entry *entry;
512
513
  git_config_iterator* iter;
513
- regex_t regex;
514
+ git_regexp regex;
514
515
  int error = 0;
515
516
 
516
- if (regexp != NULL) {
517
- if ((error = p_regcomp(&regex, regexp, REG_EXTENDED)) != 0) {
518
- giterr_set_regex(&regex, error);
519
- regfree(&regex);
520
- return -1;
521
- }
522
- }
517
+ assert(backend && cb);
518
+
519
+ if (regexp && git_regexp_compile(&regex, regexp, 0) < 0)
520
+ return -1;
523
521
 
524
522
  if ((error = backend->iterator(&iter, backend)) < 0) {
525
523
  iter = NULL;
@@ -528,18 +526,18 @@ int git_config_backend_foreach_match(
528
526
 
529
527
  while (!(iter->next(&entry, iter) < 0)) {
530
528
  /* skip non-matching keys if regexp was provided */
531
- if (regexp && regexec(&regex, entry->name, 0, NULL, 0) != 0)
529
+ if (regexp && git_regexp_match(&regex, entry->name) != 0)
532
530
  continue;
533
531
 
534
532
  /* abort iterator on non-zero return value */
535
533
  if ((error = cb(entry, payload)) != 0) {
536
- giterr_set_after_callback(error);
534
+ git_error_set_after_callback(error);
537
535
  break;
538
536
  }
539
537
  }
540
538
 
541
539
  if (regexp != NULL)
542
- regfree(&regex);
540
+ git_regexp_dispose(&regex);
543
541
 
544
542
  iter->free(iter);
545
543
 
@@ -561,7 +559,7 @@ int git_config_foreach_match(
561
559
 
562
560
  while (!(error = git_config_next(&entry, iter))) {
563
561
  if ((error = cb(entry, payload)) != 0) {
564
- giterr_set_after_callback(error);
562
+ git_error_set_after_callback(error);
565
563
  break;
566
564
  }
567
565
  }
@@ -592,38 +590,38 @@ static int get_backend_for_use(git_config_backend **out,
592
590
  git_config *cfg, const char *name, backend_use use)
593
591
  {
594
592
  size_t i;
595
- file_internal *f;
593
+ backend_internal *backend;
596
594
 
597
595
  *out = NULL;
598
596
 
599
- if (git_vector_length(&cfg->files) == 0) {
600
- giterr_set(GITERR_CONFIG,
601
- "cannot %s value for '%s' when no config files exist",
597
+ if (git_vector_length(&cfg->backends) == 0) {
598
+ git_error_set(GIT_ERROR_CONFIG,
599
+ "cannot %s value for '%s' when no config backends exist",
602
600
  uses[use], name);
603
601
  return GIT_ENOTFOUND;
604
602
  }
605
603
 
606
- git_vector_foreach(&cfg->files, i, f) {
607
- if (!f->file->readonly) {
608
- *out = f->file;
604
+ git_vector_foreach(&cfg->backends, i, backend) {
605
+ if (!backend->backend->readonly) {
606
+ *out = backend->backend;
609
607
  return 0;
610
608
  }
611
609
  }
612
610
 
613
- giterr_set(GITERR_CONFIG,
614
- "cannot %s value for '%s' when all config files are readonly",
611
+ git_error_set(GIT_ERROR_CONFIG,
612
+ "cannot %s value for '%s' when all config backends are readonly",
615
613
  uses[use], name);
616
614
  return GIT_ENOTFOUND;
617
615
  }
618
616
 
619
617
  int git_config_delete_entry(git_config *cfg, const char *name)
620
618
  {
621
- git_config_backend *file;
619
+ git_config_backend *backend;
622
620
 
623
- if (get_backend_for_use(&file, cfg, name, BACKEND_USE_DELETE) < 0)
621
+ if (get_backend_for_use(&backend, cfg, name, BACKEND_USE_DELETE) < 0)
624
622
  return GIT_ENOTFOUND;
625
623
 
626
- return file->del(file, name);
624
+ return backend->del(backend, name);
627
625
  }
628
626
 
629
627
  int git_config_set_int64(git_config *cfg, const char *name, int64_t value)
@@ -646,20 +644,20 @@ int git_config_set_bool(git_config *cfg, const char *name, int value)
646
644
  int git_config_set_string(git_config *cfg, const char *name, const char *value)
647
645
  {
648
646
  int error;
649
- git_config_backend *file;
647
+ git_config_backend *backend;
650
648
 
651
649
  if (!value) {
652
- giterr_set(GITERR_CONFIG, "the value to set cannot be NULL");
650
+ git_error_set(GIT_ERROR_CONFIG, "the value to set cannot be NULL");
653
651
  return -1;
654
652
  }
655
653
 
656
- if (get_backend_for_use(&file, cfg, name, BACKEND_USE_SET) < 0)
654
+ if (get_backend_for_use(&backend, cfg, name, BACKEND_USE_SET) < 0)
657
655
  return GIT_ENOTFOUND;
658
656
 
659
- error = file->set(file, name, value);
657
+ error = backend->set(backend, name, value);
660
658
 
661
659
  if (!error && GIT_REFCOUNT_OWNER(cfg) != NULL)
662
- git_repository__cvar_cache_clear(GIT_REFCOUNT_OWNER(cfg));
660
+ git_repository__configmap_lookup_cache_clear(GIT_REFCOUNT_OWNER(cfg));
663
661
 
664
662
  return error;
665
663
  }
@@ -701,7 +699,7 @@ int git_config__update_entry(
701
699
 
702
700
  static int config_error_notfound(const char *name)
703
701
  {
704
- giterr_set(GITERR_CONFIG, "config value '%s' was not found", name);
702
+ git_error_set(GIT_ERROR_CONFIG, "config value '%s' was not found", name);
705
703
  return GIT_ENOTFOUND;
706
704
  }
707
705
 
@@ -722,7 +720,7 @@ static int get_entry(
722
720
  const char *key = name;
723
721
  char *normalized = NULL;
724
722
  size_t i;
725
- file_internal *internal;
723
+ backend_internal *internal;
726
724
 
727
725
  *out = NULL;
728
726
 
@@ -733,11 +731,11 @@ static int get_entry(
733
731
  }
734
732
 
735
733
  res = GIT_ENOTFOUND;
736
- git_vector_foreach(&cfg->files, i, internal) {
737
- if (!internal || !internal->file)
734
+ git_vector_foreach(&cfg->backends, i, internal) {
735
+ if (!internal || !internal->backend)
738
736
  continue;
739
737
 
740
- res = internal->file->get(internal->file, key, out);
738
+ res = internal->backend->get(internal->backend, key, out);
741
739
  if (res != GIT_ENOTFOUND)
742
740
  break;
743
741
  }
@@ -748,7 +746,7 @@ cleanup:
748
746
  if (res == GIT_ENOTFOUND)
749
747
  res = (want_errors > GET_ALL_ERRORS) ? 0 : config_error_notfound(name);
750
748
  else if (res && (want_errors == GET_NO_ERRORS)) {
751
- giterr_clear();
749
+ git_error_clear();
752
750
  res = 0;
753
751
  }
754
752
 
@@ -775,7 +773,7 @@ int git_config_get_mapped(
775
773
  int *out,
776
774
  const git_config *cfg,
777
775
  const char *name,
778
- const git_cvar_map *maps,
776
+ const git_configmap *maps,
779
777
  size_t map_n)
780
778
  {
781
779
  git_config_entry *entry;
@@ -835,13 +833,13 @@ int git_config_get_bool(int *out, const git_config *cfg, const char *name)
835
833
  static int is_readonly(const git_config *cfg)
836
834
  {
837
835
  size_t i;
838
- file_internal *internal;
836
+ backend_internal *internal;
839
837
 
840
- git_vector_foreach(&cfg->files, i, internal) {
841
- if (!internal || !internal->file)
838
+ git_vector_foreach(&cfg->backends, i, internal) {
839
+ if (!internal || !internal->backend)
842
840
  continue;
843
841
 
844
- if (!internal->file->readonly)
842
+ if (!internal->backend->readonly)
845
843
  return 0;
846
844
  }
847
845
 
@@ -869,7 +867,7 @@ int git_config_get_string(
869
867
  int ret;
870
868
 
871
869
  if (!is_readonly(cfg)) {
872
- giterr_set(GITERR_CONFIG, "get_string called on a live config object");
870
+ git_error_set(GIT_ERROR_CONFIG, "get_string called on a live config object");
873
871
  return -1;
874
872
  }
875
873
 
@@ -923,7 +921,7 @@ int git_config__get_bool_force(
923
921
  get_entry(&entry, cfg, key, false, GET_NO_ERRORS);
924
922
 
925
923
  if (entry && git_config_parse_bool(&val, entry->value) < 0)
926
- giterr_clear();
924
+ git_error_clear();
927
925
 
928
926
  git_config_entry_free(entry);
929
927
  return val;
@@ -938,7 +936,7 @@ int git_config__get_int_force(
938
936
  get_entry(&entry, cfg, key, false, GET_NO_ERRORS);
939
937
 
940
938
  if (entry && git_config_parse_int32(&val, entry->value) < 0)
941
- giterr_clear();
939
+ git_error_clear();
942
940
 
943
941
  git_config_entry_free(entry);
944
942
  return (int)val;
@@ -960,7 +958,7 @@ int git_config_get_multivar_foreach(
960
958
  found = 1;
961
959
 
962
960
  if ((err = cb(entry, payload)) != 0) {
963
- giterr_set_after_callback(err);
961
+ git_error_set_after_callback(err);
964
962
  break;
965
963
  }
966
964
  }
@@ -979,7 +977,7 @@ typedef struct {
979
977
  git_config_iterator parent;
980
978
  git_config_iterator *iter;
981
979
  char *name;
982
- regex_t regex;
980
+ git_regexp regex;
983
981
  int have_regex;
984
982
  } multivar_iter;
985
983
 
@@ -995,7 +993,7 @@ static int multivar_iter_next(git_config_entry **entry, git_config_iterator *_it
995
993
  if (!iter->have_regex)
996
994
  return 0;
997
995
 
998
- if (regexec(&iter->regex, (*entry)->value, 0, NULL, 0) == 0)
996
+ if (git_regexp_match(&iter->regex, (*entry)->value) == 0)
999
997
  return 0;
1000
998
  }
1001
999
 
@@ -1010,7 +1008,7 @@ void multivar_iter_free(git_config_iterator *_iter)
1010
1008
 
1011
1009
  git__free(iter->name);
1012
1010
  if (iter->have_regex)
1013
- regfree(&iter->regex);
1011
+ git_regexp_dispose(&iter->regex);
1014
1012
  git__free(iter);
1015
1013
  }
1016
1014
 
@@ -1024,19 +1022,14 @@ int git_config_multivar_iterator_new(git_config_iterator **out, const git_config
1024
1022
  return error;
1025
1023
 
1026
1024
  iter = git__calloc(1, sizeof(multivar_iter));
1027
- GITERR_CHECK_ALLOC(iter);
1025
+ GIT_ERROR_CHECK_ALLOC(iter);
1028
1026
 
1029
1027
  if ((error = git_config__normalize_name(name, &iter->name)) < 0)
1030
1028
  goto on_error;
1031
1029
 
1032
1030
  if (regexp != NULL) {
1033
- error = p_regcomp(&iter->regex, regexp, REG_EXTENDED);
1034
- if (error != 0) {
1035
- giterr_set_regex(&iter->regex, error);
1036
- error = -1;
1037
- regfree(&iter->regex);
1031
+ if ((error = git_regexp_compile(&iter->regex, regexp, 0)) < 0)
1038
1032
  goto on_error;
1039
- }
1040
1033
 
1041
1034
  iter->have_regex = 1;
1042
1035
  }
@@ -1058,22 +1051,22 @@ on_error:
1058
1051
 
1059
1052
  int git_config_set_multivar(git_config *cfg, const char *name, const char *regexp, const char *value)
1060
1053
  {
1061
- git_config_backend *file;
1054
+ git_config_backend *backend;
1062
1055
 
1063
- if (get_backend_for_use(&file, cfg, name, BACKEND_USE_DELETE) < 0)
1056
+ if (get_backend_for_use(&backend, cfg, name, BACKEND_USE_DELETE) < 0)
1064
1057
  return GIT_ENOTFOUND;
1065
1058
 
1066
- return file->set_multivar(file, name, regexp, value);
1059
+ return backend->set_multivar(backend, name, regexp, value);
1067
1060
  }
1068
1061
 
1069
1062
  int git_config_delete_multivar(git_config *cfg, const char *name, const char *regexp)
1070
1063
  {
1071
- git_config_backend *file;
1064
+ git_config_backend *backend;
1072
1065
 
1073
- if (get_backend_for_use(&file, cfg, name, BACKEND_USE_DELETE) < 0)
1066
+ if (get_backend_for_use(&backend, cfg, name, BACKEND_USE_DELETE) < 0)
1074
1067
  return GIT_ENOTFOUND;
1075
1068
 
1076
- return file->del_multivar(file, name, regexp);
1069
+ return backend->del_multivar(backend, name, regexp);
1077
1070
  }
1078
1071
 
1079
1072
  int git_config_next(git_config_entry **entry, git_config_iterator *iter)
@@ -1109,8 +1102,15 @@ int git_config_find_system(git_buf *path)
1109
1102
 
1110
1103
  int git_config_find_programdata(git_buf *path)
1111
1104
  {
1105
+ int ret;
1106
+
1112
1107
  git_buf_sanitize(path);
1113
- return git_sysdir_find_programdata_file(path, GIT_CONFIG_FILENAME_PROGRAMDATA);
1108
+ ret = git_sysdir_find_programdata_file(path,
1109
+ GIT_CONFIG_FILENAME_PROGRAMDATA);
1110
+ if (ret != GIT_OK)
1111
+ return ret;
1112
+
1113
+ return git_path_validate_system_file_ownership(path->ptr);
1114
1114
  }
1115
1115
 
1116
1116
  int git_config__global_location(git_buf *buf)
@@ -1179,17 +1179,19 @@ int git_config_open_default(git_config **out)
1179
1179
  int git_config_lock(git_transaction **out, git_config *cfg)
1180
1180
  {
1181
1181
  int error;
1182
- git_config_backend *file;
1183
- file_internal *internal;
1182
+ git_config_backend *backend;
1183
+ backend_internal *internal;
1184
1184
 
1185
- internal = git_vector_get(&cfg->files, 0);
1186
- if (!internal || !internal->file) {
1187
- giterr_set(GITERR_CONFIG, "cannot lock; the config has no backends/files");
1185
+ assert(cfg);
1186
+
1187
+ internal = git_vector_get(&cfg->backends, 0);
1188
+ if (!internal || !internal->backend) {
1189
+ git_error_set(GIT_ERROR_CONFIG, "cannot lock; the config has no backends");
1188
1190
  return -1;
1189
1191
  }
1190
- file = internal->file;
1192
+ backend = internal->backend;
1191
1193
 
1192
- if ((error = file->lock(file)) < 0)
1194
+ if ((error = backend->lock(backend)) < 0)
1193
1195
  return error;
1194
1196
 
1195
1197
  return git_transaction_config_new(out, cfg);
@@ -1197,18 +1199,20 @@ int git_config_lock(git_transaction **out, git_config *cfg)
1197
1199
 
1198
1200
  int git_config_unlock(git_config *cfg, int commit)
1199
1201
  {
1200
- git_config_backend *file;
1201
- file_internal *internal;
1202
+ git_config_backend *backend;
1203
+ backend_internal *internal;
1204
+
1205
+ assert(cfg);
1202
1206
 
1203
- internal = git_vector_get(&cfg->files, 0);
1204
- if (!internal || !internal->file) {
1205
- giterr_set(GITERR_CONFIG, "cannot lock; the config has no backends/files");
1207
+ internal = git_vector_get(&cfg->backends, 0);
1208
+ if (!internal || !internal->backend) {
1209
+ git_error_set(GIT_ERROR_CONFIG, "cannot lock; the config has no backends");
1206
1210
  return -1;
1207
1211
  }
1208
1212
 
1209
- file = internal->file;
1213
+ backend = internal->backend;
1210
1214
 
1211
- return file->unlock(file, commit);
1215
+ return backend->unlock(backend, commit);
1212
1216
  }
1213
1217
 
1214
1218
  /***********
@@ -1217,7 +1221,7 @@ int git_config_unlock(git_config *cfg, int commit)
1217
1221
 
1218
1222
  int git_config_lookup_map_value(
1219
1223
  int *out,
1220
- const git_cvar_map *maps,
1224
+ const git_configmap *maps,
1221
1225
  size_t map_n,
1222
1226
  const char *value)
1223
1227
  {
@@ -1227,27 +1231,27 @@ int git_config_lookup_map_value(
1227
1231
  goto fail_parse;
1228
1232
 
1229
1233
  for (i = 0; i < map_n; ++i) {
1230
- const git_cvar_map *m = maps + i;
1234
+ const git_configmap *m = maps + i;
1231
1235
 
1232
- switch (m->cvar_type) {
1233
- case GIT_CVAR_FALSE:
1234
- case GIT_CVAR_TRUE: {
1236
+ switch (m->type) {
1237
+ case GIT_CONFIGMAP_FALSE:
1238
+ case GIT_CONFIGMAP_TRUE: {
1235
1239
  int bool_val;
1236
1240
 
1237
1241
  if (git__parse_bool(&bool_val, value) == 0 &&
1238
- bool_val == (int)m->cvar_type) {
1242
+ bool_val == (int)m->type) {
1239
1243
  *out = m->map_value;
1240
1244
  return 0;
1241
1245
  }
1242
1246
  break;
1243
1247
  }
1244
1248
 
1245
- case GIT_CVAR_INT32:
1249
+ case GIT_CONFIGMAP_INT32:
1246
1250
  if (git_config_parse_int32(out, value) == 0)
1247
1251
  return 0;
1248
1252
  break;
1249
1253
 
1250
- case GIT_CVAR_STRING:
1254
+ case GIT_CONFIGMAP_STRING:
1251
1255
  if (strcasecmp(value, m->str_match) == 0) {
1252
1256
  *out = m->map_value;
1253
1257
  return 0;
@@ -1257,27 +1261,27 @@ int git_config_lookup_map_value(
1257
1261
  }
1258
1262
 
1259
1263
  fail_parse:
1260
- giterr_set(GITERR_CONFIG, "failed to map '%s'", value);
1264
+ git_error_set(GIT_ERROR_CONFIG, "failed to map '%s'", value);
1261
1265
  return -1;
1262
1266
  }
1263
1267
 
1264
- int git_config_lookup_map_enum(git_cvar_t *type_out, const char **str_out,
1265
- const git_cvar_map *maps, size_t map_n, int enum_val)
1268
+ int git_config_lookup_map_enum(git_configmap_t *type_out, const char **str_out,
1269
+ const git_configmap *maps, size_t map_n, int enum_val)
1266
1270
  {
1267
1271
  size_t i;
1268
1272
 
1269
1273
  for (i = 0; i < map_n; i++) {
1270
- const git_cvar_map *m = &maps[i];
1274
+ const git_configmap *m = &maps[i];
1271
1275
 
1272
1276
  if (m->map_value != enum_val)
1273
1277
  continue;
1274
1278
 
1275
- *type_out = m->cvar_type;
1279
+ *type_out = m->type;
1276
1280
  *str_out = m->str_match;
1277
1281
  return 0;
1278
1282
  }
1279
1283
 
1280
- giterr_set(GITERR_CONFIG, "invalid enum value");
1284
+ git_error_set(GIT_ERROR_CONFIG, "invalid enum value");
1281
1285
  return GIT_ENOTFOUND;
1282
1286
  }
1283
1287
 
@@ -1291,7 +1295,7 @@ int git_config_parse_bool(int *out, const char *value)
1291
1295
  return 0;
1292
1296
  }
1293
1297
 
1294
- giterr_set(GITERR_CONFIG, "failed to parse '%s' as a boolean value", value);
1298
+ git_error_set(GIT_ERROR_CONFIG, "failed to parse '%s' as a boolean value", value);
1295
1299
  return -1;
1296
1300
  }
1297
1301
 
@@ -1300,7 +1304,7 @@ int git_config_parse_int64(int64_t *out, const char *value)
1300
1304
  const char *num_end;
1301
1305
  int64_t num;
1302
1306
 
1303
- if (!value || git__strtol64(&num, value, &num_end, 0) < 0)
1307
+ if (!value || git__strntol64(&num, value, strlen(value), &num_end, 0) < 0)
1304
1308
  goto fail_parse;
1305
1309
 
1306
1310
  switch (*num_end) {
@@ -1334,7 +1338,7 @@ int git_config_parse_int64(int64_t *out, const char *value)
1334
1338
  }
1335
1339
 
1336
1340
  fail_parse:
1337
- giterr_set(GITERR_CONFIG, "failed to parse '%s' as an integer", value ? value : "(null)");
1341
+ git_error_set(GIT_ERROR_CONFIG, "failed to parse '%s' as an integer", value ? value : "(null)");
1338
1342
  return -1;
1339
1343
  }
1340
1344
 
@@ -1354,7 +1358,7 @@ int git_config_parse_int32(int32_t *out, const char *value)
1354
1358
  return 0;
1355
1359
 
1356
1360
  fail_parse:
1357
- giterr_set(GITERR_CONFIG, "failed to parse '%s' as a 32-bit integer", value ? value : "(null)");
1361
+ git_error_set(GIT_ERROR_CONFIG, "failed to parse '%s' as a 32-bit integer", value ? value : "(null)");
1358
1362
  return -1;
1359
1363
  }
1360
1364
 
@@ -1366,7 +1370,7 @@ int git_config_parse_path(git_buf *out, const char *value)
1366
1370
 
1367
1371
  if (value[0] == '~') {
1368
1372
  if (value[1] != '\0' && value[1] != '/') {
1369
- giterr_set(GITERR_CONFIG, "retrieving a homedir by name is not supported");
1373
+ git_error_set(GIT_ERROR_CONFIG, "retrieving a homedir by name is not supported");
1370
1374
  return -1;
1371
1375
  }
1372
1376
 
@@ -1376,6 +1380,30 @@ int git_config_parse_path(git_buf *out, const char *value)
1376
1380
  return git_buf_sets(out, value);
1377
1381
  }
1378
1382
 
1383
+ static int normalize_section(char *start, char *end)
1384
+ {
1385
+ char *scan;
1386
+
1387
+ if (start == end)
1388
+ return GIT_EINVALIDSPEC;
1389
+
1390
+ /* Validate and downcase range */
1391
+ for (scan = start; *scan; ++scan) {
1392
+ if (end && scan >= end)
1393
+ break;
1394
+ if (isalnum(*scan))
1395
+ *scan = (char)git__tolower(*scan);
1396
+ else if (*scan != '-' || scan == start)
1397
+ return GIT_EINVALIDSPEC;
1398
+ }
1399
+
1400
+ if (scan == start)
1401
+ return GIT_EINVALIDSPEC;
1402
+
1403
+ return 0;
1404
+ }
1405
+
1406
+
1379
1407
  /* Take something the user gave us and make it nice for our hash function */
1380
1408
  int git_config__normalize_name(const char *in, char **out)
1381
1409
  {
@@ -1384,7 +1412,7 @@ int git_config__normalize_name(const char *in, char **out)
1384
1412
  assert(in && out);
1385
1413
 
1386
1414
  name = git__strdup(in);
1387
- GITERR_CHECK_ALLOC(name);
1415
+ GIT_ERROR_CHECK_ALLOC(name);
1388
1416
 
1389
1417
  fdot = strchr(name, '.');
1390
1418
  ldot = strrchr(name, '.');
@@ -1393,8 +1421,8 @@ int git_config__normalize_name(const char *in, char **out)
1393
1421
  goto invalid;
1394
1422
 
1395
1423
  /* Validate and downcase up to first dot and after last dot */
1396
- if (git_config_file_normalize_section(name, fdot) < 0 ||
1397
- git_config_file_normalize_section(ldot + 1, NULL) < 0)
1424
+ if (normalize_section(name, fdot) < 0 ||
1425
+ normalize_section(ldot + 1, NULL) < 0)
1398
1426
  goto invalid;
1399
1427
 
1400
1428
  /* If there is a middle range, make sure it doesn't have newlines */
@@ -1407,7 +1435,7 @@ int git_config__normalize_name(const char *in, char **out)
1407
1435
 
1408
1436
  invalid:
1409
1437
  git__free(name);
1410
- giterr_set(GITERR_CONFIG, "invalid config item name '%s'", in);
1438
+ git_error_set(GIT_ERROR_CONFIG, "invalid config item name '%s'", in);
1411
1439
  return GIT_EINVALIDSPEC;
1412
1440
  }
1413
1441
 
@@ -1466,11 +1494,10 @@ int git_config_rename_section(
1466
1494
  goto cleanup;
1467
1495
 
1468
1496
  if (new_section_name != NULL &&
1469
- (error = git_config_file_normalize_section(
1470
- replace.ptr, strchr(replace.ptr, '.'))) < 0)
1497
+ (error = normalize_section(replace.ptr, strchr(replace.ptr, '.'))) < 0)
1471
1498
  {
1472
- giterr_set(
1473
- GITERR_CONFIG, "invalid config section '%s'", new_section_name);
1499
+ git_error_set(
1500
+ GIT_ERROR_CONFIG, "invalid config section '%s'", new_section_name);
1474
1501
  goto cleanup;
1475
1502
  }
1476
1503