rugged 1.7.2 → 1.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (361) 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 +23 -10
  5. data/vendor/libgit2/COPYING +195 -1
  6. data/vendor/libgit2/cmake/{FindIconv.cmake → FindIntlIconv.cmake} +6 -0
  7. data/vendor/libgit2/cmake/FindLLHTTP.cmake +39 -0
  8. data/vendor/libgit2/cmake/SelectGSSAPI.cmake +1 -1
  9. data/vendor/libgit2/cmake/SelectHTTPParser.cmake +23 -8
  10. data/vendor/libgit2/cmake/SelectHTTPSBackend.cmake +17 -8
  11. data/vendor/libgit2/cmake/SelectHashes.cmake +28 -11
  12. data/vendor/libgit2/cmake/SelectRegex.cmake +6 -1
  13. data/vendor/libgit2/cmake/SelectSSH.cmake +22 -17
  14. data/vendor/libgit2/cmake/SelectZlib.cmake +4 -0
  15. data/vendor/libgit2/deps/llhttp/CMakeLists.txt +8 -0
  16. data/vendor/libgit2/deps/llhttp/LICENSE-MIT +22 -0
  17. data/vendor/libgit2/deps/llhttp/api.c +510 -0
  18. data/vendor/libgit2/deps/llhttp/http.c +170 -0
  19. data/vendor/libgit2/deps/llhttp/llhttp.c +10168 -0
  20. data/vendor/libgit2/deps/llhttp/llhttp.h +897 -0
  21. data/vendor/libgit2/deps/ntlmclient/CMakeLists.txt +1 -1
  22. data/vendor/libgit2/deps/ntlmclient/crypt_builtin_md4.c +311 -0
  23. data/vendor/libgit2/deps/ntlmclient/crypt_commoncrypto.c +2 -1
  24. data/vendor/libgit2/deps/ntlmclient/crypt_mbedtls.c +0 -20
  25. data/vendor/libgit2/deps/ntlmclient/crypt_openssl.c +4 -4
  26. data/vendor/libgit2/deps/ntlmclient/ntlm.c +21 -21
  27. data/vendor/libgit2/deps/ntlmclient/unicode_builtin.c +5 -4
  28. data/vendor/libgit2/deps/ntlmclient/unicode_iconv.c +2 -1
  29. data/vendor/libgit2/deps/ntlmclient/utf8.h +1176 -721
  30. data/vendor/libgit2/deps/ntlmclient/util.h +11 -0
  31. data/vendor/libgit2/deps/pcre/CMakeLists.txt +1 -0
  32. data/vendor/libgit2/deps/xdiff/xmerge.c +2 -2
  33. data/vendor/libgit2/deps/zlib/CMakeLists.txt +6 -1
  34. data/vendor/libgit2/deps/zlib/LICENSE +22 -0
  35. data/vendor/libgit2/deps/zlib/adler32.c +5 -27
  36. data/vendor/libgit2/deps/zlib/crc32.c +94 -167
  37. data/vendor/libgit2/deps/zlib/deflate.c +358 -435
  38. data/vendor/libgit2/deps/zlib/deflate.h +41 -10
  39. data/vendor/libgit2/deps/zlib/gzguts.h +13 -18
  40. data/vendor/libgit2/deps/zlib/infback.c +17 -30
  41. data/vendor/libgit2/deps/zlib/inffast.c +1 -4
  42. data/vendor/libgit2/deps/zlib/inffast.h +1 -1
  43. data/vendor/libgit2/deps/zlib/inflate.c +36 -102
  44. data/vendor/libgit2/deps/zlib/inftrees.c +6 -11
  45. data/vendor/libgit2/deps/zlib/inftrees.h +6 -6
  46. data/vendor/libgit2/deps/zlib/trees.c +287 -352
  47. data/vendor/libgit2/deps/zlib/zconf.h +23 -14
  48. data/vendor/libgit2/deps/zlib/zlib.h +202 -202
  49. data/vendor/libgit2/deps/zlib/zutil.c +18 -44
  50. data/vendor/libgit2/deps/zlib/zutil.h +13 -33
  51. data/vendor/libgit2/include/git2/annotated_commit.h +12 -5
  52. data/vendor/libgit2/include/git2/apply.h +27 -6
  53. data/vendor/libgit2/include/git2/attr.h +17 -4
  54. data/vendor/libgit2/include/git2/blame.h +133 -28
  55. data/vendor/libgit2/include/git2/blob.h +71 -28
  56. data/vendor/libgit2/include/git2/branch.h +22 -15
  57. data/vendor/libgit2/include/git2/buffer.h +6 -4
  58. data/vendor/libgit2/include/git2/cert.h +2 -1
  59. data/vendor/libgit2/include/git2/checkout.h +83 -32
  60. data/vendor/libgit2/include/git2/cherrypick.h +10 -3
  61. data/vendor/libgit2/include/git2/clone.h +25 -9
  62. data/vendor/libgit2/include/git2/commit.h +132 -3
  63. data/vendor/libgit2/include/git2/common.h +120 -63
  64. data/vendor/libgit2/include/git2/config.h +93 -23
  65. data/vendor/libgit2/include/git2/credential.h +30 -2
  66. data/vendor/libgit2/include/git2/credential_helpers.h +1 -0
  67. data/vendor/libgit2/include/git2/deprecated.h +133 -3
  68. data/vendor/libgit2/include/git2/describe.h +13 -1
  69. data/vendor/libgit2/include/git2/diff.h +38 -8
  70. data/vendor/libgit2/include/git2/email.h +9 -29
  71. data/vendor/libgit2/include/git2/errors.h +46 -73
  72. data/vendor/libgit2/include/git2/filter.h +14 -7
  73. data/vendor/libgit2/include/git2/global.h +8 -1
  74. data/vendor/libgit2/include/git2/graph.h +3 -2
  75. data/vendor/libgit2/include/git2/ignore.h +10 -0
  76. data/vendor/libgit2/include/git2/index.h +99 -14
  77. data/vendor/libgit2/include/git2/indexer.h +21 -4
  78. data/vendor/libgit2/include/git2/mailmap.h +7 -1
  79. data/vendor/libgit2/include/git2/merge.h +46 -1
  80. data/vendor/libgit2/include/git2/message.h +2 -2
  81. data/vendor/libgit2/include/git2/net.h +3 -1
  82. data/vendor/libgit2/include/git2/notes.h +9 -6
  83. data/vendor/libgit2/include/git2/object.h +9 -8
  84. data/vendor/libgit2/include/git2/odb.h +91 -49
  85. data/vendor/libgit2/include/git2/odb_backend.h +80 -52
  86. data/vendor/libgit2/include/git2/oid.h +23 -24
  87. data/vendor/libgit2/include/git2/oidarray.h +7 -1
  88. data/vendor/libgit2/include/git2/pack.h +13 -1
  89. data/vendor/libgit2/include/git2/patch.h +2 -3
  90. data/vendor/libgit2/include/git2/pathspec.h +9 -0
  91. data/vendor/libgit2/include/git2/proxy.h +10 -0
  92. data/vendor/libgit2/include/git2/rebase.h +9 -6
  93. data/vendor/libgit2/include/git2/refdb.h +2 -2
  94. data/vendor/libgit2/include/git2/reflog.h +3 -2
  95. data/vendor/libgit2/include/git2/refs.h +9 -6
  96. data/vendor/libgit2/include/git2/refspec.h +14 -4
  97. data/vendor/libgit2/include/git2/remote.h +94 -18
  98. data/vendor/libgit2/include/git2/repository.h +57 -21
  99. data/vendor/libgit2/include/git2/reset.h +16 -3
  100. data/vendor/libgit2/include/git2/revert.h +9 -4
  101. data/vendor/libgit2/include/git2/revparse.h +3 -3
  102. data/vendor/libgit2/include/git2/revwalk.h +3 -2
  103. data/vendor/libgit2/include/git2/signature.h +46 -1
  104. data/vendor/libgit2/include/git2/stash.h +17 -3
  105. data/vendor/libgit2/include/git2/status.h +10 -6
  106. data/vendor/libgit2/include/git2/stdint.h +87 -85
  107. data/vendor/libgit2/include/git2/strarray.h +2 -3
  108. data/vendor/libgit2/include/git2/submodule.h +20 -9
  109. data/vendor/libgit2/include/git2/sys/alloc.h +12 -0
  110. data/vendor/libgit2/include/git2/sys/commit.h +77 -3
  111. data/vendor/libgit2/include/git2/sys/commit_graph.h +103 -62
  112. data/vendor/libgit2/include/git2/sys/config.h +80 -4
  113. data/vendor/libgit2/include/git2/sys/credential.h +4 -3
  114. data/vendor/libgit2/include/git2/sys/diff.h +21 -1
  115. data/vendor/libgit2/include/git2/sys/email.h +7 -0
  116. data/vendor/libgit2/include/git2/sys/errors.h +76 -0
  117. data/vendor/libgit2/include/git2/sys/filter.h +66 -3
  118. data/vendor/libgit2/include/git2/sys/hashsig.h +11 -0
  119. data/vendor/libgit2/include/git2/sys/index.h +3 -2
  120. data/vendor/libgit2/include/git2/sys/mempack.h +32 -2
  121. data/vendor/libgit2/include/git2/sys/merge.h +55 -7
  122. data/vendor/libgit2/include/git2/sys/midx.h +43 -4
  123. data/vendor/libgit2/include/git2/sys/odb_backend.h +7 -3
  124. data/vendor/libgit2/include/git2/sys/openssl.h +8 -1
  125. data/vendor/libgit2/include/git2/sys/path.h +12 -1
  126. data/vendor/libgit2/include/git2/sys/refdb_backend.h +40 -36
  127. data/vendor/libgit2/include/git2/sys/refs.h +3 -2
  128. data/vendor/libgit2/include/git2/sys/remote.h +8 -1
  129. data/vendor/libgit2/include/git2/sys/repository.h +63 -3
  130. data/vendor/libgit2/include/git2/sys/stream.h +11 -2
  131. data/vendor/libgit2/include/git2/sys/transport.h +24 -3
  132. data/vendor/libgit2/include/git2/tag.h +3 -1
  133. data/vendor/libgit2/include/git2/trace.h +9 -3
  134. data/vendor/libgit2/include/git2/transaction.h +3 -2
  135. data/vendor/libgit2/include/git2/transport.h +11 -3
  136. data/vendor/libgit2/include/git2/tree.h +16 -5
  137. data/vendor/libgit2/include/git2/types.h +19 -3
  138. data/vendor/libgit2/include/git2/version.h +44 -8
  139. data/vendor/libgit2/include/git2/worktree.h +16 -6
  140. data/vendor/libgit2/src/CMakeLists.txt +6 -4
  141. data/vendor/libgit2/src/cli/CMakeLists.txt +2 -2
  142. data/vendor/libgit2/src/cli/cmd.c +1 -1
  143. data/vendor/libgit2/src/cli/cmd.h +4 -0
  144. data/vendor/libgit2/src/cli/cmd_blame.c +287 -0
  145. data/vendor/libgit2/src/cli/cmd_cat_file.c +6 -8
  146. data/vendor/libgit2/src/cli/cmd_clone.c +5 -7
  147. data/vendor/libgit2/src/cli/cmd_config.c +241 -0
  148. data/vendor/libgit2/src/cli/cmd_hash_object.c +6 -8
  149. data/vendor/libgit2/src/cli/cmd_help.c +6 -7
  150. data/vendor/libgit2/src/cli/cmd_index_pack.c +114 -0
  151. data/vendor/libgit2/src/cli/cmd_init.c +102 -0
  152. data/vendor/libgit2/src/cli/common.c +168 -0
  153. data/vendor/libgit2/src/cli/common.h +63 -0
  154. data/vendor/libgit2/src/cli/error.h +1 -1
  155. data/vendor/libgit2/src/cli/main.c +52 -24
  156. data/vendor/libgit2/src/cli/opt.c +29 -3
  157. data/vendor/libgit2/src/cli/opt.h +21 -3
  158. data/vendor/libgit2/src/cli/opt_usage.c +102 -33
  159. data/vendor/libgit2/src/cli/opt_usage.h +6 -1
  160. data/vendor/libgit2/src/cli/progress.c +51 -2
  161. data/vendor/libgit2/src/cli/progress.h +12 -0
  162. data/vendor/libgit2/src/cli/unix/sighandler.c +2 -1
  163. data/vendor/libgit2/src/cli/win32/precompiled.h +1 -1
  164. data/vendor/libgit2/src/cli/win32/sighandler.c +1 -1
  165. data/vendor/libgit2/src/libgit2/CMakeLists.txt +26 -8
  166. data/vendor/libgit2/src/libgit2/apply.c +10 -13
  167. data/vendor/libgit2/src/libgit2/attr.c +30 -13
  168. data/vendor/libgit2/src/libgit2/attr_file.c +7 -2
  169. data/vendor/libgit2/src/libgit2/attr_file.h +2 -0
  170. data/vendor/libgit2/src/libgit2/attrcache.c +69 -33
  171. data/vendor/libgit2/src/libgit2/attrcache.h +5 -9
  172. data/vendor/libgit2/src/libgit2/blame.c +130 -44
  173. data/vendor/libgit2/src/libgit2/blame.h +1 -0
  174. data/vendor/libgit2/src/libgit2/cache.c +22 -17
  175. data/vendor/libgit2/src/libgit2/cache.h +7 -9
  176. data/vendor/libgit2/src/libgit2/checkout.c +34 -24
  177. data/vendor/libgit2/src/libgit2/checkout.h +0 -2
  178. data/vendor/libgit2/src/libgit2/cherrypick.c +1 -2
  179. data/vendor/libgit2/src/libgit2/clone.c +186 -166
  180. data/vendor/libgit2/src/libgit2/clone.h +4 -1
  181. data/vendor/libgit2/src/libgit2/commit.c +92 -0
  182. data/vendor/libgit2/src/libgit2/commit_graph.c +67 -56
  183. data/vendor/libgit2/src/libgit2/commit_graph.h +1 -2
  184. data/vendor/libgit2/src/libgit2/config.c +389 -298
  185. data/vendor/libgit2/src/libgit2/config.cmake.in +3 -0
  186. data/vendor/libgit2/src/libgit2/config.h +9 -4
  187. data/vendor/libgit2/src/libgit2/config_backend.h +8 -10
  188. data/vendor/libgit2/src/libgit2/config_cache.c +4 -5
  189. data/vendor/libgit2/src/libgit2/config_file.c +99 -88
  190. data/vendor/libgit2/src/libgit2/config_list.c +285 -0
  191. data/vendor/libgit2/src/libgit2/config_list.h +32 -0
  192. data/vendor/libgit2/src/libgit2/config_mem.c +194 -40
  193. data/vendor/libgit2/src/libgit2/config_parse.c +10 -9
  194. data/vendor/libgit2/src/libgit2/config_snapshot.c +24 -31
  195. data/vendor/libgit2/src/libgit2/describe.c +24 -24
  196. data/vendor/libgit2/src/libgit2/diff.c +1 -1
  197. data/vendor/libgit2/src/libgit2/diff_driver.c +12 -19
  198. data/vendor/libgit2/src/libgit2/diff_driver.h +2 -2
  199. data/vendor/libgit2/src/libgit2/diff_generate.c +3 -3
  200. data/vendor/libgit2/src/libgit2/diff_parse.c +2 -2
  201. data/vendor/libgit2/src/libgit2/diff_print.c +65 -9
  202. data/vendor/libgit2/src/libgit2/diff_tform.c +36 -8
  203. data/vendor/libgit2/src/libgit2/email.c +1 -0
  204. data/vendor/libgit2/src/libgit2/fetch.c +5 -3
  205. data/vendor/libgit2/src/libgit2/filter.c +5 -5
  206. data/vendor/libgit2/src/libgit2/git2.rc +3 -3
  207. data/vendor/libgit2/src/libgit2/grafts.c +18 -20
  208. data/vendor/libgit2/src/libgit2/grafts.h +0 -1
  209. data/vendor/libgit2/src/libgit2/graph.c +1 -1
  210. data/vendor/libgit2/src/libgit2/hashmap_oid.h +30 -0
  211. data/vendor/libgit2/src/libgit2/ignore.c +9 -5
  212. data/vendor/libgit2/src/libgit2/index.c +68 -90
  213. data/vendor/libgit2/src/libgit2/index.h +2 -2
  214. data/vendor/libgit2/src/libgit2/index_map.c +95 -0
  215. data/vendor/libgit2/src/libgit2/index_map.h +28 -0
  216. data/vendor/libgit2/src/libgit2/indexer.c +34 -38
  217. data/vendor/libgit2/src/libgit2/iterator.c +14 -8
  218. data/vendor/libgit2/src/libgit2/libgit2.c +153 -368
  219. data/vendor/libgit2/src/libgit2/mailmap.c +1 -1
  220. data/vendor/libgit2/src/libgit2/merge.c +42 -37
  221. data/vendor/libgit2/src/libgit2/merge_driver.c +2 -2
  222. data/vendor/libgit2/src/libgit2/midx.c +28 -15
  223. data/vendor/libgit2/src/libgit2/mwindow.c +38 -45
  224. data/vendor/libgit2/src/libgit2/mwindow.h +4 -0
  225. data/vendor/libgit2/src/libgit2/object.c +6 -5
  226. data/vendor/libgit2/src/libgit2/odb.c +5 -4
  227. data/vendor/libgit2/src/libgit2/odb_mempack.c +49 -17
  228. data/vendor/libgit2/src/libgit2/odb_pack.c +13 -5
  229. data/vendor/libgit2/src/libgit2/oid.c +32 -5
  230. data/vendor/libgit2/src/libgit2/oid.h +11 -0
  231. data/vendor/libgit2/src/libgit2/pack-objects.c +58 -31
  232. data/vendor/libgit2/src/libgit2/pack-objects.h +12 -4
  233. data/vendor/libgit2/src/libgit2/pack.c +30 -24
  234. data/vendor/libgit2/src/libgit2/pack.h +15 -10
  235. data/vendor/libgit2/src/libgit2/patch_parse.c +2 -2
  236. data/vendor/libgit2/src/libgit2/path.c +1 -1
  237. data/vendor/libgit2/src/libgit2/pathspec.c +1 -1
  238. data/vendor/libgit2/src/libgit2/push.c +79 -28
  239. data/vendor/libgit2/src/libgit2/push.h +1 -0
  240. data/vendor/libgit2/src/libgit2/refdb_fs.c +128 -61
  241. data/vendor/libgit2/src/libgit2/reflog.c +1 -2
  242. data/vendor/libgit2/src/libgit2/reflog.h +2 -0
  243. data/vendor/libgit2/src/libgit2/refs.c +26 -7
  244. data/vendor/libgit2/src/libgit2/refs.h +6 -1
  245. data/vendor/libgit2/src/libgit2/refspec.c +28 -1
  246. data/vendor/libgit2/src/libgit2/refspec.h +8 -0
  247. data/vendor/libgit2/src/libgit2/remote.c +121 -61
  248. data/vendor/libgit2/src/libgit2/repository.c +231 -51
  249. data/vendor/libgit2/src/libgit2/repository.h +10 -6
  250. data/vendor/libgit2/src/libgit2/revert.c +1 -2
  251. data/vendor/libgit2/src/libgit2/revparse.c +2 -2
  252. data/vendor/libgit2/src/libgit2/revwalk.c +13 -10
  253. data/vendor/libgit2/src/libgit2/revwalk.h +3 -3
  254. data/vendor/libgit2/src/libgit2/settings.c +468 -0
  255. data/vendor/libgit2/src/libgit2/settings.h +6 -2
  256. data/vendor/libgit2/src/libgit2/signature.c +132 -15
  257. data/vendor/libgit2/src/libgit2/signature.h +0 -1
  258. data/vendor/libgit2/src/libgit2/status.c +1 -1
  259. data/vendor/libgit2/src/libgit2/streams/mbedtls.c +54 -60
  260. data/vendor/libgit2/src/libgit2/streams/openssl.c +32 -7
  261. data/vendor/libgit2/src/libgit2/streams/openssl.h +2 -0
  262. data/vendor/libgit2/src/libgit2/streams/openssl_dynamic.c +4 -0
  263. data/vendor/libgit2/src/libgit2/streams/openssl_dynamic.h +3 -0
  264. data/vendor/libgit2/src/libgit2/streams/stransport.c +39 -7
  265. data/vendor/libgit2/src/libgit2/submodule.c +106 -63
  266. data/vendor/libgit2/src/libgit2/submodule.h +6 -7
  267. data/vendor/libgit2/src/libgit2/tag.c +1 -1
  268. data/vendor/libgit2/src/libgit2/trailer.c +6 -6
  269. data/vendor/libgit2/src/libgit2/transaction.c +26 -20
  270. data/vendor/libgit2/src/libgit2/transaction.h +4 -1
  271. data/vendor/libgit2/src/libgit2/transport.c +4 -1
  272. data/vendor/libgit2/src/libgit2/transports/credential.c +1 -1
  273. data/vendor/libgit2/src/libgit2/transports/http.c +1 -2
  274. data/vendor/libgit2/src/libgit2/transports/http.h +0 -10
  275. data/vendor/libgit2/src/libgit2/transports/httpclient.c +112 -72
  276. data/vendor/libgit2/src/libgit2/transports/httpparser.c +128 -0
  277. data/vendor/libgit2/src/libgit2/transports/httpparser.h +99 -0
  278. data/vendor/libgit2/src/libgit2/transports/local.c +8 -7
  279. data/vendor/libgit2/src/libgit2/transports/smart.c +20 -8
  280. data/vendor/libgit2/src/libgit2/transports/smart.h +4 -2
  281. data/vendor/libgit2/src/libgit2/transports/smart_pkt.c +2 -2
  282. data/vendor/libgit2/src/libgit2/transports/smart_protocol.c +55 -10
  283. data/vendor/libgit2/src/libgit2/transports/ssh.c +41 -1103
  284. data/vendor/libgit2/src/libgit2/transports/ssh_exec.c +347 -0
  285. data/vendor/libgit2/src/libgit2/transports/ssh_exec.h +26 -0
  286. data/vendor/libgit2/src/libgit2/transports/ssh_libssh2.c +1126 -0
  287. data/vendor/libgit2/src/libgit2/transports/ssh_libssh2.h +28 -0
  288. data/vendor/libgit2/src/libgit2/transports/winhttp.c +35 -7
  289. data/vendor/libgit2/src/libgit2/tree.c +34 -26
  290. data/vendor/libgit2/src/libgit2/tree.h +3 -2
  291. data/vendor/libgit2/src/libgit2/worktree.c +14 -17
  292. data/vendor/libgit2/src/util/CMakeLists.txt +4 -6
  293. data/vendor/libgit2/src/util/alloc.c +4 -1
  294. data/vendor/libgit2/src/util/allocators/debugalloc.c +73 -0
  295. data/vendor/libgit2/src/{cli/cli.h → util/allocators/debugalloc.h} +6 -9
  296. data/vendor/libgit2/src/util/allocators/stdalloc.c +0 -10
  297. data/vendor/libgit2/src/util/array.h +18 -17
  298. data/vendor/libgit2/src/util/cc-compat.h +2 -0
  299. data/vendor/libgit2/src/util/ctype_compat.h +70 -0
  300. data/vendor/libgit2/src/util/date.c +22 -14
  301. data/vendor/libgit2/src/util/date.h +12 -0
  302. data/vendor/libgit2/src/util/errors.c +401 -0
  303. data/vendor/libgit2/src/{libgit2 → util}/errors.h +21 -17
  304. data/vendor/libgit2/src/util/fs_path.c +15 -4
  305. data/vendor/libgit2/src/util/fs_path.h +23 -0
  306. data/vendor/libgit2/src/util/futils.c +6 -5
  307. data/vendor/libgit2/src/util/futils.h +13 -4
  308. data/vendor/libgit2/src/util/git2_features.h.in +12 -1
  309. data/vendor/libgit2/src/util/git2_util.h +6 -0
  310. data/vendor/libgit2/src/util/hash/openssl.c +152 -0
  311. data/vendor/libgit2/src/util/hash/openssl.h +17 -1
  312. data/vendor/libgit2/src/util/hash/sha.h +4 -1
  313. data/vendor/libgit2/src/util/hashmap.h +424 -0
  314. data/vendor/libgit2/src/util/hashmap_str.h +43 -0
  315. data/vendor/libgit2/src/util/integer.h +3 -1
  316. data/vendor/libgit2/src/util/net.c +13 -7
  317. data/vendor/libgit2/src/util/net.h +2 -0
  318. data/vendor/libgit2/src/util/pool.c +1 -1
  319. data/vendor/libgit2/src/util/pool.h +5 -0
  320. data/vendor/libgit2/src/util/pqueue.h +1 -1
  321. data/vendor/libgit2/src/util/process.h +222 -0
  322. data/vendor/libgit2/src/util/rand.c +1 -7
  323. data/vendor/libgit2/src/util/regexp.c +1 -1
  324. data/vendor/libgit2/src/util/sortedcache.c +14 -13
  325. data/vendor/libgit2/src/util/sortedcache.h +3 -3
  326. data/vendor/libgit2/src/util/str.c +2 -2
  327. data/vendor/libgit2/src/util/strlist.c +108 -0
  328. data/vendor/libgit2/src/util/strlist.h +36 -0
  329. data/vendor/libgit2/src/util/unix/posix.h +0 -2
  330. data/vendor/libgit2/src/util/unix/process.c +629 -0
  331. data/vendor/libgit2/src/util/unix/realpath.c +23 -5
  332. data/vendor/libgit2/src/util/util.c +2 -2
  333. data/vendor/libgit2/src/util/util.h +4 -38
  334. data/vendor/libgit2/src/util/vector.c +3 -3
  335. data/vendor/libgit2/src/util/vector.h +2 -2
  336. data/vendor/libgit2/src/util/win32/posix_w32.c +29 -6
  337. data/vendor/libgit2/src/util/win32/process.c +506 -0
  338. metadata +45 -28
  339. data/vendor/libgit2/deps/http-parser/CMakeLists.txt +0 -6
  340. data/vendor/libgit2/deps/http-parser/COPYING +0 -23
  341. data/vendor/libgit2/deps/http-parser/http_parser.c +0 -2182
  342. data/vendor/libgit2/deps/http-parser/http_parser.h +0 -305
  343. data/vendor/libgit2/deps/zlib/COPYING +0 -27
  344. data/vendor/libgit2/include/git2/sys/reflog.h +0 -21
  345. data/vendor/libgit2/src/libgit2/config_entries.c +0 -237
  346. data/vendor/libgit2/src/libgit2/config_entries.h +0 -24
  347. data/vendor/libgit2/src/libgit2/errors.c +0 -293
  348. data/vendor/libgit2/src/libgit2/idxmap.c +0 -157
  349. data/vendor/libgit2/src/libgit2/idxmap.h +0 -177
  350. data/vendor/libgit2/src/libgit2/libgit2.h +0 -15
  351. data/vendor/libgit2/src/libgit2/offmap.c +0 -101
  352. data/vendor/libgit2/src/libgit2/offmap.h +0 -133
  353. data/vendor/libgit2/src/libgit2/oidmap.c +0 -107
  354. data/vendor/libgit2/src/libgit2/oidmap.h +0 -128
  355. data/vendor/libgit2/src/libgit2/threadstate.c +0 -97
  356. data/vendor/libgit2/src/libgit2/threadstate.h +0 -22
  357. data/vendor/libgit2/src/libgit2/transports/ssh.h +0 -14
  358. data/vendor/libgit2/src/util/khash.h +0 -615
  359. data/vendor/libgit2/src/util/strmap.c +0 -100
  360. data/vendor/libgit2/src/util/strmap.h +0 -131
  361. /data/vendor/libgit2/cmake/{FindHTTPParser.cmake → FindHTTP_Parser.cmake} +0 -0
