rugged 0.27.10 → 0.27.10.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (420) hide show
  1. checksums.yaml +4 -4
  2. data/lib/rugged/version.rb +1 -1
  3. data/vendor/libgit2/AUTHORS +0 -1
  4. data/vendor/libgit2/CMakeLists.txt +54 -98
  5. data/vendor/libgit2/COPYING +0 -28
  6. data/vendor/libgit2/cmake/Modules/AddCFlagIfSupported.cmake +1 -15
  7. data/vendor/libgit2/cmake/Modules/EnableWarnings.cmake +8 -9
  8. data/vendor/libgit2/cmake/Modules/FindCoreFoundation.cmake +2 -2
  9. data/vendor/libgit2/cmake/Modules/FindGSSAPI.cmake +1 -1
  10. data/vendor/libgit2/cmake/Modules/FindSecurity.cmake +2 -2
  11. data/vendor/libgit2/cmake/Modules/FindStatNsec.cmake +0 -6
  12. data/vendor/libgit2/deps/http-parser/CMakeLists.txt +0 -2
  13. data/vendor/libgit2/deps/http-parser/{COPYING → LICENSE-MIT} +0 -0
  14. data/vendor/libgit2/deps/http-parser/http_parser.c +6 -11
  15. data/vendor/libgit2/deps/regex/CMakeLists.txt +2 -0
  16. data/vendor/libgit2/deps/regex/config.h +7 -0
  17. data/vendor/libgit2/deps/regex/regcomp.c +3857 -0
  18. data/vendor/libgit2/deps/regex/regex.c +92 -0
  19. data/vendor/libgit2/deps/regex/regex.h +582 -0
  20. data/vendor/libgit2/deps/regex/regex_internal.c +1744 -0
  21. data/vendor/libgit2/deps/regex/regex_internal.h +819 -0
  22. data/vendor/libgit2/deps/regex/regexec.c +4369 -0
  23. data/vendor/libgit2/deps/zlib/CMakeLists.txt +0 -1
  24. data/vendor/libgit2/deps/zlib/adler32.c +7 -0
  25. data/vendor/libgit2/deps/zlib/crc32.c +7 -0
  26. data/vendor/libgit2/include/git2.h +0 -5
  27. data/vendor/libgit2/include/git2/annotated_commit.h +0 -9
  28. data/vendor/libgit2/include/git2/attr.h +20 -38
  29. data/vendor/libgit2/include/git2/blame.h +25 -42
  30. data/vendor/libgit2/include/git2/blob.h +13 -45
  31. data/vendor/libgit2/include/git2/branch.h +1 -1
  32. data/vendor/libgit2/include/git2/buffer.h +16 -22
  33. data/vendor/libgit2/include/git2/checkout.h +32 -65
  34. data/vendor/libgit2/include/git2/cherrypick.h +7 -9
  35. data/vendor/libgit2/include/git2/clone.h +10 -12
  36. data/vendor/libgit2/include/git2/commit.h +3 -53
  37. data/vendor/libgit2/include/git2/common.h +8 -60
  38. data/vendor/libgit2/include/git2/config.h +19 -30
  39. data/vendor/libgit2/include/git2/describe.h +9 -32
  40. data/vendor/libgit2/include/git2/diff.h +156 -208
  41. data/vendor/libgit2/include/git2/errors.h +46 -54
  42. data/vendor/libgit2/include/git2/filter.h +0 -8
  43. data/vendor/libgit2/include/git2/ignore.h +2 -2
  44. data/vendor/libgit2/include/git2/index.h +52 -74
  45. data/vendor/libgit2/include/git2/indexer.h +6 -76
  46. data/vendor/libgit2/include/git2/inttypes.h +309 -0
  47. data/vendor/libgit2/include/git2/merge.h +18 -35
  48. data/vendor/libgit2/include/git2/net.h +5 -0
  49. data/vendor/libgit2/include/git2/notes.h +1 -1
  50. data/vendor/libgit2/include/git2/object.h +29 -17
  51. data/vendor/libgit2/include/git2/odb.h +11 -12
  52. data/vendor/libgit2/include/git2/odb_backend.h +9 -10
  53. data/vendor/libgit2/include/git2/oid.h +2 -2
  54. data/vendor/libgit2/include/git2/pack.h +3 -14
  55. data/vendor/libgit2/include/git2/proxy.h +8 -14
  56. data/vendor/libgit2/include/git2/rebase.h +6 -53
  57. data/vendor/libgit2/include/git2/refs.h +15 -33
  58. data/vendor/libgit2/include/git2/refspec.h +0 -17
  59. data/vendor/libgit2/include/git2/remote.h +24 -123
  60. data/vendor/libgit2/include/git2/repository.h +39 -76
  61. data/vendor/libgit2/include/git2/revert.h +4 -6
  62. data/vendor/libgit2/include/git2/revwalk.h +7 -7
  63. data/vendor/libgit2/include/git2/signature.h +2 -2
  64. data/vendor/libgit2/include/git2/stash.h +12 -15
  65. data/vendor/libgit2/include/git2/status.h +20 -33
  66. data/vendor/libgit2/include/git2/submodule.h +12 -30
  67. data/vendor/libgit2/include/git2/sys/commit.h +1 -1
  68. data/vendor/libgit2/include/git2/sys/config.h +13 -13
  69. data/vendor/libgit2/include/git2/sys/filter.h +6 -6
  70. data/vendor/libgit2/include/git2/sys/index.h +0 -3
  71. data/vendor/libgit2/include/git2/sys/mempack.h +35 -35
  72. data/vendor/libgit2/include/git2/sys/merge.h +4 -9
  73. data/vendor/libgit2/include/git2/sys/odb_backend.h +22 -66
  74. data/vendor/libgit2/include/git2/sys/refdb_backend.h +40 -76
  75. data/vendor/libgit2/include/git2/sys/repository.h +1 -5
  76. data/vendor/libgit2/include/git2/sys/stream.h +12 -92
  77. data/vendor/libgit2/include/git2/sys/time.h +31 -0
  78. data/vendor/libgit2/include/git2/sys/transport.h +83 -129
  79. data/vendor/libgit2/include/git2/tag.h +4 -13
  80. data/vendor/libgit2/include/git2/trace.h +2 -2
  81. data/vendor/libgit2/include/git2/transaction.h +0 -1
  82. data/vendor/libgit2/include/git2/transport.h +311 -11
  83. data/vendor/libgit2/include/git2/tree.h +4 -4
  84. data/vendor/libgit2/include/git2/types.h +111 -33
  85. data/vendor/libgit2/include/git2/version.h +4 -4
  86. data/vendor/libgit2/include/git2/worktree.h +13 -48
  87. data/vendor/libgit2/libgit2.pc.in +13 -0
  88. data/vendor/libgit2/src/CMakeLists.txt +164 -96
  89. data/vendor/libgit2/src/annotated_commit.c +8 -15
  90. data/vendor/libgit2/src/apply.c +31 -537
  91. data/vendor/libgit2/src/apply.h +1 -3
  92. data/vendor/libgit2/src/array.h +2 -2
  93. data/vendor/libgit2/src/attr.c +75 -81
  94. data/vendor/libgit2/src/attr_file.c +121 -207
  95. data/vendor/libgit2/src/attr_file.h +9 -9
  96. data/vendor/libgit2/src/attrcache.c +53 -51
  97. data/vendor/libgit2/src/attrcache.h +1 -2
  98. data/vendor/libgit2/src/blame.c +20 -47
  99. data/vendor/libgit2/src/blame.h +1 -2
  100. data/vendor/libgit2/src/blame_git.c +20 -37
  101. data/vendor/libgit2/src/blob.c +42 -128
  102. data/vendor/libgit2/src/blob.h +2 -19
  103. data/vendor/libgit2/src/branch.c +43 -67
  104. data/vendor/libgit2/src/buf_text.c +6 -7
  105. data/vendor/libgit2/src/buffer.c +57 -69
  106. data/vendor/libgit2/src/buffer.h +1 -1
  107. data/vendor/libgit2/src/cache.c +45 -38
  108. data/vendor/libgit2/src/cache.h +3 -3
  109. data/vendor/libgit2/src/cc-compat.h +3 -20
  110. data/vendor/libgit2/src/checkout.c +90 -109
  111. data/vendor/libgit2/src/cherrypick.c +9 -15
  112. data/vendor/libgit2/src/clone.c +27 -49
  113. data/vendor/libgit2/src/clone.h +0 -4
  114. data/vendor/libgit2/src/commit.c +49 -117
  115. data/vendor/libgit2/src/commit.h +0 -7
  116. data/vendor/libgit2/src/commit_list.c +78 -30
  117. data/vendor/libgit2/src/commit_list.h +2 -2
  118. data/vendor/libgit2/src/common.h +91 -27
  119. data/vendor/libgit2/src/config.c +176 -194
  120. data/vendor/libgit2/src/config.h +20 -8
  121. data/vendor/libgit2/src/config_cache.c +35 -41
  122. data/vendor/libgit2/src/config_file.c +753 -439
  123. data/vendor/libgit2/src/config_file.h +73 -0
  124. data/vendor/libgit2/src/config_parse.c +63 -114
  125. data/vendor/libgit2/src/config_parse.h +16 -17
  126. data/vendor/libgit2/src/crlf.c +190 -219
  127. data/vendor/libgit2/src/delta.c +18 -25
  128. data/vendor/libgit2/src/describe.c +41 -42
  129. data/vendor/libgit2/src/diff.c +68 -53
  130. data/vendor/libgit2/src/diff.h +1 -2
  131. data/vendor/libgit2/src/diff_driver.c +49 -47
  132. data/vendor/libgit2/src/diff_file.c +17 -19
  133. data/vendor/libgit2/src/diff_file.h +1 -1
  134. data/vendor/libgit2/src/diff_generate.c +106 -162
  135. data/vendor/libgit2/src/diff_generate.h +3 -3
  136. data/vendor/libgit2/src/diff_parse.c +4 -4
  137. data/vendor/libgit2/src/diff_print.c +30 -42
  138. data/vendor/libgit2/src/diff_stats.c +7 -22
  139. data/vendor/libgit2/src/diff_tform.c +16 -16
  140. data/vendor/libgit2/src/diff_xdiff.c +3 -15
  141. data/vendor/libgit2/src/errors.c +39 -51
  142. data/vendor/libgit2/src/features.h.in +3 -11
  143. data/vendor/libgit2/src/fetch.c +5 -10
  144. data/vendor/libgit2/src/fetchhead.c +17 -17
  145. data/vendor/libgit2/src/filebuf.c +36 -32
  146. data/vendor/libgit2/src/filebuf.h +2 -2
  147. data/vendor/libgit2/src/{futils.c → fileops.c} +73 -80
  148. data/vendor/libgit2/src/{futils.h → fileops.h} +6 -6
  149. data/vendor/libgit2/src/filter.c +38 -46
  150. data/vendor/libgit2/src/filter.h +10 -0
  151. data/vendor/libgit2/src/fnmatch.c +248 -0
  152. data/vendor/libgit2/src/fnmatch.h +48 -0
  153. data/vendor/libgit2/src/global.c +63 -48
  154. data/vendor/libgit2/src/global.h +2 -0
  155. data/vendor/libgit2/src/hash.c +0 -61
  156. data/vendor/libgit2/src/hash.h +19 -20
  157. data/vendor/libgit2/src/hash/hash_collisiondetect.h +47 -0
  158. data/vendor/libgit2/src/hash/{sha1/common_crypto.c → hash_common_crypto.h} +17 -17
  159. data/vendor/libgit2/src/hash/{sha1/generic.c → hash_generic.c} +10 -22
  160. data/vendor/libgit2/src/hash/{sha1/generic.h → hash_generic.h} +10 -4
  161. data/vendor/libgit2/src/hash/hash_openssl.h +59 -0
  162. data/vendor/libgit2/src/hash/{sha1/win32.c → hash_win32.c} +37 -47
  163. data/vendor/libgit2/src/hash/{sha1/win32.h → hash_win32.h} +19 -6
  164. data/vendor/libgit2/src/hash/{sha1/sha1dc → sha1dc}/sha1.c +3 -14
  165. data/vendor/libgit2/src/hash/{sha1/sha1dc → sha1dc}/sha1.h +0 -0
  166. data/vendor/libgit2/src/hash/{sha1/sha1dc → sha1dc}/ubc_check.c +0 -0
  167. data/vendor/libgit2/src/hash/{sha1/sha1dc → sha1dc}/ubc_check.h +0 -0
  168. data/vendor/libgit2/src/hashsig.c +5 -5
  169. data/vendor/libgit2/src/idxmap.c +61 -107
  170. data/vendor/libgit2/src/idxmap.h +31 -153
  171. data/vendor/libgit2/src/ignore.c +47 -43
  172. data/vendor/libgit2/src/index.c +232 -337
  173. data/vendor/libgit2/src/index.h +1 -17
  174. data/vendor/libgit2/src/indexer.c +175 -346
  175. data/vendor/libgit2/src/integer.h +26 -71
  176. data/vendor/libgit2/src/iterator.c +70 -142
  177. data/vendor/libgit2/src/iterator.h +0 -15
  178. data/vendor/libgit2/src/khash.h +1 -3
  179. data/vendor/libgit2/src/map.h +1 -1
  180. data/vendor/libgit2/src/merge.c +100 -144
  181. data/vendor/libgit2/src/merge_driver.c +11 -11
  182. data/vendor/libgit2/src/merge_file.c +2 -2
  183. data/vendor/libgit2/src/mwindow.c +29 -24
  184. data/vendor/libgit2/src/mwindow.h +4 -4
  185. data/vendor/libgit2/src/netops.c +156 -55
  186. data/vendor/libgit2/src/netops.h +23 -3
  187. data/vendor/libgit2/src/notes.c +11 -16
  188. data/vendor/libgit2/src/object.c +69 -120
  189. data/vendor/libgit2/src/object.h +9 -22
  190. data/vendor/libgit2/src/object_api.c +8 -8
  191. data/vendor/libgit2/src/odb.c +93 -116
  192. data/vendor/libgit2/src/odb.h +7 -8
  193. data/vendor/libgit2/src/odb_loose.c +55 -62
  194. data/vendor/libgit2/src/odb_mempack.c +34 -21
  195. data/vendor/libgit2/src/odb_pack.c +14 -18
  196. data/vendor/libgit2/src/offmap.c +35 -53
  197. data/vendor/libgit2/src/offmap.h +21 -108
  198. data/vendor/libgit2/src/oid.c +7 -12
  199. data/vendor/libgit2/src/oidmap.c +47 -49
  200. data/vendor/libgit2/src/oidmap.h +24 -101
  201. data/vendor/libgit2/src/pack-objects.c +87 -88
  202. data/vendor/libgit2/src/pack-objects.h +8 -2
  203. data/vendor/libgit2/src/pack.c +101 -99
  204. data/vendor/libgit2/src/pack.h +19 -17
  205. data/vendor/libgit2/src/parse.c +0 -10
  206. data/vendor/libgit2/src/parse.h +3 -3
  207. data/vendor/libgit2/src/patch.c +4 -4
  208. data/vendor/libgit2/src/patch_generate.c +20 -20
  209. data/vendor/libgit2/src/patch_parse.c +63 -151
  210. data/vendor/libgit2/src/path.c +104 -117
  211. data/vendor/libgit2/src/path.h +71 -3
  212. data/vendor/libgit2/src/pathspec.c +19 -19
  213. data/vendor/libgit2/src/pool.c +22 -26
  214. data/vendor/libgit2/src/pool.h +7 -7
  215. data/vendor/libgit2/src/posix.c +10 -10
  216. data/vendor/libgit2/src/posix.h +1 -12
  217. data/vendor/libgit2/src/proxy.c +3 -8
  218. data/vendor/libgit2/src/push.c +31 -37
  219. data/vendor/libgit2/src/push.h +1 -2
  220. data/vendor/libgit2/src/rebase.c +59 -115
  221. data/vendor/libgit2/src/refdb.c +3 -15
  222. data/vendor/libgit2/src/refdb_fs.c +254 -381
  223. data/vendor/libgit2/src/reflog.c +15 -13
  224. data/vendor/libgit2/src/refs.c +88 -118
  225. data/vendor/libgit2/src/refs.h +3 -5
  226. data/vendor/libgit2/src/refspec.c +37 -56
  227. data/vendor/libgit2/src/refspec.h +1 -1
  228. data/vendor/libgit2/src/remote.c +215 -266
  229. data/vendor/libgit2/src/remote.h +2 -11
  230. data/vendor/libgit2/src/repository.c +225 -280
  231. data/vendor/libgit2/src/repository.h +40 -52
  232. data/vendor/libgit2/src/reset.c +8 -8
  233. data/vendor/libgit2/src/revert.c +9 -14
  234. data/vendor/libgit2/src/revparse.c +48 -47
  235. data/vendor/libgit2/src/revwalk.c +57 -120
  236. data/vendor/libgit2/src/revwalk.h +1 -22
  237. data/vendor/libgit2/src/settings.c +10 -47
  238. data/vendor/libgit2/src/signature.c +11 -11
  239. data/vendor/libgit2/src/sortedcache.c +36 -22
  240. data/vendor/libgit2/src/sortedcache.h +1 -1
  241. data/vendor/libgit2/src/stash.c +99 -125
  242. data/vendor/libgit2/src/status.c +22 -28
  243. data/vendor/libgit2/src/stream.h +2 -17
  244. data/vendor/libgit2/src/streams/curl.c +385 -0
  245. data/vendor/libgit2/src/{allocators/stdalloc.h → streams/curl.h} +5 -5
  246. data/vendor/libgit2/src/streams/openssl.c +114 -224
  247. data/vendor/libgit2/src/streams/openssl.h +108 -4
  248. data/vendor/libgit2/src/streams/socket.c +30 -55
  249. data/vendor/libgit2/src/streams/stransport.c +32 -57
  250. data/vendor/libgit2/src/streams/stransport.h +0 -5
  251. data/vendor/libgit2/src/streams/tls.c +19 -50
  252. data/vendor/libgit2/src/streams/tls.h +4 -12
  253. data/vendor/libgit2/src/strmap.c +74 -47
  254. data/vendor/libgit2/src/strmap.h +33 -108
  255. data/vendor/libgit2/src/submodule.c +216 -272
  256. data/vendor/libgit2/src/submodule.h +1 -1
  257. data/vendor/libgit2/src/sysdir.c +19 -29
  258. data/vendor/libgit2/src/tag.c +28 -41
  259. data/vendor/libgit2/src/tag.h +1 -2
  260. data/vendor/libgit2/src/trace.c +2 -2
  261. data/vendor/libgit2/src/trace.h +3 -3
  262. data/vendor/libgit2/src/trailer.c +38 -52
  263. data/vendor/libgit2/src/transaction.c +29 -30
  264. data/vendor/libgit2/src/transport.c +5 -5
  265. data/vendor/libgit2/src/transports/auth.c +11 -15
  266. data/vendor/libgit2/src/transports/auth.h +3 -10
  267. data/vendor/libgit2/src/transports/auth_negotiate.c +18 -33
  268. data/vendor/libgit2/src/transports/auth_negotiate.h +2 -2
  269. data/vendor/libgit2/src/transports/cred.c +24 -24
  270. data/vendor/libgit2/src/{allocators/win32_crtdbg.h → transports/cred.h} +4 -5
  271. data/vendor/libgit2/src/transports/git.c +31 -26
  272. data/vendor/libgit2/src/transports/http.c +348 -881
  273. data/vendor/libgit2/src/transports/http.h +0 -2
  274. data/vendor/libgit2/src/transports/local.c +35 -35
  275. data/vendor/libgit2/src/transports/smart.c +47 -70
  276. data/vendor/libgit2/src/transports/smart.h +4 -3
  277. data/vendor/libgit2/src/transports/smart_pkt.c +40 -43
  278. data/vendor/libgit2/src/transports/smart_protocol.c +116 -96
  279. data/vendor/libgit2/src/transports/ssh.c +66 -77
  280. data/vendor/libgit2/src/transports/winhttp.c +314 -318
  281. data/vendor/libgit2/src/tree-cache.c +12 -19
  282. data/vendor/libgit2/src/tree.c +142 -103
  283. data/vendor/libgit2/src/tree.h +12 -1
  284. data/vendor/libgit2/src/unix/map.c +3 -3
  285. data/vendor/libgit2/src/unix/posix.h +11 -1
  286. data/vendor/libgit2/src/userdiff.h +1 -3
  287. data/vendor/libgit2/src/util.c +56 -70
  288. data/vendor/libgit2/src/util.h +156 -28
  289. data/vendor/libgit2/src/vector.c +4 -4
  290. data/vendor/libgit2/src/win32/dir.c +3 -3
  291. data/vendor/libgit2/src/win32/findfile.c +3 -3
  292. data/vendor/libgit2/src/win32/map.c +11 -9
  293. data/vendor/libgit2/src/win32/msvc-compat.h +0 -6
  294. data/vendor/libgit2/src/win32/path_w32.c +9 -113
  295. data/vendor/libgit2/src/win32/path_w32.h +29 -18
  296. data/vendor/libgit2/src/win32/posix.h +4 -1
  297. data/vendor/libgit2/src/win32/posix_w32.c +45 -70
  298. data/vendor/libgit2/src/win32/precompiled.h +2 -0
  299. data/vendor/libgit2/src/win32/thread.c +10 -5
  300. data/vendor/libgit2/src/win32/w32_buffer.c +5 -9
  301. data/vendor/libgit2/src/win32/w32_crtdbg_stacktrace.c +2 -3
  302. data/vendor/libgit2/src/win32/w32_crtdbg_stacktrace.h +75 -26
  303. data/vendor/libgit2/src/win32/w32_stack.c +11 -6
  304. data/vendor/libgit2/src/win32/w32_stack.h +3 -3
  305. data/vendor/libgit2/src/win32/w32_util.c +64 -27
  306. data/vendor/libgit2/src/win32/w32_util.h +49 -5
  307. data/vendor/libgit2/src/worktree.c +60 -95
  308. data/vendor/libgit2/src/worktree.h +0 -2
  309. data/vendor/libgit2/src/xdiff/xdiffi.c +5 -7
  310. data/vendor/libgit2/src/xdiff/xhistogram.c +1 -1
  311. data/vendor/libgit2/src/xdiff/xmerge.c +15 -27
  312. data/vendor/libgit2/src/xdiff/xpatience.c +0 -3
  313. data/vendor/libgit2/src/zstream.c +4 -4
  314. metadata +33 -122
  315. data/vendor/libgit2/cmake/Modules/FindGSSFramework.cmake +0 -28
  316. data/vendor/libgit2/cmake/Modules/FindPCRE.cmake +0 -38
  317. data/vendor/libgit2/cmake/Modules/FindPCRE2.cmake +0 -37
  318. data/vendor/libgit2/cmake/Modules/FindmbedTLS.cmake +0 -93
  319. data/vendor/libgit2/cmake/Modules/PkgBuildConfig.cmake +0 -110
  320. data/vendor/libgit2/cmake/Modules/SelectGSSAPI.cmake +0 -53
  321. data/vendor/libgit2/cmake/Modules/SelectHTTPSBackend.cmake +0 -124
  322. data/vendor/libgit2/cmake/Modules/SelectHashes.cmake +0 -66
  323. data/vendor/libgit2/deps/ntlmclient/CMakeLists.txt +0 -21
  324. data/vendor/libgit2/deps/ntlmclient/compat.h +0 -33
  325. data/vendor/libgit2/deps/ntlmclient/crypt.h +0 -64
  326. data/vendor/libgit2/deps/ntlmclient/crypt_commoncrypto.c +0 -120
  327. data/vendor/libgit2/deps/ntlmclient/crypt_commoncrypto.h +0 -18
  328. data/vendor/libgit2/deps/ntlmclient/crypt_mbedtls.c +0 -145
  329. data/vendor/libgit2/deps/ntlmclient/crypt_mbedtls.h +0 -18
  330. data/vendor/libgit2/deps/ntlmclient/crypt_openssl.c +0 -130
  331. data/vendor/libgit2/deps/ntlmclient/crypt_openssl.h +0 -21
  332. data/vendor/libgit2/deps/ntlmclient/ntlm.c +0 -1420
  333. data/vendor/libgit2/deps/ntlmclient/ntlm.h +0 -174
  334. data/vendor/libgit2/deps/ntlmclient/ntlmclient.h +0 -320
  335. data/vendor/libgit2/deps/ntlmclient/unicode.h +0 -36
  336. data/vendor/libgit2/deps/ntlmclient/unicode_builtin.c +0 -445
  337. data/vendor/libgit2/deps/ntlmclient/unicode_iconv.c +0 -201
  338. data/vendor/libgit2/deps/ntlmclient/utf8.h +0 -1257
  339. data/vendor/libgit2/deps/ntlmclient/util.c +0 -21
  340. data/vendor/libgit2/deps/ntlmclient/util.h +0 -14
  341. data/vendor/libgit2/deps/pcre/CMakeLists.txt +0 -140
  342. data/vendor/libgit2/deps/pcre/COPYING +0 -5
  343. data/vendor/libgit2/deps/pcre/cmake/COPYING-CMAKE-SCRIPTS +0 -22
  344. data/vendor/libgit2/deps/pcre/cmake/FindEditline.cmake +0 -17
  345. data/vendor/libgit2/deps/pcre/cmake/FindPackageHandleStandardArgs.cmake +0 -58
  346. data/vendor/libgit2/deps/pcre/cmake/FindReadline.cmake +0 -29
  347. data/vendor/libgit2/deps/pcre/config.h.in +0 -57
  348. data/vendor/libgit2/deps/pcre/pcre.h +0 -641
  349. data/vendor/libgit2/deps/pcre/pcre_byte_order.c +0 -319
  350. data/vendor/libgit2/deps/pcre/pcre_chartables.c +0 -198
  351. data/vendor/libgit2/deps/pcre/pcre_compile.c +0 -9800
  352. data/vendor/libgit2/deps/pcre/pcre_config.c +0 -190
  353. data/vendor/libgit2/deps/pcre/pcre_dfa_exec.c +0 -3676
  354. data/vendor/libgit2/deps/pcre/pcre_exec.c +0 -7173
  355. data/vendor/libgit2/deps/pcre/pcre_fullinfo.c +0 -245
  356. data/vendor/libgit2/deps/pcre/pcre_get.c +0 -669
  357. data/vendor/libgit2/deps/pcre/pcre_globals.c +0 -86
  358. data/vendor/libgit2/deps/pcre/pcre_internal.h +0 -2787
  359. data/vendor/libgit2/deps/pcre/pcre_jit_compile.c +0 -11913
  360. data/vendor/libgit2/deps/pcre/pcre_maketables.c +0 -156
  361. data/vendor/libgit2/deps/pcre/pcre_newline.c +0 -210
  362. data/vendor/libgit2/deps/pcre/pcre_ord2utf8.c +0 -94
  363. data/vendor/libgit2/deps/pcre/pcre_printint.c +0 -834
  364. data/vendor/libgit2/deps/pcre/pcre_refcount.c +0 -92
  365. data/vendor/libgit2/deps/pcre/pcre_string_utils.c +0 -211
  366. data/vendor/libgit2/deps/pcre/pcre_study.c +0 -1686
  367. data/vendor/libgit2/deps/pcre/pcre_tables.c +0 -727
  368. data/vendor/libgit2/deps/pcre/pcre_ucd.c +0 -3644
  369. data/vendor/libgit2/deps/pcre/pcre_valid_utf8.c +0 -301
  370. data/vendor/libgit2/deps/pcre/pcre_version.c +0 -98
  371. data/vendor/libgit2/deps/pcre/pcre_xclass.c +0 -268
  372. data/vendor/libgit2/deps/pcre/pcreposix.c +0 -421
  373. data/vendor/libgit2/deps/pcre/pcreposix.h +0 -117
  374. data/vendor/libgit2/deps/pcre/ucp.h +0 -224
  375. data/vendor/libgit2/deps/winhttp/COPYING.GPL +0 -993
  376. data/vendor/libgit2/deps/winhttp/COPYING.LGPL +0 -502
  377. data/vendor/libgit2/deps/zlib/COPYING +0 -27
  378. data/vendor/libgit2/include/git2/apply.h +0 -149
  379. data/vendor/libgit2/include/git2/cert.h +0 -135
  380. data/vendor/libgit2/include/git2/cred.h +0 -308
  381. data/vendor/libgit2/include/git2/deprecated.h +0 -493
  382. data/vendor/libgit2/include/git2/mailmap.h +0 -115
  383. data/vendor/libgit2/include/git2/sys/alloc.h +0 -101
  384. data/vendor/libgit2/include/git2/sys/cred.h +0 -90
  385. data/vendor/libgit2/include/git2/sys/path.h +0 -64
  386. data/vendor/libgit2/src/alloc.c +0 -43
  387. data/vendor/libgit2/src/alloc.h +0 -40
  388. data/vendor/libgit2/src/allocators/stdalloc.c +0 -119
  389. data/vendor/libgit2/src/allocators/win32_crtdbg.c +0 -118
  390. data/vendor/libgit2/src/config_backend.h +0 -96
  391. data/vendor/libgit2/src/config_entries.c +0 -229
  392. data/vendor/libgit2/src/config_entries.h +0 -24
  393. data/vendor/libgit2/src/config_mem.c +0 -220
  394. data/vendor/libgit2/src/config_snapshot.c +0 -206
  395. data/vendor/libgit2/src/errors.h +0 -81
  396. data/vendor/libgit2/src/hash/sha1.h +0 -38
  397. data/vendor/libgit2/src/hash/sha1/collisiondetect.c +0 -48
  398. data/vendor/libgit2/src/hash/sha1/collisiondetect.h +0 -19
  399. data/vendor/libgit2/src/hash/sha1/common_crypto.h +0 -19
  400. data/vendor/libgit2/src/hash/sha1/mbedtls.c +0 -46
  401. data/vendor/libgit2/src/hash/sha1/mbedtls.h +0 -19
  402. data/vendor/libgit2/src/hash/sha1/openssl.c +0 -59
  403. data/vendor/libgit2/src/hash/sha1/openssl.h +0 -19
  404. data/vendor/libgit2/src/mailmap.c +0 -485
  405. data/vendor/libgit2/src/mailmap.h +0 -35
  406. data/vendor/libgit2/src/net.c +0 -184
  407. data/vendor/libgit2/src/net.h +0 -36
  408. data/vendor/libgit2/src/reader.c +0 -265
  409. data/vendor/libgit2/src/reader.h +0 -107
  410. data/vendor/libgit2/src/regexp.c +0 -221
  411. data/vendor/libgit2/src/regexp.h +0 -97
  412. data/vendor/libgit2/src/streams/mbedtls.c +0 -483
  413. data/vendor/libgit2/src/streams/mbedtls.h +0 -23
  414. data/vendor/libgit2/src/streams/registry.c +0 -118
  415. data/vendor/libgit2/src/streams/registry.h +0 -19
  416. data/vendor/libgit2/src/transports/auth_ntlm.c +0 -223
  417. data/vendor/libgit2/src/transports/auth_ntlm.h +0 -35
  418. data/vendor/libgit2/src/wildmatch.c +0 -320
  419. data/vendor/libgit2/src/wildmatch.h +0 -23
  420. data/vendor/libgit2/src/win32/w32_common.h +0 -39
