rugged 1.1.1 → 1.4.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (407) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +1 -0
  3. data/README.md +1 -1
  4. data/ext/rugged/extconf.rb +2 -2
  5. data/ext/rugged/rugged.c +7 -4
  6. data/ext/rugged/rugged_config.c +7 -2
  7. data/ext/rugged/rugged_object.c +1 -1
  8. data/ext/rugged/rugged_remote.c +17 -0
  9. data/ext/rugged/rugged_repo.c +3 -3
  10. data/lib/rugged/repository.rb +2 -2
  11. data/lib/rugged/version.rb +1 -1
  12. data/vendor/libgit2/CMakeLists.txt +103 -271
  13. data/vendor/libgit2/COPYING +149 -24
  14. data/vendor/libgit2/cmake/AddCFlagIfSupported.cmake +21 -21
  15. data/vendor/libgit2/cmake/DefaultCFlags.cmake +154 -0
  16. data/vendor/libgit2/cmake/EnableWarnings.cmake +13 -13
  17. data/vendor/libgit2/cmake/FindCoreFoundation.cmake +13 -13
  18. data/vendor/libgit2/cmake/FindGSSAPI.cmake +171 -287
  19. data/vendor/libgit2/cmake/FindGSSFramework.cmake +13 -13
  20. data/vendor/libgit2/cmake/{FindHTTP_Parser.cmake → FindHTTPParser.cmake} +17 -17
  21. data/vendor/libgit2/cmake/FindIconv.cmake +27 -27
  22. data/vendor/libgit2/cmake/FindLibSSH2.cmake +13 -0
  23. data/vendor/libgit2/cmake/FindPCRE.cmake +13 -13
  24. data/vendor/libgit2/cmake/FindPCRE2.cmake +12 -12
  25. data/vendor/libgit2/cmake/FindPkgLibraries.cmake +19 -19
  26. data/vendor/libgit2/cmake/FindSecurity.cmake +14 -14
  27. data/vendor/libgit2/cmake/FindStatNsec.cmake +12 -18
  28. data/vendor/libgit2/cmake/Findfutimens.cmake +14 -0
  29. data/vendor/libgit2/cmake/FindmbedTLS.cmake +63 -70
  30. data/vendor/libgit2/cmake/IdeSplitSources.cmake +18 -18
  31. data/vendor/libgit2/cmake/PkgBuildConfig.cmake +60 -60
  32. data/vendor/libgit2/cmake/SanitizeBool.cmake +20 -20
  33. data/vendor/libgit2/cmake/SelectGSSAPI.cmake +37 -37
  34. data/vendor/libgit2/cmake/SelectHTTPParser.cmake +19 -0
  35. data/vendor/libgit2/cmake/SelectHTTPSBackend.cmake +100 -96
  36. data/vendor/libgit2/cmake/SelectHashes.cmake +39 -48
  37. data/vendor/libgit2/cmake/SelectRegex.cmake +51 -0
  38. data/vendor/libgit2/cmake/SelectSSH.cmake +41 -0
  39. data/vendor/libgit2/cmake/SelectWinHTTP.cmake +17 -0
  40. data/vendor/libgit2/cmake/SelectZlib.cmake +34 -0
  41. data/vendor/libgit2/deps/chromium-zlib/CMakeLists.txt +101 -0
  42. data/vendor/libgit2/deps/ntlmclient/CMakeLists.txt +32 -20
  43. data/vendor/libgit2/deps/ntlmclient/crypt.h +14 -9
  44. data/vendor/libgit2/deps/ntlmclient/crypt_commoncrypto.c +20 -20
  45. data/vendor/libgit2/deps/ntlmclient/crypt_commoncrypto.h +3 -3
  46. data/vendor/libgit2/deps/ntlmclient/crypt_mbedtls.c +37 -36
  47. data/vendor/libgit2/deps/ntlmclient/crypt_mbedtls.h +4 -3
  48. data/vendor/libgit2/deps/ntlmclient/crypt_openssl.c +178 -51
  49. data/vendor/libgit2/deps/ntlmclient/crypt_openssl.h +74 -5
  50. data/vendor/libgit2/deps/ntlmclient/ntlm.c +154 -122
  51. data/vendor/libgit2/deps/ntlmclient/ntlm.h +17 -13
  52. data/vendor/libgit2/deps/ntlmclient/ntlmclient.h +17 -4
  53. data/vendor/libgit2/deps/ntlmclient/unicode.h +10 -4
  54. data/vendor/libgit2/deps/ntlmclient/unicode_builtin.c +16 -27
  55. data/vendor/libgit2/deps/ntlmclient/unicode_builtin.h +20 -0
  56. data/vendor/libgit2/deps/ntlmclient/unicode_iconv.c +28 -52
  57. data/vendor/libgit2/deps/ntlmclient/unicode_iconv.h +22 -0
  58. data/vendor/libgit2/deps/pcre/CMakeLists.txt +88 -88
  59. data/vendor/libgit2/deps/winhttp/CMakeLists.txt +14 -16
  60. data/vendor/libgit2/include/git2/apply.h +16 -2
  61. data/vendor/libgit2/include/git2/attr.h +106 -2
  62. data/vendor/libgit2/include/git2/blame.h +97 -43
  63. data/vendor/libgit2/include/git2/blob.h +33 -2
  64. data/vendor/libgit2/include/git2/branch.h +27 -0
  65. data/vendor/libgit2/include/git2/buffer.h +18 -78
  66. data/vendor/libgit2/include/git2/cert.h +43 -6
  67. data/vendor/libgit2/include/git2/checkout.h +32 -13
  68. data/vendor/libgit2/include/git2/clone.h +4 -4
  69. data/vendor/libgit2/include/git2/commit.h +37 -19
  70. data/vendor/libgit2/include/git2/common.h +46 -5
  71. data/vendor/libgit2/include/git2/config.h +19 -3
  72. data/vendor/libgit2/include/git2/credential.h +2 -1
  73. data/vendor/libgit2/include/git2/credential_helpers.h +1 -0
  74. data/vendor/libgit2/include/git2/deprecated.h +326 -6
  75. data/vendor/libgit2/include/git2/describe.h +7 -2
  76. data/vendor/libgit2/include/git2/diff.h +50 -121
  77. data/vendor/libgit2/include/git2/email.h +127 -0
  78. data/vendor/libgit2/include/git2/errors.h +7 -6
  79. data/vendor/libgit2/include/git2/filter.h +69 -18
  80. data/vendor/libgit2/include/git2/graph.h +21 -2
  81. data/vendor/libgit2/include/git2/ignore.h +1 -1
  82. data/vendor/libgit2/include/git2/index.h +13 -7
  83. data/vendor/libgit2/include/git2/indexer.h +19 -0
  84. data/vendor/libgit2/include/git2/merge.h +23 -3
  85. data/vendor/libgit2/include/git2/message.h +2 -0
  86. data/vendor/libgit2/include/git2/notes.h +2 -2
  87. data/vendor/libgit2/include/git2/object.h +23 -0
  88. data/vendor/libgit2/include/git2/odb.h +65 -6
  89. data/vendor/libgit2/include/git2/odb_backend.h +1 -1
  90. data/vendor/libgit2/include/git2/oidarray.h +5 -8
  91. data/vendor/libgit2/include/git2/pack.h +24 -8
  92. data/vendor/libgit2/include/git2/patch.h +16 -0
  93. data/vendor/libgit2/include/git2/pathspec.h +1 -1
  94. data/vendor/libgit2/include/git2/proxy.h +1 -1
  95. data/vendor/libgit2/include/git2/rebase.h +34 -2
  96. data/vendor/libgit2/include/git2/refdb.h +3 -0
  97. data/vendor/libgit2/include/git2/reflog.h +1 -1
  98. data/vendor/libgit2/include/git2/refs.h +8 -4
  99. data/vendor/libgit2/include/git2/remote.h +246 -46
  100. data/vendor/libgit2/include/git2/repository.h +25 -18
  101. data/vendor/libgit2/include/git2/reset.h +2 -2
  102. data/vendor/libgit2/include/git2/revparse.h +5 -5
  103. data/vendor/libgit2/include/git2/revwalk.h +4 -1
  104. data/vendor/libgit2/include/git2/signature.h +1 -1
  105. data/vendor/libgit2/include/git2/stash.h +4 -4
  106. data/vendor/libgit2/include/git2/status.h +124 -62
  107. data/vendor/libgit2/include/git2/stdint.h +3 -3
  108. data/vendor/libgit2/include/git2/submodule.h +16 -2
  109. data/vendor/libgit2/include/git2/sys/commit_graph.h +174 -0
  110. data/vendor/libgit2/include/git2/sys/email.h +45 -0
  111. data/vendor/libgit2/include/git2/sys/filter.h +49 -28
  112. data/vendor/libgit2/include/git2/sys/midx.h +74 -0
  113. data/vendor/libgit2/include/git2/sys/odb_backend.h +9 -5
  114. data/vendor/libgit2/include/git2/sys/remote.h +31 -0
  115. data/vendor/libgit2/include/git2/sys/stream.h +1 -1
  116. data/vendor/libgit2/include/git2/sys/transport.h +26 -34
  117. data/vendor/libgit2/include/git2/tag.h +13 -0
  118. data/vendor/libgit2/include/git2/tree.h +4 -17
  119. data/vendor/libgit2/include/git2/types.h +16 -7
  120. data/vendor/libgit2/include/git2/version.h +4 -4
  121. data/vendor/libgit2/include/git2/worktree.h +13 -2
  122. data/vendor/libgit2/include/git2.h +1 -0
  123. data/vendor/libgit2/src/CMakeLists.txt +192 -290
  124. data/vendor/libgit2/src/alloc.c +21 -8
  125. data/vendor/libgit2/src/allocators/failalloc.c +92 -0
  126. data/vendor/libgit2/src/allocators/failalloc.h +23 -0
  127. data/vendor/libgit2/src/allocators/stdalloc.c +41 -10
  128. data/vendor/libgit2/src/allocators/win32_leakcheck.c +118 -0
  129. data/vendor/libgit2/src/allocators/{win32_crtdbg.h → win32_leakcheck.h} +3 -3
  130. data/vendor/libgit2/src/annotated_commit.c +21 -9
  131. data/vendor/libgit2/src/annotated_commit.h +1 -1
  132. data/vendor/libgit2/src/apply.c +34 -25
  133. data/vendor/libgit2/src/apply.h +2 -2
  134. data/vendor/libgit2/src/array.h +11 -11
  135. data/vendor/libgit2/src/attr.c +204 -82
  136. data/vendor/libgit2/src/attr_file.c +105 -52
  137. data/vendor/libgit2/src/attr_file.h +36 -15
  138. data/vendor/libgit2/src/attrcache.c +55 -45
  139. data/vendor/libgit2/src/attrcache.h +4 -5
  140. data/vendor/libgit2/src/blame.c +15 -9
  141. data/vendor/libgit2/src/blame_git.c +2 -2
  142. data/vendor/libgit2/src/blob.c +76 -52
  143. data/vendor/libgit2/src/blob.h +1 -1
  144. data/vendor/libgit2/src/branch.c +203 -110
  145. data/vendor/libgit2/src/branch.h +15 -3
  146. data/vendor/libgit2/src/buf.c +126 -0
  147. data/vendor/libgit2/src/buf.h +50 -0
  148. data/vendor/libgit2/src/cache.c +2 -2
  149. data/vendor/libgit2/src/cache.h +7 -7
  150. data/vendor/libgit2/src/cc-compat.h +11 -9
  151. data/vendor/libgit2/src/checkout.c +118 -91
  152. data/vendor/libgit2/src/cherrypick.c +16 -12
  153. data/vendor/libgit2/src/clone.c +97 -103
  154. data/vendor/libgit2/src/commit.c +167 -84
  155. data/vendor/libgit2/src/commit.h +24 -1
  156. data/vendor/libgit2/src/commit_graph.c +1224 -0
  157. data/vendor/libgit2/src/commit_graph.h +169 -0
  158. data/vendor/libgit2/src/commit_list.c +48 -3
  159. data/vendor/libgit2/src/commit_list.h +2 -0
  160. data/vendor/libgit2/src/common.h +35 -5
  161. data/vendor/libgit2/src/config.c +119 -64
  162. data/vendor/libgit2/src/config.h +15 -2
  163. data/vendor/libgit2/src/config_cache.c +5 -3
  164. data/vendor/libgit2/src/config_file.c +120 -100
  165. data/vendor/libgit2/src/config_mem.c +9 -9
  166. data/vendor/libgit2/src/config_parse.c +29 -27
  167. data/vendor/libgit2/src/crlf.c +36 -23
  168. data/vendor/libgit2/src/date.c +13 -19
  169. data/vendor/libgit2/src/date.h +33 -0
  170. data/vendor/libgit2/src/delta.c +1 -1
  171. data/vendor/libgit2/src/describe.c +32 -21
  172. data/vendor/libgit2/src/diff.c +71 -183
  173. data/vendor/libgit2/src/diff.h +2 -4
  174. data/vendor/libgit2/src/diff_driver.c +53 -51
  175. data/vendor/libgit2/src/diff_driver.h +3 -3
  176. data/vendor/libgit2/src/diff_file.c +31 -26
  177. data/vendor/libgit2/src/diff_generate.c +76 -23
  178. data/vendor/libgit2/src/diff_generate.h +5 -3
  179. data/vendor/libgit2/src/diff_print.c +120 -95
  180. data/vendor/libgit2/src/diff_stats.c +47 -34
  181. data/vendor/libgit2/src/{message.h → diff_stats.h} +7 -6
  182. data/vendor/libgit2/src/diff_tform.c +18 -16
  183. data/vendor/libgit2/src/diff_xdiff.c +7 -10
  184. data/vendor/libgit2/src/diff_xdiff.h +1 -1
  185. data/vendor/libgit2/src/email.c +315 -0
  186. data/vendor/libgit2/src/email.h +25 -0
  187. data/vendor/libgit2/src/errors.c +37 -32
  188. data/vendor/libgit2/src/features.h.in +11 -2
  189. data/vendor/libgit2/src/fetch.c +77 -26
  190. data/vendor/libgit2/src/fetch.h +1 -1
  191. data/vendor/libgit2/src/fetchhead.c +27 -23
  192. data/vendor/libgit2/src/filebuf.c +36 -34
  193. data/vendor/libgit2/src/filebuf.h +1 -1
  194. data/vendor/libgit2/src/filter.c +278 -132
  195. data/vendor/libgit2/src/filter.h +46 -6
  196. data/vendor/libgit2/src/fs_path.c +2071 -0
  197. data/vendor/libgit2/src/fs_path.h +772 -0
  198. data/vendor/libgit2/src/futils.c +96 -90
  199. data/vendor/libgit2/src/futils.h +27 -15
  200. data/vendor/libgit2/src/graph.c +64 -9
  201. data/vendor/libgit2/src/hash/sha1/collisiondetect.c +5 -5
  202. data/vendor/libgit2/src/hash/sha1/common_crypto.c +5 -5
  203. data/vendor/libgit2/src/hash/sha1/generic.c +2 -2
  204. data/vendor/libgit2/src/hash/sha1/generic.h +1 -1
  205. data/vendor/libgit2/src/hash/sha1/mbedtls.c +13 -13
  206. data/vendor/libgit2/src/hash/sha1/openssl.c +5 -5
  207. data/vendor/libgit2/src/hash/sha1/sha1dc/sha1.c +9 -11
  208. data/vendor/libgit2/src/hash/sha1/win32.c +21 -17
  209. data/vendor/libgit2/src/hash/sha1.h +3 -1
  210. data/vendor/libgit2/src/hash.c +71 -36
  211. data/vendor/libgit2/src/hash.h +13 -13
  212. data/vendor/libgit2/src/hashsig.c +23 -10
  213. data/vendor/libgit2/src/ident.c +30 -20
  214. data/vendor/libgit2/src/ignore.c +63 -46
  215. data/vendor/libgit2/src/ignore.h +2 -2
  216. data/vendor/libgit2/src/index.c +184 -149
  217. data/vendor/libgit2/src/index.h +7 -4
  218. data/vendor/libgit2/src/indexer.c +143 -89
  219. data/vendor/libgit2/src/integer.h +64 -2
  220. data/vendor/libgit2/src/iterator.c +93 -73
  221. data/vendor/libgit2/src/iterator.h +6 -6
  222. data/vendor/libgit2/src/khash.h +3 -12
  223. data/vendor/libgit2/src/{settings.c → libgit2.c} +165 -56
  224. data/vendor/libgit2/src/libgit2.h +15 -0
  225. data/vendor/libgit2/src/mailmap.c +60 -45
  226. data/vendor/libgit2/src/map.h +3 -3
  227. data/vendor/libgit2/src/merge.c +104 -61
  228. data/vendor/libgit2/src/merge.h +3 -15
  229. data/vendor/libgit2/src/merge_driver.c +21 -15
  230. data/vendor/libgit2/src/merge_file.c +24 -6
  231. data/vendor/libgit2/src/message.c +21 -8
  232. data/vendor/libgit2/src/midx.c +501 -18
  233. data/vendor/libgit2/src/midx.h +29 -2
  234. data/vendor/libgit2/src/mwindow.c +103 -59
  235. data/vendor/libgit2/src/mwindow.h +3 -3
  236. data/vendor/libgit2/src/net.c +405 -71
  237. data/vendor/libgit2/src/net.h +26 -5
  238. data/vendor/libgit2/src/netops.c +7 -5
  239. data/vendor/libgit2/src/netops.h +3 -3
  240. data/vendor/libgit2/src/notes.c +40 -49
  241. data/vendor/libgit2/src/object.c +68 -20
  242. data/vendor/libgit2/src/object.h +1 -1
  243. data/vendor/libgit2/src/odb.c +320 -80
  244. data/vendor/libgit2/src/odb.h +17 -3
  245. data/vendor/libgit2/src/odb_loose.c +96 -86
  246. data/vendor/libgit2/src/odb_mempack.c +19 -6
  247. data/vendor/libgit2/src/odb_pack.c +402 -125
  248. data/vendor/libgit2/src/oid.c +16 -8
  249. data/vendor/libgit2/src/oid.h +15 -0
  250. data/vendor/libgit2/src/oidarray.c +10 -1
  251. data/vendor/libgit2/src/pack-objects.c +90 -69
  252. data/vendor/libgit2/src/pack-objects.h +11 -6
  253. data/vendor/libgit2/src/pack.c +337 -127
  254. data/vendor/libgit2/src/pack.h +25 -7
  255. data/vendor/libgit2/src/patch.c +17 -10
  256. data/vendor/libgit2/src/patch.h +1 -0
  257. data/vendor/libgit2/src/patch_generate.c +29 -13
  258. data/vendor/libgit2/src/patch_generate.h +5 -5
  259. data/vendor/libgit2/src/patch_parse.c +26 -25
  260. data/vendor/libgit2/src/path.c +86 -1768
  261. data/vendor/libgit2/src/path.h +39 -635
  262. data/vendor/libgit2/src/pathspec.c +12 -12
  263. data/vendor/libgit2/src/pathspec.h +2 -2
  264. data/vendor/libgit2/src/pool.c +13 -7
  265. data/vendor/libgit2/src/posix.c +14 -6
  266. data/vendor/libgit2/src/posix.h +1 -0
  267. data/vendor/libgit2/src/pqueue.h +1 -1
  268. data/vendor/libgit2/src/proxy.c +4 -1
  269. data/vendor/libgit2/src/proxy.h +1 -1
  270. data/vendor/libgit2/src/push.c +30 -35
  271. data/vendor/libgit2/src/push.h +4 -16
  272. data/vendor/libgit2/src/rand.c +226 -0
  273. data/vendor/libgit2/src/rand.h +37 -0
  274. data/vendor/libgit2/src/reader.c +18 -14
  275. data/vendor/libgit2/src/reader.h +2 -2
  276. data/vendor/libgit2/src/rebase.c +177 -132
  277. data/vendor/libgit2/src/refdb.c +30 -13
  278. data/vendor/libgit2/src/refdb_fs.c +548 -222
  279. data/vendor/libgit2/src/reflog.c +19 -14
  280. data/vendor/libgit2/src/refs.c +107 -72
  281. data/vendor/libgit2/src/refs.h +2 -2
  282. data/vendor/libgit2/src/refspec.c +53 -38
  283. data/vendor/libgit2/src/refspec.h +5 -2
  284. data/vendor/libgit2/src/regexp.c +1 -1
  285. data/vendor/libgit2/src/remote.c +960 -486
  286. data/vendor/libgit2/src/remote.h +16 -10
  287. data/vendor/libgit2/src/repository.c +702 -422
  288. data/vendor/libgit2/src/repository.h +26 -8
  289. data/vendor/libgit2/src/reset.c +16 -12
  290. data/vendor/libgit2/src/revert.c +16 -12
  291. data/vendor/libgit2/src/revparse.c +66 -48
  292. data/vendor/libgit2/src/revwalk.c +39 -22
  293. data/vendor/libgit2/src/runtime.c +162 -0
  294. data/vendor/libgit2/src/runtime.h +62 -0
  295. data/vendor/libgit2/src/settings.h +11 -0
  296. data/vendor/libgit2/src/signature.c +18 -11
  297. data/vendor/libgit2/src/signature.h +1 -1
  298. data/vendor/libgit2/src/sortedcache.c +1 -1
  299. data/vendor/libgit2/src/sortedcache.h +10 -8
  300. data/vendor/libgit2/src/stash.c +39 -38
  301. data/vendor/libgit2/src/status.c +11 -5
  302. data/vendor/libgit2/src/{buffer.c → str.c} +459 -136
  303. data/vendor/libgit2/src/str.h +357 -0
  304. data/vendor/libgit2/src/strarray.c +2 -1
  305. data/vendor/libgit2/src/streams/mbedtls.c +22 -23
  306. data/vendor/libgit2/src/streams/mbedtls.h +1 -1
  307. data/vendor/libgit2/src/streams/openssl.c +101 -201
  308. data/vendor/libgit2/src/streams/openssl.h +9 -1
  309. data/vendor/libgit2/src/streams/openssl_dynamic.c +309 -0
  310. data/vendor/libgit2/src/streams/openssl_dynamic.h +348 -0
  311. data/vendor/libgit2/src/streams/openssl_legacy.c +203 -0
  312. data/vendor/libgit2/src/streams/openssl_legacy.h +63 -0
  313. data/vendor/libgit2/src/streams/registry.c +5 -6
  314. data/vendor/libgit2/src/streams/socket.c +6 -2
  315. data/vendor/libgit2/src/streams/stransport.c +6 -3
  316. data/vendor/libgit2/src/streams/tls.c +5 -3
  317. data/vendor/libgit2/src/submodule.c +290 -212
  318. data/vendor/libgit2/src/submodule.h +10 -10
  319. data/vendor/libgit2/src/sysdir.c +70 -56
  320. data/vendor/libgit2/src/sysdir.h +15 -10
  321. data/vendor/libgit2/src/tag.c +72 -34
  322. data/vendor/libgit2/src/thread.c +140 -0
  323. data/vendor/libgit2/src/thread.h +479 -0
  324. data/vendor/libgit2/src/threadstate.c +84 -0
  325. data/vendor/libgit2/src/threadstate.h +24 -0
  326. data/vendor/libgit2/src/trace.c +3 -16
  327. data/vendor/libgit2/src/trace.h +17 -30
  328. data/vendor/libgit2/src/trailer.c +2 -2
  329. data/vendor/libgit2/src/transaction.c +20 -9
  330. data/vendor/libgit2/src/transport.c +13 -13
  331. data/vendor/libgit2/src/transports/auth.c +8 -10
  332. data/vendor/libgit2/src/transports/auth.h +2 -3
  333. data/vendor/libgit2/src/transports/auth_negotiate.c +23 -17
  334. data/vendor/libgit2/src/transports/auth_ntlm.c +20 -16
  335. data/vendor/libgit2/src/transports/auth_ntlm.h +0 -1
  336. data/vendor/libgit2/src/transports/credential.c +15 -7
  337. data/vendor/libgit2/src/transports/git.c +10 -14
  338. data/vendor/libgit2/src/transports/http.c +56 -34
  339. data/vendor/libgit2/src/transports/http.h +3 -3
  340. data/vendor/libgit2/src/transports/httpclient.c +106 -79
  341. data/vendor/libgit2/src/transports/httpclient.h +1 -1
  342. data/vendor/libgit2/src/transports/local.c +127 -119
  343. data/vendor/libgit2/src/transports/smart.c +61 -144
  344. data/vendor/libgit2/src/transports/smart.h +26 -32
  345. data/vendor/libgit2/src/transports/smart_pkt.c +33 -33
  346. data/vendor/libgit2/src/transports/smart_protocol.c +68 -44
  347. data/vendor/libgit2/src/transports/ssh.c +100 -131
  348. data/vendor/libgit2/src/transports/winhttp.c +86 -82
  349. data/vendor/libgit2/src/tree-cache.c +5 -5
  350. data/vendor/libgit2/src/tree-cache.h +2 -2
  351. data/vendor/libgit2/src/tree.c +150 -116
  352. data/vendor/libgit2/src/tree.h +1 -0
  353. data/vendor/libgit2/src/tsort.c +0 -2
  354. data/vendor/libgit2/src/unix/map.c +3 -3
  355. data/vendor/libgit2/src/unix/posix.h +1 -4
  356. data/vendor/libgit2/src/unix/pthread.h +2 -1
  357. data/vendor/libgit2/src/unix/realpath.c +0 -2
  358. data/vendor/libgit2/src/utf8.c +150 -0
  359. data/vendor/libgit2/src/utf8.h +52 -0
  360. data/vendor/libgit2/src/util.c +68 -144
  361. data/vendor/libgit2/src/util.h +36 -68
  362. data/vendor/libgit2/src/vector.c +23 -19
  363. data/vendor/libgit2/src/vector.h +5 -3
  364. data/vendor/libgit2/src/win32/findfile.c +172 -114
  365. data/vendor/libgit2/src/win32/findfile.h +7 -4
  366. data/vendor/libgit2/src/win32/map.c +1 -1
  367. data/vendor/libgit2/src/win32/msvc-compat.h +9 -1
  368. data/vendor/libgit2/src/win32/path_w32.c +162 -33
  369. data/vendor/libgit2/src/win32/path_w32.h +2 -1
  370. data/vendor/libgit2/src/win32/posix.h +6 -7
  371. data/vendor/libgit2/src/win32/posix_w32.c +26 -33
  372. data/vendor/libgit2/src/win32/precompiled.h +0 -1
  373. data/vendor/libgit2/src/win32/reparse.h +4 -4
  374. data/vendor/libgit2/src/win32/thread.c +24 -15
  375. data/vendor/libgit2/src/win32/thread.h +1 -1
  376. data/vendor/libgit2/src/win32/w32_buffer.c +5 -6
  377. data/vendor/libgit2/src/win32/w32_buffer.h +2 -3
  378. data/vendor/libgit2/src/win32/w32_common.h +18 -9
  379. data/vendor/libgit2/src/win32/{w32_crtdbg_stacktrace.c → w32_leakcheck.c} +269 -33
  380. data/vendor/libgit2/src/win32/w32_leakcheck.h +222 -0
  381. data/vendor/libgit2/src/win32/w32_util.h +6 -6
  382. data/vendor/libgit2/src/worktree.c +138 -105
  383. data/vendor/libgit2/src/worktree.h +1 -1
  384. data/vendor/libgit2/src/xdiff/git-xdiff.h +53 -0
  385. data/vendor/libgit2/src/xdiff/xdiff.h +15 -15
  386. data/vendor/libgit2/src/xdiff/xdiffi.c +134 -108
  387. data/vendor/libgit2/src/xdiff/xemit.c +23 -7
  388. data/vendor/libgit2/src/xdiff/xhistogram.c +87 -78
  389. data/vendor/libgit2/src/xdiff/xinclude.h +1 -12
  390. data/vendor/libgit2/src/xdiff/xmerge.c +104 -117
  391. data/vendor/libgit2/src/xdiff/xpatience.c +6 -17
  392. data/vendor/libgit2/src/xdiff/xprepare.c +15 -20
  393. data/vendor/libgit2/src/xdiff/xutils.c +18 -7
  394. data/vendor/libgit2/src/zstream.c +6 -6
  395. data/vendor/libgit2/src/zstream.h +4 -4
  396. metadata +60 -24
  397. data/vendor/libgit2/src/allocators/win32_crtdbg.c +0 -118
  398. data/vendor/libgit2/src/buf_text.c +0 -316
  399. data/vendor/libgit2/src/buf_text.h +0 -122
  400. data/vendor/libgit2/src/buffer.h +0 -222
  401. data/vendor/libgit2/src/global.c +0 -363
  402. data/vendor/libgit2/src/global.h +0 -41
  403. data/vendor/libgit2/src/thread-utils.c +0 -58
  404. data/vendor/libgit2/src/thread-utils.h +0 -369
  405. data/vendor/libgit2/src/win32/w32_crtdbg_stacktrace.h +0 -127
  406. data/vendor/libgit2/src/win32/w32_stack.c +0 -188
  407. data/vendor/libgit2/src/win32/w32_stack.h +0 -140
