rugged 0.27.9 → 0.27.10

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 +1 -0
  4. data/vendor/libgit2/CMakeLists.txt +98 -54
  5. data/vendor/libgit2/COPYING +28 -0
  6. data/vendor/libgit2/cmake/Modules/AddCFlagIfSupported.cmake +15 -1
  7. data/vendor/libgit2/cmake/Modules/EnableWarnings.cmake +9 -8
  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/FindGSSFramework.cmake +28 -0
  11. data/vendor/libgit2/cmake/Modules/FindPCRE.cmake +38 -0
  12. data/vendor/libgit2/cmake/Modules/FindPCRE2.cmake +37 -0
  13. data/vendor/libgit2/cmake/Modules/FindSecurity.cmake +2 -2
  14. data/vendor/libgit2/cmake/Modules/FindStatNsec.cmake +6 -0
  15. data/vendor/libgit2/cmake/Modules/FindmbedTLS.cmake +93 -0
  16. data/vendor/libgit2/cmake/Modules/PkgBuildConfig.cmake +110 -0
  17. data/vendor/libgit2/cmake/Modules/SelectGSSAPI.cmake +53 -0
  18. data/vendor/libgit2/cmake/Modules/SelectHTTPSBackend.cmake +124 -0
  19. data/vendor/libgit2/cmake/Modules/SelectHashes.cmake +66 -0
  20. data/vendor/libgit2/deps/http-parser/CMakeLists.txt +2 -0
  21. data/vendor/libgit2/deps/http-parser/{LICENSE-MIT → COPYING} +0 -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.h +5 -0
  82. data/vendor/libgit2/include/git2/annotated_commit.h +9 -0
  83. data/vendor/libgit2/include/git2/apply.h +149 -0
  84. data/vendor/libgit2/include/git2/attr.h +38 -20
  85. data/vendor/libgit2/include/git2/blame.h +42 -25
  86. data/vendor/libgit2/include/git2/blob.h +45 -13
  87. data/vendor/libgit2/include/git2/branch.h +1 -1
  88. data/vendor/libgit2/include/git2/buffer.h +22 -16
  89. data/vendor/libgit2/include/git2/cert.h +135 -0
  90. data/vendor/libgit2/include/git2/checkout.h +65 -32
  91. data/vendor/libgit2/include/git2/cherrypick.h +9 -7
  92. data/vendor/libgit2/include/git2/clone.h +12 -10
  93. data/vendor/libgit2/include/git2/commit.h +53 -3
  94. data/vendor/libgit2/include/git2/common.h +60 -8
  95. data/vendor/libgit2/include/git2/config.h +30 -19
  96. data/vendor/libgit2/include/git2/cred.h +308 -0
  97. data/vendor/libgit2/include/git2/deprecated.h +493 -0
  98. data/vendor/libgit2/include/git2/describe.h +32 -9
  99. data/vendor/libgit2/include/git2/diff.h +208 -156
  100. data/vendor/libgit2/include/git2/errors.h +54 -46
  101. data/vendor/libgit2/include/git2/filter.h +8 -0
  102. data/vendor/libgit2/include/git2/ignore.h +2 -2
  103. data/vendor/libgit2/include/git2/index.h +74 -52
  104. data/vendor/libgit2/include/git2/indexer.h +76 -6
  105. data/vendor/libgit2/include/git2/mailmap.h +115 -0
  106. data/vendor/libgit2/include/git2/merge.h +35 -18
  107. data/vendor/libgit2/include/git2/net.h +0 -5
  108. data/vendor/libgit2/include/git2/notes.h +1 -1
  109. data/vendor/libgit2/include/git2/object.h +17 -29
  110. data/vendor/libgit2/include/git2/odb.h +12 -11
  111. data/vendor/libgit2/include/git2/odb_backend.h +10 -9
  112. data/vendor/libgit2/include/git2/oid.h +2 -2
  113. data/vendor/libgit2/include/git2/pack.h +14 -3
  114. data/vendor/libgit2/include/git2/proxy.h +14 -8
  115. data/vendor/libgit2/include/git2/rebase.h +53 -6
  116. data/vendor/libgit2/include/git2/refs.h +33 -15
  117. data/vendor/libgit2/include/git2/refspec.h +17 -0
  118. data/vendor/libgit2/include/git2/remote.h +123 -24
  119. data/vendor/libgit2/include/git2/repository.h +76 -39
  120. data/vendor/libgit2/include/git2/revert.h +6 -4
  121. data/vendor/libgit2/include/git2/revwalk.h +7 -7
  122. data/vendor/libgit2/include/git2/signature.h +2 -2
  123. data/vendor/libgit2/include/git2/stash.h +15 -12
  124. data/vendor/libgit2/include/git2/status.h +33 -20
  125. data/vendor/libgit2/include/git2/submodule.h +30 -12
  126. data/vendor/libgit2/include/git2/sys/alloc.h +101 -0
  127. data/vendor/libgit2/include/git2/sys/commit.h +1 -1
  128. data/vendor/libgit2/include/git2/sys/config.h +13 -13
  129. data/vendor/libgit2/include/git2/sys/cred.h +90 -0
  130. data/vendor/libgit2/include/git2/sys/filter.h +6 -6
  131. data/vendor/libgit2/include/git2/sys/index.h +3 -0
  132. data/vendor/libgit2/include/git2/sys/mempack.h +35 -35
  133. data/vendor/libgit2/include/git2/sys/merge.h +9 -4
  134. data/vendor/libgit2/include/git2/sys/odb_backend.h +66 -22
  135. data/vendor/libgit2/include/git2/sys/path.h +64 -0
  136. data/vendor/libgit2/include/git2/sys/refdb_backend.h +76 -40
  137. data/vendor/libgit2/include/git2/sys/repository.h +5 -1
  138. data/vendor/libgit2/include/git2/sys/stream.h +92 -12
  139. data/vendor/libgit2/include/git2/sys/transport.h +129 -83
  140. data/vendor/libgit2/include/git2/tag.h +13 -4
  141. data/vendor/libgit2/include/git2/trace.h +2 -2
  142. data/vendor/libgit2/include/git2/transaction.h +1 -0
  143. data/vendor/libgit2/include/git2/transport.h +11 -311
  144. data/vendor/libgit2/include/git2/tree.h +4 -4
  145. data/vendor/libgit2/include/git2/types.h +33 -111
  146. data/vendor/libgit2/include/git2/version.h +4 -4
  147. data/vendor/libgit2/include/git2/worktree.h +48 -13
  148. data/vendor/libgit2/src/CMakeLists.txt +96 -164
  149. data/vendor/libgit2/src/alloc.c +43 -0
  150. data/vendor/libgit2/src/alloc.h +40 -0
  151. data/vendor/libgit2/src/allocators/stdalloc.c +119 -0
  152. data/vendor/libgit2/src/{streams/curl.h → allocators/stdalloc.h} +5 -5
  153. data/vendor/libgit2/src/allocators/win32_crtdbg.c +118 -0
  154. data/vendor/libgit2/src/{transports/cred.h → allocators/win32_crtdbg.h} +5 -4
  155. data/vendor/libgit2/src/annotated_commit.c +15 -8
  156. data/vendor/libgit2/src/apply.c +537 -31
  157. data/vendor/libgit2/src/apply.h +3 -1
  158. data/vendor/libgit2/src/array.h +2 -2
  159. data/vendor/libgit2/src/attr.c +81 -75
  160. data/vendor/libgit2/src/attr_file.c +207 -121
  161. data/vendor/libgit2/src/attr_file.h +9 -9
  162. data/vendor/libgit2/src/attrcache.c +51 -53
  163. data/vendor/libgit2/src/attrcache.h +2 -1
  164. data/vendor/libgit2/src/blame.c +47 -20
  165. data/vendor/libgit2/src/blame.h +2 -1
  166. data/vendor/libgit2/src/blame_git.c +37 -20
  167. data/vendor/libgit2/src/blob.c +128 -42
  168. data/vendor/libgit2/src/blob.h +19 -2
  169. data/vendor/libgit2/src/branch.c +67 -43
  170. data/vendor/libgit2/src/buf_text.c +7 -6
  171. data/vendor/libgit2/src/buffer.c +69 -57
  172. data/vendor/libgit2/src/buffer.h +1 -1
  173. data/vendor/libgit2/src/cache.c +38 -45
  174. data/vendor/libgit2/src/cache.h +3 -3
  175. data/vendor/libgit2/src/cc-compat.h +20 -3
  176. data/vendor/libgit2/src/checkout.c +109 -90
  177. data/vendor/libgit2/src/cherrypick.c +15 -9
  178. data/vendor/libgit2/src/clone.c +49 -27
  179. data/vendor/libgit2/src/clone.h +4 -0
  180. data/vendor/libgit2/src/commit.c +117 -49
  181. data/vendor/libgit2/src/commit.h +7 -0
  182. data/vendor/libgit2/src/commit_list.c +30 -78
  183. data/vendor/libgit2/src/commit_list.h +2 -2
  184. data/vendor/libgit2/src/common.h +27 -91
  185. data/vendor/libgit2/src/config.c +194 -176
  186. data/vendor/libgit2/src/config.h +8 -20
  187. data/vendor/libgit2/src/config_backend.h +96 -0
  188. data/vendor/libgit2/src/config_cache.c +41 -35
  189. data/vendor/libgit2/src/config_entries.c +229 -0
  190. data/vendor/libgit2/src/config_entries.h +24 -0
  191. data/vendor/libgit2/src/config_file.c +439 -753
  192. data/vendor/libgit2/src/config_mem.c +220 -0
  193. data/vendor/libgit2/src/config_parse.c +114 -63
  194. data/vendor/libgit2/src/config_parse.h +17 -16
  195. data/vendor/libgit2/src/config_snapshot.c +206 -0
  196. data/vendor/libgit2/src/crlf.c +219 -190
  197. data/vendor/libgit2/src/delta.c +25 -18
  198. data/vendor/libgit2/src/describe.c +42 -41
  199. data/vendor/libgit2/src/diff.c +53 -68
  200. data/vendor/libgit2/src/diff.h +2 -1
  201. data/vendor/libgit2/src/diff_driver.c +47 -49
  202. data/vendor/libgit2/src/diff_file.c +19 -17
  203. data/vendor/libgit2/src/diff_file.h +1 -1
  204. data/vendor/libgit2/src/diff_generate.c +162 -106
  205. data/vendor/libgit2/src/diff_generate.h +3 -3
  206. data/vendor/libgit2/src/diff_parse.c +4 -4
  207. data/vendor/libgit2/src/diff_print.c +42 -30
  208. data/vendor/libgit2/src/diff_stats.c +22 -7
  209. data/vendor/libgit2/src/diff_tform.c +16 -16
  210. data/vendor/libgit2/src/diff_xdiff.c +15 -3
  211. data/vendor/libgit2/src/errors.c +51 -39
  212. data/vendor/libgit2/src/errors.h +81 -0
  213. data/vendor/libgit2/src/features.h.in +11 -3
  214. data/vendor/libgit2/src/fetch.c +10 -5
  215. data/vendor/libgit2/src/fetchhead.c +17 -17
  216. data/vendor/libgit2/src/filebuf.c +32 -36
  217. data/vendor/libgit2/src/filebuf.h +2 -2
  218. data/vendor/libgit2/src/filter.c +46 -38
  219. data/vendor/libgit2/src/filter.h +0 -10
  220. data/vendor/libgit2/src/{fileops.c → futils.c} +80 -73
  221. data/vendor/libgit2/src/{fileops.h → futils.h} +6 -6
  222. data/vendor/libgit2/src/global.c +48 -63
  223. data/vendor/libgit2/src/global.h +0 -2
  224. data/vendor/libgit2/src/hash.c +61 -0
  225. data/vendor/libgit2/src/hash.h +20 -19
  226. data/vendor/libgit2/src/hash/sha1.h +38 -0
  227. data/vendor/libgit2/src/hash/sha1/collisiondetect.c +48 -0
  228. data/vendor/libgit2/src/hash/sha1/collisiondetect.h +19 -0
  229. data/vendor/libgit2/src/hash/{hash_common_crypto.h → sha1/common_crypto.c} +17 -17
  230. data/vendor/libgit2/src/hash/sha1/common_crypto.h +19 -0
  231. data/vendor/libgit2/src/hash/{hash_generic.c → sha1/generic.c} +22 -10
  232. data/vendor/libgit2/src/hash/{hash_generic.h → sha1/generic.h} +4 -10
  233. data/vendor/libgit2/src/hash/sha1/mbedtls.c +46 -0
  234. data/vendor/libgit2/src/hash/sha1/mbedtls.h +19 -0
  235. data/vendor/libgit2/src/hash/sha1/openssl.c +59 -0
  236. data/vendor/libgit2/src/hash/sha1/openssl.h +19 -0
  237. data/vendor/libgit2/src/hash/{sha1dc → sha1/sha1dc}/sha1.c +14 -3
  238. data/vendor/libgit2/src/hash/{sha1dc → sha1/sha1dc}/sha1.h +0 -0
  239. data/vendor/libgit2/src/hash/{sha1dc → sha1/sha1dc}/ubc_check.c +0 -0
  240. data/vendor/libgit2/src/hash/{sha1dc → sha1/sha1dc}/ubc_check.h +0 -0
  241. data/vendor/libgit2/src/hash/{hash_win32.c → sha1/win32.c} +47 -37
  242. data/vendor/libgit2/src/hash/{hash_win32.h → sha1/win32.h} +6 -19
  243. data/vendor/libgit2/src/hashsig.c +5 -5
  244. data/vendor/libgit2/src/idxmap.c +107 -61
  245. data/vendor/libgit2/src/idxmap.h +153 -31
  246. data/vendor/libgit2/src/ignore.c +43 -47
  247. data/vendor/libgit2/src/index.c +337 -232
  248. data/vendor/libgit2/src/index.h +17 -1
  249. data/vendor/libgit2/src/indexer.c +346 -175
  250. data/vendor/libgit2/src/integer.h +71 -26
  251. data/vendor/libgit2/src/iterator.c +142 -70
  252. data/vendor/libgit2/src/iterator.h +15 -0
  253. data/vendor/libgit2/src/khash.h +3 -1
  254. data/vendor/libgit2/src/mailmap.c +485 -0
  255. data/vendor/libgit2/src/mailmap.h +35 -0
  256. data/vendor/libgit2/src/map.h +1 -1
  257. data/vendor/libgit2/src/merge.c +144 -100
  258. data/vendor/libgit2/src/merge_driver.c +11 -11
  259. data/vendor/libgit2/src/merge_file.c +2 -2
  260. data/vendor/libgit2/src/mwindow.c +24 -29
  261. data/vendor/libgit2/src/mwindow.h +4 -4
  262. data/vendor/libgit2/src/net.c +184 -0
  263. data/vendor/libgit2/src/net.h +36 -0
  264. data/vendor/libgit2/src/netops.c +55 -156
  265. data/vendor/libgit2/src/netops.h +3 -23
  266. data/vendor/libgit2/src/notes.c +16 -11
  267. data/vendor/libgit2/src/object.c +120 -69
  268. data/vendor/libgit2/src/object.h +22 -9
  269. data/vendor/libgit2/src/object_api.c +8 -8
  270. data/vendor/libgit2/src/odb.c +116 -93
  271. data/vendor/libgit2/src/odb.h +8 -7
  272. data/vendor/libgit2/src/odb_loose.c +62 -55
  273. data/vendor/libgit2/src/odb_mempack.c +21 -34
  274. data/vendor/libgit2/src/odb_pack.c +18 -14
  275. data/vendor/libgit2/src/offmap.c +53 -35
  276. data/vendor/libgit2/src/offmap.h +108 -21
  277. data/vendor/libgit2/src/oid.c +12 -7
  278. data/vendor/libgit2/src/oidmap.c +49 -47
  279. data/vendor/libgit2/src/oidmap.h +101 -24
  280. data/vendor/libgit2/src/pack-objects.c +88 -87
  281. data/vendor/libgit2/src/pack-objects.h +2 -8
  282. data/vendor/libgit2/src/pack.c +99 -101
  283. data/vendor/libgit2/src/pack.h +17 -19
  284. data/vendor/libgit2/src/parse.c +10 -0
  285. data/vendor/libgit2/src/parse.h +3 -3
  286. data/vendor/libgit2/src/patch.c +4 -4
  287. data/vendor/libgit2/src/patch_generate.c +20 -20
  288. data/vendor/libgit2/src/patch_parse.c +151 -63
  289. data/vendor/libgit2/src/path.c +169 -125
  290. data/vendor/libgit2/src/path.h +3 -71
  291. data/vendor/libgit2/src/pathspec.c +19 -19
  292. data/vendor/libgit2/src/pool.c +26 -22
  293. data/vendor/libgit2/src/pool.h +7 -7
  294. data/vendor/libgit2/src/posix.c +10 -10
  295. data/vendor/libgit2/src/posix.h +12 -1
  296. data/vendor/libgit2/src/proxy.c +8 -3
  297. data/vendor/libgit2/src/push.c +37 -31
  298. data/vendor/libgit2/src/push.h +2 -1
  299. data/vendor/libgit2/src/reader.c +265 -0
  300. data/vendor/libgit2/src/reader.h +107 -0
  301. data/vendor/libgit2/src/rebase.c +115 -59
  302. data/vendor/libgit2/src/refdb.c +15 -3
  303. data/vendor/libgit2/src/refdb_fs.c +381 -254
  304. data/vendor/libgit2/src/reflog.c +13 -15
  305. data/vendor/libgit2/src/refs.c +118 -88
  306. data/vendor/libgit2/src/refs.h +5 -3
  307. data/vendor/libgit2/src/refspec.c +56 -37
  308. data/vendor/libgit2/src/refspec.h +1 -1
  309. data/vendor/libgit2/src/regexp.c +221 -0
  310. data/vendor/libgit2/src/regexp.h +97 -0
  311. data/vendor/libgit2/src/remote.c +266 -215
  312. data/vendor/libgit2/src/remote.h +11 -2
  313. data/vendor/libgit2/src/repository.c +280 -225
  314. data/vendor/libgit2/src/repository.h +52 -40
  315. data/vendor/libgit2/src/reset.c +8 -8
  316. data/vendor/libgit2/src/revert.c +14 -9
  317. data/vendor/libgit2/src/revparse.c +47 -48
  318. data/vendor/libgit2/src/revwalk.c +120 -57
  319. data/vendor/libgit2/src/revwalk.h +22 -1
  320. data/vendor/libgit2/src/settings.c +47 -10
  321. data/vendor/libgit2/src/signature.c +11 -11
  322. data/vendor/libgit2/src/sortedcache.c +22 -36
  323. data/vendor/libgit2/src/sortedcache.h +1 -1
  324. data/vendor/libgit2/src/stash.c +125 -99
  325. data/vendor/libgit2/src/status.c +28 -22
  326. data/vendor/libgit2/src/stream.h +17 -2
  327. data/vendor/libgit2/src/streams/mbedtls.c +483 -0
  328. data/vendor/libgit2/src/streams/mbedtls.h +23 -0
  329. data/vendor/libgit2/src/streams/openssl.c +224 -114
  330. data/vendor/libgit2/src/streams/openssl.h +4 -108
  331. data/vendor/libgit2/src/streams/registry.c +118 -0
  332. data/vendor/libgit2/src/streams/registry.h +19 -0
  333. data/vendor/libgit2/src/streams/socket.c +55 -30
  334. data/vendor/libgit2/src/streams/stransport.c +57 -32
  335. data/vendor/libgit2/src/streams/stransport.h +5 -0
  336. data/vendor/libgit2/src/streams/tls.c +50 -19
  337. data/vendor/libgit2/src/streams/tls.h +12 -4
  338. data/vendor/libgit2/src/strmap.c +47 -74
  339. data/vendor/libgit2/src/strmap.h +108 -33
  340. data/vendor/libgit2/src/submodule.c +272 -216
  341. data/vendor/libgit2/src/submodule.h +1 -1
  342. data/vendor/libgit2/src/sysdir.c +29 -19
  343. data/vendor/libgit2/src/tag.c +41 -28
  344. data/vendor/libgit2/src/tag.h +2 -1
  345. data/vendor/libgit2/src/trace.c +2 -2
  346. data/vendor/libgit2/src/trace.h +3 -3
  347. data/vendor/libgit2/src/trailer.c +52 -38
  348. data/vendor/libgit2/src/transaction.c +30 -29
  349. data/vendor/libgit2/src/transport.c +5 -5
  350. data/vendor/libgit2/src/transports/auth.c +15 -11
  351. data/vendor/libgit2/src/transports/auth.h +10 -3
  352. data/vendor/libgit2/src/transports/auth_negotiate.c +33 -18
  353. data/vendor/libgit2/src/transports/auth_negotiate.h +2 -2
  354. data/vendor/libgit2/src/transports/auth_ntlm.c +223 -0
  355. data/vendor/libgit2/src/transports/auth_ntlm.h +35 -0
  356. data/vendor/libgit2/src/transports/cred.c +24 -24
  357. data/vendor/libgit2/src/transports/git.c +26 -31
  358. data/vendor/libgit2/src/transports/http.c +881 -348
  359. data/vendor/libgit2/src/transports/http.h +2 -0
  360. data/vendor/libgit2/src/transports/local.c +35 -35
  361. data/vendor/libgit2/src/transports/smart.c +70 -47
  362. data/vendor/libgit2/src/transports/smart.h +3 -4
  363. data/vendor/libgit2/src/transports/smart_pkt.c +43 -40
  364. data/vendor/libgit2/src/transports/smart_protocol.c +96 -116
  365. data/vendor/libgit2/src/transports/ssh.c +77 -66
  366. data/vendor/libgit2/src/transports/winhttp.c +318 -314
  367. data/vendor/libgit2/src/tree-cache.c +19 -12
  368. data/vendor/libgit2/src/tree.c +103 -142
  369. data/vendor/libgit2/src/tree.h +1 -12
  370. data/vendor/libgit2/src/unix/map.c +3 -3
  371. data/vendor/libgit2/src/unix/posix.h +1 -11
  372. data/vendor/libgit2/src/userdiff.h +3 -1
  373. data/vendor/libgit2/src/util.c +70 -56
  374. data/vendor/libgit2/src/util.h +28 -156
  375. data/vendor/libgit2/src/vector.c +4 -4
  376. data/vendor/libgit2/src/wildmatch.c +320 -0
  377. data/vendor/libgit2/src/wildmatch.h +23 -0
  378. data/vendor/libgit2/src/win32/dir.c +3 -3
  379. data/vendor/libgit2/src/win32/findfile.c +3 -3
  380. data/vendor/libgit2/src/win32/map.c +9 -11
  381. data/vendor/libgit2/src/win32/msvc-compat.h +6 -0
  382. data/vendor/libgit2/src/win32/path_w32.c +113 -9
  383. data/vendor/libgit2/src/win32/path_w32.h +18 -29
  384. data/vendor/libgit2/src/win32/posix.h +1 -4
  385. data/vendor/libgit2/src/win32/posix_w32.c +70 -45
  386. data/vendor/libgit2/src/win32/precompiled.h +0 -2
  387. data/vendor/libgit2/src/win32/thread.c +5 -10
  388. data/vendor/libgit2/src/win32/w32_buffer.c +9 -5
  389. data/vendor/libgit2/src/win32/w32_common.h +39 -0
  390. data/vendor/libgit2/src/win32/w32_crtdbg_stacktrace.c +3 -2
  391. data/vendor/libgit2/src/win32/w32_crtdbg_stacktrace.h +26 -75
  392. data/vendor/libgit2/src/win32/w32_stack.c +6 -11
  393. data/vendor/libgit2/src/win32/w32_stack.h +3 -3
  394. data/vendor/libgit2/src/win32/w32_util.c +27 -64
  395. data/vendor/libgit2/src/win32/w32_util.h +5 -49
  396. data/vendor/libgit2/src/worktree.c +95 -60
  397. data/vendor/libgit2/src/worktree.h +2 -0
  398. data/vendor/libgit2/src/xdiff/xdiffi.c +7 -5
  399. data/vendor/libgit2/src/xdiff/xhistogram.c +1 -1
  400. data/vendor/libgit2/src/xdiff/xmerge.c +27 -15
  401. data/vendor/libgit2/src/xdiff/xpatience.c +3 -0
  402. data/vendor/libgit2/src/zstream.c +4 -4
  403. metadata +122 -33
  404. data/vendor/libgit2/deps/regex/CMakeLists.txt +0 -2
  405. data/vendor/libgit2/deps/regex/config.h +0 -7
  406. data/vendor/libgit2/deps/regex/regcomp.c +0 -3857
  407. data/vendor/libgit2/deps/regex/regex.c +0 -92
  408. data/vendor/libgit2/deps/regex/regex.h +0 -582
  409. data/vendor/libgit2/deps/regex/regex_internal.c +0 -1744
  410. data/vendor/libgit2/deps/regex/regex_internal.h +0 -819
  411. data/vendor/libgit2/deps/regex/regexec.c +0 -4369
  412. data/vendor/libgit2/include/git2/inttypes.h +0 -309
  413. data/vendor/libgit2/include/git2/sys/time.h +0 -31
  414. data/vendor/libgit2/libgit2.pc.in +0 -13
  415. data/vendor/libgit2/src/config_file.h +0 -73
  416. data/vendor/libgit2/src/fnmatch.c +0 -248
  417. data/vendor/libgit2/src/fnmatch.h +0 -48
  418. data/vendor/libgit2/src/hash/hash_collisiondetect.h +0 -47
  419. data/vendor/libgit2/src/hash/hash_openssl.h +0 -59
  420. data/vendor/libgit2/src/streams/curl.c +0 -385