@@ -55,8 +55,8 @@ extern bool git_reference__enable_symbolic_ref_target_validation;
55
55
  #define GIT_STASH_FILE "stash"
56
56
  #define GIT_REFS_STASH_FILE GIT_REFS_DIR GIT_STASH_FILE
57
57
 
58
- #define GIT_REFERENCE_FORMAT__PRECOMPOSE_UNICODE (1u << 16)
59
- #define GIT_REFERENCE_FORMAT__VALIDATION_DISABLE (1u << 15)
58
+ #define GIT_REF_FORMAT__PRECOMPOSE_UNICODE (1u << 16)
59
+ #define GIT_REF_FORMAT__VALIDATION_DISABLE (1u << 15)
60
60
 
61
61
  #define GIT_REFNAME_MAX 1024
62
62
 
@@ -64,7 +64,7 @@ typedef char git_refname_t[GIT_REFNAME_MAX];
64
64
 
65
65
  struct git_reference {
66
66
  git_refdb *db;
67
- git_reference_t type;
67
+ git_ref_t type;
68
68
 
69
69
  union {
70
70
  git_oid oid;
@@ -136,6 +136,4 @@ int git_reference__update_for_commit(
136
136
  const git_oid *id,
137
137
  const char *operation);
138
138
 
139
- int git_reference__is_unborn_head(bool *unborn, const git_reference *ref, git_repository *repo);
140
-
141
139
  #endif
@@ -9,14 +9,14 @@
9
9
 
10
10
  #include "git2/errors.h"
11
11
 
12
- #include "refs.h"
13
12
  #include "util.h"
13
+ #include "posix.h"
14
+ #include "refs.h"
14
15
  #include "vector.h"
15
- #include "wildmatch.h"
16
16
 
17
17
  int git_refspec__parse(git_refspec *refspec, const char *input, bool is_fetch)
18
18
  {
19
- /* Ported from https://github.com/git/git/blob/f06d47e7e0d9db709ee204ed13a8a7486149f494/remote.c#L518-636 */
19
+ // Ported from https://github.com/git/git/blob/f06d47e7e0d9db709ee204ed13a8a7486149f494/remote.c#L518-636
20
20
 
21
21
  size_t llen;
22
22
  int is_glob = 0;
@@ -43,11 +43,11 @@ int git_refspec__parse(git_refspec *refspec, const char *input, bool is_fetch)
43
43
  if (!is_fetch && rhs == lhs && rhs[1] == '\0') {
44
44
  refspec->matching = 1;
45
45
  refspec->string = git__strdup(input);
46
- GIT_ERROR_CHECK_ALLOC(refspec->string);
46
+ GITERR_CHECK_ALLOC(refspec->string);
47
47
  refspec->src = git__strdup("");
48
- GIT_ERROR_CHECK_ALLOC(refspec->src);
48
+ GITERR_CHECK_ALLOC(refspec->src);
49
49
  refspec->dst = git__strdup("");
50
- GIT_ERROR_CHECK_ALLOC(refspec->dst);
50
+ GITERR_CHECK_ALLOC(refspec->dst);
51
51
  return 0;
52
52
  }
53
53
 
@@ -69,9 +69,8 @@ int git_refspec__parse(git_refspec *refspec, const char *input, bool is_fetch)
69
69
 
70
70
  refspec->pattern = is_glob;
71
71
  refspec->src = git__strndup(lhs, llen);
72
- flags = GIT_REFERENCE_FORMAT_ALLOW_ONELEVEL |
73
- GIT_REFERENCE_FORMAT_REFSPEC_SHORTHAND |
74
- (is_glob ? GIT_REFERENCE_FORMAT_REFSPEC_PATTERN : 0);
72
+ flags = GIT_REF_FORMAT_ALLOW_ONELEVEL | GIT_REF_FORMAT_REFSPEC_SHORTHAND
73
+ | (is_glob ? GIT_REF_FORMAT_REFSPEC_PATTERN : 0);
75
74
 
76
75
  if (is_fetch) {
77
76
  /*
@@ -132,24 +131,24 @@ int git_refspec__parse(git_refspec *refspec, const char *input, bool is_fetch)
132
131
  /* if the RHS is empty, then it's a copy of the LHS */
133
132
  if (!refspec->dst) {
134
133
  refspec->dst = git__strdup(refspec->src);
135
- GIT_ERROR_CHECK_ALLOC(refspec->dst);
134
+ GITERR_CHECK_ALLOC(refspec->dst);
136
135
  }
137
136
  }
138
137
 
139
138
  refspec->string = git__strdup(input);
140
- GIT_ERROR_CHECK_ALLOC(refspec->string);
139
+ GITERR_CHECK_ALLOC(refspec->string);
141
140
 
142
141
  return 0;
143
142
 
144
143
  invalid:
145
- git_error_set(
146
- GIT_ERROR_INVALID,
144
+ giterr_set(
145
+ GITERR_INVALID,
147
146
  "'%s' is not a valid refspec.", input);
148
- git_refspec__dispose(refspec);
147
+ git_refspec__free(refspec);
149
148
  return -1;
150
149
  }
151
150
 
152
- void git_refspec__dispose(git_refspec *refspec)
151
+ void git_refspec__free(git_refspec *refspec)
153
152
  {
154
153
  if (refspec == NULL)
155
154
  return;
@@ -161,31 +160,6 @@ void git_refspec__dispose(git_refspec *refspec)
161
160
  memset(refspec, 0x0, sizeof(git_refspec));
162
161
  }
163
162
 
164
- int git_refspec_parse(git_refspec **out_refspec, const char *input, int is_fetch)
165
- {
166
- git_refspec *refspec;
167
- assert(out_refspec && input);
168
-
169
- *out_refspec = NULL;
170
-
171
- refspec = git__malloc(sizeof(git_refspec));
172
- GIT_ERROR_CHECK_ALLOC(refspec);
173
-
174
- if (git_refspec__parse(refspec, input, !!is_fetch) != 0) {
175
- git__free(refspec);
176
- return -1;
177
- }
178
-
179
- *out_refspec = refspec;
180
- return 0;
181
- }
182
-
183
- void git_refspec_free(git_refspec *refspec)
184
- {
185
- git_refspec__dispose(refspec);
186
- git__free(refspec);
187
- }
188
-
189
163
  const char *git_refspec_src(const git_refspec *refspec)
190
164
  {
191
165
  return refspec == NULL ? NULL : refspec->src;
@@ -213,7 +187,7 @@ int git_refspec_src_matches(const git_refspec *refspec, const char *refname)
213
187
  if (refspec == NULL || refspec->src == NULL)
214
188
  return false;
215
189
 
216
- return (wildmatch(refspec->src, refname, 0) == 0);
190
+ return (p_fnmatch(refspec->src, refname, 0) == 0);
217
191
  }
218
192
 
219
193
  int git_refspec_dst_matches(const git_refspec *refspec, const char *refname)
@@ -221,13 +195,14 @@ int git_refspec_dst_matches(const git_refspec *refspec, const char *refname)
221
195
  if (refspec == NULL || refspec->dst == NULL)
222
196
  return false;
223
197
 
224
- return (wildmatch(refspec->dst, refname, 0) == 0);
198
+ return (p_fnmatch(refspec->dst, refname, 0) == 0);
225
199
  }
226
200
 
227
201
  static int refspec_transform(
228
202
  git_buf *out, const char *from, const char *to, const char *name)
229
203
  {
230
204
  const char *from_star, *to_star;
205
+ const char *name_slash, *from_slash;
231
206
  size_t replacement_len, star_offset;
232
207
 
233
208
  git_buf_sanitize(out);
@@ -250,11 +225,17 @@ static int refspec_transform(
250
225
  /* the first half is copied over */
251
226
  git_buf_put(out, to, to_star - to);
252
227
 
253
- /*
254
- * Copy over the name, but exclude the trailing part in "from" starting
255
- * after the glob
256
- */
257
- replacement_len = strlen(name + star_offset) - strlen(from_star + 1);
228
+ /* then we copy over the replacement, from the star's offset to the next slash in 'name' */
229
+ name_slash = strchr(name + star_offset, '/');
230
+ if (!name_slash)
231
+ name_slash = strrchr(name, '\0');
232
+
233
+ /* if there is no slash after the star in 'from', we want to copy everything over */
234
+ from_slash = strchr(from + star_offset, '/');
235
+ if (!from_slash)
236
+ name_slash = strrchr(name, '\0');
237
+
238
+ replacement_len = (name_slash - name) - star_offset;
258
239
  git_buf_put(out, name + star_offset, replacement_len);
259
240
 
260
241
  return git_buf_puts(out, to_star + 1);
@@ -266,12 +247,12 @@ int git_refspec_transform(git_buf *out, const git_refspec *spec, const char *nam
266
247
  git_buf_sanitize(out);
267
248
 
268
249
  if (!git_refspec_src_matches(spec, name)) {
269
- git_error_set(GIT_ERROR_INVALID, "ref '%s' doesn't match the source", name);
250
+ giterr_set(GITERR_INVALID, "ref '%s' doesn't match the source", name);
270
251
  return -1;
271
252
  }
272
253
 
273
254
  if (!spec->pattern)
274
- return git_buf_puts(out, spec->dst ? spec->dst : "");
255
+ return git_buf_puts(out, spec->dst);
275
256
 
276
257
  return refspec_transform(out, spec->src, spec->dst, name);
277
258
  }
@@ -282,7 +263,7 @@ int git_refspec_rtransform(git_buf *out, const git_refspec *spec, const char *na
282
263
  git_buf_sanitize(out);
283
264
 
284
265
  if (!git_refspec_dst_matches(spec, name)) {
285
- git_error_set(GIT_ERROR_INVALID, "ref '%s' doesn't match the destination", name);
266
+ giterr_set(GITERR_INVALID, "ref '%s' doesn't match the destination", name);
286
267
  return -1;
287
268
  }
288
269
 
@@ -335,7 +316,7 @@ int git_refspec__dwim_one(git_vector *out, git_refspec *spec, git_vector *refs)
335
316
  assert(out && spec && refs);
336
317
 
337
318
  cur = git__calloc(1, sizeof(git_refspec));
338
- GIT_ERROR_CHECK_ALLOC(cur);
319
+ GITERR_CHECK_ALLOC(cur);
339
320
 
340
321
  cur->force = spec->force;
341
322
  cur->push = spec->push;
@@ -348,7 +329,7 @@ int git_refspec__dwim_one(git_vector *out, git_refspec *spec, git_vector *refs)
348
329
  for (j = 0; formatters[j]; j++) {
349
330
  git_buf_clear(&buf);
350
331
  git_buf_printf(&buf, formatters[j], spec->src);
351
- GIT_ERROR_CHECK_ALLOC_BUF(&buf);
332
+ GITERR_CHECK_ALLOC_BUF(&buf);
352
333
 
353
334
  key.name = (char *) git_buf_cstr(&buf);
354
335
  if (!git_vector_search(&pos, refs, &key)) {
@@ -361,7 +342,7 @@ int git_refspec__dwim_one(git_vector *out, git_refspec *spec, git_vector *refs)
361
342
  /* No shorthands found, copy over the name */
362
343
  if (cur->src == NULL && spec->src != NULL) {
363
344
  cur->src = git__strdup(spec->src);
364
- GIT_ERROR_CHECK_ALLOC(cur->src);
345
+ GITERR_CHECK_ALLOC(cur->src);
365
346
  }
366
347
 
367
348
  if (spec->dst && git__prefixcmp(spec->dst, GIT_REFS_DIR)) {
@@ -373,16 +354,16 @@ int git_refspec__dwim_one(git_vector *out, git_refspec *spec, git_vector *refs)
373
354
  }
374
355
 
375
356
  git_buf_puts(&buf, spec->dst);
376
- GIT_ERROR_CHECK_ALLOC_BUF(&buf);
357
+ GITERR_CHECK_ALLOC_BUF(&buf);
377
358
 
378
359
  cur->dst = git_buf_detach(&buf);
379
360
  }
380
361
 
381
- git_buf_dispose(&buf);
362
+ git_buf_free(&buf);
382
363
 
383
364
  if (cur->dst == NULL && spec->dst != NULL) {
384
365
  cur->dst = git__strdup(spec->dst);
385
- GIT_ERROR_CHECK_ALLOC(cur->dst);
366
+ GITERR_CHECK_ALLOC(cur->dst);
386
367
  }
387
368
 
388
369
  return git_vector_insert(out, cur);
@@ -30,7 +30,7 @@ int git_refspec__parse(
30
30
  const char *str,
31
31
  bool is_fetch);
32
32
 
33
- void git_refspec__dispose(git_refspec *refspec);
33
+ void git_refspec__free(git_refspec *refspec);
34
34
 
35
35
  int git_refspec__serialize(git_buf *out, const git_refspec *refspec);
36
36
 
@@ -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
- GIT_ERROR_CHECK_ALLOC(spec);
38
+ GITERR_CHECK_ALLOC(spec);
39
39
 
40
40
  if (git_refspec__parse(spec, string, is_fetch) < 0) {
41
41
  git__free(spec);
@@ -44,7 +44,7 @@ static int add_refspec_to(git_vector *vector, const char *string, bool is_fetch)
44
44
 
45
45
  spec->push = !is_fetch;
46
46
  if (git_vector_insert(vector, spec) < 0) {
47
- git_refspec__dispose(spec);
47
+ git_refspec__free(spec);
48
48
  git__free(spec);
49
49
  return -1;
50
50
  }
@@ -67,7 +67,7 @@ static int download_tags_value(git_remote *remote, git_config *cfg)
67
67
  return -1;
68
68
 
69
69
  error = git_config__lookup_entry(&ce, cfg, git_buf_cstr(&buf), false);
70
- git_buf_dispose(&buf);
70
+ git_buf_free(&buf);
71
71
 
72
72
  if (!error && ce && ce->value) {
73
73
  if (!strcmp(ce->value, "--no-tags"))
@@ -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
- git_error_set(
89
- GIT_ERROR_CONFIG,
88
+ giterr_set(
89
+ GITERR_CONFIG,
90
90
  "'%s' is not a valid remote name.", name ? name : "(null)");
91
91
  error = GIT_EINVALIDSPEC;
92
92
  }
@@ -111,13 +111,13 @@ 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 (git_error_last()->klass != GIT_ERROR_NOMEMORY)
114
+ if (giterr_last()->klass != GITERR_NOMEMORY)
115
115
  error = GIT_EINVALIDSPEC;
116
116
 
117
117
  return error;
118
118
  }
119
119
 
120
- git_refspec__dispose(&spec);
120
+ git_refspec__free(&spec);
121
121
 
122
122
  if ((error = git_buf_printf(&var, fmt, name)) < 0)
123
123
  return error;
@@ -132,14 +132,43 @@ static int write_add_refspec(git_repository *repo, const char *name, const char
132
132
  }
133
133
 
134
134
  cleanup:
135
- git_buf_dispose(&var);
135
+ git_buf_free(&var);
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
+
139
168
  static int canonicalize_url(git_buf *out, const char *in)
140
169
  {
141
170
  if (in == NULL || strlen(in) == 0) {
142
- git_error_set(GIT_ERROR_INVALID, "cannot set empty URL");
171
+ giterr_set(GITERR_INVALID, "cannot set empty URL");
143
172
  return GIT_EINVALIDSPEC;
144
173
  }
145
174
 
@@ -160,124 +189,58 @@ static int canonicalize_url(git_buf *out, const char *in)
160
189
  return git_buf_puts(out, in);
161
190
  }
162
191
 
163
- static int default_fetchspec_for_name(git_buf *buf, const char *name)
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)
192
+ static int create_internal(git_remote **out, git_repository *repo, const char *name, const char *url, const char *fetch)
172
193
  {
173
- int error;
174
194
  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;
206
195
  git_config *config_ro = NULL, *config_rw;
207
196
  git_buf canonical_url = GIT_BUF_INIT;
208
197
  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;
211
198
  int error = -1;
212
199
 
200
+ /* repo, name, and fetch are optional */
213
201
  assert(out && url);
214
202
 
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
- }
203
+ if (repo && (error = git_repository_config_snapshot(&config_ro, repo)) < 0)
204
+ return error;
234
205
 
235
206
  remote = git__calloc(1, sizeof(git_remote));
236
- GIT_ERROR_CHECK_ALLOC(remote);
207
+ GITERR_CHECK_ALLOC(remote);
237
208
 
238
- remote->repo = opts->repository;
209
+ remote->repo = repo;
239
210
 
240
- if ((error = git_vector_init(&remote->refs, 8, NULL)) < 0 ||
211
+ if ((error = git_vector_init(&remote->refs, 32, NULL)) < 0 ||
241
212
  (error = canonicalize_url(&canonical_url, url)) < 0)
242
213
  goto on_error;
243
214
 
244
- if (opts->repository && !(opts->flags & GIT_REMOTE_CREATE_SKIP_INSTEADOF)) {
215
+ if (repo) {
245
216
  remote->url = apply_insteadof(config_ro, canonical_url.ptr, GIT_DIRECTION_FETCH);
246
217
  } else {
247
218
  remote->url = git__strdup(canonical_url.ptr);
248
219
  }
249
- GIT_ERROR_CHECK_ALLOC(remote->url);
220
+ GITERR_CHECK_ALLOC(remote->url);
250
221
 
251
- if (opts->name != NULL) {
252
- remote->name = git__strdup(opts->name);
253
- GIT_ERROR_CHECK_ALLOC(remote->name);
222
+ if (name != NULL) {
223
+ remote->name = git__strdup(name);
224
+ GITERR_CHECK_ALLOC(remote->name);
254
225
 
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))
226
+ if ((error = git_buf_printf(&var, CONFIG_URL_FMT, name)) < 0)
259
227
  goto on_error;
260
- }
261
-
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;
270
228
 
271
- fetch = git_buf_cstr(&specbuf);
272
- }
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))
232
+ goto on_error;
233
+ }
273
234
 
235
+ if (fetch != NULL) {
274
236
  if ((error = add_refspec(remote, fetch, true)) < 0)
275
237
  goto on_error;
276
238
 
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))
239
+ /* only write for non-anonymous remotes */
240
+ if (repo && name && (error = write_add_refspec(repo, name, fetch, true)) < 0)
241
+ goto on_error;
242
+
243
+ if (repo && (error = lookup_remote_prune_config(remote, config_ro, name)) < 0)
281
244
  goto on_error;
282
245
 
283
246
  /* Move the data over to where the matching functions can find them */
@@ -286,13 +249,13 @@ int git_remote_create_with_opts(git_remote **out, const char *url, const git_rem
286
249
  }
287
250
 
288
251
  /* A remote without a name doesn't download tags */
289
- if (!opts->name)
252
+ if (!name)
290
253
  remote->download_tags = GIT_REMOTE_DOWNLOAD_TAGS_NONE;
291
254
  else
292
255
  remote->download_tags = GIT_REMOTE_DOWNLOAD_TAGS_AUTO;
293
256
 
294
257
 
295
- git_buf_dispose(&var);
258
+ git_buf_free(&var);
296
259
 
297
260
  *out = remote;
298
261
  error = 0;
@@ -302,65 +265,79 @@ on_error:
302
265
  git_remote_free(remote);
303
266
 
304
267
  git_config_free(config_ro);
305
- git_buf_dispose(&specbuf);
306
- git_buf_dispose(&canonical_url);
307
- git_buf_dispose(&var);
268
+ git_buf_free(&canonical_url);
269
+ git_buf_free(&var);
308
270
  return error;
309
271
  }
310
272
 
311
- int git_remote_create(git_remote **out, git_repository *repo, const char *name, const char *url)
273
+ static int ensure_remote_doesnot_exist(git_repository *repo, const char *name)
312
274
  {
313
- git_buf buf = GIT_BUF_INIT;
314
275
  int error;
315
- git_remote_create_options opts = GIT_REMOTE_CREATE_OPTIONS_INIT;
276
+ git_remote *remote;
316
277
 
317
- /* Those 2 tests are duplicated here because of backward-compatibility */
318
- if ((error = ensure_remote_name_is_valid(name)) < 0)
278
+ error = git_remote_lookup(&remote, repo, name);
279
+
280
+ if (error == GIT_ENOTFOUND)
281
+ return 0;
282
+
283
+ if (error < 0)
319
284
  return error;
320
285
 
321
- if (canonicalize_url(&buf, url) < 0)
322
- return GIT_ERROR;
286
+ git_remote_free(remote);
287
+
288
+ giterr_set(
289
+ GITERR_CONFIG,
290
+ "remote '%s' already exists", name);
291
+
292
+ return GIT_EEXISTS;
293
+ }
323
294
 
324
- git_buf_clear(&buf);
325
295
 
326
- opts.repository = repo;
327
- opts.name = name;
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;
328
300
 
329
- error = git_remote_create_with_opts(out, url, &opts);
301
+ if (git_buf_printf(&buf, "+refs/heads/*:refs/remotes/%s/*", name) < 0)
302
+ return -1;
330
303
 
331
- git_buf_dispose(&buf);
304
+ error = git_remote_create_with_fetchspec(out, repo, name, url, git_buf_cstr(&buf));
305
+ git_buf_free(&buf);
332
306
 
333
307
  return error;
334
308
  }