@@ -9,10 +9,17 @@
9
9
 
10
10
  #include "git2/oid.h"
11
11
  #include "repository.h"
12
- #include "global.h"
12
+ #include "threadstate.h"
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)
@@ -26,7 +33,8 @@ int git_oid_fromstrn(git_oid *out, const char *str, size_t length)
26
33
  size_t p;
27
34
  int v;
28
35
 
29
- assert(out && str);
36
+ GIT_ASSERT_ARG(out);
37
+ GIT_ASSERT_ARG(str);
30
38
 
31
39
  if (!length)
32
40
  return oid_error_invalid("too short");
@@ -107,7 +115,7 @@ int git_oid_pathfmt(char *str, const git_oid *oid)
107
115
 
108
116
  char *git_oid_tostr_s(const git_oid *oid)
109
117
  {
110
- char *str = GIT_GLOBAL->oid_fmt;
118
+ char *str = GIT_THREADSTATE->oid_fmt;
111
119
  git_oid_nfmt(str, GIT_OID_HEXSZ + 1, oid);
112
120
  return str;
113
121
  }
@@ -161,14 +169,14 @@ int git_oid__parse(
161
169
  return 0;
162
170
  }
163
171
 
164
- 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)
165
173
  {
166
174
  char hex_oid[GIT_OID_HEXSZ];
167
175
 
168
176
  git_oid_fmt(hex_oid, oid);
169
- git_buf_puts(buf, header);
170
- git_buf_put(buf, hex_oid, GIT_OID_HEXSZ);
171
- 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');
172
180
  }
