rugged 1.0.1 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (349) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +1 -0
  3. data/README.md +1 -1
  4. data/ext/rugged/rugged.c +7 -4
  5. data/ext/rugged/rugged_commit.c +1 -1
  6. data/ext/rugged/rugged_object.c +1 -1
  7. data/ext/rugged/rugged_repo.c +3 -3
  8. data/lib/rugged/commit.rb +16 -2
  9. data/lib/rugged/repository.rb +2 -2
  10. data/lib/rugged/version.rb +1 -1
  11. data/vendor/libgit2/CMakeLists.txt +41 -74
  12. data/vendor/libgit2/COPYING +109 -1
  13. data/vendor/libgit2/cmake/{Modules/AddCFlagIfSupported.cmake → AddCFlagIfSupported.cmake} +0 -0
  14. data/vendor/libgit2/cmake/{Modules/EnableWarnings.cmake → EnableWarnings.cmake} +0 -0
  15. data/vendor/libgit2/cmake/{Modules/FindCoreFoundation.cmake → FindCoreFoundation.cmake} +0 -0
  16. data/vendor/libgit2/cmake/{Modules/FindGSSAPI.cmake → FindGSSAPI.cmake} +0 -0
  17. data/vendor/libgit2/cmake/{Modules/FindGSSFramework.cmake → FindGSSFramework.cmake} +0 -0
  18. data/vendor/libgit2/cmake/{Modules/FindHTTP_Parser.cmake → FindHTTP_Parser.cmake} +0 -0
  19. data/vendor/libgit2/cmake/{Modules/FindIconv.cmake → FindIconv.cmake} +0 -0
  20. data/vendor/libgit2/cmake/FindLibSSH2.cmake +13 -0
  21. data/vendor/libgit2/cmake/{Modules/FindPCRE.cmake → FindPCRE.cmake} +0 -0
  22. data/vendor/libgit2/cmake/{Modules/FindPCRE2.cmake → FindPCRE2.cmake} +0 -0
  23. data/vendor/libgit2/cmake/{Modules/FindPkgLibraries.cmake → FindPkgLibraries.cmake} +0 -0
  24. data/vendor/libgit2/cmake/{Modules/FindSecurity.cmake → FindSecurity.cmake} +0 -0
  25. data/vendor/libgit2/cmake/{Modules/FindStatNsec.cmake → FindStatNsec.cmake} +0 -0
  26. data/vendor/libgit2/cmake/Findfutimens.cmake +14 -0
  27. data/vendor/libgit2/cmake/{Modules/FindmbedTLS.cmake → FindmbedTLS.cmake} +0 -0
  28. data/vendor/libgit2/cmake/{Modules/IdeSplitSources.cmake → IdeSplitSources.cmake} +0 -0
  29. data/vendor/libgit2/cmake/{Modules/PkgBuildConfig.cmake → PkgBuildConfig.cmake} +0 -0
  30. data/vendor/libgit2/cmake/{Modules/SanitizeBool.cmake → SanitizeBool.cmake} +0 -0
  31. data/vendor/libgit2/cmake/{Modules/SelectGSSAPI.cmake → SelectGSSAPI.cmake} +18 -26
  32. data/vendor/libgit2/cmake/{Modules/SelectHTTPSBackend.cmake → SelectHTTPSBackend.cmake} +29 -32
  33. data/vendor/libgit2/cmake/{Modules/SelectHashes.cmake → SelectHashes.cmake} +21 -28
  34. data/vendor/libgit2/deps/chromium-zlib/CMakeLists.txt +101 -0
  35. data/vendor/libgit2/deps/http-parser/CMakeLists.txt +4 -3
  36. data/vendor/libgit2/deps/ntlmclient/CMakeLists.txt +24 -10
  37. data/vendor/libgit2/deps/ntlmclient/compat.h +0 -27
  38. data/vendor/libgit2/deps/ntlmclient/crypt.h +14 -9
  39. data/vendor/libgit2/deps/ntlmclient/crypt_commoncrypto.c +20 -20
  40. data/vendor/libgit2/deps/ntlmclient/crypt_commoncrypto.h +3 -3
  41. data/vendor/libgit2/deps/ntlmclient/crypt_mbedtls.c +37 -36
  42. data/vendor/libgit2/deps/ntlmclient/crypt_mbedtls.h +4 -3
  43. data/vendor/libgit2/deps/ntlmclient/crypt_openssl.c +178 -51
  44. data/vendor/libgit2/deps/ntlmclient/crypt_openssl.h +74 -5
  45. data/vendor/libgit2/deps/ntlmclient/ntlm.c +164 -135
  46. data/vendor/libgit2/deps/ntlmclient/ntlm.h +13 -9
  47. data/vendor/libgit2/deps/ntlmclient/ntlmclient.h +16 -3
  48. data/vendor/libgit2/deps/ntlmclient/unicode.h +10 -4
  49. data/vendor/libgit2/deps/ntlmclient/unicode_builtin.c +16 -27
  50. data/vendor/libgit2/deps/ntlmclient/unicode_builtin.h +20 -0
  51. data/vendor/libgit2/deps/ntlmclient/unicode_iconv.c +28 -52
  52. data/vendor/libgit2/deps/ntlmclient/unicode_iconv.h +22 -0
  53. data/vendor/libgit2/deps/ntlmclient/util.c +15 -1
  54. data/vendor/libgit2/deps/ntlmclient/util.h +2 -1
  55. data/vendor/libgit2/deps/pcre/LICENCE +93 -0
  56. data/vendor/libgit2/deps/pcre/pcre.h +2 -2
  57. data/vendor/libgit2/deps/pcre/pcre_compile.c +29 -17
  58. data/vendor/libgit2/deps/pcre/pcre_jit_compile.c +4 -4
  59. data/vendor/libgit2/deps/pcre/pcreposix.c +2 -3
  60. data/vendor/libgit2/deps/zlib/CMakeLists.txt +6 -5
  61. data/vendor/libgit2/deps/zlib/deflate.c +1 -0
  62. data/vendor/libgit2/include/git2/annotated_commit.h +1 -1
  63. data/vendor/libgit2/include/git2/apply.h +2 -0
  64. data/vendor/libgit2/include/git2/attr.h +95 -0
  65. data/vendor/libgit2/include/git2/blame.h +95 -42
  66. data/vendor/libgit2/include/git2/blob.h +37 -3
  67. data/vendor/libgit2/include/git2/branch.h +25 -0
  68. data/vendor/libgit2/include/git2/cert.h +42 -5
  69. data/vendor/libgit2/include/git2/checkout.h +28 -12
  70. data/vendor/libgit2/include/git2/clone.h +1 -1
  71. data/vendor/libgit2/include/git2/commit.h +35 -19
  72. data/vendor/libgit2/include/git2/common.h +51 -6
  73. data/vendor/libgit2/include/git2/config.h +1 -1
  74. data/vendor/libgit2/include/git2/deprecated.h +368 -8
  75. data/vendor/libgit2/include/git2/diff.h +34 -113
  76. data/vendor/libgit2/include/git2/email.h +127 -0
  77. data/vendor/libgit2/include/git2/errors.h +8 -7
  78. data/vendor/libgit2/include/git2/filter.h +63 -17
  79. data/vendor/libgit2/include/git2/graph.h +20 -2
  80. data/vendor/libgit2/include/git2/index.h +4 -5
  81. data/vendor/libgit2/include/git2/indexer.h +2 -1
  82. data/vendor/libgit2/include/git2/notes.h +2 -2
  83. data/vendor/libgit2/include/git2/odb.h +44 -20
  84. data/vendor/libgit2/include/git2/oidarray.h +5 -8
  85. data/vendor/libgit2/include/git2/pack.h +1 -1
  86. data/vendor/libgit2/include/git2/patch.h +8 -0
  87. data/vendor/libgit2/include/git2/rebase.h +25 -1
  88. data/vendor/libgit2/include/git2/refs.h +9 -5
  89. data/vendor/libgit2/include/git2/remote.h +62 -9
  90. data/vendor/libgit2/include/git2/repository.h +107 -62
  91. data/vendor/libgit2/include/git2/revparse.h +5 -5
  92. data/vendor/libgit2/include/git2/stash.h +1 -1
  93. data/vendor/libgit2/include/git2/status.h +115 -59
  94. data/vendor/libgit2/include/git2/stdint.h +3 -3
  95. data/vendor/libgit2/include/git2/strarray.h +6 -10
  96. data/vendor/libgit2/include/git2/submodule.h +9 -0
  97. data/vendor/libgit2/include/git2/sys/commit_graph.h +174 -0
  98. data/vendor/libgit2/include/git2/sys/email.h +45 -0
  99. data/vendor/libgit2/include/git2/sys/filter.h +49 -28
  100. data/vendor/libgit2/include/git2/sys/midx.h +74 -0
  101. data/vendor/libgit2/include/git2/sys/odb_backend.h +7 -0
  102. data/vendor/libgit2/include/git2/sys/transport.h +1 -0
  103. data/vendor/libgit2/include/git2/tag.h +12 -0
  104. data/vendor/libgit2/include/git2/transport.h +1 -1
  105. data/vendor/libgit2/include/git2/tree.h +2 -14
  106. data/vendor/libgit2/include/git2/types.h +9 -0
  107. data/vendor/libgit2/include/git2/version.h +4 -4
  108. data/vendor/libgit2/include/git2/worktree.h +1 -0
  109. data/vendor/libgit2/include/git2.h +1 -0
  110. data/vendor/libgit2/src/CMakeLists.txt +84 -44
  111. data/vendor/libgit2/src/alloc.c +21 -8
  112. data/vendor/libgit2/src/allocators/failalloc.c +92 -0
  113. data/vendor/libgit2/src/allocators/failalloc.h +23 -0
  114. data/vendor/libgit2/src/allocators/stdalloc.c +41 -10
  115. data/vendor/libgit2/src/allocators/win32_leakcheck.c +118 -0
  116. data/vendor/libgit2/src/allocators/{win32_crtdbg.h → win32_leakcheck.h} +3 -3
  117. data/vendor/libgit2/src/annotated_commit.c +21 -9
  118. data/vendor/libgit2/src/apply.c +21 -8
  119. data/vendor/libgit2/src/array.h +11 -11
  120. data/vendor/libgit2/src/assert_safe.h +58 -0
  121. data/vendor/libgit2/src/attr.c +192 -70
  122. data/vendor/libgit2/src/attr_file.c +99 -41
  123. data/vendor/libgit2/src/attr_file.h +32 -11
  124. data/vendor/libgit2/src/attrcache.c +44 -40
  125. data/vendor/libgit2/src/attrcache.h +4 -5
  126. data/vendor/libgit2/src/blame.c +32 -19
  127. data/vendor/libgit2/src/blame_git.c +7 -4
  128. data/vendor/libgit2/src/blob.c +60 -32
  129. data/vendor/libgit2/src/branch.c +87 -37
  130. data/vendor/libgit2/src/buffer.c +349 -29
  131. data/vendor/libgit2/src/buffer.h +154 -2
  132. data/vendor/libgit2/src/cache.c +3 -24
  133. data/vendor/libgit2/src/cache.h +7 -7
  134. data/vendor/libgit2/src/cc-compat.h +10 -8
  135. data/vendor/libgit2/src/checkout.c +103 -105
  136. data/vendor/libgit2/src/cherrypick.c +8 -2
  137. data/vendor/libgit2/src/clone.c +105 -30
  138. data/vendor/libgit2/src/commit.c +41 -28
  139. data/vendor/libgit2/src/commit_graph.c +1209 -0
  140. data/vendor/libgit2/src/commit_graph.h +162 -0
  141. data/vendor/libgit2/src/commit_list.c +46 -0
  142. data/vendor/libgit2/src/commit_list.h +2 -0
  143. data/vendor/libgit2/src/common.h +26 -2
  144. data/vendor/libgit2/src/config.c +41 -23
  145. data/vendor/libgit2/src/config_cache.c +9 -4
  146. data/vendor/libgit2/src/config_entries.c +35 -27
  147. data/vendor/libgit2/src/config_file.c +17 -9
  148. data/vendor/libgit2/src/config_parse.c +6 -8
  149. data/vendor/libgit2/src/config_snapshot.c +2 -1
  150. data/vendor/libgit2/src/crlf.c +16 -6
  151. data/vendor/libgit2/src/date.c +4 -3
  152. data/vendor/libgit2/src/delta.c +1 -1
  153. data/vendor/libgit2/src/describe.c +12 -5
  154. data/vendor/libgit2/src/diff.c +55 -183
  155. data/vendor/libgit2/src/diff_driver.c +21 -17
  156. data/vendor/libgit2/src/diff_file.c +5 -7
  157. data/vendor/libgit2/src/diff_generate.c +56 -28
  158. data/vendor/libgit2/src/diff_parse.c +2 -3
  159. data/vendor/libgit2/src/diff_print.c +81 -65
  160. data/vendor/libgit2/src/diff_stats.c +19 -16
  161. data/vendor/libgit2/src/diff_tform.c +13 -13
  162. data/vendor/libgit2/src/diff_xdiff.c +4 -2
  163. data/vendor/libgit2/src/diff_xdiff.h +1 -1
  164. data/vendor/libgit2/src/email.c +299 -0
  165. data/vendor/libgit2/src/email.h +25 -0
  166. data/vendor/libgit2/src/errors.c +26 -19
  167. data/vendor/libgit2/src/features.h.in +5 -1
  168. data/vendor/libgit2/src/fetch.c +7 -2
  169. data/vendor/libgit2/src/fetchhead.c +8 -4
  170. data/vendor/libgit2/src/filebuf.c +9 -7
  171. data/vendor/libgit2/src/filter.c +215 -113
  172. data/vendor/libgit2/src/filter.h +24 -5
  173. data/vendor/libgit2/src/futils.c +8 -8
  174. data/vendor/libgit2/src/futils.h +4 -4
  175. data/vendor/libgit2/src/graph.c +64 -9
  176. data/vendor/libgit2/src/hash/sha1/collisiondetect.c +3 -3
  177. data/vendor/libgit2/src/hash/sha1/common_crypto.c +3 -3
  178. data/vendor/libgit2/src/hash/sha1/generic.h +1 -1
  179. data/vendor/libgit2/src/hash/sha1/mbedtls.c +12 -12
  180. data/vendor/libgit2/src/hash/sha1/openssl.c +3 -3
  181. data/vendor/libgit2/src/hash/sha1/sha1dc/sha1.c +8 -10
  182. data/vendor/libgit2/src/hash/sha1/win32.c +15 -11
  183. data/vendor/libgit2/src/hash.c +16 -13
  184. data/vendor/libgit2/src/hash.h +1 -1
  185. data/vendor/libgit2/src/hashsig.c +23 -10
  186. data/vendor/libgit2/src/ident.c +13 -3
  187. data/vendor/libgit2/src/idxmap.c +0 -22
  188. data/vendor/libgit2/src/ignore.c +33 -17
  189. data/vendor/libgit2/src/index.c +124 -82
  190. data/vendor/libgit2/src/index.h +1 -1
  191. data/vendor/libgit2/src/indexer.c +95 -37
  192. data/vendor/libgit2/src/integer.h +79 -2
  193. data/vendor/libgit2/src/iterator.c +40 -28
  194. data/vendor/libgit2/src/iterator.h +1 -1
  195. data/vendor/libgit2/src/khash.h +2 -11
  196. data/vendor/libgit2/src/{settings.c → libgit2.c} +148 -49
  197. data/vendor/libgit2/src/libgit2.h +15 -0
  198. data/vendor/libgit2/src/mailmap.c +23 -10
  199. data/vendor/libgit2/src/map.h +3 -3
  200. data/vendor/libgit2/src/merge.c +95 -43
  201. data/vendor/libgit2/src/merge.h +2 -1
  202. data/vendor/libgit2/src/merge_driver.c +19 -13
  203. data/vendor/libgit2/src/merge_file.c +15 -9
  204. data/vendor/libgit2/src/message.c +3 -1
  205. data/vendor/libgit2/src/midx.c +879 -0
  206. data/vendor/libgit2/src/midx.h +110 -0
  207. data/vendor/libgit2/src/mwindow.c +214 -95
  208. data/vendor/libgit2/src/mwindow.h +3 -3
  209. data/vendor/libgit2/src/net.c +133 -4
  210. data/vendor/libgit2/src/net.h +16 -2
  211. data/vendor/libgit2/src/netops.c +6 -4
  212. data/vendor/libgit2/src/netops.h +2 -2
  213. data/vendor/libgit2/src/notes.c +40 -40
  214. data/vendor/libgit2/src/object.c +24 -15
  215. data/vendor/libgit2/src/odb.c +298 -57
  216. data/vendor/libgit2/src/odb.h +16 -2
  217. data/vendor/libgit2/src/odb_loose.c +31 -21
  218. data/vendor/libgit2/src/odb_mempack.c +3 -1
  219. data/vendor/libgit2/src/odb_pack.c +391 -114
  220. data/vendor/libgit2/src/oid.c +7 -4
  221. data/vendor/libgit2/src/oidarray.c +10 -1
  222. data/vendor/libgit2/src/pack-objects.c +83 -69
  223. data/vendor/libgit2/src/pack.c +383 -150
  224. data/vendor/libgit2/src/pack.h +44 -9
  225. data/vendor/libgit2/src/patch.c +14 -7
  226. data/vendor/libgit2/src/patch_generate.c +3 -5
  227. data/vendor/libgit2/src/patch_parse.c +6 -3
  228. data/vendor/libgit2/src/path.c +103 -58
  229. data/vendor/libgit2/src/path.h +80 -7
  230. data/vendor/libgit2/src/pathspec.c +12 -11
  231. data/vendor/libgit2/src/pool.c +34 -22
  232. data/vendor/libgit2/src/pool.h +9 -1
  233. data/vendor/libgit2/src/posix.c +43 -12
  234. data/vendor/libgit2/src/posix.h +9 -0
  235. data/vendor/libgit2/src/proxy.c +2 -0
  236. data/vendor/libgit2/src/push.c +2 -0
  237. data/vendor/libgit2/src/reader.c +10 -6
  238. data/vendor/libgit2/src/rebase.c +95 -49
  239. data/vendor/libgit2/src/refdb.c +165 -13
  240. data/vendor/libgit2/src/refdb.h +69 -0
  241. data/vendor/libgit2/src/refdb_fs.c +145 -153
  242. data/vendor/libgit2/src/reflog.c +21 -20
  243. data/vendor/libgit2/src/refs.c +153 -233
  244. data/vendor/libgit2/src/refs.h +2 -20
  245. data/vendor/libgit2/src/refspec.c +81 -45
  246. data/vendor/libgit2/src/regexp.c +2 -2
  247. data/vendor/libgit2/src/remote.c +320 -122
  248. data/vendor/libgit2/src/remote.h +2 -1
  249. data/vendor/libgit2/src/repository.c +476 -203
  250. data/vendor/libgit2/src/repository.h +27 -29
  251. data/vendor/libgit2/src/reset.c +8 -7
  252. data/vendor/libgit2/src/revert.c +8 -2
  253. data/vendor/libgit2/src/revparse.c +23 -17
  254. data/vendor/libgit2/src/revwalk.c +35 -20
  255. data/vendor/libgit2/src/runtime.c +162 -0
  256. data/vendor/libgit2/src/runtime.h +62 -0
  257. data/vendor/libgit2/src/{refdb_fs.h → settings.h} +3 -11
  258. data/vendor/libgit2/src/signature.c +6 -5
  259. data/vendor/libgit2/src/sortedcache.c +2 -3
  260. data/vendor/libgit2/src/sortedcache.h +10 -8
  261. data/vendor/libgit2/src/stash.c +6 -2
  262. data/vendor/libgit2/src/status.c +9 -4
  263. data/vendor/libgit2/src/strarray.c +64 -0
  264. data/vendor/libgit2/src/streams/mbedtls.c +14 -17
  265. data/vendor/libgit2/src/streams/mbedtls.h +1 -1
  266. data/vendor/libgit2/src/streams/openssl.c +113 -207
  267. data/vendor/libgit2/src/streams/openssl.h +9 -1
  268. data/vendor/libgit2/src/streams/openssl_dynamic.c +309 -0
  269. data/vendor/libgit2/src/streams/openssl_dynamic.h +348 -0
  270. data/vendor/libgit2/src/streams/openssl_legacy.c +203 -0
  271. data/vendor/libgit2/src/streams/openssl_legacy.h +63 -0
  272. data/vendor/libgit2/src/streams/registry.c +10 -9
  273. data/vendor/libgit2/src/streams/socket.c +6 -2
  274. data/vendor/libgit2/src/streams/stransport.c +6 -3
  275. data/vendor/libgit2/src/streams/tls.c +5 -3
  276. data/vendor/libgit2/src/submodule.c +134 -66
  277. data/vendor/libgit2/src/submodule.h +9 -9
  278. data/vendor/libgit2/src/sysdir.c +8 -26
  279. data/vendor/libgit2/src/sysdir.h +0 -11
  280. data/vendor/libgit2/src/tag.c +49 -11
  281. data/vendor/libgit2/src/thread.c +140 -0
  282. data/vendor/libgit2/src/thread.h +479 -0
  283. data/vendor/libgit2/src/threadstate.c +84 -0
  284. data/vendor/libgit2/src/threadstate.h +24 -0
  285. data/vendor/libgit2/src/trace.c +2 -2
  286. data/vendor/libgit2/src/trace.h +17 -13
  287. data/vendor/libgit2/src/trailer.c +1 -1
  288. data/vendor/libgit2/src/transaction.c +21 -9
  289. data/vendor/libgit2/src/transport.c +3 -3
  290. data/vendor/libgit2/src/transports/auth.c +1 -1
  291. data/vendor/libgit2/src/transports/auth_negotiate.c +11 -4
  292. data/vendor/libgit2/src/transports/auth_ntlm.c +10 -6
  293. data/vendor/libgit2/src/transports/credential.c +17 -7
  294. data/vendor/libgit2/src/transports/credential_helpers.c +2 -0
  295. data/vendor/libgit2/src/transports/git.c +1 -3
  296. data/vendor/libgit2/src/transports/http.c +19 -17
  297. data/vendor/libgit2/src/transports/http.h +1 -0
  298. data/vendor/libgit2/src/transports/httpclient.c +68 -38
  299. data/vendor/libgit2/src/transports/httpclient.h +1 -1
  300. data/vendor/libgit2/src/transports/local.c +5 -5
  301. data/vendor/libgit2/src/transports/smart.c +14 -9
  302. data/vendor/libgit2/src/transports/smart.h +1 -1
  303. data/vendor/libgit2/src/transports/smart_protocol.c +11 -5
  304. data/vendor/libgit2/src/transports/ssh.c +55 -21
  305. data/vendor/libgit2/src/transports/winhttp.c +157 -89
  306. data/vendor/libgit2/src/tree.c +100 -77
  307. data/vendor/libgit2/src/tree.h +1 -0
  308. data/vendor/libgit2/src/tsort.c +0 -2
  309. data/vendor/libgit2/src/unix/map.c +3 -1
  310. data/vendor/libgit2/src/unix/posix.h +16 -1
  311. data/vendor/libgit2/src/unix/pthread.h +2 -1
  312. data/vendor/libgit2/src/utf8.c +150 -0
  313. data/vendor/libgit2/src/utf8.h +52 -0
  314. data/vendor/libgit2/src/util.c +75 -184
  315. data/vendor/libgit2/src/util.h +34 -40
  316. data/vendor/libgit2/src/vector.c +23 -19
  317. data/vendor/libgit2/src/vector.h +4 -2
  318. data/vendor/libgit2/src/win32/findfile.c +5 -3
  319. data/vendor/libgit2/src/win32/git2.rc +18 -3
  320. data/vendor/libgit2/src/win32/map.c +1 -1
  321. data/vendor/libgit2/src/win32/msvc-compat.h +9 -1
  322. data/vendor/libgit2/src/win32/path_w32.c +23 -25
  323. data/vendor/libgit2/src/win32/path_w32.h +0 -1
  324. data/vendor/libgit2/src/win32/posix.h +6 -6
  325. data/vendor/libgit2/src/win32/posix_w32.c +86 -7
  326. data/vendor/libgit2/src/win32/precompiled.h +0 -1
  327. data/vendor/libgit2/src/win32/reparse.h +4 -4
  328. data/vendor/libgit2/src/win32/thread.c +24 -15
  329. data/vendor/libgit2/src/win32/thread.h +1 -1
  330. data/vendor/libgit2/src/win32/w32_buffer.c +3 -3
  331. data/vendor/libgit2/src/win32/w32_common.h +18 -9
  332. data/vendor/libgit2/src/win32/{w32_crtdbg_stacktrace.c → w32_leakcheck.c} +269 -33
  333. data/vendor/libgit2/src/win32/w32_leakcheck.h +222 -0
  334. data/vendor/libgit2/src/win32/w32_util.h +6 -6
  335. data/vendor/libgit2/src/worktree.c +36 -14
  336. data/vendor/libgit2/src/zstream.c +1 -1
  337. metadata +65 -42
  338. data/vendor/libgit2/cmake/Modules/CheckPrototypeDefinition.c.in +0 -29
  339. data/vendor/libgit2/cmake/Modules/CheckPrototypeDefinition.cmake +0 -96
  340. data/vendor/libgit2/src/allocators/win32_crtdbg.c +0 -118
  341. data/vendor/libgit2/src/buf_text.c +0 -316
  342. data/vendor/libgit2/src/buf_text.h +0 -122
  343. data/vendor/libgit2/src/global.c +0 -361
  344. data/vendor/libgit2/src/global.h +0 -41
  345. data/vendor/libgit2/src/thread-utils.c +0 -58
  346. data/vendor/libgit2/src/thread-utils.h +0 -246
  347. data/vendor/libgit2/src/win32/w32_crtdbg_stacktrace.h +0 -127
  348. data/vendor/libgit2/src/win32/w32_stack.c +0 -188
  349. data/vendor/libgit2/src/win32/w32_stack.h +0 -140
