rugged 0.27.7 → 0.27.10

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 (409) 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 +99 -51
  5. data/vendor/libgit2/COPYING +28 -0
  6. data/vendor/libgit2/cmake/Modules/AddCFlagIfSupported.cmake +15 -1
  7. data/vendor/libgit2/cmake/Modules/CheckPrototypeDefinition.c.in +29 -0
  8. data/vendor/libgit2/cmake/Modules/CheckPrototypeDefinition.cmake +96 -0
  9. data/vendor/libgit2/cmake/Modules/EnableWarnings.cmake +9 -8
  10. data/vendor/libgit2/cmake/Modules/FindCoreFoundation.cmake +2 -2
  11. data/vendor/libgit2/cmake/Modules/FindGSSAPI.cmake +1 -1
  12. data/vendor/libgit2/cmake/Modules/FindGSSFramework.cmake +28 -0
  13. data/vendor/libgit2/cmake/Modules/FindIconv.cmake +11 -6
  14. data/vendor/libgit2/cmake/Modules/FindPCRE.cmake +38 -0
  15. data/vendor/libgit2/cmake/Modules/FindPCRE2.cmake +37 -0
  16. data/vendor/libgit2/cmake/Modules/FindSecurity.cmake +2 -2
  17. data/vendor/libgit2/cmake/Modules/FindStatNsec.cmake +6 -0
  18. data/vendor/libgit2/cmake/Modules/PkgBuildConfig.cmake +110 -0
  19. data/vendor/libgit2/cmake/Modules/SelectGSSAPI.cmake +53 -0
  20. data/vendor/libgit2/cmake/Modules/SelectHTTPSBackend.cmake +124 -0
  21. data/vendor/libgit2/cmake/Modules/SelectHashes.cmake +66 -0
  22. data/vendor/libgit2/deps/http-parser/http_parser.c +11 -6
  23. data/vendor/libgit2/deps/ntlmclient/CMakeLists.txt +21 -0
  24. data/vendor/libgit2/deps/ntlmclient/compat.h +33 -0
  25. data/vendor/libgit2/deps/ntlmclient/crypt.h +64 -0
  26. data/vendor/libgit2/deps/ntlmclient/crypt_commoncrypto.c +120 -0
  27. data/vendor/libgit2/deps/ntlmclient/crypt_commoncrypto.h +18 -0
  28. data/vendor/libgit2/deps/ntlmclient/crypt_mbedtls.c +145 -0
  29. data/vendor/libgit2/deps/ntlmclient/crypt_mbedtls.h +18 -0
  30. data/vendor/libgit2/deps/ntlmclient/crypt_openssl.c +130 -0
  31. data/vendor/libgit2/deps/ntlmclient/crypt_openssl.h +21 -0
  32. data/vendor/libgit2/deps/ntlmclient/ntlm.c +1420 -0
  33. data/vendor/libgit2/deps/ntlmclient/ntlm.h +174 -0
  34. data/vendor/libgit2/deps/ntlmclient/ntlmclient.h +320 -0
  35. data/vendor/libgit2/deps/ntlmclient/unicode.h +36 -0
  36. data/vendor/libgit2/deps/ntlmclient/unicode_builtin.c +445 -0
  37. data/vendor/libgit2/deps/ntlmclient/unicode_iconv.c +201 -0
  38. data/vendor/libgit2/deps/ntlmclient/utf8.h +1257 -0
  39. data/vendor/libgit2/deps/ntlmclient/util.c +21 -0
  40. data/vendor/libgit2/deps/ntlmclient/util.h +14 -0
  41. data/vendor/libgit2/deps/pcre/CMakeLists.txt +140 -0
  42. data/vendor/libgit2/deps/pcre/COPYING +5 -0
  43. data/vendor/libgit2/deps/pcre/cmake/COPYING-CMAKE-SCRIPTS +22 -0
  44. data/vendor/libgit2/deps/pcre/cmake/FindEditline.cmake +17 -0
  45. data/vendor/libgit2/deps/pcre/cmake/FindPackageHandleStandardArgs.cmake +58 -0
  46. data/vendor/libgit2/deps/pcre/cmake/FindReadline.cmake +29 -0
  47. data/vendor/libgit2/deps/pcre/config.h.in +57 -0
  48. data/vendor/libgit2/deps/pcre/pcre.h +641 -0
  49. data/vendor/libgit2/deps/pcre/pcre_byte_order.c +319 -0
  50. data/vendor/libgit2/deps/pcre/pcre_chartables.c +198 -0
  51. data/vendor/libgit2/deps/pcre/pcre_compile.c +9800 -0
  52. data/vendor/libgit2/deps/pcre/pcre_config.c +190 -0
  53. data/vendor/libgit2/deps/pcre/pcre_dfa_exec.c +3676 -0
  54. data/vendor/libgit2/deps/pcre/pcre_exec.c +7173 -0
  55. data/vendor/libgit2/deps/pcre/pcre_fullinfo.c +245 -0
  56. data/vendor/libgit2/deps/pcre/pcre_get.c +669 -0
  57. data/vendor/libgit2/deps/pcre/pcre_globals.c +86 -0
  58. data/vendor/libgit2/deps/pcre/pcre_internal.h +2787 -0
  59. data/vendor/libgit2/deps/pcre/pcre_jit_compile.c +11913 -0
  60. data/vendor/libgit2/deps/pcre/pcre_maketables.c +156 -0
  61. data/vendor/libgit2/deps/pcre/pcre_newline.c +210 -0
  62. data/vendor/libgit2/deps/pcre/pcre_ord2utf8.c +94 -0
  63. data/vendor/libgit2/deps/pcre/pcre_printint.c +834 -0
  64. data/vendor/libgit2/deps/pcre/pcre_refcount.c +92 -0
  65. data/vendor/libgit2/deps/pcre/pcre_string_utils.c +211 -0
  66. data/vendor/libgit2/deps/pcre/pcre_study.c +1686 -0
  67. data/vendor/libgit2/deps/pcre/pcre_tables.c +727 -0
  68. data/vendor/libgit2/deps/pcre/pcre_ucd.c +3644 -0
  69. data/vendor/libgit2/deps/pcre/pcre_valid_utf8.c +301 -0
  70. data/vendor/libgit2/deps/pcre/pcre_version.c +98 -0
  71. data/vendor/libgit2/deps/pcre/pcre_xclass.c +268 -0
  72. data/vendor/libgit2/deps/pcre/pcreposix.c +421 -0
  73. data/vendor/libgit2/deps/pcre/pcreposix.h +117 -0
  74. data/vendor/libgit2/deps/pcre/ucp.h +224 -0
  75. data/vendor/libgit2/deps/winhttp/COPYING.GPL +993 -0
  76. data/vendor/libgit2/deps/winhttp/COPYING.LGPL +502 -0
  77. data/vendor/libgit2/deps/zlib/CMakeLists.txt +1 -0
  78. data/vendor/libgit2/deps/zlib/COPYING +27 -0
  79. data/vendor/libgit2/deps/zlib/adler32.c +0 -7
  80. data/vendor/libgit2/deps/zlib/crc32.c +0 -7
  81. data/vendor/libgit2/include/git2/annotated_commit.h +9 -0
  82. data/vendor/libgit2/include/git2/apply.h +149 -0
  83. data/vendor/libgit2/include/git2/attr.h +20 -13
  84. data/vendor/libgit2/include/git2/blame.h +4 -4
  85. data/vendor/libgit2/include/git2/blob.h +44 -12
  86. data/vendor/libgit2/include/git2/buffer.h +20 -26
  87. data/vendor/libgit2/include/git2/cert.h +135 -0
  88. data/vendor/libgit2/include/git2/checkout.h +53 -21
  89. data/vendor/libgit2/include/git2/cherrypick.h +3 -3
  90. data/vendor/libgit2/include/git2/clone.h +5 -5
  91. data/vendor/libgit2/include/git2/commit.h +25 -3
  92. data/vendor/libgit2/include/git2/common.h +35 -10
  93. data/vendor/libgit2/include/git2/config.h +29 -19
  94. data/vendor/libgit2/include/git2/cred.h +308 -0
  95. data/vendor/libgit2/include/git2/deprecated.h +493 -0
  96. data/vendor/libgit2/include/git2/describe.h +4 -4
  97. data/vendor/libgit2/include/git2/diff.h +177 -135
  98. data/vendor/libgit2/include/git2/errors.h +53 -46
  99. data/vendor/libgit2/include/git2/filter.h +8 -0
  100. data/vendor/libgit2/include/git2/index.h +74 -52
  101. data/vendor/libgit2/include/git2/indexer.h +76 -6
  102. data/vendor/libgit2/include/git2/merge.h +25 -10
  103. data/vendor/libgit2/include/git2/net.h +0 -5
  104. data/vendor/libgit2/include/git2/notes.h +1 -1
  105. data/vendor/libgit2/include/git2/object.h +17 -29
  106. data/vendor/libgit2/include/git2/odb.h +12 -11
  107. data/vendor/libgit2/include/git2/odb_backend.h +10 -9
  108. data/vendor/libgit2/include/git2/oid.h +2 -2
  109. data/vendor/libgit2/include/git2/pack.h +14 -3
  110. data/vendor/libgit2/include/git2/proxy.h +5 -3
  111. data/vendor/libgit2/include/git2/rebase.h +46 -2
  112. data/vendor/libgit2/include/git2/refs.h +34 -16
  113. data/vendor/libgit2/include/git2/remote.h +111 -14
  114. data/vendor/libgit2/include/git2/repository.h +69 -34
  115. data/vendor/libgit2/include/git2/revert.h +1 -1
  116. data/vendor/libgit2/include/git2/revwalk.h +7 -7
  117. data/vendor/libgit2/include/git2/signature.h +2 -2
  118. data/vendor/libgit2/include/git2/stash.h +5 -5
  119. data/vendor/libgit2/include/git2/status.h +26 -17
  120. data/vendor/libgit2/include/git2/submodule.h +23 -6
  121. data/vendor/libgit2/include/git2/sys/alloc.h +18 -18
  122. data/vendor/libgit2/include/git2/sys/commit.h +1 -1
  123. data/vendor/libgit2/include/git2/sys/config.h +13 -13
  124. data/vendor/libgit2/include/git2/sys/cred.h +90 -0
  125. data/vendor/libgit2/include/git2/sys/filter.h +6 -6
  126. data/vendor/libgit2/include/git2/sys/merge.h +3 -3
  127. data/vendor/libgit2/include/git2/sys/odb_backend.h +66 -22
  128. data/vendor/libgit2/include/git2/sys/path.h +14 -5
  129. data/vendor/libgit2/include/git2/sys/refdb_backend.h +76 -40
  130. data/vendor/libgit2/include/git2/sys/repository.h +5 -1
  131. data/vendor/libgit2/include/git2/sys/stream.h +92 -12
  132. data/vendor/libgit2/include/git2/sys/transport.h +129 -83
  133. data/vendor/libgit2/include/git2/tag.h +13 -4
  134. data/vendor/libgit2/include/git2/trace.h +2 -2
  135. data/vendor/libgit2/include/git2/transport.h +11 -311
  136. data/vendor/libgit2/include/git2/tree.h +4 -4
  137. data/vendor/libgit2/include/git2/types.h +25 -106
  138. data/vendor/libgit2/include/git2/version.h +3 -3
  139. data/vendor/libgit2/include/git2/worktree.h +5 -5
  140. data/vendor/libgit2/include/git2.h +4 -0
  141. data/vendor/libgit2/src/CMakeLists.txt +104 -235
  142. data/vendor/libgit2/src/alloc.c +14 -18
  143. data/vendor/libgit2/src/{stdalloc.c → allocators/stdalloc.c} +7 -8
  144. data/vendor/libgit2/src/{stdalloc.h → allocators/stdalloc.h} +4 -4
  145. data/vendor/libgit2/src/allocators/win32_crtdbg.c +118 -0
  146. data/vendor/libgit2/src/{transports/cred.h → allocators/win32_crtdbg.h} +5 -4
  147. data/vendor/libgit2/src/annotated_commit.c +18 -11
  148. data/vendor/libgit2/src/apply.c +535 -28
  149. data/vendor/libgit2/src/apply.h +3 -1
  150. data/vendor/libgit2/src/array.h +2 -2
  151. data/vendor/libgit2/src/attr.c +77 -71
  152. data/vendor/libgit2/src/attr_file.c +203 -117
  153. data/vendor/libgit2/src/attr_file.h +9 -9
  154. data/vendor/libgit2/src/attrcache.c +49 -51
  155. data/vendor/libgit2/src/attrcache.h +2 -1
  156. data/vendor/libgit2/src/blame.c +38 -18
  157. data/vendor/libgit2/src/blame.h +1 -1
  158. data/vendor/libgit2/src/blame_git.c +29 -15
  159. data/vendor/libgit2/src/blob.c +123 -37
  160. data/vendor/libgit2/src/blob.h +19 -2
  161. data/vendor/libgit2/src/branch.c +47 -23
  162. data/vendor/libgit2/src/buf_text.c +7 -6
  163. data/vendor/libgit2/src/buffer.c +60 -53
  164. data/vendor/libgit2/src/cache.c +38 -45
  165. data/vendor/libgit2/src/cache.h +3 -3
  166. data/vendor/libgit2/src/cc-compat.h +20 -3
  167. data/vendor/libgit2/src/checkout.c +77 -67
  168. data/vendor/libgit2/src/cherrypick.c +12 -6
  169. data/vendor/libgit2/src/clone.c +36 -14
  170. data/vendor/libgit2/src/clone.h +4 -0
  171. data/vendor/libgit2/src/commit.c +103 -48
  172. data/vendor/libgit2/src/commit.h +7 -0
  173. data/vendor/libgit2/src/commit_list.c +36 -78
  174. data/vendor/libgit2/src/commit_list.h +2 -2
  175. data/vendor/libgit2/src/common.h +24 -90
  176. data/vendor/libgit2/src/config.c +203 -176
  177. data/vendor/libgit2/src/config.h +8 -20
  178. data/vendor/libgit2/src/config_backend.h +96 -0
  179. data/vendor/libgit2/src/config_cache.c +41 -35
  180. data/vendor/libgit2/src/config_entries.c +229 -0
  181. data/vendor/libgit2/src/config_entries.h +24 -0
  182. data/vendor/libgit2/src/config_file.c +422 -680
  183. data/vendor/libgit2/src/config_mem.c +220 -0
  184. data/vendor/libgit2/src/config_parse.c +96 -68
  185. data/vendor/libgit2/src/config_parse.h +15 -14
  186. data/vendor/libgit2/src/config_snapshot.c +206 -0
  187. data/vendor/libgit2/src/crlf.c +219 -196
  188. data/vendor/libgit2/src/delta.c +25 -18
  189. data/vendor/libgit2/src/describe.c +42 -41
  190. data/vendor/libgit2/src/diff.c +52 -67
  191. data/vendor/libgit2/src/diff.h +2 -1
  192. data/vendor/libgit2/src/diff_driver.c +44 -46
  193. data/vendor/libgit2/src/diff_file.c +16 -14
  194. data/vendor/libgit2/src/diff_file.h +1 -1
  195. data/vendor/libgit2/src/diff_generate.c +158 -103
  196. data/vendor/libgit2/src/diff_generate.h +3 -3
  197. data/vendor/libgit2/src/diff_parse.c +4 -4
  198. data/vendor/libgit2/src/diff_print.c +34 -22
  199. data/vendor/libgit2/src/diff_stats.c +22 -7
  200. data/vendor/libgit2/src/diff_tform.c +18 -16
  201. data/vendor/libgit2/src/diff_xdiff.c +3 -3
  202. data/vendor/libgit2/src/errors.c +51 -39
  203. data/vendor/libgit2/src/errors.h +81 -0
  204. data/vendor/libgit2/src/features.h.in +9 -3
  205. data/vendor/libgit2/src/fetch.c +8 -3
  206. data/vendor/libgit2/src/fetchhead.c +12 -12
  207. data/vendor/libgit2/src/filebuf.c +28 -32
  208. data/vendor/libgit2/src/filebuf.h +2 -2
  209. data/vendor/libgit2/src/filter.c +47 -33
  210. data/vendor/libgit2/src/filter.h +0 -10
  211. data/vendor/libgit2/src/{fileops.c → futils.c} +70 -63
  212. data/vendor/libgit2/src/{fileops.h → futils.h} +6 -6
  213. data/vendor/libgit2/src/global.c +35 -55
  214. data/vendor/libgit2/src/global.h +0 -2
  215. data/vendor/libgit2/src/hash/sha1/collisiondetect.c +48 -0
  216. data/vendor/libgit2/src/hash/sha1/collisiondetect.h +19 -0
  217. data/vendor/libgit2/src/hash/{hash_common_crypto.h → sha1/common_crypto.c} +17 -17
  218. data/vendor/libgit2/src/hash/sha1/common_crypto.h +19 -0
  219. data/vendor/libgit2/src/hash/{hash_generic.c → sha1/generic.c} +22 -10
  220. data/vendor/libgit2/src/hash/{hash_generic.h → sha1/generic.h} +4 -10
  221. data/vendor/libgit2/src/hash/{hash_mbedtls.c → sha1/mbedtls.c} +15 -7
  222. data/vendor/libgit2/src/hash/{hash_mbedtls.h → sha1/mbedtls.h} +6 -7
  223. data/vendor/libgit2/src/hash/sha1/openssl.c +59 -0
  224. data/vendor/libgit2/src/hash/sha1/openssl.h +19 -0
  225. data/vendor/libgit2/src/hash/{sha1dc → sha1/sha1dc}/sha1.c +14 -3
  226. data/vendor/libgit2/src/hash/{hash_win32.c → sha1/win32.c} +47 -37
  227. data/vendor/libgit2/src/hash/{hash_win32.h → sha1/win32.h} +6 -19
  228. data/vendor/libgit2/src/hash/sha1.h +38 -0
  229. data/vendor/libgit2/src/hash.c +61 -0
  230. data/vendor/libgit2/src/hash.h +20 -21
  231. data/vendor/libgit2/src/hashsig.c +5 -5
  232. data/vendor/libgit2/src/idxmap.c +107 -61
  233. data/vendor/libgit2/src/idxmap.h +153 -31
  234. data/vendor/libgit2/src/ignore.c +38 -42
  235. data/vendor/libgit2/src/index.c +264 -199
  236. data/vendor/libgit2/src/index.h +7 -1
  237. data/vendor/libgit2/src/indexer.c +338 -167
  238. data/vendor/libgit2/src/integer.h +71 -26
  239. data/vendor/libgit2/src/iterator.c +134 -62
  240. data/vendor/libgit2/src/iterator.h +15 -0
  241. data/vendor/libgit2/src/mailmap.c +8 -8
  242. data/vendor/libgit2/src/map.h +1 -1
  243. data/vendor/libgit2/src/merge.c +137 -93
  244. data/vendor/libgit2/src/merge_driver.c +11 -11
  245. data/vendor/libgit2/src/merge_file.c +2 -2
  246. data/vendor/libgit2/src/mwindow.c +24 -29
  247. data/vendor/libgit2/src/mwindow.h +4 -4
  248. data/vendor/libgit2/src/net.c +184 -0
  249. data/vendor/libgit2/src/net.h +36 -0
  250. data/vendor/libgit2/src/netops.c +55 -156
  251. data/vendor/libgit2/src/netops.h +3 -23
  252. data/vendor/libgit2/src/notes.c +14 -9
  253. data/vendor/libgit2/src/object.c +120 -69
  254. data/vendor/libgit2/src/object.h +22 -9
  255. data/vendor/libgit2/src/object_api.c +8 -8
  256. data/vendor/libgit2/src/odb.c +111 -88
  257. data/vendor/libgit2/src/odb.h +8 -7
  258. data/vendor/libgit2/src/odb_loose.c +58 -47
  259. data/vendor/libgit2/src/odb_mempack.c +21 -34
  260. data/vendor/libgit2/src/odb_pack.c +17 -13
  261. data/vendor/libgit2/src/offmap.c +53 -35
  262. data/vendor/libgit2/src/offmap.h +108 -21
  263. data/vendor/libgit2/src/oid.c +12 -7
  264. data/vendor/libgit2/src/oidmap.c +49 -47
  265. data/vendor/libgit2/src/oidmap.h +101 -24
  266. data/vendor/libgit2/src/pack-objects.c +87 -86
  267. data/vendor/libgit2/src/pack-objects.h +2 -8
  268. data/vendor/libgit2/src/pack.c +94 -96
  269. data/vendor/libgit2/src/pack.h +16 -18
  270. data/vendor/libgit2/src/parse.c +17 -4
  271. data/vendor/libgit2/src/parse.h +3 -3
  272. data/vendor/libgit2/src/patch.c +3 -3
  273. data/vendor/libgit2/src/patch_generate.c +18 -18
  274. data/vendor/libgit2/src/patch_parse.c +147 -79
  275. data/vendor/libgit2/src/path.c +207 -62
  276. data/vendor/libgit2/src/path.h +14 -0
  277. data/vendor/libgit2/src/pathspec.c +18 -18
  278. data/vendor/libgit2/src/pool.c +26 -22
  279. data/vendor/libgit2/src/pool.h +7 -7
  280. data/vendor/libgit2/src/posix.c +10 -10
  281. data/vendor/libgit2/src/posix.h +12 -1
  282. data/vendor/libgit2/src/proxy.c +8 -3
  283. data/vendor/libgit2/src/push.c +35 -29
  284. data/vendor/libgit2/src/push.h +2 -1
  285. data/vendor/libgit2/src/reader.c +265 -0
  286. data/vendor/libgit2/src/reader.h +107 -0
  287. data/vendor/libgit2/src/rebase.c +97 -38
  288. data/vendor/libgit2/src/refdb.c +15 -3
  289. data/vendor/libgit2/src/refdb_fs.c +318 -222
  290. data/vendor/libgit2/src/reflog.c +13 -15
  291. data/vendor/libgit2/src/refs.c +122 -89
  292. data/vendor/libgit2/src/refs.h +5 -3
  293. data/vendor/libgit2/src/refspec.c +27 -33
  294. data/vendor/libgit2/src/regexp.c +221 -0
  295. data/vendor/libgit2/src/regexp.h +97 -0
  296. data/vendor/libgit2/src/remote.c +229 -178
  297. data/vendor/libgit2/src/remote.h +11 -2
  298. data/vendor/libgit2/src/repository.c +227 -172
  299. data/vendor/libgit2/src/repository.h +52 -40
  300. data/vendor/libgit2/src/reset.c +7 -7
  301. data/vendor/libgit2/src/revert.c +11 -6
  302. data/vendor/libgit2/src/revparse.c +46 -46
  303. data/vendor/libgit2/src/revwalk.c +89 -54
  304. data/vendor/libgit2/src/revwalk.h +20 -0
  305. data/vendor/libgit2/src/settings.c +22 -9
  306. data/vendor/libgit2/src/signature.c +15 -13
  307. data/vendor/libgit2/src/sortedcache.c +22 -36
  308. data/vendor/libgit2/src/sortedcache.h +1 -1
  309. data/vendor/libgit2/src/stash.c +56 -76
  310. data/vendor/libgit2/src/status.c +27 -21
  311. data/vendor/libgit2/src/stream.h +17 -2
  312. data/vendor/libgit2/src/streams/mbedtls.c +100 -80
  313. data/vendor/libgit2/src/streams/mbedtls.h +5 -2
  314. data/vendor/libgit2/src/streams/openssl.c +93 -81
  315. data/vendor/libgit2/src/streams/openssl.h +5 -2
  316. data/vendor/libgit2/src/streams/registry.c +118 -0
  317. data/vendor/libgit2/src/streams/registry.h +19 -0
  318. data/vendor/libgit2/src/streams/socket.c +55 -30
  319. data/vendor/libgit2/src/streams/stransport.c +57 -32
  320. data/vendor/libgit2/src/streams/stransport.h +5 -0
  321. data/vendor/libgit2/src/streams/tls.c +48 -20
  322. data/vendor/libgit2/src/streams/tls.h +12 -4
  323. data/vendor/libgit2/src/strmap.c +47 -74
  324. data/vendor/libgit2/src/strmap.h +108 -33
  325. data/vendor/libgit2/src/submodule.c +190 -169
  326. data/vendor/libgit2/src/submodule.h +1 -1
  327. data/vendor/libgit2/src/sysdir.c +25 -15
  328. data/vendor/libgit2/src/tag.c +39 -26
  329. data/vendor/libgit2/src/tag.h +2 -1
  330. data/vendor/libgit2/src/trace.c +2 -2
  331. data/vendor/libgit2/src/trace.h +2 -2
  332. data/vendor/libgit2/src/trailer.c +46 -32
  333. data/vendor/libgit2/src/transaction.c +30 -29
  334. data/vendor/libgit2/src/transport.c +3 -3
  335. data/vendor/libgit2/src/transports/auth.c +14 -10
  336. data/vendor/libgit2/src/transports/auth.h +10 -3
  337. data/vendor/libgit2/src/transports/auth_negotiate.c +31 -16
  338. data/vendor/libgit2/src/transports/auth_negotiate.h +2 -2
  339. data/vendor/libgit2/src/transports/auth_ntlm.c +223 -0
  340. data/vendor/libgit2/src/transports/auth_ntlm.h +35 -0
  341. data/vendor/libgit2/src/transports/cred.c +24 -24
  342. data/vendor/libgit2/src/transports/git.c +25 -30
  343. data/vendor/libgit2/src/transports/http.c +871 -335
  344. data/vendor/libgit2/src/transports/http.h +2 -0
  345. data/vendor/libgit2/src/transports/local.c +28 -28
  346. data/vendor/libgit2/src/transports/smart.c +64 -46
  347. data/vendor/libgit2/src/transports/smart.h +5 -6
  348. data/vendor/libgit2/src/transports/smart_pkt.c +162 -151
  349. data/vendor/libgit2/src/transports/smart_protocol.c +64 -94
  350. data/vendor/libgit2/src/transports/ssh.c +76 -65
  351. data/vendor/libgit2/src/transports/winhttp.c +328 -319
  352. data/vendor/libgit2/src/tree-cache.c +21 -14
  353. data/vendor/libgit2/src/tree.c +119 -112
  354. data/vendor/libgit2/src/tree.h +1 -0
  355. data/vendor/libgit2/src/unix/map.c +3 -3
  356. data/vendor/libgit2/src/unix/posix.h +1 -11
  357. data/vendor/libgit2/src/userdiff.h +3 -1
  358. data/vendor/libgit2/src/util.c +154 -93
  359. data/vendor/libgit2/src/util.h +19 -23
  360. data/vendor/libgit2/src/vector.c +15 -10
  361. data/vendor/libgit2/src/wildmatch.c +320 -0
  362. data/vendor/libgit2/src/wildmatch.h +23 -0
  363. data/vendor/libgit2/src/win32/dir.c +3 -3
  364. data/vendor/libgit2/src/win32/findfile.c +1 -1
  365. data/vendor/libgit2/src/win32/map.c +9 -11
  366. data/vendor/libgit2/src/win32/msvc-compat.h +6 -0
  367. data/vendor/libgit2/src/win32/path_w32.c +113 -9
  368. data/vendor/libgit2/src/win32/path_w32.h +18 -29
  369. data/vendor/libgit2/src/win32/posix.h +1 -4
  370. data/vendor/libgit2/src/win32/posix_w32.c +69 -44
  371. data/vendor/libgit2/src/win32/precompiled.h +0 -2
  372. data/vendor/libgit2/src/win32/thread.c +5 -10
  373. data/vendor/libgit2/src/win32/w32_buffer.c +9 -5
  374. data/vendor/libgit2/src/win32/w32_common.h +39 -0
  375. data/vendor/libgit2/src/win32/w32_crtdbg_stacktrace.c +2 -95
  376. data/vendor/libgit2/src/win32/w32_crtdbg_stacktrace.h +0 -2
  377. data/vendor/libgit2/src/win32/w32_stack.c +6 -11
  378. data/vendor/libgit2/src/win32/w32_stack.h +3 -3
  379. data/vendor/libgit2/src/win32/w32_util.c +27 -64
  380. data/vendor/libgit2/src/win32/w32_util.h +5 -49
  381. data/vendor/libgit2/src/worktree.c +44 -30
  382. data/vendor/libgit2/src/xdiff/xdiffi.c +5 -5
  383. data/vendor/libgit2/src/xdiff/xhistogram.c +1 -1
  384. data/vendor/libgit2/src/xdiff/xmerge.c +27 -15
  385. data/vendor/libgit2/src/xdiff/xpatience.c +3 -0
  386. data/vendor/libgit2/src/zstream.c +4 -4
  387. metadata +115 -38
  388. data/vendor/libgit2/deps/regex/CMakeLists.txt +0 -2
  389. data/vendor/libgit2/deps/regex/config.h +0 -7
  390. data/vendor/libgit2/deps/regex/regcomp.c +0 -3857
  391. data/vendor/libgit2/deps/regex/regex.c +0 -92
  392. data/vendor/libgit2/deps/regex/regex.h +0 -582
  393. data/vendor/libgit2/deps/regex/regex_internal.c +0 -1744
  394. data/vendor/libgit2/deps/regex/regex_internal.h +0 -819
  395. data/vendor/libgit2/deps/regex/regexec.c +0 -4369
  396. data/vendor/libgit2/include/git2/inttypes.h +0 -309
  397. data/vendor/libgit2/include/git2/sys/time.h +0 -31
  398. data/vendor/libgit2/libgit2.pc.in +0 -13
  399. data/vendor/libgit2/src/config_file.h +0 -73
  400. data/vendor/libgit2/src/fnmatch.c +0 -248
  401. data/vendor/libgit2/src/fnmatch.h +0 -48
  402. data/vendor/libgit2/src/hash/hash_collisiondetect.h +0 -47
  403. data/vendor/libgit2/src/hash/hash_openssl.h +0 -59
  404. data/vendor/libgit2/src/streams/curl.c +0 -385
  405. data/vendor/libgit2/src/streams/curl.h +0 -17
  406. /data/vendor/libgit2/deps/http-parser/{LICENSE-MIT → COPYING} +0 -0
  407. /data/vendor/libgit2/src/hash/{sha1dc → sha1/sha1dc}/sha1.h +0 -0
  408. /data/vendor/libgit2/src/hash/{sha1dc → sha1/sha1dc}/ubc_check.c +0 -0
  409. /data/vendor/libgit2/src/hash/{sha1dc → sha1/sha1dc}/ubc_check.h +0 -0