173
181
 
174
182
  int git_oid_fromraw(git_oid *out, const unsigned char *raw)
@@ -316,7 +324,7 @@ git_oid_shorten *git_oid_shorten_new(size_t min_length)
316
324
  {
317
325
  git_oid_shorten *os;
318
326
 
319
- assert((size_t)((int)min_length) == min_length);
327
+ GIT_ASSERT_ARG_WITH_RETVAL((size_t)((int)min_length) == min_length, NULL);
320
328
 
321
329
  os = git__calloc(1, sizeof(git_oid_shorten));
322
330
  if (os == NULL)
@@ -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
@@ -10,7 +10,7 @@
10
10
  #include "git2/oidarray.h"
11
11
  #include "array.h"
12
12
 
13
- void git_oidarray_free(git_oidarray *arr)
13
+ void git_oidarray_dispose(git_oidarray *arr)
14
14
  {
15
15
  git__free(arr->ids);
16
16
  }
@@ -32,3 +32,12 @@ void git_oidarray__reverse(git_oidarray *arr)
32
32
  git_oid_cpy(&arr->ids[(arr->count-1)-i], &tmp);
33
33
  }
34
34
  }
35
+
36
+ #ifndef GIT_DEPRECATE_HARD
37
+
38
+ void git_oidarray_free(git_oidarray *arr)
39
+ {
40
+ git_oidarray_dispose(arr);
41
+ }
42
+
43
+ #endif
@@ -7,12 +7,13 @@
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"
13
14
  #include "netops.h"