335
309
 
336
310
  int git_remote_create_with_fetchspec(git_remote **out, git_repository *repo, const char *name, const char *url, const char *fetch)
337
311
  {
312
+ git_remote *remote = NULL;
338
313
  int error;
339
- git_remote_create_options opts = GIT_REMOTE_CREATE_OPTIONS_INIT;
340
314
 
341
315
  if ((error = ensure_remote_name_is_valid(name)) < 0)
342
316
  return error;
343
317
 
344
- opts.repository = repo;
345
- opts.name = name;
346
- opts.fetchspec = fetch;
347
- opts.flags = GIT_REMOTE_CREATE_SKIP_DEFAULT_FETCHSPEC;
318
+ if ((error = ensure_remote_doesnot_exist(repo, name)) < 0)
319
+ return error;
320
+
321
+ if (create_internal(&remote, repo, name, url, fetch) < 0)
322
+ goto on_error;
323
+
324
+ *out = remote;
325
+
326
+ return 0;
348
327
 
349
- return git_remote_create_with_opts(out, url, &opts);
328
+ on_error:
329
+ git_remote_free(remote);
330
+ return -1;
350
331
  }
351
332
 
352
333
  int git_remote_create_anonymous(git_remote **out, git_repository *repo, const char *url)
353
334
  {
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);
335
+ return create_internal(out, repo, NULL, url, NULL);
359
336
  }
