rugged 1.3.2.3 → 1.4.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (329) hide show
  1. checksums.yaml +4 -4
  2. data/ext/rugged/extconf.rb +1 -1
  3. data/ext/rugged/rugged_config.c +7 -2
  4. data/ext/rugged/rugged_remote.c +17 -0
  5. data/lib/rugged/version.rb +1 -1
  6. data/vendor/libgit2/CMakeLists.txt +103 -276
  7. data/vendor/libgit2/COPYING +36 -19
  8. data/vendor/libgit2/cmake/AddCFlagIfSupported.cmake +21 -21
  9. data/vendor/libgit2/cmake/DefaultCFlags.cmake +154 -0
  10. data/vendor/libgit2/cmake/EnableWarnings.cmake +13 -13
  11. data/vendor/libgit2/cmake/FindCoreFoundation.cmake +13 -13
  12. data/vendor/libgit2/cmake/FindGSSAPI.cmake +171 -287
  13. data/vendor/libgit2/cmake/FindGSSFramework.cmake +13 -13
  14. data/vendor/libgit2/cmake/{FindHTTP_Parser.cmake → FindHTTPParser.cmake} +17 -17
  15. data/vendor/libgit2/cmake/FindIconv.cmake +27 -27
  16. data/vendor/libgit2/cmake/FindLibSSH2.cmake +5 -5
  17. data/vendor/libgit2/cmake/FindPCRE.cmake +13 -13
  18. data/vendor/libgit2/cmake/FindPCRE2.cmake +12 -12
  19. data/vendor/libgit2/cmake/FindPkgLibraries.cmake +19 -19
  20. data/vendor/libgit2/cmake/FindSecurity.cmake +14 -14
  21. data/vendor/libgit2/cmake/FindStatNsec.cmake +12 -18
  22. data/vendor/libgit2/cmake/Findfutimens.cmake +8 -8
  23. data/vendor/libgit2/cmake/FindmbedTLS.cmake +63 -70
  24. data/vendor/libgit2/cmake/IdeSplitSources.cmake +18 -18
  25. data/vendor/libgit2/cmake/PkgBuildConfig.cmake +60 -60
  26. data/vendor/libgit2/cmake/SanitizeBool.cmake +20 -20
  27. data/vendor/libgit2/cmake/SelectGSSAPI.cmake +37 -37
  28. data/vendor/libgit2/cmake/SelectHTTPParser.cmake +19 -0
  29. data/vendor/libgit2/cmake/SelectHTTPSBackend.cmake +100 -100
  30. data/vendor/libgit2/cmake/SelectHashes.cmake +39 -49
  31. data/vendor/libgit2/cmake/SelectRegex.cmake +51 -0
  32. data/vendor/libgit2/cmake/SelectSSH.cmake +41 -0
  33. data/vendor/libgit2/cmake/SelectWinHTTP.cmake +17 -0
  34. data/vendor/libgit2/cmake/SelectZlib.cmake +34 -0
  35. data/vendor/libgit2/deps/chromium-zlib/CMakeLists.txt +6 -6
  36. data/vendor/libgit2/deps/ntlmclient/CMakeLists.txt +31 -31
  37. data/vendor/libgit2/deps/ntlmclient/crypt_openssl.c +1 -1
  38. data/vendor/libgit2/deps/ntlmclient/ntlm.c +4 -4
  39. data/vendor/libgit2/deps/ntlmclient/ntlm.h +4 -4
  40. data/vendor/libgit2/deps/ntlmclient/ntlmclient.h +2 -2
  41. data/vendor/libgit2/deps/pcre/CMakeLists.txt +88 -88
  42. data/vendor/libgit2/deps/winhttp/CMakeLists.txt +14 -16
  43. data/vendor/libgit2/deps/zlib/adler32.c +0 -7
  44. data/vendor/libgit2/deps/zlib/crc32.c +288 -975
  45. data/vendor/libgit2/deps/zlib/crc32.h +436 -9441
  46. data/vendor/libgit2/deps/zlib/deflate.c +31 -83
  47. data/vendor/libgit2/deps/zlib/deflate.h +15 -12
  48. data/vendor/libgit2/deps/zlib/gzguts.h +2 -3
  49. data/vendor/libgit2/deps/zlib/infback.c +1 -2
  50. data/vendor/libgit2/deps/zlib/inffast.c +14 -14
  51. data/vendor/libgit2/deps/zlib/inflate.c +8 -39
  52. data/vendor/libgit2/deps/zlib/inflate.h +2 -3
  53. data/vendor/libgit2/deps/zlib/inftrees.c +3 -3
  54. data/vendor/libgit2/deps/zlib/trees.c +48 -27
  55. data/vendor/libgit2/deps/zlib/zlib.h +100 -126
  56. data/vendor/libgit2/deps/zlib/zutil.c +2 -2
  57. data/vendor/libgit2/deps/zlib/zutil.h +9 -12
  58. data/vendor/libgit2/include/git2/apply.h +16 -2
  59. data/vendor/libgit2/include/git2/attr.h +11 -2
  60. data/vendor/libgit2/include/git2/blame.h +4 -1
  61. data/vendor/libgit2/include/git2/blob.h +14 -1
  62. data/vendor/libgit2/include/git2/branch.h +2 -0
  63. data/vendor/libgit2/include/git2/buffer.h +18 -78
  64. data/vendor/libgit2/include/git2/cert.h +2 -2
  65. data/vendor/libgit2/include/git2/checkout.h +5 -2
  66. data/vendor/libgit2/include/git2/clone.h +3 -3
  67. data/vendor/libgit2/include/git2/commit.h +2 -0
  68. data/vendor/libgit2/include/git2/common.h +5 -12
  69. data/vendor/libgit2/include/git2/config.h +19 -3
  70. data/vendor/libgit2/include/git2/credential.h +2 -1
  71. data/vendor/libgit2/include/git2/credential_helpers.h +1 -0
  72. data/vendor/libgit2/include/git2/deprecated.h +1 -1
  73. data/vendor/libgit2/include/git2/describe.h +7 -2
  74. data/vendor/libgit2/include/git2/diff.h +17 -9
  75. data/vendor/libgit2/include/git2/email.h +1 -1
  76. data/vendor/libgit2/include/git2/errors.h +1 -2
  77. data/vendor/libgit2/include/git2/filter.h +7 -2
  78. data/vendor/libgit2/include/git2/graph.h +1 -0
  79. data/vendor/libgit2/include/git2/ignore.h +1 -1
  80. data/vendor/libgit2/include/git2/index.h +11 -5
  81. data/vendor/libgit2/include/git2/indexer.h +19 -0
  82. data/vendor/libgit2/include/git2/merge.h +23 -3
  83. data/vendor/libgit2/include/git2/message.h +2 -0
  84. data/vendor/libgit2/include/git2/object.h +23 -0
  85. data/vendor/libgit2/include/git2/odb.h +37 -7
  86. data/vendor/libgit2/include/git2/odb_backend.h +1 -1
  87. data/vendor/libgit2/include/git2/pack.h +24 -8
  88. data/vendor/libgit2/include/git2/patch.h +8 -0
  89. data/vendor/libgit2/include/git2/pathspec.h +1 -1
  90. data/vendor/libgit2/include/git2/proxy.h +1 -1
  91. data/vendor/libgit2/include/git2/rebase.h +9 -1
  92. data/vendor/libgit2/include/git2/refdb.h +3 -0
  93. data/vendor/libgit2/include/git2/reflog.h +1 -1
  94. data/vendor/libgit2/include/git2/refs.h +2 -2
  95. data/vendor/libgit2/include/git2/remote.h +184 -37
  96. data/vendor/libgit2/include/git2/repository.h +14 -9
  97. data/vendor/libgit2/include/git2/reset.h +2 -2
  98. data/vendor/libgit2/include/git2/revparse.h +1 -1
  99. data/vendor/libgit2/include/git2/revwalk.h +4 -1
  100. data/vendor/libgit2/include/git2/signature.h +1 -1
  101. data/vendor/libgit2/include/git2/stash.h +3 -3
  102. data/vendor/libgit2/include/git2/status.h +9 -3
  103. data/vendor/libgit2/include/git2/submodule.h +7 -2
  104. data/vendor/libgit2/include/git2/sys/commit_graph.h +1 -1
  105. data/vendor/libgit2/include/git2/sys/odb_backend.h +2 -5
  106. data/vendor/libgit2/include/git2/sys/remote.h +31 -0
  107. data/vendor/libgit2/include/git2/sys/stream.h +1 -1
  108. data/vendor/libgit2/include/git2/sys/transport.h +25 -34
  109. data/vendor/libgit2/include/git2/tag.h +1 -0
  110. data/vendor/libgit2/include/git2/tree.h +4 -3
  111. data/vendor/libgit2/include/git2/types.h +7 -7
  112. data/vendor/libgit2/include/git2/version.h +3 -3
  113. data/vendor/libgit2/include/git2/worktree.h +12 -2
  114. data/vendor/libgit2/src/CMakeLists.txt +189 -315
  115. data/vendor/libgit2/src/annotated_commit.h +1 -1
  116. data/vendor/libgit2/src/apply.c +18 -18
  117. data/vendor/libgit2/src/apply.h +2 -2
  118. data/vendor/libgit2/src/attr.c +18 -18
  119. data/vendor/libgit2/src/attr_file.c +17 -17
  120. data/vendor/libgit2/src/attr_file.h +4 -4
  121. data/vendor/libgit2/src/attrcache.c +17 -12
  122. data/vendor/libgit2/src/blame_git.c +1 -1
  123. data/vendor/libgit2/src/blob.c +33 -26
  124. data/vendor/libgit2/src/blob.h +1 -1
  125. data/vendor/libgit2/src/branch.c +150 -109
  126. data/vendor/libgit2/src/branch.h +15 -3
  127. data/vendor/libgit2/src/buf.c +126 -0
  128. data/vendor/libgit2/src/buf.h +50 -0
  129. data/vendor/libgit2/src/cc-compat.h +1 -1
  130. data/vendor/libgit2/src/checkout.c +74 -68
  131. data/vendor/libgit2/src/cherrypick.c +10 -10
  132. data/vendor/libgit2/src/clone.c +66 -66
  133. data/vendor/libgit2/src/commit.c +128 -58
  134. data/vendor/libgit2/src/commit.h +24 -1
  135. data/vendor/libgit2/src/commit_graph.c +68 -53
  136. data/vendor/libgit2/src/commit_graph.h +10 -3
  137. data/vendor/libgit2/src/commit_list.c +2 -3
  138. data/vendor/libgit2/src/common.h +10 -3
  139. data/vendor/libgit2/src/config.c +99 -77
  140. data/vendor/libgit2/src/config.h +15 -2
  141. data/vendor/libgit2/src/config_file.c +103 -91
  142. data/vendor/libgit2/src/config_mem.c +9 -9
  143. data/vendor/libgit2/src/config_parse.c +27 -23
  144. data/vendor/libgit2/src/crlf.c +24 -21
  145. data/vendor/libgit2/src/date.c +10 -17
  146. data/vendor/libgit2/src/date.h +33 -0
  147. data/vendor/libgit2/src/describe.c +27 -19
  148. data/vendor/libgit2/src/diff.c +25 -8
  149. data/vendor/libgit2/src/diff.h +2 -4
  150. data/vendor/libgit2/src/diff_driver.c +34 -36
  151. data/vendor/libgit2/src/diff_driver.h +3 -3
  152. data/vendor/libgit2/src/diff_file.c +29 -20
  153. data/vendor/libgit2/src/diff_generate.c +30 -6
  154. data/vendor/libgit2/src/diff_generate.h +5 -3
  155. data/vendor/libgit2/src/diff_print.c +102 -95
  156. data/vendor/libgit2/src/diff_stats.c +40 -29
  157. data/vendor/libgit2/src/{message.h → diff_stats.h} +7 -6
  158. data/vendor/libgit2/src/diff_tform.c +9 -8
  159. data/vendor/libgit2/src/diff_xdiff.c +3 -8
  160. data/vendor/libgit2/src/email.c +54 -38
  161. data/vendor/libgit2/src/email.h +1 -1
  162. data/vendor/libgit2/src/errors.c +18 -18
  163. data/vendor/libgit2/src/features.h.in +6 -1
  164. data/vendor/libgit2/src/fetch.c +69 -24
  165. data/vendor/libgit2/src/fetch.h +1 -1
  166. data/vendor/libgit2/src/fetchhead.c +19 -19
  167. data/vendor/libgit2/src/filebuf.c +28 -28
  168. data/vendor/libgit2/src/filebuf.h +1 -1
  169. data/vendor/libgit2/src/filter.c +96 -52
  170. data/vendor/libgit2/src/filter.h +26 -5
  171. data/vendor/libgit2/src/fs_path.c +1912 -0
  172. data/vendor/libgit2/src/fs_path.h +752 -0
  173. data/vendor/libgit2/src/futils.c +91 -85
  174. data/vendor/libgit2/src/futils.h +26 -14
  175. data/vendor/libgit2/src/hash/sha1/collisiondetect.c +2 -2
  176. data/vendor/libgit2/src/hash/sha1/common_crypto.c +2 -2
  177. data/vendor/libgit2/src/hash/sha1/generic.c +2 -2
  178. data/vendor/libgit2/src/hash/sha1/mbedtls.c +2 -2
  179. data/vendor/libgit2/src/hash/sha1/openssl.c +2 -2
  180. data/vendor/libgit2/src/hash/sha1/sha1dc/sha1.c +1 -1
  181. data/vendor/libgit2/src/hash/sha1/win32.c +6 -6
  182. data/vendor/libgit2/src/hash/sha1.h +3 -1
  183. data/vendor/libgit2/src/hash.c +67 -35
  184. data/vendor/libgit2/src/hash.h +12 -12
  185. data/vendor/libgit2/src/ident.c +18 -18
  186. data/vendor/libgit2/src/ignore.c +35 -34
  187. data/vendor/libgit2/src/ignore.h +2 -2
  188. data/vendor/libgit2/src/index.c +79 -80
  189. data/vendor/libgit2/src/index.h +6 -3
  190. data/vendor/libgit2/src/indexer.c +75 -57
  191. data/vendor/libgit2/src/iterator.c +64 -56
  192. data/vendor/libgit2/src/iterator.h +5 -5
  193. data/vendor/libgit2/src/khash.h +1 -1
  194. data/vendor/libgit2/src/libgit2.c +22 -19
  195. data/vendor/libgit2/src/mailmap.c +38 -36
  196. data/vendor/libgit2/src/merge.c +27 -27
  197. data/vendor/libgit2/src/merge.h +1 -14
  198. data/vendor/libgit2/src/merge_driver.c +2 -2
  199. data/vendor/libgit2/src/merge_file.c +13 -3
  200. data/vendor/libgit2/src/message.c +21 -10
  201. data/vendor/libgit2/src/midx.c +83 -66
  202. data/vendor/libgit2/src/midx.h +3 -3
  203. data/vendor/libgit2/src/mwindow.c +1 -1
  204. data/vendor/libgit2/src/net.c +278 -68
  205. data/vendor/libgit2/src/net.h +10 -3
  206. data/vendor/libgit2/src/netops.c +1 -1
  207. data/vendor/libgit2/src/netops.h +1 -1
  208. data/vendor/libgit2/src/notes.c +20 -29
  209. data/vendor/libgit2/src/object.c +49 -9
  210. data/vendor/libgit2/src/object.h +1 -1
  211. data/vendor/libgit2/src/odb.c +35 -32
  212. data/vendor/libgit2/src/odb.h +1 -1
  213. data/vendor/libgit2/src/odb_loose.c +68 -68
  214. data/vendor/libgit2/src/odb_mempack.c +18 -5
  215. data/vendor/libgit2/src/odb_pack.c +43 -43
  216. data/vendor/libgit2/src/oid.c +11 -4
  217. data/vendor/libgit2/src/oid.h +15 -0
  218. data/vendor/libgit2/src/pack-objects.c +41 -26
  219. data/vendor/libgit2/src/pack-objects.h +11 -6
  220. data/vendor/libgit2/src/pack.c +10 -10
  221. data/vendor/libgit2/src/patch.c +3 -3
  222. data/vendor/libgit2/src/patch.h +1 -0
  223. data/vendor/libgit2/src/patch_generate.c +27 -11
  224. data/vendor/libgit2/src/patch_generate.h +5 -5
  225. data/vendor/libgit2/src/patch_parse.c +24 -24
  226. data/vendor/libgit2/src/path.c +76 -1951
  227. data/vendor/libgit2/src/path.h +34 -741
  228. data/vendor/libgit2/src/pathspec.c +6 -6
  229. data/vendor/libgit2/src/pathspec.h +2 -2
  230. data/vendor/libgit2/src/posix.c +3 -3
  231. data/vendor/libgit2/src/posix.h +1 -0
  232. data/vendor/libgit2/src/pqueue.h +1 -1
  233. data/vendor/libgit2/src/proxy.c +4 -1
  234. data/vendor/libgit2/src/proxy.h +1 -1
  235. data/vendor/libgit2/src/push.c +30 -35
  236. data/vendor/libgit2/src/push.h +4 -16
  237. data/vendor/libgit2/src/rand.c +226 -0
  238. data/vendor/libgit2/src/rand.h +37 -0
  239. data/vendor/libgit2/src/reader.c +8 -8
  240. data/vendor/libgit2/src/reader.h +2 -2
  241. data/vendor/libgit2/src/rebase.c +89 -88
  242. data/vendor/libgit2/src/refdb_fs.c +447 -173
  243. data/vendor/libgit2/src/refs.c +32 -32
  244. data/vendor/libgit2/src/refs.h +2 -2
  245. data/vendor/libgit2/src/refspec.c +32 -37
  246. data/vendor/libgit2/src/refspec.h +5 -2
  247. data/vendor/libgit2/src/regexp.c +1 -1
  248. data/vendor/libgit2/src/remote.c +713 -419
  249. data/vendor/libgit2/src/remote.h +15 -10
  250. data/vendor/libgit2/src/repository.c +350 -467
  251. data/vendor/libgit2/src/repository.h +11 -10
  252. data/vendor/libgit2/src/reset.c +8 -5
  253. data/vendor/libgit2/src/revert.c +10 -10
  254. data/vendor/libgit2/src/revparse.c +48 -35
  255. data/vendor/libgit2/src/revwalk.c +7 -7
  256. data/vendor/libgit2/src/signature.c +12 -6
  257. data/vendor/libgit2/src/signature.h +1 -1
  258. data/vendor/libgit2/src/sortedcache.c +1 -1
  259. data/vendor/libgit2/src/sortedcache.h +1 -1
  260. data/vendor/libgit2/src/stash.c +36 -37
  261. data/vendor/libgit2/src/status.c +4 -1
  262. data/vendor/libgit2/src/{buffer.c → str.c} +157 -151
  263. data/vendor/libgit2/src/str.h +357 -0
  264. data/vendor/libgit2/src/streams/mbedtls.c +8 -6
  265. data/vendor/libgit2/src/streams/openssl_dynamic.h +3 -3
  266. data/vendor/libgit2/src/submodule.c +171 -159
  267. data/vendor/libgit2/src/submodule.h +1 -1
  268. data/vendor/libgit2/src/sysdir.c +68 -52
  269. data/vendor/libgit2/src/sysdir.h +15 -10
  270. data/vendor/libgit2/src/tag.c +29 -27
  271. data/vendor/libgit2/src/thread.h +3 -3
  272. data/vendor/libgit2/src/threadstate.c +3 -3
  273. data/vendor/libgit2/src/threadstate.h +1 -1
  274. data/vendor/libgit2/src/trace.c +1 -14
  275. data/vendor/libgit2/src/trace.h +5 -22
  276. data/vendor/libgit2/src/trailer.c +1 -1
  277. data/vendor/libgit2/src/transaction.c +1 -1
  278. data/vendor/libgit2/src/transport.c +10 -10
  279. data/vendor/libgit2/src/transports/auth.c +7 -9
  280. data/vendor/libgit2/src/transports/auth.h +2 -3
  281. data/vendor/libgit2/src/transports/auth_negotiate.c +12 -13
  282. data/vendor/libgit2/src/transports/auth_ntlm.c +10 -10
  283. data/vendor/libgit2/src/transports/auth_ntlm.h +0 -1
  284. data/vendor/libgit2/src/transports/git.c +9 -11
  285. data/vendor/libgit2/src/transports/http.c +37 -17
  286. data/vendor/libgit2/src/transports/http.h +2 -3
  287. data/vendor/libgit2/src/transports/httpclient.c +65 -65
  288. data/vendor/libgit2/src/transports/local.c +124 -116
  289. data/vendor/libgit2/src/transports/smart.c +51 -139
  290. data/vendor/libgit2/src/transports/smart.h +25 -31
  291. data/vendor/libgit2/src/transports/smart_pkt.c +33 -33
  292. data/vendor/libgit2/src/transports/smart_protocol.c +57 -39
  293. data/vendor/libgit2/src/transports/ssh.c +47 -112
  294. data/vendor/libgit2/src/transports/winhttp.c +50 -56
  295. data/vendor/libgit2/src/tree-cache.c +5 -5
  296. data/vendor/libgit2/src/tree-cache.h +2 -2
  297. data/vendor/libgit2/src/tree.c +59 -48
  298. data/vendor/libgit2/src/tree.h +1 -1
  299. data/vendor/libgit2/src/unix/map.c +0 -2
  300. data/vendor/libgit2/src/unix/posix.h +1 -4
  301. data/vendor/libgit2/src/unix/realpath.c +0 -2
  302. data/vendor/libgit2/src/util.c +14 -14
  303. data/vendor/libgit2/src/util.h +2 -28
  304. data/vendor/libgit2/src/vector.h +1 -1
  305. data/vendor/libgit2/src/win32/findfile.c +172 -116
  306. data/vendor/libgit2/src/win32/findfile.h +7 -4
  307. data/vendor/libgit2/src/win32/path_w32.c +140 -9
  308. data/vendor/libgit2/src/win32/path_w32.h +2 -0
  309. data/vendor/libgit2/src/win32/posix.h +0 -1
  310. data/vendor/libgit2/src/win32/posix_w32.c +11 -27
  311. data/vendor/libgit2/src/win32/w32_buffer.c +2 -3
  312. data/vendor/libgit2/src/win32/w32_buffer.h +2 -3
  313. data/vendor/libgit2/src/win32/w32_leakcheck.c +1 -1
  314. data/vendor/libgit2/src/worktree.c +116 -94
  315. data/vendor/libgit2/src/worktree.h +1 -1
  316. data/vendor/libgit2/src/xdiff/git-xdiff.h +53 -0
  317. data/vendor/libgit2/src/xdiff/xdiff.h +15 -15
  318. data/vendor/libgit2/src/xdiff/xdiffi.c +134 -108
  319. data/vendor/libgit2/src/xdiff/xemit.c +23 -7
  320. data/vendor/libgit2/src/xdiff/xhistogram.c +87 -78
  321. data/vendor/libgit2/src/xdiff/xinclude.h +1 -12
  322. data/vendor/libgit2/src/xdiff/xmerge.c +104 -117
  323. data/vendor/libgit2/src/xdiff/xpatience.c +6 -17
  324. data/vendor/libgit2/src/xdiff/xprepare.c +15 -20
  325. data/vendor/libgit2/src/xdiff/xutils.c +18 -7
  326. data/vendor/libgit2/src/zstream.c +5 -5
  327. data/vendor/libgit2/src/zstream.h +4 -4
  328. metadata +25 -10
  329. data/vendor/libgit2/src/buffer.h +0 -374