@@ -34,7 +34,6 @@
34
34
  #include "submodule.h"
35
35
  #include "worktree.h"
36
36
  #include "path.h"
37
- #include "strmap.h"
38
37
 
39
38
  #ifdef GIT_WIN32
40
39
  # include "win32/w32_util.h"
@@ -62,7 +61,8 @@ static const struct {
62
61
  { GIT_REPOSITORY_ITEM_COMMONDIR, GIT_REPOSITORY_ITEM_GITDIR, "hooks", true },
63
62
  { GIT_REPOSITORY_ITEM_COMMONDIR, GIT_REPOSITORY_ITEM_GITDIR, "logs", true },
64
63
  { GIT_REPOSITORY_ITEM_GITDIR, GIT_REPOSITORY_ITEM__LAST, "modules", true },
65
- { GIT_REPOSITORY_ITEM_COMMONDIR, GIT_REPOSITORY_ITEM_GITDIR, "worktrees", true }
64
+ { GIT_REPOSITORY_ITEM_COMMONDIR, GIT_REPOSITORY_ITEM_GITDIR, "worktrees", true },
65
+ { GIT_REPOSITORY_ITEM_GITDIR, GIT_REPOSITORY_ITEM_GITDIR, "config.worktree", false }
66
66
  };
67
67
 