360
337
 
361
338
  int git_remote_create_detached(git_remote **out, const char *url)
362
339
  {
363
- return git_remote_create_with_opts(out, url, NULL);
340
+ return create_internal(out, NULL, NULL, url, NULL);
364
341
  }
365
342
 
366
343
  int git_remote_dup(git_remote **dest, git_remote *source)
@@ -369,21 +346,21 @@ int git_remote_dup(git_remote **dest, git_remote *source)
369
346
  int error = 0;
370
347
  git_refspec *spec;
371
348
  git_remote *remote = git__calloc(1, sizeof(git_remote));
372
- GIT_ERROR_CHECK_ALLOC(remote);
349
+ GITERR_CHECK_ALLOC(remote);
373
350
 
374
351
  if (source->name != NULL) {
375
352
  remote->name = git__strdup(source->name);
376
- GIT_ERROR_CHECK_ALLOC(remote->name);
353
+ GITERR_CHECK_ALLOC(remote->name);
377
354
  }
378
355
 
379
356
  if (source->url != NULL) {
380
357
  remote->url = git__strdup(source->url);
381
- GIT_ERROR_CHECK_ALLOC(remote->url);
358
+ GITERR_CHECK_ALLOC(remote->url);
382
359
  }
383
360
 
384
361
  if (source->pushurl != NULL) {
385
362
  remote->pushurl = git__strdup(source->pushurl);
386
- GIT_ERROR_CHECK_ALLOC(remote->pushurl);
363
+ GITERR_CHECK_ALLOC(remote->pushurl);
387
364
  }
