rugged 1.6.3 → 1.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (443) hide show
  1. checksums.yaml +4 -4
  2. data/ext/rugged/rugged_allocator.c +0 -54
  3. data/lib/rugged/version.rb +1 -1
  4. data/vendor/libgit2/AUTHORS +1 -0
  5. data/vendor/libgit2/CMakeLists.txt +25 -17
  6. data/vendor/libgit2/COPYING +195 -1
  7. data/vendor/libgit2/cmake/CheckPrototypeDefinitionSafe.cmake +16 -0
  8. data/vendor/libgit2/cmake/{FindIconv.cmake → FindIntlIconv.cmake} +6 -0
  9. data/vendor/libgit2/cmake/FindLLHTTP.cmake +39 -0
  10. data/vendor/libgit2/cmake/SelectGSSAPI.cmake +4 -4
  11. data/vendor/libgit2/cmake/SelectHTTPParser.cmake +23 -8
  12. data/vendor/libgit2/cmake/SelectHTTPSBackend.cmake +34 -6
  13. data/vendor/libgit2/cmake/SelectHashes.cmake +32 -11
  14. data/vendor/libgit2/cmake/SelectRegex.cmake +6 -1
  15. data/vendor/libgit2/cmake/SelectSSH.cmake +22 -17
  16. data/vendor/libgit2/cmake/SelectXdiff.cmake +9 -0
  17. data/vendor/libgit2/cmake/SelectZlib.cmake +4 -0
  18. data/vendor/libgit2/deps/llhttp/CMakeLists.txt +8 -0
  19. data/vendor/libgit2/deps/llhttp/LICENSE-MIT +22 -0
  20. data/vendor/libgit2/deps/llhttp/api.c +510 -0
  21. data/vendor/libgit2/deps/llhttp/http.c +170 -0
  22. data/vendor/libgit2/deps/llhttp/llhttp.c +10168 -0
  23. data/vendor/libgit2/deps/llhttp/llhttp.h +897 -0
  24. data/vendor/libgit2/deps/ntlmclient/CMakeLists.txt +1 -1
  25. data/vendor/libgit2/deps/ntlmclient/crypt_builtin_md4.c +311 -0
  26. data/vendor/libgit2/deps/ntlmclient/crypt_commoncrypto.c +2 -1
  27. data/vendor/libgit2/deps/ntlmclient/crypt_mbedtls.c +0 -20
  28. data/vendor/libgit2/deps/ntlmclient/crypt_openssl.c +4 -4
  29. data/vendor/libgit2/deps/ntlmclient/ntlm.c +21 -21
  30. data/vendor/libgit2/deps/ntlmclient/unicode_builtin.c +5 -4
  31. data/vendor/libgit2/deps/ntlmclient/unicode_iconv.c +2 -1
  32. data/vendor/libgit2/deps/ntlmclient/utf8.h +1176 -721
  33. data/vendor/libgit2/deps/ntlmclient/util.h +11 -0
  34. data/vendor/libgit2/deps/pcre/CMakeLists.txt +1 -0
  35. data/vendor/libgit2/deps/pcre/LICENCE +5 -5
  36. data/vendor/libgit2/deps/pcre/pcre.h +2 -2
  37. data/vendor/libgit2/deps/pcre/pcre_compile.c +6 -3
  38. data/vendor/libgit2/deps/pcre/pcre_exec.c +2 -2
  39. data/vendor/libgit2/deps/xdiff/CMakeLists.txt +28 -0
  40. data/vendor/libgit2/{src/libgit2 → deps}/xdiff/git-xdiff.h +4 -1
  41. data/vendor/libgit2/{src/libgit2 → deps}/xdiff/xdiffi.c +19 -18
  42. data/vendor/libgit2/{src/libgit2 → deps}/xdiff/xdiffi.h +2 -4
  43. data/vendor/libgit2/{src/libgit2 → deps}/xdiff/xemit.c +3 -3
  44. data/vendor/libgit2/{src/libgit2 → deps}/xdiff/xhistogram.c +7 -18
  45. data/vendor/libgit2/{src/libgit2 → deps}/xdiff/xmacros.h +18 -1
  46. data/vendor/libgit2/{src/libgit2 → deps}/xdiff/xmerge.c +22 -20
  47. data/vendor/libgit2/{src/libgit2 → deps}/xdiff/xpatience.c +21 -30
  48. data/vendor/libgit2/{src/libgit2 → deps}/xdiff/xprepare.c +13 -30
  49. data/vendor/libgit2/{src/libgit2 → deps}/xdiff/xutils.c +18 -1
  50. data/vendor/libgit2/{src/libgit2 → deps}/xdiff/xutils.h +2 -1
  51. data/vendor/libgit2/deps/zlib/CMakeLists.txt +6 -1
  52. data/vendor/libgit2/deps/zlib/LICENSE +22 -0
  53. data/vendor/libgit2/deps/zlib/adler32.c +5 -27
  54. data/vendor/libgit2/deps/zlib/crc32.c +94 -167
  55. data/vendor/libgit2/deps/zlib/deflate.c +358 -435
  56. data/vendor/libgit2/deps/zlib/deflate.h +41 -10
  57. data/vendor/libgit2/deps/zlib/gzguts.h +13 -18
  58. data/vendor/libgit2/deps/zlib/infback.c +17 -30
  59. data/vendor/libgit2/deps/zlib/inffast.c +1 -4
  60. data/vendor/libgit2/deps/zlib/inffast.h +1 -1
  61. data/vendor/libgit2/deps/zlib/inflate.c +36 -102
  62. data/vendor/libgit2/deps/zlib/inftrees.c +6 -11
  63. data/vendor/libgit2/deps/zlib/inftrees.h +6 -6
  64. data/vendor/libgit2/deps/zlib/trees.c +287 -352
  65. data/vendor/libgit2/deps/zlib/zconf.h +23 -14
  66. data/vendor/libgit2/deps/zlib/zlib.h +202 -202
  67. data/vendor/libgit2/deps/zlib/zutil.c +18 -44
  68. data/vendor/libgit2/deps/zlib/zutil.h +13 -33
  69. data/vendor/libgit2/include/git2/annotated_commit.h +12 -5
  70. data/vendor/libgit2/include/git2/apply.h +27 -6
  71. data/vendor/libgit2/include/git2/attr.h +17 -4
  72. data/vendor/libgit2/include/git2/blame.h +133 -28
  73. data/vendor/libgit2/include/git2/blob.h +71 -28
  74. data/vendor/libgit2/include/git2/branch.h +22 -15
  75. data/vendor/libgit2/include/git2/buffer.h +6 -4
  76. data/vendor/libgit2/include/git2/cert.h +2 -1
  77. data/vendor/libgit2/include/git2/checkout.h +83 -32
  78. data/vendor/libgit2/include/git2/cherrypick.h +10 -3
  79. data/vendor/libgit2/include/git2/clone.h +25 -9
  80. data/vendor/libgit2/include/git2/commit.h +132 -3
  81. data/vendor/libgit2/include/git2/common.h +138 -56
  82. data/vendor/libgit2/include/git2/config.h +93 -23
  83. data/vendor/libgit2/include/git2/credential.h +30 -2
  84. data/vendor/libgit2/include/git2/credential_helpers.h +1 -0
  85. data/vendor/libgit2/include/git2/deprecated.h +133 -3
  86. data/vendor/libgit2/include/git2/describe.h +13 -1
  87. data/vendor/libgit2/include/git2/diff.h +77 -9
  88. data/vendor/libgit2/include/git2/email.h +9 -29
  89. data/vendor/libgit2/include/git2/errors.h +49 -74
  90. data/vendor/libgit2/include/git2/filter.h +14 -7
  91. data/vendor/libgit2/include/git2/global.h +8 -1
  92. data/vendor/libgit2/include/git2/graph.h +3 -2
  93. data/vendor/libgit2/include/git2/ignore.h +10 -0
  94. data/vendor/libgit2/include/git2/index.h +100 -6
  95. data/vendor/libgit2/include/git2/indexer.h +21 -4
  96. data/vendor/libgit2/include/git2/mailmap.h +7 -1
  97. data/vendor/libgit2/include/git2/merge.h +46 -1
  98. data/vendor/libgit2/include/git2/message.h +2 -2
  99. data/vendor/libgit2/include/git2/net.h +3 -1
  100. data/vendor/libgit2/include/git2/notes.h +9 -6
  101. data/vendor/libgit2/include/git2/object.h +9 -8
  102. data/vendor/libgit2/include/git2/odb.h +91 -49
  103. data/vendor/libgit2/include/git2/odb_backend.h +80 -52
  104. data/vendor/libgit2/include/git2/oid.h +24 -25
  105. data/vendor/libgit2/include/git2/oidarray.h +7 -1
  106. data/vendor/libgit2/include/git2/pack.h +13 -1
  107. data/vendor/libgit2/include/git2/patch.h +2 -3
  108. data/vendor/libgit2/include/git2/pathspec.h +9 -0
  109. data/vendor/libgit2/include/git2/proxy.h +10 -0
  110. data/vendor/libgit2/include/git2/rebase.h +9 -6
  111. data/vendor/libgit2/include/git2/refdb.h +2 -2
  112. data/vendor/libgit2/include/git2/reflog.h +3 -2
  113. data/vendor/libgit2/include/git2/refs.h +9 -6
  114. data/vendor/libgit2/include/git2/refspec.h +14 -4
  115. data/vendor/libgit2/include/git2/remote.h +112 -18
  116. data/vendor/libgit2/include/git2/repository.h +61 -15
  117. data/vendor/libgit2/include/git2/reset.h +16 -3
  118. data/vendor/libgit2/include/git2/revert.h +9 -4
  119. data/vendor/libgit2/include/git2/revparse.h +3 -3
  120. data/vendor/libgit2/include/git2/revwalk.h +3 -2
  121. data/vendor/libgit2/include/git2/signature.h +46 -1
  122. data/vendor/libgit2/include/git2/stash.h +17 -3
  123. data/vendor/libgit2/include/git2/status.h +10 -6
  124. data/vendor/libgit2/include/git2/stdint.h +87 -85
  125. data/vendor/libgit2/include/git2/strarray.h +2 -3
  126. data/vendor/libgit2/include/git2/submodule.h +20 -9
  127. data/vendor/libgit2/include/git2/sys/alloc.h +12 -34
  128. data/vendor/libgit2/include/git2/sys/commit.h +77 -3
  129. data/vendor/libgit2/include/git2/sys/commit_graph.h +109 -58
  130. data/vendor/libgit2/include/git2/sys/config.h +80 -4
  131. data/vendor/libgit2/include/git2/sys/credential.h +4 -3
  132. data/vendor/libgit2/include/git2/sys/diff.h +21 -1
  133. data/vendor/libgit2/include/git2/sys/email.h +7 -0
  134. data/vendor/libgit2/include/git2/sys/errors.h +76 -0
  135. data/vendor/libgit2/include/git2/sys/filter.h +66 -3
  136. data/vendor/libgit2/include/git2/sys/hashsig.h +11 -0
  137. data/vendor/libgit2/include/git2/sys/index.h +3 -2
  138. data/vendor/libgit2/include/git2/sys/mempack.h +32 -2
  139. data/vendor/libgit2/include/git2/sys/merge.h +55 -7
  140. data/vendor/libgit2/include/git2/sys/midx.h +47 -4
  141. data/vendor/libgit2/include/git2/sys/odb_backend.h +7 -3
  142. data/vendor/libgit2/include/git2/sys/openssl.h +8 -1
  143. data/vendor/libgit2/include/git2/sys/path.h +12 -1
  144. data/vendor/libgit2/include/git2/sys/refdb_backend.h +40 -36
  145. data/vendor/libgit2/include/git2/sys/refs.h +3 -2
  146. data/vendor/libgit2/include/git2/sys/remote.h +8 -1
  147. data/vendor/libgit2/include/git2/sys/repository.h +63 -3
  148. data/vendor/libgit2/include/git2/sys/stream.h +25 -2
  149. data/vendor/libgit2/include/git2/sys/transport.h +44 -5
  150. data/vendor/libgit2/include/git2/tag.h +3 -1
  151. data/vendor/libgit2/include/git2/trace.h +9 -3
  152. data/vendor/libgit2/include/git2/transaction.h +3 -2
  153. data/vendor/libgit2/include/git2/transport.h +11 -3
  154. data/vendor/libgit2/include/git2/tree.h +16 -5
  155. data/vendor/libgit2/include/git2/types.h +19 -3
  156. data/vendor/libgit2/include/git2/version.h +44 -8
  157. data/vendor/libgit2/include/git2/worktree.h +19 -7
  158. data/vendor/libgit2/src/CMakeLists.txt +40 -15
  159. data/vendor/libgit2/src/cli/CMakeLists.txt +2 -2
  160. data/vendor/libgit2/src/cli/cmd.c +1 -1
  161. data/vendor/libgit2/src/cli/cmd.h +4 -0
  162. data/vendor/libgit2/src/cli/cmd_blame.c +287 -0
  163. data/vendor/libgit2/src/cli/cmd_cat_file.c +6 -8
  164. data/vendor/libgit2/src/cli/cmd_clone.c +27 -13
  165. data/vendor/libgit2/src/cli/cmd_config.c +241 -0
  166. data/vendor/libgit2/src/cli/cmd_hash_object.c +6 -8
  167. data/vendor/libgit2/src/cli/cmd_help.c +6 -7
  168. data/vendor/libgit2/src/cli/cmd_index_pack.c +114 -0
  169. data/vendor/libgit2/src/cli/cmd_init.c +102 -0
  170. data/vendor/libgit2/src/cli/common.c +168 -0
  171. data/vendor/libgit2/src/cli/common.h +63 -0
  172. data/vendor/libgit2/src/cli/error.h +1 -1
  173. data/vendor/libgit2/src/cli/main.c +52 -24
  174. data/vendor/libgit2/src/cli/opt.c +29 -3
  175. data/vendor/libgit2/src/cli/opt.h +21 -3
  176. data/vendor/libgit2/src/cli/opt_usage.c +102 -33
  177. data/vendor/libgit2/src/cli/opt_usage.h +6 -1
  178. data/vendor/libgit2/src/cli/progress.c +60 -10
  179. data/vendor/libgit2/src/cli/progress.h +16 -4
  180. data/vendor/libgit2/src/cli/unix/sighandler.c +2 -1
  181. data/vendor/libgit2/src/cli/win32/precompiled.h +1 -1
  182. data/vendor/libgit2/src/cli/win32/sighandler.c +1 -1
  183. data/vendor/libgit2/src/libgit2/CMakeLists.txt +27 -27
  184. data/vendor/libgit2/src/libgit2/annotated_commit.c +2 -2
  185. data/vendor/libgit2/src/libgit2/annotated_commit.h +1 -1
  186. data/vendor/libgit2/src/libgit2/apply.c +14 -16
  187. data/vendor/libgit2/src/libgit2/attr.c +30 -13
  188. data/vendor/libgit2/src/libgit2/attr_file.c +7 -2
  189. data/vendor/libgit2/src/libgit2/attr_file.h +2 -0
  190. data/vendor/libgit2/src/libgit2/attrcache.c +69 -33
  191. data/vendor/libgit2/src/libgit2/attrcache.h +5 -9
  192. data/vendor/libgit2/src/libgit2/blame.c +152 -59
  193. data/vendor/libgit2/src/libgit2/blame.h +1 -0
  194. data/vendor/libgit2/src/libgit2/blame_git.c +0 -1
  195. data/vendor/libgit2/src/libgit2/branch.c +2 -2
  196. data/vendor/libgit2/src/libgit2/cache.c +22 -17
  197. data/vendor/libgit2/src/libgit2/cache.h +7 -9
  198. data/vendor/libgit2/src/libgit2/checkout.c +34 -24
  199. data/vendor/libgit2/src/libgit2/checkout.h +0 -2
  200. data/vendor/libgit2/src/libgit2/cherrypick.c +4 -5
  201. data/vendor/libgit2/src/libgit2/clone.c +186 -164
  202. data/vendor/libgit2/src/libgit2/clone.h +4 -1
  203. data/vendor/libgit2/src/libgit2/commit.c +123 -9
  204. data/vendor/libgit2/src/libgit2/commit_graph.c +166 -88
  205. data/vendor/libgit2/src/libgit2/commit_graph.h +21 -6
  206. data/vendor/libgit2/src/libgit2/commit_list.c +12 -5
  207. data/vendor/libgit2/src/libgit2/commit_list.h +1 -0
  208. data/vendor/libgit2/src/libgit2/config.c +394 -300
  209. data/vendor/libgit2/src/libgit2/config.cmake.in +3 -0
  210. data/vendor/libgit2/src/libgit2/config.h +9 -4
  211. data/vendor/libgit2/src/libgit2/config_backend.h +8 -10
  212. data/vendor/libgit2/src/libgit2/config_cache.c +4 -5
  213. data/vendor/libgit2/src/libgit2/config_file.c +113 -96
  214. data/vendor/libgit2/src/libgit2/config_list.c +285 -0
  215. data/vendor/libgit2/src/libgit2/config_list.h +32 -0
  216. data/vendor/libgit2/src/libgit2/config_mem.c +194 -40
  217. data/vendor/libgit2/src/libgit2/config_parse.c +10 -9
  218. data/vendor/libgit2/src/libgit2/config_snapshot.c +24 -31
  219. data/vendor/libgit2/src/libgit2/describe.c +34 -31
  220. data/vendor/libgit2/src/libgit2/diff.c +17 -8
  221. data/vendor/libgit2/src/libgit2/diff.h +6 -6
  222. data/vendor/libgit2/src/libgit2/diff_driver.c +12 -19
  223. data/vendor/libgit2/src/libgit2/diff_driver.h +2 -2
  224. data/vendor/libgit2/src/libgit2/diff_file.c +7 -7
  225. data/vendor/libgit2/src/libgit2/diff_generate.c +39 -18
  226. data/vendor/libgit2/src/libgit2/diff_parse.c +22 -6
  227. data/vendor/libgit2/src/libgit2/diff_print.c +88 -13
  228. data/vendor/libgit2/src/libgit2/diff_tform.c +40 -12
  229. data/vendor/libgit2/src/libgit2/diff_xdiff.h +1 -1
  230. data/vendor/libgit2/src/libgit2/email.c +5 -3
  231. data/vendor/libgit2/src/libgit2/fetch.c +39 -9
  232. data/vendor/libgit2/src/libgit2/fetch.h +0 -2
  233. data/vendor/libgit2/src/libgit2/fetchhead.c +11 -9
  234. data/vendor/libgit2/src/libgit2/filter.c +5 -5
  235. data/vendor/libgit2/src/libgit2/git2.rc +3 -3
  236. data/vendor/libgit2/src/libgit2/grafts.c +270 -0
  237. data/vendor/libgit2/src/libgit2/grafts.h +35 -0
  238. data/vendor/libgit2/src/libgit2/graph.c +1 -1
  239. data/vendor/libgit2/src/libgit2/hashmap_oid.h +30 -0
  240. data/vendor/libgit2/src/libgit2/ident.c +3 -3
  241. data/vendor/libgit2/src/libgit2/ignore.c +9 -5
  242. data/vendor/libgit2/src/libgit2/index.c +392 -208
  243. data/vendor/libgit2/src/libgit2/index.h +16 -3
  244. data/vendor/libgit2/src/libgit2/index_map.c +95 -0
  245. data/vendor/libgit2/src/libgit2/index_map.h +28 -0
  246. data/vendor/libgit2/src/libgit2/indexer.c +44 -41
  247. data/vendor/libgit2/src/libgit2/iterator.c +34 -13
  248. data/vendor/libgit2/src/libgit2/iterator.h +3 -0
  249. data/vendor/libgit2/src/libgit2/libgit2.c +155 -331
  250. data/vendor/libgit2/src/libgit2/mailmap.c +1 -1
  251. data/vendor/libgit2/src/libgit2/merge.c +56 -46
  252. data/vendor/libgit2/src/libgit2/merge_driver.c +2 -2
  253. data/vendor/libgit2/src/libgit2/merge_file.c +0 -2
  254. data/vendor/libgit2/src/libgit2/midx.c +86 -44
  255. data/vendor/libgit2/src/libgit2/midx.h +13 -3
  256. data/vendor/libgit2/src/libgit2/mwindow.c +38 -45
  257. data/vendor/libgit2/src/libgit2/mwindow.h +4 -0
  258. data/vendor/libgit2/src/libgit2/notes.c +9 -8
  259. data/vendor/libgit2/src/libgit2/object.c +42 -16
  260. data/vendor/libgit2/src/libgit2/object.h +6 -0
  261. data/vendor/libgit2/src/libgit2/odb.c +16 -9
  262. data/vendor/libgit2/src/libgit2/odb_mempack.c +49 -17
  263. data/vendor/libgit2/src/libgit2/odb_pack.c +28 -7
  264. data/vendor/libgit2/src/libgit2/oid.c +35 -2
  265. data/vendor/libgit2/src/libgit2/oid.h +11 -0
  266. data/vendor/libgit2/src/libgit2/oidarray.c +49 -3
  267. data/vendor/libgit2/src/libgit2/oidarray.h +5 -1
  268. data/vendor/libgit2/src/libgit2/pack-objects.c +77 -43
  269. data/vendor/libgit2/src/libgit2/pack-objects.h +17 -6
  270. data/vendor/libgit2/src/libgit2/pack.c +33 -27
  271. data/vendor/libgit2/src/libgit2/pack.h +15 -10
  272. data/vendor/libgit2/src/libgit2/parse.c +7 -4
  273. data/vendor/libgit2/src/libgit2/parse.h +1 -1
  274. data/vendor/libgit2/src/libgit2/patch.h +7 -1
  275. data/vendor/libgit2/src/libgit2/patch_generate.c +24 -5
  276. data/vendor/libgit2/src/libgit2/patch_parse.c +18 -10
  277. data/vendor/libgit2/src/libgit2/path.c +1 -1
  278. data/vendor/libgit2/src/libgit2/pathspec.c +1 -1
  279. data/vendor/libgit2/src/libgit2/push.c +81 -30
  280. data/vendor/libgit2/src/libgit2/push.h +1 -0
  281. data/vendor/libgit2/src/libgit2/reader.c +1 -1
  282. data/vendor/libgit2/src/libgit2/rebase.c +72 -84
  283. data/vendor/libgit2/src/libgit2/refdb_fs.c +146 -70
  284. data/vendor/libgit2/src/libgit2/reflog.c +1 -2
  285. data/vendor/libgit2/src/libgit2/reflog.h +2 -0
  286. data/vendor/libgit2/src/libgit2/refs.c +34 -8
  287. data/vendor/libgit2/src/libgit2/refs.h +6 -1
  288. data/vendor/libgit2/src/libgit2/refspec.c +28 -1
  289. data/vendor/libgit2/src/libgit2/refspec.h +8 -0
  290. data/vendor/libgit2/src/libgit2/remote.c +136 -67
  291. data/vendor/libgit2/src/libgit2/remote.h +1 -0
  292. data/vendor/libgit2/src/libgit2/repository.c +789 -330
  293. data/vendor/libgit2/src/libgit2/repository.h +22 -3
  294. data/vendor/libgit2/src/libgit2/reset.c +2 -2
  295. data/vendor/libgit2/src/libgit2/revert.c +9 -13
  296. data/vendor/libgit2/src/libgit2/revparse.c +6 -3
  297. data/vendor/libgit2/src/libgit2/revwalk.c +36 -11
  298. data/vendor/libgit2/src/libgit2/revwalk.h +3 -3
  299. data/vendor/libgit2/src/libgit2/settings.c +468 -0
  300. data/vendor/libgit2/src/libgit2/settings.h +6 -2
  301. data/vendor/libgit2/src/libgit2/signature.c +132 -15
  302. data/vendor/libgit2/src/libgit2/signature.h +0 -1
  303. data/vendor/libgit2/src/libgit2/stash.c +9 -8
  304. data/vendor/libgit2/src/libgit2/status.c +1 -1
  305. data/vendor/libgit2/src/libgit2/streams/mbedtls.c +54 -61
  306. data/vendor/libgit2/src/libgit2/streams/openssl.c +40 -23
  307. data/vendor/libgit2/src/libgit2/streams/openssl.h +2 -0
  308. data/vendor/libgit2/src/libgit2/streams/openssl_dynamic.c +4 -0
  309. data/vendor/libgit2/src/libgit2/streams/openssl_dynamic.h +3 -0
  310. data/vendor/libgit2/src/libgit2/streams/schannel.c +715 -0
  311. data/vendor/libgit2/src/libgit2/streams/schannel.h +28 -0
  312. data/vendor/libgit2/src/libgit2/streams/socket.c +237 -51
  313. data/vendor/libgit2/src/libgit2/streams/socket.h +3 -1
  314. data/vendor/libgit2/src/libgit2/streams/stransport.c +79 -19
  315. data/vendor/libgit2/src/libgit2/streams/tls.c +5 -0
  316. data/vendor/libgit2/src/libgit2/submodule.c +106 -63
  317. data/vendor/libgit2/src/libgit2/submodule.h +9 -10
  318. data/vendor/libgit2/src/libgit2/tag.c +1 -1
  319. data/vendor/libgit2/src/libgit2/trailer.c +6 -6
  320. data/vendor/libgit2/src/libgit2/transaction.c +26 -20
  321. data/vendor/libgit2/src/libgit2/transaction.h +4 -1
  322. data/vendor/libgit2/src/libgit2/transport.c +4 -1
  323. data/vendor/libgit2/src/libgit2/transports/auth.h +1 -2
  324. data/vendor/libgit2/src/libgit2/transports/{auth_negotiate.c → auth_gssapi.c} +32 -32
  325. data/vendor/libgit2/src/libgit2/transports/auth_negotiate.h +1 -1
  326. data/vendor/libgit2/src/libgit2/transports/auth_ntlm.h +1 -1
  327. data/vendor/libgit2/src/libgit2/transports/{auth_ntlm.c → auth_ntlmclient.c} +12 -12
  328. data/vendor/libgit2/src/libgit2/transports/auth_sspi.c +341 -0
  329. data/vendor/libgit2/src/libgit2/transports/credential.c +1 -1
  330. data/vendor/libgit2/src/libgit2/transports/git.c +7 -8
  331. data/vendor/libgit2/src/libgit2/transports/http.c +8 -4
  332. data/vendor/libgit2/src/libgit2/transports/http.h +0 -10
  333. data/vendor/libgit2/src/libgit2/transports/httpclient.c +117 -72
  334. data/vendor/libgit2/src/libgit2/transports/httpparser.c +128 -0
  335. data/vendor/libgit2/src/libgit2/transports/httpparser.h +99 -0
  336. data/vendor/libgit2/src/libgit2/transports/local.c +21 -11
  337. data/vendor/libgit2/src/libgit2/transports/smart.c +50 -32
  338. data/vendor/libgit2/src/libgit2/transports/smart.h +26 -9
  339. data/vendor/libgit2/src/libgit2/transports/smart_pkt.c +139 -18
  340. data/vendor/libgit2/src/libgit2/transports/smart_protocol.c +209 -57
  341. data/vendor/libgit2/src/libgit2/transports/ssh.c +41 -1103
  342. data/vendor/libgit2/src/libgit2/transports/ssh_exec.c +347 -0
  343. data/vendor/libgit2/src/libgit2/transports/ssh_exec.h +26 -0
  344. data/vendor/libgit2/src/libgit2/transports/ssh_libssh2.c +1126 -0
  345. data/vendor/libgit2/src/libgit2/transports/ssh_libssh2.h +28 -0
  346. data/vendor/libgit2/src/libgit2/transports/winhttp.c +48 -21
  347. data/vendor/libgit2/src/libgit2/tree-cache.c +26 -16
  348. data/vendor/libgit2/src/libgit2/tree-cache.h +5 -3
  349. data/vendor/libgit2/src/libgit2/tree.c +35 -27
  350. data/vendor/libgit2/src/libgit2/tree.h +3 -2
  351. data/vendor/libgit2/src/libgit2/worktree.c +39 -27
  352. data/vendor/libgit2/src/util/CMakeLists.txt +4 -6
  353. data/vendor/libgit2/src/util/alloc.c +69 -7
  354. data/vendor/libgit2/src/util/alloc.h +34 -9
  355. data/vendor/libgit2/src/util/allocators/debugalloc.c +73 -0
  356. data/vendor/libgit2/src/{cli/cli.h → util/allocators/debugalloc.h} +6 -9
  357. data/vendor/libgit2/src/util/allocators/failalloc.c +0 -60
  358. data/vendor/libgit2/src/util/allocators/failalloc.h +0 -6
  359. data/vendor/libgit2/src/util/allocators/stdalloc.c +2 -115
  360. data/vendor/libgit2/src/util/allocators/win32_leakcheck.c +0 -68
  361. data/vendor/libgit2/src/util/array.h +24 -18
  362. data/vendor/libgit2/src/util/cc-compat.h +4 -0
  363. data/vendor/libgit2/src/util/ctype_compat.h +70 -0
  364. data/vendor/libgit2/src/util/date.c +22 -14
  365. data/vendor/libgit2/src/util/date.h +12 -0
  366. data/vendor/libgit2/src/util/errors.c +401 -0
  367. data/vendor/libgit2/src/{libgit2 → util}/errors.h +21 -17
  368. data/vendor/libgit2/src/util/filebuf.c +6 -1
  369. data/vendor/libgit2/src/util/filebuf.h +19 -6
  370. data/vendor/libgit2/src/util/fs_path.c +16 -5
  371. data/vendor/libgit2/src/util/fs_path.h +23 -0
  372. data/vendor/libgit2/src/util/futils.c +14 -10
  373. data/vendor/libgit2/src/util/futils.h +13 -4
  374. data/vendor/libgit2/src/util/git2_features.h.in +21 -4
  375. data/vendor/libgit2/src/util/git2_util.h +6 -0
  376. data/vendor/libgit2/src/util/hash/openssl.c +152 -0
  377. data/vendor/libgit2/src/util/hash/openssl.h +17 -1
  378. data/vendor/libgit2/src/util/hash/sha.h +4 -1
  379. data/vendor/libgit2/src/util/hashmap.h +424 -0
  380. data/vendor/libgit2/src/util/hashmap_str.h +43 -0
  381. data/vendor/libgit2/src/util/integer.h +3 -1
  382. data/vendor/libgit2/src/util/net.c +318 -161
  383. data/vendor/libgit2/src/util/net.h +27 -0
  384. data/vendor/libgit2/src/util/pool.c +1 -1
  385. data/vendor/libgit2/src/util/pool.h +5 -0
  386. data/vendor/libgit2/src/util/posix.c +54 -0
  387. data/vendor/libgit2/src/util/posix.h +22 -0
  388. data/vendor/libgit2/src/util/pqueue.h +1 -1
  389. data/vendor/libgit2/src/util/process.h +222 -0
  390. data/vendor/libgit2/src/util/rand.c +6 -10
  391. data/vendor/libgit2/src/util/regexp.c +1 -1
  392. data/vendor/libgit2/src/util/sortedcache.c +14 -13
  393. data/vendor/libgit2/src/util/sortedcache.h +3 -3
  394. data/vendor/libgit2/src/util/staticstr.h +66 -0
  395. data/vendor/libgit2/src/util/str.c +2 -2
  396. data/vendor/libgit2/src/util/strlist.c +108 -0
  397. data/vendor/libgit2/src/util/strlist.h +36 -0
  398. data/vendor/libgit2/src/util/unix/posix.h +0 -2
  399. data/vendor/libgit2/src/util/unix/process.c +629 -0
  400. data/vendor/libgit2/src/util/unix/realpath.c +23 -5
  401. data/vendor/libgit2/src/util/util.c +17 -12
  402. data/vendor/libgit2/src/util/util.h +28 -54
  403. data/vendor/libgit2/src/util/vector.c +3 -3
  404. data/vendor/libgit2/src/util/vector.h +2 -2
  405. data/vendor/libgit2/src/util/win32/error.c +1 -1
  406. data/vendor/libgit2/src/util/win32/path_w32.c +8 -8
  407. data/vendor/libgit2/src/util/win32/posix_w32.c +30 -7
  408. data/vendor/libgit2/src/util/win32/process.c +506 -0
  409. data/vendor/libgit2/src/util/win32/utf-conv.c +73 -75
  410. data/vendor/libgit2/src/util/win32/utf-conv.h +81 -14
  411. data/vendor/libgit2/src/util/win32/w32_util.c +1 -1
  412. metadata +72 -49
  413. data/vendor/libgit2/cmake/SelectWinHTTP.cmake +0 -17
  414. data/vendor/libgit2/deps/http-parser/CMakeLists.txt +0 -6
  415. data/vendor/libgit2/deps/http-parser/COPYING +0 -23
  416. data/vendor/libgit2/deps/http-parser/http_parser.c +0 -2182
  417. data/vendor/libgit2/deps/http-parser/http_parser.h +0 -305
  418. data/vendor/libgit2/deps/zlib/COPYING +0 -27
  419. data/vendor/libgit2/include/git2/sys/reflog.h +0 -21
  420. data/vendor/libgit2/src/libgit2/config_entries.c +0 -237
  421. data/vendor/libgit2/src/libgit2/config_entries.h +0 -24
  422. data/vendor/libgit2/src/libgit2/errors.c +0 -238
  423. data/vendor/libgit2/src/libgit2/idxmap.c +0 -157
  424. data/vendor/libgit2/src/libgit2/idxmap.h +0 -177
  425. data/vendor/libgit2/src/libgit2/libgit2.h +0 -15
  426. data/vendor/libgit2/src/libgit2/netops.c +0 -124
  427. data/vendor/libgit2/src/libgit2/netops.h +0 -68
  428. data/vendor/libgit2/src/libgit2/offmap.c +0 -101
  429. data/vendor/libgit2/src/libgit2/offmap.h +0 -133
  430. data/vendor/libgit2/src/libgit2/oidmap.c +0 -107
  431. data/vendor/libgit2/src/libgit2/oidmap.h +0 -128
  432. data/vendor/libgit2/src/libgit2/threadstate.c +0 -84
  433. data/vendor/libgit2/src/libgit2/threadstate.h +0 -24
  434. data/vendor/libgit2/src/libgit2/transports/ssh.h +0 -14
  435. data/vendor/libgit2/src/util/khash.h +0 -615
  436. data/vendor/libgit2/src/util/strmap.c +0 -100
  437. data/vendor/libgit2/src/util/strmap.h +0 -131
  438. /data/vendor/libgit2/cmake/{FindHTTPParser.cmake → FindHTTP_Parser.cmake} +0 -0
  439. /data/vendor/libgit2/{src/libgit2 → deps}/xdiff/xdiff.h +0 -0
  440. /data/vendor/libgit2/{src/libgit2 → deps}/xdiff/xemit.h +0 -0
  441. /data/vendor/libgit2/{src/libgit2 → deps}/xdiff/xinclude.h +0 -0
  442. /data/vendor/libgit2/{src/libgit2 → deps}/xdiff/xprepare.h +0 -0
  443. /data/vendor/libgit2/{src/libgit2 → deps}/xdiff/xtypes.h +0 -0
