rugged 0.27.10 → 0.27.10.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (420) 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 +54 -98
  5. data/vendor/libgit2/COPYING +0 -28
  6. data/vendor/libgit2/cmake/Modules/AddCFlagIfSupported.cmake +1 -15
  7. data/vendor/libgit2/cmake/Modules/EnableWarnings.cmake +8 -9
  8. data/vendor/libgit2/cmake/Modules/FindCoreFoundation.cmake +2 -2
  9. data/vendor/libgit2/cmake/Modules/FindGSSAPI.cmake +1 -1
  10. data/vendor/libgit2/cmake/Modules/FindSecurity.cmake +2 -2
  11. data/vendor/libgit2/cmake/Modules/FindStatNsec.cmake +0 -6
  12. data/vendor/libgit2/deps/http-parser/CMakeLists.txt +0 -2
  13. data/vendor/libgit2/deps/http-parser/{COPYING → LICENSE-MIT} +0 -0
  14. data/vendor/libgit2/deps/http-parser/http_parser.c +6 -11
  15. data/vendor/libgit2/deps/regex/CMakeLists.txt +2 -0
  16. data/vendor/libgit2/deps/regex/config.h +7 -0
  17. data/vendor/libgit2/deps/regex/regcomp.c +3857 -0
  18. data/vendor/libgit2/deps/regex/regex.c +92 -0
  19. data/vendor/libgit2/deps/regex/regex.h +582 -0
  20. data/vendor/libgit2/deps/regex/regex_internal.c +1744 -0
  21. data/vendor/libgit2/deps/regex/regex_internal.h +819 -0
  22. data/vendor/libgit2/deps/regex/regexec.c +4369 -0
  23. data/vendor/libgit2/deps/zlib/CMakeLists.txt +0 -1
  24. data/vendor/libgit2/deps/zlib/adler32.c +7 -0
  25. data/vendor/libgit2/deps/zlib/crc32.c +7 -0
  26. data/vendor/libgit2/include/git2.h +0 -5
  27. data/vendor/libgit2/include/git2/annotated_commit.h +0 -9
  28. data/vendor/libgit2/include/git2/attr.h +20 -38
  29. data/vendor/libgit2/include/git2/blame.h +25 -42
  30. data/vendor/libgit2/include/git2/blob.h +13 -45
  31. data/vendor/libgit2/include/git2/branch.h +1 -1
  32. data/vendor/libgit2/include/git2/buffer.h +16 -22
  33. data/vendor/libgit2/include/git2/checkout.h +32 -65
  34. data/vendor/libgit2/include/git2/cherrypick.h +7 -9
  35. data/vendor/libgit2/include/git2/clone.h +10 -12
  36. data/vendor/libgit2/include/git2/commit.h +3 -53
  37. data/vendor/libgit2/include/git2/common.h +8 -60
  38. data/vendor/libgit2/include/git2/config.h +19 -30
  39. data/vendor/libgit2/include/git2/describe.h +9 -32
  40. data/vendor/libgit2/include/git2/diff.h +156 -208
  41. data/vendor/libgit2/include/git2/errors.h +46 -54
  42. data/vendor/libgit2/include/git2/filter.h +0 -8
  43. data/vendor/libgit2/include/git2/ignore.h +2 -2
  44. data/vendor/libgit2/include/git2/index.h +52 -74
  45. data/vendor/libgit2/include/git2/indexer.h +6 -76
  46. data/vendor/libgit2/include/git2/inttypes.h +309 -0
  47. data/vendor/libgit2/include/git2/merge.h +18 -35
  48. data/vendor/libgit2/include/git2/net.h +5 -0
  49. data/vendor/libgit2/include/git2/notes.h +1 -1
  50. data/vendor/libgit2/include/git2/object.h +29 -17
  51. data/vendor/libgit2/include/git2/odb.h +11 -12
  52. data/vendor/libgit2/include/git2/odb_backend.h +9 -10
  53. data/vendor/libgit2/include/git2/oid.h +2 -2
  54. data/vendor/libgit2/include/git2/pack.h +3 -14
  55. data/vendor/libgit2/include/git2/proxy.h +8 -14
  56. data/vendor/libgit2/include/git2/rebase.h +6 -53
  57. data/vendor/libgit2/include/git2/refs.h +15 -33
  58. data/vendor/libgit2/include/git2/refspec.h +0 -17
  59. data/vendor/libgit2/include/git2/remote.h +24 -123
  60. data/vendor/libgit2/include/git2/repository.h +39 -76
  61. data/vendor/libgit2/include/git2/revert.h +4 -6
  62. data/vendor/libgit2/include/git2/revwalk.h +7 -7
  63. data/vendor/libgit2/include/git2/signature.h +2 -2
  64. data/vendor/libgit2/include/git2/stash.h +12 -15
  65. data/vendor/libgit2/include/git2/status.h +20 -33
  66. data/vendor/libgit2/include/git2/submodule.h +12 -30
  67. data/vendor/libgit2/include/git2/sys/commit.h +1 -1
  68. data/vendor/libgit2/include/git2/sys/config.h +13 -13
  69. data/vendor/libgit2/include/git2/sys/filter.h +6 -6
  70. data/vendor/libgit2/include/git2/sys/index.h +0 -3
  71. data/vendor/libgit2/include/git2/sys/mempack.h +35 -35
  72. data/vendor/libgit2/include/git2/sys/merge.h +4 -9
  73. data/vendor/libgit2/include/git2/sys/odb_backend.h +22 -66
  74. data/vendor/libgit2/include/git2/sys/refdb_backend.h +40 -76
  75. data/vendor/libgit2/include/git2/sys/repository.h +1 -5
  76. data/vendor/libgit2/include/git2/sys/stream.h +12 -92
  77. data/vendor/libgit2/include/git2/sys/time.h +31 -0
  78. data/vendor/libgit2/include/git2/sys/transport.h +83 -129
  79. data/vendor/libgit2/include/git2/tag.h +4 -13
  80. data/vendor/libgit2/include/git2/trace.h +2 -2
  81. data/vendor/libgit2/include/git2/transaction.h +0 -1
  82. data/vendor/libgit2/include/git2/transport.h +311 -11
  83. data/vendor/libgit2/include/git2/tree.h +4 -4
  84. data/vendor/libgit2/include/git2/types.h +111 -33
  85. data/vendor/libgit2/include/git2/version.h +4 -4
  86. data/vendor/libgit2/include/git2/worktree.h +13 -48
  87. data/vendor/libgit2/libgit2.pc.in +13 -0
  88. data/vendor/libgit2/src/CMakeLists.txt +164 -96
  89. data/vendor/libgit2/src/annotated_commit.c +8 -15
  90. data/vendor/libgit2/src/apply.c +31 -537
  91. data/vendor/libgit2/src/apply.h +1 -3
  92. data/vendor/libgit2/src/array.h +2 -2
  93. data/vendor/libgit2/src/attr.c +75 -81
  94. data/vendor/libgit2/src/attr_file.c +121 -207
  95. data/vendor/libgit2/src/attr_file.h +9 -9
  96. data/vendor/libgit2/src/attrcache.c +53 -51
  97. data/vendor/libgit2/src/attrcache.h +1 -2
  98. data/vendor/libgit2/src/blame.c +20 -47
  99. data/vendor/libgit2/src/blame.h +1 -2
  100. data/vendor/libgit2/src/blame_git.c +20 -37
  101. data/vendor/libgit2/src/blob.c +42 -128
  102. data/vendor/libgit2/src/blob.h +2 -19
  103. data/vendor/libgit2/src/branch.c +43 -67
  104. data/vendor/libgit2/src/buf_text.c +6 -7
  105. data/vendor/libgit2/src/buffer.c +57 -69
  106. data/vendor/libgit2/src/buffer.h +1 -1
  107. data/vendor/libgit2/src/cache.c +45 -38
  108. data/vendor/libgit2/src/cache.h +3 -3
  109. data/vendor/libgit2/src/cc-compat.h +3 -20
  110. data/vendor/libgit2/src/checkout.c +90 -109
  111. data/vendor/libgit2/src/cherrypick.c +9 -15
  112. data/vendor/libgit2/src/clone.c +27 -49
  113. data/vendor/libgit2/src/clone.h +0 -4
  114. data/vendor/libgit2/src/commit.c +49 -117
  115. data/vendor/libgit2/src/commit.h +0 -7
  116. data/vendor/libgit2/src/commit_list.c +78 -30
  117. data/vendor/libgit2/src/commit_list.h +2 -2
  118. data/vendor/libgit2/src/common.h +91 -27
  119. data/vendor/libgit2/src/config.c +176 -194
  120. data/vendor/libgit2/src/config.h +20 -8
  121. data/vendor/libgit2/src/config_cache.c +35 -41
  122. data/vendor/libgit2/src/config_file.c +753 -439
  123. data/vendor/libgit2/src/config_file.h +73 -0
  124. data/vendor/libgit2/src/config_parse.c +63 -114
  125. data/vendor/libgit2/src/config_parse.h +16 -17
  126. data/vendor/libgit2/src/crlf.c +190 -219
  127. data/vendor/libgit2/src/delta.c +18 -25
  128. data/vendor/libgit2/src/describe.c +41 -42
  129. data/vendor/libgit2/src/diff.c +68 -53
  130. data/vendor/libgit2/src/diff.h +1 -2
  131. data/vendor/libgit2/src/diff_driver.c +49 -47
  132. data/vendor/libgit2/src/diff_file.c +17 -19
  133. data/vendor/libgit2/src/diff_file.h +1 -1
  134. data/vendor/libgit2/src/diff_generate.c +106 -162
  135. data/vendor/libgit2/src/diff_generate.h +3 -3
  136. data/vendor/libgit2/src/diff_parse.c +4 -4
  137. data/vendor/libgit2/src/diff_print.c +30 -42
  138. data/vendor/libgit2/src/diff_stats.c +7 -22
  139. data/vendor/libgit2/src/diff_tform.c +16 -16
  140. data/vendor/libgit2/src/diff_xdiff.c +3 -15
  141. data/vendor/libgit2/src/errors.c +39 -51
  142. data/vendor/libgit2/src/features.h.in +3 -11
  143. data/vendor/libgit2/src/fetch.c +5 -10
  144. data/vendor/libgit2/src/fetchhead.c +17 -17
  145. data/vendor/libgit2/src/filebuf.c +36 -32
  146. data/vendor/libgit2/src/filebuf.h +2 -2
  147. data/vendor/libgit2/src/{futils.c → fileops.c} +73 -80
  148. data/vendor/libgit2/src/{futils.h → fileops.h} +6 -6
  149. data/vendor/libgit2/src/filter.c +38 -46
  150. data/vendor/libgit2/src/filter.h +10 -0
  151. data/vendor/libgit2/src/fnmatch.c +248 -0
  152. data/vendor/libgit2/src/fnmatch.h +48 -0
  153. data/vendor/libgit2/src/global.c +63 -48
  154. data/vendor/libgit2/src/global.h +2 -0
  155. data/vendor/libgit2/src/hash.c +0 -61
  156. data/vendor/libgit2/src/hash.h +19 -20
  157. data/vendor/libgit2/src/hash/hash_collisiondetect.h +47 -0
  158. data/vendor/libgit2/src/hash/{sha1/common_crypto.c → hash_common_crypto.h} +17 -17
  159. data/vendor/libgit2/src/hash/{sha1/generic.c → hash_generic.c} +10 -22
  160. data/vendor/libgit2/src/hash/{sha1/generic.h → hash_generic.h} +10 -4
  161. data/vendor/libgit2/src/hash/hash_openssl.h +59 -0
  162. data/vendor/libgit2/src/hash/{sha1/win32.c → hash_win32.c} +37 -47
  163. data/vendor/libgit2/src/hash/{sha1/win32.h → hash_win32.h} +19 -6
  164. data/vendor/libgit2/src/hash/{sha1/sha1dc → sha1dc}/sha1.c +3 -14
  165. data/vendor/libgit2/src/hash/{sha1/sha1dc → sha1dc}/sha1.h +0 -0
  166. data/vendor/libgit2/src/hash/{sha1/sha1dc → sha1dc}/ubc_check.c +0 -0
  167. data/vendor/libgit2/src/hash/{sha1/sha1dc → sha1dc}/ubc_check.h +0 -0
  168. data/vendor/libgit2/src/hashsig.c +5 -5
  169. data/vendor/libgit2/src/idxmap.c +61 -107
  170. data/vendor/libgit2/src/idxmap.h +31 -153
  171. data/vendor/libgit2/src/ignore.c +47 -43
  172. data/vendor/libgit2/src/index.c +232 -337
  173. data/vendor/libgit2/src/index.h +1 -17
  174. data/vendor/libgit2/src/indexer.c +175 -346
  175. data/vendor/libgit2/src/integer.h +26 -71
  176. data/vendor/libgit2/src/iterator.c +70 -142
  177. data/vendor/libgit2/src/iterator.h +0 -15
  178. data/vendor/libgit2/src/khash.h +1 -3
  179. data/vendor/libgit2/src/map.h +1 -1
  180. data/vendor/libgit2/src/merge.c +100 -144
  181. data/vendor/libgit2/src/merge_driver.c +11 -11
  182. data/vendor/libgit2/src/merge_file.c +2 -2
  183. data/vendor/libgit2/src/mwindow.c +29 -24
  184. data/vendor/libgit2/src/mwindow.h +4 -4
  185. data/vendor/libgit2/src/netops.c +156 -55
  186. data/vendor/libgit2/src/netops.h +23 -3
  187. data/vendor/libgit2/src/notes.c +11 -16
  188. data/vendor/libgit2/src/object.c +69 -120
  189. data/vendor/libgit2/src/object.h +9 -22
  190. data/vendor/libgit2/src/object_api.c +8 -8
  191. data/vendor/libgit2/src/odb.c +93 -116
  192. data/vendor/libgit2/src/odb.h +7 -8
  193. data/vendor/libgit2/src/odb_loose.c +55 -62
  194. data/vendor/libgit2/src/odb_mempack.c +34 -21
  195. data/vendor/libgit2/src/odb_pack.c +14 -18
  196. data/vendor/libgit2/src/offmap.c +35 -53
  197. data/vendor/libgit2/src/offmap.h +21 -108
  198. data/vendor/libgit2/src/oid.c +7 -12
  199. data/vendor/libgit2/src/oidmap.c +47 -49
  200. data/vendor/libgit2/src/oidmap.h +24 -101
  201. data/vendor/libgit2/src/pack-objects.c +87 -88
  202. data/vendor/libgit2/src/pack-objects.h +8 -2
  203. data/vendor/libgit2/src/pack.c +101 -99
  204. data/vendor/libgit2/src/pack.h +19 -17
  205. data/vendor/libgit2/src/parse.c +0 -10
  206. data/vendor/libgit2/src/parse.h +3 -3
  207. data/vendor/libgit2/src/patch.c +4 -4
  208. data/vendor/libgit2/src/patch_generate.c +20 -20
  209. data/vendor/libgit2/src/patch_parse.c +63 -151
  210. data/vendor/libgit2/src/path.c +104 -117
  211. data/vendor/libgit2/src/path.h +71 -3
  212. data/vendor/libgit2/src/pathspec.c +19 -19
  213. data/vendor/libgit2/src/pool.c +22 -26
  214. data/vendor/libgit2/src/pool.h +7 -7
  215. data/vendor/libgit2/src/posix.c +10 -10
  216. data/vendor/libgit2/src/posix.h +1 -12
  217. data/vendor/libgit2/src/proxy.c +3 -8
  218. data/vendor/libgit2/src/push.c +31 -37
  219. data/vendor/libgit2/src/push.h +1 -2
  220. data/vendor/libgit2/src/rebase.c +59 -115
  221. data/vendor/libgit2/src/refdb.c +3 -15
  222. data/vendor/libgit2/src/refdb_fs.c +254 -381
  223. data/vendor/libgit2/src/reflog.c +15 -13
  224. data/vendor/libgit2/src/refs.c +88 -118
  225. data/vendor/libgit2/src/refs.h +3 -5
  226. data/vendor/libgit2/src/refspec.c +37 -56
  227. data/vendor/libgit2/src/refspec.h +1 -1
  228. data/vendor/libgit2/src/remote.c +215 -266
  229. data/vendor/libgit2/src/remote.h +2 -11
  230. data/vendor/libgit2/src/repository.c +225 -280
  231. data/vendor/libgit2/src/repository.h +40 -52
  232. data/vendor/libgit2/src/reset.c +8 -8
  233. data/vendor/libgit2/src/revert.c +9 -14
  234. data/vendor/libgit2/src/revparse.c +48 -47
  235. data/vendor/libgit2/src/revwalk.c +57 -120
  236. data/vendor/libgit2/src/revwalk.h +1 -22
  237. data/vendor/libgit2/src/settings.c +10 -47
  238. data/vendor/libgit2/src/signature.c +11 -11
  239. data/vendor/libgit2/src/sortedcache.c +36 -22
  240. data/vendor/libgit2/src/sortedcache.h +1 -1
  241. data/vendor/libgit2/src/stash.c +99 -125
  242. data/vendor/libgit2/src/status.c +22 -28
  243. data/vendor/libgit2/src/stream.h +2 -17
  244. data/vendor/libgit2/src/streams/curl.c +385 -0
  245. data/vendor/libgit2/src/{allocators/stdalloc.h → streams/curl.h} +5 -5
  246. data/vendor/libgit2/src/streams/openssl.c +114 -224
  247. data/vendor/libgit2/src/streams/openssl.h +108 -4
  248. data/vendor/libgit2/src/streams/socket.c +30 -55
  249. data/vendor/libgit2/src/streams/stransport.c +32 -57
  250. data/vendor/libgit2/src/streams/stransport.h +0 -5
  251. data/vendor/libgit2/src/streams/tls.c +19 -50
  252. data/vendor/libgit2/src/streams/tls.h +4 -12
  253. data/vendor/libgit2/src/strmap.c +74 -47
  254. data/vendor/libgit2/src/strmap.h +33 -108
  255. data/vendor/libgit2/src/submodule.c +216 -272
  256. data/vendor/libgit2/src/submodule.h +1 -1
  257. data/vendor/libgit2/src/sysdir.c +19 -29
  258. data/vendor/libgit2/src/tag.c +28 -41
  259. data/vendor/libgit2/src/tag.h +1 -2
  260. data/vendor/libgit2/src/trace.c +2 -2
  261. data/vendor/libgit2/src/trace.h +3 -3
  262. data/vendor/libgit2/src/trailer.c +38 -52
  263. data/vendor/libgit2/src/transaction.c +29 -30
  264. data/vendor/libgit2/src/transport.c +5 -5
  265. data/vendor/libgit2/src/transports/auth.c +11 -15
  266. data/vendor/libgit2/src/transports/auth.h +3 -10
  267. data/vendor/libgit2/src/transports/auth_negotiate.c +18 -33
  268. data/vendor/libgit2/src/transports/auth_negotiate.h +2 -2
  269. data/vendor/libgit2/src/transports/cred.c +24 -24
  270. data/vendor/libgit2/src/{allocators/win32_crtdbg.h → transports/cred.h} +4 -5
  271. data/vendor/libgit2/src/transports/git.c +31 -26
  272. data/vendor/libgit2/src/transports/http.c +348 -881
  273. data/vendor/libgit2/src/transports/http.h +0 -2
  274. data/vendor/libgit2/src/transports/local.c +35 -35
  275. data/vendor/libgit2/src/transports/smart.c +47 -70
  276. data/vendor/libgit2/src/transports/smart.h +4 -3
  277. data/vendor/libgit2/src/transports/smart_pkt.c +40 -43
  278. data/vendor/libgit2/src/transports/smart_protocol.c +116 -96
  279. data/vendor/libgit2/src/transports/ssh.c +66 -77
  280. data/vendor/libgit2/src/transports/winhttp.c +314 -318
  281. data/vendor/libgit2/src/tree-cache.c +12 -19
  282. data/vendor/libgit2/src/tree.c +142 -103
  283. data/vendor/libgit2/src/tree.h +12 -1
  284. data/vendor/libgit2/src/unix/map.c +3 -3
  285. data/vendor/libgit2/src/unix/posix.h +11 -1
  286. data/vendor/libgit2/src/userdiff.h +1 -3
  287. data/vendor/libgit2/src/util.c +56 -70
  288. data/vendor/libgit2/src/util.h +156 -28
  289. data/vendor/libgit2/src/vector.c +4 -4
  290. data/vendor/libgit2/src/win32/dir.c +3 -3
  291. data/vendor/libgit2/src/win32/findfile.c +3 -3
  292. data/vendor/libgit2/src/win32/map.c +11 -9
  293. data/vendor/libgit2/src/win32/msvc-compat.h +0 -6
  294. data/vendor/libgit2/src/win32/path_w32.c +9 -113
  295. data/vendor/libgit2/src/win32/path_w32.h +29 -18
  296. data/vendor/libgit2/src/win32/posix.h +4 -1
  297. data/vendor/libgit2/src/win32/posix_w32.c +45 -70
  298. data/vendor/libgit2/src/win32/precompiled.h +2 -0
  299. data/vendor/libgit2/src/win32/thread.c +10 -5
  300. data/vendor/libgit2/src/win32/w32_buffer.c +5 -9
  301. data/vendor/libgit2/src/win32/w32_crtdbg_stacktrace.c +2 -3
  302. data/vendor/libgit2/src/win32/w32_crtdbg_stacktrace.h +75 -26
  303. data/vendor/libgit2/src/win32/w32_stack.c +11 -6
  304. data/vendor/libgit2/src/win32/w32_stack.h +3 -3
  305. data/vendor/libgit2/src/win32/w32_util.c +64 -27
  306. data/vendor/libgit2/src/win32/w32_util.h +49 -5
  307. data/vendor/libgit2/src/worktree.c +60 -95
  308. data/vendor/libgit2/src/worktree.h +0 -2
  309. data/vendor/libgit2/src/xdiff/xdiffi.c +5 -7
  310. data/vendor/libgit2/src/xdiff/xhistogram.c +1 -1
  311. data/vendor/libgit2/src/xdiff/xmerge.c +15 -27
  312. data/vendor/libgit2/src/xdiff/xpatience.c +0 -3
  313. data/vendor/libgit2/src/zstream.c +4 -4
  314. metadata +33 -122
  315. data/vendor/libgit2/cmake/Modules/FindGSSFramework.cmake +0 -28
  316. data/vendor/libgit2/cmake/Modules/FindPCRE.cmake +0 -38
  317. data/vendor/libgit2/cmake/Modules/FindPCRE2.cmake +0 -37
  318. data/vendor/libgit2/cmake/Modules/FindmbedTLS.cmake +0 -93
  319. data/vendor/libgit2/cmake/Modules/PkgBuildConfig.cmake +0 -110
  320. data/vendor/libgit2/cmake/Modules/SelectGSSAPI.cmake +0 -53
  321. data/vendor/libgit2/cmake/Modules/SelectHTTPSBackend.cmake +0 -124
  322. data/vendor/libgit2/cmake/Modules/SelectHashes.cmake +0 -66
  323. data/vendor/libgit2/deps/ntlmclient/CMakeLists.txt +0 -21
  324. data/vendor/libgit2/deps/ntlmclient/compat.h +0 -33
  325. data/vendor/libgit2/deps/ntlmclient/crypt.h +0 -64
  326. data/vendor/libgit2/deps/ntlmclient/crypt_commoncrypto.c +0 -120
  327. data/vendor/libgit2/deps/ntlmclient/crypt_commoncrypto.h +0 -18
  328. data/vendor/libgit2/deps/ntlmclient/crypt_mbedtls.c +0 -145
  329. data/vendor/libgit2/deps/ntlmclient/crypt_mbedtls.h +0 -18
  330. data/vendor/libgit2/deps/ntlmclient/crypt_openssl.c +0 -130
  331. data/vendor/libgit2/deps/ntlmclient/crypt_openssl.h +0 -21
  332. data/vendor/libgit2/deps/ntlmclient/ntlm.c +0 -1420
  333. data/vendor/libgit2/deps/ntlmclient/ntlm.h +0 -174
  334. data/vendor/libgit2/deps/ntlmclient/ntlmclient.h +0 -320
  335. data/vendor/libgit2/deps/ntlmclient/unicode.h +0 -36
  336. data/vendor/libgit2/deps/ntlmclient/unicode_builtin.c +0 -445
  337. data/vendor/libgit2/deps/ntlmclient/unicode_iconv.c +0 -201
  338. data/vendor/libgit2/deps/ntlmclient/utf8.h +0 -1257
  339. data/vendor/libgit2/deps/ntlmclient/util.c +0 -21
  340. data/vendor/libgit2/deps/ntlmclient/util.h +0 -14
  341. data/vendor/libgit2/deps/pcre/CMakeLists.txt +0 -140
  342. data/vendor/libgit2/deps/pcre/COPYING +0 -5
  343. data/vendor/libgit2/deps/pcre/cmake/COPYING-CMAKE-SCRIPTS +0 -22
  344. data/vendor/libgit2/deps/pcre/cmake/FindEditline.cmake +0 -17
  345. data/vendor/libgit2/deps/pcre/cmake/FindPackageHandleStandardArgs.cmake +0 -58
  346. data/vendor/libgit2/deps/pcre/cmake/FindReadline.cmake +0 -29
  347. data/vendor/libgit2/deps/pcre/config.h.in +0 -57
  348. data/vendor/libgit2/deps/pcre/pcre.h +0 -641
  349. data/vendor/libgit2/deps/pcre/pcre_byte_order.c +0 -319
  350. data/vendor/libgit2/deps/pcre/pcre_chartables.c +0 -198
  351. data/vendor/libgit2/deps/pcre/pcre_compile.c +0 -9800
  352. data/vendor/libgit2/deps/pcre/pcre_config.c +0 -190
  353. data/vendor/libgit2/deps/pcre/pcre_dfa_exec.c +0 -3676
  354. data/vendor/libgit2/deps/pcre/pcre_exec.c +0 -7173
  355. data/vendor/libgit2/deps/pcre/pcre_fullinfo.c +0 -245
  356. data/vendor/libgit2/deps/pcre/pcre_get.c +0 -669
  357. data/vendor/libgit2/deps/pcre/pcre_globals.c +0 -86
  358. data/vendor/libgit2/deps/pcre/pcre_internal.h +0 -2787
  359. data/vendor/libgit2/deps/pcre/pcre_jit_compile.c +0 -11913
  360. data/vendor/libgit2/deps/pcre/pcre_maketables.c +0 -156
  361. data/vendor/libgit2/deps/pcre/pcre_newline.c +0 -210
  362. data/vendor/libgit2/deps/pcre/pcre_ord2utf8.c +0 -94
  363. data/vendor/libgit2/deps/pcre/pcre_printint.c +0 -834
  364. data/vendor/libgit2/deps/pcre/pcre_refcount.c +0 -92
  365. data/vendor/libgit2/deps/pcre/pcre_string_utils.c +0 -211
  366. data/vendor/libgit2/deps/pcre/pcre_study.c +0 -1686
  367. data/vendor/libgit2/deps/pcre/pcre_tables.c +0 -727
  368. data/vendor/libgit2/deps/pcre/pcre_ucd.c +0 -3644
  369. data/vendor/libgit2/deps/pcre/pcre_valid_utf8.c +0 -301
  370. data/vendor/libgit2/deps/pcre/pcre_version.c +0 -98
  371. data/vendor/libgit2/deps/pcre/pcre_xclass.c +0 -268
  372. data/vendor/libgit2/deps/pcre/pcreposix.c +0 -421
  373. data/vendor/libgit2/deps/pcre/pcreposix.h +0 -117
  374. data/vendor/libgit2/deps/pcre/ucp.h +0 -224
  375. data/vendor/libgit2/deps/winhttp/COPYING.GPL +0 -993
  376. data/vendor/libgit2/deps/winhttp/COPYING.LGPL +0 -502
  377. data/vendor/libgit2/deps/zlib/COPYING +0 -27
  378. data/vendor/libgit2/include/git2/apply.h +0 -149
  379. data/vendor/libgit2/include/git2/cert.h +0 -135
  380. data/vendor/libgit2/include/git2/cred.h +0 -308
  381. data/vendor/libgit2/include/git2/deprecated.h +0 -493
  382. data/vendor/libgit2/include/git2/mailmap.h +0 -115
  383. data/vendor/libgit2/include/git2/sys/alloc.h +0 -101
  384. data/vendor/libgit2/include/git2/sys/cred.h +0 -90
  385. data/vendor/libgit2/include/git2/sys/path.h +0 -64
  386. data/vendor/libgit2/src/alloc.c +0 -43
  387. data/vendor/libgit2/src/alloc.h +0 -40
  388. data/vendor/libgit2/src/allocators/stdalloc.c +0 -119
  389. data/vendor/libgit2/src/allocators/win32_crtdbg.c +0 -118
  390. data/vendor/libgit2/src/config_backend.h +0 -96
  391. data/vendor/libgit2/src/config_entries.c +0 -229
  392. data/vendor/libgit2/src/config_entries.h +0 -24
  393. data/vendor/libgit2/src/config_mem.c +0 -220
  394. data/vendor/libgit2/src/config_snapshot.c +0 -206
  395. data/vendor/libgit2/src/errors.h +0 -81
  396. data/vendor/libgit2/src/hash/sha1.h +0 -38
  397. data/vendor/libgit2/src/hash/sha1/collisiondetect.c +0 -48
  398. data/vendor/libgit2/src/hash/sha1/collisiondetect.h +0 -19
  399. data/vendor/libgit2/src/hash/sha1/common_crypto.h +0 -19
  400. data/vendor/libgit2/src/hash/sha1/mbedtls.c +0 -46
  401. data/vendor/libgit2/src/hash/sha1/mbedtls.h +0 -19
  402. data/vendor/libgit2/src/hash/sha1/openssl.c +0 -59
  403. data/vendor/libgit2/src/hash/sha1/openssl.h +0 -19
  404. data/vendor/libgit2/src/mailmap.c +0 -485
  405. data/vendor/libgit2/src/mailmap.h +0 -35
  406. data/vendor/libgit2/src/net.c +0 -184
  407. data/vendor/libgit2/src/net.h +0 -36
  408. data/vendor/libgit2/src/reader.c +0 -265
  409. data/vendor/libgit2/src/reader.h +0 -107
  410. data/vendor/libgit2/src/regexp.c +0 -221
  411. data/vendor/libgit2/src/regexp.h +0 -97
  412. data/vendor/libgit2/src/streams/mbedtls.c +0 -483
  413. data/vendor/libgit2/src/streams/mbedtls.h +0 -23
  414. data/vendor/libgit2/src/streams/registry.c +0 -118
  415. data/vendor/libgit2/src/streams/registry.h +0 -19
  416. data/vendor/libgit2/src/transports/auth_ntlm.c +0 -223
  417. data/vendor/libgit2/src/transports/auth_ntlm.h +0 -35
  418. data/vendor/libgit2/src/wildmatch.c +0 -320
  419. data/vendor/libgit2/src/wildmatch.h +0 -23
  420. data/vendor/libgit2/src/win32/w32_common.h +0 -39