@@ -35,7 +35,7 @@ static int add_refspec_to(git_vector *vector, const char *string, bool is_fetch)
35
35
  git_refspec *spec;
36
36
 
37
37
  spec = git__calloc(1, sizeof(git_refspec));
38
- GITERR_CHECK_ALLOC(spec);
38
+ GIT_ERROR_CHECK_ALLOC(spec);
39
39
 
40
40
  if (git_refspec__parse(spec, string, is_fetch) < 0) {
41
41
  git__free(spec);
@@ -85,8 +85,8 @@ static int ensure_remote_name_is_valid(const char *name)
85
85
  int error = 0;
86
86
 
87
87
  if (!git_remote_is_valid_name(name)) {
88
- giterr_set(
89
- GITERR_CONFIG,
88
+ git_error_set(
89
+ GIT_ERROR_CONFIG,
90
90
  "'%s' is not a valid remote name.", name ? name : "(null)");
91
91
  error = GIT_EINVALIDSPEC;
92
92
  }
@@ -111,7 +111,7 @@ static int write_add_refspec(git_repository *repo, const char *name, const char
111
111
  return error;
112
112
 
113
113
  if ((error = git_refspec__parse(&spec, refspec, fetch)) < 0) {
114
- if (giterr_last()->klass != GITERR_NOMEMORY)
114
+ if (git_error_last()->klass != GIT_ERROR_NOMEMORY)
115
115
  error = GIT_EINVALIDSPEC;
116
116
 
117
117
  return error;
@@ -136,39 +136,10 @@ cleanup:
136
136
  return 0;
137
137
  }
138
138
 
139
- #if 0
140
- /* We could export this as a helper */
141
- static int get_check_cert(int *out, git_repository *repo)
142
- {
143
- git_config *cfg;
144
- const char *val;
145
- int error = 0;
146
-
147
- assert(out && repo);
148
-
149
- /* By default, we *DO* want to verify the certificate. */
150
- *out = 1;
151
-
152
- /* Go through the possible sources for SSL verification settings, from
153
- * most specific to least specific. */
154
-
155
- /* GIT_SSL_NO_VERIFY environment variable */
156
- if ((val = p_getenv("GIT_SSL_NO_VERIFY")) != NULL)
157
- return git_config_parse_bool(out, val);
158
-
159
- /* http.sslVerify config setting */
160
- if ((error = git_repository_config__weakptr(&cfg, repo)) < 0)
161
- return error;
162
-
163
- *out = git_config__get_bool_force(cfg, "http.sslverify", 1);
164
- return 0;
165
- }
166
- #endif
167
-
168
139
  static int canonicalize_url(git_buf *out, const char *in)
169
140
  {
170
141
  if (in == NULL || strlen(in) == 0) {
171
- giterr_set(GITERR_INVALID, "cannot set empty URL");
142
+ git_error_set(GIT_ERROR_INVALID, "cannot set empty URL");
172
143
  return GIT_EINVALIDSPEC;
173
144
  }
174
145
 
@@ -189,58 +160,124 @@ static int canonicalize_url(git_buf *out, const char *in)
189
160
  return git_buf_puts(out, in);
190
161
  }
191
162
 
192
- static int create_internal(git_remote **out, git_repository *repo, const char *name, const char *url, const char *fetch)
163
+ static int default_fetchspec_for_name(git_buf *buf, const char *name)
193
164
  {
165
+ if (git_buf_printf(buf, "+refs/heads/*:refs/remotes/%s/*", name) < 0)
166
+ return -1;
167
+
168
+ return 0;
169
+ }
170
+
171
+ static int ensure_remote_doesnot_exist(git_repository *repo, const char *name)
172
+ {
173
+ int error;
194
174
  git_remote *remote;
175
+
176
+ error = git_remote_lookup(&remote, repo, name);
177
+
178
+ if (error == GIT_ENOTFOUND)
179
+ return 0;
180
+
181
+ if (error < 0)
182
+ return error;
183
+
184
+ git_remote_free(remote);
185
+
186
+ git_error_set(GIT_ERROR_CONFIG, "remote '%s' already exists", name);
187
+
188
+ return GIT_EEXISTS;
189
+ }
190
+
191
+ int git_remote_create_options_init(git_remote_create_options *opts, unsigned int version)
192
+ {
193
+ GIT_INIT_STRUCTURE_FROM_TEMPLATE(
194
+ opts, version, git_remote_create_options, GIT_REMOTE_CREATE_OPTIONS_INIT);
195
+ return 0;
196
+ }
197
+
198
+ int git_remote_create_init_options(git_remote_create_options *opts, unsigned int version)
199
+ {
200
+ return git_remote_create_options_init(opts, version);
201
+ }
202
+
203
+ int git_remote_create_with_opts(git_remote **out, const char *url, const git_remote_create_options *opts)
204
+ {
205
+ git_remote *remote = NULL;
195
206
  git_config *config_ro = NULL, *config_rw;
196
207
  git_buf canonical_url = GIT_BUF_INIT;
197
208
  git_buf var = GIT_BUF_INIT;
209
+ git_buf specbuf = GIT_BUF_INIT;
210
+ const git_remote_create_options dummy_opts = GIT_REMOTE_CREATE_OPTIONS_INIT;
198
211
  int error = -1;
199
212
 
200
- /* repo, name, and fetch are optional */
201
213
  assert(out && url);
202
214
 
203
- if (repo && (error = git_repository_config_snapshot(&config_ro, repo)) < 0)
204
- return error;
215
+ if (!opts) {
216
+ opts = &dummy_opts;
217
+ }
218
+
219
+ GIT_ERROR_CHECK_VERSION(opts, GIT_REMOTE_CREATE_OPTIONS_VERSION, "git_remote_create_options");
220
+
221
+ if (opts->name != NULL) {
222
+ if ((error = ensure_remote_name_is_valid(opts->name)) < 0)
223
+ return error;
224
+
225
+ if (opts->repository &&
226
+ (error = ensure_remote_doesnot_exist(opts->repository, opts->name)) < 0)
227
+ return error;
228
+ }
229
+
230
+ if (opts->repository) {
231
+ if ((error = git_repository_config_snapshot(&config_ro, opts->repository)) < 0)
232
+ goto on_error;
233
+ }
205
234
 
206
235
  remote = git__calloc(1, sizeof(git_remote));
207
- GITERR_CHECK_ALLOC(remote);
236
+ GIT_ERROR_CHECK_ALLOC(remote);
208
237
 
209
- remote->repo = repo;
238
+ remote->repo = opts->repository;
210
239
 
211
- if ((error = git_vector_init(&remote->refs, 32, NULL)) < 0 ||
240
+ if ((error = git_vector_init(&remote->refs, 8, NULL)) < 0 ||
212
241
  (error = canonicalize_url(&canonical_url, url)) < 0)
213
242
  goto on_error;
214
243
 
215
- if (repo) {
244
+ if (opts->repository && !(opts->flags & GIT_REMOTE_CREATE_SKIP_INSTEADOF)) {
216
245
  remote->url = apply_insteadof(config_ro, canonical_url.ptr, GIT_DIRECTION_FETCH);
217
246
  } else {
218
247
  remote->url = git__strdup(canonical_url.ptr);
219
248
  }
220
- GITERR_CHECK_ALLOC(remote->url);
221
-
222
- if (name != NULL) {
223
- remote->name = git__strdup(name);
224
- GITERR_CHECK_ALLOC(remote->name);
249
+ GIT_ERROR_CHECK_ALLOC(remote->url);
225
250
 
226
- if ((error = git_buf_printf(&var, CONFIG_URL_FMT, name)) < 0)
227
- goto on_error;
251
+ if (opts->name != NULL) {
252
+ remote->name = git__strdup(opts->name);
253
+ GIT_ERROR_CHECK_ALLOC(remote->name);
228
254
 
229
- if (repo &&
230
- ((error = git_repository_config__weakptr(&config_rw, repo)) < 0 ||
231
- (error = git_config_set_string(config_rw, var.ptr, canonical_url.ptr)) < 0))
255
+ if (opts->repository &&
256
+ ((error = git_buf_printf(&var, CONFIG_URL_FMT, opts->name)) < 0 ||
257
+ (error = git_repository_config__weakptr(&config_rw, opts->repository)) < 0 ||
258
+ (error = git_config_set_string(config_rw, var.ptr, canonical_url.ptr)) < 0))
232
259
  goto on_error;
233
260
  }
234
261
 
235
- if (fetch != NULL) {
236
- if ((error = add_refspec(remote, fetch, true)) < 0)
237
- goto on_error;
262
+ if (opts->fetchspec != NULL ||
263
+ (opts->name && !(opts->flags & GIT_REMOTE_CREATE_SKIP_DEFAULT_FETCHSPEC))) {
264
+ const char *fetch = NULL;
265
+ if (opts->fetchspec) {
266
+ fetch = opts->fetchspec;
267
+ } else {
268
+ if ((error = default_fetchspec_for_name(&specbuf, opts->name)) < 0)
269
+ goto on_error;
238
270
 
239
- /* only write for non-anonymous remotes */
240
- if (repo && name && (error = write_add_refspec(repo, name, fetch, true)) < 0)
271
+ fetch = git_buf_cstr(&specbuf);
272
+ }
273
+
274
+ if ((error = add_refspec(remote, fetch, true)) < 0)
241
275
  goto on_error;
242
276
 
243
- if (repo && (error = lookup_remote_prune_config(remote, config_ro, name)) < 0)
277
+ /* only write for named remotes with a repository */
278
+ if (opts->repository && opts->name &&
279
+ ((error = write_add_refspec(opts->repository, opts->name, fetch, true)) < 0 ||
280
+ (error = lookup_remote_prune_config(remote, config_ro, opts->name)) < 0))
244
281
  goto on_error;
245
282
 
246
283
  /* Move the data over to where the matching functions can find them */
@@ -249,7 +286,7 @@ static int create_internal(git_remote **out, git_repository *repo, const char *n
249
286
  }
250
287
 
251
288
  /* A remote without a name doesn't download tags */
252
- if (!name)
289
+ if (!opts->name)
253
290
  remote->download_tags = GIT_REMOTE_DOWNLOAD_TAGS_NONE;
254
291
  else
255
292
  remote->download_tags = GIT_REMOTE_DOWNLOAD_TAGS_AUTO;
@@ -265,43 +302,32 @@ on_error:
265
302
  git_remote_free(remote);
266
303
 
267
304
  git_config_free(config_ro);
305
+ git_buf_dispose(&specbuf);
268
306
  git_buf_dispose(&canonical_url);
269
307
  git_buf_dispose(&var);
270
308
  return error;
271
309
  }
272
310
 
273
- static int ensure_remote_doesnot_exist(git_repository *repo, const char *name)
311
+ int git_remote_create(git_remote **out, git_repository *repo, const char *name, const char *url)
274
312
  {
313
+ git_buf buf = GIT_BUF_INIT;
275
314
  int error;
276
- git_remote *remote;
315
+ git_remote_create_options opts = GIT_REMOTE_CREATE_OPTIONS_INIT;
277
316
 
278
- error = git_remote_lookup(&remote, repo, name);
279
-
280
- if (error == GIT_ENOTFOUND)
281
- return 0;
282
-
283
- if (error < 0)
317
+ /* Those 2 tests are duplicated here because of backward-compatibility */
318
+ if ((error = ensure_remote_name_is_valid(name)) < 0)
284
319
  return error;
285
320
 
286
- git_remote_free(remote);
287
-
288
- giterr_set(
289
- GITERR_CONFIG,
290
- "remote '%s' already exists", name);
321
+ if (canonicalize_url(&buf, url) < 0)
322
+ return GIT_ERROR;
291
323
 
292
- return GIT_EEXISTS;
293
- }
324
+ git_buf_clear(&buf);
294
325
 
326
+ opts.repository = repo;
327
+ opts.name = name;
295
328
 
296
- int git_remote_create(git_remote **out, git_repository *repo, const char *name, const char *url)
297
- {
298
- git_buf buf = GIT_BUF_INIT;
299
- int error;
300
-
301
- if (git_buf_printf(&buf, "+refs/heads/*:refs/remotes/%s/*", name) < 0)
302
- return -1;
329
+ error = git_remote_create_with_opts(out, url, &opts);
303
330
 
304
- error = git_remote_create_with_fetchspec(out, repo, name, url, git_buf_cstr(&buf));
305
331
  git_buf_dispose(&buf);
306
332
 
307
333
  return error;
@@ -309,35 +335,32 @@ int git_remote_create(git_remote **out, git_repository *repo, const char *name,
309
335
 
310
336
  int git_remote_create_with_fetchspec(git_remote **out, git_repository *repo, const char *name, const char *url, const char *fetch)
311
337
  {
312
- git_remote *remote = NULL;
313
338
  int error;
339
+ git_remote_create_options opts = GIT_REMOTE_CREATE_OPTIONS_INIT;
314
340
 
315
341
  if ((error = ensure_remote_name_is_valid(name)) < 0)
316
342
  return error;
317
343
 
318
- if ((error = ensure_remote_doesnot_exist(repo, name)) < 0)
319
- return error;
344
+ opts.repository = repo;
345
+ opts.name = name;
346
+ opts.fetchspec = fetch;
347
+ opts.flags = GIT_REMOTE_CREATE_SKIP_DEFAULT_FETCHSPEC;
320
348
 
321
- if (create_internal(&remote, repo, name, url, fetch) < 0)
322
- goto on_error;
323
-
324
- *out = remote;
325
-
326
- return 0;
327
-
328
- on_error:
329
- git_remote_free(remote);
330
- return -1;
349
+ return git_remote_create_with_opts(out, url, &opts);
331
350
  }
332
351
 
333
352
  int git_remote_create_anonymous(git_remote **out, git_repository *repo, const char *url)
334
353
  {
335
- return create_internal(out, repo, NULL, url, NULL);
354
+ git_remote_create_options opts = GIT_REMOTE_CREATE_OPTIONS_INIT;
355
+
356
+ opts.repository = repo;
357
+
358
+ return git_remote_create_with_opts(out, url, &opts);
336
359
  }
337
360
 
338
361
  int git_remote_create_detached(git_remote **out, const char *url)
339
362
  {
340
- return create_internal(out, NULL, NULL, url, NULL);
363
+ return git_remote_create_with_opts(out, url, NULL);
341
364
  }
342
365
 
343
366
  int git_remote_dup(git_remote **dest, git_remote *source)
@@ -346,21 +369,21 @@ int git_remote_dup(git_remote **dest, git_remote *source)
346
369
  int error = 0;
347
370
  git_refspec *spec;
348
371
  git_remote *remote = git__calloc(1, sizeof(git_remote));
349
- GITERR_CHECK_ALLOC(remote);
372
+ GIT_ERROR_CHECK_ALLOC(remote);
350
373
 
351
374
  if (source->name != NULL) {
352
375
  remote->name = git__strdup(source->name);
353
- GITERR_CHECK_ALLOC(remote->name);
376
+ GIT_ERROR_CHECK_ALLOC(remote->name);
354
377
  }
355
378
 
356
379
  if (source->url != NULL) {
357
380
  remote->url = git__strdup(source->url);
358
- GITERR_CHECK_ALLOC(remote->url);
381
+ GIT_ERROR_CHECK_ALLOC(remote->url);
359
382
  }
360
383
 
361
384
  if (source->pushurl != NULL) {
362
385
  remote->pushurl = git__strdup(source->pushurl);
363
- GITERR_CHECK_ALLOC(remote->pushurl);
386
+ GIT_ERROR_CHECK_ALLOC(remote->pushurl);
364
387
  }
365
388
 
366
389
  remote->repo = source->repo;
@@ -419,7 +442,7 @@ static int get_optional_config(
419
442
  *found = !error;
420
443
 
421
444
  if (error == GIT_ENOTFOUND) {
422
- giterr_clear();
445
+ git_error_clear();
423
446
  error = 0;
424
447
  }
425
448
 
@@ -428,7 +451,7 @@ static int get_optional_config(
428
451
 
429
452
  int git_remote_lookup(git_remote **out, git_repository *repo, const char *name)
430
453
  {
431
- git_remote *remote;
454
+ git_remote *remote = NULL;
432
455
  git_buf buf = GIT_BUF_INIT;
433
456
  const char *val;
434
457
  int error = 0;
@@ -445,10 +468,10 @@ int git_remote_lookup(git_remote **out, git_repository *repo, const char *name)
445
468
  return error;
446
469
 
447
470
  remote = git__calloc(1, sizeof(git_remote));
448
- GITERR_CHECK_ALLOC(remote);
471
+ GIT_ERROR_CHECK_ALLOC(remote);
449
472
 
450
473
  remote->name = git__strdup(name);
451
- GITERR_CHECK_ALLOC(remote->name);
474
+ GIT_ERROR_CHECK_ALLOC(remote->name);
452
475
 
453
476
  if (git_vector_init(&remote->refs, 32, NULL) < 0 ||
454
477
  git_vector_init(&remote->refspecs, 2, NULL) < 0 ||
@@ -471,7 +494,7 @@ int git_remote_lookup(git_remote **out, git_repository *repo, const char *name)
471
494
 
472
495
  if (found && strlen(val) > 0) {
473
496
  remote->url = apply_insteadof(config, val, GIT_DIRECTION_FETCH);
474
- GITERR_CHECK_ALLOC(remote->url);
497
+ GIT_ERROR_CHECK_ALLOC(remote->url);
475
498
  }
476
499
 
477
500
  val = NULL;
@@ -485,13 +508,13 @@ int git_remote_lookup(git_remote **out, git_repository *repo, const char *name)
485
508
 
486
509
  if (!optional_setting_found) {
487
510
  error = GIT_ENOTFOUND;
488
- giterr_set(GITERR_CONFIG, "remote '%s' does not exist", name);
511
+ git_error_set(GIT_ERROR_CONFIG, "remote '%s' does not exist", name);
489
512
  goto cleanup;
490
513
  }
491
514
 
492
515
  if (found && strlen(val) > 0) {
493
516
  remote->pushurl = apply_insteadof(config, val, GIT_DIRECTION_PUSH);
494
- GITERR_CHECK_ALLOC(remote->pushurl);
517
+ GIT_ERROR_CHECK_ALLOC(remote->pushurl);
495
518
  }
496
519
 
497
520
  data.remote = remote;
@@ -510,7 +533,7 @@ int git_remote_lookup(git_remote **out, git_repository *repo, const char *name)
510
533
  if ((error = get_optional_config(NULL, config, &buf, refspec_cb, &data)) < 0)
511
534
  goto cleanup;
512
535
 
513
- if (download_tags_value(remote, config) < 0)
536
+ if ((error = download_tags_value(remote, config)) < 0)
514
537
  goto cleanup;
515
538
 
516
539
  if ((error = lookup_remote_prune_config(remote, config, name)) < 0)
@@ -541,11 +564,11 @@ static int lookup_remote_prune_config(git_remote *remote, git_config *config, co
541
564
 
542
565
  if ((error = git_config_get_bool(&remote->prune_refs, config, git_buf_cstr(&buf))) < 0) {
543
566
  if (error == GIT_ENOTFOUND) {
544
- giterr_clear();
567
+ git_error_clear();
545
568
 
546
569
  if ((error = git_config_get_bool(&remote->prune_refs, config, "fetch.prune")) < 0) {
547
570
  if (error == GIT_ENOTFOUND) {
548
- giterr_clear();
571
+ git_error_clear();
549
572
  error = 0;
550
573
  }
551
574
  }
@@ -623,21 +646,44 @@ int git_remote_set_pushurl(git_repository *repo, const char *remote, const char*
623
646
  return set_url(repo, remote, CONFIG_PUSHURL_FMT, url);
624
647
  }
625
648
 
626
- const char* git_remote__urlfordirection(git_remote *remote, int direction)
649
+ static int resolve_url(git_buf *resolved_url, const char *url, int direction, const git_remote_callbacks *callbacks)
627
650
  {
628
- assert(remote);
651
+ int status;
652
+
653
+ if (callbacks && callbacks->resolve_url) {
654
+ git_buf_clear(resolved_url);
655
+ status = callbacks->resolve_url(resolved_url, url, direction, callbacks->payload);
656
+ if (status != GIT_PASSTHROUGH) {
657
+ git_error_set_after_callback_function(status, "git_resolve_url_cb");
658
+ git_buf_sanitize(resolved_url);
659
+ return status;
660
+ }
661
+ }
662
+
663
+ return git_buf_sets(resolved_url, url);
664
+ }
665
+
666
+ int git_remote__urlfordirection(git_buf *url_out, struct git_remote *remote, int direction, const git_remote_callbacks *callbacks)
667
+ {
668
+ const char *url = NULL;
629
669
 
670
+ assert(remote);
630
671
  assert(direction == GIT_DIRECTION_FETCH || direction == GIT_DIRECTION_PUSH);
631
672
 
632
673
  if (direction == GIT_DIRECTION_FETCH) {
633
- return remote->url;
674
+ url = remote->url;
675
+ } else if (direction == GIT_DIRECTION_PUSH) {
676
+ url = remote->pushurl ? remote->pushurl : remote->url;
634
677
  }
635
678
 
636
- if (direction == GIT_DIRECTION_PUSH) {
637
- return remote->pushurl ? remote->pushurl : remote->url;
679
+ if (!url) {
680
+ git_error_set(GIT_ERROR_INVALID,
681
+ "malformed remote '%s' - missing %s URL",
682
+ remote->name ? remote->name : "(anonymous)",
683
+ direction == GIT_DIRECTION_FETCH ? "fetch" : "push");
684
+ return GIT_EINVALID;
638
685
  }
639
-
640
- return NULL;
686
+ return resolve_url(url_out, url, direction, callbacks);
641
687
  }
642
688
 
643
689
  int set_transport_callbacks(git_transport *t, const git_remote_callbacks *cbs)
@@ -657,10 +703,10 @@ static int set_transport_custom_headers(git_transport *t, const git_strarray *cu
657
703
  return t->set_custom_headers(t, custom_headers);
658
704
  }
659
705
 
660
- int git_remote_connect(git_remote *remote, git_direction direction, const git_remote_callbacks *callbacks, const git_proxy_options *proxy, const git_strarray *custom_headers)
706
+ int git_remote__connect(git_remote *remote, git_direction direction, const git_remote_callbacks *callbacks, const git_remote_connection_opts *conn)
661
707
  {
662
708
  git_transport *t;
663
- const char *url;
709
+ git_buf url = GIT_BUF_INIT;
664
710
  int flags = GIT_TRANSPORTFLAGS_NONE;
665
711
  int error;
666
712
  void *payload = NULL;
@@ -670,50 +716,49 @@ int git_remote_connect(git_remote *remote, git_direction direction, const git_re
670
716
  assert(remote);
671
717
 
672
718
  if (callbacks) {
673
- GITERR_CHECK_VERSION(callbacks, GIT_REMOTE_CALLBACKS_VERSION, "git_remote_callbacks");
719
+ GIT_ERROR_CHECK_VERSION(callbacks, GIT_REMOTE_CALLBACKS_VERSION, "git_remote_callbacks");
674
720
  credentials = callbacks->credentials;
675
721
  transport = callbacks->transport;
676
722
  payload = callbacks->payload;
677
723
  }
678
724
 
679
- if (proxy)
680
- GITERR_CHECK_VERSION(proxy, GIT_PROXY_OPTIONS_VERSION, "git_proxy_options");
725
+ if (conn->proxy)
726
+ GIT_ERROR_CHECK_VERSION(conn->proxy, GIT_PROXY_OPTIONS_VERSION, "git_proxy_options");
681
727
 
682
728
  t = remote->transport;
683
729
 
684
- url = git_remote__urlfordirection(remote, direction);
685
- if (url == NULL) {
686
- giterr_set(GITERR_INVALID,
687
- "Malformed remote '%s' - missing %s URL",
688
- remote->name ? remote->name : "(anonymous)",
689
- direction == GIT_DIRECTION_FETCH ? "fetch" : "push");
690
- return -1;
691
- }
730
+ if ((error = git_remote__urlfordirection(&url, remote, direction, callbacks)) < 0)
731
+ goto on_error;
692
732
 
693
733
  /* If we don't have a transport object yet, and the caller specified a
694
734
  * custom transport factory, use that */
695
735
  if (!t && transport &&
696
736
  (error = transport(&t, remote, payload)) < 0)
697
- return error;
737
+ goto on_error;
698
738
 
699
739
  /* If we still don't have a transport, then use the global
700
740
  * transport registrations which map URI schemes to transport factories */
701
- if (!t && (error = git_transport_new(&t, remote, url)) < 0)
702
- return error;
741
+ if (!t && (error = git_transport_new(&t, remote, url.ptr)) < 0)
742
+ goto on_error;
703
743
 
704
- if ((error = set_transport_custom_headers(t, custom_headers)) != 0)
744
+ if ((error = set_transport_custom_headers(t, conn->custom_headers)) != 0)
705
745
  goto on_error;
706
746
 
707
747
  if ((error = set_transport_callbacks(t, callbacks)) < 0 ||
708
- (error = t->connect(t, url, credentials, payload, proxy, direction, flags)) != 0)
748
+ (error = t->connect(t, url.ptr, credentials, payload, conn->proxy, direction, flags)) != 0)
709
749
  goto on_error;
710
750
 
711
751
  remote->transport = t;
712
752
 
753
+ git_buf_dispose(&url);
754
+
713
755
  return 0;
714
756
 
715
757
  on_error:
716
- t->free(t);
758
+ if (t)
759
+ t->free(t);
760
+
761
+ git_buf_dispose(&url);
717
762
 
718
763
  if (t == remote->transport)
719
764
  remote->transport = NULL;
@@ -721,12 +766,22 @@ on_error:
721
766
  return error;
722
767
  }
723
768
 
769
+ int git_remote_connect(git_remote *remote, git_direction direction, const git_remote_callbacks *callbacks, const git_proxy_options *proxy, const git_strarray *custom_headers)
770
+ {
771
+ git_remote_connection_opts conn;
772
+
773
+ conn.proxy = proxy;
774
+ conn.custom_headers = custom_headers;
775
+
776
+ return git_remote__connect(remote, direction, callbacks, &conn);
777
+ }
778
+
724
779
  int git_remote_ls(const git_remote_head ***out, size_t *size, git_remote *remote)
725
780
  {
726
781
  assert(remote);
727
782
 
728
783
  if (!remote->transport) {
729
- giterr_set(GITERR_NET, "this remote has never connected");
784
+ git_error_set(GIT_ERROR_NET, "this remote has never connected");
730
785
  return -1;
731
786
  }
732
787
 
@@ -790,7 +845,7 @@ int git_remote__get_http_proxy(git_remote *remote, bool use_ssl, char **proxy_ur
790
845
 
791
846
  if (error < 0) {
792
847
  if (error == GIT_ENOTFOUND) {
793
- giterr_clear();
848
+ git_error_clear();
794
849
  error = 0;
795
850
  }
796
851
 
@@ -800,7 +855,7 @@ int git_remote__get_http_proxy(git_remote *remote, bool use_ssl, char **proxy_ur
800
855
  *proxy_url = git_buf_detach(&val);
801
856
 
802
857
  found:
803
- GITERR_CHECK_ALLOC(*proxy_url);
858
+ GIT_ERROR_CHECK_ALLOC(*proxy_url);
804
859
  git_config_entry_free(ce);
805
860
 
806
861
  return 0;
@@ -872,15 +927,15 @@ int git_remote_download(git_remote *remote, const git_strarray *refspecs, const
872
927
  assert(remote);
873
928
 
874
929
  if (!remote->repo) {
875
- giterr_set(GITERR_INVALID, "cannot download detached remote");
930
+ git_error_set(GIT_ERROR_INVALID, "cannot download detached remote");
876
931
  return -1;
877
932
  }
878
933
 
879
934
  if (opts) {
880
- GITERR_CHECK_VERSION(&opts->callbacks, GIT_REMOTE_CALLBACKS_VERSION, "git_remote_callbacks");
935
+ GIT_ERROR_CHECK_VERSION(&opts->callbacks, GIT_REMOTE_CALLBACKS_VERSION, "git_remote_callbacks");
881
936
  cbs = &opts->callbacks;
882
937
  custom_headers = &opts->custom_headers;
883
- GITERR_CHECK_VERSION(&opts->proxy_opts, GIT_PROXY_OPTIONS_VERSION, "git_proxy_options");
938
+ GIT_ERROR_CHECK_VERSION(&opts->proxy_opts, GIT_PROXY_OPTIONS_VERSION, "git_proxy_options");
884
939
  proxy = &opts->proxy_opts;
885
940
  }
886
941
 
@@ -949,21 +1004,20 @@ int git_remote_fetch(
949
1004
  bool prune = false;
950
1005
  git_buf reflog_msg_buf = GIT_BUF_INIT;
951
1006
  const git_remote_callbacks *cbs = NULL;
952
- const git_strarray *custom_headers = NULL;
953
- const git_proxy_options *proxy = NULL;
1007
+ git_remote_connection_opts conn = GIT_REMOTE_CONNECTION_OPTIONS_INIT;
954
1008
 
955
1009
  if (opts) {
956
- GITERR_CHECK_VERSION(&opts->callbacks, GIT_REMOTE_CALLBACKS_VERSION, "git_remote_callbacks");
1010
+ GIT_ERROR_CHECK_VERSION(&opts->callbacks, GIT_REMOTE_CALLBACKS_VERSION, "git_remote_callbacks");
957
1011
  cbs = &opts->callbacks;
958
- custom_headers = &opts->custom_headers;
1012
+ conn.custom_headers = &opts->custom_headers;
959
1013
  update_fetchhead = opts->update_fetchhead;
960
1014
  tagopt = opts->download_tags;
961
- GITERR_CHECK_VERSION(&opts->proxy_opts, GIT_PROXY_OPTIONS_VERSION, "git_proxy_options");
962
- proxy = &opts->proxy_opts;
1015
+ GIT_ERROR_CHECK_VERSION(&opts->proxy_opts, GIT_PROXY_OPTIONS_VERSION, "git_proxy_options");
1016
+ conn.proxy = &opts->proxy_opts;
963
1017
  }
964
1018
 
965
1019
  /* Connect and download everything */
966
- if ((error = git_remote_connect(remote, GIT_DIRECTION_FETCH, cbs, proxy, custom_headers)) != 0)
1020
+ if ((error = git_remote__connect(remote, GIT_DIRECTION_FETCH, cbs, &conn)) != 0)
967
1021
  return error;
968
1022
 
969
1023
  error = git_remote_download(remote, refspecs, opts);
@@ -1041,7 +1095,7 @@ static int ref_to_update(int *update, git_buf *remote_name, git_remote *remote,
1041
1095
  (error = git_refspec_rtransform(remote_name, spec, upstream_name.ptr)) < 0) {
1042
1096
  /* Not an error if there is no upstream */
1043
1097
  if (error == GIT_ENOTFOUND) {
1044
- giterr_clear();
1098
+ git_error_clear();
1045
1099
  error = 0;
1046
1100
  }
1047
1101
 
@@ -1070,7 +1124,7 @@ static int remote_head_for_ref(git_remote_head **out, git_remote *remote, git_re
1070
1124
  error = git_reference_resolve(&resolved_ref, ref);
1071
1125
 
1072
1126
  /* If we're in an unborn branch, let's pretend nothing happened */
1073
- if (error == GIT_ENOTFOUND && git_reference_type(ref) == GIT_REF_SYMBOLIC) {
1127
+ if (error == GIT_ENOTFOUND && git_reference_type(ref) == GIT_REFERENCE_SYMBOLIC) {
1074
1128
  ref_name = git_reference_symbolic_target(ref);
1075
1129
  error = 0;
1076
1130
  } else {
@@ -1176,7 +1230,7 @@ static int prune_candidates(git_vector *candidates, git_remote *remote)
1176
1230
  continue;
1177
1231
 
1178
1232
  refname_dup = git__strdup(refname);
1179
- GITERR_CHECK_ALLOC(refname_dup);
1233
+ GIT_ERROR_CHECK_ALLOC(refname_dup);
1180
1234
 
1181
1235
  if ((error = git_vector_insert(candidates, refname_dup)) < 0)
1182
1236
  goto out;
@@ -1206,7 +1260,7 @@ int git_remote_prune(git_remote *remote, const git_remote_callbacks *callbacks)
1206
1260
  git_oid zero_id = {{ 0 }};
1207
1261
 
1208
1262
  if (callbacks)
1209
- GITERR_CHECK_VERSION(callbacks, GIT_REMOTE_CALLBACKS_VERSION, "git_remote_callbacks");
1263
+ GIT_ERROR_CHECK_VERSION(callbacks, GIT_REMOTE_CALLBACKS_VERSION, "git_remote_callbacks");
1210
1264
 
1211
1265
  if ((error = ls_to_vector(&remote_refs, remote)) < 0)
1212
1266
  goto cleanup;
@@ -1234,7 +1288,7 @@ int git_remote_prune(git_remote *remote, const git_remote_callbacks *callbacks)
1234
1288
  goto cleanup;
1235
1289
 
1236
1290
  key.name = (char *) git_buf_cstr(&buf);
1237
- error = git_vector_search(&pos, &remote_refs, &key);
1291
+ error = git_vector_bsearch(&pos, &remote_refs, &key);
1238
1292
  git_buf_dispose(&buf);
1239
1293
 
1240
1294
  if (error < 0 && error != GIT_ENOTFOUND)
@@ -1273,7 +1327,7 @@ int git_remote_prune(git_remote *remote, const git_remote_callbacks *callbacks)
1273
1327
  if (error < 0)
1274
1328
  goto cleanup;
1275
1329
 
1276
- if (git_reference_type(ref) == GIT_REF_SYMBOLIC) {
1330
+ if (git_reference_type(ref) == GIT_REFERENCE_SYMBOLIC) {
1277
1331
  git_reference_free(ref);
1278
1332
  continue;
1279
1333
  }
@@ -1394,7 +1448,7 @@ static int update_tips_for_spec(
1394
1448
  continue;
1395
1449
 
1396
1450
  /* In autotag mode, don't overwrite any locally-existing tags */
1397
- error = git_reference_create(&ref, remote->repo, refname.ptr, &head->oid, !autotag,
1451
+ error = git_reference_create(&ref, remote->repo, refname.ptr, &head->oid, !autotag,
1398
1452
  log_message);
1399
1453
 
1400
1454
  if (error == GIT_EEXISTS)
@@ -1681,7 +1735,7 @@ static int remote_list_cb(const git_config_entry *entry, void *payload)
1681
1735
  remote_name = git__strndup(name, namelen - 4); /* strip ".url" */
1682
1736
  else
1683
1737
  remote_name = git__strndup(name, namelen - 8); /* strip ".pushurl" */
1684
- GITERR_CHECK_ALLOC(remote_name);
1738
+ GIT_ERROR_CHECK_ALLOC(remote_name);
1685
1739
 
1686
1740
  return git_vector_insert(list, remote_name);
1687
1741
  }
@@ -1714,7 +1768,7 @@ int git_remote_list(git_strarray *remotes_list, git_repository *repo)
1714
1768
  return 0;
1715
1769
  }
1716
1770
 
1717
- const git_transfer_progress* git_remote_stats(git_remote *remote)
1771
+ const git_indexer_progress *git_remote_stats(git_remote *remote)
1718
1772
  {
1719
1773
  assert(remote);
1720
1774
  return &remote->stats;
@@ -1755,7 +1809,7 @@ int git_remote_set_autotag(git_repository *repo, const char *remote, git_remote_
1755
1809
  error = 0;
1756
1810
  break;
1757
1811
  default:
1758
- giterr_set(GITERR_INVALID, "invalid value for the tagopt setting");
1812
+ git_error_set(GIT_ERROR_INVALID, "invalid value for the tagopt setting");
1759
1813
  error = -1;
1760
1814
  }
1761
1815
 
@@ -1863,7 +1917,7 @@ static int rename_one_remote_reference(
1863
1917
  git_buf_cstr(&log_message))) < 0)
1864
1918
  goto cleanup;
1865
1919
 
1866
- if (git_reference_type(ref) != GIT_REF_SYMBOLIC)
1920
+ if (git_reference_type(ref) != GIT_REFERENCE_SYMBOLIC)
1867
1921
  goto cleanup;
1868
1922
 
1869
1923
  /* Handle refs like origin/HEAD -> origin/master */
@@ -1937,8 +1991,7 @@ static int rename_fetch_refspecs(git_vector *problems, git_remote *remote, const
1937
1991
  if ((error = git_vector_init(problems, 1, NULL)) < 0)
1938
1992
  return error;
1939
1993
 
1940
- if ((error = git_buf_printf(
1941
- &base, "+refs/heads/*:refs/remotes/%s/*", remote->name)) < 0)
1994
+ if ((error = default_fetchspec_for_name(&base, remote->name)) < 0)
1942
1995
  return error;
1943
1996
 
1944
1997
  git_vector_foreach(&remote->refspecs, i, spec) {
@@ -1950,7 +2003,7 @@ static int rename_fetch_refspecs(git_vector *problems, git_remote *remote, const
1950
2003
  char *dup;
1951
2004
 
1952
2005
  dup = git__strdup(spec->string);
1953
- GITERR_CHECK_ALLOC(dup);
2006
+ GIT_ERROR_CHECK_ALLOC(dup);
1954
2007
 
1955
2008
  if ((error = git_vector_insert(problems, dup)) < 0)
1956
2009
  break;
@@ -1963,8 +2016,7 @@ static int rename_fetch_refspecs(git_vector *problems, git_remote *remote, const
1963
2016
  git_buf_clear(&val);
1964
2017
  git_buf_clear(&var);
1965
2018
 
1966
- if (git_buf_printf(
1967
- &val, "+refs/heads/*:refs/remotes/%s/*", new_name) < 0 ||
2019
+ if (default_fetchspec_for_name(&val, new_name) < 0 ||
1968
2020
  git_buf_printf(&var, "remote.%s.fetch", new_name) < 0)
1969
2021
  {
1970
2022
  error = -1;
@@ -2047,7 +2099,7 @@ int git_remote_is_valid_name(
2047
2099
  git_buf_dispose(&buf);
2048
2100
  git_refspec__dispose(&refspec);
2049
2101
 
2050
- giterr_clear();
2102
+ git_error_clear();
2051
2103
  return error == 0;
2052
2104
  }
2053
2105
 
@@ -2202,7 +2254,7 @@ static int remove_branch_config_related_entries(
2202
2254
  if ((error = git_config_delete_entry(config, git_buf_cstr(&buf))) < 0) {
2203
2255
  if (error != GIT_ENOTFOUND)
2204
2256
  break;
2205
- giterr_clear();
2257
+ git_error_clear();
2206
2258
  }
2207
2259
 
2208
2260
  git_buf_clear(&buf);
@@ -2212,7 +2264,7 @@ static int remove_branch_config_related_entries(
2212
2264
  if ((error = git_config_delete_entry(config, git_buf_cstr(&buf))) < 0) {
2213
2265
  if (error != GIT_ENOTFOUND)
2214
2266
  break;
2215
- giterr_clear();
2267
+ git_error_clear();
2216
2268
  }
2217
2269
  }
2218
2270
 
@@ -2373,24 +2425,23 @@ int git_remote_upload(git_remote *remote, const git_strarray *refspecs, const gi
2373
2425
  git_push *push;
2374
2426
  git_refspec *spec;
2375
2427
  const git_remote_callbacks *cbs = NULL;
2376
- const git_strarray *custom_headers = NULL;
2377
- const git_proxy_options *proxy = NULL;
2428
+ git_remote_connection_opts conn = GIT_REMOTE_CONNECTION_OPTIONS_INIT;
2378
2429
 
2379
2430
  assert(remote);
2380
2431
 
2381
2432
  if (!remote->repo) {
2382
- giterr_set(GITERR_INVALID, "cannot download detached remote");
2433
+ git_error_set(GIT_ERROR_INVALID, "cannot download detached remote");
2383
2434
  return -1;
2384
2435
  }
2385
2436
 
2386
2437
  if (opts) {
2387
2438
  cbs = &opts->callbacks;
2388
- custom_headers = &opts->custom_headers;
2389
- proxy = &opts->proxy_opts;
2439
+ conn.custom_headers = &opts->custom_headers;
2440
+ conn.proxy = &opts->proxy_opts;
2390
2441
  }
2391
2442
 
2392
2443
  if (!git_remote_connected(remote) &&
2393
- (error = git_remote_connect(remote, GIT_DIRECTION_PUSH, cbs, proxy, custom_headers)) < 0)
2444
+ (error = git_remote__connect(remote, GIT_DIRECTION_PUSH, cbs, &conn)) < 0)
2394
2445
  goto cleanup;
2395
2446
 
2396
2447
  free_refspecs(&remote->active_refspecs);
@@ -2445,15 +2496,15 @@ int git_remote_push(git_remote *remote, const git_strarray *refspecs, const git_
2445
2496
  assert(remote);
2446
2497
 
2447
2498
  if (!remote->repo) {
2448
- giterr_set(GITERR_INVALID, "cannot download detached remote");
2499
+ git_error_set(GIT_ERROR_INVALID, "cannot download detached remote");
2449
2500
  return -1;
2450
2501
  }
2451
2502
 
2452
2503
  if (opts) {
2453
- GITERR_CHECK_VERSION(&opts->callbacks, GIT_REMOTE_CALLBACKS_VERSION, "git_remote_callbacks");
2504
+ GIT_ERROR_CHECK_VERSION(&opts->callbacks, GIT_REMOTE_CALLBACKS_VERSION, "git_remote_callbacks");
2454
2505
  cbs = &opts->callbacks;
2455
2506
  custom_headers = &opts->custom_headers;
2456
- GITERR_CHECK_VERSION(&opts->proxy_opts, GIT_PROXY_OPTIONS_VERSION, "git_proxy_options");
2507
+ GIT_ERROR_CHECK_VERSION(&opts->proxy_opts, GIT_PROXY_OPTIONS_VERSION, "git_proxy_options");
2457
2508
  proxy = &opts->proxy_opts;
2458
2509
  }
2459
2510