@@ -11,7 +11,7 @@
11
11
  #include "futils.h"
12
12
  #include "hash.h"
13
13
  #include "repository.h"
14
- #include "global.h"
14
+ #include "runtime.h"
15
15
  #include "git2/sys/filter.h"
16
16
  #include "git2/config.h"
17
17
  #include "blob.h"
@@ -19,12 +19,12 @@
19
19
  #include "array.h"
20
20
 
21
21
  struct git_filter_source {
22
- git_repository *repo;
23
- const char *path;
24
- git_oid oid; /* zero if unknown (which is likely) */
25
- uint16_t filemode; /* zero if unknown */
26
- git_filter_mode_t mode;
27
- uint32_t flags;
22
+ git_repository *repo;
23
+ const char *path;
24
+ git_oid oid; /* zero if unknown (which is likely) */
25
+ uint16_t filemode; /* zero if unknown */
26
+ git_filter_mode_t mode;
27
+ git_filter_options options;
28
28
  };
29
29
 
30
30
  typedef struct {
@@ -206,7 +206,8 @@ int git_filter_global_init(void)
206
206
  GIT_FILTER_IDENT, ident, GIT_FILTER_IDENT_PRIORITY) < 0)
207
207
  error = -1;
208
208
 
209
- git__on_shutdown(git_filter_global_shutdown);
209
+ if (!error)
210
+ error = git_runtime_shutdown_register(git_filter_global_shutdown);
210
211
 
