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
@@ -13,6 +13,7 @@
13
13
  #include "odb.h"
14
14
  #include "oid.h"
15
15
  #include "oidarray.h"
16
+ #include "hashmap_oid.h"
16
17
 
17
18
  /* Option to bypass checking existence of '.keep' files */
18
19
  bool git_disable_pack_keep_file_checks = false;
@@ -41,6 +42,12 @@ static int pack_entry_find_offset(
41
42
  const git_oid *short_oid,
42
43
  size_t len);
43
44
 
45
+ #define off64_hash(key) (uint32_t)((key)>>33^(key)^(key)<<11)
46
+ #define off64_equal(a, b) ((a) == (b))
47
+
48
+ GIT_HASHMAP_FUNCTIONS(git_pack_offsetmap, GIT_HASHMAP_INLINE, off64_t, git_pack_cache_entry *, off64_hash, off64_equal);
49
+ GIT_HASHMAP_OID_FUNCTIONS(git_pack_oidmap, , struct git_pack_entry *);
50
+
44
51
  static int packfile_error(const char *message)
45
52
  {
46
53
  git_error_set(GIT_ERROR_ODB, "invalid pack file - %s", message);
@@ -75,31 +82,21 @@ static void free_cache_object(void *o)
75
82
 
76
83
  static void cache_free(git_pack_cache *cache)
77
84
  {
85
+ git_hashmap_iter_t iter = GIT_HASHMAP_ITER_INIT;
78
86
  git_pack_cache_entry *entry;
79
87
 
80
- if (cache->entries) {
81
- git_offmap_foreach_value(cache->entries, entry, {
82
- free_cache_object(entry);
83
- });
88
+ while (git_pack_offsetmap_iterate(&iter, NULL, &entry, &cache->entries) == 0)
89
+ free_cache_object(entry);
84
90
 
85
- git_offmap_free(cache->entries);
86
- cache->entries = NULL;
87
- }
91
+ git_pack_offsetmap_dispose(&cache->entries);
88
92
  }
89
93
 
90
94
  static int cache_init(git_pack_cache *cache)
91
95
  {
92
- if (git_offmap_new(&cache->entries) < 0)
93
- return -1;
94
-
95
96
  cache->memory_limit = GIT_PACK_CACHE_MEMORY_LIMIT;
96
97
 
97
98
  if (git_mutex_init(&cache->lock)) {
98
99
  git_error_set(GIT_ERROR_OS, "failed to initialize pack cache mutex");
99
-
100
- git__free(cache->entries);
101
- cache->entries = NULL;
102
-
103
100
  return -1;
104
101
  }
105
102
 
@@ -108,15 +105,16 @@ static int cache_init(git_pack_cache *cache)
108
105
 
109
106
  static git_pack_cache_entry *cache_get(git_pack_cache *cache, off64_t offset)
110
107
  {
111
- git_pack_cache_entry *entry;
108
+ git_pack_cache_entry *entry = NULL;
112
109
 
113
110
  if (git_mutex_lock(&cache->lock) < 0)
114
111
  return NULL;
115
112
 
116
- if ((entry = git_offmap_get(cache->entries, offset)) != NULL) {
113
+ if (git_pack_offsetmap_get(&entry, &cache->entries, offset) == 0) {
117
114
  git_atomic32_inc(&entry->refcount);
118
115
  entry->last_usage = cache->use_ctr++;
119
116
  }
117
+
120
118
  git_mutex_unlock(&cache->lock);
121
119
 
122
120
  return entry;
@@ -125,16 +123,17 @@ static git_pack_cache_entry *cache_get(git_pack_cache *cache, off64_t offset)
125
123
  /* Run with the cache lock held */
126
124
  static void free_lowest_entry(git_pack_cache *cache)
127
125
  {
128
- off64_t offset;
126
+ git_hashmap_iter_t iter = GIT_HASHMAP_ITER_INIT;
129
127
  git_pack_cache_entry *entry;
128
+ off64_t offset;
130
129
 
131
- git_offmap_foreach(cache->entries, offset, entry, {
130
+ while (git_pack_offsetmap_iterate(&iter, &offset, &entry, &cache->entries) == 0) {
132
131
  if (entry && git_atomic32_get(&entry->refcount) == 0) {
133
132
  cache->memory_used -= entry->raw.len;
134
- git_offmap_delete(cache->entries, offset);
133
+ git_pack_offsetmap_remove(&cache->entries, offset);
135
134
  free_cache_object(entry);
136
135
  }
137
- });
136
+ }
138
137
  }
139
138
 
140
139
  static int cache_add(
@@ -157,12 +156,12 @@ static int cache_add(
157
156
  return -1;
158
157
  }
159
158
  /* Add it to the cache if nobody else has */
160
- exists = git_offmap_exists(cache->entries, offset);
159
+ exists = git_pack_offsetmap_contains(&cache->entries, offset);
161
160
  if (!exists) {
162
161
  while (cache->memory_used + base->len > cache->memory_limit)
163
162
  free_lowest_entry(cache);
164
163
 
165
- git_offmap_set(cache->entries, offset, entry);
164
+ git_pack_offsetmap_put(&cache->entries, offset, entry);
166
165
  cache->memory_used += entry->raw.len;
167
166
 
168
167
  *cached_out = entry;
@@ -1009,7 +1008,7 @@ int get_delta_base(
1009
1008
  if (p->has_cache) {
1010
1009
  struct git_pack_entry *entry;
1011
1010
 
1012
- if ((entry = git_oidmap_get(p->idx_cache, &base_oid)) != NULL) {
1011
+ if (git_pack_oidmap_get(&entry, &p->idx_cache, &base_oid) == 0) {
1013
1012
  if (entry->offset == 0)
1014
1013
  return packfile_error("delta offset is zero");
1015
1014
 
@@ -1268,13 +1267,13 @@ static off64_t nth_packed_object_offset_locked(struct git_pack_file *p, uint32_t
1268
1267
  end = index + p->index_map.len;
1269
1268
  index += 4 * 256;
1270
1269
  if (p->index_version == 1)
1271
- return ntohl(*((uint32_t *)(index + (p->oid_size + 4) * n)));
1270
+ return ntohl(*((uint32_t *)(index + (p->oid_size + 4) * (size_t) n)));
1272
1271
 
1273
- index += 8 + p->num_objects * (p->oid_size + 4);
1272
+ index += 8 + (size_t) p->num_objects * (p->oid_size + 4);
1274
1273
  off32 = ntohl(*((uint32_t *)(index + 4 * n)));
1275
1274
  if (!(off32 & 0x80000000))
1276
1275
  return off32;
1277
- index += p->num_objects * 4 + (off32 & 0x7fffffff) * 8;
1276
+ index += (size_t) p->num_objects * 4 + (off32 & 0x7fffffff) * 8;
1278
1277
 
1279
1278
  /* Make sure we're not being sent out of bounds */
1280
1279
  if (index >= end - 8)
@@ -1351,7 +1350,7 @@ int git_pack_foreach_entry(
1351
1350
  git_vector_insert(&oids, (void*)&current[4]);
1352
1351
  }
1353
1352
 
1354
- git_vector_free(&offsets);
1353
+ git_vector_dispose(&offsets);
1355
1354
  p->ids = (unsigned char **)git_vector_detach(NULL, NULL, &oids);
1356
1355
  }
1357
1356
 
@@ -1499,6 +1498,7 @@ static int pack_entry_find_offset(
1499
1498
  size_t len)
1500
1499
  {
1501
1500
  const uint32_t *level1_ofs;
1501
+ size_t ofs_delta = 0;
1502
1502
  const unsigned char *index;
1503
1503
  unsigned hi, lo, stride;
1504
1504
  int pos, found = 0;
@@ -1524,9 +1524,15 @@ static int pack_entry_find_offset(
1524
1524
 
1525
1525
  if (p->index_version > 1) {
1526
1526
  level1_ofs += 2;
1527
+ ofs_delta = 2;
1527
1528
  index += 8;
1528
1529
  }
1529
1530
 
1531
+ if ((size_t)short_oid->id[0] + ofs_delta >= p->index_map.len) {
1532
+ git_error_set(GIT_ERROR_INTERNAL, "internal error: p->short_oid->[0] out of bounds");
1533
+ goto cleanup;
1534
+ }
1535
+
1530
1536
  index += 4 * 256;
1531
1537
  hi = ntohl(level1_ofs[(int)short_oid->id[0]]);
1532
1538
  lo = ((short_oid->id[0] == 0x0) ? 0 : ntohl(level1_ofs[(int)short_oid->id[0] - 1]));
@@ -16,10 +16,9 @@
16
16
  #include "map.h"
17
17
  #include "mwindow.h"
18
18
  #include "odb.h"
19
- #include "offmap.h"
20
- #include "oidmap.h"
21
19
  #include "zstream.h"
22
20
  #include "oid.h"
21
+ #include "hashmap_oid.h"
23
22
 
24
23
  /**
25
24
  * Function type for callbacks from git_pack_foreach_entry_offset.
@@ -83,12 +82,23 @@ typedef git_array_t(struct pack_chain_elem) git_dependency_chain;
83
82
  #define GIT_PACK_CACHE_MEMORY_LIMIT 16 * 1024 * 1024
84
83
  #define GIT_PACK_CACHE_SIZE_LIMIT 1024 * 1024 /* don't bother caching anything over 1MB */
85
84
 
85
+ struct git_pack_entry {
86
+ off64_t offset;
87
+ git_oid id;
88
+ struct git_pack_file *p;
89
+ };
90
+
91
+ GIT_HASHMAP_STRUCT(git_pack_offsetmap, off64_t, git_pack_cache_entry *);
92
+
93
+ GIT_HASHMAP_OID_STRUCT(git_pack_oidmap, struct git_pack_entry *);
94
+ GIT_HASHMAP_OID_PROTOTYPES(git_pack_oidmap, struct git_pack_entry *);
95
+
86
96
  typedef struct {
87
97
  size_t memory_used;
88
98
  size_t memory_limit;
89
99
  size_t use_ctr;
90
100
  git_mutex lock;
91
- git_offmap *entries;
101
+ git_pack_offsetmap entries;
92
102
  } git_pack_cache;
93
103
 
94
104
  struct git_pack_file {
@@ -110,7 +120,8 @@ struct git_pack_file {
110
120
 
111
121
  int index_version;
112
122
  git_time_t mtime;
113
- git_oidmap *idx_cache;
123
+
124
+ git_pack_oidmap idx_cache;
114
125
  unsigned char **ids;
115
126
 
116
127
  git_pack_cache bases; /* delta base cache */
@@ -139,12 +150,6 @@ int git_pack__lookup_id(
139
150
  const unsigned char *id_prefix,
140
151
  const git_oid_t oid_type);
141
152
 
142
- struct git_pack_entry {
143
- off64_t offset;
144
- git_oid id;
145
- struct git_pack_file *p;
146
- };
147
-
148
153
  typedef struct git_packfile_stream {
149
154
  off64_t curpos;
150
155
  int done;
@@ -102,13 +102,16 @@ int git_parse_advance_digit(int64_t *out, git_parse_ctx *ctx, int base)
102
102
  return 0;
103
103
  }
104
104
 
105
- int git_parse_advance_oid(git_oid *out, git_parse_ctx *ctx)
105
+ int git_parse_advance_oid(git_oid *out, git_parse_ctx *ctx, git_oid_t oid_type)
106
106
  {
107
- if (ctx->line_len < GIT_OID_SHA1_HEXSIZE)
107
+ size_t oid_hexsize = git_oid_hexsize(oid_type);
108
+ GIT_ASSERT(oid_hexsize);
109
+
110
+ if (ctx->line_len < oid_hexsize)
108
111
  return -1;
109
- if ((git_oid__fromstrn(out, ctx->line, GIT_OID_SHA1_HEXSIZE, GIT_OID_SHA1)) < 0)
112
+ if ((git_oid__fromstrn(out, ctx->line, oid_hexsize, oid_type)) < 0)
110
113
  return -1;
111
- git_parse_advance_chars(ctx, GIT_OID_SHA1_HEXSIZE);
114
+ git_parse_advance_chars(ctx, oid_hexsize);
112
115
  return 0;
113
116
  }
114
117
 
@@ -50,7 +50,7 @@ int git_parse_advance_expected(
50
50
  int git_parse_advance_ws(git_parse_ctx *ctx);
51
51
  int git_parse_advance_nl(git_parse_ctx *ctx);
52
52
  int git_parse_advance_digit(int64_t *out, git_parse_ctx *ctx, int base);
53
- int git_parse_advance_oid(git_oid *out, git_parse_ctx *ctx);
53
+ int git_parse_advance_oid(git_oid *out, git_parse_ctx *ctx, git_oid_t oid_type);
54
54
 
55
55
  enum GIT_PARSE_PEEK_FLAGS {
56
56
  GIT_PARSE_PEEK_SKIP_WHITESPACE = (1 << 0)
@@ -59,9 +59,15 @@ typedef struct {
59
59
  * This prefix will be removed when looking for files. The default is 1.
60
60
  */
61
61
  uint32_t prefix_len;
62
+
63
+ /**
64
+ * The type of object IDs in the patch file. The default is
65
+ * `GIT_OID_DEFAULT`.
66
+ */
67
+ git_oid_t oid_type;
62
68
  } git_patch_options;
63
69
 
64
- #define GIT_PATCH_OPTIONS_INIT { 1 }
70
+ #define GIT_PATCH_OPTIONS_INIT { 1, GIT_OID_DEFAULT }
65
71
 
66
72
  extern int git_patch__to_buf(git_str *out, git_patch *patch);
67
73
  extern void git_patch_free(git_patch *patch);
@@ -81,7 +81,8 @@ static void patch_generated_init_common(git_patch_generated *patch)
81
81
 
82
82
  static int patch_generated_normalize_options(
83
83
  git_diff_options *out,
84
- const git_diff_options *opts)
84
+ const git_diff_options *opts,
85
+ git_repository *repo)
85
86
  {
86
87
  if (opts) {
87
88
  GIT_ERROR_CHECK_VERSION(opts, GIT_DIFF_OPTIONS_VERSION, "git_diff_options");
@@ -91,6 +92,23 @@ static int patch_generated_normalize_options(
91
92
  memcpy(out, &default_opts, sizeof(git_diff_options));
92
93
  }
93
94
 
95
+ if (repo && opts && opts->oid_type && repo->oid_type != opts->oid_type) {
96
+ /*
97
+ * This limitation feels unnecessary - we should consider
98
+ * allowing users to generate diffs with a different object
99
+ * ID format than the repository.
100
+ */
101
+ git_error_set(GIT_ERROR_INVALID,
102
+ "specified object ID type does not match repository object ID type");
103
+ return -1;
104
+ } else if (repo) {
105
+ out->oid_type = repo->oid_type;
106
+ } else if (opts && opts->oid_type) {
107
+ out->oid_type = opts->oid_type;
108
+ } else {
109
+ out->oid_type = GIT_OID_DEFAULT;
110
+ }
111
+
94
112
  out->old_prefix = opts && opts->old_prefix ?
95
113
  git__strdup(opts->old_prefix) :
96
114
  git__strdup(DIFF_OLD_PREFIX_DEFAULT);
@@ -118,7 +136,7 @@ static int patch_generated_init(
118
136
  patch->delta_index = delta_index;
119
137
 
120
138
  if ((error = patch_generated_normalize_options(
121
- &patch->base.diff_opts, &diff->opts)) < 0 ||
139
+ &patch->base.diff_opts, &diff->opts, diff->repo)) < 0 ||
122
140
  (error = git_diff_file_content__init_from_diff(
123
141
  &patch->ofile, diff, patch->base.delta, true)) < 0 ||
124
142
  (error = git_diff_file_content__init_from_diff(
@@ -449,7 +467,7 @@ static int patch_generated_from_sources(
449
467
  git_xdiff_output *xo,
450
468
  git_diff_file_content_src *oldsrc,
451
469
  git_diff_file_content_src *newsrc,
452
- const git_diff_options *opts)
470
+ const git_diff_options *given_opts)
453
471
  {
454
472
  int error = 0;
455
473
  git_repository *repo =
@@ -457,11 +475,12 @@ static int patch_generated_from_sources(
457
475
  newsrc->blob ? git_blob_owner(newsrc->blob) : NULL;
458
476
  git_diff_file *lfile = &pd->delta.old_file, *rfile = &pd->delta.new_file;
459
477
  git_diff_file_content *ldata = &pd->patch.ofile, *rdata = &pd->patch.nfile;
478
+ git_diff_options *opts = &pd->patch.base.diff_opts;
460
479
 
461
- if ((error = patch_generated_normalize_options(&pd->patch.base.diff_opts, opts)) < 0)
480
+ if ((error = patch_generated_normalize_options(opts, given_opts, repo)) < 0)
462
481
  return error;
463
482
 
464
- if (opts && (opts->flags & GIT_DIFF_REVERSE) != 0) {
483
+ if ((opts->flags & GIT_DIFF_REVERSE) != 0) {
465
484
  void *tmp = lfile; lfile = rfile; rfile = tmp;
466
485
  tmp = ldata; ldata = rdata; rdata = tmp;
467
486
  }
@@ -166,15 +166,19 @@ static int parse_header_oid(
166
166
  uint16_t *oid_len,
167
167
  git_patch_parse_ctx *ctx)
168
168
  {
169
- size_t len;
169
+ size_t hexsize, len;
170
+
171
+ hexsize = git_oid_hexsize(ctx->opts.oid_type);
170
172
 
171
- for (len = 0; len < ctx->parse_ctx.line_len && len < GIT_OID_SHA1_HEXSIZE; len++) {
173
+ for (len = 0;
174
+ len < ctx->parse_ctx.line_len && len < hexsize;
175
+ len++) {
172
176
  if (!git__isxdigit(ctx->parse_ctx.line[len]))
173
177
  break;
174
178
  }
175
179
 
176
- if (len < GIT_OID_MINPREFIXLEN || len > GIT_OID_SHA1_HEXSIZE ||
177
- git_oid__fromstrn(oid, ctx->parse_ctx.line, len, GIT_OID_SHA1) < 0)
180
+ if (len < GIT_OID_MINPREFIXLEN || len > hexsize ||
181
+ git_oid__fromstrn(oid, ctx->parse_ctx.line, len, ctx->opts.oid_type) < 0)
178
182
  return git_parse_err("invalid hex formatted object id at line %"PRIuZ,
179
183
  ctx->parse_ctx.line_num);
180
184
 
@@ -558,9 +562,9 @@ fail:
558
562
 
559
563
  static int eof_for_origin(int origin) {
560
564
  if (origin == GIT_DIFF_LINE_ADDITION)
561
- return GIT_DIFF_LINE_ADD_EOFNL;
562
- if (origin == GIT_DIFF_LINE_DELETION)
563
565
  return GIT_DIFF_LINE_DEL_EOFNL;
566
+ if (origin == GIT_DIFF_LINE_DELETION)
567
+ return GIT_DIFF_LINE_ADD_EOFNL;
564
568
  return GIT_DIFF_LINE_CONTEXT_EOFNL;
565
569
  }
566
570
 
@@ -1065,12 +1069,14 @@ static int check_patch(git_patch_parsed *patch)
1065
1069
  return git_parse_err("patch with no hunks");
1066
1070
 
1067
1071
  if (delta->status == GIT_DELTA_ADDED) {
1068
- git_oid_clear(&delta->old_file.id, GIT_OID_SHA1);
1072
+ git_oid_clear(&delta->old_file.id,
1073
+ patch->base.diff_opts.oid_type);
1069
1074
  delta->old_file.id_abbrev = 0;
1070
1075
  }
1071
1076
 
1072
1077
  if (delta->status == GIT_DELTA_DELETED) {
1073
- git_oid_clear(&delta->new_file.id, GIT_OID_SHA1);
1078
+ git_oid_clear(&delta->new_file.id,
1079
+ patch->base.diff_opts.oid_type);
1074
1080
  delta->new_file.id_abbrev = 0;
1075
1081
  }
1076
1082
 
@@ -1187,11 +1193,13 @@ int git_patch_parse(
1187
1193
  patch->base.delta->status = GIT_DELTA_MODIFIED;
1188
1194
  patch->base.delta->nfiles = 2;
1189
1195
 
1196
+ patch->base.diff_opts.oid_type = ctx->opts.oid_type;
1197
+
1190
1198
  start = ctx->parse_ctx.remain_len;
1191
1199
 
1192
1200
  if ((error = parse_patch_header(patch, ctx)) < 0 ||
1193
- (error = parse_patch_body(patch, ctx)) < 0 ||
1194
- (error = check_patch(patch)) < 0)
1201
+ (error = parse_patch_body(patch, ctx)) < 0 ||
1202
+ (error = check_patch(patch)) < 0)
1195
1203
  goto done;
1196
1204
 
1197
1205
  used = start - ctx->parse_ctx.remain_len;
@@ -202,7 +202,7 @@ GIT_INLINE(size_t) common_prefix_icase(const char *str, size_t len, const char *
202
202
  {
203
203
  size_t count = 0;
204
204
 
205
- while (len > 0 && tolower(*str) == tolower(*prefix)) {
205
+ while (len > 0 && git__tolower(*str) == git__tolower(*prefix)) {
206
206
  count++;
207
207
  str++;
208
208
  prefix++;
@@ -105,7 +105,7 @@ int git_pathspec__vinit(
105
105
  /* free data from the pathspec vector */
106
106
  void git_pathspec__vfree(git_vector *vspec)
107
107
  {
108
- git_vector_free_deep(vspec);
108
+ git_vector_dispose_deep(vspec);
109
109
  }
110
110
 
111
111
  struct pathspec_match_context {
@@ -56,14 +56,22 @@ int git_push_new(git_push **out, git_remote *remote, const git_push_options *opt
56
56
  }
57
57
 
58
58
  if (git_vector_init(&p->status, 0, push_status_ref_cmp) < 0) {
59
- git_vector_free(&p->specs);
59
+ git_vector_dispose(&p->specs);
60
60
  git__free(p);
61
61
  return -1;
62
62
  }
63
63
 
64
64
  if (git_vector_init(&p->updates, 0, NULL) < 0) {
65
- git_vector_free(&p->status);
66
- git_vector_free(&p->specs);
65
+ git_vector_dispose(&p->status);
66
+ git_vector_dispose(&p->specs);
67
+ git__free(p);
68
+ return -1;
69
+ }
70
+
71
+ if (git_vector_init(&p->remote_push_options, 0, git__strcmp_cb) < 0) {
72
+ git_vector_dispose(&p->status);
73
+ git_vector_dispose(&p->specs);
74
+ git_vector_dispose(&p->updates);
67
75
  git__free(p);
68
76
  return -1;
69
77
  }
@@ -118,8 +126,8 @@ static int parse_refspec(git_push *push, push_spec **spec, const char *str)
118
126
  s = git__calloc(1, sizeof(*s));
119
127
  GIT_ERROR_CHECK_ALLOC(s);
120
128
 
121
- git_oid_clear(&s->loid, GIT_OID_SHA1);
122
- git_oid_clear(&s->roid, GIT_OID_SHA1);
129
+ git_oid_clear(&s->loid, push->repo->oid_type);
130
+ git_oid_clear(&s->roid, push->repo->oid_type);
123
131
 
124
132
  if (git_refspec__parse(&s->refspec, str, false) < 0) {
125
133
  git_error_set(GIT_ERROR_INVALID, "invalid refspec %s", str);
@@ -213,12 +221,25 @@ int git_push_update_tips(git_push *push, const git_remote_callbacks *callbacks)
213
221
  fire_callback = 0;
214
222
  }
215
223
 
216
- if (fire_callback && callbacks && callbacks->update_tips) {
217
- error = callbacks->update_tips(git_str_cstr(&remote_ref_name),
218
- &push_spec->roid, &push_spec->loid, callbacks->payload);
224
+ if (!fire_callback || !callbacks)
225
+ continue;
219
226
 
220
- if (error < 0)
221
- goto on_error;
227
+ if (callbacks->update_refs)
228
+ error = callbacks->update_refs(
229
+ git_str_cstr(&remote_ref_name),
230
+ &push_spec->roid, &push_spec->loid,
231
+ &push_spec->refspec, callbacks->payload);
232
+ #ifndef GIT_DEPRECATE_HARD
233
+ else if (callbacks->update_tips)
234
+ error = callbacks->update_tips(
235
+ git_str_cstr(&remote_ref_name),
236
+ &push_spec->roid, &push_spec->loid,
237
+ callbacks->payload);
238
+ #endif
239
+
240
+ if (error < 0) {
241
+ git_error_set_after_callback_function(error, "git_remote_push");
242
+ goto on_error;
222
243
  }
223
244
  }
224
245
 
@@ -275,6 +296,7 @@ static int queue_objects(git_push *push)
275
296
 
276
297
  git_vector_foreach(&push->specs, i, spec) {
277
298
  git_object_t type;
299
+ git_oid id;
278
300
  size_t size;
279
301
 
280
302
  if (git_oid_is_zero(&spec->loid))
@@ -296,20 +318,20 @@ static int queue_objects(git_push *push)
296
318
  if ((error = enqueue_tag(&target, push, &spec->loid)) < 0)
297
319
  goto on_error;
298
320
 
299
- if (git_object_type(target) == GIT_OBJECT_COMMIT) {
300
- if ((error = git_revwalk_push(rw, git_object_id(target))) < 0) {
301
- git_object_free(target);
302
- goto on_error;
303
- }
304
- } else {
305
- if ((error = git_packbuilder_insert(
306
- push->pb, git_object_id(target), NULL)) < 0) {
307
- git_object_free(target);
308
- goto on_error;
309
- }
310
- }
321
+ type = git_object_type(target);
322
+ git_oid_cpy(&id, git_object_id(target));
323
+
311
324
  git_object_free(target);
312
- } else if ((error = git_revwalk_push(rw, &spec->loid)) < 0)
325
+ } else {
326
+ git_oid_cpy(&id, &spec->loid);
327
+ }
328
+
329
+ if (type == GIT_OBJECT_COMMIT)
330
+ error = git_revwalk_push(rw, &id);
331
+ else
332
+ error = git_packbuilder_insert(push->pb, &id, NULL);
333
+
334
+ if (error < 0)
313
335
  goto on_error;
314
336
 
315
337
  if (!spec->refspec.force) {
@@ -444,10 +466,21 @@ static int do_push(git_push *push)
444
466
  if ((error = calculate_work(push)) < 0)
445
467
  goto on_error;
446
468
 
447
- if (callbacks && callbacks->push_negotiation &&
448
- (error = callbacks->push_negotiation((const git_push_update **) push->updates.contents,
449
- push->updates.length, callbacks->payload)) < 0)
450
- goto on_error;
469
+ if (callbacks && callbacks->push_negotiation) {
470
+ git_error_clear();
471
+
472
+ error = callbacks->push_negotiation(
473
+ (const git_push_update **) push->updates.contents,
474
+ push->updates.length, callbacks->payload);
475
+
476
+ if (error < 0) {
477
+ git_error_set_after_callback_function(error,
478
+ "push_negotiation");
479
+ goto on_error;
480
+ }
481
+
482
+ error = 0;
483
+ }
451
484
 
452
485
  if ((error = queue_objects(push)) < 0 ||
453
486
  (error = transport->push(transport, push)) < 0)
@@ -479,12 +512,24 @@ static int filter_refs(git_remote *remote)
479
512
  int git_push_finish(git_push *push)
480
513
  {
481
514
  int error;
515
+ unsigned int remote_caps;
482
516
 
483
517
  if (!git_remote_connected(push->remote)) {
484
518
  git_error_set(GIT_ERROR_NET, "remote is disconnected");
485
519
  return -1;
486
520
  }
487
521
 
522
+ if ((error = git_remote_capabilities(&remote_caps, push->remote)) < 0) {
523
+ git_error_set(GIT_ERROR_INVALID, "remote capabilities not available");
524
+ return -1;
525
+ }
526
+
527
+ if (git_vector_length(&push->remote_push_options) > 0 &&
528
+ !(remote_caps & GIT_REMOTE_CAPABILITY_PUSH_OPTIONS)) {
529
+ git_error_set(GIT_ERROR_INVALID, "push-options not supported by remote");
530
+ return -1;
531
+ }
532
+
488
533
  if ((error = filter_refs(push->remote)) < 0 ||
489
534
  (error = do_push(push)) < 0)
490
535
  return error;
@@ -528,6 +573,7 @@ void git_push_free(git_push *push)
528
573
  push_spec *spec;
529
574
  push_status *status;
530
575
  git_push_update *update;
576
+ char *option;
531
577
  unsigned int i;
532
578
 
533
579
  if (push == NULL)
@@ -536,19 +582,24 @@ void git_push_free(git_push *push)
536
582
  git_vector_foreach(&push->specs, i, spec) {
537
583
  free_refspec(spec);
538
584
  }
539
- git_vector_free(&push->specs);
585
+ git_vector_dispose(&push->specs);
540
586
 
541
587
  git_vector_foreach(&push->status, i, status) {
542
588
  git_push_status_free(status);
543
589
  }
544
- git_vector_free(&push->status);
590
+ git_vector_dispose(&push->status);
545
591
 
546
592
  git_vector_foreach(&push->updates, i, update) {
547
593
  git__free(update->src_refname);
548
594
  git__free(update->dst_refname);
549
595
  git__free(update);
550
596
  }
551
- git_vector_free(&push->updates);
597
+ git_vector_dispose(&push->updates);
598
+
599
+ git_vector_foreach(&push->remote_push_options, i, option) {
600
+ git__free(option);
601
+ }
602
+ git_vector_dispose(&push->remote_push_options);
552
603
 
553
604
  git__free(push);
554
605
  }
@@ -34,6 +34,7 @@ struct git_push {
34
34
  git_vector specs;
35
35
  git_vector updates;
36
36
  bool report_status;
37
+ git_vector remote_push_options;
37
38
 
38
39
  /* report-status */
39
40
  bool unpack_ok;
@@ -125,7 +125,7 @@ static int workdir_reader_read(
125
125
  goto done;
126
126
 
127
127
  if (out_id || reader->index) {
128
- if ((error = git_odb__hash(&id, out->ptr, out->size, GIT_OBJECT_BLOB, GIT_OID_SHA1)) < 0)
128
+ if ((error = git_odb__hash(&id, out->ptr, out->size, GIT_OBJECT_BLOB, reader->repo->oid_type)) < 0)
129
129
  goto done;
130
130
  }
131
131