@@ -35,12 +35,5 @@ struct git_commit {
35
35
 
36
36
  void git_commit__free(void *commit);
37
37
  int git_commit__parse(void *commit, git_odb_object *obj);
38
- int git_commit__parse_raw(void *commit, const char *data, size_t size);
39
-
40
- typedef enum {
41
- GIT_COMMIT_PARSE_QUICK = (1 << 0), /**< Only parse parents and committer info */
42
- } git_commit__parse_flags;
43
-
44
- int git_commit__parse_ext(git_commit *commit, git_odb_object *odb_obj, unsigned int flags);
45
38
 
46
39
  #endif
@@ -10,7 +10,6 @@
10
10
  #include "revwalk.h"
11
11
  #include "pool.h"
12
12
  #include "odb.h"
13
- #include "commit.h"
14
13
 
15
14
  int git_commit_list_time_cmp(const void *a, const void *b)
16
15
  {
@@ -56,6 +55,17 @@ git_commit_list_node *git_commit_list_alloc_node(git_revwalk *walk)
56
55
  return (git_commit_list_node *)git_pool_mallocz(&walk->commit_pool, 1);
57
56
  }
58
57
 
58
+ static int commit_error(git_commit_list_node *commit, const char *msg)
59
+ {
60
+ char commit_oid[GIT_OID_HEXSZ + 1];
61
+ git_oid_fmt(commit_oid, &commit->oid);
62
+ commit_oid[GIT_OID_HEXSZ] = '\0';
63
+
64
+ giterr_set(GITERR_ODB, "failed to parse commit %s - %s", commit_oid, msg);
65
+
66
+ return -1;
67
+ }
68
+
59
69
  static git_commit_list_node **alloc_parents(
60
70
  git_revwalk *walk, git_commit_list_node *commit, size_t n_parents)
61
71
  {
@@ -101,42 +111,77 @@ git_commit_list_node *git_commit_list_pop(git_commit_list **stack)
101
111
 
102
112
  static int commit_quick_parse(
103
113
  git_revwalk *walk,
104
- git_commit_list_node *node,
105
- git_odb_object *obj)
114
+ git_commit_list_node *commit,
115
+ const uint8_t *buffer,
116
+ size_t buffer_len)
106
117
  {
107
- git_oid *parent_oid;
108
- git_commit *commit;
109
- int error;
110
- size_t i;
118
+ const size_t parent_len = strlen("parent ") + GIT_OID_HEXSZ + 1;
119
+ const uint8_t *buffer_end = buffer + buffer_len;
120
+ const uint8_t *parents_start, *committer_start;
121
+ int i, parents = 0;
122
+ int64_t commit_time;
123
+
124
+ buffer += strlen("tree ") + GIT_OID_HEXSZ + 1;
125
+
126
+ parents_start = buffer;
127
+ while (buffer + parent_len < buffer_end && memcmp(buffer, "parent ", strlen("parent ")) == 0) {
128
+ parents++;
129
+ buffer += parent_len;
130
+ }
111
131
 
112
- commit = git__calloc(1, sizeof(*commit));
113
- GIT_ERROR_CHECK_ALLOC(commit);
114
- commit->object.repo = walk->repo;
132
+ commit->parents = alloc_parents(walk, commit, parents);
133
+ GITERR_CHECK_ALLOC(commit->parents);
115
134
 
116
- if ((error = git_commit__parse_ext(commit, obj, GIT_COMMIT_PARSE_QUICK)) < 0) {
117
- git__free(commit);
118
- return error;
119
- }
135
+ buffer = parents_start;
136
+ for (i = 0; i < parents; ++i) {
137
+ git_oid oid;
120
138
 
121
- if (!git__is_uint16(git_array_size(commit->parent_ids))) {
122
- git__free(commit);
123
- git_error_set(GIT_ERROR_INVALID, "commit has more than 2^16 parents");
124
- return -1;
125
- }
139
+ if (git_oid_fromstr(&oid, (const char *)buffer + strlen("parent ")) < 0)
140
+ return -1;
126
141
 
127
- node->time = commit->committer->when.time;
128
- node->out_degree = (uint16_t) git_array_size(commit->parent_ids);
129
- node->parents = alloc_parents(walk, node, node->out_degree);
130
- GIT_ERROR_CHECK_ALLOC(node->parents);
142
+ commit->parents[i] = git_revwalk__commit_lookup(walk, &oid);
143
+ if (commit->parents[i] == NULL)
144
+ return -1;
131
145
 
132
- git_array_foreach(commit->parent_ids, i, parent_oid) {
133
- node->parents[i] = git_revwalk__commit_lookup(walk, parent_oid);
146
+ buffer += parent_len;
134
147
  }
135
148
 
136
- git_commit__free(commit);
149
+ commit->out_degree = (unsigned short)parents;
150
+
151
+ if ((committer_start = buffer = memchr(buffer, '\n', buffer_end - buffer)) == NULL)
152
+ return commit_error(commit, "object is corrupted");
153
+
154
+ buffer++;
155
+
156
+ if ((buffer = memchr(buffer, '\n', buffer_end - buffer)) == NULL)
157
+ return commit_error(commit, "object is corrupted");
158
+
159
+ /* Skip trailing spaces */
160
+ while (buffer > committer_start && git__isspace(*buffer))
161
+ buffer--;
162
+
163
+ /* Seek for the beginning of the pack of digits */
164
+ while (buffer > committer_start && git__isdigit(*buffer))
165
+ buffer--;
166
+
167
+ /* Skip potential timezone offset */
168
+ if ((buffer > committer_start) && (*buffer == '+' || *buffer == '-')) {
169
+ buffer--;
170
+
171
+ while (buffer > committer_start && git__isspace(*buffer))
172
+ buffer--;
173
+
174
+ while (buffer > committer_start && git__isdigit(*buffer))
175
+ buffer--;
176
+ }
137
177
 
138
- node->parsed = 1;
178
+ if ((buffer == committer_start) ||
179
+ (git__strntol64(&commit_time, (char *)(buffer + 1),
180
+ buffer_end - buffer + 1, NULL, 10) < 0))
181
+ return commit_error(commit, "cannot parse commit time");
139
182
 
183
+ commit->time = commit_time;
184
+ commit->parsed = 1;
140
185
  return 0;
141
186
  }
142
187
 
@@ -151,11 +196,14 @@ int git_commit_list_parse(git_revwalk *walk, git_commit_list_node *commit)
151
196
  if ((error = git_odb_read(&obj, walk->odb, &commit->oid)) < 0)
152
197
  return error;
153
198
 
154
- if (obj->cached.type != GIT_OBJECT_COMMIT) {
155
- git_error_set(GIT_ERROR_INVALID, "object is no commit object");
199
+ if (obj->cached.type != GIT_OBJ_COMMIT) {
200
+ giterr_set(GITERR_INVALID, "object is no commit object");
156
201
  error = -1;
157
202
  } else
158
- error = commit_quick_parse(walk, commit, obj);
203
+ error = commit_quick_parse(
204
+ walk, commit,
205
+ (const uint8_t *)git_odb_object_data(obj),
206
+ git_odb_object_size(obj));
159
207
 
160
208
  git_odb_object_free(obj);
161
209
  return error;
@@ -33,8 +33,8 @@ typedef struct git_commit_list_node {
33
33
  added:1,
34
34
  flags : FLAG_BITS;
35
35
 
36
- uint16_t in_degree;
37
- uint16_t out_degree;
36
+ unsigned short in_degree;
37
+ unsigned short out_degree;
38
38
 
39
39
  struct git_commit_list_node **parents;
40
40
  } git_commit_list_node;
@@ -17,10 +17,8 @@
17
17
  /** Declare a function as always inlined. */
18
18
  #if defined(_MSC_VER)
19
19
  # define GIT_INLINE(type) static __inline type
20
- #elif defined(__GNUC__)
21
- # define GIT_INLINE(type) static __inline__ type
22
20
  #else
23
- # define GIT_INLINE(type) static type
21
+ # define GIT_INLINE(type) static inline type
24
22
  #endif
25
23
 
26
24
  /** Support for gcc/clang __has_builtin intrinsic */
@@ -47,7 +45,6 @@
47
45
  # include <ws2tcpip.h>
48
46
  # include "win32/msvc-compat.h"
49
47
  # include "win32/mingw-compat.h"
50
- # include "win32/w32_common.h"
51
48
  # include "win32/win32-compat.h"
52
49
  # include "win32/error.h"
53
50
  # include "win32/version.h"
@@ -77,17 +74,10 @@
77
74
 
78
75
  #include "git2/types.h"
79
76
  #include "git2/errors.h"
80
- #include "errors.h"
81
77
  #include "thread-utils.h"
82
78
  #include "integer.h"
83
79
 
84
- /*
85
- * Include the declarations for deprecated functions; this ensures
86
- * that they're decorated with the proper extern/visibility attributes.
87
- */
88
- #include "git2/deprecated.h"
89
-
90
- #include "posix.h"
80
+ #include <regex.h>
91
81
 
92
82
  #define DEFAULT_BUFSIZE 65536
93
83
  #define FILEIO_BUFSIZE DEFAULT_BUFSIZE
@@ -97,23 +87,97 @@
97
87
  /**
98
88
  * Check a pointer allocation result, returning -1 if it failed.
99
89
  */
100
- #define GIT_ERROR_CHECK_ALLOC(ptr) if (ptr == NULL) { return -1; }
90
+ #define GITERR_CHECK_ALLOC(ptr) if (ptr == NULL) { return -1; }
101
91
 
102
92
  /**
103
93
  * Check a buffer allocation result, returning -1 if it failed.
104
94
  */
105
- #define GIT_ERROR_CHECK_ALLOC_BUF(buf) if ((void *)(buf) == NULL || git_buf_oom(buf)) { return -1; }
95
+ #define GITERR_CHECK_ALLOC_BUF(buf) if ((void *)(buf) == NULL || git_buf_oom(buf)) { return -1; }
106
96
 
107
97
  /**
108
98
  * Check a return value and propagate result if non-zero.
109
99
  */
110
- #define GIT_ERROR_CHECK_ERROR(code) \
100
+ #define GITERR_CHECK_ERROR(code) \
111
101
  do { int _err = (code); if (_err) return _err; } while (0)
112
102
 
103
+ /**
104
+ * Set the error message for this thread, formatting as needed.
105
+ */
106
+
107
+ void giterr_set(int error_class, const char *string, ...) GIT_FORMAT_PRINTF(2, 3);
108
+
109
+ /**
110
+ * Set the error message for a regex failure, using the internal regex
111
+ * error code lookup and return a libgit error code.
112
+ */
113
+ int giterr_set_regex(const regex_t *regex, int error_code);
114
+
115
+ /**
116
+ * Set error message for user callback if needed.
117
+ *
118
+ * If the error code in non-zero and no error message is set, this
119
+ * sets a generic error message.
120
+ *
121
+ * @return This always returns the `error_code` parameter.
122
+ */
123
+ GIT_INLINE(int) giterr_set_after_callback_function(
124
+ int error_code, const char *action)
125
+ {
126
+ if (error_code) {
127
+ const git_error *e = giterr_last();
128
+ if (!e || !e->message)
129
+ giterr_set(e ? e->klass : GITERR_CALLBACK,
130
+ "%s callback returned %d", action, error_code);
131
+ }
132
+ return error_code;
133
+ }
134
+
135
+ #ifdef GIT_WIN32
136
+ #define giterr_set_after_callback(code) \
137
+ giterr_set_after_callback_function((code), __FUNCTION__)
138
+ #else
139
+ #define giterr_set_after_callback(code) \
140
+ giterr_set_after_callback_function((code), __func__)
141
+ #endif
142
+
143
+ /**
144
+ * Gets the system error code for this thread.
145
+ */
146
+ int giterr_system_last(void);
147
+
148
+ /**
149
+ * Sets the system error code for this thread.
150
+ */
151
+ void giterr_system_set(int code);
152
+
153
+ /**
154
+ * Structure to preserve libgit2 error state
155
+ */
156
+ typedef struct {
157
+ int error_code;
158
+ unsigned int oom : 1;
159
+ git_error error_msg;
160
+ } git_error_state;
161
+
162
+ /**
163
+ * Capture current error state to restore later, returning error code.
164
+ * If `error_code` is zero, this does not clear the current error state.
165
+ * You must either restore this error state, or free it.
166
+ */
167
+ extern int giterr_state_capture(git_error_state *state, int error_code);
168
+
169
+ /**
170
+ * Restore error state to a previous value, returning saved error code.
171
+ */
172
+ extern int giterr_state_restore(git_error_state *state);
173
+
174
+ /** Free an error state. */
175
+ extern void giterr_state_free(git_error_state *state);
176
+
113
177
  /**
114
178
  * Check a versioned structure for validity
115
179
  */
116
- GIT_INLINE(int) git_error__check_version(const void *structure, unsigned int expected_max, const char *name)
180
+ GIT_INLINE(int) giterr__check_version(const void *structure, unsigned int expected_max, const char *name)
117
181
  {
118
182
  unsigned int actual;
119
183
 
@@ -124,10 +188,10 @@ GIT_INLINE(int) git_error__check_version(const void *structure, unsigned int exp
124
188
  if (actual > 0 && actual <= expected_max)
125
189
  return 0;
126
190
 
127
- git_error_set(GIT_ERROR_INVALID, "invalid version %d on %s", actual, name);
191
+ giterr_set(GITERR_INVALID, "invalid version %d on %s", actual, name);
128
192
  return -1;
129
193
  }
130
- #define GIT_ERROR_CHECK_VERSION(S,V,N) if (git_error__check_version(S,V,N) < 0) return -1
194
+ #define GITERR_CHECK_VERSION(S,V,N) if (giterr__check_version(S,V,N) < 0) return -1
131
195
 
132
196
  /**
133
197
  * Initialize a structure with a version.
@@ -141,42 +205,42 @@ GIT_INLINE(void) git__init_structure(void *structure, size_t len, unsigned int v
141
205
 
142
206
  #define GIT_INIT_STRUCTURE_FROM_TEMPLATE(PTR,VERSION,TYPE,TPL) do { \
143
207
  TYPE _tmpl = TPL; \
144
- GIT_ERROR_CHECK_VERSION(&(VERSION), _tmpl.version, #TYPE); \
208
+ GITERR_CHECK_VERSION(&(VERSION), _tmpl.version, #TYPE); \
145
209
  memcpy((PTR), &_tmpl, sizeof(_tmpl)); } while (0)
146
210
 
147
211
 
148
212
  /** Check for additive overflow, setting an error if would occur. */
149
213
  #define GIT_ADD_SIZET_OVERFLOW(out, one, two) \
150
- (git__add_sizet_overflow(out, one, two) ? (git_error_set_oom(), 1) : 0)
214
+ (git__add_sizet_overflow(out, one, two) ? (giterr_set_oom(), 1) : 0)
151
215
 
152
216
  /** Check for additive overflow, setting an error if would occur. */
153
217
  #define GIT_MULTIPLY_SIZET_OVERFLOW(out, nelem, elsize) \
154
- (git__multiply_sizet_overflow(out, nelem, elsize) ? (git_error_set_oom(), 1) : 0)
218
+ (git__multiply_sizet_overflow(out, nelem, elsize) ? (giterr_set_oom(), 1) : 0)
155
219
 
156
220
  /** Check for additive overflow, failing if it would occur. */
157
- #define GIT_ERROR_CHECK_ALLOC_ADD(out, one, two) \
221
+ #define GITERR_CHECK_ALLOC_ADD(out, one, two) \
158
222
  if (GIT_ADD_SIZET_OVERFLOW(out, one, two)) { return -1; }
159
223
 
160
- #define GIT_ERROR_CHECK_ALLOC_ADD3(out, one, two, three) \
224
+ #define GITERR_CHECK_ALLOC_ADD3(out, one, two, three) \
161
225
  if (GIT_ADD_SIZET_OVERFLOW(out, one, two) || \
162
226
  GIT_ADD_SIZET_OVERFLOW(out, *(out), three)) { return -1; }
163
227
 
164
- #define GIT_ERROR_CHECK_ALLOC_ADD4(out, one, two, three, four) \
228
+ #define GITERR_CHECK_ALLOC_ADD4(out, one, two, three, four) \
165
229
  if (GIT_ADD_SIZET_OVERFLOW(out, one, two) || \
166
230
  GIT_ADD_SIZET_OVERFLOW(out, *(out), three) || \
167
231
  GIT_ADD_SIZET_OVERFLOW(out, *(out), four)) { return -1; }
168
232
 
169
- #define GIT_ERROR_CHECK_ALLOC_ADD5(out, one, two, three, four, five) \
233
+ #define GITERR_CHECK_ALLOC_ADD5(out, one, two, three, four, five) \
170
234
  if (GIT_ADD_SIZET_OVERFLOW(out, one, two) || \
171
235
  GIT_ADD_SIZET_OVERFLOW(out, *(out), three) || \
172
236
  GIT_ADD_SIZET_OVERFLOW(out, *(out), four) || \
173
237
  GIT_ADD_SIZET_OVERFLOW(out, *(out), five)) { return -1; }
174
238
 
175
239
  /** Check for multiplicative overflow, failing if it would occur. */
176
- #define GIT_ERROR_CHECK_ALLOC_MULTIPLY(out, nelem, elsize) \
240
+ #define GITERR_CHECK_ALLOC_MULTIPLY(out, nelem, elsize) \
177
241
  if (GIT_MULTIPLY_SIZET_OVERFLOW(out, nelem, elsize)) { return -1; }
178
242
 
179
- /* NOTE: other git_error functions are in the public errors.h header file */
243
+ /* NOTE: other giterr functions are in the public errors.h header file */
180
244
 
181
245
  #include "util.h"
182
246
 
@@ -7,15 +7,13 @@
7
7
 
8
8
  #include "config.h"
9
9
 
10
+ #include "sysdir.h"
10
11
  #include "git2/config.h"
11
12
  #include "git2/sys/config.h"
12
-
13
+ #include "vector.h"
13
14
  #include "buf_text.h"
14
- #include "config_backend.h"
15
- #include "regexp.h"
16
- #include "sysdir.h"
15
+ #include "config_file.h"
17
16
  #include "transaction.h"
18
- #include "vector.h"
19
17
  #if GIT_WIN32
20
18
  # include <windows.h>
21
19
  #endif
@@ -33,30 +31,30 @@ void git_config_entry_free(git_config_entry *entry)
33
31
  typedef struct {
34
32
  git_refcount rc;
35
33
 
36
- git_config_backend *backend;
34
+ git_config_backend *file;
37
35
  git_config_level_t level;
38
- } backend_internal;
36
+ } file_internal;
39
37
 
40
- static void backend_internal_free(backend_internal *internal)
38
+ static void file_internal_free(file_internal *internal)
41
39
  {
42
- git_config_backend *backend;
40
+ git_config_backend *file;
43
41
 
44
- backend = internal->backend;
45
- backend->free(backend);
42
+ file = internal->file;
43
+ file->free(file);
46
44
  git__free(internal);
47
45
  }
48
46
 
49
47
  static void config_free(git_config *cfg)
50
48
  {
51
49
  size_t i;
52
- backend_internal *internal;
50
+ file_internal *internal;
53
51
 
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);
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);
57
55
  }
58
56
 
59
- git_vector_free(&cfg->backends);
57
+ git_vector_free(&cfg->files);
60
58
 
61
59
  git__memzero(cfg, sizeof(*cfg));
62
60
  git__free(cfg);
@@ -72,8 +70,8 @@ void git_config_free(git_config *cfg)
72
70
 
73
71
  static int config_backend_cmp(const void *a, const void *b)
74
72
  {
75
- const backend_internal *bk_a = (const backend_internal *)(a);
76
- const backend_internal *bk_b = (const backend_internal *)(b);
73
+ const file_internal *bk_a = (const file_internal *)(a);
74
+ const file_internal *bk_b = (const file_internal *)(b);
77
75
 
78
76
  return bk_b->level - bk_a->level;
79
77
  }
@@ -83,11 +81,11 @@ int git_config_new(git_config **out)
83
81
  git_config *cfg;
84
82
 
85
83
  cfg = git__malloc(sizeof(git_config));
86
- GIT_ERROR_CHECK_ALLOC(cfg);
84
+ GITERR_CHECK_ALLOC(cfg);
87
85
 
88
86
  memset(cfg, 0x0, sizeof(git_config));
89
87
 
90
- if (git_vector_init(&cfg->backends, 3, config_backend_cmp) < 0) {
88
+ if (git_vector_init(&cfg->files, 3, config_backend_cmp) < 0) {
91
89
  git__free(cfg);
92
90
  return -1;
93
91
  }
@@ -112,11 +110,11 @@ int git_config_add_file_ondisk(
112
110
 
113
111
  res = p_stat(path, &st);
114
112
  if (res < 0 && errno != ENOENT && errno != ENOTDIR) {
115
- git_error_set(GIT_ERROR_CONFIG, "failed to stat '%s'", path);
113
+ giterr_set(GITERR_CONFIG, "failed to stat '%s'", path);
116
114
  return -1;
117
115
  }
118
116
 
119
- if (git_config_backend_from_file(&file, path) < 0)
117
+ if (git_config_file__ondisk(&file, path) < 0)
120
118
  return -1;
121
119
 
122
120
  if ((res = git_config_add_backend(cfg, file, level, repo, force)) < 0) {
@@ -153,7 +151,7 @@ int git_config_snapshot(git_config **out, git_config *in)
153
151
  {
154
152
  int error = 0;
155
153
  size_t i;
156
- backend_internal *internal;
154
+ file_internal *internal;
157
155
  git_config *config;
158
156
 
159
157
  *out = NULL;
@@ -161,10 +159,10 @@ int git_config_snapshot(git_config **out, git_config *in)
161
159
  if (git_config_new(&config) < 0)
162
160
  return -1;
163
161
 
164
- git_vector_foreach(&in->backends, i, internal) {
162
+ git_vector_foreach(&in->files, i, internal) {
165
163
  git_config_backend *b;
166
164
 
167
- if ((error = internal->backend->snapshot(&b, internal->backend)) < 0)
165
+ if ((error = internal->file->snapshot(&b, internal->file)) < 0)
168
166
  break;
169
167
 
170
168
  if ((error = git_config_add_backend(config, b, internal->level, NULL, 0)) < 0) {
@@ -181,59 +179,59 @@ int git_config_snapshot(git_config **out, git_config *in)
181
179
  return error;
182
180
  }
183
181
 
184
- static int find_backend_by_level(
185
- backend_internal **out,
182
+ static int find_internal_file_by_level(
183
+ file_internal **internal_out,
186
184
  const git_config *cfg,
187
185
  git_config_level_t level)
188
186
  {
189
187
  int pos = -1;
190
- backend_internal *internal;
188
+ file_internal *internal;
191
189
  size_t i;
192
190
 
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
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
196
194
  * will do the job.
197
195
  */
198
196
  if (level == GIT_CONFIG_HIGHEST_LEVEL) {
199
197
  pos = 0;
200
198
  } else {
201
- git_vector_foreach(&cfg->backends, i, internal) {
199
+ git_vector_foreach(&cfg->files, i, internal) {
202
200
  if (internal->level == level)
203
201
  pos = (int)i;
204
202
  }
205
203
  }
206
204
 
207
205
  if (pos == -1) {
208
- git_error_set(GIT_ERROR_CONFIG,
209
- "no configuration exists for the given level '%i'", (int)level);
206
+ giterr_set(GITERR_CONFIG,
207
+ "no config file exists for the given level '%i'", (int)level);
210
208
  return GIT_ENOTFOUND;
211
209
  }
212
210
 
213
- *out = git_vector_get(&cfg->backends, pos);
211
+ *internal_out = git_vector_get(&cfg->files, pos);
214
212
 
215
213
  return 0;
216
214
  }
217
215
 
218
216
  static int duplicate_level(void **old_raw, void *new_raw)
219
217
  {
220
- backend_internal **old = (backend_internal **)old_raw;
218
+ file_internal **old = (file_internal **)old_raw;
221
219
 
222
220
  GIT_UNUSED(new_raw);
223
221
 
224
- git_error_set(GIT_ERROR_CONFIG, "there already exists a configuration for the given level (%i)", (int)(*old)->level);
222
+ giterr_set(GITERR_CONFIG, "a file with the same level (%i) has already been added to the config", (int)(*old)->level);
225
223
  return GIT_EEXISTS;
226
224
  }
227
225
 
228
- static void try_remove_existing_backend(
226
+ static void try_remove_existing_file_internal(
229
227
  git_config *cfg,
230
228
  git_config_level_t level)
231
229
  {
232
230
  int pos = -1;
233
- backend_internal *internal;
231
+ file_internal *internal;
234
232
  size_t i;
235
233
 
236
- git_vector_foreach(&cfg->backends, i, internal) {
234
+ git_vector_foreach(&cfg->files, i, internal) {
237
235
  if (internal->level == level)
238
236
  pos = (int)i;
239
237
  }
@@ -241,32 +239,32 @@ static void try_remove_existing_backend(
241
239
  if (pos == -1)
242
240
  return;
243
241
 
244
- internal = git_vector_get(&cfg->backends, pos);
242
+ internal = git_vector_get(&cfg->files, pos);
245
243
 
246
- if (git_vector_remove(&cfg->backends, pos) < 0)
244
+ if (git_vector_remove(&cfg->files, pos) < 0)
247
245
  return;
248
246
 
249
- GIT_REFCOUNT_DEC(internal, backend_internal_free);
247
+ GIT_REFCOUNT_DEC(internal, file_internal_free);
250
248
  }
251
249
 
252
250
  static int git_config__add_internal(
253
251
  git_config *cfg,
254
- backend_internal *internal,
252
+ file_internal *internal,
255
253
  git_config_level_t level,
256
254
  int force)
257
255
  {
258
256
  int result;
259
257
 
260
- /* delete existing config backend for level if it exists */
258
+ /* delete existing config file for level if it exists */
261
259
  if (force)
262
- try_remove_existing_backend(cfg, level);
260
+ try_remove_existing_file_internal(cfg, level);
263
261
 
264
- if ((result = git_vector_insert_sorted(&cfg->backends,
262
+ if ((result = git_vector_insert_sorted(&cfg->files,
265
263
  internal, &duplicate_level)) < 0)
266
264
  return result;
267
265
 
268
- git_vector_sort(&cfg->backends);
269
- internal->backend->cfg = cfg;
266
+ git_vector_sort(&cfg->files);
267
+ internal->file->cfg = cfg;
270
268
 
271
269
  GIT_REFCOUNT_INC(internal);
272
270
 
@@ -287,10 +285,10 @@ int git_config_open_level(
287
285
  git_config_level_t level)
288
286
  {
289
287
  git_config *cfg;
290
- backend_internal *internal;
288
+ file_internal *internal;
291
289
  int res;
292
290
 
293
- if ((res = find_backend_by_level(&internal, cfg_parent, level)) < 0)
291
+ if ((res = find_internal_file_by_level(&internal, cfg_parent, level)) < 0)
294
292
  return res;
295
293
 
296
294
  if ((res = git_config_new(&cfg)) < 0)
@@ -308,27 +306,27 @@ int git_config_open_level(
308
306
 
309
307
  int git_config_add_backend(
310
308
  git_config *cfg,
311
- git_config_backend *backend,
309
+ git_config_backend *file,
312
310
  git_config_level_t level,
313
311
  const git_repository *repo,
314
312
  int force)
315
313
  {
316
- backend_internal *internal;
314
+ file_internal *internal;
317
315
  int result;
318
316
 
319
- assert(cfg && backend);
317
+ assert(cfg && file);
320
318
 
321
- GIT_ERROR_CHECK_VERSION(backend, GIT_CONFIG_BACKEND_VERSION, "git_config_backend");
319
+ GITERR_CHECK_VERSION(file, GIT_CONFIG_BACKEND_VERSION, "git_config_backend");
322
320
 
323
- if ((result = backend->open(backend, level, repo)) < 0)
321
+ if ((result = file->open(file, level, repo)) < 0)
324
322
  return result;
325
323
 
326
- internal = git__malloc(sizeof(backend_internal));
327
- GIT_ERROR_CHECK_ALLOC(internal);
324
+ internal = git__malloc(sizeof(file_internal));
325
+ GITERR_CHECK_ALLOC(internal);
328
326
 
329
- memset(internal, 0x0, sizeof(backend_internal));
327
+ memset(internal, 0x0, sizeof(file_internal));
330
328
 
331
- internal->backend = backend;
329
+ internal->file = file;
332
330
  internal->level = level;
333
331
 
334
332
  if ((result = git_config__add_internal(cfg, internal, level, force)) < 0) {
@@ -347,17 +345,17 @@ typedef struct {
347
345
  git_config_iterator parent;
348
346
  git_config_iterator *current;
349
347
  const git_config *cfg;
350
- git_regexp regex;
348
+ regex_t regex;
351
349
  size_t i;
352
350
  } all_iter;
353
351
 
354
352
  static int find_next_backend(size_t *out, const git_config *cfg, size_t i)
355
353
  {
356
- backend_internal *internal;
354
+ file_internal *internal;
357
355
 
358
356
  for (; i > 0; --i) {
359
- internal = git_vector_get(&cfg->backends, i - 1);
360
- if (!internal || !internal->backend)
357
+ internal = git_vector_get(&cfg->files, i - 1);
358
+ if (!internal || !internal->file)
361
359
  continue;
362
360
 
363
361
  *out = i;
@@ -370,7 +368,7 @@ static int find_next_backend(size_t *out, const git_config *cfg, size_t i)
370
368
  static int all_iter_next(git_config_entry **entry, git_config_iterator *_iter)
371
369
  {
372
370
  all_iter *iter = (all_iter *) _iter;
373
- backend_internal *internal;
371
+ file_internal *internal;
374
372
  git_config_backend *backend;
375
373
  size_t i;
376
374
  int error = 0;
@@ -387,8 +385,8 @@ static int all_iter_next(git_config_entry **entry, git_config_iterator *_iter)
387
385
  if (find_next_backend(&i, iter->cfg, iter->i) < 0)
388
386
  return GIT_ITEROVER;
389
387
 
390
- internal = git_vector_get(&iter->cfg->backends, i - 1);
391
- backend = internal->backend;
388
+ internal = git_vector_get(&iter->cfg->files, i - 1);
389
+ backend = internal->file;
392
390
  iter->i = i - 1;
393
391
 
394
392
  if (iter->current)
@@ -425,7 +423,7 @@ static int all_iter_glob_next(git_config_entry **entry, git_config_iterator *_it
425
423
  */
426
424
  while ((error = all_iter_next(entry, _iter)) == 0) {
427
425
  /* skip non-matching keys if regexp was provided */
428
- if (git_regexp_match(&iter->regex, (*entry)->name) != 0)
426
+ if (regexec(&iter->regex, (*entry)->name, 0, NULL, 0) != 0)
429
427
  continue;
430
428
 
431
429
  /* and simply return if we like the entry's name */
@@ -449,7 +447,7 @@ static void all_iter_glob_free(git_config_iterator *_iter)
449
447
  {
450
448
  all_iter *iter = (all_iter *) _iter;
451
449
 
452
- git_regexp_dispose(&iter->regex);
450
+ regfree(&iter->regex);
453
451
  all_iter_free(_iter);
454
452
  }
455
453
 
@@ -458,12 +456,12 @@ int git_config_iterator_new(git_config_iterator **out, const git_config *cfg)
458
456
  all_iter *iter;
459
457
 
460
458
  iter = git__calloc(1, sizeof(all_iter));
461
- GIT_ERROR_CHECK_ALLOC(iter);
459
+ GITERR_CHECK_ALLOC(iter);
462
460
 
463
461
  iter->parent.free = all_iter_free;
464
462
  iter->parent.next = all_iter_next;
465
463
 
466
- iter->i = cfg->backends.length;
464
+ iter->i = cfg->files.length;
467
465
  iter->cfg = cfg;
468
466
 
469
467
  *out = (git_config_iterator *) iter;
@@ -480,16 +478,17 @@ int git_config_iterator_glob_new(git_config_iterator **out, const git_config *cf
480
478
  return git_config_iterator_new(out, cfg);
481
479
 
482
480
  iter = git__calloc(1, sizeof(all_iter));
483
- GIT_ERROR_CHECK_ALLOC(iter);
481
+ GITERR_CHECK_ALLOC(iter);
484
482
 
485
- if ((result = git_regexp_compile(&iter->regex, regexp, 0)) < 0) {
483
+ if ((result = p_regcomp(&iter->regex, regexp, REG_EXTENDED)) != 0) {
484
+ giterr_set_regex(&iter->regex, result);
486
485
  git__free(iter);
487
486
  return -1;
488
487
  }
489
488
 
490
489
  iter->parent.next = all_iter_glob_next;
491
490
  iter->parent.free = all_iter_glob_free;
492
- iter->i = cfg->backends.length;
491
+ iter->i = cfg->files.length;
493
492
  iter->cfg = cfg;
494
493
 
495
494
  *out = (git_config_iterator *) iter;
@@ -511,13 +510,18 @@ int git_config_backend_foreach_match(
511
510
  {
512
511
  git_config_entry *entry;
513
512
  git_config_iterator* iter;
514
- git_regexp regex;
513
+ regex_t regex;
515
514
  int error = 0;
516
515
 
517
516
  assert(backend && cb);
518
517
 
519
- if (regexp && git_regexp_compile(&regex, regexp, 0) < 0)
520
- return -1;
518
+ if (regexp != NULL) {
519
+ if ((error = p_regcomp(&regex, regexp, REG_EXTENDED)) != 0) {
520
+ giterr_set_regex(&regex, error);
521
+ regfree(&regex);
522
+ return -1;
523
+ }
524
+ }
521
525
 
522
526
  if ((error = backend->iterator(&iter, backend)) < 0) {
523
527
  iter = NULL;
@@ -526,18 +530,18 @@ int git_config_backend_foreach_match(
526
530
 
527
531
  while (!(iter->next(&entry, iter) < 0)) {
528
532
  /* skip non-matching keys if regexp was provided */
529
- if (regexp && git_regexp_match(&regex, entry->name) != 0)
533
+ if (regexp && regexec(&regex, entry->name, 0, NULL, 0) != 0)
530
534
  continue;
531
535
 
532
536
  /* abort iterator on non-zero return value */
533
537
  if ((error = cb(entry, payload)) != 0) {
534
- git_error_set_after_callback(error);
538
+ giterr_set_after_callback(error);
535
539
  break;
536
540
  }
537
541
  }
538
542
 
539
543
  if (regexp != NULL)
540
- git_regexp_dispose(&regex);
544
+ regfree(&regex);
541
545
 
542
546
  iter->free(iter);
543
547
 
@@ -559,7 +563,7 @@ int git_config_foreach_match(
559
563
 
560
564
  while (!(error = git_config_next(&entry, iter))) {
561
565
  if ((error = cb(entry, payload)) != 0) {
562
- git_error_set_after_callback(error);
566
+ giterr_set_after_callback(error);
563
567
  break;
564
568
  }
565
569
  }
@@ -590,38 +594,38 @@ static int get_backend_for_use(git_config_backend **out,
590
594
  git_config *cfg, const char *name, backend_use use)
591
595
  {
592
596
  size_t i;
593
- backend_internal *backend;
597
+ file_internal *f;
594
598
 
595
599
  *out = NULL;
596
600
 
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",
601
+ if (git_vector_length(&cfg->files) == 0) {
602
+ giterr_set(GITERR_CONFIG,
603
+ "cannot %s value for '%s' when no config files exist",
600
604
  uses[use], name);
601
605
  return GIT_ENOTFOUND;
602
606
  }
603
607
 
604
- git_vector_foreach(&cfg->backends, i, backend) {
605
- if (!backend->backend->readonly) {
606
- *out = backend->backend;
608
+ git_vector_foreach(&cfg->files, i, f) {
609
+ if (!f->file->readonly) {
610
+ *out = f->file;
607
611
  return 0;
608
612
  }
609
613
  }
610
614
 
611
- git_error_set(GIT_ERROR_CONFIG,
612
- "cannot %s value for '%s' when all config backends are readonly",
615
+ giterr_set(GITERR_CONFIG,
616
+ "cannot %s value for '%s' when all config files are readonly",
613
617
  uses[use], name);
614
618
  return GIT_ENOTFOUND;
615
619
  }
616
620
 
617
621
  int git_config_delete_entry(git_config *cfg, const char *name)
618
622
  {
619
- git_config_backend *backend;
623
+ git_config_backend *file;
620
624
 
621
- if (get_backend_for_use(&backend, cfg, name, BACKEND_USE_DELETE) < 0)
625
+ if (get_backend_for_use(&file, cfg, name, BACKEND_USE_DELETE) < 0)
622
626
  return GIT_ENOTFOUND;
623
627
 
624
- return backend->del(backend, name);
628
+ return file->del(file, name);
625
629
  }
626
630
 
627
631
  int git_config_set_int64(git_config *cfg, const char *name, int64_t value)
@@ -644,20 +648,20 @@ int git_config_set_bool(git_config *cfg, const char *name, int value)
644
648
  int git_config_set_string(git_config *cfg, const char *name, const char *value)
645
649
  {
646
650
  int error;
647
- git_config_backend *backend;
651
+ git_config_backend *file;
648
652
 
649
653
  if (!value) {
650
- git_error_set(GIT_ERROR_CONFIG, "the value to set cannot be NULL");
654
+ giterr_set(GITERR_CONFIG, "the value to set cannot be NULL");
651
655
  return -1;
652
656
  }
653
657
 
654
- if (get_backend_for_use(&backend, cfg, name, BACKEND_USE_SET) < 0)
658
+ if (get_backend_for_use(&file, cfg, name, BACKEND_USE_SET) < 0)
655
659
  return GIT_ENOTFOUND;
656
660
 
657
- error = backend->set(backend, name, value);
661
+ error = file->set(file, name, value);
658
662
 
659
663
  if (!error && GIT_REFCOUNT_OWNER(cfg) != NULL)
660
- git_repository__configmap_lookup_cache_clear(GIT_REFCOUNT_OWNER(cfg));
664
+ git_repository__cvar_cache_clear(GIT_REFCOUNT_OWNER(cfg));
661
665
 
662
666
  return error;
663
667
  }
@@ -699,7 +703,7 @@ int git_config__update_entry(
699
703
 
700
704
  static int config_error_notfound(const char *name)
701
705
  {
702
- git_error_set(GIT_ERROR_CONFIG, "config value '%s' was not found", name);
706
+ giterr_set(GITERR_CONFIG, "config value '%s' was not found", name);
703
707
  return GIT_ENOTFOUND;
704
708
  }
705
709
 
@@ -720,7 +724,7 @@ static int get_entry(
720
724
  const char *key = name;
721
725
  char *normalized = NULL;
722
726
  size_t i;
723
- backend_internal *internal;
727
+ file_internal *internal;
724
728
 
725
729
  *out = NULL;
726
730
 
@@ -731,11 +735,11 @@ static int get_entry(
731
735
  }
732
736
 
733
737
  res = GIT_ENOTFOUND;
734
- git_vector_foreach(&cfg->backends, i, internal) {
735
- if (!internal || !internal->backend)
738
+ git_vector_foreach(&cfg->files, i, internal) {
739
+ if (!internal || !internal->file)
736
740
  continue;
737
741
 
738
- res = internal->backend->get(internal->backend, key, out);
742
+ res = internal->file->get(internal->file, key, out);
739
743
  if (res != GIT_ENOTFOUND)
740
744
  break;
741
745
  }
@@ -746,7 +750,7 @@ cleanup:
746
750
  if (res == GIT_ENOTFOUND)
747
751
  res = (want_errors > GET_ALL_ERRORS) ? 0 : config_error_notfound(name);
748
752
  else if (res && (want_errors == GET_NO_ERRORS)) {
749
- git_error_clear();
753
+ giterr_clear();
750
754
  res = 0;
751
755
  }
752
756
 
@@ -773,7 +777,7 @@ int git_config_get_mapped(
773
777
  int *out,
774
778
  const git_config *cfg,
775
779
  const char *name,
776
- const git_configmap *maps,
780
+ const git_cvar_map *maps,
777
781
  size_t map_n)
778
782
  {
779
783
  git_config_entry *entry;
@@ -833,13 +837,13 @@ int git_config_get_bool(int *out, const git_config *cfg, const char *name)
833
837
  static int is_readonly(const git_config *cfg)
834
838
  {
835
839
  size_t i;
836
- backend_internal *internal;
840
+ file_internal *internal;
837
841
 
838
- git_vector_foreach(&cfg->backends, i, internal) {
839
- if (!internal || !internal->backend)
842
+ git_vector_foreach(&cfg->files, i, internal) {
843
+ if (!internal || !internal->file)
840
844
  continue;
841
845
 
842
- if (!internal->backend->readonly)
846
+ if (!internal->file->readonly)
843
847
  return 0;
844
848
  }
845
849
 
@@ -867,7 +871,7 @@ int git_config_get_string(
867
871
  int ret;
868
872
 
869
873
  if (!is_readonly(cfg)) {
870
- git_error_set(GIT_ERROR_CONFIG, "get_string called on a live config object");
874
+ giterr_set(GITERR_CONFIG, "get_string called on a live config object");
871
875
  return -1;
872
876
  }
873
877
 
@@ -921,7 +925,7 @@ int git_config__get_bool_force(
921
925
  get_entry(&entry, cfg, key, false, GET_NO_ERRORS);
922
926
 
923
927
  if (entry && git_config_parse_bool(&val, entry->value) < 0)
924
- git_error_clear();
928
+ giterr_clear();
925
929
 
926
930
  git_config_entry_free(entry);
927
931
  return val;
@@ -936,7 +940,7 @@ int git_config__get_int_force(
936
940
  get_entry(&entry, cfg, key, false, GET_NO_ERRORS);
937
941
 
938
942
  if (entry && git_config_parse_int32(&val, entry->value) < 0)
939
- git_error_clear();
943
+ giterr_clear();
940
944
 
941
945
  git_config_entry_free(entry);
942
946
  return (int)val;
@@ -958,7 +962,7 @@ int git_config_get_multivar_foreach(
958
962
  found = 1;
959
963
 
960
964
  if ((err = cb(entry, payload)) != 0) {
961
- git_error_set_after_callback(err);
965
+ giterr_set_after_callback(err);
962
966
  break;
963
967
  }
964
968
  }
@@ -977,7 +981,7 @@ typedef struct {
977
981
  git_config_iterator parent;
978
982
  git_config_iterator *iter;
979
983
  char *name;
980
- git_regexp regex;
984
+ regex_t regex;
981
985
  int have_regex;
982
986
  } multivar_iter;
983
987
 
@@ -993,7 +997,7 @@ static int multivar_iter_next(git_config_entry **entry, git_config_iterator *_it
993
997
  if (!iter->have_regex)
994
998
  return 0;
995
999
 
996
- if (git_regexp_match(&iter->regex, (*entry)->value) == 0)
1000
+ if (regexec(&iter->regex, (*entry)->value, 0, NULL, 0) == 0)
997
1001
  return 0;
998
1002
  }
999
1003
 
@@ -1008,7 +1012,7 @@ void multivar_iter_free(git_config_iterator *_iter)
1008
1012
 
1009
1013
  git__free(iter->name);
1010
1014
  if (iter->have_regex)
1011
- git_regexp_dispose(&iter->regex);
1015
+ regfree(&iter->regex);
1012
1016
  git__free(iter);
1013
1017
  }
1014
1018
 
@@ -1022,14 +1026,19 @@ int git_config_multivar_iterator_new(git_config_iterator **out, const git_config
1022
1026
  return error;
1023
1027
 
1024
1028
  iter = git__calloc(1, sizeof(multivar_iter));
1025
- GIT_ERROR_CHECK_ALLOC(iter);
1029
+ GITERR_CHECK_ALLOC(iter);
1026
1030
 
1027
1031
  if ((error = git_config__normalize_name(name, &iter->name)) < 0)
1028
1032
  goto on_error;
1029
1033
 
1030
1034
  if (regexp != NULL) {
1031
- if ((error = git_regexp_compile(&iter->regex, regexp, 0)) < 0)
1035
+ error = p_regcomp(&iter->regex, regexp, REG_EXTENDED);
1036
+ if (error != 0) {
1037
+ giterr_set_regex(&iter->regex, error);
1038
+ error = -1;
1039
+ regfree(&iter->regex);
1032
1040
  goto on_error;
1041
+ }
1033
1042
 
1034
1043
  iter->have_regex = 1;
1035
1044
  }
@@ -1051,22 +1060,22 @@ on_error:
1051
1060
 
1052
1061
  int git_config_set_multivar(git_config *cfg, const char *name, const char *regexp, const char *value)
1053
1062
  {
1054
- git_config_backend *backend;
1063
+ git_config_backend *file;
1055
1064
 
1056
- if (get_backend_for_use(&backend, cfg, name, BACKEND_USE_DELETE) < 0)
1065
+ if (get_backend_for_use(&file, cfg, name, BACKEND_USE_DELETE) < 0)
1057
1066
  return GIT_ENOTFOUND;
1058
1067
 
1059
- return backend->set_multivar(backend, name, regexp, value);
1068
+ return file->set_multivar(file, name, regexp, value);
1060
1069
  }
1061
1070
 
1062
1071
  int git_config_delete_multivar(git_config *cfg, const char *name, const char *regexp)
1063
1072
  {
1064
- git_config_backend *backend;
1073
+ git_config_backend *file;
1065
1074
 
1066
- if (get_backend_for_use(&backend, cfg, name, BACKEND_USE_DELETE) < 0)
1075
+ if (get_backend_for_use(&file, cfg, name, BACKEND_USE_DELETE) < 0)
1067
1076
  return GIT_ENOTFOUND;
1068
1077
 
1069
- return backend->del_multivar(backend, name, regexp);
1078
+ return file->del_multivar(file, name, regexp);
1070
1079
  }
1071
1080
 
1072
1081
  int git_config_next(git_config_entry **entry, git_config_iterator *iter)
@@ -1164,7 +1173,7 @@ int git_config_open_default(git_config **out)
1164
1173
  error = git_config_add_file_ondisk(cfg, buf.ptr,
1165
1174
  GIT_CONFIG_LEVEL_PROGRAMDATA, NULL, 0);
1166
1175
 
1167
- git_buf_dispose(&buf);
1176
+ git_buf_free(&buf);
1168
1177
 
1169
1178
  if (error) {
1170
1179
  git_config_free(cfg);
@@ -1179,19 +1188,17 @@ int git_config_open_default(git_config **out)
1179
1188
  int git_config_lock(git_transaction **out, git_config *cfg)
1180
1189
  {
1181
1190
  int error;
1182
- git_config_backend *backend;
1183
- backend_internal *internal;
1191
+ git_config_backend *file;
1192
+ file_internal *internal;
1184
1193
 
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");
1194
+ internal = git_vector_get(&cfg->files, 0);
1195
+ if (!internal || !internal->file) {
1196
+ giterr_set(GITERR_CONFIG, "cannot lock; the config has no backends/files");
1190
1197
  return -1;
1191
1198
  }
1192
- backend = internal->backend;
1199
+ file = internal->file;
1193
1200
 
1194
- if ((error = backend->lock(backend)) < 0)
1201
+ if ((error = file->lock(file)) < 0)
1195
1202
  return error;
1196
1203
 
1197
1204
  return git_transaction_config_new(out, cfg);
@@ -1199,20 +1206,18 @@ int git_config_lock(git_transaction **out, git_config *cfg)
1199
1206
 
1200
1207
  int git_config_unlock(git_config *cfg, int commit)
1201
1208
  {
1202
- git_config_backend *backend;
1203
- backend_internal *internal;
1209
+ git_config_backend *file;
1210
+ file_internal *internal;
1204
1211
 
1205
- assert(cfg);
1206
-
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");
1212
+ internal = git_vector_get(&cfg->files, 0);
1213
+ if (!internal || !internal->file) {
1214
+ giterr_set(GITERR_CONFIG, "cannot lock; the config has no backends/files");
1210
1215
  return -1;
1211
1216
  }
1212
1217
 
1213
- backend = internal->backend;
1218
+ file = internal->file;
1214
1219
 
1215
- return backend->unlock(backend, commit);
1220
+ return file->unlock(file, commit);
1216
1221
  }
1217
1222
 
1218
1223
  /***********
@@ -1221,7 +1226,7 @@ int git_config_unlock(git_config *cfg, int commit)
1221
1226
 
1222
1227
  int git_config_lookup_map_value(
1223
1228
  int *out,
1224
- const git_configmap *maps,
1229
+ const git_cvar_map *maps,
1225
1230
  size_t map_n,
1226
1231
  const char *value)
1227
1232
  {
@@ -1231,27 +1236,27 @@ int git_config_lookup_map_value(
1231
1236
  goto fail_parse;
1232
1237
 
1233
1238
  for (i = 0; i < map_n; ++i) {
1234
- const git_configmap *m = maps + i;
1239
+ const git_cvar_map *m = maps + i;
1235
1240
 
1236
- switch (m->type) {
1237
- case GIT_CONFIGMAP_FALSE:
1238
- case GIT_CONFIGMAP_TRUE: {
1241
+ switch (m->cvar_type) {
1242
+ case GIT_CVAR_FALSE:
1243
+ case GIT_CVAR_TRUE: {
1239
1244
  int bool_val;
1240
1245
 
1241
1246
  if (git__parse_bool(&bool_val, value) == 0 &&
1242
- bool_val == (int)m->type) {
1247
+ bool_val == (int)m->cvar_type) {
1243
1248
  *out = m->map_value;
1244
1249
  return 0;
1245
1250
  }
1246
1251
  break;
1247
1252
  }
1248
1253
 
1249
- case GIT_CONFIGMAP_INT32:
1254
+ case GIT_CVAR_INT32:
1250
1255
  if (git_config_parse_int32(out, value) == 0)
1251
1256
  return 0;
1252
1257
  break;
1253
1258
 
1254
- case GIT_CONFIGMAP_STRING:
1259
+ case GIT_CVAR_STRING:
1255
1260
  if (strcasecmp(value, m->str_match) == 0) {
1256
1261
  *out = m->map_value;
1257
1262
  return 0;
@@ -1261,27 +1266,27 @@ int git_config_lookup_map_value(
1261
1266
  }
1262
1267
 
1263
1268
  fail_parse:
1264
- git_error_set(GIT_ERROR_CONFIG, "failed to map '%s'", value);
1269
+ giterr_set(GITERR_CONFIG, "failed to map '%s'", value);
1265
1270
  return -1;
1266
1271
  }
1267
1272
 
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)
1273
+ int git_config_lookup_map_enum(git_cvar_t *type_out, const char **str_out,
1274
+ const git_cvar_map *maps, size_t map_n, int enum_val)
1270
1275
  {
1271
1276
  size_t i;
1272
1277
 
1273
1278
  for (i = 0; i < map_n; i++) {
1274
- const git_configmap *m = &maps[i];
1279
+ const git_cvar_map *m = &maps[i];
1275
1280
 
1276
1281
  if (m->map_value != enum_val)
1277
1282
  continue;
1278
1283
 
1279
- *type_out = m->type;
1284
+ *type_out = m->cvar_type;
1280
1285
  *str_out = m->str_match;
1281
1286
  return 0;
1282
1287
  }
1283
1288
 
1284
- git_error_set(GIT_ERROR_CONFIG, "invalid enum value");
1289
+ giterr_set(GITERR_CONFIG, "invalid enum value");
1285
1290
  return GIT_ENOTFOUND;
1286
1291
  }
1287
1292
 
@@ -1295,7 +1300,7 @@ int git_config_parse_bool(int *out, const char *value)
1295
1300
  return 0;
1296
1301
  }
1297
1302
 
1298
- git_error_set(GIT_ERROR_CONFIG, "failed to parse '%s' as a boolean value", value);
1303
+ giterr_set(GITERR_CONFIG, "failed to parse '%s' as a boolean value", value);
1299
1304
  return -1;
1300
1305
  }
1301
1306
 
@@ -1338,7 +1343,7 @@ int git_config_parse_int64(int64_t *out, const char *value)
1338
1343
  }
1339
1344
 
1340
1345
  fail_parse:
1341
- git_error_set(GIT_ERROR_CONFIG, "failed to parse '%s' as an integer", value ? value : "(null)");
1346
+ giterr_set(GITERR_CONFIG, "failed to parse '%s' as an integer", value ? value : "(null)");
1342
1347
  return -1;
1343
1348
  }
1344
1349
 
@@ -1358,7 +1363,7 @@ int git_config_parse_int32(int32_t *out, const char *value)
1358
1363
  return 0;
1359
1364
 
1360
1365
  fail_parse:
1361
- git_error_set(GIT_ERROR_CONFIG, "failed to parse '%s' as a 32-bit integer", value ? value : "(null)");
1366
+ giterr_set(GITERR_CONFIG, "failed to parse '%s' as a 32-bit integer", value ? value : "(null)");
1362
1367
  return -1;
1363
1368
  }
1364
1369
 
@@ -1370,7 +1375,7 @@ int git_config_parse_path(git_buf *out, const char *value)
1370
1375
 
1371
1376
  if (value[0] == '~') {
1372
1377
  if (value[1] != '\0' && value[1] != '/') {
1373
- git_error_set(GIT_ERROR_CONFIG, "retrieving a homedir by name is not supported");
1378
+ giterr_set(GITERR_CONFIG, "retrieving a homedir by name is not supported");
1374
1379
  return -1;
1375
1380
  }
1376
1381
 
@@ -1380,30 +1385,6 @@ int git_config_parse_path(git_buf *out, const char *value)
1380
1385
  return git_buf_sets(out, value);
1381
1386
  }
1382
1387
 
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
-
1407
1388
  /* Take something the user gave us and make it nice for our hash function */
1408
1389
  int git_config__normalize_name(const char *in, char **out)
1409
1390
  {
@@ -1412,7 +1393,7 @@ int git_config__normalize_name(const char *in, char **out)
1412
1393
  assert(in && out);
1413
1394
 
1414
1395
  name = git__strdup(in);
1415
- GIT_ERROR_CHECK_ALLOC(name);
1396
+ GITERR_CHECK_ALLOC(name);
1416
1397
 
1417
1398
  fdot = strchr(name, '.');
1418
1399
  ldot = strrchr(name, '.');
@@ -1421,8 +1402,8 @@ int git_config__normalize_name(const char *in, char **out)
1421
1402
  goto invalid;
1422
1403
 
1423
1404
  /* Validate and downcase up to first dot and after last dot */
1424
- if (normalize_section(name, fdot) < 0 ||
1425
- normalize_section(ldot + 1, NULL) < 0)
1405
+ if (git_config_file_normalize_section(name, fdot) < 0 ||
1406
+ git_config_file_normalize_section(ldot + 1, NULL) < 0)
1426
1407
  goto invalid;
1427
1408
 
1428
1409
  /* If there is a middle range, make sure it doesn't have newlines */
@@ -1435,7 +1416,7 @@ int git_config__normalize_name(const char *in, char **out)
1435
1416
 
1436
1417
  invalid:
1437
1418
  git__free(name);
1438
- git_error_set(GIT_ERROR_CONFIG, "invalid config item name '%s'", in);
1419
+ giterr_set(GITERR_CONFIG, "invalid config item name '%s'", in);
1439
1420
  return GIT_EINVALIDSPEC;
1440
1421
  }
1441
1422
 
@@ -1494,10 +1475,11 @@ int git_config_rename_section(
1494
1475
  goto cleanup;
1495
1476
 
1496
1477
  if (new_section_name != NULL &&
1497
- (error = normalize_section(replace.ptr, strchr(replace.ptr, '.'))) < 0)
1478
+ (error = git_config_file_normalize_section(
1479
+ replace.ptr, strchr(replace.ptr, '.'))) < 0)
1498
1480
  {
1499
- git_error_set(
1500
- GIT_ERROR_CONFIG, "invalid config section '%s'", new_section_name);
1481
+ giterr_set(
1482
+ GITERR_CONFIG, "invalid config section '%s'", new_section_name);
1501
1483
  goto cleanup;
1502
1484
  }
1503
1485
 
@@ -1505,8 +1487,8 @@ int git_config_rename_section(
1505
1487
  config, git_buf_cstr(&pattern), rename_config_entries_cb, &data);
1506
1488
 
1507
1489
  cleanup:
1508
- git_buf_dispose(&pattern);
1509
- git_buf_dispose(&replace);
1490
+ git_buf_free(&pattern);
1491
+ git_buf_free(&replace);
1510
1492
 
1511
1493
  return error;
1512
1494
  }