14
15
  #include "pack.h"
15
- #include "thread-utils.h"
16
+ #include "thread.h"
16
17
  #include "tree.h"
17
18
  #include "util.h"
18
19
  #include "revwalk.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 {
@@ -48,18 +49,10 @@ struct walk_object {
48
49
  };
49
50
 
50
51
  #ifdef GIT_THREADS
51
-
52
- #define GIT_PACKBUILDER__MUTEX_OP(pb, mtx, op) do { \
53
- int result = git_mutex_##op(&(pb)->mtx); \
54
- assert(!result); \
55
- GIT_UNUSED(result); \
56
- } while (0)
57
-
52
+ # define GIT_PACKBUILDER__MUTEX_OP(pb, mtx, op) git_mutex_##op(&(pb)->mtx)
58
53
  #else
59
-
60
- #define GIT_PACKBUILDER__MUTEX_OP(pb,mtx,op) GIT_UNUSED(pb)
61
-
62
- #endif /* GIT_THREADS */
54
+ # define GIT_PACKBUILDER__MUTEX_OP(pb, mtx, op) git__noop()
55
+ #endif
63
56
 
64
57
  #define git_packbuilder__cache_lock(pb) GIT_PACKBUILDER__MUTEX_OP(pb, cache_mutex, lock)
