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
@@ -7,10 +7,11 @@
7
7
 
8
8
  #include "common.h"
9
9
 
10
- #include "buffer.h"
10
+ #include "str.h"
11
11
  #include "repository.h"
12
12
  #include "posix.h"
13
13
  #include "filebuf.h"
14
+ #include "commit.h"
14
15
  #include "merge.h"
15
16
  #include "array.h"
16
17
  #include "config.h"
@@ -52,7 +53,7 @@ typedef enum {
52
53
  GIT_REBASE_NONE = 0,
53
54
  GIT_REBASE_APPLY = 1,
54
55
  GIT_REBASE_MERGE = 2,
55
- GIT_REBASE_INTERACTIVE = 3,
56
+ GIT_REBASE_INTERACTIVE = 3
56
57
  } git_rebase_t;
57
58
 
58
59
  struct git_rebase {
@@ -63,10 +64,10 @@ struct git_rebase {
63
64
  git_rebase_t type;
64
65
  char *state_path;
65
66
 
66
- int head_detached : 1,
67
- inmemory : 1,
68
- quiet : 1,
69
- started : 1;
67
+ unsigned int head_detached:1,
68
+ inmemory:1,
69
+ quiet:1,
70
+ started:1;
70
71
 
71
72
  git_array_t(git_rebase_operation) operations;
72
73
  size_t current;
@@ -90,22 +91,22 @@ static int rebase_state_type(
90
91
  char **path_out,
91
92
  git_repository *repo)
92
93
  {
93
- git_buf path = GIT_BUF_INIT;
94
+ git_str path = GIT_STR_INIT;
94
95
  git_rebase_t type = GIT_REBASE_NONE;
95
96
 
96
- if (git_buf_joinpath(&path, repo->gitdir, REBASE_APPLY_DIR) < 0)
97
+ if (git_str_joinpath(&path, repo->gitdir, REBASE_APPLY_DIR) < 0)
97
98
  return -1;
98
99
 
99
- if (git_path_isdir(git_buf_cstr(&path))) {
100
+ if (git_fs_path_isdir(git_str_cstr(&path))) {
100
101
  type = GIT_REBASE_APPLY;
101
102
  goto done;
102
103
  }
103
104
 
104
- git_buf_clear(&path);
105
- if (git_buf_joinpath(&path, repo->gitdir, REBASE_MERGE_DIR) < 0)
105
+ git_str_clear(&path);
106
+ if (git_str_joinpath(&path, repo->gitdir, REBASE_MERGE_DIR) < 0)
106
107
  return -1;
107
108
 
108
- if (git_path_isdir(git_buf_cstr(&path))) {
109
+ if (git_fs_path_isdir(git_str_cstr(&path))) {
109
110
  type = GIT_REBASE_MERGE;
110
111
  goto done;
111
112
  }
@@ -114,36 +115,36 @@ done:
114
115
  *type_out = type;
115
116
 
116
117
  if (type != GIT_REBASE_NONE && path_out)
117
- *path_out = git_buf_detach(&path);
118
+ *path_out = git_str_detach(&path);
118
119
 
119
- git_buf_dispose(&path);
120
+ git_str_dispose(&path);
120
121
 
121
122
  return 0;
122
123
  }
123
124
 
124
125
  GIT_INLINE(int) rebase_readfile(
125
- git_buf *out,
126
- git_buf *state_path,
126
+ git_str *out,
127
+ git_str *state_path,
127
128
  const char *filename)
128
129
  {
129
130
  size_t state_path_len = state_path->size;
130
131
  int error;
131
132
 
132
- git_buf_clear(out);
133
+ git_str_clear(out);
133
134
 
134
- if ((error = git_buf_joinpath(state_path, state_path->ptr, filename)) < 0 ||
135
+ if ((error = git_str_joinpath(state_path, state_path->ptr, filename)) < 0 ||
135
136
  (error = git_futils_readbuffer(out, state_path->ptr)) < 0)
136
137
  goto done;
137
138
 
138
- git_buf_rtrim(out);
139
+ git_str_rtrim(out);
139
140
 
140
141
  done:
141
- git_buf_truncate(state_path, state_path_len);
142
+ git_str_truncate(state_path, state_path_len);
142
143
  return error;
143
144
  }
144
145
 
145
146
  GIT_INLINE(int) rebase_readint(
146
- size_t *out, git_buf *asc_out, git_buf *state_path, const char *filename)
147
+ size_t *out, git_str *asc_out, git_str *state_path, const char *filename)
147
148
  {
148
149
  int32_t num;
149
150
  const char *eol;
@@ -163,7 +164,7 @@ GIT_INLINE(int) rebase_readint(
163
164
  }
164
165
 
165
166
  GIT_INLINE(int) rebase_readoid(
166
- git_oid *out, git_buf *str_out, git_buf *state_path, const char *filename)
167
+ git_oid *out, git_str *str_out, git_str *state_path, const char *filename)
167
168
  {
168
169
  int error;
169
170
 
@@ -186,8 +187,8 @@ static git_rebase_operation *rebase_operation_alloc(
186
187
  {
187
188
  git_rebase_operation *operation;
188
189
 
189
- assert((type == GIT_REBASE_OPERATION_EXEC) == !id);
190
- assert((type == GIT_REBASE_OPERATION_EXEC) == !!exec);
190
+ GIT_ASSERT_WITH_RETVAL((type == GIT_REBASE_OPERATION_EXEC) == !id, NULL);
191
+ GIT_ASSERT_WITH_RETVAL((type == GIT_REBASE_OPERATION_EXEC) == !!exec, NULL);
191
192
 
192
193
  if ((operation = git_array_alloc(rebase->operations)) == NULL)
193
194
  return NULL;
@@ -201,13 +202,13 @@ static git_rebase_operation *rebase_operation_alloc(
201
202
 
202
203
  static int rebase_open_merge(git_rebase *rebase)
203
204
  {
204
- git_buf state_path = GIT_BUF_INIT, buf = GIT_BUF_INIT, cmt = GIT_BUF_INIT;
205
+ git_str state_path = GIT_STR_INIT, buf = GIT_STR_INIT, cmt = GIT_STR_INIT;
205
206
  git_oid id;
206
207
  git_rebase_operation *operation;
207
208
  size_t i, msgnum = 0, end;
208
209
  int error;
209
210
 
210
- if ((error = git_buf_puts(&state_path, rebase->state_path)) < 0)
211
+ if ((error = git_str_puts(&state_path, rebase->state_path)) < 0)
211
212
  goto done;
212
213
 
213
214
  /* Read 'msgnum' if it exists (otherwise, let msgnum = 0) */
@@ -234,9 +235,9 @@ static int rebase_open_merge(git_rebase *rebase)
234
235
  GIT_ERROR_CHECK_ARRAY(rebase->operations);
235
236
 
236
237
  for (i = 0; i < end; i++) {
237
- git_buf_clear(&cmt);
238
+ git_str_clear(&cmt);
238
239
 
239
- if ((error = git_buf_printf(&cmt, "cmt.%" PRIuZ, (i+1))) < 0 ||
240
+ if ((error = git_str_printf(&cmt, "cmt.%" PRIuZ, (i+1))) < 0 ||
240
241
  (error = rebase_readoid(&id, &buf, &state_path, cmt.ptr)) < 0)
241
242
  goto done;
242
243
 
@@ -248,12 +249,12 @@ static int rebase_open_merge(git_rebase *rebase)
248
249
  if ((error = rebase_readfile(&buf, &state_path, ONTO_NAME_FILE)) < 0)
249
250
  goto done;
250
251
 
251
- rebase->onto_name = git_buf_detach(&buf);
252
+ rebase->onto_name = git_str_detach(&buf);
252
253
 
253
254
  done:
254
- git_buf_dispose(&cmt);
255
- git_buf_dispose(&state_path);
256
- git_buf_dispose(&buf);
255
+ git_str_dispose(&cmt);
256
+ git_str_dispose(&state_path);
257
+ git_str_dispose(&buf);
257
258
 
258
259
  return error;
259
260
  }
@@ -296,12 +297,12 @@ int git_rebase_open(
296
297
  const git_rebase_options *given_opts)
297
298
  {
298
299
  git_rebase *rebase;
299
- git_buf path = GIT_BUF_INIT, orig_head_name = GIT_BUF_INIT,
300
- orig_head_id = GIT_BUF_INIT, onto_id = GIT_BUF_INIT;
300
+ git_str path = GIT_STR_INIT, orig_head_name = GIT_STR_INIT,
301
+ orig_head_id = GIT_STR_INIT, onto_id = GIT_STR_INIT;
301
302
  size_t state_path_len;
302
303
  int error;
303
304
 
304
- assert(repo);
305
+ GIT_ASSERT_ARG(repo);
305
306
 
306
307
  if ((error = rebase_check_versions(given_opts)) < 0)
307
308
  return error;
@@ -320,54 +321,54 @@ int git_rebase_open(
320
321
  goto done;
321
322
  }
322
323
 
323
- if ((error = git_buf_puts(&path, rebase->state_path)) < 0)
324
+ if ((error = git_str_puts(&path, rebase->state_path)) < 0)
324
325
  goto done;
325
326
 
326
- state_path_len = git_buf_len(&path);
327
+ state_path_len = git_str_len(&path);
327
328
 
328
- if ((error = git_buf_joinpath(&path, path.ptr, HEAD_NAME_FILE)) < 0 ||
329
+ if ((error = git_str_joinpath(&path, path.ptr, HEAD_NAME_FILE)) < 0 ||
329
330
  (error = git_futils_readbuffer(&orig_head_name, path.ptr)) < 0)
330
331
  goto done;
331
332
 
332
- git_buf_rtrim(&orig_head_name);
333
+ git_str_rtrim(&orig_head_name);
333
334
 
334
335
  if (strcmp(ORIG_DETACHED_HEAD, orig_head_name.ptr) == 0)
335
336
  rebase->head_detached = 1;
336
337
 
337
- git_buf_truncate(&path, state_path_len);
338
+ git_str_truncate(&path, state_path_len);
338
339
 
339
- if ((error = git_buf_joinpath(&path, path.ptr, ORIG_HEAD_FILE)) < 0)
340
+ if ((error = git_str_joinpath(&path, path.ptr, ORIG_HEAD_FILE)) < 0)
340
341
  goto done;
341
342
 
342
- if (!git_path_isfile(path.ptr)) {
343
+ if (!git_fs_path_isfile(path.ptr)) {
343
344
  /* Previous versions of git.git used 'head' here; support that. */
344
- git_buf_truncate(&path, state_path_len);
345
+ git_str_truncate(&path, state_path_len);
345
346
 
346
- if ((error = git_buf_joinpath(&path, path.ptr, HEAD_FILE)) < 0)
347
+ if ((error = git_str_joinpath(&path, path.ptr, HEAD_FILE)) < 0)
347
348
  goto done;
348
349
  }
349
350
 
350
351
  if ((error = git_futils_readbuffer(&orig_head_id, path.ptr)) < 0)
351
352
  goto done;
352
353
 
353
- git_buf_rtrim(&orig_head_id);
354
+ git_str_rtrim(&orig_head_id);
354
355
 
355
356
  if ((error = git_oid_fromstr(&rebase->orig_head_id, orig_head_id.ptr)) < 0)
356
357
  goto done;
357
358
 
358
- git_buf_truncate(&path, state_path_len);
359
+ git_str_truncate(&path, state_path_len);
359
360
 
360
- if ((error = git_buf_joinpath(&path, path.ptr, ONTO_FILE)) < 0 ||
361
+ if ((error = git_str_joinpath(&path, path.ptr, ONTO_FILE)) < 0 ||
361
362
  (error = git_futils_readbuffer(&onto_id, path.ptr)) < 0)
362
363
  goto done;
363
364
 
364
- git_buf_rtrim(&onto_id);
365
+ git_str_rtrim(&onto_id);
365
366
 
366
367
  if ((error = git_oid_fromstr(&rebase->onto_id, onto_id.ptr)) < 0)
367
368
  goto done;
368
369
 
369
370
  if (!rebase->head_detached)
370
- rebase->orig_head_name = git_buf_detach(&orig_head_name);
371
+ rebase->orig_head_name = git_str_detach(&orig_head_name);
371
372
 
372
373
  switch (rebase->type) {
373
374
  case GIT_REBASE_INTERACTIVE:
@@ -391,10 +392,10 @@ done:
391
392
  else
392
393
  git_rebase_free(rebase);
393
394
 
394
- git_buf_dispose(&path);
395
- git_buf_dispose(&orig_head_name);
396
- git_buf_dispose(&orig_head_id);
397
- git_buf_dispose(&onto_id);
395
+ git_str_dispose(&path);
396
+ git_str_dispose(&orig_head_name);
397
+ git_str_dispose(&orig_head_id);
398
+ git_str_dispose(&onto_id);
398
399
  return error;
399
400
  }
400
401
 
@@ -403,27 +404,27 @@ static int rebase_cleanup(git_rebase *rebase)
403
404
  if (!rebase || rebase->inmemory)
404
405
  return 0;
405
406
 
406
- return git_path_isdir(rebase->state_path) ?
407
+ return git_fs_path_isdir(rebase->state_path) ?
407
408
  git_futils_rmdir_r(rebase->state_path, NULL, GIT_RMDIR_REMOVE_FILES) :
408
409
  0;
409
410
  }
410
411
 
411
412
  static int rebase_setupfile(git_rebase *rebase, const char *filename, int flags, const char *fmt, ...)
412
413
  {
413
- git_buf path = GIT_BUF_INIT,
414
- contents = GIT_BUF_INIT;
414
+ git_str path = GIT_STR_INIT,
415
+ contents = GIT_STR_INIT;
415
416
  va_list ap;
416
417
  int error;
417
418
 
418
419
  va_start(ap, fmt);
419
- git_buf_vprintf(&contents, fmt, ap);
420
+ git_str_vprintf(&contents, fmt, ap);
420
421
  va_end(ap);
421
422
 
422
- if ((error = git_buf_joinpath(&path, rebase->state_path, filename)) == 0)
423
+ if ((error = git_str_joinpath(&path, rebase->state_path, filename)) == 0)
423
424
  error = git_futils_writebuffer(&contents, path.ptr, flags, REBASE_FILE_MODE);
424
425
 
425
- git_buf_dispose(&path);
426
- git_buf_dispose(&contents);
426
+ git_str_dispose(&path);
427
+ git_str_dispose(&contents);
427
428
 
428
429
  return error;
429
430
  }
@@ -440,7 +441,7 @@ static const char *rebase_onto_name(const git_annotated_commit *onto)
440
441
 
441
442
  static int rebase_setupfiles_merge(git_rebase *rebase)
442
443
  {
443
- git_buf commit_filename = GIT_BUF_INIT;
444
+ git_str commit_filename = GIT_STR_INIT;
444
445
  char id_str[GIT_OID_HEXSZ];
445
446
  git_rebase_operation *operation;
446
447
  size_t i;
@@ -453,8 +454,8 @@ static int rebase_setupfiles_merge(git_rebase *rebase)
453
454
  for (i = 0; i < git_array_size(rebase->operations); i++) {
454
455
  operation = git_array_get(rebase->operations, i);
455
456
 
456
- git_buf_clear(&commit_filename);
457
- git_buf_printf(&commit_filename, CMT_FILE_FMT, i+1);
457
+ git_str_clear(&commit_filename);
458
+ git_str_printf(&commit_filename, CMT_FILE_FMT, i+1);
458
459
 
459
460
  git_oid_fmt(id_str, &operation->id);
460
461
 
@@ -464,7 +465,7 @@ static int rebase_setupfiles_merge(git_rebase *rebase)
464
465
  }
465
466
 
466
467
  done:
467
- git_buf_dispose(&commit_filename);
468
+ git_str_dispose(&commit_filename);
468
469
  return error;
469
470
  }
470
471
 
@@ -626,16 +627,16 @@ static int rebase_init_merge(
626
627
  {
627
628
  git_reference *head_ref = NULL;
628
629
  git_commit *onto_commit = NULL;
629
- git_buf reflog = GIT_BUF_INIT;
630
- git_buf state_path = GIT_BUF_INIT;
630
+ git_str reflog = GIT_STR_INIT;
631
+ git_str state_path = GIT_STR_INIT;
631
632
  int error;
632
633
 
633
634
  GIT_UNUSED(upstream);
634
635
 
635
- if ((error = git_buf_joinpath(&state_path, repo->gitdir, REBASE_MERGE_DIR)) < 0)
636
+ if ((error = git_str_joinpath(&state_path, repo->gitdir, REBASE_MERGE_DIR)) < 0)
636
637
  goto done;
637
638
 
638
- rebase->state_path = git_buf_detach(&state_path);
639
+ rebase->state_path = git_str_detach(&state_path);
639
640
  GIT_ERROR_CHECK_ALLOC(rebase->state_path);
640
641
 
641
642
  if (branch->ref_name && strcmp(branch->ref_name, "HEAD")) {
@@ -654,7 +655,7 @@ static int rebase_init_merge(
654
655
  git_oid_cpy(&rebase->onto_id, git_annotated_commit_id(onto));
655
656
 
656
657
  if ((error = rebase_setupfiles(rebase)) < 0 ||
657
- (error = git_buf_printf(&reflog,
658
+ (error = git_str_printf(&reflog,
658
659
  "rebase: checkout %s", rebase_onto_name(onto))) < 0 ||
659
660
  (error = git_commit_lookup(
660
661
  &onto_commit, repo, git_annotated_commit_id(onto))) < 0 ||
@@ -667,8 +668,8 @@ static int rebase_init_merge(
667
668
  done:
668
669
  git_reference_free(head_ref);
669
670
  git_commit_free(onto_commit);
670
- git_buf_dispose(&reflog);
671
- git_buf_dispose(&state_path);
671
+ git_str_dispose(&reflog);
672
+ git_str_dispose(&state_path);
672
673
 
673
674
  return error;
674
675
  }
@@ -701,7 +702,8 @@ int git_rebase_init(
701
702
  bool inmemory = (given_opts && given_opts->inmemory);
702
703
  int error;
703
704
 
704
- assert(repo && (upstream || onto));
705
+ GIT_ASSERT_ARG(repo);
706
+ GIT_ASSERT_ARG(upstream || onto);
705
707
 
706
708
  *out = NULL;
707
709
 
@@ -794,7 +796,7 @@ static int rebase_next_merge(
794
796
  git_rebase_operation **out,
795
797
  git_rebase *rebase)
796
798
  {
797
- git_buf path = GIT_BUF_INIT;
799
+ git_str path = GIT_STR_INIT;
798
800
  git_commit *current_commit = NULL, *parent_commit = NULL;
799
801
  git_tree *current_tree = NULL, *head_tree = NULL, *parent_tree = NULL;
800
802
  git_index *index = NULL;
@@ -847,7 +849,7 @@ done:
847
849
  git_tree_free(parent_tree);
848
850
  git_commit_free(parent_commit);
849
851
  git_commit_free(current_commit);
850
- git_buf_dispose(&path);
852
+ git_str_dispose(&path);
851
853
 
852
854
  return error;
853
855
  }
@@ -912,7 +914,8 @@ int git_rebase_next(
912
914
  {
913
915
  int error;
914
916
 
915
- assert(out && rebase);
917
+ GIT_ASSERT_ARG(out);
918
+ GIT_ASSERT_ARG(rebase);
916
919
 
917
920
  if ((error = rebase_movenext(rebase)) < 0)
918
921
  return error;
@@ -931,7 +934,9 @@ int git_rebase_inmemory_index(
931
934
  git_index **out,
932
935
  git_rebase *rebase)
933
936
  {
934
- assert(out && rebase && rebase->index);
937
+ GIT_ASSERT_ARG(out);
938
+ GIT_ASSERT_ARG(rebase);
939
+ GIT_ASSERT_ARG(rebase->index);
935
940
 
936
941
  GIT_REFCOUNT_INC(rebase->index);
937
942
  *out = rebase->index;
@@ -939,6 +944,54 @@ int git_rebase_inmemory_index(
939
944
  return 0;
940
945
  }
941
946
 
947
+ #ifndef GIT_DEPRECATE_HARD
948
+ static int create_signed(
949
+ git_oid *out,
950
+ git_rebase *rebase,
951
+ const git_signature *author,
952
+ const git_signature *committer,
953
+ const char *message_encoding,
954
+ const char *message,
955
+ git_tree *tree,
956
+ size_t parent_count,
957
+ const git_commit **parents)
958
+ {
959
+ git_str commit_content = GIT_STR_INIT;
960
+ git_buf commit_signature = { NULL, 0, 0 },
961
+ signature_field = { NULL, 0, 0 };
962
+ int error;
963
+
964
+ git_error_clear();
965
+
966
+ if ((error = git_commit__create_buffer(&commit_content,
967
+ rebase->repo, author, committer, message_encoding,
968
+ message, tree, parent_count, parents)) < 0)
969
+ goto done;
970
+
971
+ error = rebase->options.signing_cb(&commit_signature,
972
+ &signature_field, commit_content.ptr,
973
+ rebase->options.payload);
974
+
975
+ if (error) {
976
+ if (error != GIT_PASSTHROUGH)
977
+ git_error_set_after_callback_function(error, "signing_cb");
978
+
979
+ goto done;
980
+ }
981
+
982
+ error = git_commit_create_with_signature(out, rebase->repo,
983
+ commit_content.ptr,
984
+ commit_signature.size > 0 ? commit_signature.ptr : NULL,
985
+ signature_field.size > 0 ? signature_field.ptr : NULL);
986
+
987
+ done:
988
+ git_buf_dispose(&commit_signature);
989
+ git_buf_dispose(&signature_field);
990
+ git_str_dispose(&commit_content);
991
+ return error;
992
+ }
993
+ #endif
994
+
942
995
  static int rebase_commit__create(
943
996
  git_commit **out,
944
997
  git_rebase *rebase,
@@ -953,10 +1006,6 @@ static int rebase_commit__create(
953
1006
  git_commit *current_commit = NULL, *commit = NULL;
954
1007
  git_tree *parent_tree = NULL, *tree = NULL;
955
1008
  git_oid tree_id, commit_id;
956
- git_buf commit_content = GIT_BUF_INIT, commit_signature = GIT_BUF_INIT,
957
- signature_field = GIT_BUF_INIT;
958
- const char *signature_field_string = NULL,
959
- *commit_signature_string = NULL;
960
1009
  int error;
961
1010
 
962
1011
  operation = git_array_get(rebase->operations, rebase->current);
@@ -987,37 +1036,32 @@ static int rebase_commit__create(
987
1036
  message = git_commit_message(current_commit);
988
1037
  }
989
1038
 
990
- if ((error = git_commit_create_buffer(&commit_content, rebase->repo, author, committer,
991
- message_encoding, message, tree, 1, (const git_commit **)&parent_commit)) < 0)
992
- goto done;
1039
+ git_error_clear();
1040
+ error = GIT_PASSTHROUGH;
993
1041
 
994
- if (rebase->options.signing_cb) {
995
- git_error_clear();
996
- error = git_error_set_after_callback_function(rebase->options.signing_cb(
997
- &commit_signature, &signature_field, git_buf_cstr(&commit_content),
998
- rebase->options.payload), "commit signing_cb failed");
999
- if (error == GIT_PASSTHROUGH) {
1000
- git_buf_dispose(&commit_signature);
1001
- git_buf_dispose(&signature_field);
1002
- git_error_clear();
1003
- error = GIT_OK;
1004
- } else if (error < 0)
1005
- goto done;
1006
- }
1042
+ if (rebase->options.commit_create_cb) {
1043
+ error = rebase->options.commit_create_cb(&commit_id,
1044
+ author, committer, message_encoding, message,
1045
+ tree, 1, (const git_commit **)&parent_commit,
1046
+ rebase->options.payload);
1007
1047
 
1008
- if (git_buf_is_allocated(&commit_signature)) {
1009
- assert(git_buf_contains_nul(&commit_signature));
1010
- commit_signature_string = git_buf_cstr(&commit_signature);
1048
+ git_error_set_after_callback_function(error,
1049
+ "commit_create_cb");
1011
1050
  }
1012
-
1013
- if (git_buf_is_allocated(&signature_field)) {
1014
- assert(git_buf_contains_nul(&signature_field));
1015
- signature_field_string = git_buf_cstr(&signature_field);
1051
+ #ifndef GIT_DEPRECATE_HARD
1052
+ else if (rebase->options.signing_cb) {
1053
+ error = create_signed(&commit_id, rebase, author,
1054
+ committer, message_encoding, message, tree,
1055
+ 1, (const git_commit **)&parent_commit);
1016
1056
  }
1057
+ #endif
1058
+
1059
+ if (error == GIT_PASSTHROUGH)
1060
+ error = git_commit_create(&commit_id, rebase->repo, NULL,
1061
+ author, committer, message_encoding, message,
1062
+ tree, 1, (const git_commit **)&parent_commit);
1017
1063
 
1018
- if ((error = git_commit_create_with_signature(&commit_id, rebase->repo,
1019
- git_buf_cstr(&commit_content), commit_signature_string,
1020
- signature_field_string)))
1064
+ if (error)
1021
1065
  goto done;
1022
1066
 
1023
1067
  if ((error = git_commit_lookup(&commit, rebase->repo, &commit_id)) < 0)
@@ -1029,9 +1073,6 @@ done:
1029
1073
  if (error < 0)
1030
1074
  git_commit_free(commit);
1031
1075
 
1032
- git_buf_dispose(&commit_signature);
1033
- git_buf_dispose(&signature_field);
1034
- git_buf_dispose(&commit_content);
1035
1076
  git_commit_free(current_commit);
1036
1077
  git_tree_free(parent_tree);
1037
1078
  git_tree_free(tree);
@@ -1055,7 +1096,7 @@ static int rebase_commit_merge(
1055
1096
  int error;
1056
1097
 
1057
1098
  operation = git_array_get(rebase->operations, rebase->current);
1058
- assert(operation);
1099
+ GIT_ASSERT(operation);
1059
1100
 
1060
1101
  if ((error = rebase_ensure_not_dirty(rebase->repo, false, true, GIT_EUNMERGED)) < 0 ||
1061
1102
  (error = git_repository_head(&head, rebase->repo)) < 0 ||
@@ -1095,9 +1136,9 @@ static int rebase_commit_inmemory(
1095
1136
  git_commit *commit = NULL;
1096
1137
  int error = 0;
1097
1138
 
1098
- assert(rebase->index);
1099
- assert(rebase->last_commit);
1100
- assert(rebase->current < rebase->operations.size);
1139
+ GIT_ASSERT_ARG(rebase->index);
1140
+ GIT_ASSERT_ARG(rebase->last_commit);
1141
+ GIT_ASSERT_ARG(rebase->current < rebase->operations.size);
1101
1142
 
1102
1143
  if ((error = rebase_commit__create(&commit, rebase, rebase->index,
1103
1144
  rebase->last_commit, author, committer, message_encoding, message)) < 0)
@@ -1125,7 +1166,8 @@ int git_rebase_commit(
1125
1166
  {
1126
1167
  int error;
1127
1168
 
1128
- assert(rebase && committer);
1169
+ GIT_ASSERT_ARG(rebase);
1170
+ GIT_ASSERT_ARG(committer);
1129
1171
 
1130
1172
  if (rebase->inmemory)
1131
1173
  error = rebase_commit_inmemory(
@@ -1145,7 +1187,7 @@ int git_rebase_abort(git_rebase *rebase)
1145
1187
  git_commit *orig_head_commit = NULL;
1146
1188
  int error;
1147
1189
 
1148
- assert(rebase);
1190
+ GIT_ASSERT_ARG(rebase);
1149
1191
 
1150
1192
  if (rebase->inmemory)
1151
1193
  return 0;
@@ -1175,13 +1217,13 @@ done:
1175
1217
  return error;
1176
1218
  }
1177
1219
 
1178
- static int notes_ref_lookup(git_buf *out, git_rebase *rebase)
1220
+ static int notes_ref_lookup(git_str *out, git_rebase *rebase)
1179
1221
  {
1180
1222
  git_config *config = NULL;
1181
1223
  int do_rewrite, error;
1182
1224
 
1183
1225
  if (rebase->options.rewrite_notes_ref) {
1184
- git_buf_attach_notowned(out,
1226
+ git_str_attach_notowned(out,
1185
1227
  rebase->options.rewrite_notes_ref,
1186
1228
  strlen(rebase->options.rewrite_notes_ref));
1187
1229
  return 0;
@@ -1198,7 +1240,7 @@ static int notes_ref_lookup(git_buf *out, git_rebase *rebase)
1198
1240
  }
1199
1241
 
1200
1242
  error = do_rewrite ?
1201
- git_config_get_string_buf(out, config, "notes.rewriteref") :
1243
+ git_config__get_string_buf(out, config, "notes.rewriteref") :
1202
1244
  GIT_ENOTFOUND;
1203
1245
 
1204
1246
  done:
@@ -1253,7 +1295,7 @@ static int rebase_copy_notes(
1253
1295
  git_rebase *rebase,
1254
1296
  const git_signature *committer)
1255
1297
  {
1256
- git_buf path = GIT_BUF_INIT, rewritten = GIT_BUF_INIT, notes_ref = GIT_BUF_INIT;
1298
+ git_str path = GIT_STR_INIT, rewritten = GIT_STR_INIT, notes_ref = GIT_STR_INIT;
1257
1299
  char *pair_list, *fromstr, *tostr, *end;
1258
1300
  git_oid from, to;
1259
1301
  unsigned int linenum = 1;
@@ -1268,7 +1310,7 @@ static int rebase_copy_notes(
1268
1310
  goto done;
1269
1311
  }
1270
1312
 
1271
- if ((error = git_buf_joinpath(&path, rebase->state_path, REWRITTEN_FILE)) < 0 ||
1313
+ if ((error = git_str_joinpath(&path, rebase->state_path, REWRITTEN_FILE)) < 0 ||
1272
1314
  (error = git_futils_readbuffer(&rewritten, path.ptr)) < 0)
1273
1315
  goto done;
1274
1316
 
@@ -1308,9 +1350,9 @@ on_error:
1308
1350
  error = -1;
1309
1351
 
1310
1352
  done:
1311
- git_buf_dispose(&rewritten);
1312
- git_buf_dispose(&path);
1313
- git_buf_dispose(&notes_ref);
1353
+ git_str_dispose(&rewritten);
1354
+ git_str_dispose(&path);
1355
+ git_str_dispose(&notes_ref);
1314
1356
 
1315
1357
  return error;
1316
1358
  }
@@ -1319,16 +1361,16 @@ static int return_to_orig_head(git_rebase *rebase)
1319
1361
  {
1320
1362
  git_reference *terminal_ref = NULL, *branch_ref = NULL, *head_ref = NULL;
1321
1363
  git_commit *terminal_commit = NULL;
1322
- git_buf branch_msg = GIT_BUF_INIT, head_msg = GIT_BUF_INIT;
1364
+ git_str branch_msg = GIT_STR_INIT, head_msg = GIT_STR_INIT;
1323
1365
  char onto[GIT_OID_HEXSZ];
1324
1366
  int error = 0;
1325
1367
 
1326
1368
  git_oid_fmt(onto, &rebase->onto_id);
1327
1369
 
1328
- if ((error = git_buf_printf(&branch_msg,
1370
+ if ((error = git_str_printf(&branch_msg,
1329
1371
  "rebase finished: %s onto %.*s",
1330
1372
  rebase->orig_head_name, GIT_OID_HEXSZ, onto)) == 0 &&
1331
- (error = git_buf_printf(&head_msg,
1373
+ (error = git_str_printf(&head_msg,
1332
1374
  "rebase finished: returning to %s",
1333
1375
  rebase->orig_head_name)) == 0 &&
1334
1376
  (error = git_repository_head(&terminal_ref, rebase->repo)) == 0 &&
@@ -1342,8 +1384,8 @@ static int return_to_orig_head(git_rebase *rebase)
1342
1384
  rebase->repo, GIT_HEAD_FILE, rebase->orig_head_name, 1,
1343
1385
  head_msg.ptr);
1344
1386
 
1345
- git_buf_dispose(&head_msg);
1346
- git_buf_dispose(&branch_msg);
1387
+ git_str_dispose(&head_msg);
1388
+ git_str_dispose(&branch_msg);
1347
1389
  git_commit_free(terminal_commit);
1348
1390
  git_reference_free(head_ref);
1349
1391
  git_reference_free(branch_ref);
@@ -1358,7 +1400,7 @@ int git_rebase_finish(
1358
1400
  {
1359
1401
  int error = 0;
1360
1402
 
1361
- assert(rebase);
1403
+ GIT_ASSERT_ARG(rebase);
1362
1404
 
1363
1405
  if (rebase->inmemory)
1364
1406
  return 0;
@@ -1373,14 +1415,17 @@ int git_rebase_finish(
1373
1415
  }
1374
1416
 
1375
1417
  const char *git_rebase_orig_head_name(git_rebase *rebase) {
1418
+ GIT_ASSERT_ARG_WITH_RETVAL(rebase, NULL);
1376
1419
  return rebase->orig_head_name;
1377
1420
  }
1378
1421
 
1379
1422
  const git_oid *git_rebase_orig_head_id(git_rebase *rebase) {
1423
+ GIT_ASSERT_ARG_WITH_RETVAL(rebase, NULL);
1380
1424
  return &rebase->orig_head_id;
1381
1425
  }
1382
1426
 
1383
1427
  const char *git_rebase_onto_name(git_rebase *rebase) {
1428
+ GIT_ASSERT_ARG_WITH_RETVAL(rebase, NULL);
1384
1429
  return rebase->onto_name;
1385
1430
  }
1386
1431
 
@@ -1390,21 +1435,21 @@ const git_oid *git_rebase_onto_id(git_rebase *rebase) {
1390
1435
 
1391
1436
  size_t git_rebase_operation_entrycount(git_rebase *rebase)
1392
1437
  {
1393
- assert(rebase);
1438
+ GIT_ASSERT_ARG_WITH_RETVAL(rebase, 0);
1394
1439
 
1395
1440
  return git_array_size(rebase->operations);
1396
1441
  }
1397
1442
 
1398
1443
  size_t git_rebase_operation_current(git_rebase *rebase)
1399
1444
  {
1400
- assert(rebase);
1445
+ GIT_ASSERT_ARG_WITH_RETVAL(rebase, 0);
1401
1446
 
1402
1447
  return rebase->started ? rebase->current : GIT_REBASE_NO_OPERATION;
1403
1448
  }
1404
1449
 
1405
1450
  git_rebase_operation *git_rebase_operation_byindex(git_rebase *rebase, size_t idx)
1406
1451
  {
1407
- assert(rebase);
1452
+ GIT_ASSERT_ARG_WITH_RETVAL(rebase, NULL);
1408
1453
 
1409
1454
  return git_array_get(rebase->operations, idx);
1410
1455
  }