rugged 1.0.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (338) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +1 -0
  3. data/README.md +3 -3
  4. data/ext/rugged/rugged.c +7 -4
  5. data/ext/rugged/rugged_commit.c +1 -1
  6. data/ext/rugged/rugged_config.c +1 -1
  7. data/ext/rugged/rugged_object.c +1 -1
  8. data/ext/rugged/rugged_remote.c +32 -2
  9. data/ext/rugged/rugged_repo.c +13 -3
  10. data/lib/rugged/commit.rb +17 -4
  11. data/lib/rugged/repository.rb +7 -8
  12. data/lib/rugged/submodule_collection.rb +4 -4
  13. data/lib/rugged/version.rb +1 -1
  14. data/vendor/libgit2/CMakeLists.txt +41 -74
  15. data/vendor/libgit2/COPYING +109 -1
  16. data/vendor/libgit2/cmake/{Modules/AddCFlagIfSupported.cmake → AddCFlagIfSupported.cmake} +0 -0
  17. data/vendor/libgit2/cmake/{Modules/EnableWarnings.cmake → EnableWarnings.cmake} +0 -0
  18. data/vendor/libgit2/cmake/{Modules/FindCoreFoundation.cmake → FindCoreFoundation.cmake} +0 -0
  19. data/vendor/libgit2/cmake/{Modules/FindGSSAPI.cmake → FindGSSAPI.cmake} +0 -0
  20. data/vendor/libgit2/cmake/{Modules/FindGSSFramework.cmake → FindGSSFramework.cmake} +0 -0
  21. data/vendor/libgit2/cmake/{Modules/FindHTTP_Parser.cmake → FindHTTP_Parser.cmake} +0 -0
  22. data/vendor/libgit2/cmake/{Modules/FindIconv.cmake → FindIconv.cmake} +0 -0
  23. data/vendor/libgit2/cmake/{Modules/FindPCRE.cmake → FindPCRE.cmake} +0 -0
  24. data/vendor/libgit2/cmake/{Modules/FindPCRE2.cmake → FindPCRE2.cmake} +0 -0
  25. data/vendor/libgit2/cmake/{Modules/FindPkgLibraries.cmake → FindPkgLibraries.cmake} +0 -0
  26. data/vendor/libgit2/cmake/{Modules/FindSecurity.cmake → FindSecurity.cmake} +0 -0
  27. data/vendor/libgit2/cmake/{Modules/FindStatNsec.cmake → FindStatNsec.cmake} +0 -0
  28. data/vendor/libgit2/cmake/Findfutimens.cmake +14 -0
  29. data/vendor/libgit2/cmake/{Modules/FindmbedTLS.cmake → FindmbedTLS.cmake} +0 -0
  30. data/vendor/libgit2/cmake/{Modules/IdeSplitSources.cmake → IdeSplitSources.cmake} +0 -0
  31. data/vendor/libgit2/cmake/{Modules/PkgBuildConfig.cmake → PkgBuildConfig.cmake} +0 -0
  32. data/vendor/libgit2/cmake/{Modules/SanitizeBool.cmake → SanitizeBool.cmake} +0 -0
  33. data/vendor/libgit2/cmake/{Modules/SelectGSSAPI.cmake → SelectGSSAPI.cmake} +18 -26
  34. data/vendor/libgit2/cmake/{Modules/SelectHTTPSBackend.cmake → SelectHTTPSBackend.cmake} +29 -32
  35. data/vendor/libgit2/cmake/{Modules/SelectHashes.cmake → SelectHashes.cmake} +21 -28
  36. data/vendor/libgit2/deps/chromium-zlib/CMakeLists.txt +101 -0
  37. data/vendor/libgit2/deps/http-parser/CMakeLists.txt +4 -3
  38. data/vendor/libgit2/deps/ntlmclient/CMakeLists.txt +24 -10
  39. data/vendor/libgit2/deps/ntlmclient/compat.h +0 -27
  40. data/vendor/libgit2/deps/ntlmclient/crypt.h +14 -9
  41. data/vendor/libgit2/deps/ntlmclient/crypt_commoncrypto.c +20 -20
  42. data/vendor/libgit2/deps/ntlmclient/crypt_commoncrypto.h +3 -3
  43. data/vendor/libgit2/deps/ntlmclient/crypt_mbedtls.c +37 -36
  44. data/vendor/libgit2/deps/ntlmclient/crypt_mbedtls.h +4 -3
  45. data/vendor/libgit2/deps/ntlmclient/crypt_openssl.c +178 -51
  46. data/vendor/libgit2/deps/ntlmclient/crypt_openssl.h +74 -5
  47. data/vendor/libgit2/deps/ntlmclient/ntlm.c +164 -135
  48. data/vendor/libgit2/deps/ntlmclient/ntlm.h +13 -9
  49. data/vendor/libgit2/deps/ntlmclient/ntlmclient.h +16 -3
  50. data/vendor/libgit2/deps/ntlmclient/unicode.h +10 -4
  51. data/vendor/libgit2/deps/ntlmclient/unicode_builtin.c +16 -27
  52. data/vendor/libgit2/deps/ntlmclient/unicode_builtin.h +20 -0
  53. data/vendor/libgit2/deps/ntlmclient/unicode_iconv.c +28 -52
  54. data/vendor/libgit2/deps/ntlmclient/unicode_iconv.h +22 -0
  55. data/vendor/libgit2/deps/ntlmclient/util.c +15 -1
  56. data/vendor/libgit2/deps/ntlmclient/util.h +2 -1
  57. data/vendor/libgit2/deps/pcre/LICENCE +93 -0
  58. data/vendor/libgit2/deps/pcre/pcre.h +2 -2
  59. data/vendor/libgit2/deps/pcre/pcre_compile.c +29 -17
  60. data/vendor/libgit2/deps/pcre/pcre_jit_compile.c +4 -4
  61. data/vendor/libgit2/deps/pcre/pcreposix.c +2 -3
  62. data/vendor/libgit2/deps/zlib/CMakeLists.txt +6 -5
  63. data/vendor/libgit2/deps/zlib/deflate.c +1 -0
  64. data/vendor/libgit2/include/git2/annotated_commit.h +1 -1
  65. data/vendor/libgit2/include/git2/apply.h +2 -0
  66. data/vendor/libgit2/include/git2/attr.h +89 -0
  67. data/vendor/libgit2/include/git2/blame.h +95 -42
  68. data/vendor/libgit2/include/git2/blob.h +31 -3
  69. data/vendor/libgit2/include/git2/branch.h +25 -0
  70. data/vendor/libgit2/include/git2/cert.h +42 -5
  71. data/vendor/libgit2/include/git2/checkout.h +28 -12
  72. data/vendor/libgit2/include/git2/commit.h +35 -19
  73. data/vendor/libgit2/include/git2/common.h +33 -6
  74. data/vendor/libgit2/include/git2/config.h +1 -1
  75. data/vendor/libgit2/include/git2/deprecated.h +248 -8
  76. data/vendor/libgit2/include/git2/diff.h +35 -20
  77. data/vendor/libgit2/include/git2/errors.h +8 -7
  78. data/vendor/libgit2/include/git2/filter.h +57 -17
  79. data/vendor/libgit2/include/git2/graph.h +20 -2
  80. data/vendor/libgit2/include/git2/index.h +4 -5
  81. data/vendor/libgit2/include/git2/indexer.h +2 -1
  82. data/vendor/libgit2/include/git2/odb.h +44 -20
  83. data/vendor/libgit2/include/git2/pack.h +1 -1
  84. data/vendor/libgit2/include/git2/patch.h +8 -0
  85. data/vendor/libgit2/include/git2/rebase.h +25 -1
  86. data/vendor/libgit2/include/git2/refs.h +9 -5
  87. data/vendor/libgit2/include/git2/remote.h +59 -6
  88. data/vendor/libgit2/include/git2/repository.h +95 -52
  89. data/vendor/libgit2/include/git2/revparse.h +5 -5
  90. data/vendor/libgit2/include/git2/status.h +115 -59
  91. data/vendor/libgit2/include/git2/strarray.h +6 -10
  92. data/vendor/libgit2/include/git2/submodule.h +9 -0
  93. data/vendor/libgit2/include/git2/sys/commit_graph.h +174 -0
  94. data/vendor/libgit2/include/git2/sys/filter.h +49 -28
  95. data/vendor/libgit2/include/git2/sys/midx.h +74 -0
  96. data/vendor/libgit2/include/git2/sys/odb_backend.h +7 -0
  97. data/vendor/libgit2/include/git2/sys/transport.h +1 -0
  98. data/vendor/libgit2/include/git2/tag.h +12 -0
  99. data/vendor/libgit2/include/git2/transport.h +1 -1
  100. data/vendor/libgit2/include/git2/tree.h +2 -14
  101. data/vendor/libgit2/include/git2/types.h +9 -0
  102. data/vendor/libgit2/include/git2/version.h +3 -3
  103. data/vendor/libgit2/include/git2/worktree.h +1 -0
  104. data/vendor/libgit2/src/CMakeLists.txt +77 -44
  105. data/vendor/libgit2/src/alloc.c +21 -8
  106. data/vendor/libgit2/src/allocators/failalloc.c +92 -0
  107. data/vendor/libgit2/src/allocators/failalloc.h +23 -0
  108. data/vendor/libgit2/src/allocators/stdalloc.c +41 -10
  109. data/vendor/libgit2/src/allocators/win32_leakcheck.c +118 -0
  110. data/vendor/libgit2/src/allocators/{win32_crtdbg.h → win32_leakcheck.h} +3 -3
  111. data/vendor/libgit2/src/annotated_commit.c +21 -9
  112. data/vendor/libgit2/src/apply.c +21 -8
  113. data/vendor/libgit2/src/array.h +11 -11
  114. data/vendor/libgit2/src/assert_safe.h +58 -0
  115. data/vendor/libgit2/src/attr.c +181 -74
  116. data/vendor/libgit2/src/attr_file.c +92 -42
  117. data/vendor/libgit2/src/attr_file.h +32 -11
  118. data/vendor/libgit2/src/attrcache.c +44 -40
  119. data/vendor/libgit2/src/attrcache.h +4 -5
  120. data/vendor/libgit2/src/blame.c +28 -15
  121. data/vendor/libgit2/src/blame_git.c +6 -3
  122. data/vendor/libgit2/src/blob.c +46 -24
  123. data/vendor/libgit2/src/branch.c +87 -37
  124. data/vendor/libgit2/src/buffer.c +339 -27
  125. data/vendor/libgit2/src/buffer.h +153 -2
  126. data/vendor/libgit2/src/cache.c +3 -24
  127. data/vendor/libgit2/src/cache.h +7 -7
  128. data/vendor/libgit2/src/cc-compat.h +10 -2
  129. data/vendor/libgit2/src/checkout.c +97 -98
  130. data/vendor/libgit2/src/cherrypick.c +8 -2
  131. data/vendor/libgit2/src/clone.c +104 -29
  132. data/vendor/libgit2/src/commit.c +41 -28
  133. data/vendor/libgit2/src/commit_graph.c +1209 -0
  134. data/vendor/libgit2/src/commit_graph.h +162 -0
  135. data/vendor/libgit2/src/commit_list.c +46 -0
  136. data/vendor/libgit2/src/commit_list.h +2 -0
  137. data/vendor/libgit2/src/common.h +26 -2
  138. data/vendor/libgit2/src/config.c +40 -22
  139. data/vendor/libgit2/src/config_cache.c +9 -4
  140. data/vendor/libgit2/src/config_entries.c +35 -27
  141. data/vendor/libgit2/src/config_file.c +25 -8
  142. data/vendor/libgit2/src/config_parse.c +5 -7
  143. data/vendor/libgit2/src/config_snapshot.c +2 -1
  144. data/vendor/libgit2/src/crlf.c +16 -6
  145. data/vendor/libgit2/src/date.c +4 -3
  146. data/vendor/libgit2/src/delta.c +1 -1
  147. data/vendor/libgit2/src/describe.c +11 -4
  148. data/vendor/libgit2/src/diff.c +23 -19
  149. data/vendor/libgit2/src/diff_driver.c +21 -17
  150. data/vendor/libgit2/src/diff_file.c +5 -7
  151. data/vendor/libgit2/src/diff_generate.c +56 -28
  152. data/vendor/libgit2/src/diff_parse.c +2 -3
  153. data/vendor/libgit2/src/diff_print.c +81 -65
  154. data/vendor/libgit2/src/diff_stats.c +19 -16
  155. data/vendor/libgit2/src/diff_tform.c +13 -13
  156. data/vendor/libgit2/src/diff_xdiff.c +4 -2
  157. data/vendor/libgit2/src/diff_xdiff.h +1 -1
  158. data/vendor/libgit2/src/errors.c +26 -19
  159. data/vendor/libgit2/src/features.h.in +5 -1
  160. data/vendor/libgit2/src/fetch.c +7 -2
  161. data/vendor/libgit2/src/fetchhead.c +8 -4
  162. data/vendor/libgit2/src/filebuf.c +9 -7
  163. data/vendor/libgit2/src/filter.c +209 -113
  164. data/vendor/libgit2/src/filter.h +24 -5
  165. data/vendor/libgit2/src/futils.c +8 -8
  166. data/vendor/libgit2/src/futils.h +4 -4
  167. data/vendor/libgit2/src/graph.c +64 -9
  168. data/vendor/libgit2/src/hash/sha1/collisiondetect.c +3 -3
  169. data/vendor/libgit2/src/hash/sha1/common_crypto.c +3 -3
  170. data/vendor/libgit2/src/hash/sha1/generic.h +1 -1
  171. data/vendor/libgit2/src/hash/sha1/mbedtls.c +12 -12
  172. data/vendor/libgit2/src/hash/sha1/openssl.c +3 -3
  173. data/vendor/libgit2/src/hash/sha1/sha1dc/sha1.c +0 -2
  174. data/vendor/libgit2/src/hash/sha1/win32.c +15 -11
  175. data/vendor/libgit2/src/hash.c +16 -13
  176. data/vendor/libgit2/src/hash.h +1 -1
  177. data/vendor/libgit2/src/hashsig.c +23 -10
  178. data/vendor/libgit2/src/ident.c +13 -3
  179. data/vendor/libgit2/src/idxmap.c +0 -22
  180. data/vendor/libgit2/src/ignore.c +35 -19
  181. data/vendor/libgit2/src/index.c +126 -84
  182. data/vendor/libgit2/src/index.h +1 -1
  183. data/vendor/libgit2/src/indexer.c +60 -36
  184. data/vendor/libgit2/src/integer.h +79 -2
  185. data/vendor/libgit2/src/iterator.c +40 -28
  186. data/vendor/libgit2/src/iterator.h +1 -1
  187. data/vendor/libgit2/src/khash.h +2 -11
  188. data/vendor/libgit2/src/{settings.c → libgit2.c} +125 -49
  189. data/vendor/libgit2/src/libgit2.h +15 -0
  190. data/vendor/libgit2/src/mailmap.c +23 -10
  191. data/vendor/libgit2/src/map.h +3 -3
  192. data/vendor/libgit2/src/merge.c +108 -46
  193. data/vendor/libgit2/src/merge.h +2 -1
  194. data/vendor/libgit2/src/merge_driver.c +19 -13
  195. data/vendor/libgit2/src/merge_file.c +15 -9
  196. data/vendor/libgit2/src/message.c +3 -1
  197. data/vendor/libgit2/src/midx.c +879 -0
  198. data/vendor/libgit2/src/midx.h +110 -0
  199. data/vendor/libgit2/src/mwindow.c +214 -95
  200. data/vendor/libgit2/src/mwindow.h +3 -3
  201. data/vendor/libgit2/src/net.c +133 -4
  202. data/vendor/libgit2/src/net.h +16 -2
  203. data/vendor/libgit2/src/netops.c +6 -4
  204. data/vendor/libgit2/src/netops.h +2 -2
  205. data/vendor/libgit2/src/notes.c +10 -10
  206. data/vendor/libgit2/src/object.c +24 -15
  207. data/vendor/libgit2/src/odb.c +298 -57
  208. data/vendor/libgit2/src/odb.h +16 -2
  209. data/vendor/libgit2/src/odb_loose.c +31 -21
  210. data/vendor/libgit2/src/odb_mempack.c +3 -1
  211. data/vendor/libgit2/src/odb_pack.c +391 -114
  212. data/vendor/libgit2/src/oid.c +7 -4
  213. data/vendor/libgit2/src/pack-objects.c +83 -69
  214. data/vendor/libgit2/src/pack.c +383 -150
  215. data/vendor/libgit2/src/pack.h +44 -9
  216. data/vendor/libgit2/src/patch.c +14 -7
  217. data/vendor/libgit2/src/patch_generate.c +3 -5
  218. data/vendor/libgit2/src/patch_parse.c +6 -3
  219. data/vendor/libgit2/src/path.c +102 -57
  220. data/vendor/libgit2/src/path.h +79 -6
  221. data/vendor/libgit2/src/pathspec.c +12 -11
  222. data/vendor/libgit2/src/pool.c +34 -22
  223. data/vendor/libgit2/src/pool.h +9 -1
  224. data/vendor/libgit2/src/posix.c +43 -12
  225. data/vendor/libgit2/src/posix.h +9 -0
  226. data/vendor/libgit2/src/proxy.c +2 -0
  227. data/vendor/libgit2/src/push.c +2 -0
  228. data/vendor/libgit2/src/reader.c +10 -6
  229. data/vendor/libgit2/src/rebase.c +95 -49
  230. data/vendor/libgit2/src/refdb.c +165 -13
  231. data/vendor/libgit2/src/refdb.h +69 -0
  232. data/vendor/libgit2/src/refdb_fs.c +144 -152
  233. data/vendor/libgit2/src/reflog.c +21 -20
  234. data/vendor/libgit2/src/refs.c +151 -231
  235. data/vendor/libgit2/src/refs.h +2 -20
  236. data/vendor/libgit2/src/refspec.c +80 -44
  237. data/vendor/libgit2/src/regexp.c +2 -2
  238. data/vendor/libgit2/src/remote.c +312 -121
  239. data/vendor/libgit2/src/remote.h +2 -1
  240. data/vendor/libgit2/src/repository.c +351 -189
  241. data/vendor/libgit2/src/repository.h +23 -29
  242. data/vendor/libgit2/src/reset.c +7 -6
  243. data/vendor/libgit2/src/revert.c +8 -2
  244. data/vendor/libgit2/src/revparse.c +19 -13
  245. data/vendor/libgit2/src/revwalk.c +35 -20
  246. data/vendor/libgit2/src/runtime.c +162 -0
  247. data/vendor/libgit2/src/runtime.h +62 -0
  248. data/vendor/libgit2/src/{refdb_fs.h → settings.h} +3 -11
  249. data/vendor/libgit2/src/signature.c +6 -5
  250. data/vendor/libgit2/src/sortedcache.c +2 -3
  251. data/vendor/libgit2/src/sortedcache.h +10 -8
  252. data/vendor/libgit2/src/stash.c +7 -3
  253. data/vendor/libgit2/src/status.c +9 -4
  254. data/vendor/libgit2/src/strarray.c +64 -0
  255. data/vendor/libgit2/src/streams/mbedtls.c +14 -17
  256. data/vendor/libgit2/src/streams/mbedtls.h +1 -1
  257. data/vendor/libgit2/src/streams/openssl.c +113 -207
  258. data/vendor/libgit2/src/streams/openssl.h +9 -1
  259. data/vendor/libgit2/src/streams/openssl_dynamic.c +309 -0
  260. data/vendor/libgit2/src/streams/openssl_dynamic.h +348 -0
  261. data/vendor/libgit2/src/streams/openssl_legacy.c +203 -0
  262. data/vendor/libgit2/src/streams/openssl_legacy.h +63 -0
  263. data/vendor/libgit2/src/streams/registry.c +10 -9
  264. data/vendor/libgit2/src/streams/socket.c +6 -2
  265. data/vendor/libgit2/src/streams/stransport.c +6 -3
  266. data/vendor/libgit2/src/streams/tls.c +5 -3
  267. data/vendor/libgit2/src/submodule.c +134 -66
  268. data/vendor/libgit2/src/submodule.h +9 -9
  269. data/vendor/libgit2/src/sysdir.c +8 -26
  270. data/vendor/libgit2/src/sysdir.h +0 -11
  271. data/vendor/libgit2/src/tag.c +49 -11
  272. data/vendor/libgit2/src/thread.c +140 -0
  273. data/vendor/libgit2/src/thread.h +479 -0
  274. data/vendor/libgit2/src/threadstate.c +83 -0
  275. data/vendor/libgit2/src/threadstate.h +24 -0
  276. data/vendor/libgit2/src/trace.c +2 -2
  277. data/vendor/libgit2/src/trace.h +17 -13
  278. data/vendor/libgit2/src/transaction.c +21 -9
  279. data/vendor/libgit2/src/transport.c +3 -3
  280. data/vendor/libgit2/src/transports/auth.c +1 -1
  281. data/vendor/libgit2/src/transports/auth_negotiate.c +11 -4
  282. data/vendor/libgit2/src/transports/auth_ntlm.c +10 -6
  283. data/vendor/libgit2/src/transports/credential.c +17 -7
  284. data/vendor/libgit2/src/transports/credential_helpers.c +2 -0
  285. data/vendor/libgit2/src/transports/git.c +1 -3
  286. data/vendor/libgit2/src/transports/http.c +19 -17
  287. data/vendor/libgit2/src/transports/http.h +1 -0
  288. data/vendor/libgit2/src/transports/httpclient.c +84 -42
  289. data/vendor/libgit2/src/transports/httpclient.h +1 -1
  290. data/vendor/libgit2/src/transports/local.c +5 -5
  291. data/vendor/libgit2/src/transports/smart.c +14 -9
  292. data/vendor/libgit2/src/transports/smart.h +1 -1
  293. data/vendor/libgit2/src/transports/smart_protocol.c +11 -5
  294. data/vendor/libgit2/src/transports/ssh.c +51 -17
  295. data/vendor/libgit2/src/transports/winhttp.c +156 -88
  296. data/vendor/libgit2/src/tree.c +100 -77
  297. data/vendor/libgit2/src/tree.h +1 -0
  298. data/vendor/libgit2/src/tsort.c +0 -2
  299. data/vendor/libgit2/src/unix/map.c +3 -1
  300. data/vendor/libgit2/src/unix/posix.h +16 -1
  301. data/vendor/libgit2/src/unix/pthread.h +2 -1
  302. data/vendor/libgit2/src/utf8.c +150 -0
  303. data/vendor/libgit2/src/utf8.h +52 -0
  304. data/vendor/libgit2/src/util.c +74 -183
  305. data/vendor/libgit2/src/util.h +33 -39
  306. data/vendor/libgit2/src/vector.c +23 -19
  307. data/vendor/libgit2/src/vector.h +4 -2
  308. data/vendor/libgit2/src/win32/findfile.c +4 -2
  309. data/vendor/libgit2/src/win32/git2.rc +18 -3
  310. data/vendor/libgit2/src/win32/map.c +1 -1
  311. data/vendor/libgit2/src/win32/msvc-compat.h +9 -1
  312. data/vendor/libgit2/src/win32/path_w32.c +23 -25
  313. data/vendor/libgit2/src/win32/path_w32.h +0 -1
  314. data/vendor/libgit2/src/win32/posix_w32.c +77 -1
  315. data/vendor/libgit2/src/win32/precompiled.h +0 -1
  316. data/vendor/libgit2/src/win32/reparse.h +4 -4
  317. data/vendor/libgit2/src/win32/thread.c +24 -15
  318. data/vendor/libgit2/src/win32/thread.h +1 -1
  319. data/vendor/libgit2/src/win32/w32_buffer.c +3 -3
  320. data/vendor/libgit2/src/win32/w32_common.h +18 -9
  321. data/vendor/libgit2/src/win32/{w32_crtdbg_stacktrace.c → w32_leakcheck.c} +269 -33
  322. data/vendor/libgit2/src/win32/w32_leakcheck.h +222 -0
  323. data/vendor/libgit2/src/win32/w32_util.h +6 -6
  324. data/vendor/libgit2/src/worktree.c +37 -15
  325. data/vendor/libgit2/src/zstream.c +1 -1
  326. metadata +56 -38
  327. data/vendor/libgit2/cmake/Modules/CheckPrototypeDefinition.c.in +0 -29
  328. data/vendor/libgit2/cmake/Modules/CheckPrototypeDefinition.cmake +0 -96
  329. data/vendor/libgit2/src/allocators/win32_crtdbg.c +0 -118
  330. data/vendor/libgit2/src/buf_text.c +0 -316
  331. data/vendor/libgit2/src/buf_text.h +0 -122
  332. data/vendor/libgit2/src/global.c +0 -361
  333. data/vendor/libgit2/src/global.h +0 -41
  334. data/vendor/libgit2/src/thread-utils.c +0 -58
  335. data/vendor/libgit2/src/thread-utils.h +0 -246
  336. data/vendor/libgit2/src/win32/w32_crtdbg_stacktrace.h +0 -127
  337. data/vendor/libgit2/src/win32/w32_stack.c +0 -188
  338. data/vendor/libgit2/src/win32/w32_stack.h +0 -140