211
212
  done:
212
213
  if (error) {
@@ -266,7 +267,8 @@ int git_filter_register(
266
267
  {
267
268
  int error;
268
269
 
269
- assert(name && filter);
270
+ GIT_ASSERT_ARG(name);
271
+ GIT_ASSERT_ARG(filter);
270
272
 
271
273
  if (git_rwlock_wrlock(&filter_registry.lock) < 0) {
272
274
  git_error_set(GIT_ERROR_OS, "failed to lock filter registry");
@@ -293,7 +295,7 @@ int git_filter_unregister(const char *name)
293
295
  git_filter_def *fdef;
294
296
  int error = 0;
295
297
 
296
- assert(name);
298
+ GIT_ASSERT_ARG(name);
297
299
 
298
300
  /* cannot unregister default filters */
299
301
  if (!strcmp(GIT_FILTER_CRLF, name) || !strcmp(GIT_FILTER_IDENT, name)) {
@@ -395,7 +397,7 @@ git_filter_mode_t git_filter_source_mode(const git_filter_source *src)
395
397
 
396
398
  uint32_t git_filter_source_flags(const git_filter_source *src)
397
399
  {
398
- return src->flags;
400
+ return src->options.flags;
399
401
  }
400
402
 
401
403
  static int filter_list_new(
@@ -415,7 +417,8 @@ static int filter_list_new(
415
417
  fl->source.repo = src->repo;
416
418
  fl->source.path = fl->path;
417
419
  fl->source.mode = src->mode;
418
- fl->source.flags = src->flags;
420
+
421
+ memcpy(&fl->source.options, &src->options, sizeof(git_filter_options));
419
422
 
420
423
  *out = fl;
421
424
  return 0;
@@ -424,25 +427,36 @@ static int filter_list_new(
424
427
  static int filter_list_check_attributes(
425
428
  const char ***out,
426
429
  git_repository *repo,
427
- git_attr_session *attr_session,
430
+ git_filter_session *filter_session,
428
431
  git_filter_def *fdef,
429
432
  const git_filter_source *src)
430
433
  {
431
434
  const char **strs = git__calloc(fdef->nattrs, sizeof(const char *));
432
- uint32_t flags = 0;
435
+ git_attr_options attr_opts = GIT_ATTR_OPTIONS_INIT;
433
436
  size_t i;
434
437
  int error;
435
438
 
436
439
  GIT_ERROR_CHECK_ALLOC(strs);
437
440
 
438
- if ((src->flags & GIT_FILTER_NO_SYSTEM_ATTRIBUTES) != 0)
439
- flags |= GIT_ATTR_CHECK_NO_SYSTEM;
441
+ if ((src->options.flags & GIT_FILTER_NO_SYSTEM_ATTRIBUTES) != 0)
442
+ attr_opts.flags |= GIT_ATTR_CHECK_NO_SYSTEM;
443
+
444
+ if ((src->options.flags & GIT_FILTER_ATTRIBUTES_FROM_HEAD) != 0)
445
+ attr_opts.flags |= GIT_ATTR_CHECK_INCLUDE_HEAD;
446
+
447
+ if ((src->options.flags & GIT_FILTER_ATTRIBUTES_FROM_COMMIT) != 0) {
448
+ attr_opts.flags |= GIT_ATTR_CHECK_INCLUDE_COMMIT;
440
449
 
441
- if ((src->flags & GIT_FILTER_ATTRIBUTES_FROM_HEAD) != 0)
442
- flags |= GIT_ATTR_CHECK_INCLUDE_HEAD;
450
+ #ifndef GIT_DEPRECATE_HARD
451
+ if (src->options.commit_id)
452
+ git_oid_cpy(&attr_opts.attr_commit_id, src->options.commit_id);
453
+ else
454
+ #endif
455
+ git_oid_cpy(&attr_opts.attr_commit_id, &src->options.attr_commit_id);
456
+ }
443
457
 
444
458
  error = git_attr_get_many_with_session(
445
- strs, repo, attr_session, flags, src->path, fdef->nattrs, fdef->attrs);
459
+ strs, repo, filter_session->attr_session, &attr_opts, src->path, fdef->nattrs, fdef->attrs);
446
460
 
447
461
  /* if no values were found but no matches are needed, it's okay! */
448
462
  if (error == GIT_ENOTFOUND && !fdef->nmatches) {
@@ -487,17 +501,17 @@ int git_filter_list_new(
487
501
  src.repo = repo;
488
502
  src.path = NULL;
489
503
  src.mode = mode;
490
- src.flags = flags;
504
+ src.options.flags = flags;
491
505
  return filter_list_new(out, &src);
492
506
  }
493
507
 
494
- int git_filter_list__load_ext(
508
+ int git_filter_list__load(
495
509
  git_filter_list **filters,
496
510
  git_repository *repo,
497
511
  git_blob *blob, /* can be NULL */
498
512
  const char *path,
499
513
  git_filter_mode_t mode,
500
- git_filter_options *filter_opts)
514
+ git_filter_session *filter_session)
501
515
  {
502
516
  int error = 0;
503
517
  git_filter_list *fl = NULL;
@@ -514,7 +528,8 @@ int git_filter_list__load_ext(
514
528
  src.repo = repo;
515
529
  src.path = path;
516
530
  src.mode = mode;
517
- src.flags = filter_opts->flags;
531
+
532
+ memcpy(&src.options, &filter_session->options, sizeof(git_filter_options));
518
533
 
519
534
  if (blob)
520
535
  git_oid_cpy(&src.oid, git_blob_id(blob));
@@ -528,7 +543,8 @@ int git_filter_list__load_ext(
528
543
 
529
544
  if (fdef->nattrs > 0) {
530
545
  error = filter_list_check_attributes(
531
- &values, repo, filter_opts->attr_session, fdef, &src);
546
+ &values, repo,
547
+ filter_session, fdef, &src);
532
548
 
533
549
  if (error == GIT_ENOTFOUND) {
534
550
  error = 0;
@@ -555,7 +571,7 @@ int git_filter_list__load_ext(
555
571
  if ((error = filter_list_new(&fl, &src)) < 0)
556
572
  break;
557
573
 
558
- fl->temp_buf = filter_opts->temp_buf;
574
+ fl->temp_buf = filter_session->temp_buf;
559
575
  }
560
576
 
561
577
  fe = git_array_alloc(fl->filters);
@@ -579,6 +595,23 @@ int git_filter_list__load_ext(
579
595
  return error;
580
596
  }
581
597
 
598
+ int git_filter_list_load_ext(
599
+ git_filter_list **filters,
600
+ git_repository *repo,
601
+ git_blob *blob, /* can be NULL */
602
+ const char *path,
603
+ git_filter_mode_t mode,
604
+ git_filter_options *opts)
605
+ {
606
+ git_filter_session filter_session = GIT_FILTER_SESSION_INIT;
607
+
608
+ if (opts)
609
+ memcpy(&filter_session.options, opts, sizeof(git_filter_options));
610
+
611
+ return git_filter_list__load(
612
+ filters, repo, blob, path, mode, &filter_session);
613
+ }
614
+
582
615
  int git_filter_list_load(
583
616
  git_filter_list **filters,
584
617
  git_repository *repo,
@@ -587,12 +620,12 @@ int git_filter_list_load(
587
620
  git_filter_mode_t mode,
588
621
  uint32_t flags)
589
622
  {
590
- git_filter_options filter_opts = GIT_FILTER_OPTIONS_INIT;
623
+ git_filter_session filter_session = GIT_FILTER_SESSION_INIT;
591
624
 
592
- filter_opts.flags = flags;
625
+ filter_session.options.flags = flags;
593
626
 
594
- return git_filter_list__load_ext(
595
- filters, repo, blob, path, mode, &filter_opts);
627
+ return git_filter_list__load(
628
+ filters, repo, blob, path, mode, &filter_session);
596
629
  }
597
630
 
598
631
  void git_filter_list_free(git_filter_list *fl)
@@ -618,7 +651,7 @@ int git_filter_list_contains(
618
651
  {
619
652
  size_t i;
620
653
 
621
- assert(name);
654
+ GIT_ASSERT_ARG(name);
622
655
 
623
656
  if (!fl)
624
657
  return 0;
@@ -639,7 +672,8 @@ int git_filter_list_push(
639
672
  git_filter_def *fdef = NULL;
640
673
  git_filter_entry *fe;
641
674
 
642
- assert(fl && filter);
675
+ GIT_ASSERT_ARG(fl);
676
+ GIT_ASSERT_ARG(filter);
643
677
 
644
678
  if (git_rwlock_rdlock(&filter_registry.lock) < 0) {
645
679
  git_error_set(GIT_ERROR_OS, "failed to lock filter registry");
@@ -684,9 +718,8 @@ static int buf_stream_write(
684
718
  git_writestream *s, const char *buffer, size_t len)
685
719
  {
686
720
  struct buf_stream *buf_stream = (struct buf_stream *)s;
687
- assert(buf_stream);
688
-
689
- assert(buf_stream->complete == 0);
721
+ GIT_ASSERT_ARG(buf_stream);
722
+ GIT_ASSERT(buf_stream->complete == 0);
690
723
 
691
724
  return git_buf_put(buf_stream->target, buffer, len);
692
725
  }
@@ -694,9 +727,9 @@ static int buf_stream_write(
694
727
  static int buf_stream_close(git_writestream *s)
695
728
  {
696
729
  struct buf_stream *buf_stream = (struct buf_stream *)s;
697
- assert(buf_stream);
730
+ GIT_ASSERT_ARG(buf_stream);
698
731
 
699
- assert(buf_stream->complete == 0);
732
+ GIT_ASSERT(buf_stream->complete == 0);
700
733
  buf_stream->complete = 1;
701
734
 
702
735
  return 0;
@@ -719,27 +752,47 @@ static void buf_stream_init(struct buf_stream *writer, git_buf *target)
719
752
  git_buf_clear(target);
720
753
  }
721
754
 
722
- int git_filter_list_apply_to_data(
723
- git_buf *tgt, git_filter_list *filters, git_buf *src)
755
+ int git_filter_list_apply_to_buffer(
756
+ git_buf *out,
757
+ git_filter_list *filters,
758
+ const char *in,
759
+ size_t in_len)
724
760
  {
725
761
  struct buf_stream writer;
726
762
  int error;
727
763
 
728
- git_buf_sanitize(tgt);
729
- git_buf_sanitize(src);
764
+ if ((error = git_buf_sanitize(out)) < 0)
765
+ return error;
730
766
 
731
- if (!filters) {
732
- git_buf_attach_notowned(tgt, src->ptr, src->size);
767
+ buf_stream_init(&writer, out);
768
+
769
+ if ((error = git_filter_list_stream_buffer(filters,
770
+ in, in_len, &writer.parent)) < 0)
771
+ return error;
772
+
773
+ GIT_ASSERT(writer.complete);
774
+ return error;
775
+ }
776
+
777
+ int git_filter_list__convert_buf(
778
+ git_buf *out,
779
+ git_filter_list *filters,
780
+ git_buf *in)
781
+ {
782
+ int error;
783
+
784
+ if (!filters || git_filter_list_length(filters) == 0) {
785
+ git_buf_swap(out, in);
786
+ git_buf_dispose(in);
733
787
  return 0;
734
788
  }
735
789
 
736
- buf_stream_init(&writer, tgt);
790
+ error = git_filter_list_apply_to_buffer(out, filters,
791
+ in->ptr, in->size);
737
792
 
738
- if ((error = git_filter_list_stream_data(filters, src,
739
- &writer.parent)) < 0)
740
- return error;
793
+ if (!error)
794
+ git_buf_dispose(in);
741
795
 
742
- assert(writer.complete);
743
796
  return error;
744
797
  }
745
798
 
@@ -758,7 +811,7 @@ int git_filter_list_apply_to_file(
758
811
  filters, repo, path, &writer.parent)) < 0)
759
812
  return error;
760
813
 
761
- assert(writer.complete);
814
+ GIT_ASSERT(writer.complete);
762
815
  return error;
763
816
  }
764
817
 
@@ -789,13 +842,14 @@ int git_filter_list_apply_to_blob(
789
842
  filters, blob, &writer.parent)) < 0)
790
843
  return error;
791
844
 
792
- assert(writer.complete);
845
+ GIT_ASSERT(writer.complete);
793
846
  return error;
794
847
  }
795
848
 
796
- struct proxy_stream {
849
+ struct buffered_stream {
797
850
  git_writestream parent;
798
851
  git_filter *filter;
852
+ int (*write_fn)(git_filter *, void **, git_buf *, const git_buf *, const git_filter_source *);
799
853
  const git_filter_source *source;
800
854
  void **payload;
801
855
  git_buf input;
@@ -804,89 +858,120 @@ struct proxy_stream {
804
858
  git_writestream *target;
805
859
  };
806
860
 
807
- static int proxy_stream_write(
861
+ static int buffered_stream_write(
808
862
  git_writestream *s, const char *buffer, size_t len)
809
863
  {
810
- struct proxy_stream *proxy_stream = (struct proxy_stream *)s;
811
- assert(proxy_stream);
864
+ struct buffered_stream *buffered_stream = (struct buffered_stream *)s;
865
+ GIT_ASSERT_ARG(buffered_stream);
812
866
 
813
- return git_buf_put(&proxy_stream->input, buffer, len);
867
+ return git_buf_put(&buffered_stream->input, buffer, len);
814
868
  }
815
869
 
816
- static int proxy_stream_close(git_writestream *s)
870
+ static int buffered_stream_close(git_writestream *s)
817
871
  {
818
- struct proxy_stream *proxy_stream = (struct proxy_stream *)s;
872
+ struct buffered_stream *buffered_stream = (struct buffered_stream *)s;
819
873
  git_buf *writebuf;
820
874
  git_error_state error_state = {0};
821
875
  int error;
822
876
 
823
- assert(proxy_stream);
877
+ GIT_ASSERT_ARG(buffered_stream);
824
878
 
825
- error = proxy_stream->filter->apply(
826
- proxy_stream->filter,
827
- proxy_stream->payload,
828
- proxy_stream->output,
829
- &proxy_stream->input,
830
- proxy_stream->source);
879
+ error = buffered_stream->write_fn(
880
+ buffered_stream->filter,
881
+ buffered_stream->payload,
882
+ buffered_stream->output,
883
+ &buffered_stream->input,
884
+ buffered_stream->source);
831
885
 
832
886
  if (error == GIT_PASSTHROUGH) {
833
- writebuf = &proxy_stream->input;
887
+ writebuf = &buffered_stream->input;
834
888
  } else if (error == 0) {
835
- git_buf_sanitize(proxy_stream->output);
836
- writebuf = proxy_stream->output;
889
+ if ((error = git_buf_sanitize(buffered_stream->output)) < 0)
890
+ return error;
891
+
892
+ writebuf = buffered_stream->output;
837
893
  } else {
838
894
  /* close stream before erroring out taking care
839
895
  * to preserve the original error */
840
896
  git_error_state_capture(&error_state, error);
841
- proxy_stream->target->close(proxy_stream->target);
897
+ buffered_stream->target->close(buffered_stream->target);
842
898
  git_error_state_restore(&error_state);
843
899
  return error;
844
900
  }
845
901
 
846
- if ((error = proxy_stream->target->write(
847
- proxy_stream->target, writebuf->ptr, writebuf->size)) == 0)
848
- error = proxy_stream->target->close(proxy_stream->target);
902
+ if ((error = buffered_stream->target->write(
903
+ buffered_stream->target, writebuf->ptr, writebuf->size)) == 0)
904
+ error = buffered_stream->target->close(buffered_stream->target);
849
905
 
850
906
  return error;
851
907
  }
852
908
 
853
- static void proxy_stream_free(git_writestream *s)
909
+ static void buffered_stream_free(git_writestream *s)
854
910
  {
855
- struct proxy_stream *proxy_stream = (struct proxy_stream *)s;
856
- assert(proxy_stream);
911
+ struct buffered_stream *buffered_stream = (struct buffered_stream *)s;
857
912
 
858
- git_buf_dispose(&proxy_stream->input);
859
- git_buf_dispose(&proxy_stream->temp_buf);
860
- git__free(proxy_stream);
913
+ if (buffered_stream) {
914
+ git_buf_dispose(&buffered_stream->input);
915
+ git_buf_dispose(&buffered_stream->temp_buf);
916
+ git__free(buffered_stream);
917
+ }
861
918
  }
862
919
 
863
- static int proxy_stream_init(
920
+ int git_filter_buffered_stream_new(
864
921
  git_writestream **out,
865
922
  git_filter *filter,
923
+ int (*write_fn)(git_filter *, void **, git_buf *, const git_buf *, const git_filter_source *),
866
924
  git_buf *temp_buf,
867
925
  void **payload,
868
926
  const git_filter_source *source,
869
927
  git_writestream *target)
870
928
  {
871
- struct proxy_stream *proxy_stream = git__calloc(1, sizeof(struct proxy_stream));
872
- GIT_ERROR_CHECK_ALLOC(proxy_stream);
873
-
874
- proxy_stream->parent.write = proxy_stream_write;
875
- proxy_stream->parent.close = proxy_stream_close;
876
- proxy_stream->parent.free = proxy_stream_free;
877
- proxy_stream->filter = filter;
878
- proxy_stream->payload = payload;
879
- proxy_stream->source = source;
880
- proxy_stream->target = target;
881
- proxy_stream->output = temp_buf ? temp_buf : &proxy_stream->temp_buf;
929
+ struct buffered_stream *buffered_stream = git__calloc(1, sizeof(struct buffered_stream));
930
+ GIT_ERROR_CHECK_ALLOC(buffered_stream);
931
+
932
+ buffered_stream->parent.write = buffered_stream_write;
933
+ buffered_stream->parent.close = buffered_stream_close;
934
+ buffered_stream->parent.free = buffered_stream_free;
935
+ buffered_stream->filter = filter;
936
+ buffered_stream->write_fn = write_fn;
937
+ buffered_stream->output = temp_buf ? temp_buf : &buffered_stream->temp_buf;
938
+ buffered_stream->payload = payload;
939
+ buffered_stream->source = source;
940
+ buffered_stream->target = target;
882
941
 
883
942
  if (temp_buf)
884
943
  git_buf_clear(temp_buf);
885
944
 
886
- *out = (git_writestream *)proxy_stream;
945
+ *out = (git_writestream *)buffered_stream;
887
946
  return 0;
888
947
  }
889
948
 
949
+ static int setup_stream(
950
+ git_writestream **out,
951
+ git_filter_entry *fe,
952
+ git_filter_list *filters,
953
+ git_writestream *last_stream)
954
+ {
955
+ #ifndef GIT_DEPRECATE_HARD
956
+ GIT_ASSERT(fe->filter->stream || fe->filter->apply);
957
+
958
+ /*
959
+ * If necessary, create a stream that proxies the traditional
960
+ * application.
961
+ */
962
+ if (!fe->filter->stream) {
963
+ /* Create a stream that proxies the one-shot apply */
964
+ return git_filter_buffered_stream_new(out,
965
+ fe->filter, fe->filter->apply, filters->temp_buf,
966
+ &fe->payload, &filters->source, last_stream);
967
+ }
968
+ #endif
969
+
970
+ GIT_ASSERT(fe->filter->stream);
971
+ return fe->filter->stream(out, fe->filter,
972
+ &fe->payload, &filters->source, last_stream);
973
+ }
974
+
890
975
  static int stream_list_init(
891
976
  git_writestream **out,
892
977
  git_vector *streams,
@@ -908,22 +993,11 @@ static int stream_list_init(
908
993
  for (i = 0; i < git_array_size(filters->filters); ++i) {
909
994
  size_t filter_idx = (filters->source.mode == GIT_FILTER_TO_WORKTREE) ?
910
995
  git_array_size(filters->filters) - 1 - i : i;
996
+
911
997
  git_filter_entry *fe = git_array_get(filters->filters, filter_idx);
912
998
  git_writestream *filter_stream;
913
999
 
914
- assert(fe->filter->stream || fe->filter->apply);
915
-
916
- /* If necessary, create a stream that proxies the traditional
917
- * application.
918
- */
919
- if (fe->filter->stream)
920
- error = fe->filter->stream(&filter_stream, fe->filter,
921
- &fe->payload, &filters->source, last_stream);
922
- else
923
- /* Create a stream that proxies the one-shot apply */
924
- error = proxy_stream_init(&filter_stream, fe->filter,
925
- filters->temp_buf, &fe->payload, &filters->source,
926
- last_stream);
1000
+ error = setup_stream(&filter_stream, fe, filters, last_stream);
927
1001
 
928
1002
  if (error < 0)
929
1003
  goto out;
@@ -941,7 +1015,7 @@ out:
941
1015
  return error;
942
1016
  }
943
1017
 
944
- void stream_list_free(git_vector *streams)
1018
+ static void filter_streams_free(git_vector *streams)
945
1019
  {
946
1020
  git_writestream *stream;
947
1021
  size_t i;
@@ -967,8 +1041,10 @@ int git_filter_list_stream_file(
967
1041
 
968
1042
  if ((error = stream_list_init(
969
1043
  &stream_start, &filter_streams, filters, target)) < 0 ||
970
- (error = git_path_join_unrooted(&abspath, path, base, NULL)) < 0)
1044
+ (error = git_path_join_unrooted(&abspath, path, base, NULL)) < 0 ||
1045
+ (error = git_path_validate_workdir_buf(repo, &abspath)) < 0)
971
1046
  goto done;
1047
+
972
1048
  initialized = 1;
973
1049
 
974
1050
  if ((fd = git_futils_open_ro(abspath.ptr)) < 0) {
@@ -990,35 +1066,33 @@ done:
990
1066
 
991
1067
  if (fd >= 0)
992
1068
  p_close(fd);
993
- stream_list_free(&filter_streams);
1069
+ filter_streams_free(&filter_streams);
994
1070
  git_buf_dispose(&abspath);
995
1071
  return error;
996
1072
  }
997
1073
 
998
- int git_filter_list_stream_data(
1074
+ int git_filter_list_stream_buffer(
999
1075
  git_filter_list *filters,
1000
- git_buf *data,
1076
+ const char *buffer,
1077
+ size_t len,
1001
1078
  git_writestream *target)
1002
1079
  {
1003
1080
  git_vector filter_streams = GIT_VECTOR_INIT;
1004
1081
  git_writestream *stream_start;
1005
1082
  int error, initialized = 0;
1006
1083
 
1007
- git_buf_sanitize(data);
1008
-
1009
1084
  if ((error = stream_list_init(&stream_start, &filter_streams, filters, target)) < 0)
1010
1085
  goto out;
1011
1086
  initialized = 1;
1012
1087
 
1013
- if ((error = stream_start->write(
1014
- stream_start, data->ptr, data->size)) < 0)
1088
+ if ((error = stream_start->write(stream_start, buffer, len)) < 0)
1015
1089
  goto out;
1016
1090
 
1017
1091
  out:
1018
1092
  if (initialized)
1019
1093
  error |= stream_start->close(stream_start);
1020
1094
 
1021
- stream_list_free(&filter_streams);
1095
+ filter_streams_free(&filter_streams);
1022
1096
  return error;
1023
1097
  }
1024
1098
 
@@ -1035,7 +1109,7 @@ int git_filter_list_stream_blob(
1035
1109
  if (filters)
1036
1110
  git_oid_cpy(&filters->source.oid, git_blob_id(blob));
1037
1111
 
1038
- return git_filter_list_stream_data(filters, &in, target);
1112
+ return git_filter_list_stream_buffer(filters, in.ptr, in.size, target);
1039
1113
  }
1040
1114
 
1041
1115
  int git_filter_init(git_filter *filter, unsigned int version)
@@ -1043,3 +1117,31 @@ int git_filter_init(git_filter *filter, unsigned int version)
1043
1117
  GIT_INIT_STRUCTURE_FROM_TEMPLATE(filter, version, git_filter, GIT_FILTER_INIT);
1044
1118
  return 0;
1045
1119
  }
1120
+
1121
+ #ifndef GIT_DEPRECATE_HARD
1122
+
1123
+ int git_filter_list_stream_data(
1124
+ git_filter_list *filters,
1125
+ git_buf *data,
1126
+ git_writestream *target)
1127
+ {
1128
+ int error;
1129
+
1130
+ if ((error = git_buf_sanitize(data)) < 0)
1131
+ return error;
1132
+
1133
+ return git_filter_list_stream_buffer(filters, data->ptr, data->size, target);
1134
+ }
1135
+
1136
+ int git_filter_list_apply_to_data(
1137
+ git_buf *tgt, git_filter_list *filters, git_buf *src)
1138
+ {
1139
+ int error;
1140
+
1141
+ if ((error = git_buf_sanitize(src)) < 0)
1142
+ return error;
1143
+
1144
+ return git_filter_list_apply_to_buffer(tgt, filters, src->ptr, src->size);
1145
+ }
1146
+
1147
+ #endif
@@ -11,29 +11,39 @@
11
11
 
12
12
  #include "attr_file.h"
13
13
  #include "git2/filter.h"
14
+ #include "git2/sys/filter.h"
14
15
 
15
16
  /* Amount of file to examine for NUL byte when checking binary-ness */
16
17
  #define GIT_FILTER_BYTES_TO_CHECK_NUL 8000
17
18
 
18
19
  typedef struct {
20
+ git_filter_options options;
19
21
  git_attr_session *attr_session;
20
22
  git_buf *temp_buf;
21
- uint32_t flags;
22
- } git_filter_options;
23
+ } git_filter_session;
23
24
 
24
- #define GIT_FILTER_OPTIONS_INIT {0}
25
+ #define GIT_FILTER_SESSION_INIT {GIT_FILTER_OPTIONS_INIT, 0}
25
26
 
26
27
  extern int git_filter_global_init(void);
27
28
 
28
29
  extern void git_filter_free(git_filter *filter);
29
30
 
30
- extern int git_filter_list__load_ext(
31
+ extern int git_filter_list__load(
31
32
  git_filter_list **filters,
32
33
  git_repository *repo,
33
34
  git_blob *blob, /* can be NULL */
34
35
  const char *path,
35
36
  git_filter_mode_t mode,
36
- git_filter_options *filter_opts);
37
+ git_filter_session *filter_session);
38
+
39
+ /*
40
+ * The given input buffer will be converted to the given output buffer.
41
+ * The input buffer will be freed (_if_ it was allocated).
42
+ */
43
+ extern int git_filter_list__convert_buf(
44
+ git_buf *out,
45
+ git_filter_list *filters,
46
+ git_buf *in);
37
47
 
38
48
  /*
39
49
  * Available filters
@@ -42,4 +52,13 @@ extern int git_filter_list__load_ext(
42
52
  extern git_filter *git_crlf_filter_new(void);
43
53
  extern git_filter *git_ident_filter_new(void);
44
54
 
55
+ extern int git_filter_buffered_stream_new(
56
+ git_writestream **out,
57
+ git_filter *filter,
58
+ int (*write_fn)(git_filter *, void **, git_buf *, const git_buf *, const git_filter_source *),
59
+ git_buf *temp_buf,
60
+ void **payload,
61
+ const git_filter_source *source,
62
+ git_writestream *target);
63
+
45
64
  #endif