68
68
  static int check_repositoryformatversion(int *version, git_config *config);
@@ -328,19 +328,34 @@ on_error:
328
328
  return NULL;
329
329
  }
330
330
 
331
- int git_repository_new(git_repository **out)
331
+ int git_repository__new(git_repository **out, git_oid_t oid_type)
332
332
  {
333
333
  git_repository *repo;
334
334
 
335
335
  *out = repo = repository_alloc();
336
336
  GIT_ERROR_CHECK_ALLOC(repo);
337
337
 
338
+ GIT_ASSERT_ARG(git_oid_type_is_valid(oid_type));
339
+
338
340
  repo->is_bare = 1;
339
341
  repo->is_worktree = 0;
342
+ repo->oid_type = oid_type;
340
343
 
341
344
  return 0;
342
345
  }
343
346
 
347
+ #ifdef GIT_EXPERIMENTAL_SHA256
348
+ int git_repository_new(git_repository **out, git_repository_new_options *opts)
349
+ {
350
+ return git_repository__new(out, opts && opts->oid_type ? opts->oid_type : GIT_OID_DEFAULT);
351
+ }
352
+ #else
353
+ int git_repository_new(git_repository** out)
354
+ {
355
+ return git_repository__new(out, GIT_OID_SHA1);
356
+ }
357
+ #endif
358
+
344
359
  static int load_config_data(git_repository *repo, const git_config *config)