@@ -11,8 +11,8 @@
11
11
 
12
12
  #include "git2.h"
13
13
  #include "git2/transport.h"
14
- #include "buffer.h"
15
14
  #include "posix.h"
15
+ #include "str.h"
16
16
  #include "netops.h"
17
17
  #include "smart.h"
18
18
  #include "remote.h"
@@ -99,7 +99,7 @@ typedef enum {
99
99
  GIT_WINHTTP_AUTH_BASIC = 1,
100
100
  GIT_WINHTTP_AUTH_NTLM = 2,
101
101
  GIT_WINHTTP_AUTH_NEGOTIATE = 4,
102
- GIT_WINHTTP_AUTH_DIGEST = 8,
102
+ GIT_WINHTTP_AUTH_DIGEST = 8
103
103
  } winhttp_authmechanism_t;
104
104
 
105
105
  typedef struct {
@@ -293,14 +293,14 @@ static int certificate_check(winhttp_stream *s, int valid)
293
293
  git_cert_x509 cert;
294
294
 
295
295
  /* If there is no override, we should fail if WinHTTP doesn't think it's fine */
296
- if (t->owner->certificate_check_cb == NULL && !valid) {
296
+ if (t->owner->connect_opts.callbacks.certificate_check == NULL && !valid) {
297
297
  if (!git_error_last())
298
298
  git_error_set(GIT_ERROR_HTTP, "unknown certificate check failure");
299
299
 
300
300
  return GIT_ECERTIFICATE;
301
301
  }
302
302
 
303
- if (t->owner->certificate_check_cb == NULL || git__strcmp(t->server.url.scheme, "https") != 0)
303
+ if (t->owner->connect_opts.callbacks.certificate_check == NULL || git__strcmp(t->server.url.scheme, "https") != 0)
304
304
  return 0;
305
305
 
306
306
  if (!WinHttpQueryOption(s->request, WINHTTP_OPTION_SERVER_CERT_CONTEXT, &cert_ctx, &cert_ctx_size)) {
@@ -312,7 +312,7 @@ static int certificate_check(winhttp_stream *s, int valid)
312
312
  cert.parent.cert_type = GIT_CERT_X509;
313
313
  cert.data = cert_ctx->pbCertEncoded;
314
314
  cert.len = cert_ctx->cbCertEncoded;
315
- error = t->owner->certificate_check_cb((git_cert *) &cert, valid, t->server.url.host, t->owner->message_cb_payload);
315
+ error = t->owner->connect_opts.callbacks.certificate_check((git_cert *) &cert, valid, t->server.url.host, t->owner->connect_opts.callbacks.payload);
316
316
  CertFreeCertificateContext(cert_ctx);
317
317
 
318
318
  if (error == GIT_PASSTHROUGH)
@@ -372,7 +372,7 @@ static int apply_credentials(
372
372
  static int winhttp_stream_connect(winhttp_stream *s)
373
373
  {
374
374
  winhttp_subtransport *t = OWNING_SUBTRANSPORT(s);
375
- git_buf buf = GIT_BUF_INIT;
375
+ git_str buf = GIT_STR_INIT;
376
376
  char *proxy_url = NULL;
377
377
  wchar_t ct[MAX_CONTENT_TYPE_LEN];
378
378
  LPCWSTR types[] = { L"*/*", NULL };
@@ -391,13 +391,13 @@ static int winhttp_stream_connect(winhttp_stream *s)
391
391
  if ((git__suffixcmp(t->server.url.path, "/") == 0) && (git__prefixcmp(service_url, "/") == 0))
392
392
  service_url++;
393
393
  /* Prepare URL */
394
- git_buf_printf(&buf, "%s%s", t->server.url.path, service_url);
394
+ git_str_printf(&buf, "%s%s", t->server.url.path, service_url);
395
395
 
396
- if (git_buf_oom(&buf))
396
+ if (git_str_oom(&buf))
397
397
  return -1;
398
398
 
399
399
  /* Convert URL to wide characters */
400
- if (git__utf8_to_16_alloc(&s->request_uri, git_buf_cstr(&buf)) < 0) {
400
+ if (git__utf8_to_16_alloc(&s->request_uri, git_str_cstr(&buf)) < 0) {
401
401
  git_error_set(GIT_ERROR_OS, "failed to convert string to wide form");
402
402
  goto on_error;
403
403
  }
@@ -426,7 +426,7 @@ static int winhttp_stream_connect(winhttp_stream *s)
426
426
  goto on_error;
427
427
  }
428
428
 
429
- proxy_opts = &t->owner->proxy;
429
+ proxy_opts = &t->owner->connect_opts.proxy_opts;
430
430
  if (proxy_opts->type == GIT_PROXY_AUTO) {
431
431
  /* Set proxy if necessary */
432
432
  if (git_remote__http_proxy(&proxy_url, t->owner->owner, &t->server.url) < 0)
@@ -438,7 +438,7 @@ static int winhttp_stream_connect(winhttp_stream *s)
438
438
  }
439
439
 
440
440
  if (proxy_url) {
441
- git_buf processed_url = GIT_BUF_INIT;
441
+ git_str processed_url = GIT_STR_INIT;
442
442
  WINHTTP_PROXY_INFO proxy_info;
443
443
  wchar_t *proxy_wide;
444
444
 
@@ -453,28 +453,28 @@ static int winhttp_stream_connect(winhttp_stream *s)
453
453
  goto on_error;
454
454
  }
455
455
 
456
- git_buf_puts(&processed_url, t->proxy.url.scheme);
457
- git_buf_PUTS(&processed_url, "://");
456
+ git_str_puts(&processed_url, t->proxy.url.scheme);
457
+ git_str_PUTS(&processed_url, "://");
458
458
 
459
459
  if (git_net_url_is_ipv6(&t->proxy.url))
460
- git_buf_putc(&processed_url, '[');
460
+ git_str_putc(&processed_url, '[');
461
461
 
462
- git_buf_puts(&processed_url, t->proxy.url.host);
462
+ git_str_puts(&processed_url, t->proxy.url.host);
463
463
 
464
464
  if (git_net_url_is_ipv6(&t->proxy.url))
465
- git_buf_putc(&processed_url, ']');
465
+ git_str_putc(&processed_url, ']');
466
466
 
467
467
  if (!git_net_url_is_default_port(&t->proxy.url))
468
- git_buf_printf(&processed_url, ":%s", t->proxy.url.port);
468
+ git_str_printf(&processed_url, ":%s", t->proxy.url.port);
469
469
 
470
- if (git_buf_oom(&processed_url)) {
470
+ if (git_str_oom(&processed_url)) {
471
471
  error = -1;
472
472
  goto on_error;
473
473
  }
474
474
 
475
475
  /* Convert URL to wide characters */
476
476
  error = git__utf8_to_16_alloc(&proxy_wide, processed_url.ptr);
477
- git_buf_dispose(&processed_url);
477
+ git_str_dispose(&processed_url);
478
478
  if (error < 0)
479
479
  goto on_error;
480
480
 
@@ -525,13 +525,13 @@ static int winhttp_stream_connect(winhttp_stream *s)
525
525
 
526
526
  if (post_verb == s->verb) {
527
527
  /* Send Content-Type and Accept headers -- only necessary on a POST */
528
- git_buf_clear(&buf);
529
- if (git_buf_printf(&buf,
528
+ git_str_clear(&buf);
529
+ if (git_str_printf(&buf,
530
530
  "Content-Type: application/x-git-%s-request",
531
531
  s->service) < 0)
532
532
  goto on_error;
533
533
 
534
- if (git__utf8_to_16(ct, MAX_CONTENT_TYPE_LEN, git_buf_cstr(&buf)) < 0) {
534
+ if (git__utf8_to_16(ct, MAX_CONTENT_TYPE_LEN, git_str_cstr(&buf)) < 0) {
535
535
  git_error_set(GIT_ERROR_OS, "failed to convert content-type to wide characters");
536
536
  goto on_error;
537
537
  }
@@ -542,13 +542,13 @@ static int winhttp_stream_connect(winhttp_stream *s)
542
542
  goto on_error;
543
543
  }
544
544
 
545
- git_buf_clear(&buf);
546
- if (git_buf_printf(&buf,
545
+ git_str_clear(&buf);
546
+ if (git_str_printf(&buf,
547
547
  "Accept: application/x-git-%s-result",
548
548
  s->service) < 0)
549
549
  goto on_error;
550
550
 
551
- if (git__utf8_to_16(ct, MAX_CONTENT_TYPE_LEN, git_buf_cstr(&buf)) < 0) {
551
+ if (git__utf8_to_16(ct, MAX_CONTENT_TYPE_LEN, git_str_cstr(&buf)) < 0) {
552
552
  git_error_set(GIT_ERROR_OS, "failed to convert accept header to wide characters");
553
553
  goto on_error;
554
554
  }
@@ -560,11 +560,11 @@ static int winhttp_stream_connect(winhttp_stream *s)
560
560
  }
561
561
  }
562
562
 
563
- for (i = 0; i < t->owner->custom_headers.count; i++) {
564
- if (t->owner->custom_headers.strings[i]) {
565
- git_buf_clear(&buf);
566
- git_buf_puts(&buf, t->owner->custom_headers.strings[i]);
567
- if (git__utf8_to_16(ct, MAX_CONTENT_TYPE_LEN, git_buf_cstr(&buf)) < 0) {
563
+ for (i = 0; i < t->owner->connect_opts.custom_headers.count; i++) {
564
+ if (t->owner->connect_opts.custom_headers.strings[i]) {
565
+ git_str_clear(&buf);
566
+ git_str_puts(&buf, t->owner->connect_opts.custom_headers.strings[i]);
567
+ if (git__utf8_to_16(ct, MAX_CONTENT_TYPE_LEN, git_str_cstr(&buf)) < 0) {
568
568
  git_error_set(GIT_ERROR_OS, "failed to convert custom header to wide characters");
569
569
  goto on_error;
570
570
  }
@@ -577,14 +577,6 @@ static int winhttp_stream_connect(winhttp_stream *s)
577
577
  }
578
578
  }
579
579
 
580
- /* If requested, disable certificate validation */
581
- if (strcmp(t->server.url.scheme, "https") == 0) {
582
- int flags;
583
-
584
- if (t->owner->parent.read_flags(&t->owner->parent, &flags) < 0)
585
- goto on_error;
586
- }
587
-
588
580
  if ((error = apply_credentials(s->request, &t->server.url, WINHTTP_AUTH_TARGET_SERVER, t->server.cred, t->server.auth_mechanisms)) < 0)
589
581
  goto on_error;
590
582
 
@@ -597,7 +589,7 @@ on_error:
597
589
  winhttp_stream_close(s);
598
590
 
599
591
  git__free(proxy_url);
600
- git_buf_dispose(&buf);
592
+ git_str_dispose(&buf);
601
593
  return error;
602
594
  }
603
595
 
@@ -646,23 +638,23 @@ static int parse_unauthorized_response(
646
638
  static int write_chunk(HINTERNET request, const char *buffer, size_t len)
647
639
  {
648
640
  DWORD bytes_written;
649
- git_buf buf = GIT_BUF_INIT;
641
+ git_str buf = GIT_STR_INIT;
650
642
 
651
643
  /* Chunk header */
652
- git_buf_printf(&buf, "%"PRIXZ"\r\n", len);
644
+ git_str_printf(&buf, "%"PRIXZ"\r\n", len);
653
645
 
654
- if (git_buf_oom(&buf))
646
+ if (git_str_oom(&buf))
655
647
  return -1;
656
648
 
657
649
  if (!WinHttpWriteData(request,
658
- git_buf_cstr(&buf), (DWORD)git_buf_len(&buf),
650
+ git_str_cstr(&buf), (DWORD)git_str_len(&buf),
659
651
  &bytes_written)) {
660
- git_buf_dispose(&buf);
652
+ git_str_dispose(&buf);
661
653
  git_error_set(GIT_ERROR_OS, "failed to write chunk header");
662
654
  return -1;
663
655
  }
664
656
 
665
- git_buf_dispose(&buf);
657
+ git_str_dispose(&buf);
666
658
 
667
659
  /* Chunk body */
668
660
  if (!WinHttpWriteData(request,
@@ -756,7 +748,7 @@ static int winhttp_connect(
756
748
  wchar_t *wide_host = NULL;
757
749
  int32_t port;
758
750
  wchar_t *wide_ua = NULL;
759
- git_buf ipv6 = GIT_BUF_INIT, ua = GIT_BUF_INIT;
751
+ git_str ipv6 = GIT_STR_INIT, ua = GIT_STR_INIT;
760
752
  const char *host;
761
753
  int error = -1;
762
754
  int default_timeout = TIMEOUT_INFINITE;
@@ -777,7 +769,7 @@ static int winhttp_connect(
777
769
 
778
770
  /* IPv6? Add braces around the host. */
779
771
  if (git_net_url_is_ipv6(&t->server.url)) {
780
- if (git_buf_printf(&ipv6, "[%s]", t->server.url.host) < 0)
772
+ if (git_str_printf(&ipv6, "[%s]", t->server.url.host) < 0)
781
773
  goto on_error;
782
774
 
783
775
  host = ipv6.ptr;
@@ -795,7 +787,7 @@ static int winhttp_connect(
795
787
  if (git_http__user_agent(&ua) < 0)
796
788
  goto on_error;
797
789
 
798
- if (git__utf8_to_16_alloc(&wide_ua, git_buf_cstr(&ua)) < 0) {
790
+ if (git__utf8_to_16_alloc(&wide_ua, git_str_cstr(&ua)) < 0) {
799
791
  git_error_set(GIT_ERROR_OS, "unable to convert host to wide characters");
800
792
  goto on_error;
801
793
  }
@@ -863,8 +855,8 @@ on_error:
863
855
  if (error < 0)
864
856
  winhttp_close_connection(t);
865
857
 
866
- git_buf_dispose(&ua);
867
- git_buf_dispose(&ipv6);
858
+ git_str_dispose(&ua);
859
+ git_str_dispose(&ipv6);
868
860
  git__free(wide_host);
869
861
  git__free(wide_ua);
870
862
 
@@ -1197,8 +1189,10 @@ replay:
1197
1189
  winhttp_stream_close(s);
1198
1190
 
1199
1191
  if (!git__prefixcmp_icase(location8, prefix_https)) {
1192
+ bool follow = (t->owner->connect_opts.follow_redirects != GIT_REMOTE_REDIRECT_NONE);
1193
+
1200
1194
  /* Upgrade to secure connection; disconnect and start over */
1201
- if (git_net_url_apply_redirect(&t->server.url, location8, s->service_url) < 0) {
1195
+ if (git_net_url_apply_redirect(&t->server.url, location8, follow, s->service_url) < 0) {
1202
1196
  git__free(location8);
1203
1197
  return -1;
1204
1198
  }
@@ -1218,8 +1212,8 @@ replay:
1218
1212
  int error = acquire_credentials(s->request,
1219
1213
  &t->server,
1220
1214
  t->owner->url,
1221
- t->owner->cred_acquire_cb,
1222
- t->owner->cred_acquire_payload);
1215
+ t->owner->connect_opts.callbacks.credentials,
1216
+ t->owner->connect_opts.callbacks.payload);
1223
1217
 
1224
1218
  if (error < 0) {
1225
1219
  return error;
@@ -1231,9 +1225,9 @@ replay:
1231
1225
  } else if (status_code == HTTP_STATUS_PROXY_AUTH_REQ) {
1232
1226
  int error = acquire_credentials(s->request,
1233
1227
  &t->proxy,
1234
- t->owner->proxy.url,
1235
- t->owner->proxy.credentials,
1236
- t->owner->proxy.payload);
1228
+ t->owner->connect_opts.proxy_opts.url,
1229
+ t->owner->connect_opts.proxy_opts.credentials,
1230
+ t->owner->connect_opts.proxy_opts.payload);
1237
1231
 
1238
1232
  if (error < 0) {
1239
1233
  return error;
@@ -256,22 +256,22 @@ int git_tree_cache_new(git_tree_cache **out, const char *name, git_pool *pool)
256
256
  return 0;
257
257
  }
258
258
 
259
- static void write_tree(git_buf *out, git_tree_cache *tree)
259
+ static void write_tree(git_str *out, git_tree_cache *tree)
260
260
  {
261
261
  size_t i;
262
262
 
263
- git_buf_printf(out, "%s%c%"PRIdZ" %"PRIuZ"\n", tree->name, 0, tree->entry_count, tree->children_count);
263
+ git_str_printf(out, "%s%c%"PRIdZ" %"PRIuZ"\n", tree->name, 0, tree->entry_count, tree->children_count);
264
264
 
265
265
  if (tree->entry_count != -1)
266
- git_buf_put(out, (const char *) &tree->oid, GIT_OID_RAWSZ);
266
+ git_str_put(out, (const char *) &tree->oid, GIT_OID_RAWSZ);
267
267
 
268
268
  for (i = 0; i < tree->children_count; i++)
269
269
  write_tree(out, tree->children[i]);
270
270
  }
271
271
 
272
- int git_tree_cache_write(git_buf *out, git_tree_cache *tree)
272
+ int git_tree_cache_write(git_str *out, git_tree_cache *tree)
273
273
  {
274
274
  write_tree(out, tree);
275
275
 
276
- return git_buf_oom(out) ? -1 : 0;
276
+ return git_str_oom(out) ? -1 : 0;
277
277
  }
@@ -11,7 +11,7 @@
11
11
  #include "common.h"
12
12
 
13
13
  #include "pool.h"
14
- #include "buffer.h"
14
+ #include "str.h"
15
15
  #include "git2/oid.h"
16
16
 
17
17
  typedef struct git_tree_cache {
@@ -24,7 +24,7 @@ typedef struct git_tree_cache {
24
24
  char name[GIT_FLEX_ARRAY];
25
25
  } git_tree_cache;
26
26
 
27
- int git_tree_cache_write(git_buf *out, git_tree_cache *tree);
27
+ int git_tree_cache_write(git_str *out, git_tree_cache *tree);
28
28
  int git_tree_cache_read(git_tree_cache **tree, const char *buffer, size_t buffer_size, git_pool *pool);
29
29
  void git_tree_cache_invalidate_path(git_tree_cache *tree, const char *path);
30
30
  const git_tree_cache *git_tree_cache_get(const git_tree_cache *tree, const char *path);
@@ -13,6 +13,7 @@
13
13
  #include "futils.h"
14
14
  #include "tree-cache.h"
15
15
  #include "index.h"
16
+ #include "path.h"
16
17
 
17
18
  #define DEFAULT_TREE_SIZE 16
18
19
  #define MAX_FILEMODE_BYTES 6
@@ -54,8 +55,8 @@ GIT_INLINE(git_filemode_t) normalize_filemode(git_filemode_t filemode)
54
55
  static int valid_entry_name(git_repository *repo, const char *filename)
55
56
  {
56
57
  return *filename != '\0' &&
57
- git_path_validate(repo, filename, 0,
58
- GIT_PATH_REJECT_TRAVERSAL | GIT_PATH_REJECT_DOT_GIT | GIT_PATH_REJECT_SLASH);
58
+ git_path_is_valid(repo, filename, 0,
59
+ GIT_FS_PATH_REJECT_TRAVERSAL | GIT_PATH_REJECT_DOT_GIT | GIT_FS_PATH_REJECT_SLASH);
59
60
  }
60
61
 
61
62
  static int entry_sort_cmp(const void *a, const void *b)
@@ -63,7 +64,7 @@ static int entry_sort_cmp(const void *a, const void *b)
63
64
  const git_tree_entry *e1 = (const git_tree_entry *)a;
64
65
  const git_tree_entry *e2 = (const git_tree_entry *)b;
65
66
 
66
- return git_path_cmp(
67
+ return git_fs_path_cmp(
67
68
  e1->filename, e1->filename_len, git_tree_entry__is_tree(e1),
68
69
  e2->filename, e2->filename_len, git_tree_entry__is_tree(e2),
69
70
  git__strncmp);
@@ -350,15 +351,26 @@ size_t git_treebuilder_entrycount(git_treebuilder *bld)
350
351
  return git_strmap_size(bld->map);
351
352
  }
352
353
 
353
- static int tree_error(const char *str, const char *path)
354
+ GIT_INLINE(void) set_error(const char *str, const char *path)
354
355
  {
355
356
  if (path)
356
357
  git_error_set(GIT_ERROR_TREE, "%s - %s", str, path);
357
358
  else
358
359
  git_error_set(GIT_ERROR_TREE, "%s", str);
360
+ }
361
+
362
+ static int tree_error(const char *str, const char *path)
363
+ {
364
+ set_error(str, path);
359
365
  return -1;
360
366
  }
361
367
 
368
+ static int tree_parse_error(const char *str, const char *path)
369
+ {
370
+ set_error(str, path);
371
+ return GIT_EINVALID;
372
+ }
373
+
362
374
  static int parse_mode(uint16_t *mode_out, const char *buffer, size_t buffer_len, const char **buffer_out)
363
375
  {
364
376
  int32_t mode;
@@ -398,19 +410,19 @@ int git_tree__parse_raw(void *_tree, const char *data, size_t size)
398
410
  uint16_t attr;
399
411
 
400
412
  if (parse_mode(&attr, buffer, buffer_end - buffer, &buffer) < 0 || !buffer)
401
- return tree_error("failed to parse tree: can't parse filemode", NULL);
413
+ return tree_parse_error("failed to parse tree: can't parse filemode", NULL);
402
414
 
403
415
  if (buffer >= buffer_end || (*buffer++) != ' ')
404
- return tree_error("failed to parse tree: missing space after filemode", NULL);
416
+ return tree_parse_error("failed to parse tree: missing space after filemode", NULL);
405
417
 
406
418
  if ((nul = memchr(buffer, 0, buffer_end - buffer)) == NULL)
407
- return tree_error("failed to parse tree: object is corrupted", NULL);
419
+ return tree_parse_error("failed to parse tree: object is corrupted", NULL);
408
420
 
409
421
  if ((filename_len = nul - buffer) == 0 || filename_len > UINT16_MAX)
410
- return tree_error("failed to parse tree: can't parse filename", NULL);
422
+ return tree_parse_error("failed to parse tree: can't parse filename", NULL);
411
423
 
412
424
  if ((buffer_end - (nul + 1)) < GIT_OID_RAWSZ)
413
- return tree_error("failed to parse tree: can't parse OID", NULL);
425
+ return tree_parse_error("failed to parse tree: can't parse OID", NULL);
414
426
 
415
427
  /* Allocate the entry */
416
428
  {
@@ -433,16 +445,15 @@ int git_tree__parse_raw(void *_tree, const char *data, size_t size)
433
445
  int git_tree__parse(void *_tree, git_odb_object *odb_obj)
434
446
  {
435
447
  git_tree *tree = _tree;
448
+ const char *data = git_odb_object_data(odb_obj);
449
+ size_t size = git_odb_object_size(odb_obj);
450
+ int error;
436
451
 
437
- if ((git_tree__parse_raw(tree,
438
- git_odb_object_data(odb_obj),
439
- git_odb_object_size(odb_obj))) < 0)
440
- return -1;
441
-
442
- if (git_odb_object_dup(&tree->odb_obj, odb_obj) < 0)
443
- return -1;
452
+ if ((error = git_tree__parse_raw(tree, data, size)) < 0 ||
453
+ (error = git_odb_object_dup(&tree->odb_obj, odb_obj)) < 0)
454
+ return error;
444
455
 
445
- return 0;
456
+ return error;
446
457
  }
447
458
 
448
459
  static size_t find_next_dir(const char *dirname, git_index *index, size_t start)
@@ -495,7 +506,7 @@ static int check_entry(git_repository *repo, const char *filename, const git_oid
495
506
  static int git_treebuilder__write_with_buffer(
496
507
  git_oid *oid,
497
508
  git_treebuilder *bld,
498
- git_buf *buf)
509
+ git_str *buf)
499
510
  {
500
511
  int error = 0;
501
512
  size_t i, entrycount;
@@ -503,14 +514,14 @@ static int git_treebuilder__write_with_buffer(
503
514
  git_tree_entry *entry;
504
515
  git_vector entries = GIT_VECTOR_INIT;
505
516
 
506
- git_buf_clear(buf);
517
+ git_str_clear(buf);
507
518
 
508
519
  entrycount = git_strmap_size(bld->map);
509
520
  if ((error = git_vector_init(&entries, entrycount, entry_sort_cmp)) < 0)
510
521
  goto out;
511
522
 
512
523
  if (buf->asize == 0 &&
513
- (error = git_buf_grow(buf, entrycount * 72)) < 0)
524
+ (error = git_str_grow(buf, entrycount * 72)) < 0)
514
525
  goto out;
515
526
 
516
527
  git_strmap_foreach_value(bld->map, entry, {
@@ -523,11 +534,11 @@ static int git_treebuilder__write_with_buffer(
523
534
  for (i = 0; i < entries.length && !error; ++i) {
524
535
  entry = git_vector_get(&entries, i);
525
536
 
526
- git_buf_printf(buf, "%o ", entry->attr);
527
- git_buf_put(buf, entry->filename, entry->filename_len + 1);
528
- git_buf_put(buf, (char *)entry->oid->id, GIT_OID_RAWSZ);
537
+ git_str_printf(buf, "%o ", entry->attr);
538
+ git_str_put(buf, entry->filename, entry->filename_len + 1);
539
+ git_str_put(buf, (char *)entry->oid->id, GIT_OID_RAWSZ);
529
540
 
530
- if (git_buf_oom(buf)) {
541
+ if (git_str_oom(buf)) {
531
542
  error = -1;
532
543
  goto out;
533
544
  }
@@ -575,7 +586,7 @@ static int write_tree(
575
586
  git_index *index,
576
587
  const char *dirname,
577
588
  size_t start,
578
- git_buf *shared_buf)
589
+ git_str *shared_buf)
579
590
  {
580
591
  git_treebuilder *bld = NULL;
581
592
  size_t i, entries = git_index_entrycount(index);
@@ -594,7 +605,7 @@ static int write_tree(
594
605
 
595
606
  /*
596
607
  * This loop is unfortunate, but necessary. The index doesn't have
597
- * any directores, so we need to handle that manually, and we
608
+ * any directories, so we need to handle that manually, and we
598
609
  * need to keep track of the current position.
599
610
  */
600
611
  for (i = start; i < entries; ++i) {
@@ -676,7 +687,7 @@ int git_tree__write_index(
676
687
  {
677
688
  int ret;
678
689
  git_tree *tree;
679
- git_buf shared_buf = GIT_BUF_INIT;
690
+ git_str shared_buf = GIT_STR_INIT;
680
691
  bool old_ignore_case = false;
681
692
 
682
693
  GIT_ASSERT_ARG(oid);
@@ -705,7 +716,7 @@ int git_tree__write_index(
705
716
  }
706
717
 
707
718
  ret = write_tree(oid, repo, index, "", 0, &shared_buf);
708
- git_buf_dispose(&shared_buf);
719
+ git_str_dispose(&shared_buf);
709
720
 
710
721
  if (old_ignore_case)
711
722
  git_index__set_ignore_case(index, true);
@@ -879,7 +890,7 @@ void git_treebuilder_free(git_treebuilder *bld)
879
890
  if (bld == NULL)
880
891
  return;
881
892
 
882
- git_buf_dispose(&bld->write_cache);
893
+ git_str_dispose(&bld->write_cache);
883
894
  git_treebuilder_clear(bld);
884
895
  git_strmap_free(bld->map);
885
896
  git__free(bld);
@@ -959,7 +970,7 @@ int git_tree_entry_bypath(
959
970
  static int tree_walk(
960
971
  const git_tree *tree,
961
972
  git_treewalk_cb callback,
962
- git_buf *path,
973
+ git_str *path,
963
974
  void *payload,
964
975
  bool preorder)
965
976
  {
@@ -982,17 +993,17 @@ static int tree_walk(
982
993
 
983
994
  if (git_tree_entry__is_tree(entry)) {
984
995
  git_tree *subtree;
985
- size_t path_len = git_buf_len(path);
996
+ size_t path_len = git_str_len(path);
986
997
 
987
998
  error = git_tree_lookup(&subtree, tree->object.repo, entry->oid);
988
999
  if (error < 0)
989
1000
  break;
990
1001
 
991
1002
  /* append the next entry to the path */
992
- git_buf_puts(path, entry->filename);
993
- git_buf_putc(path, '/');
1003
+ git_str_puts(path, entry->filename);
1004
+ git_str_putc(path, '/');
994
1005
 
995
- if (git_buf_oom(path))
1006
+ if (git_str_oom(path))
996
1007
  error = -1;
997
1008
  else
998
1009
  error = tree_walk(subtree, callback, path, payload, preorder);
@@ -1001,7 +1012,7 @@ static int tree_walk(
1001
1012
  if (error != 0)
1002
1013
  break;
1003
1014
 
1004
- git_buf_truncate(path, path_len);
1015
+ git_str_truncate(path, path_len);
1005
1016
  }
1006
1017
 
1007
1018
  if (!preorder) {
@@ -1024,7 +1035,7 @@ int git_tree_walk(
1024
1035
  void *payload)
1025
1036
  {
1026
1037
  int error = 0;
1027
- git_buf root_path = GIT_BUF_INIT;
1038
+ git_str root_path = GIT_STR_INIT;
1028
1039
 
1029
1040
  if (mode != GIT_TREEWALK_POST && mode != GIT_TREEWALK_PRE) {
1030
1041
  git_error_set(GIT_ERROR_INVALID, "invalid walking mode for tree walk");
@@ -1034,7 +1045,7 @@ int git_tree_walk(
1034
1045
  error = tree_walk(
1035
1046
  tree, callback, &root_path, payload, (mode == GIT_TREEWALK_PRE));
1036
1047
 
1037
- git_buf_dispose(&root_path);
1048
+ git_str_dispose(&root_path);
1038
1049
 
1039
1050
  return error;
1040
1051
  }
@@ -1080,19 +1091,19 @@ GIT_INLINE(size_t) count_slashes(const char *path)
1080
1091
  return count;
1081
1092
  }
1082
1093
 
1083
- static bool next_component(git_buf *out, const char *in)
1094
+ static bool next_component(git_str *out, const char *in)
1084
1095
  {
1085
1096
  const char *slash = strchr(in, '/');
1086
1097
 
1087
- git_buf_clear(out);
1098
+ git_str_clear(out);
1088
1099
 
1089
1100
  if (slash)
1090
- git_buf_put(out, in, slash - in);
1101
+ git_str_put(out, in, slash - in);
1091
1102
 
1092
1103
  return !!slash;
1093
1104
  }
1094
1105
 
1095
- static int create_popped_tree(tree_stack_entry *current, tree_stack_entry *popped, git_buf *component)
1106
+ static int create_popped_tree(tree_stack_entry *current, tree_stack_entry *popped, git_str *component)
1096
1107
  {
1097
1108
  int error;
1098
1109
  git_oid new_tree;
@@ -1116,8 +1127,8 @@ static int create_popped_tree(tree_stack_entry *current, tree_stack_entry *poppe
1116
1127
  }
1117
1128
 
1118
1129
  /* We've written out the tree, now we have to put the new value into its parent */
1119
- git_buf_clear(component);
1120
- git_buf_puts(component, popped->name);
1130
+ git_str_clear(component);
1131
+ git_str_puts(component, popped->name);
1121
1132
  git__free(popped->name);
1122
1133
 
1123
1134
  GIT_ERROR_CHECK_ALLOC(component->ptr);
@@ -1142,7 +1153,7 @@ int git_tree_create_updated(git_oid *out, git_repository *repo, git_tree *baseli
1142
1153
  git_vector entries;
1143
1154
  int error;
1144
1155
  size_t i;
1145
- git_buf component = GIT_BUF_INIT;
1156
+ git_str component = GIT_STR_INIT;
1146
1157
 
1147
1158
  if ((error = git_vector_init(&entries, nupdates, compare_entries)) < 0)
1148
1159
  return error;
@@ -1171,7 +1182,7 @@ int git_tree_create_updated(git_oid *out, git_repository *repo, git_tree *baseli
1171
1182
 
1172
1183
  /* Figure out how much we need to change from the previous tree */
1173
1184
  if (last_update)
1174
- common_prefix = git_path_common_dirlen(last_update->path, update->path);
1185
+ common_prefix = git_fs_path_common_dirlen(last_update->path, update->path);
1175
1186
 
1176
1187
  /*
1177
1188
  * The entries are sorted, so when we find we're no
@@ -1233,7 +1244,7 @@ int git_tree_create_updated(git_oid *out, git_repository *repo, git_tree *baseli
1233
1244
  {
1234
1245
  /* Make sure we're replacing something of the same type */
1235
1246
  tree_stack_entry *last = git_array_last(stack);
1236
- char *basename = git_path_basename(update->path);
1247
+ char *basename = git_fs_path_basename(update->path);
1237
1248
  const git_tree_entry *e = git_treebuilder_get(last->bld, basename);
1238
1249
  if (e && git_tree_entry_type(e) != git_object__type_from_filemode(update->filemode)) {
1239
1250
  git__free(basename);
@@ -1252,7 +1263,7 @@ int git_tree_create_updated(git_oid *out, git_repository *repo, git_tree *baseli
1252
1263
  case GIT_TREE_UPDATE_REMOVE:
1253
1264
  {
1254
1265
  tree_stack_entry *last = git_array_last(stack);
1255
- char *basename = git_path_basename(update->path);
1266
+ char *basename = git_fs_path_basename(update->path);
1256
1267
  error = git_treebuilder_remove(last->bld, basename);
1257
1268
  git__free(basename);
1258
1269
  break;
@@ -1300,7 +1311,7 @@ cleanup:
1300
1311
  }
1301
1312
  }
1302
1313
 
1303
- git_buf_dispose(&component);
1314
+ git_str_dispose(&component);
1304
1315
  git_array_clear(stack);
1305
1316
  git_vector_free(&entries);
1306
1317
  return error;
@@ -32,7 +32,7 @@ struct git_tree {
32
32
  struct git_treebuilder {
33
33
  git_repository *repo;
34
34
  git_strmap *map;
35
- git_buf write_cache;
35
+ git_str write_cache;
36
36
  };
37
37
 
38
38
  GIT_INLINE(bool) git_tree_entry__is_tree(const struct git_tree_entry *e)
@@ -7,8 +7,6 @@
7
7
 
8
8
  #include "common.h"
9
9
 
10
- #include "git2/common.h"
11
-
12
10
  #if !defined(GIT_WIN32) && !defined(NO_MMAP)
13
11
 
14
12
  #include "map.h"