65
58
  #define git_packbuilder__cache_unlock(pb) GIT_PACKBUILDER__MUTEX_OP(pb, cache_mutex, unlock)
@@ -149,7 +142,7 @@ int git_packbuilder_new(git_packbuilder **out, git_repository *repo)
149
142
  pb->repo = repo;
150
143
  pb->nr_threads = 1; /* do not spawn any thread by default */
151
144
 
152
- if (git_hash_ctx_init(&pb->ctx) < 0 ||
145
+ if (git_hash_ctx_init(&pb->ctx, GIT_HASH_ALGORITHM_SHA1) < 0 ||
153
146
  git_zstream_init(&pb->zstream, GIT_ZSTREAM_DEFLATE) < 0 ||
154
147
  git_repository_odb(&pb->odb, repo) < 0 ||
155
148
  packbuilder_config(pb) < 0)
@@ -177,13 +170,13 @@ on_error:
177
170
 
178
171
  unsigned int git_packbuilder_set_threads(git_packbuilder *pb, unsigned int n)
179
172
  {
180
- assert(pb);
173
+ GIT_ASSERT_ARG(pb);
181
174
 
182
175
  #ifdef GIT_THREADS
183
176
  pb->nr_threads = n;
184
177
  #else
185
178
  GIT_UNUSED(n);
186
- assert(1 == pb->nr_threads);
179
+ GIT_ASSERT(pb->nr_threads == 1);
187
180
  #endif
188
181
 
189
182
  return pb->nr_threads;
@@ -211,7 +204,8 @@ int git_packbuilder_insert(git_packbuilder *pb, const git_oid *oid,
211
204
  size_t newsize;
212
205
  int ret;
213
206
 
214
- assert(pb && oid);
207
+ GIT_ASSERT_ARG(pb);
208
+ GIT_ASSERT_ARG(oid);
215
209
 
216
210
  /* If the object already exists in the hash table, then we don't
217
211
  * have any work to do */
@@ -258,7 +252,7 @@ int git_packbuilder_insert(git_packbuilder *pb, const git_oid *oid,
258
252
  double current_time = git__timer();
259
253
  double elapsed = current_time - pb->last_progress_report_time;
260
254
 
261
- if (elapsed >= MIN_PROGRESS_UPDATE_INTERVAL) {
255
+ if (elapsed < 0 || elapsed >= MIN_PROGRESS_UPDATE_INTERVAL) {
262
256
  pb->last_progress_report_time = current_time;
263
257
 
264
258
  ret = pb->progress_cb(
@@ -347,10 +341,9 @@ static int write_object(
347
341
  }
348
342
 
349
343
  /* Write header */
350
- hdr_len = git_packfile__object_header(hdr, data_len, type);
351
-
352
- if ((error = write_cb(hdr, hdr_len, cb_data)) < 0 ||
353
- (error = git_hash_update(&pb->ctx, hdr, hdr_len)) < 0)
344
+ if ((error = git_packfile__object_header(&hdr_len, hdr, data_len, type)) < 0 ||
345
+ (error = write_cb(hdr, hdr_len, cb_data)) < 0 ||
346
+ (error = git_hash_update(&pb->ctx, hdr, hdr_len)) < 0)
354
347
  goto done;
355
348
 
356
349
  if (type == GIT_OBJECT_REF_DELTA) {
@@ -525,13 +518,18 @@ static int cb_tag_foreach(const char *name, git_oid *oid, void *data)
525
518
  return 0;
526
519
  }
527
520
 
528
- static git_pobject **compute_write_order(git_packbuilder *pb)
521
+ static int compute_write_order(git_pobject ***out, git_packbuilder *pb)
529
522
  {
530
523
  size_t i, wo_end, last_untagged;
531
524
  git_pobject **wo;
532
525
 
526
+ *out = NULL;
527
+
528
+ if (!pb->nr_objects)
529
+ return 0;
530
+
533
531
  if ((wo = git__mallocarray(pb->nr_objects, sizeof(*wo))) == NULL)
534
- return NULL;
532
+ return -1;
535
533
 
536
534
  for (i = 0; i < pb->nr_objects; i++) {
537
535
  git_pobject *po = pb->object_list + i;
@@ -560,7 +558,7 @@ static git_pobject **compute_write_order(git_packbuilder *pb)
560
558
  */
561
559
  if (git_tag_foreach(pb->repo, &cb_tag_foreach, pb) < 0) {
562
560
  git__free(wo);
563
- return NULL;
561
+ return -1;
564
562
  }
565
563
 
566
564
  /*
@@ -617,10 +615,11 @@ static git_pobject **compute_write_order(git_packbuilder *pb)
617
615
  if (wo_end != pb->nr_objects) {
618
616
  git__free(wo);
619
617
  git_error_set(GIT_ERROR_INVALID, "invalid write order");
620
- return NULL;
618
+ return -1;
621
619
  }
622
620
 
623
- return wo;
621
+ *out = wo;
622
+ return 0;
624
623
  }
625
624
 
626
625
  static int write_pack(git_packbuilder *pb,
@@ -633,15 +632,15 @@ static int write_pack(git_packbuilder *pb,
633
632
  struct git_pack_header ph;
634
633
  git_oid entry_oid;
635
634
  size_t i = 0;
636
- int error = 0;
635
+ int error;
637
636
 
638
- write_order = compute_write_order(pb);
639
- if (write_order == NULL)
640
- return -1;
637
+ if ((error = compute_write_order(&write_order, pb)) < 0)
638
+ return error;
641
639
 
642
640
  if (!git__is_uint32(pb->nr_objects)) {
643
641
  git_error_set(GIT_ERROR_INVALID, "too many objects");
644
- return -1;
642
+ error = -1;
643
+ goto done;
645
644
  }
646
645
 
647
646
  /* Write pack header */
@@ -666,7 +665,7 @@ static int write_pack(git_packbuilder *pb,
666
665
  pb->nr_remaining -= pb->nr_written;
667
666
  } while (pb->nr_remaining && i < pb->nr_objects);
668
667
 
669
- if ((error = git_hash_final(&entry_oid, &pb->ctx)) < 0)
668
+ if ((error = git_hash_final(entry_oid.id, &pb->ctx)) < 0)
670
669
  goto done;
671
670
 
672
671
  error = write_cb(entry_oid.id, GIT_OID_RAWSZ, cb_data);
@@ -687,8 +686,8 @@ done:
687
686
 
688
687
  static int write_pack_buf(void *buf, size_t size, void *data)
689
688
  {
690
- git_buf *b = (git_buf *)data;
691
- return git_buf_put(b, buf, size);
689
+ git_str *b = (git_str *)data;
690
+ return git_str_put(b, buf, size);
692
691
  }
693
692
 
694
693
  static int type_size_sort(const void *_a, const void *_b)
@@ -852,10 +851,11 @@ static int try_delta(git_packbuilder *pb, struct unpacked *trg,
852
851
  }
853
852
  }
854
853
 
855
- git_packbuilder__cache_lock(pb);
854
+ GIT_ASSERT(git_packbuilder__cache_lock(pb) == 0);
855
+
856
856
  if (trg_object->delta_data) {
857
857
  git__free(trg_object->delta_data);
858
- assert(pb->delta_cache_size >= trg_object->delta_size);
858
+ GIT_ASSERT(pb->delta_cache_size >= trg_object->delta_size);
859
859
  pb->delta_cache_size -= trg_object->delta_size;
860
860
  trg_object->delta_data = NULL;
861
861
  }
@@ -863,7 +863,7 @@ static int try_delta(git_packbuilder *pb, struct unpacked *trg,
863
863
  bool overflow = git__add_sizet_overflow(
864
864
  &pb->delta_cache_size, pb->delta_cache_size, delta_size);
865
865
 
866
- git_packbuilder__cache_unlock(pb);
866
+ GIT_ASSERT(git_packbuilder__cache_unlock(pb) == 0);
867
867
 
868
868
  if (overflow) {
869
869
  git__free(delta_buf);
@@ -874,7 +874,7 @@ static int try_delta(git_packbuilder *pb, struct unpacked *trg,
874
874
  GIT_ERROR_CHECK_ALLOC(trg_object->delta_data);
875
875
  } else {
876
876
  /* create delta when writing the pack */
877
- git_packbuilder__cache_unlock(pb);
877
+ GIT_ASSERT(git_packbuilder__cache_unlock(pb) == 0);
878
878
  git__free(delta_buf);
879
879
  }
880
880
 
@@ -929,7 +929,7 @@ static int report_delta_progress(
929
929
  double current_time = git__timer();
930
930
  double elapsed = current_time - pb->last_progress_report_time;
931
931
 
932
- if (force || elapsed >= MIN_PROGRESS_UPDATE_INTERVAL) {
932
+ if (force || elapsed < 0 || elapsed >= MIN_PROGRESS_UPDATE_INTERVAL) {
933
933
  pb->last_progress_report_time = current_time;
934
934
 
935
935
  ret = pb->progress_cb(
@@ -948,7 +948,7 @@ static int find_deltas(git_packbuilder *pb, git_pobject **list,
948
948
  size_t *list_size, size_t window, size_t depth)
949
949
  {
950
950
  git_pobject *po;
951
- git_buf zbuf = GIT_BUF_INIT;
951
+ git_str zbuf = GIT_STR_INIT;
952
952
  struct unpacked *array;
953
953
  size_t idx = 0, count = 0;
954
954
  size_t mem_usage = 0;
@@ -962,9 +962,9 @@ static int find_deltas(git_packbuilder *pb, git_pobject **list,
962
962
  struct unpacked *n = array + idx;
963
963
  size_t max_depth, j, best_base = SIZE_MAX;
964
964
 
965
- git_packbuilder__progress_lock(pb);
965
+ GIT_ASSERT(git_packbuilder__progress_lock(pb) == 0);
966
966
  if (!*list_size) {
967
- git_packbuilder__progress_unlock(pb);
967
+ GIT_ASSERT(git_packbuilder__progress_unlock(pb) == 0);
968
968
  break;
969
969
  }
970
970
 
@@ -973,7 +973,7 @@ static int find_deltas(git_packbuilder *pb, git_pobject **list,
973
973
 
974
974
  po = *list++;
975
975
  (*list_size)--;
976
- git_packbuilder__progress_unlock(pb);
976
+ GIT_ASSERT(git_packbuilder__progress_unlock(pb) == 0);
977
977
 
978
978
  mem_usage -= free_unpacked(n);
979
979
  n->object = po;
@@ -1046,12 +1046,12 @@ static int find_deltas(git_packbuilder *pb, git_pobject **list,
1046
1046
 
1047
1047
  memcpy(po->delta_data, zbuf.ptr, zbuf.size);
1048
1048
  po->z_delta_size = zbuf.size;
1049
- git_buf_clear(&zbuf);
1049
+ git_str_clear(&zbuf);
1050
1050
 
1051
- git_packbuilder__cache_lock(pb);
1051
+ GIT_ASSERT(git_packbuilder__cache_lock(pb) == 0);
1052
1052
  pb->delta_cache_size -= po->delta_size;
1053
1053
  pb->delta_cache_size += po->z_delta_size;
1054
- git_packbuilder__cache_unlock(pb);
1054
+ GIT_ASSERT(git_packbuilder__cache_unlock(pb) == 0);
1055
1055
  }
1056
1056
 
1057
1057
  /*
@@ -1094,7 +1094,7 @@ on_error:
1094
1094
  git__free(array[i].data);
1095
1095
  }
1096
1096
  git__free(array);
1097
- git_buf_dispose(&zbuf);
1097
+ git_str_dispose(&zbuf);
1098
1098
 
1099
1099
  return error;
1100
1100
  }
@@ -1129,10 +1129,10 @@ static void *threaded_find_deltas(void *arg)
1129
1129
  ; /* TODO */
1130
1130
  }
1131
1131
 
1132
- git_packbuilder__progress_lock(me->pb);
1132
+ GIT_ASSERT_WITH_RETVAL(git_packbuilder__progress_lock(me->pb) == 0, NULL);
1133
1133
  me->working = 0;
1134
1134
  git_cond_signal(&me->pb->progress_cond);
1135
- git_packbuilder__progress_unlock(me->pb);
1135
+ GIT_ASSERT_WITH_RETVAL(git_packbuilder__progress_unlock(me->pb) == 0, NULL);
1136
1136
 
1137
1137
  if (git_mutex_lock(&me->mutex)) {
1138
1138
  git_error_set(GIT_ERROR_THREAD, "unable to lock packfile condition mutex");
@@ -1165,7 +1165,7 @@ static int ll_find_deltas(git_packbuilder *pb, git_pobject **list,
1165
1165
  int ret, active_threads = 0;
1166
1166
 
1167
1167
  if (!pb->nr_threads)
1168
- pb->nr_threads = git_online_cpus();
1168
+ pb->nr_threads = git__online_cpus();
1169
1169
 
1170
1170
  if (pb->nr_threads <= 1) {
1171
1171
  find_deltas(pb, list, &list_size, window, depth);
@@ -1237,7 +1237,7 @@ static int ll_find_deltas(git_packbuilder *pb, git_pobject **list,
1237
1237
  * 'working' flag from 1 -> 0. This indicates that it is
1238
1238
  * ready to receive more work using our work-stealing
1239
1239
  * algorithm. */
1240
- git_packbuilder__progress_lock(pb);
1240
+ GIT_ASSERT(git_packbuilder__progress_lock(pb) == 0);
1241
1241
  for (;;) {
1242
1242
  for (i = 0; !target && i < pb->nr_threads; i++)
1243
1243
  if (!p[i].working)
@@ -1280,7 +1280,7 @@ static int ll_find_deltas(git_packbuilder *pb, git_pobject **list,
1280
1280
  target->list_size = sub_size;
1281
1281
  target->remaining = sub_size;
1282
1282
  target->working = 1;
1283
- git_packbuilder__progress_unlock(pb);
1283
+ GIT_ASSERT(git_packbuilder__progress_unlock(pb) == 0);
1284
1284
 
1285
1285
  if (git_mutex_lock(&target->mutex)) {
1286
1286
  git_error_set(GIT_ERROR_THREAD, "unable to lock packfile condition mutex");
@@ -1308,7 +1308,7 @@ static int ll_find_deltas(git_packbuilder *pb, git_pobject **list,
1308
1308
  #define ll_find_deltas(pb, l, ls, w, d) find_deltas(pb, l, &ls, w, d)
1309
1309
  #endif
1310
1310
 
1311
- static int prepare_pack(git_packbuilder *pb)
1311
+ int git_packbuilder__prepare(git_packbuilder *pb)
1312
1312
  {
1313
1313
  git_pobject **delta_list;
1314
1314
  size_t i, n = 0;
@@ -1353,7 +1353,7 @@ static int prepare_pack(git_packbuilder *pb)
1353
1353
  return 0;
1354
1354
  }
1355
1355
 
1356
- #define PREPARE_PACK if (prepare_pack(pb) < 0) { return -1; }
1356
+ #define PREPARE_PACK if (git_packbuilder__prepare(pb) < 0) { return -1; }
1357
1357
 
1358
1358
  int git_packbuilder_foreach(git_packbuilder *pb, int (*cb)(void *buf, size_t size, void *payload), void *payload)
1359
1359
  {
@@ -1361,13 +1361,18 @@ int git_packbuilder_foreach(git_packbuilder *pb, int (*cb)(void *buf, size_t siz
1361
1361
  return write_pack(pb, cb, payload);
1362
1362
  }
1363
1363
 
1364
- int git_packbuilder_write_buf(git_buf *buf, git_packbuilder *pb)
1364
+ int git_packbuilder__write_buf(git_str *buf, git_packbuilder *pb)
1365
1365
  {
1366
1366
  PREPARE_PACK;
1367
- git_buf_sanitize(buf);
1367
+
1368
1368
  return write_pack(pb, &write_pack_buf, buf);
1369
1369
  }
1370
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
+
1371
1376
  static int write_cb(void *buf, size_t len, void *payload)
1372
1377
  {
1373
1378
  struct pack_write_context *ctx = payload;
@@ -1382,7 +1387,7 @@ int git_packbuilder_write(
1382
1387
  void *progress_cb_payload)
1383
1388
  {
1384
1389
  int error = -1;
1385
- git_buf object_path = GIT_BUF_INIT;
1390
+ git_str object_path = GIT_STR_INIT;
1386
1391
  git_indexer_options opts = GIT_INDEXER_OPTIONS_INIT;
1387
1392
  git_indexer *indexer = NULL;
1388
1393
  git_indexer_progress stats;
@@ -1392,11 +1397,11 @@ int git_packbuilder_write(
1392
1397
  PREPARE_PACK;
1393
1398
 
1394
1399
  if (path == NULL) {
1395
- 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)
1396
1401
  goto cleanup;
1397
- 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)
1398
1403
  goto cleanup;
1399
- path = git_buf_cstr(&object_path);
1404
+ path = git_str_cstr(&object_path);
1400
1405
  }
1401
1406
 
1402
1407
  opts.progress_cb = progress_cb;
@@ -1417,20 +1422,32 @@ int git_packbuilder_write(
1417
1422
  if ((error = git_indexer_commit(indexer, &stats)) < 0)
1418
1423
  goto cleanup;
1419
1424
 
1425
+ #ifndef GIT_DEPRECATE_HARD
1420
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);
1421
1431
 
1422
1432
  cleanup:
1423
1433
  git_indexer_free(indexer);
1424
- git_buf_dispose(&object_path);
1434
+ git_str_dispose(&object_path);
1425
1435
  return error;
1426
1436
  }
1427
1437
 
1428
1438
  #undef PREPARE_PACK
1429
1439
 
1440
+ #ifndef GIT_DEPRECATE_HARD
1430
1441
  const git_oid *git_packbuilder_hash(git_packbuilder *pb)
1431
1442
  {
1432
1443
  return &pb->pack_oid;
1433
1444
  }
1445
+ #endif
1446
+
1447
+ const char *git_packbuilder_name(git_packbuilder *pb)
1448
+ {
1449
+ return pb->pack_name;
1450
+ }
1434
1451
 
1435
1452
 
1436
1453
  static int cb_tree_walk(
@@ -1443,10 +1460,10 @@ static int cb_tree_walk(
1443
1460
  if (git_tree_entry_type(entry) == GIT_OBJECT_COMMIT)
1444
1461
  return 0;
1445
1462
 
1446
- if (!(error = git_buf_sets(&ctx->buf, root)) &&
1447
- !(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))))
1448
1465
  error = git_packbuilder_insert(
1449
- 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));
1450
1467
 
1451
1468
  return error;
1452
1469
  }
@@ -1470,14 +1487,14 @@ int git_packbuilder_insert_tree(git_packbuilder *pb, const git_oid *oid)
1470
1487
  {
1471
1488
  int error;
1472
1489
  git_tree *tree = NULL;
1473
- struct tree_walk_context context = { pb, GIT_BUF_INIT };
1490
+ struct tree_walk_context context = { pb, GIT_STR_INIT };
1474
1491
 
1475
1492
  if (!(error = git_tree_lookup(&tree, pb->repo, oid)) &&
1476
1493
  !(error = git_packbuilder_insert(pb, oid, NULL)))
1477
1494
  error = git_tree_walk(tree, GIT_TREEWALK_PRE, cb_tree_walk, &context);
1478
1495
 
1479
1496
  git_tree_free(tree);
1480
- git_buf_dispose(&context.buf);
1497
+ git_str_dispose(&context.buf);
1481
1498
  return error;
1482
1499
  }
1483
1500
 
@@ -1486,7 +1503,8 @@ int git_packbuilder_insert_recur(git_packbuilder *pb, const git_oid *id, const c
1486
1503
  git_object *obj;
1487
1504
  int error;
1488
1505
 
1489
- assert(pb && id);
1506
+ GIT_ASSERT_ARG(pb);
1507
+ GIT_ASSERT_ARG(id);
1490
1508
 
1491
1509
  if ((error = git_object_lookup(&obj, pb->repo, id, GIT_OBJECT_ANY)) < 0)
1492
1510
  return error;
@@ -1727,7 +1745,8 @@ int git_packbuilder_insert_walk(git_packbuilder *pb, git_revwalk *walk)
1727
1745
  git_oid id;
1728
1746
  struct walk_object *obj;
1729
1747
 
1730
- assert(pb && walk);
1748
+ GIT_ASSERT_ARG(pb);
1749
+ GIT_ASSERT_ARG(walk);
1731
1750
 
1732
1751
  if ((error = mark_edges_uninteresting(pb, walk->user_input)) < 0)
1733
1752
  return error;
@@ -1796,5 +1815,7 @@ void git_packbuilder_free(git_packbuilder *pb)
1796
1815
  git_hash_ctx_cleanup(&pb->ctx);
1797
1816
  git_zstream_free(&pb->zstream);
1798
1817
 
1818
+ git__free(pb->pack_name);
1819
+
1799
1820
  git__free(pb);
1800
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