388
365
 
389
366
  remote->repo = source->repo;
@@ -442,7 +419,7 @@ static int get_optional_config(
442
419
  *found = !error;
443
420
 
444
421
  if (error == GIT_ENOTFOUND) {
445
- git_error_clear();
422
+ giterr_clear();
446
423
  error = 0;
447
424
  }
448
425
 
@@ -468,10 +445,10 @@ int git_remote_lookup(git_remote **out, git_repository *repo, const char *name)
468
445
  return error;
469
446
 
470
447
  remote = git__calloc(1, sizeof(git_remote));
471
- GIT_ERROR_CHECK_ALLOC(remote);
448
+ GITERR_CHECK_ALLOC(remote);
472
449
 
473
450
  remote->name = git__strdup(name);
474
- GIT_ERROR_CHECK_ALLOC(remote->name);
451
+ GITERR_CHECK_ALLOC(remote->name);
475
452
 
476
453
  if (git_vector_init(&remote->refs, 32, NULL) < 0 ||
477
454
  git_vector_init(&remote->refspecs, 2, NULL) < 0 ||
@@ -494,7 +471,7 @@ int git_remote_lookup(git_remote **out, git_repository *repo, const char *name)
494
471
 
495
472
  if (found && strlen(val) > 0) {
496
473
  remote->url = apply_insteadof(config, val, GIT_DIRECTION_FETCH);
497
- GIT_ERROR_CHECK_ALLOC(remote->url);
474
+ GITERR_CHECK_ALLOC(remote->url);
498
475
  }
499
476
 
500
477
  val = NULL;
@@ -508,13 +485,13 @@ int git_remote_lookup(git_remote **out, git_repository *repo, const char *name)
508
485
 
509
486
  if (!optional_setting_found) {
510
487
  error = GIT_ENOTFOUND;
511
- git_error_set(GIT_ERROR_CONFIG, "remote '%s' does not exist", name);
488
+ giterr_set(GITERR_CONFIG, "remote '%s' does not exist", name);
512
489
  goto cleanup;
513
490
  }
514
491
 
515
492
  if (found && strlen(val) > 0) {
516
493
  remote->pushurl = apply_insteadof(config, val, GIT_DIRECTION_PUSH);
517
- GIT_ERROR_CHECK_ALLOC(remote->pushurl);
494
+ GITERR_CHECK_ALLOC(remote->pushurl);
518
495
  }
519
496
 
520
497
  data.remote = remote;
@@ -547,7 +524,7 @@ int git_remote_lookup(git_remote **out, git_repository *repo, const char *name)
547
524
 
548
525
  cleanup:
549
526
  git_config_free(config);
550
- git_buf_dispose(&buf);
527
+ git_buf_free(&buf);
551
528
 
552
529
  if (error < 0)
553
530
  git_remote_free(remote);
@@ -564,18 +541,18 @@ static int lookup_remote_prune_config(git_remote *remote, git_config *config, co
564
541
 
565
542
  if ((error = git_config_get_bool(&remote->prune_refs, config, git_buf_cstr(&buf))) < 0) {
566
543
  if (error == GIT_ENOTFOUND) {
567
- git_error_clear();
544
+ giterr_clear();
568
545
 
569
546
  if ((error = git_config_get_bool(&remote->prune_refs, config, "fetch.prune")) < 0) {
570
547
  if (error == GIT_ENOTFOUND) {
571
- git_error_clear();
548
+ giterr_clear();
572
549
  error = 0;
573
550
  }
574
551
  }
575
552
  }
576
553
  }
577
554
 
578
- git_buf_dispose(&buf);
555
+ git_buf_free(&buf);
579
556
  return error;
580
557
  }
581
558
 
@@ -624,8 +601,8 @@ static int set_url(git_repository *repo, const char *remote, const char *pattern
624
601
  }
625
602
 
626
603
  cleanup:
627
- git_buf_dispose(&canonical_url);
628
- git_buf_dispose(&buf);
604
+ git_buf_free(&canonical_url);
605
+ git_buf_free(&buf);
629
606
 
630
607
  return error;
631
608
  }
@@ -646,44 +623,21 @@ int git_remote_set_pushurl(git_repository *repo, const char *remote, const char*
646
623
  return set_url(repo, remote, CONFIG_PUSHURL_FMT, url);
647
624
  }
648
625
 
649
- static int resolve_url(git_buf *resolved_url, const char *url, int direction, const git_remote_callbacks *callbacks)
626
+ const char* git_remote__urlfordirection(git_remote *remote, int direction)
650
627
  {
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;
669
-
670
628
  assert(remote);
629
+
671
630
  assert(direction == GIT_DIRECTION_FETCH || direction == GIT_DIRECTION_PUSH);
672
631
 
673
632
  if (direction == GIT_DIRECTION_FETCH) {
674
- url = remote->url;
675
- } else if (direction == GIT_DIRECTION_PUSH) {
676
- url = remote->pushurl ? remote->pushurl : remote->url;
633
+ return remote->url;
677
634
  }
678
635
 
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;
636
+ if (direction == GIT_DIRECTION_PUSH) {
637
+ return remote->pushurl ? remote->pushurl : remote->url;
685
638
  }
686
- return resolve_url(url_out, url, direction, callbacks);
639
+
640
+ return NULL;
687
641
  }
688
642
 
689
643
  int set_transport_callbacks(git_transport *t, const git_remote_callbacks *cbs)
@@ -703,10 +657,10 @@ static int set_transport_custom_headers(git_transport *t, const git_strarray *cu
703
657
  return t->set_custom_headers(t, custom_headers);
704
658
  }
705
659
 
706
- int git_remote__connect(git_remote *remote, git_direction direction, const git_remote_callbacks *callbacks, const git_remote_connection_opts *conn)
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)
707
661
  {
708
662
  git_transport *t;
709
- git_buf url = GIT_BUF_INIT;
663
+ const char *url;
710
664
  int flags = GIT_TRANSPORTFLAGS_NONE;
711
665
  int error;
712
666
  void *payload = NULL;
@@ -716,49 +670,50 @@ int git_remote__connect(git_remote *remote, git_direction direction, const git_r
716
670
  assert(remote);
717
671
 
718
672
  if (callbacks) {
719
- GIT_ERROR_CHECK_VERSION(callbacks, GIT_REMOTE_CALLBACKS_VERSION, "git_remote_callbacks");
673
+ GITERR_CHECK_VERSION(callbacks, GIT_REMOTE_CALLBACKS_VERSION, "git_remote_callbacks");
720
674
  credentials = callbacks->credentials;
721
675
  transport = callbacks->transport;
722
676
  payload = callbacks->payload;
723
677
  }
724
678
 
725
- if (conn->proxy)
726
- GIT_ERROR_CHECK_VERSION(conn->proxy, GIT_PROXY_OPTIONS_VERSION, "git_proxy_options");
679
+ if (proxy)
680
+ GITERR_CHECK_VERSION(proxy, GIT_PROXY_OPTIONS_VERSION, "git_proxy_options");
727
681
 
728
682
  t = remote->transport;
729
683
 
730
- if ((error = git_remote__urlfordirection(&url, remote, direction, callbacks)) < 0)
731
- goto on_error;
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
+ }
732
692
 
733
693
  /* If we don't have a transport object yet, and the caller specified a
734
694
  * custom transport factory, use that */
735
695
  if (!t && transport &&
736
696
  (error = transport(&t, remote, payload)) < 0)
737
- goto on_error;
697
+ return error;
738
698
 
739
699
  /* If we still don't have a transport, then use the global
740
700
  * transport registrations which map URI schemes to transport factories */
741
- if (!t && (error = git_transport_new(&t, remote, url.ptr)) < 0)
742
- goto on_error;
701
+ if (!t && (error = git_transport_new(&t, remote, url)) < 0)
702
+ return error;
743
703
 
744
- if ((error = set_transport_custom_headers(t, conn->custom_headers)) != 0)
704
+ if ((error = set_transport_custom_headers(t, custom_headers)) != 0)
745
705
  goto on_error;
746
706
 
747
707
  if ((error = set_transport_callbacks(t, callbacks)) < 0 ||
748
- (error = t->connect(t, url.ptr, credentials, payload, conn->proxy, direction, flags)) != 0)
708
+ (error = t->connect(t, url, credentials, payload, proxy, direction, flags)) != 0)
749
709
  goto on_error;