345
360
  {
346
361
  int is_bare;
@@ -545,25 +560,39 @@ typedef struct {
545
560
  static int validate_ownership_cb(const git_config_entry *entry, void *payload)
546
561
  {
547
562
  validate_ownership_data *data = payload;
563
+ const char *test_path;
548
564
 
549
565
  if (strcmp(entry->value, "") == 0) {
550
566
  *data->is_safe = false;
551
567
  } else if (strcmp(entry->value, "*") == 0) {
552
568
  *data->is_safe = true;
553
569
  } else {
554
- const char *test_path = entry->value;
570
+ if (git_str_sets(&data->tmp, entry->value) < 0)
571
+ return -1;
572
+
573
+ if (!git_fs_path_is_root(data->tmp.ptr)) {
574
+ /* Input must not have trailing backslash. */
575
+ if (!data->tmp.size ||
576
+ data->tmp.ptr[data->tmp.size - 1] == '/')
577
+ return 0;
578
+
579
+ if (git_fs_path_to_dir(&data->tmp) < 0)
580
+ return -1;
581
+ }
582
+
583
+ test_path = data->tmp.ptr;
555
584
 
556
- #ifdef GIT_WIN32
557
585
  /*
558
- * Git for Windows does some truly bizarre things with
559
- * paths that start with a forward slash; and expects you
560
- * to escape that with `%(prefix)`. This syntax generally
561
- * means to add the prefix that Git was installed to -- eg
562
- * `/usr/local` -- unless it's an absolute path, in which
563
- * case the leading `%(prefix)/` is just removed. And Git
564
- * for Windows expects you to use this syntax for absolute
565
- * Unix-style paths (in "Git Bash" or Windows Subsystem for
566
- * Linux).
586
+ * Git - and especially, Git for Windows - does some
587
+ * truly bizarre things with paths that start with a
588
+ * forward slash; and expects you to escape that with
589
+ * `%(prefix)`. This syntax generally means to add the
590
+ * prefix that Git was installed to (eg `/usr/local`)
591
+ * unless it's an absolute path, in which case the
592
+ * leading `%(prefix)/` is just removed. And Git for
593
+ * Windows expects you to use this syntax for absolute
594
+ * Unix-style paths (in "Git Bash" or Windows Subsystem
595
+ * for Linux).
567
596
  *
568
597
  * Worse, the behavior used to be that a leading `/` was
569
598
  * not absolute. It would indicate that Git for Windows
@@ -578,13 +607,8 @@ static int validate_ownership_cb(const git_config_entry *entry, void *payload)
578
607
  */
579
608
  if (strncmp(test_path, "%(prefix)//", strlen("%(prefix)//")) == 0)
580
609
  test_path += strlen("%(prefix)/");
581
- else if (strncmp(test_path, "//", 2) == 0 &&
582
- strncmp(test_path, "//wsl.localhost/", strlen("//wsl.localhost/")) != 0)
583
- test_path++;
584
- #endif
585
610
 
586
- if (git_fs_path_prettify_dir(&data->tmp, test_path, NULL) == 0 &&
587
- strcmp(data->tmp.ptr, data->repo_path) == 0)
611
+ if (strcmp(test_path, data->repo_path) == 0)
588
612
  *data->is_safe = true;
589
613
  }
590
614
 
@@ -681,9 +705,12 @@ static int validate_ownership(git_repository *repo)
681
705
  goto done;
682
706
 
683
707
  if (!is_safe) {
708
+ size_t path_len = git_fs_path_is_root(path) ?
709
+ strlen(path) : git_fs_path_dirlen(path);
710
+
684
711
  git_error_set(GIT_ERROR_CONFIG,
685
- "repository path '%s' is not owned by current user",
686
- path);
712
+ "repository path '%.*s' is not owned by current user",
713
+ (int)min(path_len, INT_MAX), path);
687
714
  error = GIT_EOWNER;
688
715
  }
689
716
 
@@ -852,8 +879,30 @@ static int load_grafts(git_repository *repo)
852
879
  git_str path = GIT_STR_INIT;
853
880
  int error;
854
881
 
855
- if ((error = git_repository__item_path(&path, repo, GIT_REPOSITORY_ITEM_INFO)) < 0 ||
856
- (error = git_str_joinpath(&path, path.ptr, "grafts")) < 0 ||
882
+ /* refresh if they've both been opened previously */
883
+ if (repo->grafts && repo->shallow_grafts) {
884
+ if ((error = git_grafts_refresh(repo->grafts)) < 0 ||
885
+ (error = git_grafts_refresh(repo->shallow_grafts)) < 0)
886
+ return error;
887
+ }
888
+
889
+ /* resolve info path, which may not be found for inmemory repository */
890
+ if ((error = git_repository__item_path(&path, repo, GIT_REPOSITORY_ITEM_INFO)) < 0) {
891
+ if (error != GIT_ENOTFOUND)
892
+ return error;
893
+
894
+ /* create empty/inmemory grafts for inmemory repository */
895
+ if (!repo->grafts && (error = git_grafts_new(&repo->grafts, repo->oid_type)) < 0)
896
+ return error;
897
+
898
+ if (!repo->shallow_grafts && (error = git_grafts_new(&repo->shallow_grafts, repo->oid_type)) < 0)
899
+ return error;
900
+
901
+ return 0;
902
+ }
903
+
904
+ /* load grafts from disk */
905
+ if ((error = git_str_joinpath(&path, path.ptr, "grafts")) < 0 ||
857
906
  (error = git_grafts_open_or_refresh(&repo->grafts, path.ptr, repo->oid_type)) < 0)
858
907
  goto error;
859
908
 
@@ -1174,17 +1223,15 @@ out:
1174
1223
  return err;
1175
1224
  }
1176
1225
 
1177
- int git_repository__wrap_odb(
1178
- git_repository **out,
1179
- git_odb *odb,
1180
- git_oid_t oid_type)
1226
+ int git_repository_wrap_odb(git_repository **out, git_odb *odb)
1181
1227
  {
1182
1228
  git_repository *repo;
1183
1229
 
1184
1230
  repo = repository_alloc();
1185
1231
  GIT_ERROR_CHECK_ALLOC(repo);
1186
1232
 
1187
- repo->oid_type = oid_type;
1233
+ GIT_ASSERT(git_oid_type_is_valid(odb->options.oid_type));
1234
+ repo->oid_type = odb->options.oid_type;
1188
1235
 
1189
1236
  git_repository_set_odb(repo, odb);
1190
1237
  *out = repo;
@@ -1192,21 +1239,6 @@ int git_repository__wrap_odb(
1192
1239
  return 0;
1193
1240
  }
1194
1241
 
1195
- #ifdef GIT_EXPERIMENTAL_SHA256
1196
- int git_repository_wrap_odb(
1197
- git_repository **out,
1198
- git_odb *odb,
1199
- git_oid_t oid_type)
1200
- {
1201
- return git_repository__wrap_odb(out, odb, oid_type);
1202
- }
1203
- #else
1204
- int git_repository_wrap_odb(git_repository **out, git_odb *odb)
1205
- {
1206
- return git_repository__wrap_odb(out, odb, GIT_OID_DEFAULT);
1207
- }
1208
- #endif
1209
-
1210
1242
  int git_repository_discover(
1211
1243
  git_buf *out,
1212
1244
  const char *start_path,
@@ -1226,6 +1258,24 @@ int git_repository_discover(
1226
1258
  return error;
1227
1259
  }
1228
1260
 
1261
+ static int has_config_worktree(bool *out, git_config *cfg)
1262
+ {
1263
+ int worktreeconfig = 0, error;
1264
+
1265
+ *out = false;
1266
+
1267
+ error = git_config_get_bool(&worktreeconfig, cfg, "extensions.worktreeconfig");
1268
+
1269
+ if (error == 0)
1270
+ *out = worktreeconfig;
1271
+ else if (error == GIT_ENOTFOUND)
1272
+ *out = false;
1273
+ else
1274
+ return error;
1275
+
1276
+ return 0;
1277
+ }
1278
+
1229
1279
  static int load_config(
1230
1280
  git_config **out,
1231
1281
  git_repository *repo,
@@ -1234,9 +1284,11 @@ static int load_config(
1234
1284
  const char *system_config_path,
1235
1285
  const char *programdata_path)
1236
1286
  {
1237
- int error;
1238
1287
  git_str config_path = GIT_STR_INIT;
1239
1288
  git_config *cfg = NULL;
1289
+ git_config_level_t write_order;
1290
+ bool has_worktree;
1291
+ int error;
1240
1292
 
1241
1293
  GIT_ASSERT_ARG(out);
1242
1294
 
@@ -1250,6 +1302,14 @@ static int load_config(
1250
1302
  if (error && error != GIT_ENOTFOUND)
1251
1303
  goto on_error;
1252
1304
 
1305
+ if ((error = has_config_worktree(&has_worktree, cfg)) == 0 &&
1306
+ has_worktree &&
1307
+ (error = git_repository__item_path(&config_path, repo, GIT_REPOSITORY_ITEM_WORKTREE_CONFIG)) == 0)
1308
+ error = git_config_add_file_ondisk(cfg, config_path.ptr, GIT_CONFIG_LEVEL_WORKTREE, repo, 0);
1309
+
1310
+ if (error && error != GIT_ENOTFOUND)
1311
+ goto on_error;
1312
+
1253
1313
  git_str_dispose(&config_path);
1254
1314
  }
1255
1315
 
@@ -1279,6 +1339,11 @@ static int load_config(
1279
1339
 
1280
1340
  git_error_clear(); /* clear any lingering ENOTFOUND errors */
1281
1341
 
1342
+ write_order = GIT_CONFIG_LEVEL_LOCAL;
1343
+
1344
+ if ((error = git_config_set_writeorder(cfg, &write_order, 1)) < 0)
1345
+ goto on_error;
1346
+
1282
1347
  *out = cfg;
1283
1348
  return 0;
1284
1349
 
@@ -1798,7 +1863,9 @@ static int check_repositoryformatversion(int *version, git_config *config)
1798
1863
 
1799
1864
  static const char *builtin_extensions[] = {
1800
1865
  "noop",
1801
- "objectformat"
1866
+ "objectformat",
1867
+ "worktreeconfig",
1868
+ "preciousobjects"
1802
1869
  };
1803
1870
 
1804
1871
  static git_vector user_extensions = { 0, git__strcmp_cb };
@@ -2024,7 +2091,7 @@ int git_repository__set_extensions(const char **extensions, size_t len)
2024
2091
 
2025
2092
  void git_repository__free_extensions(void)
2026
2093
  {
2027
- git_vector_free_deep(&user_extensions);
2094
+ git_vector_dispose_deep(&user_extensions);
2028
2095
  }
2029
2096
 
2030
2097
  int git_repository_create_head(const char *git_dir, const char *ref_name)
@@ -2439,7 +2506,7 @@ static int repo_write_gitlink(
2439
2506
  error = git_fs_path_make_relative(&path_to_repo, in_dir);
2440
2507
 
2441
2508
  if (!error)
2442
- error = git_str_join(&buf, ' ', GIT_FILE_CONTENT_PREFIX, path_to_repo.ptr);
2509
+ error = git_str_printf(&buf, "%s %s\n", GIT_FILE_CONTENT_PREFIX, path_to_repo.ptr);
2443
2510
 
2444
2511
  if (!error)
2445
2512
  error = repo_write_template(in_dir, true, DOT_GIT, 0666, true, buf.ptr);
@@ -2471,7 +2538,8 @@ static int repo_init_structure(
2471
2538
  int error = 0;
2472
2539
  repo_template_item *tpl;
2473
2540
  bool external_tpl =
2474
- ((opts->flags & GIT_REPOSITORY_INIT_EXTERNAL_TEMPLATE) != 0);
2541
+ opts->template_path != NULL ||
2542
+ (opts->flags & GIT_REPOSITORY_INIT_EXTERNAL_TEMPLATE) != 0;
2475
2543
  mode_t dmode = pick_dir_mode(opts);
2476
2544
  bool chmod = opts->mode != GIT_REPOSITORY_INIT_SHARED_UMASK;
2477
2545
 
@@ -2630,6 +2698,8 @@ static int repo_init_directories(
2630
2698
  if (git_str_joinpath(repo_path, given_repo, add_dotgit ? GIT_DIR : "") < 0)
2631
2699
  return -1;
2632
2700
 
2701
+ git_fs_path_mkposix(repo_path->ptr);
2702
+
2633
2703
  has_dotgit = (git__suffixcmp(repo_path->ptr, "/" GIT_DIR) == 0);
2634
2704
  if (has_dotgit)
2635
2705
  opts->flags |= GIT_REPOSITORY_INIT__HAS_DOTGIT;
@@ -3197,14 +3267,18 @@ int git_repository_set_workdir(
3197
3267
  if (git_fs_path_prettify_dir(&path, workdir, NULL) < 0)
3198
3268
  return -1;
3199
3269
 
3200
- if (repo->workdir && strcmp(repo->workdir, path.ptr) == 0)
3270
+ if (repo->workdir && strcmp(repo->workdir, path.ptr) == 0) {
3271
+ git_str_dispose(&path);
3201
3272
  return 0;
3273
+ }
3202
3274
 
3203
3275
  if (update_gitlink) {
3204
3276
  git_config *config;
3205
3277
 
3206
- if (git_repository_config__weakptr(&config, repo) < 0)
3278
+ if (git_repository_config__weakptr(&config, repo) < 0) {
3279
+ git_str_dispose(&path);
3207
3280
  return -1;
3281
+ }
3208
3282
 
3209
3283
  error = repo_write_gitlink(path.ptr, git_repository_path(repo), false);
3210
3284
 
@@ -3226,6 +3300,7 @@ int git_repository_set_workdir(
3226
3300
 
3227
3301
  git__free(old_workdir);
3228
3302
  }
3303
+ git_str_dispose(&path);
3229
3304
 
3230
3305
  return error;
3231
3306
  }
@@ -3268,6 +3343,25 @@ int git_repository_set_bare(git_repository *repo)
3268
3343
  return 0;
3269
3344
  }
3270
3345
 
3346
+ int git_repository_head_commit(git_commit **commit, git_repository *repo)
3347
+ {
3348
+ git_reference *head;
3349
+ git_object *obj;
3350
+ int error;
3351
+
3352
+ if ((error = git_repository_head(&head, repo)) < 0)
3353
+ return error;
3354
+
3355
+ if ((error = git_reference_peel(&obj, head, GIT_OBJECT_COMMIT)) < 0)
3356
+ goto cleanup;
3357
+
3358
+ *commit = (git_commit *)obj;
3359
+
3360
+ cleanup:
3361
+ git_reference_free(head);
3362
+ return error;
3363
+ }
3364
+
3271
3365
  int git_repository_head_tree(git_tree **tree, git_repository *repo)
3272
3366
  {
3273
3367
  git_reference *head;
@@ -3839,3 +3933,89 @@ git_oid_t git_repository_oid_type(git_repository *repo)
3839
3933
  {
3840
3934
  return repo ? repo->oid_type : 0;
3841
3935
  }
3936
+
3937
+ struct mergehead_data {
3938
+ git_repository *repo;
3939
+ git_vector *parents;
3940
+ };
3941
+
3942
+ static int insert_mergehead(const git_oid *oid, void *payload)
3943
+ {
3944
+ git_commit *commit;
3945
+ struct mergehead_data *data = (struct mergehead_data *)payload;
3946
+
3947
+ if (git_commit_lookup(&commit, data->repo, oid) < 0)
3948
+ return -1;
3949
+
3950
+ return git_vector_insert(data->parents, commit);
3951
+ }
3952
+
3953
+ int git_repository_commit_parents(git_commitarray *out, git_repository *repo)
3954
+ {
3955
+ git_commit *first_parent = NULL, *commit;
3956
+ git_reference *head_ref = NULL;
3957
+ git_vector parents = GIT_VECTOR_INIT;
3958
+ struct mergehead_data data;
3959
+ size_t i;
3960
+ int error;
3961
+
3962
+ GIT_ASSERT_ARG(out && repo);
3963
+
3964
+ out->count = 0;
3965
+ out->commits = NULL;
3966
+
3967
+ error = git_revparse_ext((git_object **)&first_parent, &head_ref, repo, "HEAD");
3968
+
3969
+ if (error != 0) {
3970
+ if (error == GIT_ENOTFOUND)
3971
+ error = 0;
3972
+
3973
+ goto done;
3974
+ }
3975
+
3976
+ if ((error = git_vector_insert(&parents, first_parent)) < 0)
3977
+ goto done;
3978
+
3979
+ data.repo = repo;
3980
+ data.parents = &parents;
3981
+
3982
+ error = git_repository_mergehead_foreach(repo, insert_mergehead, &data);
3983
+
3984
+ if (error == GIT_ENOTFOUND)
3985
+ error = 0;
3986
+ else if (error != 0)
3987
+ goto done;
3988
+
3989
+ out->commits = (git_commit **)git_vector_detach(&out->count, NULL, &parents);
3990
+
3991
+ done:
3992
+ git_vector_foreach(&parents, i, commit)
3993
+ git__free(commit);
3994
+
3995
+ git_reference_free(head_ref);
3996
+ return error;
3997
+ }
3998
+
3999
+ int git_repository__abbrev_length(int *out, git_repository *repo)
4000
+ {
4001
+ size_t oid_hexsize;
4002
+ int len;
4003
+ int error;
4004
+
4005
+ oid_hexsize = git_oid_hexsize(repo->oid_type);
4006
+
4007
+ if ((error = git_repository__configmap_lookup(&len, repo, GIT_CONFIGMAP_ABBREV)) < 0)
4008
+ return error;
4009
+
4010
+ if (len < GIT_ABBREV_MINIMUM) {
4011
+ git_error_set(GIT_ERROR_CONFIG, "invalid oid abbreviation setting: '%d'", len);
4012
+ return -1;
4013
+ }
4014
+
4015
+ if (len == GIT_ABBREV_FALSE || (size_t)len > oid_hexsize)
4016
+ len = (int)oid_hexsize;
4017
+
4018
+ *out = len;
4019
+
4020
+ return error;
4021
+ }
@@ -102,6 +102,8 @@ typedef enum {
102
102
  /* core.trustctime */
103
103
  GIT_TRUSTCTIME_DEFAULT = GIT_CONFIGMAP_TRUE,
104
104
  /* core.abbrev */
105
+ GIT_ABBREV_FALSE = GIT_OID_MAX_HEXSIZE,
106
+ GIT_ABBREV_MINIMUM = 4,
105
107
  GIT_ABBREV_DEFAULT = 7,
106
108
  /* core.precomposeunicode */
107
109
  GIT_PRECOMPOSE_DEFAULT = GIT_CONFIGMAP_FALSE,
@@ -165,7 +167,7 @@ struct git_repository {
165
167
  git_atomic32 attr_session_key;
166
168
 
167
169
  intptr_t configmap_cache[GIT_CONFIGMAP_CACHE_MAX];
168
- git_strmap *submodule_cache;
170
+ git_submodule_cache *submodule_cache;
169
171
  };
170
172
 
171
173
  GIT_INLINE(git_attr_cache *) git_repository_attr_cache(git_repository *repo)
@@ -173,6 +175,7 @@ GIT_INLINE(git_attr_cache *) git_repository_attr_cache(git_repository *repo)
173
175
  return repo->attrcache;
174
176
  }
175
177
 
178
+ int git_repository_head_commit(git_commit **commit, git_repository *repo);
176
179
  int git_repository_head_tree(git_tree **tree, git_repository *repo);
177
180
  int git_repository_create_head(const char *git_dir, const char *ref_name);
178
181
 
@@ -196,11 +199,6 @@ int git_repository_index__weakptr(git_index **out, git_repository *repo);
196
199
  int git_repository_grafts__weakptr(git_grafts **out, git_repository *repo);
197
200
  int git_repository_shallow_grafts__weakptr(git_grafts **out, git_repository *repo);
198
201
 
199
- int git_repository__wrap_odb(
200
- git_repository **out,
201
- git_odb *odb,
202
- git_oid_t oid_type);
203
-
204
202
  /*
205
203
  * Configuration map cache
206
204
  *
@@ -210,6 +208,9 @@ int git_repository__wrap_odb(
210
208
  int git_repository__configmap_lookup(int *out, git_repository *repo, git_configmap_item item);
211
209
  void git_repository__configmap_lookup_cache_clear(git_repository *repo);
212
210
 
211
+ /** Return the length that object names will be abbreviated to. */
212
+ int git_repository__abbrev_length(int *out, git_repository *repo);
213
+
213
214
  int git_repository__item_path(git_str *out, const git_repository *repo, git_repository_item_t item);
214
215
 
215
216
  GIT_INLINE(int) git_repository__ensure_not_bare(
@@ -280,4 +281,7 @@ int git_repository__set_objectformat(
280
281
  git_repository *repo,
281
282
  git_oid_t oid_type);
282
283
 
284
+ /* SHA256-aware internal functions */
285
+ int git_repository__new(git_repository **out, git_oid_t oid_type);
286
+
283
287
  #endif
@@ -74,8 +74,7 @@ static int revert_normalize_opts(
74
74
  const char *their_label)
75
75
  {
76
76
  int error = 0;
77
- unsigned int default_checkout_strategy = GIT_CHECKOUT_SAFE |
78
- GIT_CHECKOUT_ALLOW_CONFLICTS;
77
+ unsigned int default_checkout_strategy = GIT_CHECKOUT_ALLOW_CONFLICTS;
79
78
 
80
79
  GIT_UNUSED(repo);
81
80
 
@@ -816,7 +816,7 @@ static int revparse(
816
816
  if (temp_object != NULL)
817
817
  base_rev = temp_object;
818
818
  break;
819
- } else if (spec[pos+1] == '\0') {
819
+ } else if (spec[pos + 1] == '\0' && !pos) {
820
820
  spec = "HEAD";
821
821
  identifier_len = 4;
822
822
  parsed = true;
@@ -935,7 +935,7 @@ int git_revparse(
935
935
  * allowed.
936
936
  */
937
937
  if (!git__strcmp(spec, "..")) {
938
- git_error_set(GIT_ERROR_INVALID, "Invalid pattern '..'");
938
+ git_error_set(GIT_ERROR_INVALID, "invalid pattern '..'");
939
939
  return GIT_EINVALIDSPEC;
940
940
  }
941
941
 
@@ -14,6 +14,9 @@
14
14
  #include "git2/revparse.h"
15
15
  #include "merge.h"
16
16
  #include "vector.h"
17
+ #include "hashmap_oid.h"
18
+
19
+ GIT_HASHMAP_OID_FUNCTIONS(git_revwalk_oidmap, GIT_HASHMAP_INLINE, git_commit_list_node *);
17
20
 
18
21
  static int get_revision(git_commit_list_node **out, git_revwalk *walk, git_commit_list **list);
19
22
 
@@ -23,7 +26,7 @@ git_commit_list_node *git_revwalk__commit_lookup(
23
26
  git_commit_list_node *commit;
24
27
 
25
28
  /* lookup and reserve space if not already present */
26
- if ((commit = git_oidmap_get(walk->commits, oid)) != NULL)
29
+ if (git_revwalk_oidmap_get(&commit, &walk->commits, oid) == 0)
27
30
  return commit;
28
31
 
29
32
  commit = git_commit_list_alloc_node(walk);
@@ -32,7 +35,7 @@ git_commit_list_node *git_revwalk__commit_lookup(
32
35
 
33
36
  git_oid_cpy(&commit->oid, oid);
34
37
 
35
- if ((git_oidmap_set(walk->commits, &commit->oid, commit)) < 0)
38
+ if (git_revwalk_oidmap_put(&walk->commits, &commit->oid, commit) < 0)
36
39
  return NULL;
37
40
 
38
41
  return commit;
@@ -623,7 +626,7 @@ static int prepare_walk(git_revwalk *walk)
623
626
  return GIT_ITEROVER;
624
627
  }
625
628
 
626
- /*
629
+ /*
627
630
  * This is a bit convoluted, but necessary to maintain the order of
628
631
  * the commits. This is especially important in situations where
629
632
  * git_revwalk__push_glob is called with a git_revwalk__push_options
@@ -643,13 +646,13 @@ static int prepare_walk(git_revwalk *walk)
643
646
  git_error_set_oom();
644
647
  return -1;
645
648
  }
646
-
649
+
647
650
  commit->seen = 1;
648
651
  if (commits_last == NULL)
649
652
  commits = new_list;
650
653
  else
651
654
  commits_last->next = new_list;
652
-
655
+
653
656
  commits_last = new_list;
654
657
  }
655
658
  }
@@ -700,8 +703,7 @@ int git_revwalk_new(git_revwalk **revwalk_out, git_repository *repo)
700
703
  git_revwalk *walk = git__calloc(1, sizeof(git_revwalk));
701
704
  GIT_ERROR_CHECK_ALLOC(walk);
702
705
 
703
- if (git_oidmap_new(&walk->commits) < 0 ||
704
- git_pqueue_init(&walk->iterator_time, 0, 8, git_commit_list_time_cmp) < 0 ||
706
+ if (git_pqueue_init(&walk->iterator_time, 0, 8, git_commit_list_time_cmp) < 0 ||
705
707
  git_pool_init(&walk->commit_pool, COMMIT_ALLOC) < 0)
706
708
  return -1;
707
709
 
@@ -727,7 +729,7 @@ void git_revwalk_free(git_revwalk *walk)
727
729
  git_revwalk_reset(walk);
728
730
  git_odb_free(walk->odb);
729
731
 
730
- git_oidmap_free(walk->commits);
732
+ git_revwalk_oidmap_dispose(&walk->commits);
731
733
  git_pool_clear(&walk->commit_pool);
732
734
  git_pqueue_free(&walk->iterator_time);
733
735
  git__free(walk);
@@ -799,17 +801,18 @@ int git_revwalk_next(git_oid *oid, git_revwalk *walk)
799
801
  int git_revwalk_reset(git_revwalk *walk)
800
802
  {
801
803
  git_commit_list_node *commit;
804
+ git_hashmap_iter_t iter = GIT_HASHMAP_ITER_INIT;
802
805
 
803
806
  GIT_ASSERT_ARG(walk);
804
807
 
805
- git_oidmap_foreach_value(walk->commits, commit, {
808
+ while (git_revwalk_oidmap_iterate(&iter, NULL, &commit, &walk->commits) == 0) {
806
809
  commit->seen = 0;
807
810
  commit->in_degree = 0;
808
811
  commit->topo_delay = 0;
809
812
  commit->uninteresting = 0;
810
813
  commit->added = 0;
811
814
  commit->flags = 0;
812
- });
815
+ }
813
816
 
814
817
  git_pqueue_clear(&walk->iterator_time);
815
818
  git_commit_list_free(&walk->iterator_topo);
@@ -10,19 +10,19 @@
10
10
  #include "common.h"
11
11
 
12
12
  #include "git2/revwalk.h"
13
- #include "oidmap.h"
14
13
  #include "commit_list.h"
15
14
  #include "pqueue.h"
16
15
  #include "pool.h"
17
16
  #include "vector.h"
17
+ #include "hashmap_oid.h"
18
18
 
19
- #include "oidmap.h"
19
+ GIT_HASHMAP_OID_STRUCT(git_revwalk_oidmap, git_commit_list_node *);
20
20
 
21
21
  struct git_revwalk {
22
22
  git_repository *repo;
23
23
  git_odb *odb;
24
24
 
25
- git_oidmap *commits;
25
+ git_revwalk_oidmap commits;
26
26
  git_pool commit_pool;
27
27
 
28
28
  git_commit_list *iterator_topo;