@@ -45,7 +45,6 @@ extern bool git_reference__enable_symbolic_ref_target_validation;
45
45
  #define GIT_REBASE_APPLY_DIR "rebase-apply/"
46
46
  #define GIT_REBASE_APPLY_REBASING_FILE GIT_REBASE_APPLY_DIR "rebasing"
47
47
  #define GIT_REBASE_APPLY_APPLYING_FILE GIT_REBASE_APPLY_DIR "applying"
48
- #define GIT_REFS_HEADS_MASTER_FILE GIT_REFS_HEADS_DIR "master"
49
48
 
50
49
  #define GIT_SEQUENCER_DIR "sequencer/"
51
50
  #define GIT_SEQUENCER_HEAD_FILE GIT_SEQUENCER_DIR "head"
@@ -86,10 +85,11 @@ git_reference *git_reference__realloc(git_reference **ptr_to_ref, const char *na
86
85
 
87
86
  int git_reference__normalize_name(git_buf *buf, const char *name, unsigned int flags);
88
87
  int git_reference__update_terminal(git_repository *repo, const char *ref_name, const git_oid *oid, const git_signature *sig, const char *log_message);
89
- int git_reference__is_valid_name(const char *refname, unsigned int flags);
88
+ int git_reference__name_is_valid(int *valid, const char *name, unsigned int flags);
90
89
  int git_reference__is_branch(const char *ref_name);
91
90
  int git_reference__is_remote(const char *ref_name);
92
91
  int git_reference__is_tag(const char *ref_name);
92
+ int git_reference__is_note(const char *ref_name);
93
93
  const char *git_reference__shorthand(const char *name);
94
94
 
95
95
  /**
@@ -115,24 +115,6 @@ int git_reference_lookup_resolved(
115
115
  const char *name,
116
116
  int max_deref);
117
117
 
118
- /**
119
- * Read reference from a file.
120
- *
121
- * This function will read in the file at `path`. If it is a
122
- * symref, it will return a new unresolved symbolic reference
123
- * with the given name pointing to the reference pointed to by
124
- * the file. If it is not a symbolic reference, it will return
125
- * the resolved reference.
126
- *
127
- * Note that because the refdb is not involved for symbolic references, they
128
- * won't be owned, hence you should either not make the returned reference
129
- * 'externally visible', or perform the lookup before returning it to the user.
130
- */
131
- int git_reference__read_head(
132
- git_reference **out,
133
- git_repository *repo,
134
- const char *path);
135
-
136
118
  int git_reference__log_signature(git_signature **out, git_repository *repo);
137
119
 
138
120
  /** Update a reference after a commit. */
@@ -21,9 +21,11 @@ int git_refspec__parse(git_refspec *refspec, const char *input, bool is_fetch)
21
21
  size_t llen;
22
22
  int is_glob = 0;
23
23
  const char *lhs, *rhs;
24
- int flags;
24
+ int valid = 0;
25
+ unsigned int flags;
25
26
 
26
- assert(refspec && input);
27
+ GIT_ASSERT_ARG(refspec);
28
+ GIT_ASSERT_ARG(input);
27
29
 
28
30
  memset(refspec, 0x0, sizeof(git_refspec));
29
31
  refspec->push = !is_fetch;
@@ -75,57 +77,69 @@ int git_refspec__parse(git_refspec *refspec, const char *input, bool is_fetch)
75
77
 
76
78
  if (is_fetch) {
77
79
  /*
78
- * LHS
79
- * - empty is allowed; it means HEAD.
80
- * - otherwise it must be a valid looking ref.
81
- */
80
+ * LHS
81
+ * - empty is allowed; it means HEAD.
82
+ * - otherwise it must be a valid looking ref.
83
+ */
82
84
  if (!*refspec->src)
83
85
  ; /* empty is ok */
84
- else if (!git_reference__is_valid_name(refspec->src, flags))
86
+ else if (git_reference__name_is_valid(&valid, refspec->src, flags) < 0)
87
+ goto on_error;
88
+ else if (!valid)
85
89
  goto invalid;
90
+
86
91
  /*
87
- * RHS
88
- * - missing is ok, and is same as empty.
89
- * - empty is ok; it means not to store.
90
- * - otherwise it must be a valid looking ref.
91
- */
92
+ * RHS
93
+ * - missing is ok, and is same as empty.
94
+ * - empty is ok; it means not to store.
95
+ * - otherwise it must be a valid looking ref.
96
+ */
92
97
  if (!refspec->dst)
93
98
  ; /* ok */
94
99
  else if (!*refspec->dst)
95
100
  ; /* ok */
96
- else if (!git_reference__is_valid_name(refspec->dst, flags))
101
+ else if (git_reference__name_is_valid(&valid, refspec->dst, flags) < 0)
102
+ goto on_error;
103
+ else if (!valid)
97
104
  goto invalid;
98
105
  } else {
99
106
  /*
100
- * LHS
101
- * - empty is allowed; it means delete.
102
- * - when wildcarded, it must be a valid looking ref.
103
- * - otherwise, it must be an extended SHA-1, but
104
- * there is no existing way to validate this.
105
- */
107
+ * LHS
108
+ * - empty is allowed; it means delete.
109
+ * - when wildcarded, it must be a valid looking ref.
110
+ * - otherwise, it must be an extended SHA-1, but
111
+ * there is no existing way to validate this.
112
+ */
106
113
  if (!*refspec->src)
107
114
  ; /* empty is ok */
108
115
  else if (is_glob) {
109
- if (!git_reference__is_valid_name(refspec->src, flags))
116
+ if (git_reference__name_is_valid(&valid, refspec->src, flags) < 0)
117
+ goto on_error;
118
+ else if (!valid)
110
119
  goto invalid;
111
120
  }
112
121
  else {
113
122
  ; /* anything goes, for now */
114
123
  }
124
+
115
125
  /*
116
- * RHS
117
- * - missing is allowed, but LHS then must be a
118
- * valid looking ref.
119
- * - empty is not allowed.
120
- * - otherwise it must be a valid looking ref.
121
- */
126
+ * RHS
127
+ * - missing is allowed, but LHS then must be a
128
+ * valid looking ref.
129
+ * - empty is not allowed.
130
+ * - otherwise it must be a valid looking ref.
131
+ */
122
132
  if (!refspec->dst) {
123
- if (!git_reference__is_valid_name(refspec->src, flags))
133
+ if (git_reference__name_is_valid(&valid, refspec->src, flags) < 0)
134
+ goto on_error;
135
+ else if (!valid)
124
136
  goto invalid;
125
137
  } else if (!*refspec->dst) {
126
138
  goto invalid;
127
139
  } else {
128
- if (!git_reference__is_valid_name(refspec->dst, flags))
140
+ if (git_reference__name_is_valid(&valid, refspec->dst, flags) < 0)
141
+ goto on_error;
142
+ else if (!valid)
129
143
  goto invalid;
130
144
  }
131
145
 
@@ -141,11 +155,14 @@ int git_refspec__parse(git_refspec *refspec, const char *input, bool is_fetch)
141
155
 
142
156
  return 0;
143
157
 
144
- invalid:
145
- git_error_set(
146
- GIT_ERROR_INVALID,
147
- "'%s' is not a valid refspec.", input);
148
- git_refspec__dispose(refspec);
158
+ invalid:
159
+ git_error_set(GIT_ERROR_INVALID,
160
+ "'%s' is not a valid refspec.", input);
161
+ git_refspec__dispose(refspec);
162
+ return GIT_EINVALIDSPEC;
163
+
164
+ on_error:
165
+ git_refspec__dispose(refspec);
149
166
  return -1;
150
167
  }
151
168
 
@@ -164,7 +181,8 @@ void git_refspec__dispose(git_refspec *refspec)
164
181
  int git_refspec_parse(git_refspec **out_refspec, const char *input, int is_fetch)
165
182
  {
166
183
  git_refspec *refspec;
167
- assert(out_refspec && input);
184
+ GIT_ASSERT_ARG(out_refspec);
185
+ GIT_ASSERT_ARG(input);
168
186
 
169
187
  *out_refspec = NULL;
170
188
 
@@ -203,7 +221,7 @@ const char *git_refspec_string(const git_refspec *refspec)
203
221
 
204
222
  int git_refspec_force(const git_refspec *refspec)
205
223
  {
206
- assert(refspec);
224
+ GIT_ASSERT_ARG(refspec);
207
225
 
208
226
  return refspec->force;
209
227
  }
@@ -229,8 +247,11 @@ static int refspec_transform(
229
247
  {
230
248
  const char *from_star, *to_star;
231
249
  size_t replacement_len, star_offset;
250
+ int error;
251
+
252
+ if ((error = git_buf_sanitize(out)) < 0)
253
+ return error;
232
254
 
233
- git_buf_sanitize(out);
234
255
  git_buf_clear(out);
235
256
 
236
257
  /*
@@ -242,7 +263,7 @@ static int refspec_transform(
242
263
  from_star = strchr(from, '*');
243
264
  to_star = strchr(to, '*');
244
265
 
245
- assert(from_star && to_star);
266
+ GIT_ASSERT(from_star && to_star);
246
267
 
247
268
  /* star offset, both in 'from' and in 'name' */
248
269
  star_offset = from_star - from;
@@ -262,8 +283,14 @@ static int refspec_transform(
262
283
 
263
284
  int git_refspec_transform(git_buf *out, const git_refspec *spec, const char *name)
264
285
  {
265
- assert(out && spec && name);
266
- git_buf_sanitize(out);
286
+ int error;
287
+
288
+ GIT_ASSERT_ARG(out);
289
+ GIT_ASSERT_ARG(spec);
290
+ GIT_ASSERT_ARG(name);
291
+
292
+ if ((error = git_buf_sanitize(out)) < 0)
293
+ return error;
267
294
 
268
295
  if (!git_refspec_src_matches(spec, name)) {
269
296
  git_error_set(GIT_ERROR_INVALID, "ref '%s' doesn't match the source", name);
@@ -278,8 +305,14 @@ int git_refspec_transform(git_buf *out, const git_refspec *spec, const char *nam
278
305
 
279
306
  int git_refspec_rtransform(git_buf *out, const git_refspec *spec, const char *name)
280
307
  {
281
- assert(out && spec && name);
282
- git_buf_sanitize(out);
308
+ int error;
309
+
310
+ GIT_ASSERT_ARG(out);
311
+ GIT_ASSERT_ARG(spec);
312
+ GIT_ASSERT_ARG(name);
313
+
314
+ if ((error = git_buf_sanitize(out)) < 0)
315
+ return error;
283
316
 
284
317
  if (!git_refspec_dst_matches(spec, name)) {
285
318
  git_error_set(GIT_ERROR_INVALID, "ref '%s' doesn't match the destination", name);
@@ -306,14 +339,15 @@ int git_refspec__serialize(git_buf *out, const git_refspec *refspec)
306
339
 
307
340
  int git_refspec_is_wildcard(const git_refspec *spec)
308
341
  {
309
- assert(spec && spec->src);
342
+ GIT_ASSERT_ARG(spec);
343
+ GIT_ASSERT_ARG(spec->src);
310
344
 
311
345
  return (spec->src[strlen(spec->src) - 1] == '*');
312
346
  }
313
347
 
314
348
  git_direction git_refspec_direction(const git_refspec *spec)
315
349
  {
316
- assert(spec);
350
+ GIT_ASSERT_ARG(spec);
317
351
 
318
352
  return spec->push;
319
353
  }
@@ -332,7 +366,9 @@ int git_refspec__dwim_one(git_vector *out, git_refspec *spec, git_vector *refs)
332
366
  NULL
333
367
  };
334
368
 
335
- assert(out && spec && refs);
369
+ GIT_ASSERT_ARG(out);
370
+ GIT_ASSERT_ARG(spec);
371
+ GIT_ASSERT_ARG(refs);
336
372
 
337
373
  cur = git__calloc(1, sizeof(git_refspec));
338
374
  GIT_ERROR_CHECK_ALLOC(cur);
@@ -12,7 +12,7 @@
12
12
  int git_regexp_compile(git_regexp *r, const char *pattern, int flags)
13
13
  {
14
14
  int erroffset, cflags = 0;
15
- const char *error;
15
+ const char *error = NULL;
16
16
 
17
17
  if (flags & GIT_REGEXP_ICASE)
18
18
  cflags |= PCRE_CASELESS;
@@ -41,7 +41,7 @@ int git_regexp_match(const git_regexp *r, const char *string)
41
41
 
42
42
  int git_regexp_search(const git_regexp *r, const char *string, size_t nmatches, git_regmatch *matches)
43
43
  {
44
- int static_ovec[9], *ovec;
44
+ int static_ovec[9] = {0}, *ovec;
45
45
  int error;
46
46
  size_t i;
47
47
 
@@ -82,9 +82,11 @@ static int download_tags_value(git_remote *remote, git_config *cfg)
82
82
 
83
83
  static int ensure_remote_name_is_valid(const char *name)
84
84
  {
85
- int error = 0;
85
+ int valid, error;
86
+
87
+ error = git_remote_name_is_valid(&valid, name);
86
88
 
87
- if (!git_remote_is_valid_name(name)) {
89
+ if (!error && !valid) {
88
90
  git_error_set(
89
91
  GIT_ERROR_CONFIG,
90
92
  "'%s' is not a valid remote name.", name ? name : "(null)");
@@ -110,12 +112,8 @@ static int write_add_refspec(git_repository *repo, const char *name, const char
110
112
  if ((error = ensure_remote_name_is_valid(name)) < 0)
111
113
  return error;
112
114
 
113
- if ((error = git_refspec__parse(&spec, refspec, fetch)) < 0) {
114
- if (git_error_last()->klass != GIT_ERROR_NOMEMORY)
115
- error = GIT_EINVALIDSPEC;
116
-
115
+ if ((error = git_refspec__parse(&spec, refspec, fetch)) < 0)
117
116
  return error;
118
- }
119
117
 
120
118
  git_refspec__dispose(&spec);
121
119
 
@@ -123,7 +121,7 @@ static int write_add_refspec(git_repository *repo, const char *name, const char
123
121
  return error;
124
122
 
125
123
  /*
126
- * "$^" is a unmatcheable regexp: it will not match anything at all, so
124
+ * "$^" is an unmatchable regexp: it will not match anything at all, so
127
125
  * all values will be considered new and we will not replace any
128
126
  * present value.
129
127
  */
@@ -195,10 +193,12 @@ int git_remote_create_options_init(git_remote_create_options *opts, unsigned int
195
193
  return 0;
196
194
  }
197
195
 
196
+ #ifndef GIT_DEPRECATE_HARD
198
197
  int git_remote_create_init_options(git_remote_create_options *opts, unsigned int version)
199
198
  {
200
199
  return git_remote_create_options_init(opts, version);
201
200
  }
201
+ #endif
202
202
 
203
203
  int git_remote_create_with_opts(git_remote **out, const char *url, const git_remote_create_options *opts)
204
204
  {
@@ -210,7 +210,8 @@ int git_remote_create_with_opts(git_remote **out, const char *url, const git_rem
210
210
  const git_remote_create_options dummy_opts = GIT_REMOTE_CREATE_OPTIONS_INIT;
211
211
  int error = -1;
212
212
 
213
- assert(out && url);
213
+ GIT_ASSERT_ARG(out);
214
+ GIT_ASSERT_ARG(url);
214
215
 
215
216
  if (!opts) {
216
217
  opts = &dummy_opts;
@@ -459,7 +460,9 @@ int git_remote_lookup(git_remote **out, git_repository *repo, const char *name)
459
460
  struct refspec_cb_data data = { NULL };
460
461
  bool optional_setting_found = false, found;
461
462
 
462
- assert(out && repo && name);
463
+ GIT_ASSERT_ARG(out);
464
+ GIT_ASSERT_ARG(repo);
465
+ GIT_ASSERT_ARG(name);
463
466
 
464
467
  if ((error = ensure_remote_name_is_valid(name)) < 0)
465
468
  return error;
@@ -581,29 +584,46 @@ static int lookup_remote_prune_config(git_remote *remote, git_config *config, co
581
584
 
582
585
  const char *git_remote_name(const git_remote *remote)
583
586
  {
584
- assert(remote);
587
+ GIT_ASSERT_ARG_WITH_RETVAL(remote, NULL);
585
588
  return remote->name;
586
589
  }
587
590
 
588
591
  git_repository *git_remote_owner(const git_remote *remote)
589
592
  {
590
- assert(remote);
593
+ GIT_ASSERT_ARG_WITH_RETVAL(remote, NULL);
591
594
  return remote->repo;
592
595
  }
593
596
 
594
597
  const char *git_remote_url(const git_remote *remote)
595
598
  {
596
- assert(remote);
599
+ GIT_ASSERT_ARG_WITH_RETVAL(remote, NULL);
597
600
  return remote->url;
598
601
  }
599
602
 
603
+ int git_remote_set_instance_url(git_remote *remote, const char *url)
604
+ {
605
+ char *tmp;
606
+
607
+ GIT_ASSERT_ARG(remote);
608
+ GIT_ASSERT_ARG(url);
609
+
610
+ if ((tmp = git__strdup(url)) == NULL)
611
+ return -1;
612
+
613
+ git__free(remote->url);
614
+ remote->url = tmp;
615
+
616
+ return 0;
617
+ }
618
+
600
619
  static int set_url(git_repository *repo, const char *remote, const char *pattern, const char *url)
601
620
  {
602
621
  git_config *cfg;
603
622
  git_buf buf = GIT_BUF_INIT, canonical_url = GIT_BUF_INIT;
604
623
  int error;
605
624
 
606
- assert(repo && remote);
625
+ GIT_ASSERT_ARG(repo);
626
+ GIT_ASSERT_ARG(remote);
607
627
 
608
628
  if ((error = ensure_remote_name_is_valid(remote)) < 0)
609
629
  return error;
@@ -637,44 +657,84 @@ int git_remote_set_url(git_repository *repo, const char *remote, const char *url
637
657
 
638
658
  const char *git_remote_pushurl(const git_remote *remote)
639
659
  {
640
- assert(remote);
660
+ GIT_ASSERT_ARG_WITH_RETVAL(remote, NULL);
641
661
  return remote->pushurl;
642
662
  }
643
663
 
664
+ int git_remote_set_instance_pushurl(git_remote *remote, const char *url)
665
+ {
666
+ char *tmp;
667
+
668
+ GIT_ASSERT_ARG(remote);
669
+ GIT_ASSERT_ARG(url);
670
+
671
+ if ((tmp = git__strdup(url)) == NULL)
672
+ return -1;
673
+
674
+ git__free(remote->pushurl);
675
+ remote->pushurl = tmp;
676
+
677
+ return 0;
678
+ }
679
+
644
680
  int git_remote_set_pushurl(git_repository *repo, const char *remote, const char* url)
645
681
  {
646
682
  return set_url(repo, remote, CONFIG_PUSHURL_FMT, url);
647
683
  }
648
684
 
649
- static int resolve_url(git_buf *resolved_url, const char *url, int direction, const git_remote_callbacks *callbacks)
685
+ static int resolve_url(
686
+ git_buf *resolved_url,
687
+ const char *url,
688
+ int direction,
689
+ const git_remote_callbacks *callbacks)
650
690
  {
651
- int status;
691
+ #ifdef GIT_DEPRECATE_HARD
692
+ GIT_UNUSED(direction);
693
+ GIT_UNUSED(callbacks);
694
+ #else
695
+ int status, error;
652
696
 
653
697
  if (callbacks && callbacks->resolve_url) {
654
698
  git_buf_clear(resolved_url);
655
699
  status = callbacks->resolve_url(resolved_url, url, direction, callbacks->payload);
656
700
  if (status != GIT_PASSTHROUGH) {
657
701
  git_error_set_after_callback_function(status, "git_resolve_url_cb");
658
- git_buf_sanitize(resolved_url);
702
+
703
+ if ((error = git_buf_sanitize(resolved_url)) < 0)
704
+ return error;
705
+
659
706
  return status;
660
707
  }
661
708
  }
709
+ #endif
662
710
 
663
711
  return git_buf_sets(resolved_url, url);
664
712
  }
665
713
 
666
- int git_remote__urlfordirection(git_buf *url_out, struct git_remote *remote, int direction, const git_remote_callbacks *callbacks)
714
+ int git_remote__urlfordirection(
715
+ git_buf *url_out,
716
+ struct git_remote *remote,
717
+ int direction,
718
+ const git_remote_callbacks *callbacks)
667
719
  {
668
720
  const char *url = NULL;
669
721
 
670
- assert(remote);
671
- assert(direction == GIT_DIRECTION_FETCH || direction == GIT_DIRECTION_PUSH);
722
+ GIT_ASSERT_ARG(remote);
723
+ GIT_ASSERT_ARG(direction == GIT_DIRECTION_FETCH || direction == GIT_DIRECTION_PUSH);
672
724
 
673
- if (direction == GIT_DIRECTION_FETCH) {
725
+ if (callbacks && callbacks->remote_ready) {
726
+ int status = callbacks->remote_ready(remote, direction, callbacks->payload);
727
+
728
+ if (status != 0 && status != GIT_PASSTHROUGH) {
729
+ git_error_set_after_callback_function(status, "git_remote_ready_cb");
730
+ return status;
731
+ }
732
+ }
733
+
734
+ if (direction == GIT_DIRECTION_FETCH)
674
735
  url = remote->url;
675
- } else if (direction == GIT_DIRECTION_PUSH) {
736
+ else if (direction == GIT_DIRECTION_PUSH)
676
737
  url = remote->pushurl ? remote->pushurl : remote->url;
677
- }
678
738
 
679
739
  if (!url) {
680
740
  git_error_set(GIT_ERROR_INVALID,
@@ -683,10 +743,11 @@ int git_remote__urlfordirection(git_buf *url_out, struct git_remote *remote, int
683
743
  direction == GIT_DIRECTION_FETCH ? "fetch" : "push");
684
744
  return GIT_EINVALID;
685
745
  }
746
+
686
747
  return resolve_url(url_out, url, direction, callbacks);
687
748
  }
688
749
 
689
- int set_transport_callbacks(git_transport *t, const git_remote_callbacks *cbs)
750
+ static int remote_transport_set_callbacks(git_transport *t, const git_remote_callbacks *cbs)
690
751
  {
691
752
  if (!t->set_callbacks || !cbs)
692
753
  return 0;
@@ -713,7 +774,7 @@ int git_remote__connect(git_remote *remote, git_direction direction, const git_r
713
774
  git_credential_acquire_cb credentials = NULL;
714
775
  git_transport_cb transport = NULL;
715
776
 
716
- assert(remote);
777
+ GIT_ASSERT_ARG(remote);
717
778
 
718
779
  if (callbacks) {
719
780
  GIT_ERROR_CHECK_VERSION(callbacks, GIT_REMOTE_CALLBACKS_VERSION, "git_remote_callbacks");
@@ -744,7 +805,7 @@ int git_remote__connect(git_remote *remote, git_direction direction, const git_r
744
805
  if ((error = set_transport_custom_headers(t, conn->custom_headers)) != 0)
745
806
  goto on_error;
746
807
 
747
- if ((error = set_transport_callbacks(t, callbacks)) < 0 ||
808
+ if ((error = remote_transport_set_callbacks(t, callbacks)) < 0 ||
748
809
  (error = t->connect(t, url.ptr, credentials, payload, conn->proxy, direction, flags)) != 0)
749
810
  goto on_error;
750
811
 
@@ -778,7 +839,7 @@ int git_remote_connect(git_remote *remote, git_direction direction, const git_re
778
839
 
779
840
  int git_remote_ls(const git_remote_head ***out, size_t *size, git_remote *remote)
780
841
  {
781
- assert(remote);
842
+ GIT_ASSERT_ARG(remote);
782
843
 
783
844
  if (!remote->transport) {
784
845
  git_error_set(GIT_ERROR_NET, "this remote has never connected");
@@ -788,75 +849,140 @@ int git_remote_ls(const git_remote_head ***out, size_t *size, git_remote *remote
788
849
  return remote->transport->ls(out, size, remote->transport);
789
850
  }
790
851
 
791
- int git_remote__get_http_proxy(git_remote *remote, bool use_ssl, char **proxy_url)
852
+ static int lookup_config(char **out, git_config *cfg, const char *name)
792
853
  {
793
- git_config *cfg;
794
854
  git_config_entry *ce = NULL;
795
- git_buf val = GIT_BUF_INIT;
796
855
  int error;
797
856
 
798
- assert(remote);
857
+ if ((error = git_config__lookup_entry(&ce, cfg, name, false)) < 0)
858
+ return error;
799
859
 
800
- if (!proxy_url || !remote->repo)
801
- return -1;
860
+ if (ce && ce->value) {
861
+ *out = git__strdup(ce->value);
862
+ GIT_ERROR_CHECK_ALLOC(*out);
863
+ } else {
864
+ error = GIT_ENOTFOUND;
865
+ }
802
866
 
803
- *proxy_url = NULL;
867
+ git_config_entry_free(ce);
868
+ return error;
869
+ }
804
870
 
805
- if ((error = git_repository_config__weakptr(&cfg, remote->repo)) < 0)
806
- return error;
871
+ static void url_config_trim(git_net_url *url)
872
+ {
873
+ size_t len = strlen(url->path);
807
874
 
808
- /* Go through the possible sources for proxy configuration, from most specific
809
- * to least specific. */
875
+ if (url->path[len - 1] == '/') {
876
+ len--;
877
+ } else {
878
+ while (len && url->path[len - 1] != '/')
879
+ len--;
880
+ }
881
+
882
+ url->path[len] = '\0';
883
+ }
884
+
885
+ static int http_proxy_config(char **out, git_remote *remote, git_net_url *url)
886
+ {
887
+ git_config *cfg;
888
+ git_buf buf = GIT_BUF_INIT;
889
+ git_net_url lookup_url = GIT_NET_URL_INIT;
890
+ int error;
891
+
892
+ if ((error = git_net_url_dup(&lookup_url, url)) < 0 ||
893
+ (error = git_repository_config__weakptr(&cfg, remote->repo)) < 0)
894
+ goto done;
810
895
 
811
896
  /* remote.<name>.proxy config setting */
812
897
  if (remote->name && remote->name[0]) {
813
- git_buf buf = GIT_BUF_INIT;
898
+ git_buf_clear(&buf);
814
899
 
815
- if ((error = git_buf_printf(&buf, "remote.%s.proxy", remote->name)) < 0)
816
- return error;
900
+ if ((error = git_buf_printf(&buf, "remote.%s.proxy", remote->name)) < 0 ||
901
+ (error = lookup_config(out, cfg, buf.ptr)) != GIT_ENOTFOUND)
902
+ goto done;
903
+ }
817
904
 
818
- error = git_config__lookup_entry(&ce, cfg, git_buf_cstr(&buf), false);
819
- git_buf_dispose(&buf);
905
+ while (true) {
906
+ git_buf_clear(&buf);
820
907
 
821
- if (error < 0)
822
- return error;
908
+ if ((error = git_buf_puts(&buf, "http.")) < 0 ||
909
+ (error = git_net_url_fmt(&buf, &lookup_url)) < 0 ||
910
+ (error = git_buf_puts(&buf, ".proxy")) < 0 ||
911
+ (error = lookup_config(out, cfg, buf.ptr)) != GIT_ENOTFOUND)
912
+ goto done;
823
913
 
824
- if (ce && ce->value) {
825
- *proxy_url = git__strdup(ce->value);
826
- goto found;
827
- }
914
+ if (! lookup_url.path[0])
915
+ break;
916
+
917
+ url_config_trim(&lookup_url);
828
918
  }
829
919
 
830
- /* http.proxy config setting */
831
- if ((error = git_config__lookup_entry(&ce, cfg, "http.proxy", false)) < 0)
832
- return error;
920
+ git_buf_clear(&buf);
833
921
 
834
- if (ce && ce->value) {
835
- *proxy_url = git__strdup(ce->value);
836
- goto found;
837
- }
922
+ error = lookup_config(out, cfg, "http.proxy");
923
+
924
+ done:
925
+ git_buf_dispose(&buf);
926
+ git_net_url_dispose(&lookup_url);
927
+ return error;
928
+ }
929
+
930
+ static int http_proxy_env(char **out, git_remote *remote, git_net_url *url)
931
+ {
932
+ git_buf proxy_env = GIT_BUF_INIT, no_proxy_env = GIT_BUF_INIT;
933
+ bool use_ssl = (strcmp(url->scheme, "https") == 0);
934
+ int error;
935
+
936
+ GIT_UNUSED(remote);
838
937
 
839
938
  /* http_proxy / https_proxy environment variables */
840
- error = git__getenv(&val, use_ssl ? "https_proxy" : "http_proxy");
939
+ error = git__getenv(&proxy_env, use_ssl ? "https_proxy" : "http_proxy");
841
940
 
842
941
  /* try uppercase environment variables */
843
942
  if (error == GIT_ENOTFOUND)
844
- error = git__getenv(&val, use_ssl ? "HTTPS_PROXY" : "HTTP_PROXY");
943
+ error = git__getenv(&proxy_env, use_ssl ? "HTTPS_PROXY" : "HTTP_PROXY");
845
944
 
846
- if (error < 0) {
847
- if (error == GIT_ENOTFOUND) {
848
- git_error_clear();
849
- error = 0;
850
- }
945
+ if (error)
946
+ goto done;
851
947
 
852
- return error;
853
- }
948
+ /* no_proxy/NO_PROXY environment variables */
949
+ error = git__getenv(&no_proxy_env, "no_proxy");
854
950
 
855
- *proxy_url = git_buf_detach(&val);
951
+ if (error == GIT_ENOTFOUND)
952
+ error = git__getenv(&no_proxy_env, "NO_PROXY");
856
953
 
857
- found:
858
- GIT_ERROR_CHECK_ALLOC(*proxy_url);
859
- git_config_entry_free(ce);
954
+ if (error && error != GIT_ENOTFOUND)
955
+ goto done;
956
+
957
+ if (!git_net_url_matches_pattern_list(url, no_proxy_env.ptr))
958
+ *out = git_buf_detach(&proxy_env);
959
+ else
960
+ error = GIT_ENOTFOUND;
961
+
962
+ done:
963
+ git_buf_dispose(&proxy_env);
964
+ git_buf_dispose(&no_proxy_env);
965
+ return error;
966
+ }
967
+
968
+ int git_remote__http_proxy(char **out, git_remote *remote, git_net_url *url)
969
+ {
970
+ int error;
971
+
972
+ GIT_ASSERT_ARG(out);
973
+ GIT_ASSERT_ARG(remote);
974
+ GIT_ASSERT_ARG(remote->repo);
975
+
976
+ *out = NULL;
977
+
978
+ /*
979
+ * Go through the possible sources for proxy configuration,
980
+ * Examine the various git config options first, then
981
+ * consult environment variables.
982
+ */
983
+ if ((error = http_proxy_config(out, remote, url)) != GIT_ENOTFOUND ||
984
+ (error = http_proxy_env(out, remote, url)) != GIT_ENOTFOUND)
985
+ return error;
860
986
 
861
987
  return 0;
862
988
  }
@@ -924,7 +1050,7 @@ int git_remote_download(git_remote *remote, const git_strarray *refspecs, const
924
1050
  const git_strarray *custom_headers = NULL;
925
1051
  const git_proxy_options *proxy = NULL;
926
1052
 
927
- assert(remote);
1053
+ GIT_ASSERT_ARG(remote);
928
1054
 
929
1055
  if (!remote->repo) {
930
1056
  git_error_set(GIT_ERROR_INVALID, "cannot download detached remote");
@@ -1063,7 +1189,8 @@ static int remote_head_for_fetchspec_src(git_remote_head **out, git_vector *upda
1063
1189
  unsigned int i;
1064
1190
  git_remote_head *remote_ref;
1065
1191
 
1066
- assert(update_heads && fetchspec_src);
1192
+ GIT_ASSERT_ARG(update_heads);
1193
+ GIT_ASSERT_ARG(fetchspec_src);
1067
1194
 
1068
1195
  *out = NULL;
1069
1196
 
@@ -1117,7 +1244,9 @@ static int remote_head_for_ref(git_remote_head **out, git_remote *remote, git_re
1117
1244
  const char *ref_name;
1118
1245
  int error = 0, update;
1119
1246
 
1120
- assert(out && spec && ref);
1247
+ GIT_ASSERT_ARG(out);
1248
+ GIT_ASSERT_ARG(spec);
1249
+ GIT_ASSERT_ARG(ref);
1121
1250
 
1122
1251
  *out = NULL;
1123
1252
 
@@ -1131,6 +1260,16 @@ static int remote_head_for_ref(git_remote_head **out, git_remote *remote, git_re
1131
1260
  ref_name = git_reference_name(resolved_ref);
1132
1261
  }
1133
1262
 
1263
+ /*
1264
+ * The ref name may be unresolvable - perhaps it's pointing to
1265
+ * something invalid. In this case, there is no remote head for
1266
+ * this ref.
1267
+ */
1268
+ if (!ref_name) {
1269
+ error = 0;
1270
+ goto cleanup;
1271
+ }
1272
+
1134
1273
  if ((error = ref_to_update(&update, &remote_name, remote, spec, ref_name)) < 0)
1135
1274
  goto cleanup;
1136
1275
 
@@ -1154,7 +1293,7 @@ static int git_remote_write_fetchhead(git_remote *remote, git_refspec *spec, git
1154
1293
  unsigned int i = 0;
1155
1294
  int error = 0;
1156
1295
 
1157
- assert(remote);
1296
+ GIT_ASSERT_ARG(remote);
1158
1297
 
1159
1298
  /* no heads, nothing to do */
1160
1299
  if (update_heads->length == 0)
@@ -1237,7 +1376,7 @@ static int prune_candidates(git_vector *candidates, git_remote *remote)
1237
1376
  }
1238
1377
 
1239
1378
  out:
1240
- git_strarray_free(&arr);
1379
+ git_strarray_dispose(&arr);
1241
1380
  return error;
1242
1381
  }
1243
1382
 
@@ -1297,7 +1436,7 @@ int git_remote_prune(git_remote *remote, const git_remote_callbacks *callbacks)
1297
1436
  if (error == GIT_ENOTFOUND)
1298
1437
  continue;
1299
1438
 
1300
- /* if we did find a source, remove it from the candiates */
1439
+ /* If we did find a source, remove it from the candidates. */
1301
1440
  if ((error = git_vector_set((void **) &src_name, &candidates, i, NULL)) < 0)
1302
1441
  goto cleanup;
1303
1442
 
@@ -1360,7 +1499,7 @@ static int update_tips_for_spec(
1360
1499
  git_vector *refs,
1361
1500
  const char *log_message)
1362
1501
  {
1363
- int error = 0, autotag;
1502
+ int error = 0, autotag, valid;
1364
1503
  unsigned int i = 0;
1365
1504
  git_buf refname = GIT_BUF_INIT;
1366
1505
  git_oid old;
@@ -1370,7 +1509,7 @@ static int update_tips_for_spec(
1370
1509
  git_refspec tagspec;
1371
1510
  git_vector update_heads;
1372
1511
 
1373
- assert(remote);
1512
+ GIT_ASSERT_ARG(remote);
1374
1513
 
1375
1514
  if (git_repository_odb__weakptr(&odb, remote->repo) < 0)
1376
1515
  return -1;
@@ -1388,7 +1527,10 @@ static int update_tips_for_spec(
1388
1527
  git_buf_clear(&refname);
1389
1528
 
1390
1529
  /* Ignore malformed ref names (which also saves us from tag^{} */
1391
- if (!git_reference_is_valid_name(head->name))
1530
+ if (git_reference_name_is_valid(&valid, head->name) < 0)
1531
+ goto on_error;
1532
+
1533
+ if (!valid)
1392
1534
  continue;
1393
1535
 
1394
1536
  /* If we have a tag, see if the auto-follow rules say to update it */
@@ -1437,6 +1579,11 @@ static int update_tips_for_spec(
1437
1579
  if (error < 0 && error != GIT_ENOTFOUND)
1438
1580
  goto on_error;
1439
1581
 
1582
+ if (!(error || error == GIT_ENOTFOUND)
1583
+ && !spec->force
1584
+ && !git_graph_descendant_of(remote->repo, &head->oid, &old))
1585
+ continue;
1586
+
1440
1587
  if (error == GIT_ENOTFOUND) {
1441
1588
  memset(&old, 0, GIT_OID_RAWSZ);
1442
1589
 
@@ -1497,6 +1644,7 @@ static int next_head(const git_remote *remote, git_vector *refs,
1497
1644
  git_remote_head *head;
1498
1645
  git_refspec *spec, *passive_spec;
1499
1646
  size_t i, j, k;
1647
+ int valid;
1500
1648
 
1501
1649
  active = &remote->active_refspecs;
1502
1650
  passive = &remote->passive_refspecs;
@@ -1508,7 +1656,10 @@ static int next_head(const git_remote *remote, git_vector *refs,
1508
1656
  for (; i < refs->length; i++) {
1509
1657
  head = git_vector_get(refs, i);
1510
1658
 
1511
- if (!git_reference_is_valid_name(head->name))
1659
+ if (git_reference_name_is_valid(&valid, head->name) < 0)
1660
+ return -1;
1661
+
1662
+ if (!valid)
1512
1663
  continue;
1513
1664
 
1514
1665
  for (; j < active->length; j++) {
@@ -1655,7 +1806,7 @@ int git_remote_update_tips(
1655
1806
  goto out;
1656
1807
  }
1657
1808
 
1658
- /* only try to do opportunisitic updates if the refpec lists differ */
1809
+ /* Only try to do opportunistic updates if the refpec lists differ. */
1659
1810
  if (remote->passed_refspecs)
1660
1811
  error = opportunistic_updates(remote, callbacks, &refs, reflog_message);
1661
1812
 
@@ -1667,7 +1818,7 @@ out:
1667
1818
 
1668
1819
  int git_remote_connected(const git_remote *remote)
1669
1820
  {
1670
- assert(remote);
1821
+ GIT_ASSERT_ARG(remote);
1671
1822
 
1672
1823
  if (!remote->transport || !remote->transport->is_connected)
1673
1824
  return 0;
@@ -1678,7 +1829,7 @@ int git_remote_connected(const git_remote *remote)
1678
1829
 
1679
1830
  int git_remote_stop(git_remote *remote)
1680
1831
  {
1681
- assert(remote);
1832
+ GIT_ASSERT_ARG(remote);
1682
1833
 
1683
1834
  if (remote->transport && remote->transport->cancel)
1684
1835
  remote->transport->cancel(remote->transport);
@@ -1688,7 +1839,7 @@ int git_remote_stop(git_remote *remote)
1688
1839
 
1689
1840
  int git_remote_disconnect(git_remote *remote)
1690
1841
  {
1691
- assert(remote);
1842
+ GIT_ASSERT_ARG(remote);
1692
1843
 
1693
1844
  if (git_remote_connected(remote))
1694
1845
  remote->transport->close(remote->transport);
@@ -1774,7 +1925,7 @@ int git_remote_list(git_strarray *remotes_list, git_repository *repo)
1774
1925
 
1775
1926
  const git_indexer_progress *git_remote_stats(git_remote *remote)
1776
1927
  {
1777
- assert(remote);
1928
+ GIT_ASSERT_ARG_WITH_RETVAL(remote, NULL);
1778
1929
  return &remote->stats;
1779
1930
  }
1780
1931
 
@@ -1789,7 +1940,7 @@ int git_remote_set_autotag(git_repository *repo, const char *remote, git_remote_
1789
1940
  git_config *config;
1790
1941
  int error;
1791
1942
 
1792
- assert(repo && remote);
1943
+ GIT_ASSERT_ARG(repo && remote);
1793
1944
 
1794
1945
  if ((error = ensure_remote_name_is_valid(remote)) < 0)
1795
1946
  return error;
@@ -2053,7 +2204,7 @@ int git_remote_rename(git_strarray *out, git_repository *repo, const char *name,
2053
2204
  git_vector problem_refspecs = GIT_VECTOR_INIT;
2054
2205
  git_remote *remote = NULL;
2055
2206
 
2056
- assert(out && repo && name && new_name);
2207
+ GIT_ASSERT_ARG(out && repo && name && new_name);
2057
2208
 
2058
2209
  if ((error = git_remote_lookup(&remote, repo, name)) < 0)
2059
2210
  return error;
@@ -2087,24 +2238,34 @@ cleanup:
2087
2238
  return error;
2088
2239
  }
2089
2240
 
2090
- int git_remote_is_valid_name(
2091
- const char *remote_name)
2241
+ int git_remote_name_is_valid(int *valid, const char *remote_name)
2092
2242
  {
2093
2243
  git_buf buf = GIT_BUF_INIT;
2094
- git_refspec refspec;
2095
- int error = -1;
2244
+ git_refspec refspec = {0};
2245
+ int error;
2246
+
2247
+ GIT_ASSERT(valid);
2248
+
2249
+ *valid = 0;
2096
2250
 
2097
2251
  if (!remote_name || *remote_name == '\0')
2098
2252
  return 0;
2099
2253
 
2100
- git_buf_printf(&buf, "refs/heads/test:refs/remotes/%s/test", remote_name);
2254
+ if ((error = git_buf_printf(&buf, "refs/heads/test:refs/remotes/%s/test", remote_name)) < 0)
2255
+ goto done;
2256
+
2101
2257
  error = git_refspec__parse(&refspec, git_buf_cstr(&buf), true);
2102
2258
 
2259
+ if (!error)
2260
+ *valid = 1;
2261
+ else if (error == GIT_EINVALIDSPEC)
2262
+ error = 0;
2263
+
2264
+ done:
2103
2265
  git_buf_dispose(&buf);
2104
2266
  git_refspec__dispose(&refspec);
2105
2267
 
2106
- git_error_clear();
2107
- return error == 0;
2268
+ return error;
2108
2269
  }
2109
2270
 
2110
2271
  git_refspec *git_remote__matching_refspec(git_remote *remote, const char *refname)
@@ -2219,7 +2380,7 @@ static const char *name_offset(size_t *len_out, const char *name)
2219
2380
  prefix_len = strlen("remote.");
2220
2381
  dot = strchr(name + prefix_len, '.');
2221
2382
 
2222
- assert(dot);
2383
+ GIT_ASSERT_ARG_WITH_RETVAL(dot, NULL);
2223
2384
 
2224
2385
  *len_out = dot - name - prefix_len;
2225
2386
  return name + prefix_len;
@@ -2249,10 +2410,13 @@ static int remove_branch_config_related_entries(
2249
2410
  if (strcmp(remote_name, entry->value))
2250
2411
  continue;
2251
2412
 
2252
- branch = name_offset(&branch_len, entry->name);
2413
+ if ((branch = name_offset(&branch_len, entry->name)) == NULL) {
2414
+ error = -1;
2415
+ break;
2416
+ }
2253
2417
 
2254
2418
  git_buf_clear(&buf);
2255
- if (git_buf_printf(&buf, "branch.%.*s.merge", (int)branch_len, branch) < 0)
2419
+ if ((error = git_buf_printf(&buf, "branch.%.*s.merge", (int)branch_len, branch)) < 0)
2256
2420
  break;
2257
2421
 
2258
2422
  if ((error = git_config_delete_entry(config, git_buf_cstr(&buf))) < 0) {
@@ -2262,7 +2426,7 @@ static int remove_branch_config_related_entries(
2262
2426
  }
2263
2427
 
2264
2428
  git_buf_clear(&buf);
2265
- if (git_buf_printf(&buf, "branch.%.*s.remote", (int)branch_len, branch) < 0)
2429
+ if ((error = git_buf_printf(&buf, "branch.%.*s.remote", (int)branch_len, branch)) < 0)
2266
2430
  break;
2267
2431
 
2268
2432
  if ((error = git_config_delete_entry(config, git_buf_cstr(&buf))) < 0) {
@@ -2357,7 +2521,8 @@ int git_remote_delete(git_repository *repo, const char *name)
2357
2521
  {
2358
2522
  int error;
2359
2523
 
2360
- assert(repo && name);
2524
+ GIT_ASSERT_ARG(repo);
2525
+ GIT_ASSERT_ARG(name);
2361
2526
 
2362
2527
  if ((error = remove_branch_config_related_entries(repo, name)) < 0 ||
2363
2528
  (error = remove_remote_tracking(repo, name)) < 0 ||
@@ -2373,29 +2538,37 @@ int git_remote_default_branch(git_buf *out, git_remote *remote)
2373
2538
  const git_remote_head *guess = NULL;
2374
2539
  const git_oid *head_id;
2375
2540
  size_t heads_len, i;
2541
+ git_buf local_default = GIT_BUF_INIT;
2376
2542
  int error;
2377
2543
 
2378
- assert(out);
2544
+ GIT_ASSERT_ARG(out);
2379
2545
 
2380
2546
  if ((error = git_remote_ls(&heads, &heads_len, remote)) < 0)
2381
- return error;
2547
+ goto done;
2382
2548
 
2383
- if (heads_len == 0)
2384
- return GIT_ENOTFOUND;
2549
+ if (heads_len == 0 || strcmp(heads[0]->name, GIT_HEAD_FILE)) {
2550
+ error = GIT_ENOTFOUND;
2551
+ goto done;
2552
+ }
2385
2553
 
2386
- if (strcmp(heads[0]->name, GIT_HEAD_FILE))
2387
- return GIT_ENOTFOUND;
2554
+ if ((error = git_buf_sanitize(out)) < 0)
2555
+ return error;
2388
2556
 
2389
- git_buf_sanitize(out);
2390
2557
  /* the first one must be HEAD so if that has the symref info, we're done */
2391
- if (heads[0]->symref_target)
2392
- return git_buf_puts(out, heads[0]->symref_target);
2558
+ if (heads[0]->symref_target) {
2559
+ error = git_buf_puts(out, heads[0]->symref_target);
2560
+ goto done;
2561
+ }
2393
2562
 
2394
2563
  /*
2395
2564
  * If there's no symref information, we have to look over them
2396
- * and guess. We return the first match unless the master
2397
- * branch is a candidate. Then we return the master branch.
2565
+ * and guess. We return the first match unless the default
2566
+ * branch is a candidate. Then we return the default branch.
2398
2567
  */
2568
+
2569
+ if ((error = git_repository_initialbranch(&local_default, remote->repo)) < 0)
2570
+ goto done;
2571
+
2399
2572
  head_id = &heads[0]->oid;
2400
2573
 
2401
2574
  for (i = 1; i < heads_len; i++) {
@@ -2410,16 +2583,22 @@ int git_remote_default_branch(git_buf *out, git_remote *remote)
2410
2583
  continue;
2411
2584
  }
2412
2585
 
2413
- if (!git__strcmp(GIT_REFS_HEADS_MASTER_FILE, heads[i]->name)) {
2586
+ if (!git__strcmp(local_default.ptr, heads[i]->name)) {
2414
2587
  guess = heads[i];
2415
2588
  break;
2416
2589
  }
2417
2590
  }
2418
2591
 
2419
- if (!guess)
2420
- return GIT_ENOTFOUND;
2592
+ if (!guess) {
2593
+ error = GIT_ENOTFOUND;
2594
+ goto done;
2595
+ }
2421
2596
 
2422
- return git_buf_puts(out, guess->name);
2597
+ error = git_buf_puts(out, guess->name);
2598
+
2599
+ done:
2600
+ git_buf_dispose(&local_default);
2601
+ return error;
2423
2602
  }
2424
2603
 
2425
2604
  int git_remote_upload(git_remote *remote, const git_strarray *refspecs, const git_push_options *opts)
@@ -2431,7 +2610,7 @@ int git_remote_upload(git_remote *remote, const git_strarray *refspecs, const gi
2431
2610
  const git_remote_callbacks *cbs = NULL;
2432
2611
  git_remote_connection_opts conn = GIT_REMOTE_CONNECTION_OPTIONS_INIT;
2433
2612
 
2434
- assert(remote);
2613
+ GIT_ASSERT_ARG(remote);
2435
2614
 
2436
2615
  if (!remote->repo) {
2437
2616
  git_error_set(GIT_ERROR_INVALID, "cannot download detached remote");
@@ -2497,7 +2676,7 @@ int git_remote_push(git_remote *remote, const git_strarray *refspecs, const git_
2497
2676
  const git_strarray *custom_headers = NULL;
2498
2677
  const git_proxy_options *proxy = NULL;
2499
2678
 
2500
- assert(remote);
2679
+ GIT_ASSERT_ARG(remote);
2501
2680
 
2502
2681
  if (!remote->repo) {
2503
2682
  git_error_set(GIT_ERROR_INVALID, "cannot download detached remote");
@@ -2512,8 +2691,6 @@ int git_remote_push(git_remote *remote, const git_strarray *refspecs, const git_
2512
2691
  proxy = &opts->proxy_opts;
2513
2692
  }
2514
2693
 
2515
- assert(remote);
2516
-
2517
2694
  if ((error = git_remote_connect(remote, GIT_DIRECTION_PUSH, cbs, proxy, custom_headers)) < 0)
2518
2695
  return error;
2519
2696
 
@@ -2540,9 +2717,9 @@ char *apply_insteadof(git_config *config, const char *url, int direction)
2540
2717
  git_config_entry *entry;
2541
2718
  git_config_iterator *iter;
2542
2719
 
2543
- assert(config);
2544
- assert(url);
2545
- assert(direction == GIT_DIRECTION_FETCH || direction == GIT_DIRECTION_PUSH);
2720
+ GIT_ASSERT_ARG_WITH_RETVAL(config, NULL);
2721
+ GIT_ASSERT_ARG_WITH_RETVAL(url, NULL);
2722
+ GIT_ASSERT_ARG_WITH_RETVAL(direction == GIT_DIRECTION_FETCH || direction == GIT_DIRECTION_PUSH, NULL);
2546
2723
 
2547
2724
  /* Add 1 to prefix/suffix length due to the additional escaped dot */
2548
2725
  prefix_length = strlen(PREFIX) + 1;
@@ -2590,3 +2767,17 @@ char *apply_insteadof(git_config *config, const char *url, int direction)
2590
2767
 
2591
2768
  return result.ptr;
2592
2769
  }
2770
+
2771
+ /* Deprecated functions */
2772
+
2773
+ #ifndef GIT_DEPRECATE_HARD
2774
+
2775
+ int git_remote_is_valid_name(const char *remote_name)
2776
+ {
2777
+ int valid = 0;
2778
+
2779
+ git_remote_name_is_valid(&valid, remote_name);
2780
+ return valid;
2781
+ }
2782
+
2783
+ #endif