750
710
 
751
711
  remote->transport = t;
752
712
 
753
- git_buf_dispose(&url);
754
-
755
713
  return 0;
756
714
 
757
715
  on_error:
758
- if (t)
759
- t->free(t);
760
-
761
- git_buf_dispose(&url);
716
+ t->free(t);
762
717
 
763
718
  if (t == remote->transport)
764
719
  remote->transport = NULL;
@@ -766,22 +721,12 @@ on_error:
766
721
  return error;
767
722
  }
768
723
 
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
-
779
724
  int git_remote_ls(const git_remote_head ***out, size_t *size, git_remote *remote)
780
725
  {
781
726
  assert(remote);
782
727
 
783
728
  if (!remote->transport) {
784
- git_error_set(GIT_ERROR_NET, "this remote has never connected");
729
+ giterr_set(GITERR_NET, "this remote has never connected");
785
730
  return -1;
786
731
  }
787
732
 
@@ -816,7 +761,7 @@ int git_remote__get_http_proxy(git_remote *remote, bool use_ssl, char **proxy_ur
816
761
  return error;
817
762
 
818
763
  error = git_config__lookup_entry(&ce, cfg, git_buf_cstr(&buf), false);
819
- git_buf_dispose(&buf);
764
+ git_buf_free(&buf);
820
765
 
821
766
  if (error < 0)
822
767
  return error;
@@ -845,7 +790,7 @@ int git_remote__get_http_proxy(git_remote *remote, bool use_ssl, char **proxy_ur
845
790
 
846
791
  if (error < 0) {
847
792
  if (error == GIT_ENOTFOUND) {
848
- git_error_clear();
793
+ giterr_clear();
849
794
  error = 0;
850
795
  }
851
796
 
@@ -855,7 +800,7 @@ int git_remote__get_http_proxy(git_remote *remote, bool use_ssl, char **proxy_ur
855
800
  *proxy_url = git_buf_detach(&val);
856
801
 
857
802
  found:
858
- GIT_ERROR_CHECK_ALLOC(*proxy_url);
803
+ GITERR_CHECK_ALLOC(*proxy_url);
859
804
  git_config_entry_free(ce);
860
805
 
861
806
  return 0;
@@ -881,7 +826,7 @@ static void free_refspecs(git_vector *vec)
881
826
  git_refspec *spec;
882
827
 
883
828
  git_vector_foreach(vec, i, spec) {
884
- git_refspec__dispose(spec);
829
+ git_refspec__free(spec);
885
830
  git__free(spec);
886
831
  }
887
832
 
@@ -927,15 +872,15 @@ int git_remote_download(git_remote *remote, const git_strarray *refspecs, const
927
872
  assert(remote);
928
873
 
929
874
  if (!remote->repo) {
930
- git_error_set(GIT_ERROR_INVALID, "cannot download detached remote");
875
+ giterr_set(GITERR_INVALID, "cannot download detached remote");
931
876
  return -1;
932
877
  }
933
878
 
934
879
  if (opts) {
935
- GIT_ERROR_CHECK_VERSION(&opts->callbacks, GIT_REMOTE_CALLBACKS_VERSION, "git_remote_callbacks");
880
+ GITERR_CHECK_VERSION(&opts->callbacks, GIT_REMOTE_CALLBACKS_VERSION, "git_remote_callbacks");
936
881
  cbs = &opts->callbacks;
937
882
  custom_headers = &opts->custom_headers;
938
- GIT_ERROR_CHECK_VERSION(&opts->proxy_opts, GIT_PROXY_OPTIONS_VERSION, "git_proxy_options");
883
+ GITERR_CHECK_VERSION(&opts->proxy_opts, GIT_PROXY_OPTIONS_VERSION, "git_proxy_options");
939
884
  proxy = &opts->proxy_opts;
940
885
  }
941
886
 
@@ -1004,20 +949,21 @@ int git_remote_fetch(
1004
949
  bool prune = false;
1005
950
  git_buf reflog_msg_buf = GIT_BUF_INIT;
1006
951
  const git_remote_callbacks *cbs = NULL;
1007
- git_remote_connection_opts conn = GIT_REMOTE_CONNECTION_OPTIONS_INIT;
952
+ const git_strarray *custom_headers = NULL;
953
+ const git_proxy_options *proxy = NULL;
1008
954
 
1009
955
  if (opts) {
1010
- GIT_ERROR_CHECK_VERSION(&opts->callbacks, GIT_REMOTE_CALLBACKS_VERSION, "git_remote_callbacks");
956
+ GITERR_CHECK_VERSION(&opts->callbacks, GIT_REMOTE_CALLBACKS_VERSION, "git_remote_callbacks");
1011
957
  cbs = &opts->callbacks;
1012
- conn.custom_headers = &opts->custom_headers;
958
+ custom_headers = &opts->custom_headers;
1013
959
  update_fetchhead = opts->update_fetchhead;
1014
960
  tagopt = opts->download_tags;
1015
- GIT_ERROR_CHECK_VERSION(&opts->proxy_opts, GIT_PROXY_OPTIONS_VERSION, "git_proxy_options");
1016
- conn.proxy = &opts->proxy_opts;
961
+ GITERR_CHECK_VERSION(&opts->proxy_opts, GIT_PROXY_OPTIONS_VERSION, "git_proxy_options");
962
+ proxy = &opts->proxy_opts;
1017
963
  }
1018
964
 
1019
965
  /* Connect and download everything */
1020
- if ((error = git_remote__connect(remote, GIT_DIRECTION_FETCH, cbs, &conn)) != 0)
966
+ if ((error = git_remote_connect(remote, GIT_DIRECTION_FETCH, cbs, proxy, custom_headers)) != 0)
1021
967
  return error;
1022
968
 
1023
969
  error = git_remote_download(remote, refspecs, opts);
@@ -1039,7 +985,7 @@ int git_remote_fetch(
1039
985
 
1040
986
  /* Create "remote/foo" branches for all remote branches */
1041
987
  error = git_remote_update_tips(remote, cbs, update_fetchhead, tagopt, git_buf_cstr(&reflog_msg_buf));
1042
- git_buf_dispose(&reflog_msg_buf);
988
+ git_buf_free(&reflog_msg_buf);
1043
989
  if (error < 0)
1044
990
  return error;
1045
991
 
@@ -1095,7 +1041,7 @@ static int ref_to_update(int *update, git_buf *remote_name, git_remote *remote,
1095
1041
  (error = git_refspec_rtransform(remote_name, spec, upstream_name.ptr)) < 0) {
1096
1042
  /* Not an error if there is no upstream */
1097
1043
  if (error == GIT_ENOTFOUND) {
1098
- git_error_clear();
1044
+ giterr_clear();
1099
1045
  error = 0;
1100
1046
  }
1101
1047
 
@@ -1104,8 +1050,8 @@ static int ref_to_update(int *update, git_buf *remote_name, git_remote *remote,
1104
1050
  *update = 1;
1105
1051
  }
1106
1052
 
1107
- git_buf_dispose(&upstream_remote);
1108
- git_buf_dispose(&upstream_name);
1053
+ git_buf_free(&upstream_remote);
1054
+ git_buf_free(&upstream_name);
1109
1055
  return error;
1110
1056
  }
1111
1057
 
@@ -1124,7 +1070,7 @@ static int remote_head_for_ref(git_remote_head **out, git_remote *remote, git_re
1124
1070
  error = git_reference_resolve(&resolved_ref, ref);
1125
1071
 
1126
1072
  /* If we're in an unborn branch, let's pretend nothing happened */
1127
- if (error == GIT_ENOTFOUND && git_reference_type(ref) == GIT_REFERENCE_SYMBOLIC) {
1073
+ if (error == GIT_ENOTFOUND && git_reference_type(ref) == GIT_REF_SYMBOLIC) {
1128
1074
  ref_name = git_reference_symbolic_target(ref);
1129
1075
  error = 0;
1130
1076
  } else {
@@ -1138,7 +1084,7 @@ static int remote_head_for_ref(git_remote_head **out, git_remote *remote, git_re
1138
1084
  error = remote_head_for_fetchspec_src(out, update_heads, git_buf_cstr(&remote_name));
1139
1085
 
1140
1086
  cleanup:
1141
- git_buf_dispose(&remote_name);
1087
+ git_buf_free(&remote_name);
1142
1088
  git_reference_free(resolved_ref);
1143
1089
  git_config_free(config);
1144
1090
  return error;
@@ -1230,7 +1176,7 @@ static int prune_candidates(git_vector *candidates, git_remote *remote)
1230
1176
  continue;
1231
1177
 
1232
1178
  refname_dup = git__strdup(refname);
1233
- GIT_ERROR_CHECK_ALLOC(refname_dup);
1179
+ GITERR_CHECK_ALLOC(refname_dup);
1234
1180
 
1235
1181
  if ((error = git_vector_insert(candidates, refname_dup)) < 0)
1236
1182
  goto out;
@@ -1260,7 +1206,7 @@ int git_remote_prune(git_remote *remote, const git_remote_callbacks *callbacks)
1260
1206
  git_oid zero_id = {{ 0 }};
1261
1207
 
1262
1208
  if (callbacks)
1263
- GIT_ERROR_CHECK_VERSION(callbacks, GIT_REMOTE_CALLBACKS_VERSION, "git_remote_callbacks");
1209
+ GITERR_CHECK_VERSION(callbacks, GIT_REMOTE_CALLBACKS_VERSION, "git_remote_callbacks");
1264
1210
 
1265
1211
  if ((error = ls_to_vector(&remote_refs, remote)) < 0)
1266
1212
  goto cleanup;
@@ -1289,7 +1235,7 @@ int git_remote_prune(git_remote *remote, const git_remote_callbacks *callbacks)
1289
1235
 
1290
1236
  key.name = (char *) git_buf_cstr(&buf);
1291
1237
  error = git_vector_bsearch(&pos, &remote_refs, &key);
1292
- git_buf_dispose(&buf);
1238
+ git_buf_free(&buf);
1293
1239
 
1294
1240
  if (error < 0 && error != GIT_ENOTFOUND)
1295
1241
  goto cleanup;
@@ -1327,7 +1273,7 @@ int git_remote_prune(git_remote *remote, const git_remote_callbacks *callbacks)
1327
1273
  if (error < 0)
1328
1274
  goto cleanup;
1329
1275
 
1330
- if (git_reference_type(ref) == GIT_REFERENCE_SYMBOLIC) {
1276
+ if (git_reference_type(ref) == GIT_REF_SYMBOLIC) {
1331
1277
  git_reference_free(ref);
1332
1278
  continue;
1333
1279
  }
@@ -1448,7 +1394,7 @@ static int update_tips_for_spec(
1448
1394
  continue;
1449
1395
 
1450
1396
  /* In autotag mode, don't overwrite any locally-existing tags */
1451
- error = git_reference_create(&ref, remote->repo, refname.ptr, &head->oid, !autotag,
1397
+ error = git_reference_create(&ref, remote->repo, refname.ptr, &head->oid, !autotag,
1452
1398
  log_message);
1453
1399
 
1454
1400
  if (error == GIT_EEXISTS)
@@ -1470,14 +1416,14 @@ static int update_tips_for_spec(
1470
1416
  goto on_error;
1471
1417
 
1472
1418
  git_vector_free(&update_heads);
1473
- git_refspec__dispose(&tagspec);
1474
- git_buf_dispose(&refname);
1419
+ git_refspec__free(&tagspec);
1420
+ git_buf_free(&refname);
1475
1421
  return 0;
1476
1422
 
1477
1423
  on_error:
1478
1424
  git_vector_free(&update_heads);
1479
- git_refspec__dispose(&tagspec);
1480
- git_buf_dispose(&refname);
1425
+ git_refspec__free(&tagspec);
1426
+ git_buf_free(&refname);
1481
1427
  return -1;
1482
1428
 
1483
1429
  }
@@ -1591,7 +1537,7 @@ static int opportunistic_updates(const git_remote *remote, const git_remote_call
1591
1537
  error = 0;
1592
1538
 
1593
1539
  cleanup:
1594
- git_buf_dispose(&refname);
1540
+ git_buf_free(&refname);
1595
1541
  return error;
1596
1542
  }
1597
1543
 
@@ -1604,7 +1550,7 @@ static int truncate_fetch_head(const char *gitdir)
1604
1550
  return error;
1605
1551
 
1606
1552
  error = git_futils_truncate(path.ptr, GIT_REFS_FILE_MODE);
1607
- git_buf_dispose(&path);
1553
+ git_buf_free(&path);
1608
1554
 
1609
1555
  return error;
1610
1556
  }
@@ -1661,7 +1607,7 @@ int git_remote_update_tips(
1661
1607
 
1662
1608
  out:
1663
1609
  git_vector_free(&refs);
1664
- git_refspec__dispose(&tagspec);
1610
+ git_refspec__free(&tagspec);
1665
1611
  return error;
1666
1612
  }
1667
1613
 
@@ -1735,7 +1681,7 @@ static int remote_list_cb(const git_config_entry *entry, void *payload)
1735
1681
  remote_name = git__strndup(name, namelen - 4); /* strip ".url" */
1736
1682
  else
1737
1683
  remote_name = git__strndup(name, namelen - 8); /* strip ".pushurl" */
1738
- GIT_ERROR_CHECK_ALLOC(remote_name);
1684
+ GITERR_CHECK_ALLOC(remote_name);
1739
1685
 
1740
1686
  return git_vector_insert(list, remote_name);
1741
1687
  }
@@ -1768,7 +1714,7 @@ int git_remote_list(git_strarray *remotes_list, git_repository *repo)
1768
1714
  return 0;
1769
1715
  }
1770
1716
 
1771
- const git_indexer_progress *git_remote_stats(git_remote *remote)
1717
+ const git_transfer_progress* git_remote_stats(git_remote *remote)
1772
1718
  {
1773
1719
  assert(remote);
1774
1720
  return &remote->stats;
@@ -1809,11 +1755,11 @@ int git_remote_set_autotag(git_repository *repo, const char *remote, git_remote_
1809
1755
  error = 0;
1810
1756
  break;
1811
1757
  default:
1812
- git_error_set(GIT_ERROR_INVALID, "invalid value for the tagopt setting");
1758
+ giterr_set(GITERR_INVALID, "invalid value for the tagopt setting");
1813
1759
  error = -1;
1814
1760
  }
1815
1761
 
1816
- git_buf_dispose(&var);
1762
+ git_buf_free(&var);
1817
1763
  return error;
1818
1764
  }
1819
1765
 
@@ -1844,8 +1790,8 @@ static int rename_remote_config_section(
1844
1790
  new_name ? git_buf_cstr(&new_section_name) : NULL);
1845
1791
 
1846
1792
  cleanup:
1847
- git_buf_dispose(&old_section_name);
1848
- git_buf_dispose(&new_section_name);
1793
+ git_buf_free(&old_section_name);
1794
+ git_buf_free(&new_section_name);
1849
1795
 
1850
1796
  return error;
1851
1797
  }
@@ -1917,7 +1863,7 @@ static int rename_one_remote_reference(
1917
1863
  git_buf_cstr(&log_message))) < 0)
1918
1864
  goto cleanup;
1919
1865
 
1920
- if (git_reference_type(ref) != GIT_REFERENCE_SYMBOLIC)
1866
+ if (git_reference_type(ref) != GIT_REF_SYMBOLIC)
1921
1867
  goto cleanup;
1922
1868
 
1923
1869
  /* Handle refs like origin/HEAD -> origin/master */
@@ -1941,10 +1887,10 @@ static int rename_one_remote_reference(
1941
1887
  cleanup:
1942
1888
  git_reference_free(reference_in);
1943
1889
  git_reference_free(ref);
1944
- git_buf_dispose(&namespace);
1945
- git_buf_dispose(&old_namespace);
1946
- git_buf_dispose(&new_name);
1947
- git_buf_dispose(&log_message);
1890
+ git_buf_free(&namespace);
1891
+ git_buf_free(&old_namespace);
1892
+ git_buf_free(&new_name);
1893
+ git_buf_free(&log_message);
1948
1894
  return error;
1949
1895
  }
1950
1896
 
@@ -1962,7 +1908,7 @@ static int rename_remote_references(
1962
1908
  return error;
1963
1909
 
1964
1910
  error = git_reference_iterator_glob_new(&iter, repo, git_buf_cstr(&buf));
1965
- git_buf_dispose(&buf);
1911
+ git_buf_free(&buf);
1966
1912
 
1967
1913
  if (error < 0)
1968
1914
  return error;
@@ -1991,7 +1937,8 @@ static int rename_fetch_refspecs(git_vector *problems, git_remote *remote, const
1991
1937
  if ((error = git_vector_init(problems, 1, NULL)) < 0)
1992
1938
  return error;
1993
1939
 
1994
- if ((error = default_fetchspec_for_name(&base, remote->name)) < 0)
1940
+ if ((error = git_buf_printf(
1941
+ &base, "+refs/heads/*:refs/remotes/%s/*", remote->name)) < 0)
1995
1942
  return error;
1996
1943
 
1997
1944
  git_vector_foreach(&remote->refspecs, i, spec) {
@@ -2003,7 +1950,7 @@ static int rename_fetch_refspecs(git_vector *problems, git_remote *remote, const
2003
1950
  char *dup;
2004
1951
 
2005
1952
  dup = git__strdup(spec->string);
2006
- GIT_ERROR_CHECK_ALLOC(dup);
1953
+ GITERR_CHECK_ALLOC(dup);
2007
1954
 
2008
1955
  if ((error = git_vector_insert(problems, dup)) < 0)
2009
1956
  break;
@@ -2016,7 +1963,8 @@ static int rename_fetch_refspecs(git_vector *problems, git_remote *remote, const
2016
1963
  git_buf_clear(&val);
2017
1964
  git_buf_clear(&var);
2018
1965
 
2019
- if (default_fetchspec_for_name(&val, new_name) < 0 ||
1966
+ if (git_buf_printf(
1967
+ &val, "+refs/heads/*:refs/remotes/%s/*", new_name) < 0 ||
2020
1968
  git_buf_printf(&var, "remote.%s.fetch", new_name) < 0)
2021
1969
  {
2022
1970
  error = -1;
@@ -2028,9 +1976,9 @@ static int rename_fetch_refspecs(git_vector *problems, git_remote *remote, const
2028
1976
  break;
2029
1977
  }
2030
1978
 
2031
- git_buf_dispose(&base);
2032
- git_buf_dispose(&var);
2033
- git_buf_dispose(&val);
1979
+ git_buf_free(&base);
1980
+ git_buf_free(&var);
1981
+ git_buf_free(&val);
2034
1982
 
2035
1983
  if (error < 0) {
2036
1984
  char *str;
@@ -2096,10 +2044,10 @@ int git_remote_is_valid_name(
2096
2044
  git_buf_printf(&buf, "refs/heads/test:refs/remotes/%s/test", remote_name);
2097
2045
  error = git_refspec__parse(&refspec, git_buf_cstr(&buf), true);
2098
2046
 
2099
- git_buf_dispose(&buf);
2100
- git_refspec__dispose(&refspec);
2047
+ git_buf_free(&buf);
2048
+ git_refspec__free(&refspec);
2101
2049
 
2102
- git_error_clear();
2050
+ giterr_clear();
2103
2051
  return error == 0;
2104
2052
  }
2105
2053
 
@@ -2254,7 +2202,7 @@ static int remove_branch_config_related_entries(
2254
2202
  if ((error = git_config_delete_entry(config, git_buf_cstr(&buf))) < 0) {
2255
2203
  if (error != GIT_ENOTFOUND)
2256
2204
  break;
2257
- git_error_clear();
2205
+ giterr_clear();
2258
2206
  }
2259
2207
 
2260
2208
  git_buf_clear(&buf);
@@ -2264,14 +2212,14 @@ static int remove_branch_config_related_entries(
2264
2212
  if ((error = git_config_delete_entry(config, git_buf_cstr(&buf))) < 0) {
2265
2213
  if (error != GIT_ENOTFOUND)
2266
2214
  break;
2267
- git_error_clear();
2215
+ giterr_clear();
2268
2216
  }
2269
2217
  }
2270
2218
 
2271
2219
  if (error == GIT_ITEROVER)
2272
2220
  error = 0;
2273
2221
 
2274
- git_buf_dispose(&buf);
2222
+ git_buf_free(&buf);
2275
2223
  git_config_iterator_free(iter);
2276
2224
  return error;
2277
2225
  }
@@ -2425,23 +2373,24 @@ int git_remote_upload(git_remote *remote, const git_strarray *refspecs, const gi
2425
2373
  git_push *push;
2426
2374
  git_refspec *spec;
2427
2375
  const git_remote_callbacks *cbs = NULL;
2428
- git_remote_connection_opts conn = GIT_REMOTE_CONNECTION_OPTIONS_INIT;
2376
+ const git_strarray *custom_headers = NULL;
2377
+ const git_proxy_options *proxy = NULL;
2429
2378
 
2430
2379
  assert(remote);
2431
2380
 
2432
2381
  if (!remote->repo) {
2433
- git_error_set(GIT_ERROR_INVALID, "cannot download detached remote");
2382
+ giterr_set(GITERR_INVALID, "cannot download detached remote");
2434
2383
  return -1;
2435
2384
  }
2436
2385
 
2437
2386
  if (opts) {
2438
2387
  cbs = &opts->callbacks;
2439
- conn.custom_headers = &opts->custom_headers;
2440
- conn.proxy = &opts->proxy_opts;
2388
+ custom_headers = &opts->custom_headers;
2389
+ proxy = &opts->proxy_opts;
2441
2390
  }
2442
2391
 
2443
2392
  if (!git_remote_connected(remote) &&
2444
- (error = git_remote__connect(remote, GIT_DIRECTION_PUSH, cbs, &conn)) < 0)
2393
+ (error = git_remote_connect(remote, GIT_DIRECTION_PUSH, cbs, proxy, custom_headers)) < 0)
2445
2394
  goto cleanup;
2446
2395
 
2447
2396
  free_refspecs(&remote->active_refspecs);
@@ -2496,15 +2445,15 @@ int git_remote_push(git_remote *remote, const git_strarray *refspecs, const git_
2496
2445
  assert(remote);
2497
2446
 
2498
2447
  if (!remote->repo) {
2499
- git_error_set(GIT_ERROR_INVALID, "cannot download detached remote");
2448
+ giterr_set(GITERR_INVALID, "cannot download detached remote");
2500
2449
  return -1;
2501
2450
  }
2502
2451
 
2503
2452
  if (opts) {
2504
- GIT_ERROR_CHECK_VERSION(&opts->callbacks, GIT_REMOTE_CALLBACKS_VERSION, "git_remote_callbacks");
2453
+ GITERR_CHECK_VERSION(&opts->callbacks, GIT_REMOTE_CALLBACKS_VERSION, "git_remote_callbacks");
2505
2454
  cbs = &opts->callbacks;
2506
2455
  custom_headers = &opts->custom_headers;
2507
- GIT_ERROR_CHECK_VERSION(&opts->proxy_opts, GIT_PROXY_OPTIONS_VERSION, "git_proxy_options");
2456
+ GITERR_CHECK_VERSION(&opts->proxy_opts, GIT_PROXY_OPTIONS_VERSION, "git_proxy_options");
2508
2457
  proxy = &opts->proxy_opts;
2509
2458
  }
2510
2459