rugged 0.28.3.1 → 0.28.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (350) 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 +36 -16
  5. data/vendor/libgit2/COPYING +28 -0
  6. data/vendor/libgit2/cmake/Modules/EnableWarnings.cmake +5 -1
  7. data/vendor/libgit2/cmake/Modules/FindCoreFoundation.cmake +2 -2
  8. data/vendor/libgit2/cmake/Modules/FindGSSAPI.cmake +1 -1
  9. data/vendor/libgit2/cmake/Modules/FindGSSFramework.cmake +28 -0
  10. data/vendor/libgit2/cmake/Modules/FindPCRE.cmake +38 -0
  11. data/vendor/libgit2/cmake/Modules/FindPCRE2.cmake +37 -0
  12. data/vendor/libgit2/cmake/Modules/FindSecurity.cmake +2 -2
  13. data/vendor/libgit2/cmake/Modules/FindStatNsec.cmake +6 -0
  14. data/vendor/libgit2/cmake/Modules/PkgBuildConfig.cmake +110 -0
  15. data/vendor/libgit2/cmake/Modules/SelectGSSAPI.cmake +53 -0
  16. data/vendor/libgit2/cmake/Modules/SelectHTTPSBackend.cmake +124 -0
  17. data/vendor/libgit2/cmake/Modules/SelectHashes.cmake +66 -0
  18. data/vendor/libgit2/deps/http-parser/http_parser.c +11 -6
  19. data/vendor/libgit2/deps/ntlmclient/CMakeLists.txt +21 -0
  20. data/vendor/libgit2/deps/ntlmclient/compat.h +33 -0
  21. data/vendor/libgit2/deps/ntlmclient/crypt.h +64 -0
  22. data/vendor/libgit2/deps/ntlmclient/crypt_commoncrypto.c +120 -0
  23. data/vendor/libgit2/deps/ntlmclient/crypt_commoncrypto.h +18 -0
  24. data/vendor/libgit2/deps/ntlmclient/crypt_mbedtls.c +145 -0
  25. data/vendor/libgit2/deps/ntlmclient/crypt_mbedtls.h +18 -0
  26. data/vendor/libgit2/deps/ntlmclient/crypt_openssl.c +130 -0
  27. data/vendor/libgit2/deps/ntlmclient/crypt_openssl.h +21 -0
  28. data/vendor/libgit2/deps/ntlmclient/ntlm.c +1420 -0
  29. data/vendor/libgit2/deps/ntlmclient/ntlm.h +174 -0
  30. data/vendor/libgit2/deps/ntlmclient/ntlmclient.h +320 -0
  31. data/vendor/libgit2/deps/ntlmclient/unicode.h +36 -0
  32. data/vendor/libgit2/deps/ntlmclient/unicode_builtin.c +445 -0
  33. data/vendor/libgit2/deps/ntlmclient/unicode_iconv.c +201 -0
  34. data/vendor/libgit2/deps/ntlmclient/utf8.h +1257 -0
  35. data/vendor/libgit2/deps/ntlmclient/util.c +21 -0
  36. data/vendor/libgit2/deps/ntlmclient/util.h +14 -0
  37. data/vendor/libgit2/deps/pcre/CMakeLists.txt +140 -0
  38. data/vendor/libgit2/deps/pcre/COPYING +5 -0
  39. data/vendor/libgit2/deps/pcre/cmake/COPYING-CMAKE-SCRIPTS +22 -0
  40. data/vendor/libgit2/deps/pcre/cmake/FindEditline.cmake +17 -0
  41. data/vendor/libgit2/deps/pcre/cmake/FindPackageHandleStandardArgs.cmake +58 -0
  42. data/vendor/libgit2/deps/pcre/cmake/FindReadline.cmake +29 -0
  43. data/vendor/libgit2/deps/pcre/config.h.in +57 -0
  44. data/vendor/libgit2/deps/pcre/pcre.h +641 -0
  45. data/vendor/libgit2/deps/pcre/pcre_byte_order.c +319 -0
  46. data/vendor/libgit2/deps/pcre/pcre_chartables.c +198 -0
  47. data/vendor/libgit2/deps/pcre/pcre_compile.c +9800 -0
  48. data/vendor/libgit2/deps/pcre/pcre_config.c +190 -0
  49. data/vendor/libgit2/deps/pcre/pcre_dfa_exec.c +3676 -0
  50. data/vendor/libgit2/deps/pcre/pcre_exec.c +7173 -0
  51. data/vendor/libgit2/deps/pcre/pcre_fullinfo.c +245 -0
  52. data/vendor/libgit2/deps/pcre/pcre_get.c +669 -0
  53. data/vendor/libgit2/deps/pcre/pcre_globals.c +86 -0
  54. data/vendor/libgit2/deps/pcre/pcre_internal.h +2787 -0
  55. data/vendor/libgit2/deps/pcre/pcre_jit_compile.c +11913 -0
  56. data/vendor/libgit2/deps/pcre/pcre_maketables.c +156 -0
  57. data/vendor/libgit2/deps/pcre/pcre_newline.c +210 -0
  58. data/vendor/libgit2/deps/pcre/pcre_ord2utf8.c +94 -0
  59. data/vendor/libgit2/deps/pcre/pcre_printint.c +834 -0
  60. data/vendor/libgit2/deps/pcre/pcre_refcount.c +92 -0
  61. data/vendor/libgit2/deps/pcre/pcre_string_utils.c +211 -0
  62. data/vendor/libgit2/deps/pcre/pcre_study.c +1686 -0
  63. data/vendor/libgit2/deps/pcre/pcre_tables.c +727 -0
  64. data/vendor/libgit2/deps/pcre/pcre_ucd.c +3644 -0
  65. data/vendor/libgit2/deps/pcre/pcre_valid_utf8.c +301 -0
  66. data/vendor/libgit2/deps/pcre/pcre_version.c +98 -0
  67. data/vendor/libgit2/deps/pcre/pcre_xclass.c +268 -0
  68. data/vendor/libgit2/deps/pcre/pcreposix.c +421 -0
  69. data/vendor/libgit2/deps/pcre/pcreposix.h +117 -0
  70. data/vendor/libgit2/deps/pcre/ucp.h +224 -0
  71. data/vendor/libgit2/deps/zlib/adler32.c +0 -7
  72. data/vendor/libgit2/deps/zlib/crc32.c +0 -7
  73. data/vendor/libgit2/include/git2.h +2 -0
  74. data/vendor/libgit2/include/git2/apply.h +22 -2
  75. data/vendor/libgit2/include/git2/attr.h +19 -12
  76. data/vendor/libgit2/include/git2/blame.h +2 -2
  77. data/vendor/libgit2/include/git2/blob.h +44 -12
  78. data/vendor/libgit2/include/git2/buffer.h +20 -14
  79. data/vendor/libgit2/include/git2/cert.h +135 -0
  80. data/vendor/libgit2/include/git2/checkout.h +46 -14
  81. data/vendor/libgit2/include/git2/cherrypick.h +3 -3
  82. data/vendor/libgit2/include/git2/clone.h +2 -2
  83. data/vendor/libgit2/include/git2/commit.h +23 -1
  84. data/vendor/libgit2/include/git2/common.h +7 -5
  85. data/vendor/libgit2/include/git2/config.h +12 -12
  86. data/vendor/libgit2/include/git2/cred.h +308 -0
  87. data/vendor/libgit2/include/git2/deprecated.h +243 -3
  88. data/vendor/libgit2/include/git2/describe.h +4 -4
  89. data/vendor/libgit2/include/git2/diff.h +16 -14
  90. data/vendor/libgit2/include/git2/filter.h +8 -0
  91. data/vendor/libgit2/include/git2/index.h +2 -1
  92. data/vendor/libgit2/include/git2/indexer.h +48 -4
  93. data/vendor/libgit2/include/git2/merge.h +6 -10
  94. data/vendor/libgit2/include/git2/net.h +0 -5
  95. data/vendor/libgit2/include/git2/object.h +2 -14
  96. data/vendor/libgit2/include/git2/odb.h +3 -2
  97. data/vendor/libgit2/include/git2/odb_backend.h +5 -4
  98. data/vendor/libgit2/include/git2/oid.h +1 -1
  99. data/vendor/libgit2/include/git2/pack.h +12 -1
  100. data/vendor/libgit2/include/git2/proxy.h +5 -3
  101. data/vendor/libgit2/include/git2/rebase.h +46 -2
  102. data/vendor/libgit2/include/git2/refs.h +19 -0
  103. data/vendor/libgit2/include/git2/remote.h +35 -12
  104. data/vendor/libgit2/include/git2/repository.h +24 -2
  105. data/vendor/libgit2/include/git2/revert.h +1 -1
  106. data/vendor/libgit2/include/git2/stash.h +3 -3
  107. data/vendor/libgit2/include/git2/status.h +25 -16
  108. data/vendor/libgit2/include/git2/submodule.h +20 -3
  109. data/vendor/libgit2/include/git2/sys/alloc.h +9 -9
  110. data/vendor/libgit2/include/git2/sys/cred.h +90 -0
  111. data/vendor/libgit2/include/git2/sys/odb_backend.h +48 -4
  112. data/vendor/libgit2/include/git2/sys/refdb_backend.h +57 -21
  113. data/vendor/libgit2/include/git2/sys/repository.h +5 -1
  114. data/vendor/libgit2/include/git2/sys/transport.h +2 -2
  115. data/vendor/libgit2/include/git2/tag.h +11 -2
  116. data/vendor/libgit2/include/git2/trace.h +2 -2
  117. data/vendor/libgit2/include/git2/transport.h +11 -340
  118. data/vendor/libgit2/include/git2/tree.h +1 -1
  119. data/vendor/libgit2/include/git2/types.h +4 -89
  120. data/vendor/libgit2/include/git2/version.h +2 -2
  121. data/vendor/libgit2/include/git2/worktree.h +5 -5
  122. data/vendor/libgit2/src/CMakeLists.txt +88 -222
  123. data/vendor/libgit2/src/alloc.c +2 -14
  124. data/vendor/libgit2/src/{stdalloc.c → allocators/stdalloc.c} +3 -4
  125. data/vendor/libgit2/src/{stdalloc.h → allocators/stdalloc.h} +4 -4
  126. data/vendor/libgit2/src/allocators/win32_crtdbg.c +118 -0
  127. data/vendor/libgit2/src/{transports/cred.h → allocators/win32_crtdbg.h} +5 -4
  128. data/vendor/libgit2/src/apply.c +60 -30
  129. data/vendor/libgit2/src/attr.c +70 -64
  130. data/vendor/libgit2/src/attr_file.c +189 -96
  131. data/vendor/libgit2/src/attr_file.h +9 -9
  132. data/vendor/libgit2/src/attrcache.c +44 -46
  133. data/vendor/libgit2/src/attrcache.h +2 -1
  134. data/vendor/libgit2/src/blame.c +17 -5
  135. data/vendor/libgit2/src/blame.h +1 -1
  136. data/vendor/libgit2/src/blame_git.c +21 -7
  137. data/vendor/libgit2/src/blob.c +81 -17
  138. data/vendor/libgit2/src/blob.h +2 -2
  139. data/vendor/libgit2/src/branch.c +29 -5
  140. data/vendor/libgit2/src/buffer.c +14 -7
  141. data/vendor/libgit2/src/cache.c +26 -33
  142. data/vendor/libgit2/src/cache.h +1 -1
  143. data/vendor/libgit2/src/cc-compat.h +5 -0
  144. data/vendor/libgit2/src/checkout.c +26 -16
  145. data/vendor/libgit2/src/cherrypick.c +9 -3
  146. data/vendor/libgit2/src/clone.c +29 -7
  147. data/vendor/libgit2/src/clone.h +4 -0
  148. data/vendor/libgit2/src/commit.c +69 -21
  149. data/vendor/libgit2/src/commit.h +6 -0
  150. data/vendor/libgit2/src/commit_list.c +28 -76
  151. data/vendor/libgit2/src/commit_list.h +2 -2
  152. data/vendor/libgit2/src/common.h +3 -75
  153. data/vendor/libgit2/src/config.c +31 -40
  154. data/vendor/libgit2/src/config.h +7 -6
  155. data/vendor/libgit2/src/config_backend.h +12 -0
  156. data/vendor/libgit2/src/config_cache.c +39 -39
  157. data/vendor/libgit2/src/config_entries.c +69 -99
  158. data/vendor/libgit2/src/config_entries.h +1 -0
  159. data/vendor/libgit2/src/config_file.c +337 -380
  160. data/vendor/libgit2/src/config_mem.c +12 -16
  161. data/vendor/libgit2/src/config_parse.c +49 -29
  162. data/vendor/libgit2/src/config_parse.h +13 -12
  163. data/vendor/libgit2/src/config_snapshot.c +206 -0
  164. data/vendor/libgit2/src/crlf.c +14 -14
  165. data/vendor/libgit2/src/describe.c +21 -20
  166. data/vendor/libgit2/src/diff.c +43 -58
  167. data/vendor/libgit2/src/diff.h +2 -1
  168. data/vendor/libgit2/src/diff_driver.c +37 -38
  169. data/vendor/libgit2/src/diff_file.c +9 -7
  170. data/vendor/libgit2/src/diff_file.h +1 -1
  171. data/vendor/libgit2/src/diff_generate.c +135 -85
  172. data/vendor/libgit2/src/diff_generate.h +2 -2
  173. data/vendor/libgit2/src/diff_parse.c +1 -1
  174. data/vendor/libgit2/src/diff_print.c +25 -13
  175. data/vendor/libgit2/src/diff_stats.c +1 -1
  176. data/vendor/libgit2/src/diff_tform.c +4 -4
  177. data/vendor/libgit2/src/errors.c +12 -22
  178. data/vendor/libgit2/src/errors.h +81 -0
  179. data/vendor/libgit2/src/features.h.in +9 -2
  180. data/vendor/libgit2/src/fetch.c +7 -2
  181. data/vendor/libgit2/src/fetchhead.c +1 -1
  182. data/vendor/libgit2/src/filebuf.c +6 -10
  183. data/vendor/libgit2/src/filebuf.h +2 -2
  184. data/vendor/libgit2/src/filter.c +16 -8
  185. data/vendor/libgit2/src/{fileops.c → futils.c} +21 -17
  186. data/vendor/libgit2/src/{fileops.h → futils.h} +5 -5
  187. data/vendor/libgit2/src/global.c +12 -40
  188. data/vendor/libgit2/src/global.h +0 -2
  189. data/vendor/libgit2/src/hash.c +61 -0
  190. data/vendor/libgit2/src/hash.h +19 -21
  191. data/vendor/libgit2/src/hash/sha1.h +38 -0
  192. data/vendor/libgit2/src/hash/{hash_collisiondetect.h → sha1/collisiondetect.c} +14 -17
  193. data/vendor/libgit2/src/hash/sha1/collisiondetect.h +19 -0
  194. data/vendor/libgit2/src/hash/{hash_common_crypto.h → sha1/common_crypto.c} +15 -19
  195. data/vendor/libgit2/src/hash/sha1/common_crypto.h +19 -0
  196. data/vendor/libgit2/src/hash/{hash_generic.c → sha1/generic.c} +22 -10
  197. data/vendor/libgit2/src/hash/{hash_generic.h → sha1/generic.h} +4 -14
  198. data/vendor/libgit2/src/hash/{hash_mbedtls.c → sha1/mbedtls.c} +15 -7
  199. data/vendor/libgit2/src/hash/{hash_mbedtls.h → sha1/mbedtls.h} +6 -11
  200. data/vendor/libgit2/src/hash/{hash_openssl.h → sha1/openssl.c} +14 -18
  201. data/vendor/libgit2/src/hash/sha1/openssl.h +19 -0
  202. data/vendor/libgit2/src/hash/{sha1dc → sha1/sha1dc}/sha1.c +14 -3
  203. data/vendor/libgit2/src/hash/{sha1dc → sha1/sha1dc}/sha1.h +0 -0
  204. data/vendor/libgit2/src/hash/{sha1dc → sha1/sha1dc}/ubc_check.c +0 -0
  205. data/vendor/libgit2/src/hash/{sha1dc → sha1/sha1dc}/ubc_check.h +0 -0
  206. data/vendor/libgit2/src/hash/{hash_win32.c → sha1/win32.c} +34 -24
  207. data/vendor/libgit2/src/hash/{hash_win32.h → sha1/win32.h} +6 -19
  208. data/vendor/libgit2/src/hashsig.c +1 -1
  209. data/vendor/libgit2/src/idxmap.c +91 -65
  210. data/vendor/libgit2/src/idxmap.h +151 -15
  211. data/vendor/libgit2/src/ignore.c +32 -38
  212. data/vendor/libgit2/src/index.c +66 -43
  213. data/vendor/libgit2/src/index.h +1 -1
  214. data/vendor/libgit2/src/indexer.c +69 -70
  215. data/vendor/libgit2/src/integer.h +39 -4
  216. data/vendor/libgit2/src/iterator.c +27 -22
  217. data/vendor/libgit2/src/map.h +1 -1
  218. data/vendor/libgit2/src/merge.c +58 -44
  219. data/vendor/libgit2/src/merge_driver.c +4 -4
  220. data/vendor/libgit2/src/merge_file.c +1 -1
  221. data/vendor/libgit2/src/mwindow.c +18 -23
  222. data/vendor/libgit2/src/mwindow.h +4 -4
  223. data/vendor/libgit2/src/net.c +184 -0
  224. data/vendor/libgit2/src/net.h +36 -0
  225. data/vendor/libgit2/src/netops.c +55 -165
  226. data/vendor/libgit2/src/netops.h +3 -25
  227. data/vendor/libgit2/src/notes.c +2 -2
  228. data/vendor/libgit2/src/object.c +2 -2
  229. data/vendor/libgit2/src/object.h +2 -0
  230. data/vendor/libgit2/src/odb.c +41 -23
  231. data/vendor/libgit2/src/odb.h +3 -2
  232. data/vendor/libgit2/src/odb_loose.c +17 -10
  233. data/vendor/libgit2/src/odb_mempack.c +10 -23
  234. data/vendor/libgit2/src/odb_pack.c +4 -4
  235. data/vendor/libgit2/src/offmap.c +43 -55
  236. data/vendor/libgit2/src/offmap.h +102 -24
  237. data/vendor/libgit2/src/oid.c +6 -1
  238. data/vendor/libgit2/src/oidmap.c +39 -57
  239. data/vendor/libgit2/src/oidmap.h +99 -19
  240. data/vendor/libgit2/src/pack-objects.c +25 -32
  241. data/vendor/libgit2/src/pack-objects.h +1 -1
  242. data/vendor/libgit2/src/pack.c +45 -47
  243. data/vendor/libgit2/src/pack.h +12 -14
  244. data/vendor/libgit2/src/parse.c +10 -0
  245. data/vendor/libgit2/src/parse.h +3 -3
  246. data/vendor/libgit2/src/patch.c +1 -1
  247. data/vendor/libgit2/src/patch_generate.c +2 -2
  248. data/vendor/libgit2/src/patch_parse.c +124 -31
  249. data/vendor/libgit2/src/path.c +95 -27
  250. data/vendor/libgit2/src/path.h +2 -0
  251. data/vendor/libgit2/src/pathspec.c +13 -13
  252. data/vendor/libgit2/src/pool.c +26 -22
  253. data/vendor/libgit2/src/pool.h +7 -7
  254. data/vendor/libgit2/src/posix.c +7 -7
  255. data/vendor/libgit2/src/posix.h +12 -1
  256. data/vendor/libgit2/src/proxy.c +7 -2
  257. data/vendor/libgit2/src/push.c +10 -5
  258. data/vendor/libgit2/src/reader.c +2 -2
  259. data/vendor/libgit2/src/rebase.c +66 -7
  260. data/vendor/libgit2/src/refdb.c +12 -0
  261. data/vendor/libgit2/src/refdb_fs.c +214 -165
  262. data/vendor/libgit2/src/reflog.c +11 -13
  263. data/vendor/libgit2/src/refs.c +24 -18
  264. data/vendor/libgit2/src/refspec.c +9 -16
  265. data/vendor/libgit2/src/regexp.c +221 -0
  266. data/vendor/libgit2/src/regexp.h +97 -0
  267. data/vendor/libgit2/src/remote.c +50 -52
  268. data/vendor/libgit2/src/remote.h +2 -2
  269. data/vendor/libgit2/src/repository.c +115 -100
  270. data/vendor/libgit2/src/repository.h +49 -40
  271. data/vendor/libgit2/src/revert.c +8 -3
  272. data/vendor/libgit2/src/revparse.c +18 -19
  273. data/vendor/libgit2/src/revwalk.c +63 -30
  274. data/vendor/libgit2/src/revwalk.h +20 -0
  275. data/vendor/libgit2/src/settings.c +5 -0
  276. data/vendor/libgit2/src/sortedcache.c +12 -26
  277. data/vendor/libgit2/src/sortedcache.h +1 -1
  278. data/vendor/libgit2/src/stash.c +45 -65
  279. data/vendor/libgit2/src/status.c +15 -9
  280. data/vendor/libgit2/src/streams/openssl.c +20 -0
  281. data/vendor/libgit2/src/streams/socket.c +2 -2
  282. data/vendor/libgit2/src/strmap.c +37 -84
  283. data/vendor/libgit2/src/strmap.h +105 -33
  284. data/vendor/libgit2/src/submodule.c +102 -70
  285. data/vendor/libgit2/src/submodule.h +1 -1
  286. data/vendor/libgit2/src/sysdir.c +11 -1
  287. data/vendor/libgit2/src/tag.c +10 -2
  288. data/vendor/libgit2/src/trace.c +1 -1
  289. data/vendor/libgit2/src/trace.h +2 -2
  290. data/vendor/libgit2/src/trailer.c +46 -32
  291. data/vendor/libgit2/src/transaction.c +10 -9
  292. data/vendor/libgit2/src/transports/auth.c +10 -9
  293. data/vendor/libgit2/src/transports/auth.h +11 -4
  294. data/vendor/libgit2/src/transports/auth_negotiate.c +23 -9
  295. data/vendor/libgit2/src/transports/auth_negotiate.h +2 -2
  296. data/vendor/libgit2/src/transports/auth_ntlm.c +223 -0
  297. data/vendor/libgit2/src/transports/auth_ntlm.h +35 -0
  298. data/vendor/libgit2/src/transports/cred.c +6 -6
  299. data/vendor/libgit2/src/transports/git.c +11 -16
  300. data/vendor/libgit2/src/transports/http.c +419 -276
  301. data/vendor/libgit2/src/transports/http.h +1 -1
  302. data/vendor/libgit2/src/transports/local.c +9 -9
  303. data/vendor/libgit2/src/transports/smart.c +17 -17
  304. data/vendor/libgit2/src/transports/smart.h +2 -2
  305. data/vendor/libgit2/src/transports/smart_protocol.c +36 -60
  306. data/vendor/libgit2/src/transports/ssh.c +46 -36
  307. data/vendor/libgit2/src/transports/winhttp.c +231 -207
  308. data/vendor/libgit2/src/tree-cache.c +14 -7
  309. data/vendor/libgit2/src/tree.c +10 -24
  310. data/vendor/libgit2/src/unix/map.c +1 -1
  311. data/vendor/libgit2/src/unix/posix.h +1 -11
  312. data/vendor/libgit2/src/userdiff.h +3 -1
  313. data/vendor/libgit2/src/util.c +51 -53
  314. data/vendor/libgit2/src/util.h +16 -21
  315. data/vendor/libgit2/src/wildmatch.c +320 -0
  316. data/vendor/libgit2/src/wildmatch.h +23 -0
  317. data/vendor/libgit2/src/win32/map.c +3 -5
  318. data/vendor/libgit2/src/win32/path_w32.c +12 -2
  319. data/vendor/libgit2/src/win32/path_w32.h +0 -29
  320. data/vendor/libgit2/src/win32/posix.h +1 -4
  321. data/vendor/libgit2/src/win32/posix_w32.c +40 -5
  322. data/vendor/libgit2/src/win32/precompiled.h +0 -2
  323. data/vendor/libgit2/src/win32/thread.c +5 -10
  324. data/vendor/libgit2/src/win32/w32_buffer.c +7 -3
  325. data/vendor/libgit2/src/win32/w32_common.h +39 -0
  326. data/vendor/libgit2/src/win32/w32_crtdbg_stacktrace.c +0 -93
  327. data/vendor/libgit2/src/win32/w32_crtdbg_stacktrace.h +0 -2
  328. data/vendor/libgit2/src/win32/w32_stack.c +4 -9
  329. data/vendor/libgit2/src/win32/w32_stack.h +3 -3
  330. data/vendor/libgit2/src/win32/w32_util.c +31 -0
  331. data/vendor/libgit2/src/win32/w32_util.h +6 -32
  332. data/vendor/libgit2/src/worktree.c +36 -22
  333. data/vendor/libgit2/src/xdiff/xdiffi.c +1 -1
  334. data/vendor/libgit2/src/xdiff/xmerge.c +12 -0
  335. data/vendor/libgit2/src/xdiff/xpatience.c +3 -0
  336. metadata +98 -34
  337. data/vendor/libgit2/deps/regex/CMakeLists.txt +0 -2
  338. data/vendor/libgit2/deps/regex/COPYING +0 -502
  339. data/vendor/libgit2/deps/regex/config.h +0 -7
  340. data/vendor/libgit2/deps/regex/regcomp.c +0 -3857
  341. data/vendor/libgit2/deps/regex/regex.c +0 -92
  342. data/vendor/libgit2/deps/regex/regex.h +0 -582
  343. data/vendor/libgit2/deps/regex/regex_internal.c +0 -1744
  344. data/vendor/libgit2/deps/regex/regex_internal.h +0 -819
  345. data/vendor/libgit2/deps/regex/regexec.c +0 -4369
  346. data/vendor/libgit2/include/git2/inttypes.h +0 -309
  347. data/vendor/libgit2/include/git2/sys/time.h +0 -31
  348. data/vendor/libgit2/libgit2.pc.in +0 -13
  349. data/vendor/libgit2/src/fnmatch.c +0 -248
  350. data/vendor/libgit2/src/fnmatch.h +0 -48