@@ -32,7 +32,6 @@
32
32
  #include "commit.h"
33
33
  #include "oidarray.h"
34
34
  #include "merge_driver.h"
35
- #include "oidmap.h"
36
35
  #include "array.h"
37
36
 
38
37
  #include "git2/types.h"
@@ -124,11 +123,11 @@ static int merge_bases_many(git_commit_list **out, git_revwalk **walk_out, git_r
124
123
  *out = result;
125
124
  *walk_out = walk;
126
125
 
127
- git_vector_free(&list);
126
+ git_vector_dispose(&list);
128
127
  return 0;
129
128
 
130
129
  on_error:
131
- git_vector_free(&list);
130
+ git_vector_dispose(&list);
132
131
  git_revwalk_free(walk);
133
132
  return error;
134
133
  }
@@ -511,7 +510,7 @@ static int remove_redundant(git_revwalk *walk, git_vector *commits, uint32_t min
511
510
  done:
512
511
  git__free(redundant);
513
512
  git__free(filled_index);
514
- git_vector_free(&work);
513
+ git_vector_dispose(&work);
515
514
  return error;
516
515
  }
517
516
 
@@ -570,7 +569,7 @@ int git_merge__bases_many(
570
569
  if ((error = clear_commit_marks(one, ALL_FLAGS)) < 0 ||
571
570
  (error = clear_commit_marks_many(twos, ALL_FLAGS)) < 0 ||
572
571
  (error = remove_redundant(walk, &redundant, minimum_generation)) < 0) {
573
- git_vector_free(&redundant);
572
+ git_vector_dispose(&redundant);
574
573
  return error;
575
574
  }
576
575
 
@@ -579,7 +578,7 @@ int git_merge__bases_many(
579
578
  git_commit_list_insert_by_date(two, &result);
580
579
  }
581
580
 
582
- git_vector_free(&redundant);
581
+ git_vector_dispose(&redundant);
583
582
  }
