rugged 1.7.2 → 1.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (361) hide show
  1. checksums.yaml +4 -4
  2. data/lib/rugged/version.rb +1 -1
  3. data/vendor/libgit2/AUTHORS +1 -0
  4. data/vendor/libgit2/CMakeLists.txt +23 -10
  5. data/vendor/libgit2/COPYING +195 -1
  6. data/vendor/libgit2/cmake/{FindIconv.cmake → FindIntlIconv.cmake} +6 -0
  7. data/vendor/libgit2/cmake/FindLLHTTP.cmake +39 -0
  8. data/vendor/libgit2/cmake/SelectGSSAPI.cmake +1 -1
  9. data/vendor/libgit2/cmake/SelectHTTPParser.cmake +23 -8
  10. data/vendor/libgit2/cmake/SelectHTTPSBackend.cmake +17 -8
  11. data/vendor/libgit2/cmake/SelectHashes.cmake +28 -11
  12. data/vendor/libgit2/cmake/SelectRegex.cmake +6 -1
  13. data/vendor/libgit2/cmake/SelectSSH.cmake +22 -17
  14. data/vendor/libgit2/cmake/SelectZlib.cmake +4 -0
  15. data/vendor/libgit2/deps/llhttp/CMakeLists.txt +8 -0
  16. data/vendor/libgit2/deps/llhttp/LICENSE-MIT +22 -0
  17. data/vendor/libgit2/deps/llhttp/api.c +510 -0
  18. data/vendor/libgit2/deps/llhttp/http.c +170 -0
  19. data/vendor/libgit2/deps/llhttp/llhttp.c +10168 -0
  20. data/vendor/libgit2/deps/llhttp/llhttp.h +897 -0
  21. data/vendor/libgit2/deps/ntlmclient/CMakeLists.txt +1 -1
  22. data/vendor/libgit2/deps/ntlmclient/crypt_builtin_md4.c +311 -0
  23. data/vendor/libgit2/deps/ntlmclient/crypt_commoncrypto.c +2 -1
  24. data/vendor/libgit2/deps/ntlmclient/crypt_mbedtls.c +0 -20
  25. data/vendor/libgit2/deps/ntlmclient/crypt_openssl.c +4 -4
  26. data/vendor/libgit2/deps/ntlmclient/ntlm.c +21 -21
  27. data/vendor/libgit2/deps/ntlmclient/unicode_builtin.c +5 -4
  28. data/vendor/libgit2/deps/ntlmclient/unicode_iconv.c +2 -1
  29. data/vendor/libgit2/deps/ntlmclient/utf8.h +1176 -721
  30. data/vendor/libgit2/deps/ntlmclient/util.h +11 -0
  31. data/vendor/libgit2/deps/pcre/CMakeLists.txt +1 -0
  32. data/vendor/libgit2/deps/xdiff/xmerge.c +2 -2
  33. data/vendor/libgit2/deps/zlib/CMakeLists.txt +6 -1
  34. data/vendor/libgit2/deps/zlib/LICENSE +22 -0
  35. data/vendor/libgit2/deps/zlib/adler32.c +5 -27
  36. data/vendor/libgit2/deps/zlib/crc32.c +94 -167
  37. data/vendor/libgit2/deps/zlib/deflate.c +358 -435
  38. data/vendor/libgit2/deps/zlib/deflate.h +41 -10
  39. data/vendor/libgit2/deps/zlib/gzguts.h +13 -18
  40. data/vendor/libgit2/deps/zlib/infback.c +17 -30
  41. data/vendor/libgit2/deps/zlib/inffast.c +1 -4
  42. data/vendor/libgit2/deps/zlib/inffast.h +1 -1
  43. data/vendor/libgit2/deps/zlib/inflate.c +36 -102
  44. data/vendor/libgit2/deps/zlib/inftrees.c +6 -11
  45. data/vendor/libgit2/deps/zlib/inftrees.h +6 -6
  46. data/vendor/libgit2/deps/zlib/trees.c +287 -352
  47. data/vendor/libgit2/deps/zlib/zconf.h +23 -14
  48. data/vendor/libgit2/deps/zlib/zlib.h +202 -202
  49. data/vendor/libgit2/deps/zlib/zutil.c +18 -44
  50. data/vendor/libgit2/deps/zlib/zutil.h +13 -33
  51. data/vendor/libgit2/include/git2/annotated_commit.h +12 -5
  52. data/vendor/libgit2/include/git2/apply.h +27 -6
  53. data/vendor/libgit2/include/git2/attr.h +17 -4
  54. data/vendor/libgit2/include/git2/blame.h +133 -28
  55. data/vendor/libgit2/include/git2/blob.h +71 -28
  56. data/vendor/libgit2/include/git2/branch.h +22 -15
  57. data/vendor/libgit2/include/git2/buffer.h +6 -4
  58. data/vendor/libgit2/include/git2/cert.h +2 -1
  59. data/vendor/libgit2/include/git2/checkout.h +83 -32
  60. data/vendor/libgit2/include/git2/cherrypick.h +10 -3
  61. data/vendor/libgit2/include/git2/clone.h +25 -9
  62. data/vendor/libgit2/include/git2/commit.h +132 -3
  63. data/vendor/libgit2/include/git2/common.h +120 -63
  64. data/vendor/libgit2/include/git2/config.h +93 -23
  65. data/vendor/libgit2/include/git2/credential.h +30 -2
  66. data/vendor/libgit2/include/git2/credential_helpers.h +1 -0
  67. data/vendor/libgit2/include/git2/deprecated.h +133 -3
  68. data/vendor/libgit2/include/git2/describe.h +13 -1
  69. data/vendor/libgit2/include/git2/diff.h +38 -8
  70. data/vendor/libgit2/include/git2/email.h +9 -29
  71. data/vendor/libgit2/include/git2/errors.h +46 -73
  72. data/vendor/libgit2/include/git2/filter.h +14 -7
  73. data/vendor/libgit2/include/git2/global.h +8 -1
  74. data/vendor/libgit2/include/git2/graph.h +3 -2
  75. data/vendor/libgit2/include/git2/ignore.h +10 -0
  76. data/vendor/libgit2/include/git2/index.h +99 -14
  77. data/vendor/libgit2/include/git2/indexer.h +21 -4
  78. data/vendor/libgit2/include/git2/mailmap.h +7 -1
  79. data/vendor/libgit2/include/git2/merge.h +46 -1
  80. data/vendor/libgit2/include/git2/message.h +2 -2
  81. data/vendor/libgit2/include/git2/net.h +3 -1
  82. data/vendor/libgit2/include/git2/notes.h +9 -6
  83. data/vendor/libgit2/include/git2/object.h +9 -8
  84. data/vendor/libgit2/include/git2/odb.h +91 -49
  85. data/vendor/libgit2/include/git2/odb_backend.h +80 -52
  86. data/vendor/libgit2/include/git2/oid.h +23 -24
  87. data/vendor/libgit2/include/git2/oidarray.h +7 -1
  88. data/vendor/libgit2/include/git2/pack.h +13 -1
  89. data/vendor/libgit2/include/git2/patch.h +2 -3
  90. data/vendor/libgit2/include/git2/pathspec.h +9 -0
  91. data/vendor/libgit2/include/git2/proxy.h +10 -0
  92. data/vendor/libgit2/include/git2/rebase.h +9 -6
  93. data/vendor/libgit2/include/git2/refdb.h +2 -2
  94. data/vendor/libgit2/include/git2/reflog.h +3 -2
  95. data/vendor/libgit2/include/git2/refs.h +9 -6
  96. data/vendor/libgit2/include/git2/refspec.h +14 -4
  97. data/vendor/libgit2/include/git2/remote.h +94 -18
  98. data/vendor/libgit2/include/git2/repository.h +57 -21
  99. data/vendor/libgit2/include/git2/reset.h +16 -3
  100. data/vendor/libgit2/include/git2/revert.h +9 -4
  101. data/vendor/libgit2/include/git2/revparse.h +3 -3
  102. data/vendor/libgit2/include/git2/revwalk.h +3 -2
  103. data/vendor/libgit2/include/git2/signature.h +46 -1
  104. data/vendor/libgit2/include/git2/stash.h +17 -3
  105. data/vendor/libgit2/include/git2/status.h +10 -6
  106. data/vendor/libgit2/include/git2/stdint.h +87 -85
  107. data/vendor/libgit2/include/git2/strarray.h +2 -3
  108. data/vendor/libgit2/include/git2/submodule.h +20 -9
  109. data/vendor/libgit2/include/git2/sys/alloc.h +12 -0
  110. data/vendor/libgit2/include/git2/sys/commit.h +77 -3
  111. data/vendor/libgit2/include/git2/sys/commit_graph.h +103 -62
  112. data/vendor/libgit2/include/git2/sys/config.h +80 -4
  113. data/vendor/libgit2/include/git2/sys/credential.h +4 -3
  114. data/vendor/libgit2/include/git2/sys/diff.h +21 -1
  115. data/vendor/libgit2/include/git2/sys/email.h +7 -0
  116. data/vendor/libgit2/include/git2/sys/errors.h +76 -0
  117. data/vendor/libgit2/include/git2/sys/filter.h +66 -3
  118. data/vendor/libgit2/include/git2/sys/hashsig.h +11 -0
  119. data/vendor/libgit2/include/git2/sys/index.h +3 -2
  120. data/vendor/libgit2/include/git2/sys/mempack.h +32 -2
  121. data/vendor/libgit2/include/git2/sys/merge.h +55 -7
  122. data/vendor/libgit2/include/git2/sys/midx.h +43 -4
  123. data/vendor/libgit2/include/git2/sys/odb_backend.h +7 -3
  124. data/vendor/libgit2/include/git2/sys/openssl.h +8 -1
  125. data/vendor/libgit2/include/git2/sys/path.h +12 -1
  126. data/vendor/libgit2/include/git2/sys/refdb_backend.h +40 -36
  127. data/vendor/libgit2/include/git2/sys/refs.h +3 -2
  128. data/vendor/libgit2/include/git2/sys/remote.h +8 -1
  129. data/vendor/libgit2/include/git2/sys/repository.h +63 -3
  130. data/vendor/libgit2/include/git2/sys/stream.h +11 -2
  131. data/vendor/libgit2/include/git2/sys/transport.h +24 -3
  132. data/vendor/libgit2/include/git2/tag.h +3 -1
  133. data/vendor/libgit2/include/git2/trace.h +9 -3
  134. data/vendor/libgit2/include/git2/transaction.h +3 -2
  135. data/vendor/libgit2/include/git2/transport.h +11 -3
  136. data/vendor/libgit2/include/git2/tree.h +16 -5
  137. data/vendor/libgit2/include/git2/types.h +19 -3
  138. data/vendor/libgit2/include/git2/version.h +44 -8
  139. data/vendor/libgit2/include/git2/worktree.h +16 -6
  140. data/vendor/libgit2/src/CMakeLists.txt +6 -4
  141. data/vendor/libgit2/src/cli/CMakeLists.txt +2 -2
  142. data/vendor/libgit2/src/cli/cmd.c +1 -1
  143. data/vendor/libgit2/src/cli/cmd.h +4 -0
  144. data/vendor/libgit2/src/cli/cmd_blame.c +287 -0
  145. data/vendor/libgit2/src/cli/cmd_cat_file.c +6 -8
  146. data/vendor/libgit2/src/cli/cmd_clone.c +5 -7
  147. data/vendor/libgit2/src/cli/cmd_config.c +241 -0
  148. data/vendor/libgit2/src/cli/cmd_hash_object.c +6 -8
  149. data/vendor/libgit2/src/cli/cmd_help.c +6 -7
  150. data/vendor/libgit2/src/cli/cmd_index_pack.c +114 -0
  151. data/vendor/libgit2/src/cli/cmd_init.c +102 -0
  152. data/vendor/libgit2/src/cli/common.c +168 -0
  153. data/vendor/libgit2/src/cli/common.h +63 -0
  154. data/vendor/libgit2/src/cli/error.h +1 -1
  155. data/vendor/libgit2/src/cli/main.c +52 -24
  156. data/vendor/libgit2/src/cli/opt.c +29 -3
  157. data/vendor/libgit2/src/cli/opt.h +21 -3
  158. data/vendor/libgit2/src/cli/opt_usage.c +102 -33
  159. data/vendor/libgit2/src/cli/opt_usage.h +6 -1
  160. data/vendor/libgit2/src/cli/progress.c +51 -2
  161. data/vendor/libgit2/src/cli/progress.h +12 -0
  162. data/vendor/libgit2/src/cli/unix/sighandler.c +2 -1
  163. data/vendor/libgit2/src/cli/win32/precompiled.h +1 -1
  164. data/vendor/libgit2/src/cli/win32/sighandler.c +1 -1
  165. data/vendor/libgit2/src/libgit2/CMakeLists.txt +26 -8
  166. data/vendor/libgit2/src/libgit2/apply.c +10 -13
  167. data/vendor/libgit2/src/libgit2/attr.c +30 -13
  168. data/vendor/libgit2/src/libgit2/attr_file.c +7 -2
  169. data/vendor/libgit2/src/libgit2/attr_file.h +2 -0
  170. data/vendor/libgit2/src/libgit2/attrcache.c +69 -33
  171. data/vendor/libgit2/src/libgit2/attrcache.h +5 -9
  172. data/vendor/libgit2/src/libgit2/blame.c +130 -44
  173. data/vendor/libgit2/src/libgit2/blame.h +1 -0
  174. data/vendor/libgit2/src/libgit2/cache.c +22 -17
  175. data/vendor/libgit2/src/libgit2/cache.h +7 -9
  176. data/vendor/libgit2/src/libgit2/checkout.c +34 -24
  177. data/vendor/libgit2/src/libgit2/checkout.h +0 -2
  178. data/vendor/libgit2/src/libgit2/cherrypick.c +1 -2
  179. data/vendor/libgit2/src/libgit2/clone.c +186 -166
  180. data/vendor/libgit2/src/libgit2/clone.h +4 -1
  181. data/vendor/libgit2/src/libgit2/commit.c +92 -0
  182. data/vendor/libgit2/src/libgit2/commit_graph.c +67 -56
  183. data/vendor/libgit2/src/libgit2/commit_graph.h +1 -2
  184. data/vendor/libgit2/src/libgit2/config.c +389 -298
  185. data/vendor/libgit2/src/libgit2/config.cmake.in +3 -0
  186. data/vendor/libgit2/src/libgit2/config.h +9 -4
  187. data/vendor/libgit2/src/libgit2/config_backend.h +8 -10
  188. data/vendor/libgit2/src/libgit2/config_cache.c +4 -5
  189. data/vendor/libgit2/src/libgit2/config_file.c +99 -88
  190. data/vendor/libgit2/src/libgit2/config_list.c +285 -0
  191. data/vendor/libgit2/src/libgit2/config_list.h +32 -0
  192. data/vendor/libgit2/src/libgit2/config_mem.c +194 -40
  193. data/vendor/libgit2/src/libgit2/config_parse.c +10 -9
  194. data/vendor/libgit2/src/libgit2/config_snapshot.c +24 -31
  195. data/vendor/libgit2/src/libgit2/describe.c +24 -24
  196. data/vendor/libgit2/src/libgit2/diff.c +1 -1
  197. data/vendor/libgit2/src/libgit2/diff_driver.c +12 -19
  198. data/vendor/libgit2/src/libgit2/diff_driver.h +2 -2
  199. data/vendor/libgit2/src/libgit2/diff_generate.c +3 -3
  200. data/vendor/libgit2/src/libgit2/diff_parse.c +2 -2
  201. data/vendor/libgit2/src/libgit2/diff_print.c +65 -9
  202. data/vendor/libgit2/src/libgit2/diff_tform.c +36 -8
  203. data/vendor/libgit2/src/libgit2/email.c +1 -0
  204. data/vendor/libgit2/src/libgit2/fetch.c +5 -3
  205. data/vendor/libgit2/src/libgit2/filter.c +5 -5
  206. data/vendor/libgit2/src/libgit2/git2.rc +3 -3
  207. data/vendor/libgit2/src/libgit2/grafts.c +18 -20
  208. data/vendor/libgit2/src/libgit2/grafts.h +0 -1
  209. data/vendor/libgit2/src/libgit2/graph.c +1 -1
  210. data/vendor/libgit2/src/libgit2/hashmap_oid.h +30 -0
  211. data/vendor/libgit2/src/libgit2/ignore.c +9 -5
  212. data/vendor/libgit2/src/libgit2/index.c +68 -90
  213. data/vendor/libgit2/src/libgit2/index.h +2 -2
  214. data/vendor/libgit2/src/libgit2/index_map.c +95 -0
  215. data/vendor/libgit2/src/libgit2/index_map.h +28 -0
  216. data/vendor/libgit2/src/libgit2/indexer.c +34 -38
  217. data/vendor/libgit2/src/libgit2/iterator.c +14 -8
  218. data/vendor/libgit2/src/libgit2/libgit2.c +153 -368
  219. data/vendor/libgit2/src/libgit2/mailmap.c +1 -1
  220. data/vendor/libgit2/src/libgit2/merge.c +42 -37
  221. data/vendor/libgit2/src/libgit2/merge_driver.c +2 -2
  222. data/vendor/libgit2/src/libgit2/midx.c +28 -15
  223. data/vendor/libgit2/src/libgit2/mwindow.c +38 -45
  224. data/vendor/libgit2/src/libgit2/mwindow.h +4 -0
  225. data/vendor/libgit2/src/libgit2/object.c +6 -5
  226. data/vendor/libgit2/src/libgit2/odb.c +5 -4
  227. data/vendor/libgit2/src/libgit2/odb_mempack.c +49 -17
  228. data/vendor/libgit2/src/libgit2/odb_pack.c +13 -5
  229. data/vendor/libgit2/src/libgit2/oid.c +32 -5
  230. data/vendor/libgit2/src/libgit2/oid.h +11 -0
  231. data/vendor/libgit2/src/libgit2/pack-objects.c +58 -31
  232. data/vendor/libgit2/src/libgit2/pack-objects.h +12 -4
  233. data/vendor/libgit2/src/libgit2/pack.c +30 -24
  234. data/vendor/libgit2/src/libgit2/pack.h +15 -10
  235. data/vendor/libgit2/src/libgit2/patch_parse.c +2 -2
  236. data/vendor/libgit2/src/libgit2/path.c +1 -1
  237. data/vendor/libgit2/src/libgit2/pathspec.c +1 -1
  238. data/vendor/libgit2/src/libgit2/push.c +79 -28
  239. data/vendor/libgit2/src/libgit2/push.h +1 -0
  240. data/vendor/libgit2/src/libgit2/refdb_fs.c +128 -61
  241. data/vendor/libgit2/src/libgit2/reflog.c +1 -2
  242. data/vendor/libgit2/src/libgit2/reflog.h +2 -0
  243. data/vendor/libgit2/src/libgit2/refs.c +26 -7
  244. data/vendor/libgit2/src/libgit2/refs.h +6 -1
  245. data/vendor/libgit2/src/libgit2/refspec.c +28 -1
  246. data/vendor/libgit2/src/libgit2/refspec.h +8 -0
  247. data/vendor/libgit2/src/libgit2/remote.c +121 -61
  248. data/vendor/libgit2/src/libgit2/repository.c +231 -51
  249. data/vendor/libgit2/src/libgit2/repository.h +10 -6
  250. data/vendor/libgit2/src/libgit2/revert.c +1 -2
  251. data/vendor/libgit2/src/libgit2/revparse.c +2 -2
  252. data/vendor/libgit2/src/libgit2/revwalk.c +13 -10
  253. data/vendor/libgit2/src/libgit2/revwalk.h +3 -3
  254. data/vendor/libgit2/src/libgit2/settings.c +468 -0
  255. data/vendor/libgit2/src/libgit2/settings.h +6 -2
  256. data/vendor/libgit2/src/libgit2/signature.c +132 -15
  257. data/vendor/libgit2/src/libgit2/signature.h +0 -1
  258. data/vendor/libgit2/src/libgit2/status.c +1 -1
  259. data/vendor/libgit2/src/libgit2/streams/mbedtls.c +54 -60
  260. data/vendor/libgit2/src/libgit2/streams/openssl.c +32 -7
  261. data/vendor/libgit2/src/libgit2/streams/openssl.h +2 -0
  262. data/vendor/libgit2/src/libgit2/streams/openssl_dynamic.c +4 -0
  263. data/vendor/libgit2/src/libgit2/streams/openssl_dynamic.h +3 -0
  264. data/vendor/libgit2/src/libgit2/streams/stransport.c +39 -7
  265. data/vendor/libgit2/src/libgit2/submodule.c +106 -63
  266. data/vendor/libgit2/src/libgit2/submodule.h +6 -7
  267. data/vendor/libgit2/src/libgit2/tag.c +1 -1
  268. data/vendor/libgit2/src/libgit2/trailer.c +6 -6
  269. data/vendor/libgit2/src/libgit2/transaction.c +26 -20
  270. data/vendor/libgit2/src/libgit2/transaction.h +4 -1
  271. data/vendor/libgit2/src/libgit2/transport.c +4 -1
  272. data/vendor/libgit2/src/libgit2/transports/credential.c +1 -1
  273. data/vendor/libgit2/src/libgit2/transports/http.c +1 -2
  274. data/vendor/libgit2/src/libgit2/transports/http.h +0 -10
  275. data/vendor/libgit2/src/libgit2/transports/httpclient.c +112 -72
  276. data/vendor/libgit2/src/libgit2/transports/httpparser.c +128 -0
  277. data/vendor/libgit2/src/libgit2/transports/httpparser.h +99 -0
  278. data/vendor/libgit2/src/libgit2/transports/local.c +8 -7
  279. data/vendor/libgit2/src/libgit2/transports/smart.c +20 -8
  280. data/vendor/libgit2/src/libgit2/transports/smart.h +4 -2
  281. data/vendor/libgit2/src/libgit2/transports/smart_pkt.c +2 -2
  282. data/vendor/libgit2/src/libgit2/transports/smart_protocol.c +55 -10
  283. data/vendor/libgit2/src/libgit2/transports/ssh.c +41 -1103
  284. data/vendor/libgit2/src/libgit2/transports/ssh_exec.c +347 -0
  285. data/vendor/libgit2/src/libgit2/transports/ssh_exec.h +26 -0
  286. data/vendor/libgit2/src/libgit2/transports/ssh_libssh2.c +1126 -0
  287. data/vendor/libgit2/src/libgit2/transports/ssh_libssh2.h +28 -0
  288. data/vendor/libgit2/src/libgit2/transports/winhttp.c +35 -7
  289. data/vendor/libgit2/src/libgit2/tree.c +34 -26
  290. data/vendor/libgit2/src/libgit2/tree.h +3 -2
  291. data/vendor/libgit2/src/libgit2/worktree.c +14 -17
  292. data/vendor/libgit2/src/util/CMakeLists.txt +4 -6
  293. data/vendor/libgit2/src/util/alloc.c +4 -1
  294. data/vendor/libgit2/src/util/allocators/debugalloc.c +73 -0
  295. data/vendor/libgit2/src/{cli/cli.h → util/allocators/debugalloc.h} +6 -9
  296. data/vendor/libgit2/src/util/allocators/stdalloc.c +0 -10
  297. data/vendor/libgit2/src/util/array.h +18 -17
  298. data/vendor/libgit2/src/util/cc-compat.h +2 -0
  299. data/vendor/libgit2/src/util/ctype_compat.h +70 -0
  300. data/vendor/libgit2/src/util/date.c +22 -14
  301. data/vendor/libgit2/src/util/date.h +12 -0
  302. data/vendor/libgit2/src/util/errors.c +401 -0
  303. data/vendor/libgit2/src/{libgit2 → util}/errors.h +21 -17
  304. data/vendor/libgit2/src/util/fs_path.c +15 -4
  305. data/vendor/libgit2/src/util/fs_path.h +23 -0
  306. data/vendor/libgit2/src/util/futils.c +6 -5
  307. data/vendor/libgit2/src/util/futils.h +13 -4
  308. data/vendor/libgit2/src/util/git2_features.h.in +12 -1
  309. data/vendor/libgit2/src/util/git2_util.h +6 -0
  310. data/vendor/libgit2/src/util/hash/openssl.c +152 -0
  311. data/vendor/libgit2/src/util/hash/openssl.h +17 -1
  312. data/vendor/libgit2/src/util/hash/sha.h +4 -1
  313. data/vendor/libgit2/src/util/hashmap.h +424 -0
  314. data/vendor/libgit2/src/util/hashmap_str.h +43 -0
  315. data/vendor/libgit2/src/util/integer.h +3 -1
  316. data/vendor/libgit2/src/util/net.c +13 -7
  317. data/vendor/libgit2/src/util/net.h +2 -0
  318. data/vendor/libgit2/src/util/pool.c +1 -1
  319. data/vendor/libgit2/src/util/pool.h +5 -0
  320. data/vendor/libgit2/src/util/pqueue.h +1 -1
  321. data/vendor/libgit2/src/util/process.h +222 -0
  322. data/vendor/libgit2/src/util/rand.c +1 -7
  323. data/vendor/libgit2/src/util/regexp.c +1 -1
  324. data/vendor/libgit2/src/util/sortedcache.c +14 -13
  325. data/vendor/libgit2/src/util/sortedcache.h +3 -3
  326. data/vendor/libgit2/src/util/str.c +2 -2
  327. data/vendor/libgit2/src/util/strlist.c +108 -0
  328. data/vendor/libgit2/src/util/strlist.h +36 -0
  329. data/vendor/libgit2/src/util/unix/posix.h +0 -2
  330. data/vendor/libgit2/src/util/unix/process.c +629 -0
  331. data/vendor/libgit2/src/util/unix/realpath.c +23 -5
  332. data/vendor/libgit2/src/util/util.c +2 -2
  333. data/vendor/libgit2/src/util/util.h +4 -38
  334. data/vendor/libgit2/src/util/vector.c +3 -3
  335. data/vendor/libgit2/src/util/vector.h +2 -2
  336. data/vendor/libgit2/src/util/win32/posix_w32.c +29 -6
  337. data/vendor/libgit2/src/util/win32/process.c +506 -0
  338. metadata +45 -28
  339. data/vendor/libgit2/deps/http-parser/CMakeLists.txt +0 -6
  340. data/vendor/libgit2/deps/http-parser/COPYING +0 -23
  341. data/vendor/libgit2/deps/http-parser/http_parser.c +0 -2182
  342. data/vendor/libgit2/deps/http-parser/http_parser.h +0 -305
  343. data/vendor/libgit2/deps/zlib/COPYING +0 -27
  344. data/vendor/libgit2/include/git2/sys/reflog.h +0 -21
  345. data/vendor/libgit2/src/libgit2/config_entries.c +0 -237
  346. data/vendor/libgit2/src/libgit2/config_entries.h +0 -24
  347. data/vendor/libgit2/src/libgit2/errors.c +0 -293
  348. data/vendor/libgit2/src/libgit2/idxmap.c +0 -157
  349. data/vendor/libgit2/src/libgit2/idxmap.h +0 -177
  350. data/vendor/libgit2/src/libgit2/libgit2.h +0 -15
  351. data/vendor/libgit2/src/libgit2/offmap.c +0 -101
  352. data/vendor/libgit2/src/libgit2/offmap.h +0 -133
  353. data/vendor/libgit2/src/libgit2/oidmap.c +0 -107
  354. data/vendor/libgit2/src/libgit2/oidmap.h +0 -128
  355. data/vendor/libgit2/src/libgit2/threadstate.c +0 -97
  356. data/vendor/libgit2/src/libgit2/threadstate.h +0 -22
  357. data/vendor/libgit2/src/libgit2/transports/ssh.h +0 -14
  358. data/vendor/libgit2/src/util/khash.h +0 -615
  359. data/vendor/libgit2/src/util/strmap.c +0 -100
  360. data/vendor/libgit2/src/util/strmap.h +0 -131
  361. /data/vendor/libgit2/cmake/{FindHTTPParser.cmake → FindHTTP_Parser.cmake} +0 -0
