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
@@ -115,7 +115,7 @@ struct pack_writepack {
115
115
  * | OID can be found. If we can find the offset to that SHA1 inside of the
116
116
  * | index, that means the object is contained inside of the packfile and
117
117
  * | we can stop searching. Before returning, we verify that the
118
- * | packfile behing the index we are searching still exists on disk.
118
+ * | packfile behind the index we are searching still exists on disk.
119
119
  * |
120
120
  * |-# pack_entry_find_offset
121
121
  * | Mmap the actual index file to disk if it hasn't been opened
@@ -166,7 +166,7 @@ struct pack_writepack {
166
166
 
167
167
  static int packfile_sort__cb(const void *a_, const void *b_);
168
168
 
169
- static int packfile_load__cb(void *_data, git_buf *path);
169
+ static int packfile_load__cb(void *_data, git_str *path);
170
170
 
171
171
  static int packfile_byname_search_cmp(const void *path, const void *pack_entry);
172
172
 
@@ -195,10 +195,10 @@ static int pack_entry_find_prefix(
195
195
 
196
196
  static int packfile_byname_search_cmp(const void *path_, const void *p_)
197
197
  {
198
- const git_buf *path = (const git_buf *)path_;
198
+ const git_str *path = (const git_str *)path_;
199
199
  const struct git_pack_file *p = (const struct git_pack_file *)p_;
200
200
 
201
- return strncmp(p->pack_name, git_buf_cstr(path), git_buf_len(path));
201
+ return strncmp(p->pack_name, git_str_cstr(path), git_str_len(path));
202
202
  }
203
203
 
204
204
  static int packfile_sort__cb(const void *a_, const void *b_)
@@ -231,20 +231,20 @@ static int packfile_sort__cb(const void *a_, const void *b_)
231
231
  }
232
232
 
233
233
 
234
- static int packfile_load__cb(void *data, git_buf *path)
234
+ static int packfile_load__cb(void *data, git_str *path)
235
235
  {
236
236
  struct pack_backend *backend = data;
237
237
  struct git_pack_file *pack;
238
- const char *path_str = git_buf_cstr(path);
239
- git_buf index_prefix = GIT_BUF_INIT;
240
- size_t cmp_len = git_buf_len(path);
238
+ const char *path_str = git_str_cstr(path);
239
+ git_str index_prefix = GIT_STR_INIT;
240
+ size_t cmp_len = git_str_len(path);
241
241
  int error;
242
242
 
243
243
  if (cmp_len <= strlen(".idx") || git__suffixcmp(path_str, ".idx") != 0)
244
244
  return 0; /* not an index */
245
245
 
246
246
  cmp_len -= strlen(".idx");
247
- git_buf_attach_notowned(&index_prefix, path_str, cmp_len);
247
+ git_str_attach_notowned(&index_prefix, path_str, cmp_len);
248
248
 
249
249
  if (git_vector_search2(NULL, &backend->midx_packs, packfile_byname_search_cmp, &index_prefix) == 0)
250
250
  return 0;
@@ -404,29 +404,29 @@ static int process_multi_pack_index_pack(
404
404
  int error;
405
405
  struct git_pack_file *pack;
406
406
  size_t found_position;
407
- git_buf pack_path = GIT_BUF_INIT, index_prefix = GIT_BUF_INIT;
407
+ git_str pack_path = GIT_STR_INIT, index_prefix = GIT_STR_INIT;
408
408
 
409
- error = git_buf_joinpath(&pack_path, backend->pack_folder, packfile_name);
409
+ error = git_str_joinpath(&pack_path, backend->pack_folder, packfile_name);
410
410
  if (error < 0)
411
411
  return error;
412
412
 
413
413
  /* This is ensured by midx_parse_packfile_name() */
414
- if (git_buf_len(&pack_path) <= strlen(".idx") || git__suffixcmp(git_buf_cstr(&pack_path), ".idx") != 0)
414
+ if (git_str_len(&pack_path) <= strlen(".idx") || git__suffixcmp(git_str_cstr(&pack_path), ".idx") != 0)
415
415
  return git_odb__error_notfound("midx file contained a non-index", NULL, 0);
416
416
 
417
- git_buf_attach_notowned(&index_prefix, git_buf_cstr(&pack_path), git_buf_len(&pack_path) - strlen(".idx"));
417
+ git_str_attach_notowned(&index_prefix, git_str_cstr(&pack_path), git_str_len(&pack_path) - strlen(".idx"));
418
418
 
419
419
  if (git_vector_search2(&found_position, &backend->packs, packfile_byname_search_cmp, &index_prefix) == 0) {
420
420
  /* Pack was found in the packs list. Moving it to the midx_packs list. */
421
- git_buf_dispose(&pack_path);
421
+ git_str_dispose(&pack_path);
422
422
  git_vector_set(NULL, &backend->midx_packs, i, git_vector_get(&backend->packs, found_position));
423
423
  git_vector_remove(&backend->packs, found_position);
424
424
  return 0;
425
425
  }
426
426
 
427
427
  /* Pack was not found. Allocate a new one. */
428
- error = git_mwindow_get_pack(&pack, git_buf_cstr(&pack_path));
429
- git_buf_dispose(&pack_path);
428
+ error = git_mwindow_get_pack(&pack, git_str_cstr(&pack_path));
429
+ git_str_dispose(&pack_path);
430
430
  if (error < 0)
431
431
  return error;
432
432
 
@@ -442,11 +442,11 @@ static int process_multi_pack_index_pack(
442
442
  static int refresh_multi_pack_index(struct pack_backend *backend)
443
443
  {
444
444
  int error;
445
- git_buf midx_path = GIT_BUF_INIT;
445
+ git_str midx_path = GIT_STR_INIT;
446
446
  const char *packfile_name;
447
447
  size_t i;
448
448
 
449
- error = git_buf_joinpath(&midx_path, backend->pack_folder, "multi-pack-index");
449
+ error = git_str_joinpath(&midx_path, backend->pack_folder, "multi-pack-index");
450
450
  if (error < 0)
451
451
  return error;
452
452
 
@@ -457,19 +457,19 @@ static int refresh_multi_pack_index(struct pack_backend *backend)
457
457
  * refreshing the new multi-pack-index fails, or the file is deleted.
458
458
  */
459
459
  if (backend->midx) {
460
- if (!git_midx_needs_refresh(backend->midx, git_buf_cstr(&midx_path))) {
461
- git_buf_dispose(&midx_path);
460
+ if (!git_midx_needs_refresh(backend->midx, git_str_cstr(&midx_path))) {
461
+ git_str_dispose(&midx_path);
462
462
  return 0;
463
463
  }
464
464
  error = remove_multi_pack_index(backend);
465
465
  if (error < 0) {
466
- git_buf_dispose(&midx_path);
466
+ git_str_dispose(&midx_path);
467
467
  return error;
468
468
  }
469
469
  }
470
470
 
471
- error = git_midx_open(&backend->midx, git_buf_cstr(&midx_path));
472
- git_buf_dispose(&midx_path);
471
+ error = git_midx_open(&backend->midx, git_str_cstr(&midx_path));
472
+ git_str_dispose(&midx_path);
473
473
  if (error < 0)
474
474
  return error;
475
475
 
@@ -505,7 +505,7 @@ static int pack_backend__refresh(git_odb_backend *backend_)
505
505
  {
506
506
  int error;
507
507
  struct stat st;
508
- git_buf path = GIT_BUF_INIT;
508
+ git_str path = GIT_STR_INIT;
509
509
  struct pack_backend *backend = (struct pack_backend *)backend_;
510
510
 
511
511
  if (backend->pack_folder == NULL)
@@ -523,10 +523,10 @@ static int pack_backend__refresh(git_odb_backend *backend_)
523
523
  }
524
524
 
525
525
  /* reload all packs */
526
- git_buf_sets(&path, backend->pack_folder);
527
- error = git_path_direach(&path, 0, packfile_load__cb, backend);
526
+ git_str_sets(&path, backend->pack_folder);
527
+ error = git_fs_path_direach(&path, 0, packfile_load__cb, backend);
528
528
 
529
- git_buf_dispose(&path);
529
+ git_str_dispose(&path);
530
530
  git_vector_sort(&backend->packs);
531
531
 
532
532
  return error;
@@ -743,21 +743,21 @@ static int pack_backend__writepack(struct git_odb_writepack **out,
743
743
  }
744
744
 
745
745
  static int get_idx_path(
746
- git_buf *idx_path,
746
+ git_str *idx_path,
747
747
  struct pack_backend *backend,
748
748
  struct git_pack_file *p)
749
749
  {
750
750
  size_t path_len;
751
751
  int error;
752
752
 
753
- error = git_path_prettify(idx_path, p->pack_name, backend->pack_folder);
753
+ error = git_fs_path_prettify(idx_path, p->pack_name, backend->pack_folder);
754
754
  if (error < 0)
755
755
  return error;
756
- path_len = git_buf_len(idx_path);
757
- if (path_len <= strlen(".pack") || git__suffixcmp(git_buf_cstr(idx_path), ".pack") != 0)
756
+ path_len = git_str_len(idx_path);
757
+ if (path_len <= strlen(".pack") || git__suffixcmp(git_str_cstr(idx_path), ".pack") != 0)
758
758
  return git_odb__error_notfound("packfile does not end in .pack", NULL, 0);
759
759
  path_len -= strlen(".pack");
760
- error = git_buf_splice(idx_path, path_len, strlen(".pack"), ".idx", strlen(".idx"));
760
+ error = git_str_splice(idx_path, path_len, strlen(".pack"), ".idx", strlen(".idx"));
761
761
  if (error < 0)
762
762
  return error;
763
763
 
@@ -781,22 +781,22 @@ static int pack_backend__writemidx(git_odb_backend *_backend)
781
781
  return error;
782
782
 
783
783
  git_vector_foreach(&backend->midx_packs, i, p) {
784
- git_buf idx_path = GIT_BUF_INIT;
784
+ git_str idx_path = GIT_STR_INIT;
785
785
  error = get_idx_path(&idx_path, backend, p);
786
786
  if (error < 0)
787
787
  goto cleanup;
788
- error = git_midx_writer_add(w, git_buf_cstr(&idx_path));
789
- git_buf_dispose(&idx_path);
788
+ error = git_midx_writer_add(w, git_str_cstr(&idx_path));
789
+ git_str_dispose(&idx_path);
790
790
  if (error < 0)
791
791
  goto cleanup;
792
792
  }
793
793
  git_vector_foreach(&backend->packs, i, p) {
794
- git_buf idx_path = GIT_BUF_INIT;
794
+ git_str idx_path = GIT_STR_INIT;
795
795
  error = get_idx_path(&idx_path, backend, p);
796
796
  if (error < 0)
797
797
  goto cleanup;
798
- error = git_midx_writer_add(w, git_buf_cstr(&idx_path));
799
- git_buf_dispose(&idx_path);
798
+ error = git_midx_writer_add(w, git_str_cstr(&idx_path));
799
+ git_str_dispose(&idx_path);
800
800
  if (error < 0)
801
801
  goto cleanup;
802
802
  }
@@ -896,15 +896,15 @@ int git_odb_backend_pack(git_odb_backend **backend_out, const char *objects_dir)
896
896
  {
897
897
  int error = 0;
898
898
  struct pack_backend *backend = NULL;
899
- git_buf path = GIT_BUF_INIT;
899
+ git_str path = GIT_STR_INIT;
900
900
 
901
901
  if (pack_backend__alloc(&backend, 8) < 0)
902
902
  return -1;
903
903
 
904
- if (!(error = git_buf_joinpath(&path, objects_dir, "pack")) &&
905
- git_path_isdir(git_buf_cstr(&path)))
904
+ if (!(error = git_str_joinpath(&path, objects_dir, "pack")) &&
905
+ git_fs_path_isdir(git_str_cstr(&path)))
906
906
  {
907
- backend->pack_folder = git_buf_detach(&path);
907
+ backend->pack_folder = git_str_detach(&path);
908
908
  error = pack_backend__refresh((git_odb_backend *)backend);
909
909
  }
910
910
 
@@ -915,7 +915,7 @@ int git_odb_backend_pack(git_odb_backend **backend_out, const char *objects_dir)
915
915
 
916
916
  *backend_out = (git_odb_backend *)backend;
917
917
 
918
- git_buf_dispose(&path);
918
+ git_str_dispose(&path);
919
919
 
920
920
  return error;
921
921
  }
@@ -13,6 +13,13 @@
13
13
  #include <string.h>
14
14
  #include <limits.h>
15
15
 
16
+ const git_oid git_oid__empty_blob_sha1 =
17
+ {{ 0xe6, 0x9d, 0xe2, 0x9b, 0xb2, 0xd1, 0xd6, 0x43, 0x4b, 0x8b,
18
+ 0x29, 0xae, 0x77, 0x5a, 0xd8, 0xc2, 0xe4, 0x8c, 0x53, 0x91 }};
19
+ const git_oid git_oid__empty_tree_sha1 =
20
+ {{ 0x4b, 0x82, 0x5d, 0xc6, 0x42, 0xcb, 0x6e, 0xb9, 0xa0, 0x60,
21
+ 0xe5, 0x4b, 0xf8, 0xd6, 0x92, 0x88, 0xfb, 0xee, 0x49, 0x04 }};
22
+
16
23
  static char to_hex[] = "0123456789abcdef";
17
24
 
18
25
  static int oid_error_invalid(const char *msg)
@@ -162,14 +169,14 @@ int git_oid__parse(
162
169
  return 0;
163
170
  }
164
171
 
165
- void git_oid__writebuf(git_buf *buf, const char *header, const git_oid *oid)
172
+ void git_oid__writebuf(git_str *buf, const char *header, const git_oid *oid)
166
173
  {
167
174
  char hex_oid[GIT_OID_HEXSZ];
168
175
 
169
176
  git_oid_fmt(hex_oid, oid);
170
- git_buf_puts(buf, header);
171
- git_buf_put(buf, hex_oid, GIT_OID_HEXSZ);
172
- git_buf_putc(buf, '\n');
177
+ git_str_puts(buf, header);
178
+ git_str_put(buf, hex_oid, GIT_OID_HEXSZ);
179
+ git_str_putc(buf, '\n');
173
180
  }
174
181
 
175
182
  int git_oid_fromraw(git_oid *out, const unsigned char *raw)
@@ -11,6 +11,9 @@
11
11
 
12
12
  #include "git2/oid.h"
13
13
 
14
+ extern const git_oid git_oid__empty_blob_sha1;
15
+ extern const git_oid git_oid__empty_tree_sha1;
16
+
14
17
  /**
15
18
  * Format a git_oid into a newly allocated c-string.
16
19
  *
@@ -48,4 +51,16 @@ GIT_INLINE(void) git_oid__cpy_prefix(
48
51
  out->id[len / 2] &= 0xF0;
49
52
  }
50
53
 
54
+ GIT_INLINE(bool) git_oid__is_hexstr(const char *str)
55
+ {
56
+ size_t i;
57
+
58
+ for (i = 0; str[i] != '\0'; i++) {
59
+ if (git__fromhex(str[i]) < 0)
60
+ return false;
61
+ }
62
+
63
+ return (i == GIT_OID_HEXSZ);
64
+ }
65
+
51
66
  #endif
@@ -7,6 +7,7 @@
7
7
 
8
8
  #include "pack-objects.h"
9
9
 
10
+ #include "buf.h"
10
11
  #include "zstream.h"
11
12
  #include "delta.h"
12
13
  #include "iterator.h"
@@ -33,7 +34,7 @@ struct unpacked {
33
34
 
34
35
  struct tree_walk_context {
35
36
  git_packbuilder *pb;
36
- git_buf buf;
37
+ git_str buf;
37
38
  };
38
39
 
39
40
  struct pack_write_context {
@@ -141,7 +142,7 @@ int git_packbuilder_new(git_packbuilder **out, git_repository *repo)
141
142
  pb->repo = repo;
142
143
  pb->nr_threads = 1; /* do not spawn any thread by default */
143
144
 
144
- if (git_hash_ctx_init(&pb->ctx) < 0 ||
145
+ if (git_hash_ctx_init(&pb->ctx, GIT_HASH_ALGORITHM_SHA1) < 0 ||
145
146
  git_zstream_init(&pb->zstream, GIT_ZSTREAM_DEFLATE) < 0 ||
146
147
  git_repository_odb(&pb->odb, repo) < 0 ||
147
148
  packbuilder_config(pb) < 0)
@@ -664,7 +665,7 @@ static int write_pack(git_packbuilder *pb,
664
665
  pb->nr_remaining -= pb->nr_written;
665
666
  } while (pb->nr_remaining && i < pb->nr_objects);
666
667
 
667
- if ((error = git_hash_final(&entry_oid, &pb->ctx)) < 0)
668
+ if ((error = git_hash_final(entry_oid.id, &pb->ctx)) < 0)
668
669
  goto done;
669
670
 
670
671
  error = write_cb(entry_oid.id, GIT_OID_RAWSZ, cb_data);
@@ -685,8 +686,8 @@ done:
685
686
 
686
687
  static int write_pack_buf(void *buf, size_t size, void *data)
687
688
  {
688
- git_buf *b = (git_buf *)data;
689
- return git_buf_put(b, buf, size);
689
+ git_str *b = (git_str *)data;
690
+ return git_str_put(b, buf, size);
690
691
  }
691
692
 
692
693
  static int type_size_sort(const void *_a, const void *_b)
@@ -947,7 +948,7 @@ static int find_deltas(git_packbuilder *pb, git_pobject **list,
947
948
  size_t *list_size, size_t window, size_t depth)
948
949
  {
949
950
  git_pobject *po;
950
- git_buf zbuf = GIT_BUF_INIT;
951
+ git_str zbuf = GIT_STR_INIT;
951
952
  struct unpacked *array;
952
953
  size_t idx = 0, count = 0;
953
954
  size_t mem_usage = 0;
@@ -1045,7 +1046,7 @@ static int find_deltas(git_packbuilder *pb, git_pobject **list,
1045
1046
 
1046
1047
  memcpy(po->delta_data, zbuf.ptr, zbuf.size);
1047
1048
  po->z_delta_size = zbuf.size;
1048
- git_buf_clear(&zbuf);
1049
+ git_str_clear(&zbuf);
1049
1050
 
1050
1051
  GIT_ASSERT(git_packbuilder__cache_lock(pb) == 0);
1051
1052
  pb->delta_cache_size -= po->delta_size;
@@ -1093,7 +1094,7 @@ on_error:
1093
1094
  git__free(array[i].data);
1094
1095
  }
1095
1096
  git__free(array);
1096
- git_buf_dispose(&zbuf);
1097
+ git_str_dispose(&zbuf);
1097
1098
 
1098
1099
  return error;
1099
1100
  }
@@ -1307,7 +1308,7 @@ static int ll_find_deltas(git_packbuilder *pb, git_pobject **list,
1307
1308
  #define ll_find_deltas(pb, l, ls, w, d) find_deltas(pb, l, &ls, w, d)
1308
1309
  #endif
1309
1310
 
1310
- static int prepare_pack(git_packbuilder *pb)
1311
+ int git_packbuilder__prepare(git_packbuilder *pb)
1311
1312
  {
1312
1313
  git_pobject **delta_list;
1313
1314
  size_t i, n = 0;
@@ -1352,7 +1353,7 @@ static int prepare_pack(git_packbuilder *pb)
1352
1353
  return 0;
1353
1354
  }
1354
1355
 
1355
- #define PREPARE_PACK if (prepare_pack(pb) < 0) { return -1; }
1356
+ #define PREPARE_PACK if (git_packbuilder__prepare(pb) < 0) { return -1; }
1356
1357
 
1357
1358
  int git_packbuilder_foreach(git_packbuilder *pb, int (*cb)(void *buf, size_t size, void *payload), void *payload)
1358
1359
  {
@@ -1360,18 +1361,18 @@ int git_packbuilder_foreach(git_packbuilder *pb, int (*cb)(void *buf, size_t siz
1360
1361
  return write_pack(pb, cb, payload);
1361
1362
  }
1362
1363
 
1363
- int git_packbuilder_write_buf(git_buf *buf, git_packbuilder *pb)
1364
+ int git_packbuilder__write_buf(git_str *buf, git_packbuilder *pb)
1364
1365
  {
1365
- int error;
1366
-
1367
- if ((error = git_buf_sanitize(buf)) < 0)
1368
- return error;
1369
-
1370
1366
  PREPARE_PACK;
1371
1367
 
1372
1368
  return write_pack(pb, &write_pack_buf, buf);
1373
1369
  }
1374
1370
 
1371
+ int git_packbuilder_write_buf(git_buf *buf, git_packbuilder *pb)
1372
+ {
1373
+ GIT_BUF_WRAP_PRIVATE(buf, git_packbuilder__write_buf, pb);
1374
+ }
1375
+
1375
1376
  static int write_cb(void *buf, size_t len, void *payload)
1376
1377
  {
1377
1378
  struct pack_write_context *ctx = payload;
@@ -1386,7 +1387,7 @@ int git_packbuilder_write(
1386
1387
  void *progress_cb_payload)
1387
1388
  {
1388
1389
  int error = -1;
1389
- git_buf object_path = GIT_BUF_INIT;
1390
+ git_str object_path = GIT_STR_INIT;
1390
1391
  git_indexer_options opts = GIT_INDEXER_OPTIONS_INIT;
1391
1392
  git_indexer *indexer = NULL;
1392
1393
  git_indexer_progress stats;
@@ -1396,11 +1397,11 @@ int git_packbuilder_write(
1396
1397
  PREPARE_PACK;
1397
1398
 
1398
1399
  if (path == NULL) {
1399
- if ((error = git_repository_item_path(&object_path, pb->repo, GIT_REPOSITORY_ITEM_OBJECTS)) < 0)
1400
+ if ((error = git_repository__item_path(&object_path, pb->repo, GIT_REPOSITORY_ITEM_OBJECTS)) < 0)
1400
1401
  goto cleanup;
1401
- if ((error = git_buf_joinpath(&object_path, git_buf_cstr(&object_path), "pack")) < 0)
1402
+ if ((error = git_str_joinpath(&object_path, git_str_cstr(&object_path), "pack")) < 0)
1402
1403
  goto cleanup;
1403
- path = git_buf_cstr(&object_path);
1404
+ path = git_str_cstr(&object_path);
1404
1405
  }
1405
1406
 
1406
1407
  opts.progress_cb = progress_cb;
@@ -1421,20 +1422,32 @@ int git_packbuilder_write(
1421
1422
  if ((error = git_indexer_commit(indexer, &stats)) < 0)
1422
1423
  goto cleanup;
1423
1424
 
1425
+ #ifndef GIT_DEPRECATE_HARD
1424
1426
  git_oid_cpy(&pb->pack_oid, git_indexer_hash(indexer));
1427
+ #endif
1428
+
1429
+ pb->pack_name = git__strdup(git_indexer_name(indexer));
1430
+ GIT_ERROR_CHECK_ALLOC(pb->pack_name);
1425
1431
 
1426
1432
  cleanup:
1427
1433
  git_indexer_free(indexer);
1428
- git_buf_dispose(&object_path);
1434
+ git_str_dispose(&object_path);
1429
1435
  return error;
1430
1436
  }
1431
1437
 
1432
1438
  #undef PREPARE_PACK
1433
1439
 
1440
+ #ifndef GIT_DEPRECATE_HARD
1434
1441
  const git_oid *git_packbuilder_hash(git_packbuilder *pb)
1435
1442
  {
1436
1443
  return &pb->pack_oid;
1437
1444
  }
1445
+ #endif
1446
+
1447
+ const char *git_packbuilder_name(git_packbuilder *pb)
1448
+ {
1449
+ return pb->pack_name;
1450
+ }
1438
1451
 
1439
1452
 
1440
1453
  static int cb_tree_walk(
@@ -1447,10 +1460,10 @@ static int cb_tree_walk(
1447
1460
  if (git_tree_entry_type(entry) == GIT_OBJECT_COMMIT)
1448
1461
  return 0;
1449
1462
 
1450
- if (!(error = git_buf_sets(&ctx->buf, root)) &&
1451
- !(error = git_buf_puts(&ctx->buf, git_tree_entry_name(entry))))
1463
+ if (!(error = git_str_sets(&ctx->buf, root)) &&
1464
+ !(error = git_str_puts(&ctx->buf, git_tree_entry_name(entry))))
1452
1465
  error = git_packbuilder_insert(
1453
- ctx->pb, git_tree_entry_id(entry), git_buf_cstr(&ctx->buf));
1466
+ ctx->pb, git_tree_entry_id(entry), git_str_cstr(&ctx->buf));
1454
1467
 
1455
1468
  return error;
1456
1469
  }
@@ -1474,14 +1487,14 @@ int git_packbuilder_insert_tree(git_packbuilder *pb, const git_oid *oid)
1474
1487
  {
1475
1488
  int error;
1476
1489
  git_tree *tree = NULL;
1477
- struct tree_walk_context context = { pb, GIT_BUF_INIT };
1490
+ struct tree_walk_context context = { pb, GIT_STR_INIT };
1478
1491
 
1479
1492
  if (!(error = git_tree_lookup(&tree, pb->repo, oid)) &&
1480
1493
  !(error = git_packbuilder_insert(pb, oid, NULL)))
1481
1494
  error = git_tree_walk(tree, GIT_TREEWALK_PRE, cb_tree_walk, &context);
1482
1495
 
1483
1496
  git_tree_free(tree);
1484
- git_buf_dispose(&context.buf);
1497
+ git_str_dispose(&context.buf);
1485
1498
  return error;
1486
1499
  }
1487
1500
 
@@ -1802,5 +1815,7 @@ void git_packbuilder_free(git_packbuilder *pb)
1802
1815
  git_hash_ctx_cleanup(&pb->ctx);
1803
1816
  git_zstream_free(&pb->zstream);
1804
1817
 
1818
+ git__free(pb->pack_name);
1819
+
1805
1820
  git__free(pb);
1806
1821
  }
@@ -10,7 +10,7 @@
10
10
 
11
11
  #include "common.h"
12
12
 
13
- #include "buffer.h"
13
+ #include "str.h"
14
14
  #include "hash.h"
15
15
  #include "oidmap.h"
16
16
  #include "netops.h"
@@ -46,10 +46,10 @@ typedef struct git_pobject {
46
46
  size_t delta_size;
47
47
  size_t z_delta_size;
48
48
 
49
- int written:1,
50
- recursing:1,
51
- tagged:1,
52
- filled:1;
49
+ unsigned int written:1,
50
+ recursing:1,
51
+ tagged:1,
52
+ filled:1;
53
53
  } git_pobject;
54
54
 
55
55
  struct git_packbuilder {
@@ -73,7 +73,10 @@ struct git_packbuilder {
73
73
  git_oidmap *walk_objects;
74
74
  git_pool object_pool;
75
75
 
76
+ #ifndef GIT_DEPRECATE_HARD
76
77
  git_oid pack_oid; /* hash of written pack */
78
+ #endif
79
+ char *pack_name; /* name of written pack */
77
80
 
78
81
  /* synchronization objects */
79
82
  git_mutex cache_mutex;
@@ -96,6 +99,8 @@ struct git_packbuilder {
96
99
  bool done;
97
100
  };
98
101
 
99
- int git_packbuilder_write_buf(git_buf *buf, git_packbuilder *pb);
102
+ int git_packbuilder__write_buf(git_str *buf, git_packbuilder *pb);
103
+ int git_packbuilder__prepare(git_packbuilder *pb);
104
+
100
105
 
101
106
  #endif
@@ -308,7 +308,7 @@ static int pack_index_open_locked(struct git_pack_file *p)
308
308
  {
309
309
  int error = 0;
310
310
  size_t name_len;
311
- git_buf idx_name = GIT_BUF_INIT;
311
+ git_str idx_name = GIT_STR_INIT;
312
312
 
313
313
  if (p->index_version > -1)
314
314
  goto cleanup;
@@ -317,12 +317,12 @@ static int pack_index_open_locked(struct git_pack_file *p)
317
317
  name_len = strlen(p->pack_name);
318
318
  GIT_ASSERT(name_len > strlen(".pack"));
319
319
 
320
- if ((error = git_buf_init(&idx_name, name_len)) < 0)
320
+ if ((error = git_str_init(&idx_name, name_len)) < 0)
321
321
  goto cleanup;
322
322
 
323
- git_buf_put(&idx_name, p->pack_name, name_len - strlen(".pack"));
324
- git_buf_puts(&idx_name, ".idx");
325
- if (git_buf_oom(&idx_name)) {
323
+ git_str_put(&idx_name, p->pack_name, name_len - strlen(".pack"));
324
+ git_str_puts(&idx_name, ".idx");
325
+ if (git_str_oom(&idx_name)) {
326
326
  error = -1;
327
327
  goto cleanup;
328
328
  }
@@ -331,7 +331,7 @@ static int pack_index_open_locked(struct git_pack_file *p)
331
331
  error = pack_index_check_locked(idx_name.ptr, p);
332
332
 
333
333
  cleanup:
334
- git_buf_dispose(&idx_name);
334
+ git_str_dispose(&idx_name);
335
335
 
336
336
  return error;
337
337
  }
@@ -1156,17 +1156,17 @@ cleanup:
1156
1156
  int git_packfile__name(char **out, const char *path)
1157
1157
  {
1158
1158
  size_t path_len;
1159
- git_buf buf = GIT_BUF_INIT;
1159
+ git_str buf = GIT_STR_INIT;
1160
1160
 
1161
1161
  path_len = strlen(path);
1162
1162
 
1163
1163
  if (path_len < strlen(".idx"))
1164
1164
  return git_odb__error_notfound("invalid packfile path", NULL, 0);
1165
1165
 
1166
- if (git_buf_printf(&buf, "%.*s.pack", (int)(path_len - strlen(".idx")), path) < 0)
1166
+ if (git_str_printf(&buf, "%.*s.pack", (int)(path_len - strlen(".idx")), path) < 0)
1167
1167
  return -1;
1168
1168
 
1169
- *out = git_buf_detach(&buf);
1169
+ *out = git_str_detach(&buf);
1170
1170
  return 0;
1171
1171
  }
1172
1172
 
@@ -1198,7 +1198,7 @@ int git_packfile_alloc(struct git_pack_file **pack_out, const char *path)
1198
1198
 
1199
1199
  if (!git_disable_pack_keep_file_checks) {
1200
1200
  memcpy(p->pack_name + root_len, ".keep", sizeof(".keep"));
1201
- if (git_path_exists(p->pack_name) == true)
1201
+ if (git_fs_path_exists(p->pack_name) == true)
1202
1202
  p->pack_keep = 1;
1203
1203
  }
1204
1204
 
@@ -76,15 +76,15 @@ size_t git_patch_size(
76
76
  out += patch->header_size;
77
77
 
78
78
  if (include_file_headers) {
79
- git_buf file_header = GIT_BUF_INIT;
79
+ git_str file_header = GIT_STR_INIT;
80
80
 
81
81
  if (git_diff_delta__format_file_header(
82
82
  &file_header, patch->delta, NULL, NULL, 0, true) < 0)
83
83
  git_error_clear();
84
84
  else
85
- out += git_buf_len(&file_header);
85
+ out += git_str_len(&file_header);
86
86
 
87
- git_buf_dispose(&file_header);
87
+ git_str_dispose(&file_header);
88
88
  }
89
89
 
90
90
  return out;
@@ -63,6 +63,7 @@ typedef struct {
63
63
 
64
64
  #define GIT_PATCH_OPTIONS_INIT { 1 }
65
65
 
66
+ extern int git_patch__to_buf(git_str *out, git_patch *patch);
66
67
  extern void git_patch_free(git_patch *patch);
67
68
 
68
69
  #endif