584
583
 
585
584
  *out = result;
@@ -611,13 +610,13 @@ int git_repository_mergehead_foreach(
611
610
  buffer = merge_head_file.ptr;
612
611
 
613
612
  while ((line = git__strsep(&buffer, "\n")) != NULL) {
614
- if (strlen(line) != GIT_OID_SHA1_HEXSIZE) {
613
+ if (strlen(line) != git_oid_hexsize(repo->oid_type)) {
615
614
  git_error_set(GIT_ERROR_INVALID, "unable to parse OID - invalid length");
616
615
  error = -1;
617
616
  goto cleanup;
618
617
  }
619
618
 
620
- if ((error = git_oid__fromstr(&oid, line, GIT_OID_SHA1)) < 0)
619
+ if ((error = git_oid__fromstr(&oid, line, repo->oid_type)) < 0)
621
620
  goto cleanup;
622
621
 
623
622
  if ((error = cb(&oid, payload)) != 0) {
@@ -1061,7 +1060,7 @@ static int index_entry_similarity_calc(
1061
1060
  const git_merge_options *opts)
1062
1061
  {
1063
1062
  git_blob *blob;
1064
- git_diff_file diff_file = { GIT_OID_SHA1_ZERO };
1063
+ git_diff_file diff_file;
1065
1064
  git_object_size_t blobsize;
1066
1065
  int error;
1067
1066
 
@@ -1070,6 +1069,8 @@ static int index_entry_similarity_calc(
1070
1069
 
1071
1070
  *out = NULL;
1072
1071
 
1072
+ git_oid_clear(&diff_file.id, repo->oid_type);
1073
+
1073
1074
  if ((error = git_blob_lookup(&blob, repo, &entry->id)) < 0)
1074
1075
  return error;
1075
1076
 
@@ -1142,24 +1143,28 @@ typedef struct {
1142
1143
  size_t first_entry;
1143
1144
  } deletes_by_oid_queue;
1144
1145
 
1145
- static void deletes_by_oid_free(git_oidmap *map) {
1146
+ GIT_HASHMAP_OID_SETUP(git_merge_deletes_oidmap, deletes_by_oid_queue *);
1147
+
1148
+ static void deletes_by_oid_dispose(git_merge_deletes_oidmap *map)
1149
+ {
1150
+ git_hashmap_iter_t iter = GIT_HASHMAP_ITER_INIT;
1146
1151
  deletes_by_oid_queue *queue;
1147
1152
 
1148
1153
  if (!map)
1149
1154
  return;
1150
1155
 
1151
- git_oidmap_foreach_value(map, queue, {
1156
+ while (git_merge_deletes_oidmap_iterate(&iter, NULL, &queue, map) == 0)
1152
1157
  git_array_clear(queue->arr);
1153
- });
1154
- git_oidmap_free(map);
1158
+
1159
+ git_merge_deletes_oidmap_dispose(map);
1155
1160
  }
1156
1161
 
1157
- static int deletes_by_oid_enqueue(git_oidmap *map, git_pool *pool, const git_oid *id, size_t idx)
1162
+ static int deletes_by_oid_enqueue(git_merge_deletes_oidmap *map, git_pool *pool, const git_oid *id, size_t idx)
1158
1163
  {
1159
1164
  deletes_by_oid_queue *queue;
1160
1165
  size_t *array_entry;
1161
1166
 
1162
- if ((queue = git_oidmap_get(map, id)) == NULL) {
1167
+ if (git_merge_deletes_oidmap_get(&queue, map, id) != 0) {
1163
1168
  queue = git_pool_malloc(pool, sizeof(deletes_by_oid_queue));
1164
1169
  GIT_ERROR_CHECK_ALLOC(queue);
1165
1170
 
@@ -1167,7 +1172,7 @@ static int deletes_by_oid_enqueue(git_oidmap *map, git_pool *pool, const git_oid
1167
1172
  queue->next_pos = 0;
1168
1173
  queue->first_entry = idx;
1169
1174
 
1170
- if (git_oidmap_set(map, id, queue) < 0)
1175
+ if (git_merge_deletes_oidmap_put(map, id, queue) < 0)
1171
1176
  return -1;
1172
1177
  } else {
1173
1178
  array_entry = git_array_alloc(queue->arr);
@@ -1178,13 +1183,14 @@ static int deletes_by_oid_enqueue(git_oidmap *map, git_pool *pool, const git_oid
1178
1183
  return 0;
1179
1184
  }
1180
1185
 
1181
- static int deletes_by_oid_dequeue(size_t *idx, git_oidmap *map, const git_oid *id)
1186
+ static int deletes_by_oid_dequeue(size_t *idx, git_merge_deletes_oidmap *map, const git_oid *id)
1182
1187
  {
1183
1188
  deletes_by_oid_queue *queue;
1184
1189
  size_t *array_entry;
1190
+ int error;
1185
1191
 
1186
- if ((queue = git_oidmap_get(map, id)) == NULL)
1187
- return GIT_ENOTFOUND;
1192
+ if ((error = git_merge_deletes_oidmap_get(&queue, map, id)) != 0)
1193
+ return error;
1188
1194
 
1189
1195
  if (queue->next_pos == 0) {
1190
1196
  *idx = queue->first_entry;
@@ -1207,15 +1213,10 @@ static int merge_diff_mark_similarity_exact(
1207
1213
  {
1208
1214
  size_t i, j;
1209
1215
  git_merge_diff *conflict_src, *conflict_tgt;
1210
- git_oidmap *ours_deletes_by_oid = NULL, *theirs_deletes_by_oid = NULL;
1216
+ git_merge_deletes_oidmap ours_deletes_by_oid = GIT_HASHMAP_INIT,
1217
+ theirs_deletes_by_oid = GIT_HASHMAP_INIT;
1211
1218
  int error = 0;
1212
1219
 
1213
- if (git_oidmap_new(&ours_deletes_by_oid) < 0 ||
1214
- git_oidmap_new(&theirs_deletes_by_oid) < 0) {
1215
- error = -1;
1216
- goto done;
1217
- }
1218
-
1219
1220
  /* Build a map of object ids to conflicts */
1220
1221
  git_vector_foreach(&diff_list->conflicts, i, conflict_src) {
1221
1222
  /* Items can be the source of a rename iff they have an item in the
@@ -1223,14 +1224,21 @@ static int merge_diff_mark_similarity_exact(
1223
1224
  if (!GIT_MERGE_INDEX_ENTRY_EXISTS(conflict_src->ancestor_entry))
1224
1225
  continue;
1225
1226
 
1227
+ /*
1228
+ * Ignore empty files because it has always the same blob sha1
1229
+ * and will lead to incorrect matches between all entries.
1230
+ */
1231
+ if (git_oid_equal(&conflict_src->ancestor_entry.id, &git_oid__empty_blob_sha1))
1232
+ continue;
1233
+
1226
1234
  if (!GIT_MERGE_INDEX_ENTRY_EXISTS(conflict_src->our_entry)) {
1227
- error = deletes_by_oid_enqueue(ours_deletes_by_oid, &diff_list->pool, &conflict_src->ancestor_entry.id, i);
1235
+ error = deletes_by_oid_enqueue(&ours_deletes_by_oid, &diff_list->pool, &conflict_src->ancestor_entry.id, i);
1228
1236
  if (error < 0)
1229
1237
  goto done;
1230
1238
  }
1231
1239
 
1232
1240
  if (!GIT_MERGE_INDEX_ENTRY_EXISTS(conflict_src->their_entry)) {
1233
- error = deletes_by_oid_enqueue(theirs_deletes_by_oid, &diff_list->pool, &conflict_src->ancestor_entry.id, i);
1241
+ error = deletes_by_oid_enqueue(&theirs_deletes_by_oid, &diff_list->pool, &conflict_src->ancestor_entry.id, i);
1234
1242
  if (error < 0)
1235
1243
  goto done;
1236
1244
  }
@@ -1241,7 +1249,7 @@ static int merge_diff_mark_similarity_exact(
1241
1249
  continue;
1242
1250
 
1243
1251
  if (GIT_MERGE_INDEX_ENTRY_EXISTS(conflict_tgt->our_entry)) {
1244
- if (deletes_by_oid_dequeue(&i, ours_deletes_by_oid, &conflict_tgt->our_entry.id) == 0) {
1252
+ if (deletes_by_oid_dequeue(&i, &ours_deletes_by_oid, &conflict_tgt->our_entry.id) == 0) {
1245
1253
  similarity_ours[i].similarity = 100;
1246
1254
  similarity_ours[i].other_idx = j;
1247
1255
 
@@ -1251,7 +1259,7 @@ static int merge_diff_mark_similarity_exact(
1251
1259
  }
1252
1260
 
1253
1261
  if (GIT_MERGE_INDEX_ENTRY_EXISTS(conflict_tgt->their_entry)) {
1254
- if (deletes_by_oid_dequeue(&i, theirs_deletes_by_oid, &conflict_tgt->their_entry.id) == 0) {
1262
+ if (deletes_by_oid_dequeue(&i, &theirs_deletes_by_oid, &conflict_tgt->their_entry.id) == 0) {
1255
1263
  similarity_theirs[i].similarity = 100;
1256
1264
  similarity_theirs[i].other_idx = j;
1257
1265
 
@@ -1262,8 +1270,8 @@ static int merge_diff_mark_similarity_exact(
1262
1270
  }
1263
1271
 
1264
1272
  done:
1265
- deletes_by_oid_free(ours_deletes_by_oid);
1266
- deletes_by_oid_free(theirs_deletes_by_oid);
1273
+ deletes_by_oid_dispose(&ours_deletes_by_oid);
1274
+ deletes_by_oid_dispose(&theirs_deletes_by_oid);
1267
1275
 
1268
1276
  return error;
1269
1277
  }
@@ -1857,9 +1865,9 @@ void git_merge_diff_list__free(git_merge_diff_list *diff_list)
1857
1865
  if (!diff_list)
1858
1866
  return;
1859
1867
 
1860
- git_vector_free(&diff_list->staged);
1861
- git_vector_free(&diff_list->conflicts);
1862
- git_vector_free(&diff_list->resolved);
1868
+ git_vector_dispose(&diff_list->staged);
1869
+ git_vector_dispose(&diff_list->conflicts);
1870
+ git_vector_dispose(&diff_list->resolved);
1863
1871
  git_pool_clear(&diff_list->pool);
1864
1872
  git__free(diff_list);
1865
1873
  }
@@ -1997,8 +2005,11 @@ static int index_update_reuc(git_index *index, git_merge_diff_list *diff_list)
1997
2005
  return 0;
1998
2006
  }
1999
2007
 
2000
- static int index_from_diff_list(git_index **out,
2001
- git_merge_diff_list *diff_list, bool skip_reuc)
2008
+ static int index_from_diff_list(
2009
+ git_index **out,
2010
+ git_merge_diff_list *diff_list,
2011
+ git_oid_t oid_type,
2012
+ bool skip_reuc)
2002
2013
  {
2003
2014
  git_index *index;
2004
2015
  size_t i;
@@ -2007,7 +2018,7 @@ static int index_from_diff_list(git_index **out,
2007
2018
 
2008
2019
  *out = NULL;
2009
2020
 
2010
- if ((error = git_index_new(&index)) < 0)
2021
+ if ((error = git_index__new(&index, oid_type)) < 0)
2011
2022
  return error;
2012
2023
 
2013
2024
  if ((error = git_index__fill(index, &diff_list->staged)) < 0)
@@ -2157,7 +2168,7 @@ int git_merge__iterators(
2157
2168
  }
2158
2169
  }
2159
2170
 
2160
- error = index_from_diff_list(out, diff_list,
2171
+ error = index_from_diff_list(out, diff_list, repo->oid_type,
2161
2172
  (opts.flags & GIT_MERGE_SKIP_REUC));
2162
2173
 
2163
2174
  done:
@@ -2200,8 +2211,8 @@ int git_merge_trees(
2200
2211
  result = our_tree;
2201
2212
 
2202
2213
  if (result) {
2203
- if ((error = git_index_new(out)) == 0)
2204
- error = git_index_read_tree(*out, result);
2214
+ if ((error = git_index__new(out, repo->oid_type)) == 0)
2215
+ error = git_index_read_tree(*out, result);
2205
2216
 
2206
2217
  return error;
2207
2218
  }
@@ -2824,7 +2835,7 @@ cleanup:
2824
2835
 
2825
2836
  git_str_dispose(&file_path);
2826
2837
 
2827
- git_vector_free(&matching);
2838
+ git_vector_dispose(&matching);
2828
2839
  git__free(entries);
2829
2840
 
2830
2841
  return error;
@@ -3003,7 +3014,7 @@ done:
3003
3014
  git_iterator_free(iter_new);
3004
3015
  git_diff_free(staged_diff_list);
3005
3016
  git_diff_free(index_diff_list);
3006
- git_vector_free(&staged_paths);
3017
+ git_vector_dispose(&staged_paths);
3007
3018
 
3008
3019
  return error;
3009
3020
  }
@@ -3100,7 +3111,7 @@ int git_merge__check_result(git_repository *repo, git_index *index_new)
3100
3111
  }
3101
3112
 
3102
3113
  done:
3103
- git_vector_free(&paths);
3114
+ git_vector_dispose(&paths);
3104
3115
  git_tree_free(head_tree);
3105
3116
  git_iterator_free(iter_head);
3106
3117
  git_iterator_free(iter_new);
@@ -3341,8 +3352,7 @@ int git_merge(
3341
3352
  goto done;
3342
3353
 
3343
3354
  checkout_strategy = given_checkout_opts ?
3344
- given_checkout_opts->checkout_strategy :
3345
- GIT_CHECKOUT_SAFE;
3355
+ given_checkout_opts->checkout_strategy : 0;
3346
3356
 
3347
3357
  if ((error = git_indexwriter_init_for_operation(&indexwriter, repo,
3348
3358
  &checkout_strategy)) < 0)
@@ -218,7 +218,7 @@ int git_merge_driver_global_init(void)
218
218
 
219
219
  done:
220
220
  if (error < 0)
221
- git_vector_free_deep(&merge_driver_registry.drivers);
221
+ git_vector_dispose_deep(&merge_driver_registry.drivers);
222
222
 
223
223
  return error;
224
224
  }
@@ -238,7 +238,7 @@ static void git_merge_driver_global_shutdown(void)
238
238
  git__free(entry);
239
239
  }
240
240
 
241
- git_vector_free(&merge_driver_registry.drivers);
241
+ git_vector_dispose(&merge_driver_registry.drivers);
242
242
 
243
243
  git_rwlock_wrunlock(&merge_driver_registry.lock);
244
244
  git_rwlock_free(&merge_driver_registry.lock);
@@ -19,8 +19,6 @@
19
19
  #include "git2/index.h"
20
20
  #include "git2/merge.h"
21
21
 
22
- #include "xdiff/xdiff.h"
23
-
24
22
  /* only examine the first 8000 bytes for binaryness.
25
23
  * https://github.com/git/git/blob/77bd3ea9f54f1584147b594abc04c26ca516d987/xdiff-interface.c#L197
26
24
  */
@@ -114,23 +114,16 @@ static int midx_parse_oid_lookup(
114
114
  const unsigned char *data,
115
115
  struct git_midx_chunk *chunk_oid_lookup)
116
116
  {
117
- uint32_t i;
118
- unsigned char *oid, *prev_oid, zero_oid[GIT_OID_SHA1_SIZE] = {0};
117
+ size_t oid_size = git_oid_size(idx->oid_type);
119
118
 
120
119
  if (chunk_oid_lookup->offset == 0)
121
120
  return midx_error("missing OID Lookup chunk");
122
121
  if (chunk_oid_lookup->length == 0)
123
122
  return midx_error("empty OID Lookup chunk");
124
- if (chunk_oid_lookup->length != idx->num_objects * GIT_OID_SHA1_SIZE)
123
+ if (chunk_oid_lookup->length != idx->num_objects * oid_size)
125
124
  return midx_error("OID Lookup chunk has wrong length");
126
125
 
127
- idx->oid_lookup = oid = (unsigned char *)(data + chunk_oid_lookup->offset);
128
- prev_oid = zero_oid;
129
- for (i = 0; i < idx->num_objects; ++i, oid += GIT_OID_SHA1_SIZE) {
130
- if (git_oid_raw_cmp(prev_oid, oid, GIT_OID_SHA1_SIZE) >= 0)
131
- return midx_error("OID Lookup index is non-monotonic");
132
- prev_oid = oid;
133
- }
126
+ idx->oid_lookup = (unsigned char *)(data + chunk_oid_lookup->offset);
134
127
 
135
128
  return 0;
136
129
  }
@@ -178,17 +171,20 @@ int git_midx_parse(
178
171
  struct git_midx_chunk *last_chunk;
179
172
  uint32_t i;
180
173
  off64_t last_chunk_offset, chunk_offset, trailer_offset;
181
- size_t checksum_size;
174
+ size_t checksum_size, oid_size;
182
175
  int error;
183
176
  struct git_midx_chunk chunk_packfile_names = {0},
184
177
  chunk_oid_fanout = {0},
185
178
  chunk_oid_lookup = {0},
186
179
  chunk_object_offsets = {0},
187
- chunk_object_large_offsets = {0};
180
+ chunk_object_large_offsets = {0},
181
+ chunk_unknown = {0};
188
182
 
189
183
  GIT_ASSERT_ARG(idx);
190
184
 
191
- if (size < sizeof(struct git_midx_header) + GIT_OID_SHA1_SIZE)
185
+ oid_size = git_oid_size(idx->oid_type);
186
+
187
+ if (size < sizeof(struct git_midx_header) + oid_size)
192
188
  return midx_error("multi-pack index is too short");
193
189
 
194
190
  hdr = ((struct git_midx_header *)data);
@@ -209,7 +205,7 @@ int git_midx_parse(
209
205
  sizeof(struct git_midx_header) +
210
206
  (1 + hdr->chunks) * 12;
211
207
 
212
- checksum_size = GIT_HASH_SHA1_SIZE;
208
+ checksum_size = oid_size;
213
209
  trailer_offset = size - checksum_size;
214
210
 
215
211
  if (trailer_offset < last_chunk_offset)
@@ -261,7 +257,9 @@ int git_midx_parse(
261
257
  break;
262
258
 
263
259
  default:
264
- return midx_error("unrecognized chunk ID");
260
+ chunk_unknown.offset = last_chunk_offset;
261
+ last_chunk = &chunk_unknown;
262
+ break;
265
263
  }
266
264
  }
267
265
  last_chunk->length = (size_t)(trailer_offset - last_chunk_offset);
@@ -287,8 +285,9 @@ int git_midx_parse(
287
285
  }
288
286
 
289
287
  int git_midx_open(
290
- git_midx_file **idx_out,
291
- const char *path)
288
+ git_midx_file **idx_out,
289
+ const char *path,
290
+ git_oid_t oid_type)
292
291
  {
293
292
  git_midx_file *idx;
294
293
  git_file fd = -1;
@@ -296,6 +295,8 @@ int git_midx_open(
296
295
  struct stat st;
297
296
  int error;
298
297
 
298
+ GIT_ASSERT_ARG(idx_out && path && oid_type);
299
+
299
300
  /* TODO: properly open the file without access time using O_NOATIME */
300
301
  fd = git_futils_open_ro(path);
301
302
  if (fd < 0)
@@ -317,6 +318,8 @@ int git_midx_open(
317
318
  idx = git__calloc(1, sizeof(git_midx_file));
318
319
  GIT_ERROR_CHECK_ALLOC(idx);
319
320
 
321
+ idx->oid_type = oid_type;
322
+
320
323
  error = git_str_sets(&idx->filename, path);
321
324
  if (error < 0)
322
325
  return error;
@@ -344,7 +347,7 @@ bool git_midx_needs_refresh(
344
347
  git_file fd = -1;
345
348
  struct stat st;
346
349
  ssize_t bytes_read;
347
- unsigned char checksum[GIT_HASH_SHA1_SIZE];
350
+ unsigned char checksum[GIT_HASH_MAX_SIZE];
348
351
  size_t checksum_size;
349
352
 
350
353
  /* TODO: properly open the file without access time using O_NOATIME */
@@ -364,8 +367,8 @@ bool git_midx_needs_refresh(
364
367
  return true;
365
368
  }
366
369
 
367
- checksum_size = GIT_HASH_SHA1_SIZE;
368
- bytes_read = p_pread(fd, checksum, checksum_size, st.st_size - GIT_OID_SHA1_SIZE);
370
+ checksum_size = git_oid_size(idx->oid_type);
371
+ bytes_read = p_pread(fd, checksum, checksum_size, st.st_size - checksum_size);
369
372
  p_close(fd);
370
373
 
371
374
  if (bytes_read != (ssize_t)checksum_size)
@@ -381,7 +384,7 @@ int git_midx_entry_find(
381
384
  size_t len)
382
385
  {
383
386
  int pos, found = 0;
384
- size_t pack_index;
387
+ size_t pack_index, oid_size, oid_hexsize;
385
388
  uint32_t hi, lo;
386
389
  unsigned char *current = NULL;
387
390
  const unsigned char *object_offset;
@@ -389,30 +392,33 @@ int git_midx_entry_find(
389
392
 
390
393
  GIT_ASSERT_ARG(idx);
391
394
 
395
+ oid_size = git_oid_size(idx->oid_type);
396
+ oid_hexsize = git_oid_hexsize(idx->oid_type);
397
+
392
398
  hi = ntohl(idx->oid_fanout[(int)short_oid->id[0]]);
393
399
  lo = ((short_oid->id[0] == 0x0) ? 0 : ntohl(idx->oid_fanout[(int)short_oid->id[0] - 1]));
394
400
 
395
- pos = git_pack__lookup_id(idx->oid_lookup, GIT_OID_SHA1_SIZE, lo, hi, short_oid->id, GIT_OID_SHA1);
401
+ pos = git_pack__lookup_id(idx->oid_lookup, oid_size, lo, hi, short_oid->id, idx->oid_type);
396
402
 
397
403
  if (pos >= 0) {
398
404
  /* An object matching exactly the oid was found */
399
405
  found = 1;
400
- current = idx->oid_lookup + (pos * GIT_OID_SHA1_SIZE);
406
+ current = idx->oid_lookup + (pos * oid_size);
401
407
  } else {
402
408
  /* No object was found */
403
409
  /* pos refers to the object with the "closest" oid to short_oid */
404
410
  pos = -1 - pos;
405
411
  if (pos < (int)idx->num_objects) {
406
- current = idx->oid_lookup + (pos * GIT_OID_SHA1_SIZE);
412
+ current = idx->oid_lookup + (pos * oid_size);
407
413
 
408
414
  if (!git_oid_raw_ncmp(short_oid->id, current, len))
409
415
  found = 1;
410
416
  }
411
417
  }
412
418
 
413
- if (found && len != GIT_OID_SHA1_HEXSIZE && pos + 1 < (int)idx->num_objects) {
419
+ if (found && len != oid_hexsize && pos + 1 < (int)idx->num_objects) {
414
420
  /* Check for ambiguousity */
415
- const unsigned char *next = current + GIT_OID_SHA1_SIZE;
421
+ const unsigned char *next = current + oid_size;
416
422
 
417
423
  if (!git_oid_raw_ncmp(short_oid->id, next, len))
418
424
  found = 2;
@@ -443,7 +449,7 @@ int git_midx_entry_find(
443
449
  return midx_error("invalid index into the packfile names table");
444
450
  e->pack_index = pack_index;
445
451
  e->offset = offset;
446
- git_oid__fromraw(&e->sha1, current, GIT_OID_SHA1);
452
+ git_oid__fromraw(&e->sha1, current, idx->oid_type);
447
453
  return 0;
448
454
  }
449
455
 
@@ -453,13 +459,15 @@ int git_midx_foreach_entry(
453
459
  void *data)
454
460
  {
455
461
  git_oid oid;
456
- size_t i;
462
+ size_t oid_size, i;
457
463
  int error;
458
464
 
459
465
  GIT_ASSERT_ARG(idx);
460
466
 
467
+ oid_size = git_oid_size(idx->oid_type);
468
+
461
469
  for (i = 0; i < idx->num_objects; ++i) {
462
- if ((error = git_oid__fromraw(&oid, &idx->oid_lookup[i * GIT_OID_SHA1_SIZE], GIT_OID_SHA1)) < 0)
470
+ if ((error = git_oid__fromraw(&oid, &idx->oid_lookup[i * oid_size], idx->oid_type)) < 0)
463
471
  return error;
464
472
 
465
473
  if ((error = cb(&oid, data)) != 0)
@@ -476,7 +484,7 @@ int git_midx_close(git_midx_file *idx)
476
484
  if (idx->index_map.data)
477
485
  git_futils_mmap_free(&idx->index_map);
478
486
 
479
- git_vector_free(&idx->packfile_names);
487
+ git_vector_dispose(&idx->packfile_names);
480
488
 
481
489
  return 0;
482
490
  }
@@ -500,10 +508,30 @@ static int packfile__cmp(const void *a_, const void *b_)
500
508
  }
501
509
 
502
510
  int git_midx_writer_new(
503
- git_midx_writer **out,
504
- const char *pack_dir)
511
+ git_midx_writer **out,
512
+ const char *pack_dir
513
+ #ifdef GIT_EXPERIMENTAL_SHA256
514
+ , git_midx_writer_options *opts
515
+ #endif
516
+ )
505
517
  {
506
- git_midx_writer *w = git__calloc(1, sizeof(git_midx_writer));
518
+ git_midx_writer *w;
519
+ git_oid_t oid_type;
520
+
521
+ GIT_ASSERT_ARG(out && pack_dir);
522
+
523
+ #ifdef GIT_EXPERIMENTAL_SHA256
524
+ GIT_ERROR_CHECK_VERSION(opts,
525
+ GIT_MIDX_WRITER_OPTIONS_VERSION,
526
+ "git_midx_writer_options");
527
+
528
+ oid_type = opts && opts->oid_type ? opts->oid_type : GIT_OID_DEFAULT;
529
+ GIT_ASSERT_ARG(git_oid_type_is_valid(oid_type));
530
+ #else
531
+ oid_type = GIT_OID_SHA1;
532
+ #endif
533
+
534
+ w = git__calloc(1, sizeof(git_midx_writer));
507
535
  GIT_ERROR_CHECK_ALLOC(w);
508
536
 
509
537
  if (git_str_sets(&w->pack_dir, pack_dir) < 0) {
@@ -518,6 +546,8 @@ int git_midx_writer_new(
518
546
  return -1;
519
547
  }
520
548
 
549
+ w->oid_type = oid_type;
550
+
521
551
  *out = w;
522
552
  return 0;
523
553
  }
@@ -532,7 +562,7 @@ void git_midx_writer_free(git_midx_writer *w)
532
562
 
533
563
  git_vector_foreach (&w->packs, i, p)
534
564
  git_mwindow_put_pack(p);
535
- git_vector_free(&w->packs);
565
+ git_vector_dispose(&w->packs);
536
566
  git_str_dispose(&w->pack_dir);
537
567
  git__free(w);
538
568
  }
@@ -638,9 +668,11 @@ static int midx_write_hash(const char *buf, size_t size, void *data)
638
668
  struct midx_write_hash_context *ctx = (struct midx_write_hash_context *)data;
639
669
  int error;
640
670
 
641
- error = git_hash_update(ctx->ctx, buf, size);
642
- if (error < 0)
643
- return error;
671
+ if (ctx->ctx) {
672
+ error = git_hash_update(ctx->ctx, buf, size);
673
+ if (error < 0)
674
+ return error;
675
+ }
644
676
 
645
677
  return ctx->write_cb(buf, size, ctx->cb_data);
646
678
  }
@@ -662,12 +694,13 @@ static int midx_write(
662
694
  oid_lookup = GIT_STR_INIT,
663
695
  object_offsets = GIT_STR_INIT,
664
696
  object_large_offsets = GIT_STR_INIT;
665
- unsigned char checksum[GIT_HASH_SHA1_SIZE];
666
- size_t checksum_size;
697
+ unsigned char checksum[GIT_HASH_MAX_SIZE];
698
+ size_t checksum_size, oid_size;
667
699
  git_midx_entry *entry;
668
700
  object_entry_array_t object_entries_array = GIT_ARRAY_INIT;
669
701
  git_vector object_entries = GIT_VECTOR_INIT;
670
702
  git_hash_ctx ctx;
703
+ git_hash_algorithm_t checksum_type;
671
704
  struct midx_write_hash_context hash_cb_data = {0};
672
705
 
673
706
  hdr.signature = htonl(MIDX_SIGNATURE);
@@ -679,10 +712,14 @@ static int midx_write(
679
712
  hash_cb_data.cb_data = cb_data;
680
713
  hash_cb_data.ctx = &ctx;
681
714
 
682
- checksum_size = GIT_HASH_SHA1_SIZE;
683
- error = git_hash_ctx_init(&ctx, GIT_HASH_ALGORITHM_SHA1);
684
- if (error < 0)
715
+ oid_size = git_oid_size(w->oid_type);
716
+ checksum_type = git_oid_algorithm(w->oid_type);
717
+ checksum_size = git_hash_size(checksum_type);
718
+ GIT_ASSERT(oid_size && checksum_type && checksum_size);
719
+
720
+ if ((error = git_hash_ctx_init(&ctx, checksum_type)) < 0)
685
721
  return error;
722
+
686
723
  cb_data = &hash_cb_data;
687
724
  write_cb = midx_write_hash;
688
725
 
@@ -749,7 +786,9 @@ static int midx_write(
749
786
 
750
787
  /* Fill the OID Lookup table. */
751
788
  git_vector_foreach (&object_entries, i, entry) {
752
- error = git_str_put(&oid_lookup, (char *)&entry->sha1.id, GIT_OID_SHA1_SIZE);
789
+ error = git_str_put(&oid_lookup,
790
+ (char *)&entry->sha1.id, oid_size);
791
+
753
792
  if (error < 0)
754
793
  goto cleanup;
755
794
  }
@@ -834,13 +873,16 @@ static int midx_write(
834
873
  error = git_hash_final(checksum, &ctx);
835
874
  if (error < 0)
836
875
  goto cleanup;
876
+
877
+ hash_cb_data.ctx = NULL;
878
+
837
879
  error = write_cb((char *)checksum, checksum_size, cb_data);
838
880
  if (error < 0)
839
881
  goto cleanup;
840
882
 
841
883
  cleanup:
842
884
  git_array_clear(object_entries_array);
843
- git_vector_free(&object_entries);
885
+ git_vector_dispose(&object_entries);
844
886
  git_str_dispose(&packfile_names);
845
887
  git_str_dispose(&oid_lookup);
846
888
  git_str_dispose(&object_offsets);
@@ -51,8 +51,14 @@ typedef struct git_midx_file {
51
51
  /* The number of entries in the Object Large Offsets table. Each entry has an 8-byte with an offset */
52
52
  size_t num_object_large_offsets;
53
53
 
54
- /* The trailer of the file. Contains the SHA1-checksum of the whole file. */
55
- unsigned char checksum[GIT_HASH_SHA1_SIZE];
54
+ /*
55
+ * The trailer of the file. Contains the checksum of the whole
56
+ * file, in the repository's object format hash.
57
+ */
58
+ unsigned char checksum[GIT_HASH_MAX_SIZE];
59
+
60
+ /* The type of object IDs in the midx. */
61
+ git_oid_t oid_type;
56
62
 
57
63
  /* something like ".git/objects/pack/multi-pack-index". */
58
64
  git_str filename;
@@ -82,11 +88,15 @@ struct git_midx_writer {
82
88
 
83
89
  /* The list of `git_pack_file`s. */
84
90
  git_vector packs;
91
+
92
+ /* The object ID type of the writer. */
93
+ git_oid_t oid_type;
85
94
  };
86
95
 
87
96
  int git_midx_open(
88
97
  git_midx_file **idx_out,
89
- const char *path);
98
+ const char *path,
99
+ git_oid_t oid_type);
90
100
  bool git_midx_needs_refresh(
91
101
  const git_midx_file *idx,
92
102
  const char *path);