@@ -37,4 +37,6 @@ GIT_INLINE(size_t) reflog_inverse_index(size_t idx, size_t total)
37
37
  return (total - 1) - idx;
38
38
  }
39
39
 
40
+ void git_reflog_entry__free(git_reflog_entry *entry);
41
+
40
42
  #endif
@@ -808,7 +808,7 @@ int git_reference_list(
808
808
 
809
809
  if (git_reference_foreach_name(
810
810
  repo, &cb__reflist_add, (void *)&ref_list) < 0) {
811
- git_vector_free(&ref_list);
811
+ git_vector_dispose(&ref_list);
812
812
  return -1;
813
813
  }
814
814
 
@@ -835,17 +835,20 @@ static int is_valid_ref_char(char ch)
835
835
  }
836
836
  }
837
837
 
838
- static int ensure_segment_validity(const char *name, char may_contain_glob)
838
+ static int ensure_segment_validity(const char *name, char may_contain_glob, bool allow_caret_prefix)
839
839
  {
840
840
  const char *current = name;
841
+ const char *start = current;
841
842
  char prev = '\0';
842
843
  const int lock_len = (int)strlen(GIT_FILELOCK_EXTENSION);
843
844
  int segment_len;
844
845
 
845
846
  if (*current == '.')
846
847
  return -1; /* Refname starts with "." */
848
+ if (allow_caret_prefix && *current == '^')
849
+ start++;
847
850
 
848
- for (current = name; ; current++) {
851
+ for (current = start; ; current++) {
849
852
  if (*current == '\0' || *current == '/')
850
853
  break;
851
854
 
@@ -877,7 +880,7 @@ static int ensure_segment_validity(const char *name, char may_contain_glob)
877
880
  return segment_len;
878
881
  }
879
882
 
880
- static bool is_all_caps_and_underscore(const char *name, size_t len)
883
+ static bool is_valid_normalized_name(const char *name, size_t len)
881
884
  {
882
885
  size_t i;
883
886
  char c;
@@ -888,6 +891,9 @@ static bool is_all_caps_and_underscore(const char *name, size_t len)
888
891
  for (i = 0; i < len; i++)
889
892
  {
890
893
  c = name[i];
894
+ if (i == 0 && c == '^')
895
+ continue; /* The first character is allowed to be "^" for negative refspecs */
896
+
891
897
  if ((c < 'A' || c > 'Z') && c != '_')
892
898
  return false;
893
899
  }
@@ -908,6 +914,7 @@ int git_reference__normalize_name(
908
914
  int segment_len, segments_count = 0, error = GIT_EINVALIDSPEC;
909
915
  unsigned int process_flags;
910
916
  bool normalize = (buf != NULL);
917
+ bool allow_caret_prefix = true;
911
918
  bool validate = (flags & GIT_REFERENCE_FORMAT__VALIDATION_DISABLE) == 0;
912
919
 
913
920
  #ifdef GIT_USE_ICONV
@@ -945,7 +952,7 @@ int git_reference__normalize_name(
945
952
  while (true) {
946
953
  char may_contain_glob = process_flags & GIT_REFERENCE_FORMAT_REFSPEC_PATTERN;
947
954
 
948
- segment_len = ensure_segment_validity(current, may_contain_glob);
955
+ segment_len = ensure_segment_validity(current, may_contain_glob, allow_caret_prefix);
949
956
  if (segment_len < 0)
950
957
  goto cleanup;
951
958
 
@@ -981,6 +988,12 @@ int git_reference__normalize_name(
981
988
  break;
982
989
 
983
990
  current += segment_len + 1;
991
+
992
+ /*
993
+ * A caret prefix is only allowed in the first segment to signify a
994
+ * negative refspec.
995
+ */
996
+ allow_caret_prefix = false;
984
997
  }
985
998
 
986
999
  /* A refname can not be empty */
@@ -1000,12 +1013,12 @@ int git_reference__normalize_name(
1000
1013
 
1001
1014
  if ((segments_count == 1 ) &&
1002
1015
  !(flags & GIT_REFERENCE_FORMAT_REFSPEC_SHORTHAND) &&
1003
- !(is_all_caps_and_underscore(name, (size_t)segment_len) ||
1016
+ !(is_valid_normalized_name(name, (size_t)segment_len) ||
1004
1017
  ((flags & GIT_REFERENCE_FORMAT_REFSPEC_PATTERN) && !strcmp("*", name))))
1005
1018
  goto cleanup;
1006
1019
 
1007
1020
  if ((segments_count > 1)
1008
- && (is_all_caps_and_underscore(name, strchr(name, '/') - name)))
1021
+ && (is_valid_normalized_name(name, strchr(name, '/') - name)))
1009
1022
  goto cleanup;
1010
1023
 
1011
1024
  error = 0;
@@ -1080,6 +1093,12 @@ int git_reference_cmp(
1080
1093
  return git_oid__cmp(&ref1->target.oid, &ref2->target.oid);
1081
1094
  }
1082
1095
 
1096
+ int git_reference__cmp_cb(const void *a, const void *b)
1097
+ {
1098
+ return git_reference_cmp(
1099
+ (const git_reference *)a, (const git_reference *)b);
1100
+ }
1101
+
1083
1102
  /*
1084
1103
  * Starting with the reference given by `ref_name`, follows symbolic
1085
1104
  * references until a direct reference is found and updated the OID
@@ -12,7 +12,6 @@
12
12
  #include "git2/oid.h"
13
13
  #include "git2/refs.h"
14
14
  #include "git2/refdb.h"
15
- #include "strmap.h"
16
15
  #include "str.h"
17
16
  #include "oid.h"
18
17
 
@@ -92,6 +91,12 @@ int git_reference__is_tag(const char *ref_name);
92
91
  int git_reference__is_note(const char *ref_name);
93
92
  const char *git_reference__shorthand(const char *name);
94
93
 
94
+ /*
95
+ * A `git_reference_cmp` wrapper suitable for passing to generic
96
+ * comparators, like `vector_cmp` / `tsort` / etc.
97
+ */
98
+ int git_reference__cmp_cb(const void *a, const void *b);
99
+
95
100
  /**
96
101
  * Lookup a reference by name and try to resolve to an OID.
97
102
  *
@@ -22,6 +22,7 @@ int git_refspec__parse(git_refspec *refspec, const char *input, bool is_fetch)
22
22
  const char *lhs, *rhs;
23
23
  int valid = 0;
24
24
  unsigned int flags;
25
+ bool is_neg_refspec = false;
25
26
 
26
27
  GIT_ASSERT_ARG(refspec);
27
28
  GIT_ASSERT_ARG(input);
@@ -34,6 +35,9 @@ int git_refspec__parse(git_refspec *refspec, const char *input, bool is_fetch)
34
35
  refspec->force = 1;
35
36
  lhs++;
36
37
  }
38
+ if (*lhs == '^') {
39
+ is_neg_refspec = true;
40
+ }
37
41
 
38
42
  rhs = strrchr(lhs, ':');
39
43
 
@@ -62,7 +66,14 @@ int git_refspec__parse(git_refspec *refspec, const char *input, bool is_fetch)
62
66
 
63
67
  llen = (rhs ? (size_t)(rhs - lhs - 1) : strlen(lhs));
64
68
  if (1 <= llen && memchr(lhs, '*', llen)) {
65
- if ((rhs && !is_glob) || (!rhs && is_fetch))
69
+ /*
70
+ * If the lefthand side contains a glob, then one of the following must be
71
+ * true, otherwise the spec is invalid
72
+ * 1) the rhs exists and also contains a glob
73
+ * 2) it is a negative refspec (i.e. no rhs)
74
+ * 3) the rhs doesn't exist and we're fetching
75
+ */
76
+ if ((rhs && !is_glob) || (rhs && is_neg_refspec) || (!rhs && is_fetch && !is_neg_refspec))
66
77
  goto invalid;
67
78
  is_glob = 1;
68
79
  } else if (rhs && is_glob)
@@ -225,6 +236,14 @@ int git_refspec_force(const git_refspec *refspec)
225
236
  return refspec->force;
226
237
  }
227
238
 
239
+ int git_refspec_src_matches_negative(const git_refspec *refspec, const char *refname)
240
+ {
241
+ if (refspec == NULL || refspec->src == NULL || !git_refspec_is_negative(refspec))
242
+ return false;
243
+
244
+ return (wildmatch(refspec->src + 1, refname, 0) == 0);
245
+ }
246
+
228
247
  int git_refspec_src_matches(const git_refspec *refspec, const char *refname)
229
248
  {
230
249
  if (refspec == NULL || refspec->src == NULL)
@@ -340,6 +359,14 @@ int git_refspec_is_wildcard(const git_refspec *spec)
340
359
  return (spec->src[strlen(spec->src) - 1] == '*');
341
360
  }
342
361
 
362
+ int git_refspec_is_negative(const git_refspec *spec)
363
+ {
364
+ GIT_ASSERT_ARG(spec);
365
+ GIT_ASSERT_ARG(spec->src);
366
+
367
+ return (spec->src[0] == '^' && spec->dst == NULL);
368
+ }
369
+
343
370
  git_direction git_refspec_direction(const git_refspec *spec)
344
371
  {
345
372
  GIT_ASSERT_ARG(spec);
@@ -45,6 +45,14 @@ int git_refspec__serialize(git_str *out, const git_refspec *refspec);
45
45
  */
46
46
  int git_refspec_is_wildcard(const git_refspec *spec);
47
47
 
48
+ /**
49
+ * Determines if a refspec is a negative refspec.
50
+ *
51
+ * @param spec the refspec
52
+ * @return 1 if the refspec is a negative, 0 otherwise
53
+ */
54
+ int git_refspec_is_negative(const git_refspec *spec);
55
+
48
56
  /**
49
57
  * DWIM `spec` with `refs` existing on the remote, append the dwim'ed
50
58
  * result in `out`.
@@ -1293,9 +1293,9 @@ static int git_remote__download(
1293
1293
  free_refspecs(&remote->active_refspecs);
1294
1294
  error = dwim_refspecs(&remote->active_refspecs, to_active, &refs);
1295
1295
 
1296
- git_vector_free(&refs);
1296
+ git_vector_dispose(&refs);
1297
1297
  free_refspecs(&specs);
1298
- git_vector_free(&specs);
1298
+ git_vector_dispose(&specs);
1299
1299
 
1300
1300
  if (error < 0)
1301
1301
  goto on_error;
@@ -1311,9 +1311,9 @@ static int git_remote__download(
1311
1311
  error = git_fetch_download_pack(remote);
1312
1312
 
1313
1313
  on_error:
1314
- git_vector_free(&refs);
1314
+ git_vector_dispose(&refs);
1315
1315
  free_refspecs(&specs);
1316
- git_vector_free(&specs);
1316
+ git_vector_dispose(&specs);
1317
1317
  return error;
1318
1318
  }
1319
1319
 
@@ -1339,7 +1339,11 @@ int git_remote_download(
1339
1339
  if ((error = connect_or_reset_options(remote, GIT_DIRECTION_FETCH, &connect_opts)) < 0)
1340
1340
  return error;
1341
1341
 
1342
- return git_remote__download(remote, refspecs, opts);
1342
+ error = git_remote__download(remote, refspecs, opts);
1343
+
1344
+ git_remote_connect_options_dispose(&connect_opts);
1345
+
1346
+ return error;
1343
1347
  }
1344
1348
 
1345
1349
  int git_remote_fetch(
@@ -1348,13 +1352,14 @@ int git_remote_fetch(
1348
1352
  const git_fetch_options *opts,
1349
1353
  const char *reflog_message)
1350
1354
  {
1351
- int error, update_fetchhead = 1;
1352
1355
  git_remote_autotag_option_t tagopt = remote->download_tags;
1353
1356
  bool prune = false;
1354
1357
  git_str reflog_msg_buf = GIT_STR_INIT;
1355
1358
  git_remote_connect_options connect_opts = GIT_REMOTE_CONNECT_OPTIONS_INIT;
1356
1359
  unsigned int capabilities;
1357
1360
  git_oid_t oid_type;
1361
+ unsigned int update_flags = GIT_REMOTE_UPDATE_FETCHHEAD;
1362
+ int error;
1358
1363
 
1359
1364
  GIT_ASSERT_ARG(remote);
1360
1365
 
@@ -1371,7 +1376,7 @@ int git_remote_fetch(
1371
1376
  return error;
1372
1377
 
1373
1378
  if (opts) {
1374
- update_fetchhead = opts->update_fetchhead;
1379
+ update_flags = opts->update_fetchhead;
1375
1380
  tagopt = opts->download_tags;
1376
1381
  }
1377
1382
 
@@ -1398,8 +1403,14 @@ int git_remote_fetch(
1398
1403
  }
1399
1404
 
1400
1405
  /* Create "remote/foo" branches for all remote branches */
1401
- error = git_remote_update_tips(remote, &connect_opts.callbacks, update_fetchhead, tagopt, git_str_cstr(&reflog_msg_buf));
1406
+ error = git_remote_update_tips(remote,
1407
+ &connect_opts.callbacks,
1408
+ update_flags,
1409
+ tagopt,
1410
+ git_str_cstr(&reflog_msg_buf));
1411
+
1402
1412
  git_str_dispose(&reflog_msg_buf);
1413
+
1403
1414
  if (error < 0)
1404
1415
  goto done;
1405
1416
 
@@ -1578,7 +1589,7 @@ cleanup:
1578
1589
  for (i = 0; i < fetchhead_refs.length; ++i)
1579
1590
  git_fetchhead_ref_free(fetchhead_refs.contents[i]);
1580
1591
 
1581
- git_vector_free(&fetchhead_refs);
1592
+ git_vector_dispose(&fetchhead_refs);
1582
1593
  git_reference_free(head_ref);
1583
1594
 
1584
1595
  return error;
@@ -1713,19 +1724,28 @@ int git_remote_prune(git_remote *remote, const git_remote_callbacks *callbacks)
1713
1724
  git_oid_cpy(&id, git_reference_target(ref));
1714
1725
  error = git_reference_delete(ref);
1715
1726
  git_reference_free(ref);
1727
+
1716
1728
  if (error < 0)
1717
1729
  goto cleanup;
1718
1730
 
1719
- if (callbacks && callbacks->update_tips)
1720
- error = callbacks->update_tips(refname, &id, &zero_id, callbacks->payload);
1731
+ if (callbacks && callbacks->update_refs)
1732
+ error = callbacks->update_refs(refname, &id,
1733
+ &zero_id, NULL, callbacks->payload);
1734
+ #ifndef GIT_DEPRECATE_HARD
1735
+ else if (callbacks && callbacks->update_tips)
1736
+ error = callbacks->update_tips(refname, &id,
1737
+ &zero_id, callbacks->payload);
1738
+ #endif
1721
1739
 
1722
- if (error < 0)
1740
+ if (error < 0) {
1741
+ git_error_set_after_callback_function(error, "git_remote_fetch");
1723
1742
  goto cleanup;
1743
+ }
1724
1744
  }
1725
1745
 
1726
1746
  cleanup:
1727
- git_vector_free(&remote_refs);
1728
- git_vector_free_deep(&candidates);
1747
+ git_vector_dispose(&remote_refs);
1748
+ git_vector_dispose_deep(&candidates);
1729
1749
  return error;
1730
1750
  }
1731
1751
 
@@ -1733,6 +1753,7 @@ static int update_ref(
1733
1753
  const git_remote *remote,
1734
1754
  const char *ref_name,
1735
1755
  git_oid *id,
1756
+ git_refspec *spec,
1736
1757
  const char *msg,
1737
1758
  const git_remote_callbacks *callbacks)
1738
1759
  {
@@ -1761,9 +1782,19 @@ static int update_ref(
1761
1782
  if (error < 0)
1762
1783
  return error;
1763
1784
 
1764
- if (callbacks && callbacks->update_tips &&
1765
- (error = callbacks->update_tips(ref_name, &old_id, id, callbacks->payload)) < 0)
1785
+ if (callbacks && callbacks->update_refs)
1786
+ error = callbacks->update_refs(ref_name, &old_id,
1787
+ id, spec, callbacks->payload);
1788
+ #ifndef GIT_DEPRECATE_HARD
1789
+ else if (callbacks && callbacks->update_tips)
1790
+ error = callbacks->update_tips(ref_name, &old_id,
1791
+ id, callbacks->payload);
1792
+ #endif
1793
+
1794
+ if (error < 0) {
1795
+ git_error_set_after_callback_function(error, "git_remote_fetch");
1766
1796
  return error;
1797
+ }
1767
1798
 
1768
1799
  return 0;
1769
1800
  }
@@ -1774,6 +1805,7 @@ static int update_one_tip(
1774
1805
  git_refspec *spec,
1775
1806
  git_remote_head *head,
1776
1807
  git_refspec *tagspec,
1808
+ unsigned int update_flags,
1777
1809
  git_remote_autotag_option_t tagopt,
1778
1810
  const char *log_message,
1779
1811
  const git_remote_callbacks *callbacks)
@@ -1781,7 +1813,7 @@ static int update_one_tip(
1781
1813
  git_odb *odb;
1782
1814
  git_str refname = GIT_STR_INIT;
1783
1815
  git_reference *ref = NULL;
1784
- bool autotag = false;
1816
+ bool autotag = false, updated = false;
1785
1817
  git_oid old;
1786
1818
  int valid;
1787
1819
  int error;
@@ -1855,22 +1887,33 @@ static int update_one_tip(
1855
1887
  goto done;
1856
1888
  }
1857
1889
 
1858
- if (!git_oid__cmp(&old, &head->oid))
1859
- goto done;
1890
+ if ((updated = !git_oid_equal(&old, &head->oid))) {
1891
+ /* In autotag mode, don't overwrite any locally-existing tags */
1892
+ error = git_reference_create(&ref, remote->repo, refname.ptr, &head->oid, !autotag,
1893
+ log_message);
1860
1894
 
1861
- /* In autotag mode, don't overwrite any locally-existing tags */
1862
- error = git_reference_create(&ref, remote->repo, refname.ptr, &head->oid, !autotag,
1863
- log_message);
1895
+ if (error < 0) {
1896
+ if (error == GIT_EEXISTS)
1897
+ error = 0;
1864
1898
 
1865
- if (error < 0) {
1866
- if (error == GIT_EEXISTS)
1867
- error = 0;
1899
+ goto done;
1900
+ }
1901
+ }
1868
1902
 
1903
+ if (!callbacks ||
1904
+ (!updated && (update_flags & GIT_REMOTE_UPDATE_REPORT_UNCHANGED) == 0))
1869
1905
  goto done;
1870
- }
1871
1906
 
1872
- if (callbacks && callbacks->update_tips != NULL &&
1873
- (error = callbacks->update_tips(refname.ptr, &old, &head->oid, callbacks->payload)) < 0)
1907
+ if (callbacks && callbacks->update_refs)
1908
+ error = callbacks->update_refs(refname.ptr, &old,
1909
+ &head->oid, spec, callbacks->payload);
1910
+ #ifndef GIT_DEPRECATE_HARD
1911
+ else if (callbacks && callbacks->update_tips)
1912
+ error = callbacks->update_tips(refname.ptr, &old,
1913
+ &head->oid, callbacks->payload);
1914
+ #endif
1915
+
1916
+ if (error < 0)
1874
1917
  git_error_set_after_callback_function(error, "git_remote_fetch");
1875
1918
 
1876
1919
  done:
@@ -1882,7 +1925,7 @@ done:
1882
1925
  static int update_tips_for_spec(
1883
1926
  git_remote *remote,
1884
1927
  const git_remote_callbacks *callbacks,
1885
- int update_fetchhead,
1928
+ unsigned int update_flags,
1886
1929
  git_remote_autotag_option_t tagopt,
1887
1930
  git_refspec *spec,
1888
1931
  git_vector *refs,
@@ -1905,7 +1948,10 @@ static int update_tips_for_spec(
1905
1948
 
1906
1949
  /* Update tips based on the remote heads */
1907
1950
  git_vector_foreach(refs, i, head) {
1908
- if (update_one_tip(&update_heads, remote, spec, head, &tagspec, tagopt, log_message, callbacks) < 0)
1951
+ if (update_one_tip(&update_heads,
1952
+ remote, spec, head, &tagspec,
1953
+ update_flags, tagopt, log_message,
1954
+ callbacks) < 0)
1909
1955
  goto on_error;
1910
1956
  }
1911
1957
 
@@ -1917,7 +1963,7 @@ static int update_tips_for_spec(
1917
1963
  goto on_error;
1918
1964
 
1919
1965
  if (spec->dst &&
1920
- (error = update_ref(remote, spec->dst, &id, log_message, callbacks)) < 0)
1966
+ (error = update_ref(remote, spec->dst, &id, spec, log_message, callbacks)) < 0)
1921
1967
  goto on_error;
1922
1968
 
1923
1969
  git_oid_cpy(&oid_head.oid, &id);
@@ -1927,17 +1973,17 @@ static int update_tips_for_spec(
1927
1973
  goto on_error;
1928
1974
  }
1929
1975
 
1930
- if (update_fetchhead &&
1976
+ if ((update_flags & GIT_REMOTE_UPDATE_FETCHHEAD) &&
1931
1977
  (error = git_remote_write_fetchhead(remote, spec, &update_heads)) < 0)
1932
1978
  goto on_error;
1933
1979
 
1934
1980
  git_refspec__dispose(&tagspec);
1935
- git_vector_free(&update_heads);
1981
+ git_vector_dispose(&update_heads);
1936
1982
  return 0;
1937
1983
 
1938
1984
  on_error:
1939
1985
  git_refspec__dispose(&tagspec);
1940
- git_vector_free(&update_heads);
1986
+ git_vector_dispose(&update_heads);
1941
1987
  return -1;
1942
1988
 
1943
1989
  }
@@ -2029,7 +2075,7 @@ static int opportunistic_updates(
2029
2075
 
2030
2076
  git_str_clear(&refname);
2031
2077
  if ((error = git_refspec__transform(&refname, spec, head->name)) < 0 ||
2032
- (error = update_ref(remote, refname.ptr, &head->oid, msg, callbacks)) < 0)
2078
+ (error = update_ref(remote, refname.ptr, &head->oid, spec, msg, callbacks)) < 0)
2033
2079
  goto cleanup;
2034
2080
  }
2035
2081
 
@@ -2058,11 +2104,11 @@ static int truncate_fetch_head(const char *gitdir)
2058
2104
  }
2059
2105
 
2060
2106
  int git_remote_update_tips(
2061
- git_remote *remote,
2062
- const git_remote_callbacks *callbacks,
2063
- int update_fetchhead,
2064
- git_remote_autotag_option_t download_tags,
2065
- const char *reflog_message)
2107
+ git_remote *remote,
2108
+ const git_remote_callbacks *callbacks,
2109
+ unsigned int update_flags,
2110
+ git_remote_autotag_option_t download_tags,
2111
+ const char *reflog_message)
2066
2112
  {
2067
2113
  git_refspec *spec, tagspec;
2068
2114
  git_vector refs = GIT_VECTOR_INIT;
@@ -2091,7 +2137,7 @@ int git_remote_update_tips(
2091
2137
  goto out;
2092
2138
 
2093
2139
  if (tagopt == GIT_REMOTE_DOWNLOAD_TAGS_ALL) {
2094
- if ((error = update_tips_for_spec(remote, callbacks, update_fetchhead, tagopt, &tagspec, &refs, reflog_message)) < 0)
2140
+ if ((error = update_tips_for_spec(remote, callbacks, update_flags, tagopt, &tagspec, &refs, reflog_message)) < 0)
2095
2141
  goto out;
2096
2142
  }
2097
2143
 
@@ -2099,7 +2145,7 @@ int git_remote_update_tips(
2099
2145
  if (spec->push)
2100
2146
  continue;
2101
2147
 
2102
- if ((error = update_tips_for_spec(remote, callbacks, update_fetchhead, tagopt, spec, &refs, reflog_message)) < 0)
2148
+ if ((error = update_tips_for_spec(remote, callbacks, update_flags, tagopt, spec, &refs, reflog_message)) < 0)
2103
2149
  goto out;
2104
2150
  }
2105
2151
 
@@ -2108,7 +2154,7 @@ int git_remote_update_tips(
2108
2154
  error = opportunistic_updates(remote, callbacks, &refs, reflog_message);
2109
2155
 
2110
2156
  out:
2111
- git_vector_free(&refs);
2157
+ git_vector_dispose(&refs);
2112
2158
  git_refspec__dispose(&tagspec);
2113
2159
  return error;
2114
2160
  }
@@ -2167,19 +2213,19 @@ void git_remote_free(git_remote *remote)
2167
2213
  remote->transport = NULL;
2168
2214
  }
2169
2215
 
2170
- git_vector_free(&remote->refs);
2216
+ git_vector_dispose(&remote->refs);
2171
2217
 
2172
2218
  free_refspecs(&remote->refspecs);
2173
- git_vector_free(&remote->refspecs);
2219
+ git_vector_dispose(&remote->refspecs);
2174
2220
 
2175
2221
  free_refspecs(&remote->active_refspecs);
2176
- git_vector_free(&remote->active_refspecs);
2222
+ git_vector_dispose(&remote->active_refspecs);
2177
2223
 
2178
2224
  free_refspecs(&remote->passive_refspecs);
2179
- git_vector_free(&remote->passive_refspecs);
2225
+ git_vector_dispose(&remote->passive_refspecs);
2180
2226
 
2181
2227
  free_heads(&remote->local_heads);
2182
- git_vector_free(&remote->local_heads);
2228
+ git_vector_dispose(&remote->local_heads);
2183
2229
 
2184
2230
  git_push_free(remote->push);
2185
2231
  git__free(remote->url);
@@ -2222,7 +2268,7 @@ int git_remote_list(git_strarray *remotes_list, git_repository *repo)
2222
2268
  cfg, "^remote\\..*\\.(push)?url$", remote_list_cb, &list);
2223
2269
 
2224
2270
  if (error < 0) {
2225
- git_vector_free_deep(&list);
2271
+ git_vector_dispose_deep(&list);
2226
2272
  return error;
2227
2273
  }
2228
2274
 
@@ -2503,7 +2549,7 @@ static int rename_fetch_refspecs(git_vector *problems, git_remote *remote, const
2503
2549
  git_vector_foreach(problems, i, str)
2504
2550
  git__free(str);
2505
2551
 
2506
- git_vector_free(problems);
2552
+ git_vector_dispose(problems);
2507
2553
  }
2508
2554
 
2509
2555
  return error;
@@ -2543,7 +2589,7 @@ int git_remote_rename(git_strarray *out, git_repository *repo, const char *name,
2543
2589
 
2544
2590
  cleanup:
2545
2591
  if (error < 0)
2546
- git_vector_free(&problem_refspecs);
2592
+ git_vector_dispose(&problem_refspecs);
2547
2593
 
2548
2594
  git_remote_free(remote);
2549
2595
  return error;
@@ -2582,17 +2628,21 @@ done:
2582
2628
  git_refspec *git_remote__matching_refspec(git_remote *remote, const char *refname)
2583
2629
  {
2584
2630
  git_refspec *spec;
2631
+ git_refspec *match = NULL;
2585
2632
  size_t i;
2586
2633
 
2587
2634
  git_vector_foreach(&remote->active_refspecs, i, spec) {
2588
2635
  if (spec->push)
2589
2636
  continue;
2590
2637
 
2591
- if (git_refspec_src_matches(spec, refname))
2592
- return spec;
2638
+ if (git_refspec_src_matches_negative(spec, refname))
2639
+ return NULL;
2640
+
2641
+ if (git_refspec_src_matches(spec, refname) && match == NULL)
2642
+ match = spec;
2593
2643
  }
2594
2644
 
2595
- return NULL;
2645
+ return match;
2596
2646
  }
2597
2647
 
2598
2648
  git_refspec *git_remote__matching_dst_refspec(git_remote *remote, const char *refname)
@@ -2650,7 +2700,7 @@ static int copy_refspecs(git_strarray *array, const git_remote *remote, unsigned
2650
2700
  return 0;
2651
2701
 
2652
2702
  on_error:
2653
- git_vector_free_deep(&refspecs);
2703
+ git_vector_dispose_deep(&refspecs);
2654
2704
 
2655
2705
  return -1;
2656
2706
  }
@@ -2798,7 +2848,7 @@ cleanup:
2798
2848
  git_vector_foreach(&refs, i, dup) {
2799
2849
  git__free(dup);
2800
2850
  }
2801
- git_vector_free(&refs);
2851
+ git_vector_dispose(&refs);
2802
2852
  return error;
2803
2853
  }
2804
2854
 
@@ -2967,12 +3017,22 @@ int git_remote_upload(
2967
3017
  }
2968
3018
  }
2969
3019
 
2970
- if ((error = git_push_finish(push)) < 0)
2971
- goto cleanup;
3020
+ if (opts && opts->remote_push_options.count > 0)
3021
+ for (i = 0; i < opts->remote_push_options.count; ++i) {
3022
+ char *optstr = git__strdup(opts->remote_push_options.strings[i]);
3023
+ GIT_ERROR_CHECK_ALLOC(optstr);
2972
3024
 
2973
- if (connect_opts.callbacks.push_update_reference &&
2974
- (error = git_push_status_foreach(push, connect_opts.callbacks.push_update_reference, connect_opts.callbacks.payload)) < 0)
2975
- goto cleanup;
3025
+ if ((error = git_vector_insert(&push->remote_push_options, optstr)) < 0)
3026
+ goto cleanup;
3027
+ }
3028
+
3029
+ error = git_push_finish(push);
3030
+
3031
+ if (connect_opts.callbacks.push_update_reference) {
3032
+ const int cb_error = git_push_status_foreach(push, connect_opts.callbacks.push_update_reference, connect_opts.callbacks.payload);
3033
+ if (!error)
3034
+ error = cb_error;
3035
+ }
2976
3036
 
2977
3037
  cleanup:
2978
3038
  git_remote_connect_options_dispose(&connect_opts);