@@ -10,7 +10,7 @@
10
10
 
11
11
  #include "buffer.h"
12
12
 
13
- #define GIT_HTTP_REPLAY_MAX 7
13
+ #define GIT_HTTP_REPLAY_MAX 15
14
14
 
15
15
  GIT_INLINE(int) git_http__user_agent(git_buf *buf)
16
16
  {
@@ -309,7 +309,7 @@ static int local_push_update_remote_ref(
309
309
  if (lref[0] != '\0') {
310
310
  /* Create or update a ref */
311
311
  error = git_reference_create(NULL, remote_repo, rref, loid,
312
- !git_oid_iszero(roid), NULL);
312
+ !git_oid_is_zero(roid), NULL);
313
313
  } else {
314
314
  /* Delete a ref */
315
315
  if ((error = git_reference_lookup(&remote_ref, remote_repo, rref)) < 0) {
@@ -325,7 +325,7 @@ static int local_push_update_remote_ref(
325
325
  return error;
326
326
  }
327
327
 
328
- static int transfer_to_push_transfer(const git_transfer_progress *stats, void *payload)
328
+ static int transfer_to_push_transfer(const git_indexer_progress *stats, void *payload)
329
329
  {
330
330
  const git_remote_callbacks *cbs = payload;
331
331
 
@@ -460,8 +460,8 @@ on_error:
460
460
  }
461
461
 
462
462
  typedef struct foreach_data {
463
- git_transfer_progress *stats;
464
- git_transfer_progress_cb progress_cb;
463
+ git_indexer_progress *stats;
464
+ git_indexer_progress_cb progress_cb;
465
465
  void *progress_payload;
466
466
  git_odb_writepack *writepack;
467
467
  } foreach_data;
@@ -501,7 +501,7 @@ static int local_counting(int stage, unsigned int current, unsigned int total, v
501
501
  if (git_buf_oom(&progress_info))
502
502
  return -1;
503
503
 
504
- error = t->progress_cb(git_buf_cstr(&progress_info), git_buf_len(&progress_info), t->message_cb_payload);
504
+ error = t->progress_cb(git_buf_cstr(&progress_info), (int)git_buf_len(&progress_info), t->message_cb_payload);
505
505
  git_buf_dispose(&progress_info);
506
506
 
507
507
  return error;
@@ -533,8 +533,8 @@ static int foreach_reference_cb(git_reference *reference, void *payload)
533
533
  static int local_download_pack(
534
534
  git_transport *transport,
535
535
  git_repository *repo,
536
- git_transfer_progress *stats,
537
- git_transfer_progress_cb progress_cb,
536
+ git_indexer_progress *stats,
537
+ git_indexer_progress_cb progress_cb,
538
538
  void *progress_payload)
539
539
  {
540
540
  transport_local *t = (transport_local*)transport;
@@ -588,7 +588,7 @@ static int local_download_pack(
588
588
  goto cleanup;
589
589
 
590
590
  if (t->progress_cb &&
591
- (error = t->progress_cb(git_buf_cstr(&progress_info), git_buf_len(&progress_info), t->message_cb_payload)) < 0)
591
+ (error = t->progress_cb(git_buf_cstr(&progress_info), (int)git_buf_len(&progress_info), t->message_cb_payload)) < 0)
592
592
  goto cleanup;
593
593
 
594
594
  /* Walk the objects, building a packfile */
@@ -602,7 +602,7 @@ static int local_download_pack(
602
602
  goto cleanup;
603
603
 
604
604
  if (t->progress_cb &&
605
- (error = t->progress_cb(git_buf_cstr(&progress_info), git_buf_len(&progress_info), t->message_cb_payload)) < 0)
605
+ (error = t->progress_cb(git_buf_cstr(&progress_info), (int)git_buf_len(&progress_info), t->message_cb_payload)) < 0)
606
606
  goto cleanup;
607
607
 
608
608
  if ((error = git_odb_write_pack(&writepack, odb, progress_cb, progress_payload)) != 0)
@@ -63,7 +63,7 @@ static int git_smart__set_callbacks(
63
63
  git_transport_certificate_check_cb certificate_check_cb,
64
64
  void *message_cb_payload)
65
65
  {
66
- transport_smart *t = (transport_smart *)transport;
66
+ transport_smart *t = GIT_CONTAINER_OF(transport, transport_smart, parent);
67
67
 
68
68
  t->progress_cb = progress_cb;
69
69
  t->error_cb = error_cb;
@@ -73,7 +73,7 @@ static int git_smart__set_callbacks(
73
73
  return 0;
74
74
  }
75
75
 
76
- static int http_header_name_length(const char *http_header)
76
+ static size_t http_header_name_length(const char *http_header)
77
77
  {
78
78
  const char *colon = strchr(http_header, ':');
79
79
  if (!colon)
@@ -84,7 +84,7 @@ static int http_header_name_length(const char *http_header)
84
84
  static bool is_malformed_http_header(const char *http_header)
85
85
  {
86
86
  const char *c;
87
- int name_len;
87
+ size_t name_len;
88
88
 
89
89
  /* Disallow \r and \n */
90
90
  c = strchr(http_header, '\r');
@@ -114,7 +114,7 @@ static char *forbidden_custom_headers[] = {
114
114
  static bool is_forbidden_custom_header(const char *custom_header)
115
115
  {
116
116
  unsigned long i;
117
- int name_len = http_header_name_length(custom_header);
117
+ size_t name_len = http_header_name_length(custom_header);
118
118
 
119
119
  /* Disallow headers that we set */
120
120
  for (i = 0; i < ARRAY_SIZE(forbidden_custom_headers); i++)
@@ -128,7 +128,7 @@ static int git_smart__set_custom_headers(
128
128
  git_transport *transport,
129
129
  const git_strarray *custom_headers)
130
130
  {
131
- transport_smart *t = (transport_smart *)transport;
131
+ transport_smart *t = GIT_CONTAINER_OF(transport, transport_smart, parent);
132
132
  size_t i;
133
133
 
134
134
  if (t->custom_headers.count)
@@ -212,7 +212,7 @@ static int git_smart__connect(
212
212
  int direction,
213
213
  int flags)
214
214
  {
215
- transport_smart *t = (transport_smart *)transport;
215
+ transport_smart *t = GIT_CONTAINER_OF(transport, transport_smart, parent);
216
216
  git_smart_subtransport_stream *stream;
217
217
  int error;
218
218
  git_pkt *pkt;
@@ -286,7 +286,7 @@ static int git_smart__connect(
286
286
  if ((error = git_smart__detect_caps(first, &t->caps, &symrefs)) == 0) {
287
287
  /* If the only ref in the list is capabilities^{} with OID_ZERO, remove it */
288
288
  if (1 == t->refs.length && !strcmp(first->head.name, "capabilities^{}") &&
289
- git_oid_iszero(&first->head.oid)) {
289
+ git_oid_is_zero(&first->head.oid)) {
290
290
  git_vector_clear(&t->refs);
291
291
  git_pkt_free((git_pkt *)first);
292
292
  }
@@ -315,7 +315,7 @@ cleanup:
315
315
 
316
316
  static int git_smart__ls(const git_remote_head ***out, size_t *size, git_transport *transport)
317
317
  {
318
- transport_smart *t = (transport_smart *)transport;
318
+ transport_smart *t = GIT_CONTAINER_OF(transport, transport_smart, parent);
319
319
 
320
320
  if (!t->have_refs) {
321
321
  git_error_set(GIT_ERROR_NET, "the transport has not yet loaded the refs");
@@ -330,7 +330,7 @@ static int git_smart__ls(const git_remote_head ***out, size_t *size, git_transpo
330
330
 
331
331
  int git_smart__negotiation_step(git_transport *transport, void *data, size_t len)
332
332
  {
333
- transport_smart *t = (transport_smart *)transport;
333
+ transport_smart *t = GIT_CONTAINER_OF(transport, transport_smart, parent);
334
334
  git_smart_subtransport_stream *stream;
335
335
  int error;
336
336
 
@@ -387,21 +387,21 @@ int git_smart__get_push_stream(transport_smart *t, git_smart_subtransport_stream
387
387
 
388
388
  static void git_smart__cancel(git_transport *transport)
389
389
  {
390
- transport_smart *t = (transport_smart *)transport;
390
+ transport_smart *t = GIT_CONTAINER_OF(transport, transport_smart, parent);
391
391
 
392
392
  git_atomic_set(&t->cancelled, 1);
393
393
  }
394
394
 
395
395
  static int git_smart__is_connected(git_transport *transport)
396
396
  {
397
- transport_smart *t = (transport_smart *)transport;
397
+ transport_smart *t = GIT_CONTAINER_OF(transport, transport_smart, parent);
398
398
 
399
399
  return t->connected;
400
400
  }
401
401
 
402
402
  static int git_smart__read_flags(git_transport *transport, int *flags)
403
403
  {
404
- transport_smart *t = (transport_smart *)transport;
404
+ transport_smart *t = GIT_CONTAINER_OF(transport, transport_smart, parent);
405
405
 
406
406
  *flags = t->flags;
407
407
 
@@ -410,7 +410,7 @@ static int git_smart__read_flags(git_transport *transport, int *flags)
410
410
 
411
411
  static int git_smart__close(git_transport *transport)
412
412
  {
413
- transport_smart *t = (transport_smart *)transport;
413
+ transport_smart *t = GIT_CONTAINER_OF(transport, transport_smart, parent);
414
414
  git_vector *common = &t->common;
415
415
  unsigned int i;
416
416
  git_pkt *p;
@@ -447,7 +447,7 @@ static int git_smart__close(git_transport *transport)
447
447
 
448
448
  static void git_smart__free(git_transport *transport)
449
449
  {
450
- transport_smart *t = (transport_smart *)transport;
450
+ transport_smart *t = GIT_CONTAINER_OF(transport, transport_smart, parent);
451
451
  git_vector *refs = &t->refs;
452
452
  unsigned int i;
453
453
  git_pkt *p;
@@ -479,7 +479,7 @@ static int ref_name_cmp(const void *a, const void *b)
479
479
 
480
480
  int git_transport_smart_certificate_check(git_transport *transport, git_cert *cert, int valid, const char *hostname)
481
481
  {
482
- transport_smart *t = (transport_smart *)transport;
482
+ transport_smart *t = GIT_CONTAINER_OF(transport, transport_smart, parent);
483
483
 
484
484
  assert(transport && cert && hostname);
485
485
 
@@ -491,7 +491,7 @@ int git_transport_smart_certificate_check(git_transport *transport, git_cert *ce
491
491
 
492
492
  int git_transport_smart_credentials(git_cred **out, git_transport *transport, const char *user, int methods)
493
493
  {
494
- transport_smart *t = (transport_smart *)transport;
494
+ transport_smart *t = GIT_CONTAINER_OF(transport, transport_smart, parent);
495
495
 
496
496
  assert(out && transport);
497
497
 
@@ -503,7 +503,7 @@ int git_transport_smart_credentials(git_cred **out, git_transport *transport, co
503
503
 
504
504
  int git_transport_smart_proxy_options(git_proxy_options *out, git_transport *transport)
505
505
  {
506
- transport_smart *t = (transport_smart *) transport;
506
+ transport_smart *t = GIT_CONTAINER_OF(transport, transport_smart, parent);
507
507
  return git_proxy_options_dup(out, &t->proxy);
508
508
  }
509
509
 
@@ -177,8 +177,8 @@ int git_smart__negotiate_fetch(
177
177
  int git_smart__download_pack(
178
178
  git_transport *transport,
179
179
  git_repository *repo,
180
- git_transfer_progress *stats,
181
- git_transfer_progress_cb progress_cb,
180
+ git_indexer_progress *stats,
181
+ git_indexer_progress_cb progress_cb,
182
182
  void *progress_payload);
183
183
 
184
184
  /* smart.c */
@@ -17,6 +17,7 @@
17
17
  #include "pack-objects.h"
18
18
  #include "remote.h"
19
19
  #include "util.h"
20
+ #include "revwalk.h"
20
21
 
21
22
  #define NETWORK_XFER_THRESHOLD (100*1024)
22
23
  /* The minimal interval between progress updates (in seconds). */
@@ -270,50 +271,6 @@ static int store_common(transport_smart *t)
270
271
  return 0;
271
272
  }
272
273
 
273
- static int fetch_setup_walk(git_revwalk **out, git_repository *repo)
274
- {
275
- git_revwalk *walk = NULL;
276
- git_strarray refs;
277
- unsigned int i;
278
- git_reference *ref = NULL;
279
- int error;
280
-
281
- if ((error = git_reference_list(&refs, repo)) < 0)
282
- return error;
283
-
284
- if ((error = git_revwalk_new(&walk, repo)) < 0)
285
- return error;
286
-
287
- git_revwalk_sorting(walk, GIT_SORT_TIME);
288
-
289
- for (i = 0; i < refs.count; ++i) {
290
- git_reference_free(ref);
291
- ref = NULL;
292
-
293
- /* No tags */
294
- if (!git__prefixcmp(refs.strings[i], GIT_REFS_TAGS_DIR))
295
- continue;
296
-
297
- if ((error = git_reference_lookup(&ref, repo, refs.strings[i])) < 0)
298
- goto on_error;
299
-
300
- if (git_reference_type(ref) == GIT_REFERENCE_SYMBOLIC)
301
- continue;
302
-
303
- if ((error = git_revwalk_push(walk, git_reference_target(ref))) < 0)
304
- goto on_error;
305
- }
306
-
307
- *out = walk;
308
-
309
- on_error:
310
- if (error)
311
- git_revwalk_free(walk);
312
- git_reference_free(ref);
313
- git_strarray_free(&refs);
314
- return error;
315
- }
316
-
317
274
  static int wait_while_ack(gitno_buffer *buf)
318
275
  {
319
276
  int error;
@@ -347,6 +304,7 @@ static int wait_while_ack(gitno_buffer *buf)
347
304
  int git_smart__negotiate_fetch(git_transport *transport, git_repository *repo, const git_remote_head * const *wants, size_t count)
348
305
  {
349
306
  transport_smart *t = (transport_smart *)transport;
307
+ git_revwalk__push_options opts = GIT_REVWALK__PUSH_OPTIONS_INIT;
350
308
  gitno_buffer *buf = &t->buffer;
351
309
  git_buf data = GIT_BUF_INIT;
352
310
  git_revwalk *walk = NULL;
@@ -358,7 +316,11 @@ int git_smart__negotiate_fetch(git_transport *transport, git_repository *repo, c
358
316
  if ((error = git_pkt_buffer_wants(wants, count, &t->caps, &data)) < 0)
359
317
  return error;
360
318
 
361
- if ((error = fetch_setup_walk(&walk, repo)) < 0)
319
+ if ((error = git_revwalk_new(&walk, repo)) < 0)
320
+ goto on_error;
321
+
322
+ opts.insert_by_date = 1;
323
+ if ((error = git_revwalk__push_glob(walk, "refs/*", &opts)) < 0)
362
324
  goto on_error;
363
325
 
364
326
  /*
@@ -492,7 +454,7 @@ on_error:
492
454
  return error;
493
455
  }
494
456
 
495
- static int no_sideband(transport_smart *t, struct git_odb_writepack *writepack, gitno_buffer *buf, git_transfer_progress *stats)
457
+ static int no_sideband(transport_smart *t, struct git_odb_writepack *writepack, gitno_buffer *buf, git_indexer_progress *stats)
496
458
  {
497
459
  int recvd;
498
460
 
@@ -519,9 +481,9 @@ static int no_sideband(transport_smart *t, struct git_odb_writepack *writepack,
519
481
 
520
482
  struct network_packetsize_payload
521
483
  {
522
- git_transfer_progress_cb callback;
484
+ git_indexer_progress_cb callback;
523
485
  void *payload;
524
- git_transfer_progress *stats;
486
+ git_indexer_progress *stats;
525
487
  size_t last_fired_bytes;
526
488
  };
527
489
 
@@ -546,8 +508,8 @@ static int network_packetsize(size_t received, void *payload)
546
508
  int git_smart__download_pack(
547
509
  git_transport *transport,
548
510
  git_repository *repo,
549
- git_transfer_progress *stats,
550
- git_transfer_progress_cb transfer_progress_cb,
511
+ git_indexer_progress *stats,
512
+ git_indexer_progress_cb progress_cb,
551
513
  void *progress_payload)
552
514
  {
553
515
  transport_smart *t = (transport_smart *)transport;
@@ -557,10 +519,10 @@ int git_smart__download_pack(
557
519
  int error = 0;
558
520
  struct network_packetsize_payload npp = {0};
559
521
 
560
- memset(stats, 0, sizeof(git_transfer_progress));
522
+ memset(stats, 0, sizeof(git_indexer_progress));
561
523
 
562
- if (transfer_progress_cb) {
563
- npp.callback = transfer_progress_cb;
524
+ if (progress_cb) {
525
+ npp.callback = progress_cb;
564
526
  npp.payload = progress_payload;
565
527
  npp.stats = stats;
566
528
  t->packetsize_cb = &network_packetsize;
@@ -573,7 +535,7 @@ int git_smart__download_pack(
573
535
  }
574
536
 
575
537
  if ((error = git_repository_odb__weakptr(&odb, repo)) < 0 ||
576
- ((error = git_odb_write_pack(&writepack, odb, transfer_progress_cb, progress_payload)) != 0))
538
+ ((error = git_odb_write_pack(&writepack, odb, progress_cb, progress_payload)) != 0))
577
539
  goto done;
578
540
 
579
541
  /*
@@ -604,7 +566,14 @@ int git_smart__download_pack(
604
566
  } else if (pkt->type == GIT_PKT_PROGRESS) {
605
567
  if (t->progress_cb) {
606
568
  git_pkt_progress *p = (git_pkt_progress *) pkt;
607
- error = t->progress_cb(p->data, p->len, t->message_cb_payload);
569
+
570
+ if (p->len > INT_MAX) {
571
+ git_error_set(GIT_ERROR_NET, "oversized progress message");
572
+ error = GIT_ERROR;
573
+ goto done;
574
+ }
575
+
576
+ error = t->progress_cb(p->data, (int)p->len, t->message_cb_payload);
608
577
  }
609
578
  } else if (pkt->type == GIT_PKT_DATA) {
610
579
  git_pkt_data *p = (git_pkt_data *) pkt;
@@ -626,7 +595,7 @@ int git_smart__download_pack(
626
595
  } while (1);
627
596
 
628
597
  /*
629
- * Trailing execution of transfer_progress_cb, if necessary...
598
+ * Trailing execution of progress_cb, if necessary...
630
599
  * Only the callback through the npp datastructure currently
631
600
  * updates the last_fired_bytes value. It is possible that
632
601
  * progress has already been reported with the correct
@@ -645,7 +614,7 @@ int git_smart__download_pack(
645
614
  done:
646
615
  if (writepack)
647
616
  writepack->free(writepack);
648
- if (transfer_progress_cb) {
617
+ if (progress_cb) {
649
618
  t->packetsize_cb = NULL;
650
619
  t->packetsize_payload = NULL;
651
620
  }
@@ -839,7 +808,14 @@ static int parse_report(transport_smart *transport, git_push *push)
839
808
  case GIT_PKT_PROGRESS:
840
809
  if (transport->progress_cb) {
841
810
  git_pkt_progress *p = (git_pkt_progress *) pkt;
842
- error = transport->progress_cb(p->data, p->len, transport->message_cb_payload);
811
+
812
+ if (p->len > INT_MAX) {
813
+ git_error_set(GIT_ERROR_NET, "oversized progress message");
814
+ error = GIT_ERROR;
815
+ goto done;
816
+ }
817
+
818
+ error = transport->progress_cb(p->data, (int)p->len, transport->message_cb_payload);
843
819
  }
844
820
  break;
845
821
  default:
@@ -963,7 +939,7 @@ static int update_refs_from_report(
963
939
 
964
940
  /* Remove any refs which we updated to have a zero OID. */
965
941
  git_vector_rforeach(refs, i, ref) {
966
- if (git_oid_iszero(&ref->head.oid)) {
942
+ if (git_oid_is_zero(&ref->head.oid)) {
967
943
  git_vector_remove(refs, i);
968
944
  git_pkt_free((git_pkt *)ref);
969
945
  }
@@ -978,7 +954,7 @@ struct push_packbuilder_payload
978
954
  {
979
955
  git_smart_subtransport_stream *stream;
980
956
  git_packbuilder *pb;
981
- git_push_transfer_progress cb;
957
+ git_push_transfer_progress_cb cb;
982
958
  void *cb_payload;
983
959
  size_t last_bytes;
984
960
  double last_progress_report_time;
@@ -14,11 +14,14 @@
14
14
  #include "global.h"
15
15
  #include "git2.h"
16
16
  #include "buffer.h"
17
+ #include "net.h"
17
18
  #include "netops.h"
18
19
  #include "smart.h"
19
- #include "cred.h"
20
20
  #include "streams/socket.h"
21
21
 
22
+ #include "git2/cred.h"
23
+ #include "git2/sys/cred.h"
24
+
22
25
  #ifdef GIT_SSH
23
26
 
24
27
  #define OWNING_SUBTRANSPORT(s) ((ssh_subtransport *)(s)->parent.subtransport)
@@ -132,7 +135,7 @@ static int ssh_stream_read(
132
135
  size_t *bytes_read)
133
136
  {
134
137
  int rc;
135
- ssh_stream *s = (ssh_stream *)stream;
138
+ ssh_stream *s = GIT_CONTAINER_OF(stream, ssh_stream, parent);
136
139
 
137
140
  *bytes_read = 0;
138
141
 
@@ -170,7 +173,7 @@ static int ssh_stream_write(
170
173
  const char *buffer,
171
174
  size_t len)
172
175
  {
173
- ssh_stream *s = (ssh_stream *)stream;
176
+ ssh_stream *s = GIT_CONTAINER_OF(stream, ssh_stream, parent);
174
177
  size_t off = 0;
175
178
  ssize_t ret = 0;
176
179
 
@@ -196,7 +199,7 @@ static int ssh_stream_write(
196
199
 
197
200
  static void ssh_stream_free(git_smart_subtransport_stream *stream)
198
201
  {
199
- ssh_stream *s = (ssh_stream *)stream;
202
+ ssh_stream *s = GIT_CONTAINER_OF(stream, ssh_stream, parent);
200
203
  ssh_subtransport *t;
201
204
 
202
205
  if (!stream)
@@ -258,8 +261,7 @@ static int ssh_stream_alloc(
258
261
  }
259
262
 
260
263
  static int git_ssh_extract_url_parts(
261
- char **host,
262
- char **username,
264
+ git_net_url *urldata,
263
265
  const char *url)
264
266
  {
265
267
  char *colon, *at;
@@ -271,11 +273,11 @@ static int git_ssh_extract_url_parts(
271
273
  at = strchr(url, '@');
272
274
  if (at) {
273
275
  start = at + 1;
274
- *username = git__substrdup(url, at - url);
275
- GIT_ERROR_CHECK_ALLOC(*username);
276
+ urldata->username = git__substrdup(url, at - url);
277
+ GIT_ERROR_CHECK_ALLOC(urldata->username);
276
278
  } else {
277
279
  start = url;
278
- *username = NULL;
280
+ urldata->username = NULL;
279
281
  }
280
282
 
281
283
  if (colon == NULL || (colon < start)) {
@@ -283,8 +285,8 @@ static int git_ssh_extract_url_parts(
283
285
  return -1;
284
286
  }
285
287
 
286
- *host = git__substrdup(start, colon - start);
287
- GIT_ERROR_CHECK_ALLOC(*host);
288
+ urldata->host = git__substrdup(start, colon - start);
289
+ GIT_ERROR_CHECK_ALLOC(urldata->host);
288
290
 
289
291
  return 0;
290
292
  }
@@ -479,7 +481,7 @@ static int _git_ssh_session_create(
479
481
  {
480
482
  int rc = 0;
481
483
  LIBSSH2_SESSION* s;
482
- git_socket_stream *socket = (git_socket_stream *) io;
484
+ git_socket_stream *socket = GIT_CONTAINER_OF(io, git_socket_stream, parent);
483
485
 
484
486
  assert(session);
485
487
 
@@ -506,14 +508,15 @@ static int _git_ssh_session_create(
506
508
  return 0;
507
509
  }
508
510
 
511
+ #define SSH_DEFAULT_PORT "22"
512
+
509
513
  static int _git_ssh_setup_conn(
510
514
  ssh_subtransport *t,
511
515
  const char *url,
512
516
  const char *cmd,
513
517
  git_smart_subtransport_stream **stream)
514
518
  {
515
- char *host=NULL, *port=NULL, *path=NULL, *user=NULL, *pass=NULL;
516
- const char *default_port="22";
519
+ git_net_url urldata = GIT_NET_URL_INIT;
517
520
  int auth_methods, error = 0;
518
521
  size_t i;
519
522
  ssh_stream *s;
@@ -535,19 +538,22 @@ static int _git_ssh_setup_conn(
535
538
  const char *p = ssh_prefixes[i];
536
539
 
537
540
  if (!git__prefixcmp(url, p)) {
538
- if ((error = gitno_extract_url_parts(&host, &port, &path, &user, &pass, url, default_port)) < 0)
541
+ if ((error = git_net_url_parse(&urldata, url)) < 0)
539
542
  goto done;
540
543
 
541
544
  goto post_extract;
542
545
  }
543
546
  }
544
- if ((error = git_ssh_extract_url_parts(&host, &user, url)) < 0)
547
+ if ((error = git_ssh_extract_url_parts(&urldata, url)) < 0)
545
548
  goto done;
546
- port = git__strdup(default_port);
547
- GIT_ERROR_CHECK_ALLOC(port);
549
+
550
+ if (urldata.port == NULL)
551
+ urldata.port = git__strdup(SSH_DEFAULT_PORT);
552
+
553
+ GIT_ERROR_CHECK_ALLOC(urldata.port);
548
554
 
549
555
  post_extract:
550
- if ((error = git_socket_stream_new(&s->io, host, port)) < 0 ||
556
+ if ((error = git_socket_stream_new(&s->io, urldata.host, urldata.port)) < 0 ||
551
557
  (error = git_stream_connect(s->io)) < 0)
552
558
  goto done;
553
559
 
@@ -560,6 +566,14 @@ post_extract:
560
566
 
561
567
  cert.parent.cert_type = GIT_CERT_HOSTKEY_LIBSSH2;
562
568
 
569
+ #ifdef LIBSSH2_HOSTKEY_HASH_SHA256
570
+ key = libssh2_hostkey_hash(session, LIBSSH2_HOSTKEY_HASH_SHA256);
571
+ if (key != NULL) {
572
+ cert.type |= GIT_CERT_SSH_SHA256;
573
+ memcpy(&cert.hash_sha256, key, 32);
574
+ }
575
+ #endif
576
+
563
577
  key = libssh2_hostkey_hash(session, LIBSSH2_HOSTKEY_HASH_SHA1);
564
578
  if (key != NULL) {
565
579
  cert.type |= GIT_CERT_SSH_SHA1;
@@ -583,7 +597,7 @@ post_extract:
583
597
 
584
598
  cert_ptr = &cert;
585
599
 
586
- error = t->owner->certificate_check_cb((git_cert *) cert_ptr, 0, host, t->owner->message_cb_payload);
600
+ error = t->owner->certificate_check_cb((git_cert *) cert_ptr, 0, urldata.host, t->owner->message_cb_payload);
587
601
 
588
602
  if (error < 0 && error != GIT_PASSTHROUGH) {
589
603
  if (!git_error_last())
@@ -594,21 +608,21 @@ post_extract:
594
608
  }
595
609
 
596
610
  /* we need the username to ask for auth methods */
597
- if (!user) {
611
+ if (!urldata.username) {
598
612
  if ((error = request_creds(&cred, t, NULL, GIT_CREDTYPE_USERNAME)) < 0)
599
613
  goto done;
600
614
 
601
- user = git__strdup(((git_cred_username *) cred)->username);
615
+ urldata.username = git__strdup(((git_cred_username *) cred)->username);
602
616
  cred->free(cred);
603
617
  cred = NULL;
604
- if (!user)
618
+ if (!urldata.username)
605
619
  goto done;
606
- } else if (user && pass) {
607
- if ((error = git_cred_userpass_plaintext_new(&cred, user, pass)) < 0)
620
+ } else if (urldata.username && urldata.password) {
621
+ if ((error = git_cred_userpass_plaintext_new(&cred, urldata.username, urldata.password)) < 0)
608
622
  goto done;
609
623
  }
610
624
 
611
- if ((error = list_auth_methods(&auth_methods, session, user)) < 0)
625
+ if ((error = list_auth_methods(&auth_methods, session, urldata.username)) < 0)
612
626
  goto done;
613
627
 
614
628
  error = GIT_EAUTH;
@@ -622,10 +636,10 @@ post_extract:
622
636
  cred = NULL;
623
637
  }
624
638
 
625
- if ((error = request_creds(&cred, t, user, auth_methods)) < 0)
639
+ if ((error = request_creds(&cred, t, urldata.username, auth_methods)) < 0)
626
640
  goto done;
627
641
 
628
- if (strcmp(user, git_cred__username(cred))) {
642
+ if (strcmp(urldata.username, git_cred_get_username(cred))) {
629
643
  git_error_set(GIT_ERROR_SSH, "username does not match previous request");
630
644
  error = -1;
631
645
  goto done;
@@ -662,11 +676,7 @@ done:
662
676
  if (cred)
663
677
  cred->free(cred);
664
678
 
665
- git__free(host);
666
- git__free(port);
667
- git__free(path);
668
- git__free(user);
669
- git__free(pass);
679
+ git_net_url_dispose(&urldata);
670
680
 
671
681
  return error;
672
682
  }
@@ -730,7 +740,7 @@ static int _ssh_action(
730
740
  const char *url,
731
741
  git_smart_service_t action)
732
742
  {
733
- ssh_subtransport *t = (ssh_subtransport *) subtransport;
743
+ ssh_subtransport *t = GIT_CONTAINER_OF(subtransport, ssh_subtransport, parent);
734
744
 
735
745
  switch (action) {
736
746
  case GIT_SERVICE_UPLOADPACK_LS:
@@ -752,7 +762,7 @@ static int _ssh_action(
752
762
 
753
763
  static int _ssh_close(git_smart_subtransport *subtransport)
754
764
  {
755
- ssh_subtransport *t = (ssh_subtransport *) subtransport;
765
+ ssh_subtransport *t = GIT_CONTAINER_OF(subtransport, ssh_subtransport, parent);
756
766
 
757
767
  assert(!t->current_stream);
758
768
 
@@ -763,7 +773,7 @@ static int _ssh_close(git_smart_subtransport *subtransport)
763
773
 
764
774
  static void _ssh_free(git_smart_subtransport *subtransport)
765
775
  {
766
- ssh_subtransport *t = (ssh_subtransport *) subtransport;
776
+ ssh_subtransport *t = GIT_CONTAINER_OF(subtransport, ssh_subtransport, parent);
767
777
 
768
778
  assert(!t->current_stream);
769
779