@@ -17,7 +17,7 @@ static char to_hex[] = "0123456789abcdef";
17
17
 
18
18
  static int oid_error_invalid(const char *msg)
19
19
  {
20
- giterr_set(GITERR_INVALID, "unable to parse OID - %s", msg);
20
+ git_error_set(GIT_ERROR_INVALID, "unable to parse OID - %s", msg);
21
21
  return -1;
22
22
  }
23
23
 
@@ -237,7 +237,7 @@ int git_oid_streq(const git_oid *oid_a, const char *str)
237
237
  return git_oid_strcmp(oid_a, str) == 0 ? 0 : -1;
238
238
  }
239
239
 
240
- int git_oid_iszero(const git_oid *oid_a)
240
+ int git_oid_is_zero(const git_oid *oid_a)
241
241
  {
242
242
  const unsigned char *a = oid_a->id;
243
243
  unsigned int i;
@@ -247,6 +247,11 @@ int git_oid_iszero(const git_oid *oid_a)
247
247
  return 1;
248
248
  }
249
249
 
250
+ int git_oid_iszero(const git_oid *oid_a)
251
+ {
252
+ return git_oid_is_zero(oid_a);
253
+ }
254
+
250
255
  typedef short node_index;
251
256
 
252
257
  typedef union {
@@ -263,7 +268,7 @@ struct git_oid_shorten {
263
268
  static int resize_trie(git_oid_shorten *self, size_t new_size)
264
269
  {
265
270
  self->nodes = git__reallocarray(self->nodes, new_size, sizeof(trie_node));
266
- GITERR_CHECK_ALLOC(self->nodes);
271
+ GIT_ERROR_CHECK_ALLOC(self->nodes);
267
272
 
268
273
  if (new_size > self->size) {
269
274
  memset(&self->nodes[self->size], 0x0, (new_size - self->size) * sizeof(trie_node));
@@ -381,7 +386,7 @@ int git_oid_shorten_add(git_oid_shorten *os, const char *text_oid)
381
386
  node_index idx;
382
387
 
383
388
  if (os->full) {
384
- giterr_set(GITERR_INVALID, "unable to shorten OID - OID set full");
389
+ git_error_set(GIT_ERROR_INVALID, "unable to shorten OID - OID set full");
385
390
  return -1;
386
391
  }
387
392
 
@@ -396,7 +401,7 @@ int git_oid_shorten_add(git_oid_shorten *os, const char *text_oid)
396
401
  trie_node *node;
397
402
 
398
403
  if (c == -1) {
399
- giterr_set(GITERR_INVALID, "unable to shorten OID - invalid hex value");
404
+ git_error_set(GIT_ERROR_INVALID, "unable to shorten OID - invalid hex value");
400
405
  return -1;
401
406
  }
402
407
 
@@ -411,7 +416,7 @@ int git_oid_shorten_add(git_oid_shorten *os, const char *text_oid)
411
416
  node = push_leaf(os, idx, git__fromhex(tail[0]), &tail[1]);
412
417
  if (node == NULL) {
413
418
  if (os->full)
414
- giterr_set(GITERR_INVALID, "unable to shorten OID - OID set full");
419
+ git_error_set(GIT_ERROR_INVALID, "unable to shorten OID - OID set full");
415
420
  return -1;
416
421
  }
417
422
  }
@@ -419,7 +424,7 @@ int git_oid_shorten_add(git_oid_shorten *os, const char *text_oid)
419
424
  if (node->children[c] == 0) {
420
425
  if (push_leaf(os, idx, c, &text_oid[i + 1]) == NULL) {
421
426
  if (os->full)
422
- giterr_set(GITERR_INVALID, "unable to shorten OID - OID set full");
427
+ git_error_set(GIT_ERROR_INVALID, "unable to shorten OID - OID set full");
423
428
  return -1;
424
429
  }
425
430
  break;
@@ -7,6 +7,15 @@
7
7
 
8
8
  #include "oidmap.h"
9
9
 
10
+ #define kmalloc git__malloc
11
+ #define kcalloc git__calloc
12
+ #define krealloc git__realloc
13
+ #define kreallocarray git__reallocarray
14
+ #define kfree git__free
15
+ #include "khash.h"
16
+
17
+ __KHASH_TYPE(oid, const git_oid *, void *)
18
+
10
19
  GIT_INLINE(khint_t) git_oidmap_hash(const git_oid *oid)
11
20
  {
12
21
  khint_t h;
@@ -16,9 +25,12 @@ GIT_INLINE(khint_t) git_oidmap_hash(const git_oid *oid)
16
25
 
17
26
  __KHASH_IMPL(oid, static kh_inline, const git_oid *, void *, 1, git_oidmap_hash, git_oid_equal)
18
27
 
19
- git_oidmap *git_oidmap_alloc()
28
+ int git_oidmap_new(git_oidmap **out)
20
29
  {
21
- return kh_init(oid);
30
+ *out = kh_init(oid);
31
+ GIT_ERROR_CHECK_ALLOC(*out);
32
+
33
+ return 0;
22
34
  }
23
35
 
24
36
  void git_oidmap_free(git_oidmap *map)
@@ -36,70 +48,60 @@ size_t git_oidmap_size(git_oidmap *map)
36
48
  return kh_size(map);
37
49
  }
38
50
 
39
- size_t git_oidmap_lookup_index(git_oidmap *map, const git_oid *key)
51
+ void *git_oidmap_get(git_oidmap *map, const git_oid *key)
40
52
  {
41
- return kh_get(oid, map, key);
53
+ size_t idx = kh_get(oid, map, key);
54
+ if (idx == kh_end(map) || !kh_exist(map, idx))
55
+ return NULL;
56
+ return kh_val(map, idx);
42
57
  }
43
58
 
44
- int git_oidmap_valid_index(git_oidmap *map, size_t idx)
59
+ int git_oidmap_set(git_oidmap *map, const git_oid *key, void *value)
45
60
  {
46
- return idx != kh_end(map);
47
- }
61
+ size_t idx;
62
+ int rval;
48
63
 
49
- int git_oidmap_exists(git_oidmap *map, const git_oid *key)
50
- {
51
- return kh_get(oid, map, key) != kh_end(map);
52
- }
64
+ idx = kh_put(oid, map, key, &rval);
65
+ if (rval < 0)
66
+ return -1;
53
67
 
54
- int git_oidmap_has_data(git_oidmap *map, size_t idx)
55
- {
56
- return kh_exist(map, idx);
57
- }
68
+ if (rval == 0)
69
+ kh_key(map, idx) = key;
58
70
 
59
- const git_oid *git_oidmap_key(git_oidmap *map, size_t idx)
60
- {
61
- return kh_key(map, idx);
62
- }
71
+ kh_val(map, idx) = value;
63
72
 
64
- void git_oidmap_set_key_at(git_oidmap *map, size_t idx, git_oid *key)
65
- {
66
- kh_key(map, idx) = key;
73
+ return 0;
67
74
  }
68
75
 
69
- void *git_oidmap_value_at(git_oidmap *map, size_t idx)
76
+ int git_oidmap_delete(git_oidmap *map, const git_oid *key)
70
77
  {
71
- return kh_val(map, idx);
78
+ khiter_t idx = kh_get(oid, map, key);
79
+ if (idx == kh_end(map))
80
+ return GIT_ENOTFOUND;
81
+ kh_del(oid, map, idx);
82
+ return 0;
72
83
  }
73
84
 
74
- void git_oidmap_set_value_at(git_oidmap *map, size_t idx, void *value)
85
+ int git_oidmap_exists(git_oidmap *map, const git_oid *key)
75
86
  {
76
- kh_val(map, idx) = value;
87
+ return kh_get(oid, map, key) != kh_end(map);
77
88
  }
78
89
 
79
- void git_oidmap_delete_at(git_oidmap *map, size_t idx)
90
+ int git_oidmap_iterate(void **value, git_oidmap *map, size_t *iter, const git_oid **key)
80
91
  {
81
- kh_del(oid, map, idx);
82
- }
92
+ size_t i = *iter;
83
93
 
84
- int git_oidmap_put(git_oidmap *map, const git_oid *key, int *err)
85
- {
86
- return kh_put(oid, map, key, err);
87
- }
94
+ while (i < map->n_buckets && !kh_exist(map, i))
95
+ i++;
88
96
 
89
- void git_oidmap_insert(git_oidmap *map, const git_oid *key, void *value, int *rval)
90
- {
91
- khiter_t idx = kh_put(oid, map, key, rval);
97
+ if (i >= map->n_buckets)
98
+ return GIT_ITEROVER;
92
99
 
93
- if ((*rval) >= 0) {
94
- if ((*rval) == 0)
95
- kh_key(map, idx) = key;
96
- kh_val(map, idx) = value;
97
- }
98
- }
100
+ if (key)
101
+ *key = kh_key(map, i);
102
+ if (value)
103
+ *value = kh_value(map, i);
104
+ *iter = ++i;
99
105
 
100
- void git_oidmap_delete(git_oidmap *map, const git_oid *key)
101
- {
102
- khiter_t idx = git_oidmap_lookup_index(map, key);
103
- if (git_oidmap_valid_index(map, idx))
104
- git_oidmap_delete_at(map, idx);
106
+ return 0;
105
107
  }
@@ -11,41 +11,118 @@
11
11
 
12
12
  #include "git2/oid.h"
13
13
 
14
- #define kmalloc git__malloc
15
- #define kcalloc git__calloc
16
- #define krealloc git__realloc
17
- #define kreallocarray git__reallocarray
18
- #define kfree git__free
19
- #include "khash.h"
14
+ /** A map with `git_oid`s as key. */
15
+ typedef struct kh_oid_s git_oidmap;
20
16
 
21
- __KHASH_TYPE(oid, const git_oid *, void *)
22
- typedef khash_t(oid) git_oidmap;
17
+ /**
18
+ * Allocate a new OID map.
19
+ *
20
+ * @param out Pointer to the map that shall be allocated.
21
+ * @return 0 on success, an error code if allocation has failed.
22
+ */
23
+ int git_oidmap_new(git_oidmap **out);
23
24
 
24
- git_oidmap *git_oidmap_alloc(void);
25
+ /**
26
+ * Free memory associated with the map.
27
+ *
28
+ * Note that this function will _not_ free values added to this
29
+ * map.
30
+ *
31
+ * @param map Pointer to the map that is to be free'd. May be
32
+ * `NULL`.
33
+ */
25
34
  void git_oidmap_free(git_oidmap *map);
35
+
36
+ /**
37
+ * Clear all entries from the map.
38
+ *
39
+ * This function will remove all entries from the associated map.
40
+ * Memory associated with it will not be released, though.
41
+ *
42
+ * @param map Pointer to the map that shall be cleared. May be
43
+ * `NULL`.
44
+ */
26
45
  void git_oidmap_clear(git_oidmap *map);
27
46
 
47
+ /**
48
+ * Return the number of elements in the map.
49
+ *
50
+ * @parameter map map containing the elements
51
+ * @return number of elements in the map
52
+ */
28
53
  size_t git_oidmap_size(git_oidmap *map);
29
54
 
30
- size_t git_oidmap_lookup_index(git_oidmap *map, const git_oid *key);
31
- int git_oidmap_valid_index(git_oidmap *map, size_t idx);
55
+ /**
56
+ * Return value associated with the given key.
57
+ *
58
+ * @param map map to search key in
59
+ * @param key key to search for
60
+ * @return value associated with the given key or NULL if the key was not found
61
+ */
62
+ void *git_oidmap_get(git_oidmap *map, const git_oid *key);
32
63
 
33
- int git_oidmap_exists(git_oidmap *map, const git_oid *key);
34
- int git_oidmap_has_data(git_oidmap *map, size_t idx);
64
+ /**
65
+ * Set the entry for key to value.
66
+ *
67
+ * If the map has no corresponding entry for the given key, a new
68
+ * entry will be created with the given value. If an entry exists
69
+ * already, its value will be updated to match the given value.
70
+ *
71
+ * @param map map to create new entry in
72
+ * @param key key to set
73
+ * @param value value to associate the key with; may be NULL
74
+ * @return zero if the key was successfully set, a negative error
75
+ * code otherwise
76
+ */
77
+ int git_oidmap_set(git_oidmap *map, const git_oid *key, void *value);
35
78
 
36
- const git_oid *git_oidmap_key(git_oidmap *map, size_t idx);
37
- void git_oidmap_set_key_at(git_oidmap *map, size_t idx, git_oid *key);
38
- void *git_oidmap_value_at(git_oidmap *map, size_t idx);
39
- void git_oidmap_set_value_at(git_oidmap *map, size_t idx, void *value);
40
- void git_oidmap_delete_at(git_oidmap *map, size_t idx);
79
+ /**
80
+ * Delete an entry from the map.
81
+ *
82
+ * Delete the given key and its value from the map. If no such
83
+ * key exists, this will do nothing.
84
+ *
85
+ * @param map map to delete key in
86
+ * @param key key to delete
87
+ * @return `0` if the key has been deleted, GIT_ENOTFOUND if no
88
+ * such key was found, a negative code in case of an
89
+ * error
90
+ */
91
+ int git_oidmap_delete(git_oidmap *map, const git_oid *key);
41
92
 
42
- int git_oidmap_put(git_oidmap *map, const git_oid *key, int *err);
43
- void git_oidmap_insert(git_oidmap *map, const git_oid *key, void *value, int *rval);
44
- void git_oidmap_delete(git_oidmap *map, const git_oid *key);
93
+ /**
94
+ * Check whether a key exists in the given map.
95
+ *
96
+ * @param map map to query for the key
97
+ * @param key key to search for
98
+ * @return 0 if the key has not been found, 1 otherwise
99
+ */
100
+ int git_oidmap_exists(git_oidmap *map, const git_oid *key);
45
101
 
46
- #define git_oidmap_foreach_value kh_foreach_value
102
+ /**
103
+ * Iterate over entries of the map.
104
+ *
105
+ * This functions allows to iterate over all key-value entries of
106
+ * the map. The current position is stored in the `iter` variable
107
+ * and should be initialized to `0` before the first call to this
108
+ * function.
109
+ *
110
+ * @param map map to iterate over
111
+ * @param value pointer to the variable where to store the current
112
+ * value. May be NULL.
113
+ * @param iter iterator storing the current position. Initialize
114
+ * with zero previous to the first call.
115
+ * @param key pointer to the variable where to store the current
116
+ * key. May be NULL.
117
+ * @return `0` if the next entry was correctly retrieved.
118
+ * GIT_ITEROVER if no entries are left. A negative error
119
+ * code otherwise.
120
+ */
121
+ int git_oidmap_iterate(void **value, git_oidmap *map, size_t *iter, const git_oid **key);
47
122
 
48
- #define git_oidmap_begin kh_begin
49
- #define git_oidmap_end kh_end
123
+ #define git_oidmap_foreach_value(h, vvar, code) { size_t __i = 0; \
124
+ while (git_oidmap_iterate((void **) &(vvar), h, &__i, NULL) == 0) { \
125
+ code; \
126
+ } }
50
127
 
51
128
  #endif
@@ -38,7 +38,13 @@ struct tree_walk_context {
38
38
 
39
39
  struct pack_write_context {
40
40
  git_indexer *indexer;
41
- git_transfer_progress *stats;
41
+ git_indexer_progress *stats;
42
+ };
43
+
44
+ struct walk_object {
45
+ git_oid id;
46
+ unsigned int uninteresting:1,
47
+ seen:1;
42
48
  };
43
49
 
44
50
  #ifdef GIT_THREADS
@@ -99,7 +105,7 @@ static int packbuilder_config(git_packbuilder *pb)
99
105
  ret = git_config_get_int64(&val, config, KEY); \
100
106
  if (!ret) { \
101
107
  if (!git__is_sizet(val)) { \
102
- giterr_set(GITERR_CONFIG, \
108
+ git_error_set(GIT_ERROR_CONFIG, \
103
109
  "configuration value '%s' is too large", KEY); \
104
110
  ret = -1; \
105
111
  goto out; \
@@ -133,17 +139,15 @@ int git_packbuilder_new(git_packbuilder **out, git_repository *repo)
133
139
  *out = NULL;
134
140
 
135
141
  pb = git__calloc(1, sizeof(*pb));
136
- GITERR_CHECK_ALLOC(pb);
142
+ GIT_ERROR_CHECK_ALLOC(pb);
137
143
 
138
- pb->object_ix = git_oidmap_alloc();
139
- if (!pb->object_ix)
144
+ if (git_oidmap_new(&pb->object_ix) < 0)
140
145
  goto on_error;
141
146
 
142
- pb->walk_objects = git_oidmap_alloc();
143
- if (!pb->walk_objects)
147
+ if (git_oidmap_new(&pb->walk_objects) < 0)
144
148
  goto on_error;
145
149
 
146
- git_pool_init(&pb->object_pool, sizeof(git_walk_object));
150
+ git_pool_init(&pb->object_pool, sizeof(struct walk_object));
147
151
 
148
152
  pb->repo = repo;
149
153
  pb->nr_threads = 1; /* do not spawn any thread by default */
@@ -160,7 +164,7 @@ int git_packbuilder_new(git_packbuilder **out, git_repository *repo)
160
164
  git_mutex_init(&pb->progress_mutex) ||
161
165
  git_cond_init(&pb->progress_cond))
162
166
  {
163
- giterr_set(GITERR_OS, "failed to initialize packbuilder mutex");
167
+ git_error_set(GIT_ERROR_OS, "failed to initialize packbuilder mutex");
164
168
  goto on_error;
165
169
  }
166
170
 
@@ -188,25 +192,25 @@ unsigned int git_packbuilder_set_threads(git_packbuilder *pb, unsigned int n)
188
192
  return pb->nr_threads;
189
193
  }
190
194
 
191
- static void rehash(git_packbuilder *pb)
195
+ static int rehash(git_packbuilder *pb)
192
196
  {
193
197
  git_pobject *po;
194
- khiter_t pos;
195
198
  size_t i;
196
- int ret;
197
199
 
198
200
  git_oidmap_clear(pb->object_ix);
201
+
199
202
  for (i = 0, po = pb->object_list; i < pb->nr_objects; i++, po++) {
200
- pos = git_oidmap_put(pb->object_ix, &po->id, &ret);
201
- git_oidmap_set_value_at(pb->object_ix, pos, po);
203
+ if (git_oidmap_set(pb->object_ix, &po->id, po) < 0)
204
+ return -1;
202
205
  }
206
+
207
+ return 0;
203
208
  }
204
209
 
205
210
  int git_packbuilder_insert(git_packbuilder *pb, const git_oid *oid,
206
211
  const char *name)
207
212
  {
208
213
  git_pobject *po;
209
- khiter_t pos;
210
214
  size_t newsize;
211
215
  int ret;
212
216
 
@@ -218,11 +222,11 @@ int git_packbuilder_insert(git_packbuilder *pb, const git_oid *oid,
218
222
  return 0;
219
223
 
220
224
  if (pb->nr_objects >= pb->nr_alloc) {
221
- GITERR_CHECK_ALLOC_ADD(&newsize, pb->nr_alloc, 1024);
222
- GITERR_CHECK_ALLOC_MULTIPLY(&newsize, newsize, 3 / 2);
225
+ GIT_ERROR_CHECK_ALLOC_ADD(&newsize, pb->nr_alloc, 1024);
226
+ GIT_ERROR_CHECK_ALLOC_MULTIPLY(&newsize, newsize / 2, 3);
223
227
 
224
228
  if (!git__is_uint32(newsize)) {
225
- giterr_set(GITERR_NOMEMORY, "packfile too large to fit in memory.");
229
+ git_error_set(GIT_ERROR_NOMEMORY, "packfile too large to fit in memory.");
226
230
  return -1;
227
231
  }
228
232
 
@@ -230,8 +234,10 @@ int git_packbuilder_insert(git_packbuilder *pb, const git_oid *oid,
230
234
 
231
235
  pb->object_list = git__reallocarray(pb->object_list,
232
236
  pb->nr_alloc, sizeof(*po));
233
- GITERR_CHECK_ALLOC(pb->object_list);
234
- rehash(pb);
237
+ GIT_ERROR_CHECK_ALLOC(pb->object_list);
238
+
239
+ if (rehash(pb) < 0)
240
+ return -1;
235
241
  }
236
242
 
237
243
  po = pb->object_list + pb->nr_objects;
@@ -244,13 +250,10 @@ int git_packbuilder_insert(git_packbuilder *pb, const git_oid *oid,
244
250
  git_oid_cpy(&po->id, oid);
245
251
  po->hash = name_hash(name);
246
252
 
247
- pos = git_oidmap_put(pb->object_ix, &po->id, &ret);
248
- if (ret < 0) {
249
- giterr_set_oom();
250
- return ret;
253
+ if (git_oidmap_set(pb->object_ix, &po->id, po) < 0) {
254
+ git_error_set_oom();
255
+ return -1;
251
256
  }
252
- assert(ret != 0);
253
- git_oidmap_set_value_at(pb->object_ix, pos, po);
254
257
 
255
258
  pb->done = false;
256
259
 
@@ -266,7 +269,7 @@ int git_packbuilder_insert(git_packbuilder *pb, const git_oid *oid,
266
269
  pb->nr_objects, 0, pb->progress_cb_payload);
267
270
 
268
271
  if (ret)
269
- return giterr_set_after_callback(ret);
272
+ return git_error_set_after_callback(ret);
270
273
  }
271
274
  }
272
275
 
@@ -295,7 +298,7 @@ static int get_delta(void **out, git_odb *odb, git_pobject *po)
295
298
  goto on_error;
296
299
 
297
300
  if (error == GIT_EBUFS || delta_size != po->delta_size) {
298
- giterr_set(GITERR_INVALID, "delta size changed");
301
+ git_error_set(GIT_ERROR_INVALID, "delta size changed");
299
302
  goto on_error;
300
303
  }
301
304
 
@@ -318,7 +321,7 @@ static int write_object(
318
321
  void *cb_data)
319
322
  {
320
323
  git_odb_object *obj = NULL;
321
- git_otype type;
324
+ git_object_t type;
322
325
  unsigned char hdr[10], *zbuf = NULL;
323
326
  void *data = NULL;
324
327
  size_t hdr_len, zbuf_len = COMPRESS_BUFLEN, data_len;
@@ -336,7 +339,7 @@ static int write_object(
336
339
  goto done;
337
340
 
338
341
  data_len = po->delta_size;
339
- type = GIT_OBJ_REF_DELTA;
342
+ type = GIT_OBJECT_REF_DELTA;
340
343
  } else {
341
344
  if ((error = git_odb_read(&obj, pb->odb, &po->id)) < 0)
342
345
  goto done;
@@ -353,7 +356,7 @@ static int write_object(
353
356
  (error = git_hash_update(&pb->ctx, hdr, hdr_len)) < 0)
354
357
  goto done;
355
358
 
356
- if (type == GIT_OBJ_REF_DELTA) {
359
+ if (type == GIT_OBJECT_REF_DELTA) {
357
360
  if ((error = write_cb(po->delta->id.id, GIT_OID_RAWSZ, cb_data)) < 0 ||
358
361
  (error = git_hash_update(&pb->ctx, po->delta->id.id, GIT_OID_RAWSZ)) < 0)
359
362
  goto done;
@@ -368,7 +371,7 @@ static int write_object(
368
371
  goto done;
369
372
  } else {
370
373
  zbuf = git__malloc(zbuf_len);
371
- GITERR_CHECK_ALLOC(zbuf);
374
+ GIT_ERROR_CHECK_ALLOC(zbuf);
372
375
 
373
376
  git_zstream_reset(&pb->zstream);
374
377
  git_zstream_set_input(&pb->zstream, data, data_len);
@@ -510,15 +513,12 @@ static int cb_tag_foreach(const char *name, git_oid *oid, void *data)
510
513
  {
511
514
  git_packbuilder *pb = data;
512
515
  git_pobject *po;
513
- khiter_t pos;
514
516
 
515
517
  GIT_UNUSED(name);
516
518
 
517
- pos = git_oidmap_lookup_index(pb->object_ix, oid);
518
- if (!git_oidmap_valid_index(pb->object_ix, pos))
519
+ if ((po = git_oidmap_get(pb->object_ix, oid)) == NULL)
519
520
  return 0;
520
521
 
521
- po = git_oidmap_value_at(pb->object_ix, pos);
522
522
  po->tagged = 1;
523
523
 
524
524
  /* TODO: peel objects */
@@ -590,8 +590,8 @@ static git_pobject **compute_write_order(git_packbuilder *pb)
590
590
  */
591
591
  for (i = last_untagged; i < pb->nr_objects; i++) {
592
592
  git_pobject *po = pb->object_list + i;
593
- if (po->type != GIT_OBJ_COMMIT &&
594
- po->type != GIT_OBJ_TAG)
593
+ if (po->type != GIT_OBJECT_COMMIT &&
594
+ po->type != GIT_OBJECT_TAG)
595
595
  continue;
596
596
  add_to_write_order(wo, &wo_end, po);
597
597
  }
@@ -601,7 +601,7 @@ static git_pobject **compute_write_order(git_packbuilder *pb)
601
601
  */
602
602
  for (i = last_untagged; i < pb->nr_objects; i++) {
603
603
  git_pobject *po = pb->object_list + i;
604
- if (po->type != GIT_OBJ_TREE)
604
+ if (po->type != GIT_OBJECT_TREE)
605
605
  continue;
606
606
  add_to_write_order(wo, &wo_end, po);
607
607
  }
@@ -617,7 +617,7 @@ static git_pobject **compute_write_order(git_packbuilder *pb)
617
617
 
618
618
  if (wo_end != pb->nr_objects) {
619
619
  git__free(wo);
620
- giterr_set(GITERR_INVALID, "invalid write order");
620
+ git_error_set(GIT_ERROR_INVALID, "invalid write order");
621
621
  return NULL;
622
622
  }
623
623
 
@@ -641,7 +641,7 @@ static int write_pack(git_packbuilder *pb,
641
641
  return -1;
642
642
 
643
643
  if (!git__is_uint32(pb->nr_objects)) {
644
- giterr_set(GITERR_INVALID, "too many objects");
644
+ git_error_set(GIT_ERROR_INVALID, "too many objects");
645
645
  return -1;
646
646
  }
647
647
 
@@ -798,13 +798,13 @@ static int try_delta(git_packbuilder *pb, struct unpacked *trg,
798
798
 
799
799
  sz = git_odb_object_size(obj);
800
800
  trg->data = git__malloc(sz);
801
- GITERR_CHECK_ALLOC(trg->data);
801
+ GIT_ERROR_CHECK_ALLOC(trg->data);
802
802
  memcpy(trg->data, git_odb_object_data(obj), sz);
803
803
 
804
804
  git_odb_object_free(obj);
805
805
 
806
806
  if (sz != trg_size) {
807
- giterr_set(GITERR_INVALID,
807
+ git_error_set(GIT_ERROR_INVALID,
808
808
  "inconsistent target object length");
809
809
  return -1;
810
810
  }
@@ -820,13 +820,13 @@ static int try_delta(git_packbuilder *pb, struct unpacked *trg,
820
820
 
821
821
  sz = obj_sz;
822
822
  src->data = git__malloc(sz);
823
- GITERR_CHECK_ALLOC(src->data);
823
+ GIT_ERROR_CHECK_ALLOC(src->data);
824
824
  memcpy(src->data, git_odb_object_data(obj), sz);
825
825
 
826
826
  git_odb_object_free(obj);
827
827
 
828
828
  if (sz != src_size) {
829
- giterr_set(GITERR_INVALID,
829
+ git_error_set(GIT_ERROR_INVALID,
830
830
  "inconsistent source object length");
831
831
  return -1;
832
832
  }
@@ -872,7 +872,7 @@ static int try_delta(git_packbuilder *pb, struct unpacked *trg,
872
872
  }
873
873
 
874
874
  trg_object->delta_data = git__realloc(delta_buf, delta_size);
875
- GITERR_CHECK_ALLOC(trg_object->delta_data);
875
+ GIT_ERROR_CHECK_ALLOC(trg_object->delta_data);
876
876
  } else {
877
877
  /* create delta when writing the pack */
878
878
  git_packbuilder__cache_unlock(pb);
@@ -938,7 +938,7 @@ static int report_delta_progress(
938
938
  count, pb->nr_objects, pb->progress_cb_payload);
939
939
 
940
940
  if (ret)
941
- return giterr_set_after_callback(ret);
941
+ return git_error_set_after_callback(ret);
942
942
  }
943
943
  }
944
944
 
@@ -957,7 +957,7 @@ static int find_deltas(git_packbuilder *pb, git_pobject **list,
957
957
  int error = -1;
958
958
 
959
959
  array = git__calloc(window, sizeof(struct unpacked));
960
- GITERR_CHECK_ALLOC(array);
960
+ GIT_ERROR_CHECK_ALLOC(array);
961
961
 
962
962
  for (;;) {
963
963
  struct unpacked *n = array + idx;
@@ -1043,7 +1043,7 @@ static int find_deltas(git_packbuilder *pb, git_pobject **list,
1043
1043
 
1044
1044
  git__free(po->delta_data);
1045
1045
  po->delta_data = git__malloc(zbuf.size);
1046
- GITERR_CHECK_ALLOC(po->delta_data);
1046
+ GIT_ERROR_CHECK_ALLOC(po->delta_data);
1047
1047
 
1048
1048
  memcpy(po->delta_data, zbuf.ptr, zbuf.size);
1049
1049
  po->z_delta_size = zbuf.size;
@@ -1095,7 +1095,7 @@ on_error:
1095
1095
  git__free(array[i].data);
1096
1096
  }
1097
1097
  git__free(array);
1098
- git_buf_free(&zbuf);
1098
+ git_buf_dispose(&zbuf);
1099
1099
 
1100
1100
  return error;
1101
1101
  }
@@ -1136,7 +1136,7 @@ static void *threaded_find_deltas(void *arg)
1136
1136
  git_packbuilder__progress_unlock(me->pb);
1137
1137
 
1138
1138
  if (git_mutex_lock(&me->mutex)) {
1139
- giterr_set(GITERR_THREAD, "unable to lock packfile condition mutex");
1139
+ git_error_set(GIT_ERROR_THREAD, "unable to lock packfile condition mutex");
1140
1140
  return NULL;
1141
1141
  }
1142
1142
 
@@ -1174,7 +1174,7 @@ static int ll_find_deltas(git_packbuilder *pb, git_pobject **list,
1174
1174
  }
1175
1175
 
1176
1176
  p = git__mallocarray(pb->nr_threads, sizeof(*p));
1177
- GITERR_CHECK_ALLOC(p);
1177
+ GIT_ERROR_CHECK_ALLOC(p);
1178
1178
 
1179
1179
  /* Partition the work among the threads */
1180
1180
  for (i = 0; i < pb->nr_threads; ++i) {
@@ -1215,7 +1215,7 @@ static int ll_find_deltas(git_packbuilder *pb, git_pobject **list,
1215
1215
  ret = git_thread_create(&p[i].thread,
1216
1216
  threaded_find_deltas, &p[i]);
1217
1217
  if (ret) {
1218
- giterr_set(GITERR_THREAD, "unable to create thread");
1218
+ git_error_set(GIT_ERROR_THREAD, "unable to create thread");
1219
1219
  return -1;
1220
1220
  }
1221
1221
  active_threads++;
@@ -1284,7 +1284,7 @@ static int ll_find_deltas(git_packbuilder *pb, git_pobject **list,
1284
1284
  git_packbuilder__progress_unlock(pb);
1285
1285
 
1286
1286
  if (git_mutex_lock(&target->mutex)) {
1287
- giterr_set(GITERR_THREAD, "unable to lock packfile condition mutex");
1287
+ git_error_set(GIT_ERROR_THREAD, "unable to lock packfile condition mutex");
1288
1288
  git__free(p);
1289
1289
  return -1;
1290
1290
  }
@@ -1325,7 +1325,7 @@ static int prepare_pack(git_packbuilder *pb)
1325
1325
  pb->progress_cb(GIT_PACKBUILDER_DELTAFICATION, 0, pb->nr_objects, pb->progress_cb_payload);
1326
1326
 
1327
1327
  delta_list = git__mallocarray(pb->nr_objects, sizeof(*delta_list));
1328
- GITERR_CHECK_ALLOC(delta_list);
1328
+ GIT_ERROR_CHECK_ALLOC(delta_list);
1329
1329
 
1330
1330
  for (i = 0; i < pb->nr_objects; ++i) {
1331
1331
  git_pobject *po = pb->object_list + i;
@@ -1379,21 +1379,25 @@ int git_packbuilder_write(
1379
1379
  git_packbuilder *pb,
1380
1380
  const char *path,
1381
1381
  unsigned int mode,
1382
- git_transfer_progress_cb progress_cb,
1382
+ git_indexer_progress_cb progress_cb,
1383
1383
  void *progress_cb_payload)
1384
1384
  {
1385
+ git_indexer_options opts = GIT_INDEXER_OPTIONS_INIT;
1385
1386
  git_indexer *indexer;
1386
- git_transfer_progress stats;
1387
+ git_indexer_progress stats;
1387
1388
  struct pack_write_context ctx;
1388
1389
  int t;
1389
1390
 
1390
1391
  PREPARE_PACK;
1391
1392
 
1393
+ opts.progress_cb = progress_cb;
1394
+ opts.progress_cb_payload = progress_cb_payload;
1395
+
1392
1396
  if (git_indexer_new(
1393
- &indexer, path, mode, pb->odb, progress_cb, progress_cb_payload) < 0)
1397
+ &indexer, path, mode, pb->odb, &opts) < 0)
1394
1398
  return -1;
1395
1399
 
1396
- if (!git_repository__cvar(&t, pb->repo, GIT_CVAR_FSYNCOBJECTFILES) && t)
1400
+ if (!git_repository__configmap_lookup(&t, pb->repo, GIT_CONFIGMAP_FSYNCOBJECTFILES) && t)
1397
1401
  git_indexer__set_fsync(indexer, 1);
1398
1402
 
1399
1403
  ctx.indexer = indexer;
@@ -1426,7 +1430,7 @@ static int cb_tree_walk(
1426
1430
  struct tree_walk_context *ctx = payload;
1427
1431
 
1428
1432
  /* A commit inside a tree represents a submodule commit and should be skipped. */
1429
- if (git_tree_entry_type(entry) == GIT_OBJ_COMMIT)
1433
+ if (git_tree_entry_type(entry) == GIT_OBJECT_COMMIT)
1430
1434
  return 0;
1431
1435
 
1432
1436
  if (!(error = git_buf_sets(&ctx->buf, root)) &&
@@ -1463,7 +1467,7 @@ int git_packbuilder_insert_tree(git_packbuilder *pb, const git_oid *oid)
1463
1467
  error = git_tree_walk(tree, GIT_TREEWALK_PRE, cb_tree_walk, &context);
1464
1468
 
1465
1469
  git_tree_free(tree);
1466
- git_buf_free(&context.buf);
1470
+ git_buf_dispose(&context.buf);
1467
1471
  return error;
1468
1472
  }
1469
1473
 
@@ -1474,27 +1478,27 @@ int git_packbuilder_insert_recur(git_packbuilder *pb, const git_oid *id, const c
1474
1478
 
1475
1479
  assert(pb && id);
1476
1480
 
1477
- if ((error = git_object_lookup(&obj, pb->repo, id, GIT_OBJ_ANY)) < 0)
1481
+ if ((error = git_object_lookup(&obj, pb->repo, id, GIT_OBJECT_ANY)) < 0)
1478
1482
  return error;
1479
1483
 
1480
1484
  switch (git_object_type(obj)) {
1481
- case GIT_OBJ_BLOB:
1485
+ case GIT_OBJECT_BLOB:
1482
1486
  error = git_packbuilder_insert(pb, id, name);
1483
1487
  break;
1484
- case GIT_OBJ_TREE:
1488
+ case GIT_OBJECT_TREE:
1485
1489
  error = git_packbuilder_insert_tree(pb, id);
1486
1490
  break;
1487
- case GIT_OBJ_COMMIT:
1491
+ case GIT_OBJECT_COMMIT:
1488
1492
  error = git_packbuilder_insert_commit(pb, id);
1489
1493
  break;
1490
- case GIT_OBJ_TAG:
1494
+ case GIT_OBJECT_TAG:
1491
1495
  if ((error = git_packbuilder_insert(pb, id, name)) < 0)
1492
1496
  goto cleanup;
1493
1497
  error = git_packbuilder_insert_recur(pb, git_tag_target_id((git_tag *) obj), NULL);
1494
1498
  break;
1495
1499
 
1496
1500
  default:
1497
- giterr_set(GITERR_INVALID, "unknown object type");
1501
+ git_error_set(GIT_ERROR_INVALID, "unknown object type");
1498
1502
  error = -1;
1499
1503
  }
1500
1504
 
@@ -1513,13 +1517,13 @@ size_t git_packbuilder_written(git_packbuilder *pb)
1513
1517
  return pb->nr_written;
1514
1518
  }
1515
1519
 
1516
- int lookup_walk_object(git_walk_object **out, git_packbuilder *pb, const git_oid *id)
1520
+ static int lookup_walk_object(struct walk_object **out, git_packbuilder *pb, const git_oid *id)
1517
1521
  {
1518
- git_walk_object *obj;
1522
+ struct walk_object *obj;
1519
1523
 
1520
1524
  obj = git_pool_mallocz(&pb->object_pool, 1);
1521
1525
  if (!obj) {
1522
- giterr_set_oom();
1526
+ git_error_set_oom();
1523
1527
  return -1;
1524
1528
  }
1525
1529
 
@@ -1529,20 +1533,17 @@ int lookup_walk_object(git_walk_object **out, git_packbuilder *pb, const git_oid
1529
1533
  return 0;
1530
1534
  }
1531
1535
 
1532
- static int retrieve_object(git_walk_object **out, git_packbuilder *pb, const git_oid *id)
1536
+ static int retrieve_object(struct walk_object **out, git_packbuilder *pb, const git_oid *id)
1533
1537
  {
1538
+ struct walk_object *obj;
1534
1539
  int error;
1535
- khiter_t pos;
1536
- git_walk_object *obj;
1537
1540
 
1538
- pos = git_oidmap_lookup_index(pb->walk_objects, id);
1539
- if (git_oidmap_valid_index(pb->walk_objects, pos)) {
1540
- obj = git_oidmap_value_at(pb->walk_objects, pos);
1541
- } else {
1541
+ if ((obj = git_oidmap_get(pb->walk_objects, id)) == NULL) {
1542
1542
  if ((error = lookup_walk_object(&obj, pb, id)) < 0)
1543
1543
  return error;
1544
1544
 
1545
- git_oidmap_insert(pb->walk_objects, &obj->id, obj, &error);
1545
+ if ((error = git_oidmap_set(pb->walk_objects, &obj->id, obj)) < 0)
1546
+ return error;
1546
1547
  }
1547
1548
 
1548
1549
  *out = obj;
@@ -1552,7 +1553,7 @@ static int retrieve_object(git_walk_object **out, git_packbuilder *pb, const git
1552
1553
  static int mark_blob_uninteresting(git_packbuilder *pb, const git_oid *id)
1553
1554
  {
1554
1555
  int error;
1555
- git_walk_object *obj;
1556
+ struct walk_object *obj;
1556
1557
 
1557
1558
  if ((error = retrieve_object(&obj, pb, id)) < 0)
1558
1559
  return error;
@@ -1564,7 +1565,7 @@ static int mark_blob_uninteresting(git_packbuilder *pb, const git_oid *id)
1564
1565
 
1565
1566
  static int mark_tree_uninteresting(git_packbuilder *pb, const git_oid *id)
1566
1567
  {
1567
- git_walk_object *obj;
1568
+ struct walk_object *obj;
1568
1569
  git_tree *tree;
1569
1570
  int error;
1570
1571
  size_t i;
@@ -1584,11 +1585,11 @@ static int mark_tree_uninteresting(git_packbuilder *pb, const git_oid *id)
1584
1585
  const git_tree_entry *entry = git_tree_entry_byindex(tree, i);
1585
1586
  const git_oid *entry_id = git_tree_entry_id(entry);
1586
1587
  switch (git_tree_entry_type(entry)) {
1587
- case GIT_OBJ_TREE:
1588
+ case GIT_OBJECT_TREE:
1588
1589
  if ((error = mark_tree_uninteresting(pb, entry_id)) < 0)
1589
1590
  goto cleanup;
1590
1591
  break;
1591
- case GIT_OBJ_BLOB:
1592
+ case GIT_OBJECT_BLOB:
1592
1593
  if ((error = mark_blob_uninteresting(pb, entry_id)) < 0)
1593
1594
  goto cleanup;
1594
1595
  break;
@@ -1636,7 +1637,7 @@ int insert_tree(git_packbuilder *pb, git_tree *tree)
1636
1637
  size_t i;
1637
1638
  int error;
1638
1639
  git_tree *subtree;
1639
- git_walk_object *obj;
1640
+ struct walk_object *obj;
1640
1641
  const char *name;
1641
1642
 
1642
1643
  if ((error = retrieve_object(&obj, pb, git_tree_id(tree))) < 0)
@@ -1654,7 +1655,7 @@ int insert_tree(git_packbuilder *pb, git_tree *tree)
1654
1655
  const git_tree_entry *entry = git_tree_entry_byindex(tree, i);
1655
1656
  const git_oid *entry_id = git_tree_entry_id(entry);
1656
1657
  switch (git_tree_entry_type(entry)) {
1657
- case GIT_OBJ_TREE:
1658
+ case GIT_OBJECT_TREE:
1658
1659
  if ((error = git_tree_lookup(&subtree, pb->repo, entry_id)) < 0)
1659
1660
  return error;
1660
1661
 
@@ -1665,7 +1666,7 @@ int insert_tree(git_packbuilder *pb, git_tree *tree)
1665
1666
  return error;
1666
1667
 
1667
1668
  break;
1668
- case GIT_OBJ_BLOB:
1669
+ case GIT_OBJECT_BLOB:
1669
1670
  if ((error = retrieve_object(&obj, pb, entry_id)) < 0)
1670
1671
  return error;
1671
1672
  if (obj->uninteresting)
@@ -1684,7 +1685,7 @@ int insert_tree(git_packbuilder *pb, git_tree *tree)
1684
1685
  return error;
1685
1686
  }
1686
1687
 
1687
- int insert_commit(git_packbuilder *pb, git_walk_object *obj)
1688
+ int insert_commit(git_packbuilder *pb, struct walk_object *obj)
1688
1689
  {
1689
1690
  int error;
1690
1691
  git_commit *commit = NULL;
@@ -1714,7 +1715,7 @@ int git_packbuilder_insert_walk(git_packbuilder *pb, git_revwalk *walk)
1714
1715
  {
1715
1716
  int error;
1716
1717
  git_oid id;
1717
- git_walk_object *obj;
1718
+ struct walk_object *obj;
1718
1719
 
1719
1720
  assert(pb && walk);
1720
1721