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
@@ -12,6 +12,7 @@
12
12
  #include "config.h"
13
13
  #include "sysdir.h"
14
14
  #include "ignore.h"
15
+ #include "path.h"
15
16
 
16
17
  GIT_INLINE(int) attr_cache_lock(git_attr_cache *cache)
17
18
  {
@@ -38,15 +39,17 @@ GIT_INLINE(git_attr_file_entry *) attr_cache_lookup_entry(
38
39
 
39
40
  int git_attr_cache__alloc_file_entry(
40
41
  git_attr_file_entry **out,
42
+ git_repository *repo,
41
43
  const char *base,
42
44
  const char *path,
43
45
  git_pool *pool)
44
46
  {
47
+ git_str fullpath_str = GIT_STR_INIT;
45
48
  size_t baselen = 0, pathlen = strlen(path);
46
49
  size_t cachesize = sizeof(git_attr_file_entry) + pathlen + 1;
47
50
  git_attr_file_entry *ce;
48
51
 
49
- if (base != NULL && git_path_root(path) < 0) {
52
+ if (base != NULL && git_fs_path_root(path) < 0) {
50
53
  baselen = strlen(base);
51
54
  cachesize += baselen;
52
55
 
@@ -65,6 +68,12 @@ int git_attr_cache__alloc_file_entry(
65
68
  }
66
69
  memcpy(&ce->fullpath[baselen], path, pathlen);
67
70
 
71
+ fullpath_str.ptr = ce->fullpath;
72
+ fullpath_str.size = pathlen + baselen;
73
+
74
+ if (git_path_validate_str_length(repo, &fullpath_str) < 0)
75
+ return -1;
76
+
68
77
  ce->path = &ce->fullpath[baselen];
69
78
  *out = ce;
70
79
 
@@ -79,8 +88,8 @@ static int attr_cache_make_entry(
79
88
  git_attr_file_entry *entry = NULL;
80
89
  int error;
81
90
 
82
- if ((error = git_attr_cache__alloc_file_entry(&entry, git_repository_workdir(repo),
83
- path, &cache->pool)) < 0)
91
+ if ((error = git_attr_cache__alloc_file_entry(&entry, repo,
92
+ git_repository_workdir(repo), path, &cache->pool)) < 0)
84
93
  return error;
85
94
 
86
95
  if ((error = git_strmap_set(cache->files, entry->path, entry)) < 0)
@@ -108,7 +117,7 @@ static int attr_cache_upsert(git_attr_cache *cache, git_attr_file *file)
108
117
  * Replace the existing value if another thread has
109
118
  * created it in the meantime.
110
119
  */
111
- old = git__swap(entry->file[file->source], file);
120
+ old = git_atomic_swap(entry->file[file->source.type], file);
112
121
 
113
122
  if (old) {
114
123
  GIT_REFCOUNT_OWN(old, NULL);
@@ -123,7 +132,7 @@ static int attr_cache_remove(git_attr_cache *cache, git_attr_file *file)
123
132
  {
124
133
  int error = 0;
125
134
  git_attr_file_entry *entry;
126
- git_attr_file *old = NULL;
135
+ git_attr_file *oldfile = NULL;
127
136
 
128
137
  if (!file)
129
138
  return 0;
@@ -132,13 +141,13 @@ static int attr_cache_remove(git_attr_cache *cache, git_attr_file *file)
132
141
  return error;
133
142
 
134
143
  if ((entry = attr_cache_lookup_entry(cache, file->entry->path)) != NULL)
135
- old = git__compare_and_swap(&entry->file[file->source], file, NULL);
144
+ oldfile = git_atomic_compare_and_swap(&entry->file[file->source.type], file, NULL);
136
145
 
137
146
  attr_cache_unlock(cache);
138
147
 
139
- if (old) {
140
- GIT_REFCOUNT_OWN(old, NULL);
141
- git_attr_file__free(old);
148
+ if (oldfile == file) {
149
+ GIT_REFCOUNT_OWN(file, NULL);
150
+ git_attr_file__free(file);
142
151
  }
143
152
 
144
153
  return error;
@@ -154,40 +163,42 @@ static int attr_cache_lookup(
154
163
  git_attr_file_entry **out_entry,
155
164
  git_repository *repo,
156
165
  git_attr_session *attr_session,
157
- git_attr_file_source source,
158
- const char *base,
159
- const char *filename)
166
+ git_attr_file_source *source)
160
167
  {
161
168
  int error = 0;
162
- git_buf path = GIT_BUF_INIT;
163
- const char *wd = git_repository_workdir(repo), *relfile;
169
+ git_str path = GIT_STR_INIT;
170
+ const char *wd = git_repository_workdir(repo);
171
+ const char *filename;
164
172
  git_attr_cache *cache = git_repository_attr_cache(repo);
165
173
  git_attr_file_entry *entry = NULL;
166
174
  git_attr_file *file = NULL;
167
175
 
168
176
  /* join base and path as needed */
169
- if (base != NULL && git_path_root(filename) < 0) {
170
- git_buf *p = attr_session ? &attr_session->tmp : &path;
177
+ if (source->base != NULL && git_fs_path_root(source->filename) < 0) {
178
+ git_str *p = attr_session ? &attr_session->tmp : &path;
171
179
 
172
- if (git_buf_joinpath(p, base, filename) < 0)
180
+ if (git_str_joinpath(p, source->base, source->filename) < 0 ||
181
+ git_path_validate_str_length(repo, p) < 0)
173
182
  return -1;
174
183
 
175
184
  filename = p->ptr;
185
+ } else {
186
+ filename = source->filename;
176
187
  }
177
188
 
178
- relfile = filename;
179
- if (wd && !git__prefixcmp(relfile, wd))
180
- relfile += strlen(wd);
189
+ if (wd && !git__prefixcmp(filename, wd))
190
+ filename += strlen(wd);
181
191
 
182
192
  /* check cache for existing entry */
183
193
  if ((error = attr_cache_lock(cache)) < 0)
184
194
  goto cleanup;
185
195
 
186
- entry = attr_cache_lookup_entry(cache, relfile);
187
- if (!entry)
188
- error = attr_cache_make_entry(&entry, repo, relfile);
189
- else if (entry->file[source] != NULL) {
190
- file = entry->file[source];
196
+ entry = attr_cache_lookup_entry(cache, filename);
197
+
198
+ if (!entry) {
199
+ error = attr_cache_make_entry(&entry, repo, filename);
200
+ } else if (entry->file[source->type] != NULL) {
201
+ file = entry->file[source->type];
191
202
  GIT_REFCOUNT_INC(file);
192
203
  }
193
204
 
@@ -197,7 +208,7 @@ cleanup:
197
208
  *out_file = file;
198
209
  *out_entry = entry;
199
210
 
200
- git_buf_dispose(&path);
211
+ git_str_dispose(&path);
201
212
  return error;
202
213
  }
203
214
 
@@ -205,9 +216,7 @@ int git_attr_cache__get(
205
216
  git_attr_file **out,
206
217
  git_repository *repo,
207
218
  git_attr_session *attr_session,
208
- git_attr_file_source source,
209
- const char *base,
210
- const char *filename,
219
+ git_attr_file_source *source,
211
220
  git_attr_file_parser parser,
212
221
  bool allow_macros)
213
222
  {
@@ -216,19 +225,21 @@ int git_attr_cache__get(
216
225
  git_attr_file_entry *entry = NULL;
217
226
  git_attr_file *file = NULL, *updated = NULL;
218
227
 
219
- if ((error = attr_cache_lookup(
220
- &file, &entry, repo, attr_session, source, base, filename)) < 0)
228
+ if ((error = attr_cache_lookup(&file, &entry, repo, attr_session, source)) < 0)
221
229
  return error;
222
230
 
223
231
  /* load file if we don't have one or if existing one is out of date */
224
- if (!file || (error = git_attr_file__out_of_date(repo, attr_session, file)) > 0)
225
- error = git_attr_file__load(&updated, repo, attr_session, entry, source, parser, allow_macros);
232
+ if (!file ||
233
+ (error = git_attr_file__out_of_date(repo, attr_session, file, source)) > 0)
234
+ error = git_attr_file__load(&updated, repo, attr_session,
235
+ entry, source, parser,
236
+ allow_macros);
226
237
 
227
238
  /* if we loaded the file, insert into and/or update cache */
228
239
  if (updated) {
229
- if ((error = attr_cache_upsert(cache, updated)) < 0)
240
+ if ((error = attr_cache_upsert(cache, updated)) < 0) {
230
241
  git_attr_file__free(updated);
231
- else {
242
+ } else {
232
243
  git_attr_file__free(file); /* offset incref from lookup */
233
244
  file = updated;
234
245
  }
@@ -255,7 +266,7 @@ int git_attr_cache__get(
255
266
 
256
267
  bool git_attr_cache__is_cached(
257
268
  git_repository *repo,
258
- git_attr_file_source source,
269
+ git_attr_file_source_t source_type,
259
270
  const char *filename)
260
271
  {
261
272
  git_attr_cache *cache = git_repository_attr_cache(repo);
@@ -268,14 +279,14 @@ bool git_attr_cache__is_cached(
268
279
  if ((entry = git_strmap_get(files, filename)) == NULL)
269
280
  return false;
270
281
 
271
- return entry && (entry->file[source] != NULL);
282
+ return entry && (entry->file[source_type] != NULL);
272
283
  }
273
284
 
274
285
 
275
286
  static int attr_cache__lookup_path(
276
287
  char **out, git_config *cfg, const char *key, const char *fallback)
277
288
  {
278
- git_buf buf = GIT_BUF_INIT;
289
+ git_str buf = GIT_STR_INIT;
279
290
  int error;
280
291
  git_config_entry *entry = NULL;
281
292
 
@@ -290,17 +301,17 @@ static int attr_cache__lookup_path(
290
301
  /* expand leading ~/ as needed */
291
302
  if (cfgval && cfgval[0] == '~' && cfgval[1] == '/') {
292
303
  if (! (error = git_sysdir_expand_global_file(&buf, &cfgval[2])))
293
- *out = git_buf_detach(&buf);
304
+ *out = git_str_detach(&buf);
294
305
  } else if (cfgval) {
295
306
  *out = git__strdup(cfgval);
296
307
  }
297
308
  }
298
309
  else if (!git_sysdir_find_xdg_file(&buf, fallback)) {
299
- *out = git_buf_detach(&buf);
310
+ *out = git_str_detach(&buf);
300
311
  }
301
312
 
302
313
  git_config_entry_free(entry);
303
- git_buf_dispose(&buf);
314
+ git_str_dispose(&buf);
304
315
 
305
316
  return error;
306
317
  }
@@ -321,7 +332,7 @@ static void attr_cache__free(git_attr_cache *cache)
321
332
 
322
333
  git_strmap_foreach_value(cache->files, entry, {
323
334
  for (i = 0; i < GIT_ATTR_FILE_NUM_SOURCES; ++i) {
324
- if ((file = git__swap(entry->file[i], NULL)) != NULL) {
335
+ if ((file = git_atomic_swap(entry->file[i], NULL)) != NULL) {
325
336
  GIT_REFCOUNT_OWN(file, NULL);
326
337
  git_attr_file__free(file);
327
338
  }
@@ -395,8 +406,7 @@ int git_attr_cache__init(git_repository *repo)
395
406
  (ret = git_pool_init(&cache->pool, 1)) < 0)
396
407
  goto cancel;
397
408
 
398
- cache = git__compare_and_swap(&repo->attrcache, NULL, cache);
399
- if (cache)
409
+ if (git_atomic_compare_and_swap(&repo->attrcache, NULL, cache) != NULL)
400
410
  goto cancel; /* raced with another thread, free this but no error */
401
411
 
402
412
  git_config_free(cfg);
@@ -417,7 +427,7 @@ int git_attr_cache_flush(git_repository *repo)
417
427
  /* this could be done less expensively, but for now, we'll just free
418
428
  * the entire attrcache and let the next use reinitialize it...
419
429
  */
420
- if (repo && (cache = git__swap(repo->attrcache, NULL)) != NULL)
430
+ if (repo && (cache = git_atomic_swap(repo->attrcache, NULL)) != NULL)
421
431
  attr_cache__free(cache);
422
432
 
423
433
  return 0;
@@ -31,19 +31,18 @@ extern int git_attr_cache__get(
31
31
  git_attr_file **file,
32
32
  git_repository *repo,
33
33
  git_attr_session *attr_session,
34
- git_attr_file_source source,
35
- const char *base,
36
- const char *filename,
34
+ git_attr_file_source *source,
37
35
  git_attr_file_parser parser,
38
36
  bool allow_macros);
39
37
 
40
38
  extern bool git_attr_cache__is_cached(
41
39
  git_repository *repo,
42
- git_attr_file_source source,
43
- const char *path);
40
+ git_attr_file_source_t source_type,
41
+ const char *filename);
44
42
 
45
43
  extern int git_attr_cache__alloc_file_entry(
46
44
  git_attr_file_entry **out,
45
+ git_repository *repo,
47
46
  const char *base,
48
47
  const char *path,
49
48
  git_pool *pool);
@@ -59,7 +59,7 @@ static bool hunk_starts_at_or_after_line(git_blame_hunk *hunk, size_t line)
59
59
  return line <= hunk->final_start_line_number;
60
60
  }
61
61
 
62
- static git_blame_hunk* new_hunk(
62
+ static git_blame_hunk *new_hunk(
63
63
  size_t start,
64
64
  size_t lines,
65
65
  size_t orig_start,
@@ -84,7 +84,7 @@ static void free_hunk(git_blame_hunk *hunk)
84
84
  git__free(hunk);
85
85
  }
86
86
 
87
- static git_blame_hunk* dup_hunk(git_blame_hunk *hunk)
87
+ static git_blame_hunk *dup_hunk(git_blame_hunk *hunk)
88
88
  {
89
89
  git_blame_hunk *newhunk = new_hunk(
90
90
  hunk->final_start_line_number,
@@ -122,7 +122,7 @@ static void shift_hunks_by(git_vector *v, size_t start_line, int shift_by)
122
122
  }
123
123
  }
124
124
 
125
- git_blame* git_blame__alloc(
125
+ git_blame *git_blame__alloc(
126
126
  git_repository *repo,
127
127
  git_blame_options opts,
128
128
  const char *path)
@@ -176,20 +176,21 @@ void git_blame_free(git_blame *blame)
176
176
 
177
177
  uint32_t git_blame_get_hunk_count(git_blame *blame)
178
178
  {
179
- assert(blame);
179
+ GIT_ASSERT_ARG(blame);
180
180
  return (uint32_t)blame->hunks.length;
181
181
  }
182
182
 
183
183
  const git_blame_hunk *git_blame_get_hunk_byindex(git_blame *blame, uint32_t index)
184
184
  {
185
- assert(blame);
185
+ GIT_ASSERT_ARG_WITH_RETVAL(blame, NULL);
186
186
  return (git_blame_hunk*)git_vector_get(&blame->hunks, index);
187
187
  }
188
188
 
189
189
  const git_blame_hunk *git_blame_get_hunk_byline(git_blame *blame, size_t lineno)
190
190
  {
191
191
  size_t i, new_lineno = lineno;
192
- assert(blame);
192
+
193
+ GIT_ASSERT_ARG_WITH_RETVAL(blame, NULL);
193
194
 
194
195
  if (!git_vector_bsearch2(&i, &blame->hunks, hunk_byfinalline_search_cmp, &new_lineno)) {
195
196
  return git_blame_get_hunk_byindex(blame, (uint32_t)i);
@@ -298,7 +299,7 @@ static int index_blob_lines(git_blame *blame)
298
299
  return blame->num_lines;
299
300
  }
300
301
 
301
- static git_blame_hunk* hunk_from_entry(git_blame__entry *e, git_blame *blame)
302
+ static git_blame_hunk *hunk_from_entry(git_blame__entry *e, git_blame *blame)
302
303
  {
303
304
  git_blame_hunk *h = new_hunk(
304
305
  e->lno+1, e->num_lines, e->s_lno+1, e->suspect->path);
@@ -393,7 +394,10 @@ int git_blame_file(
393
394
  git_blame_options normOptions = GIT_BLAME_OPTIONS_INIT;
394
395
  git_blame *blame = NULL;
395
396
 
396
- assert(out && repo && path);
397
+ GIT_ASSERT_ARG(out);
398
+ GIT_ASSERT_ARG(repo);
399
+ GIT_ASSERT_ARG(path);
400
+
397
401
  if ((error = normalize_options(&normOptions, options, repo)) < 0)
398
402
  goto on_error;
399
403
 
@@ -514,7 +518,9 @@ int git_blame_buffer(
514
518
 
515
519
  diffopts.context_lines = 0;
516
520
 
517
- assert(out && reference && buffer && buffer_len);
521
+ GIT_ASSERT_ARG(out);
522
+ GIT_ASSERT_ARG(reference);
523
+ GIT_ASSERT_ARG(buffer && buffer_len);
518
524
 
519
525
  blame = git_blame__alloc(reference->repository, reference->options, reference->path);
520
526
  GIT_ERROR_CHECK_ALLOC(blame);
@@ -393,7 +393,7 @@ static void fill_origin_blob(git_blame__origin *o, mmfile_t *file)
393
393
  memset(file, 0, sizeof(*file));
394
394
  if (o->blob) {
395
395
  file->ptr = (char*)git_blob_rawcontent(o->blob);
396
- file->size = (size_t)git_blob_rawsize(o->blob);
396
+ file->size = (long)git_blob_rawsize(o->blob);
397
397
  }
398
398
  }
399
399
 
@@ -429,7 +429,7 @@ static int paths_on_dup(void **old, void *new)
429
429
  return -1;
430
430
  }
431
431
 
432
- static git_blame__origin* find_origin(
432
+ static git_blame__origin *find_origin(
433
433
  git_blame *blame,
434
434
  git_commit *parent,
435
435
  git_blame__origin *origin)
@@ -12,13 +12,14 @@
12
12
  #include "git2/repository.h"
13
13
  #include "git2/odb_backend.h"
14
14
 
15
+ #include "buf.h"
15
16
  #include "filebuf.h"
16
17
  #include "filter.h"
17
- #include "buf_text.h"
18
18
 
19
19
  const void *git_blob_rawcontent(const git_blob *blob)
20
20
  {
21
- assert(blob);
21
+ GIT_ASSERT_ARG_WITH_RETVAL(blob, NULL);
22
+
22
23
  if (blob->raw)
23
24
  return blob->data.raw.data;
24
25
  else
@@ -27,19 +28,20 @@ const void *git_blob_rawcontent(const git_blob *blob)
27
28
 
28
29
  git_object_size_t git_blob_rawsize(const git_blob *blob)
29
30
  {
30
- assert(blob);
31
+ GIT_ASSERT_ARG(blob);
32
+
31
33
  if (blob->raw)
32
34
  return blob->data.raw.size;
33
35
  else
34
36
  return (git_object_size_t)git_odb_object_size(blob->data.odb);
35
37
  }
36
38
 
37
- int git_blob__getbuf(git_buf *buffer, git_blob *blob)
39
+ int git_blob__getbuf(git_str *buffer, git_blob *blob)
38
40
  {
39
41
  git_object_size_t size = git_blob_rawsize(blob);
40
42
 
41
43
  GIT_ERROR_CHECK_BLOBSIZE(size);
42
- return git_buf_set(buffer, git_blob_rawcontent(blob), (size_t)size);
44
+ return git_str_set(buffer, git_blob_rawcontent(blob), (size_t)size);
43
45
  }
44
46
 
45
47
  void git_blob__free(void *_blob)
@@ -53,7 +55,9 @@ void git_blob__free(void *_blob)
53
55
  int git_blob__parse_raw(void *_blob, const char *data, size_t size)
54
56
  {
55
57
  git_blob *blob = (git_blob *) _blob;
56
- assert(blob);
58
+
59
+ GIT_ASSERT_ARG(blob);
60
+
57
61
  blob->raw = 1;
58
62
  blob->data.raw.data = data;
59
63
  blob->data.raw.size = size;
@@ -63,7 +67,9 @@ int git_blob__parse_raw(void *_blob, const char *data, size_t size)
63
67
  int git_blob__parse(void *_blob, git_odb_object *odb_obj)
64
68
  {
65
69
  git_blob *blob = (git_blob *) _blob;
66
- assert(blob);
70
+
71
+ GIT_ASSERT_ARG(blob);
72
+
67
73
  git_cached_obj_incref((git_cached_obj *)odb_obj);
68
74
  blob->raw = 0;
69
75
  blob->data.odb = odb_obj;
@@ -77,7 +83,8 @@ int git_blob_create_from_buffer(
77
83
  git_odb *odb;
78
84
  git_odb_stream *stream;
79
85
 
80
- assert(id && repo);
86
+ GIT_ASSERT_ARG(id);
87
+ GIT_ASSERT_ARG(repo);
81
88
 
82
89
  if ((error = git_repository_odb__weakptr(&odb, repo)) < 0 ||
83
90
  (error = git_odb_open_wstream(&stream, odb, len, GIT_OBJECT_BLOB)) < 0)
@@ -132,12 +139,13 @@ static int write_file_filtered(
132
139
  git_object_size_t *size,
133
140
  git_odb *odb,
134
141
  const char *full_path,
135
- git_filter_list *fl)
142
+ git_filter_list *fl,
143
+ git_repository* repo)
136
144
  {
137
145
  int error;
138
- git_buf tgt = GIT_BUF_INIT;
146
+ git_str tgt = GIT_STR_INIT;
139
147
 
140
- error = git_filter_list_apply_to_file(&tgt, fl, NULL, full_path);
148
+ error = git_filter_list__apply_to_file(&tgt, fl, repo, full_path);
141
149
 
142
150
  /* Write the file to disk if it was properly filtered */
143
151
  if (!error) {
@@ -146,7 +154,7 @@ static int write_file_filtered(
146
154
  error = git_odb_write(id, odb, tgt.ptr, tgt.size, GIT_OBJECT_BLOB);
147
155
  }
148
156
 
149
- git_buf_dispose(&tgt);
157
+ git_str_dispose(&tgt);
150
158
  return error;
151
159
  }
152
160
 
@@ -186,22 +194,18 @@ int git_blob__create_from_paths(
186
194
  git_odb *odb = NULL;
187
195
  git_object_size_t size;
188
196
  mode_t mode;
189
- git_buf path = GIT_BUF_INIT;
197
+ git_str path = GIT_STR_INIT;
190
198
 
191
- assert(hint_path || !try_load_filters);
199
+ GIT_ASSERT_ARG(hint_path || !try_load_filters);
192
200
 
193
201
  if (!content_path) {
194
- if (git_repository__ensure_not_bare(repo, "create blob from file") < 0)
195
- return GIT_EBAREREPO;
196
-
197
- if (git_buf_joinpath(
198
- &path, git_repository_workdir(repo), hint_path) < 0)
202
+ if (git_repository_workdir_path(&path, repo, hint_path) < 0)
199
203
  return -1;
200
204
 
201
205
  content_path = path.ptr;
202
206
  }
203
207
 
204
- if ((error = git_path_lstat(content_path, &st)) < 0 ||
208
+ if ((error = git_fs_path_lstat(content_path, &st)) < 0 ||
205
209
  (error = git_repository_odb(&odb, repo)) < 0)
206
210
  goto done;
207
211
 
@@ -236,7 +240,7 @@ int git_blob__create_from_paths(
236
240
  error = write_file_stream(id, odb, content_path, size);
237
241
  else {
238
242
  /* We need to apply one or more filters */
239
- error = write_file_filtered(id, &size, odb, content_path, fl);
243
+ error = write_file_filtered(id, &size, odb, content_path, fl, repo);
240
244
 
241
245
  git_filter_list_free(fl);
242
246
  }
@@ -258,7 +262,7 @@ int git_blob__create_from_paths(
258
262
 
259
263
  done:
260
264
  git_odb_free(odb);
261
- git_buf_dispose(&path);
265
+ git_str_dispose(&path);
262
266
 
263
267
  return error;
264
268
  }
@@ -273,24 +277,23 @@ int git_blob_create_from_disk(
273
277
  git_oid *id, git_repository *repo, const char *path)
274
278
  {
275
279
  int error;
276
- git_buf full_path = GIT_BUF_INIT;
277
- const char *workdir, *hintpath;
280
+ git_str full_path = GIT_STR_INIT;
281
+ const char *workdir, *hintpath = NULL;
278
282
 
279
- if ((error = git_path_prettify(&full_path, path, NULL)) < 0) {
280
- git_buf_dispose(&full_path);
283
+ if ((error = git_fs_path_prettify(&full_path, path, NULL)) < 0) {
284
+ git_str_dispose(&full_path);
281
285
  return error;
282
286
  }
283
287
 
284
- hintpath = git_buf_cstr(&full_path);
285
288
  workdir = git_repository_workdir(repo);
286
289
 
287
- if (workdir && !git__prefixcmp(hintpath, workdir))
288
- hintpath += strlen(workdir);
290
+ if (workdir && !git__prefixcmp(full_path.ptr, workdir))
291
+ hintpath = full_path.ptr + strlen(workdir);
289
292
 
290
293
  error = git_blob__create_from_paths(
291
- id, NULL, repo, git_buf_cstr(&full_path), hintpath, 0, true);
294
+ id, NULL, repo, git_str_cstr(&full_path), hintpath, 0, !!hintpath);
292
295
 
293
- git_buf_dispose(&full_path);
296
+ git_str_dispose(&full_path);
294
297
  return error;
295
298
  }
296
299
 
@@ -328,10 +331,11 @@ static int blob_writestream_write(git_writestream *_stream, const char *buffer,
328
331
  int git_blob_create_from_stream(git_writestream **out, git_repository *repo, const char *hintpath)
329
332
  {
330
333
  int error;
331
- git_buf path = GIT_BUF_INIT;
334
+ git_str path = GIT_STR_INIT;
332
335
  blob_writestream *stream;
333
336
 
334
- assert(out && repo);
337
+ GIT_ASSERT_ARG(out);
338
+ GIT_ASSERT_ARG(repo);
335
339
 
336
340
  stream = git__calloc(1, sizeof(blob_writestream));
337
341
  GIT_ERROR_CHECK_ALLOC(stream);
@@ -346,11 +350,11 @@ int git_blob_create_from_stream(git_writestream **out, git_repository *repo, con
346
350
  stream->parent.close = blob_writestream_close;
347
351
  stream->parent.free = blob_writestream_free;
348
352
 
349
- if ((error = git_repository_item_path(&path, repo, GIT_REPOSITORY_ITEM_OBJECTS)) < 0
350
- || (error = git_buf_joinpath(&path, path.ptr, "streamed")) < 0)
353
+ if ((error = git_repository__item_path(&path, repo, GIT_REPOSITORY_ITEM_OBJECTS)) < 0
354
+ || (error = git_str_joinpath(&path, path.ptr, "streamed")) < 0)
351
355
  goto cleanup;
352
356
 
353
- if ((error = git_filebuf_open_withsize(&stream->fbuf, git_buf_cstr(&path), GIT_FILEBUF_TEMPORARY,
357
+ if ((error = git_filebuf_open_withsize(&stream->fbuf, git_str_cstr(&path), GIT_FILEBUF_TEMPORARY,
354
358
  0666, 2 * 1024 * 1024)) < 0)
355
359
  goto cleanup;
356
360
 
@@ -360,7 +364,7 @@ cleanup:
360
364
  if (error < 0)
361
365
  blob_writestream_free((git_writestream *) stream);
362
366
 
363
- git_buf_dispose(&path);
367
+ git_str_dispose(&path);
364
368
  return error;
365
369
  }
366
370
 
@@ -388,16 +392,25 @@ cleanup:
388
392
 
389
393
  int git_blob_is_binary(const git_blob *blob)
390
394
  {
391
- git_buf content = GIT_BUF_INIT;
395
+ git_str content = GIT_STR_INIT;
392
396
  git_object_size_t size;
393
397
 
394
- assert(blob);
398
+ GIT_ASSERT_ARG(blob);
395
399
 
396
400
  size = git_blob_rawsize(blob);
397
401
 
398
- git_buf_attach_notowned(&content, git_blob_rawcontent(blob),
402
+ git_str_attach_notowned(&content, git_blob_rawcontent(blob),
399
403
  (size_t)min(size, GIT_FILTER_BYTES_TO_CHECK_NUL));
400
- return git_buf_text_is_binary(&content);
404
+ return git_str_is_binary(&content);
405
+ }
406
+
407
+ int git_blob_data_is_binary(const char *str, size_t len)
408
+ {
409
+ git_str content = GIT_STR_INIT;
410
+
411
+ git_str_attach_notowned(&content, str, len);
412
+
413
+ return git_str_is_binary(&content);
401
414
  }
402
415
 
403
416
  int git_blob_filter_options_init(
@@ -415,14 +428,14 @@ int git_blob_filter(
415
428
  const char *path,
416
429
  git_blob_filter_options *given_opts)
417
430
  {
418
- int error = 0;
419
- git_filter_list *fl = NULL;
420
431
  git_blob_filter_options opts = GIT_BLOB_FILTER_OPTIONS_INIT;
421
- git_filter_flag_t flags = GIT_FILTER_DEFAULT;
422
-
423
- assert(blob && path && out);
432
+ git_filter_options filter_opts = GIT_FILTER_OPTIONS_INIT;
433
+ git_filter_list *fl = NULL;
434
+ int error = 0;
424
435
 
425
- git_buf_sanitize(out);
436
+ GIT_ASSERT_ARG(blob);
437
+ GIT_ASSERT_ARG(path);
438
+ GIT_ASSERT_ARG(out);
426
439
 
427
440
  GIT_ERROR_CHECK_VERSION(
428
441
  given_opts, GIT_BLOB_FILTER_OPTIONS_VERSION, "git_blob_filter_options");
@@ -435,14 +448,25 @@ int git_blob_filter(
435
448
  return 0;
436
449
 
437
450
  if ((opts.flags & GIT_BLOB_FILTER_NO_SYSTEM_ATTRIBUTES) != 0)
438
- flags |= GIT_FILTER_NO_SYSTEM_ATTRIBUTES;
451
+ filter_opts.flags |= GIT_FILTER_NO_SYSTEM_ATTRIBUTES;
439
452
 
440
- if ((opts.flags & GIT_BLOB_FILTER_ATTTRIBUTES_FROM_HEAD) != 0)
441
- flags |= GIT_FILTER_ATTRIBUTES_FROM_HEAD;
453
+ if ((opts.flags & GIT_BLOB_FILTER_ATTRIBUTES_FROM_HEAD) != 0)
454
+ filter_opts.flags |= GIT_FILTER_ATTRIBUTES_FROM_HEAD;
455
+
456
+ if ((opts.flags & GIT_BLOB_FILTER_ATTRIBUTES_FROM_COMMIT) != 0) {
457
+ filter_opts.flags |= GIT_FILTER_ATTRIBUTES_FROM_COMMIT;
458
+
459
+ #ifndef GIT_DEPRECATE_HARD
460
+ if (opts.commit_id)
461
+ git_oid_cpy(&filter_opts.attr_commit_id, opts.commit_id);
462
+ else
463
+ #endif
464
+ git_oid_cpy(&filter_opts.attr_commit_id, &opts.attr_commit_id);
465
+ }
442
466
 
443
- if (!(error = git_filter_list_load(
467
+ if (!(error = git_filter_list_load_ext(
444
468
  &fl, git_blob_owner(blob), blob, path,
445
- GIT_FILTER_TO_WORKTREE, flags))) {
469
+ GIT_FILTER_TO_WORKTREE, &filter_opts))) {
446
470
 
447
471
  error = git_filter_list_apply_to_blob(out, fl, blob);
448
472
 
@@ -38,7 +38,7 @@ struct git_blob {
38
38
  void git_blob__free(void *blob);
39
39
  int git_blob__parse(void *blob, git_odb_object *obj);
40
40
  int git_blob__parse_raw(void *blob, const char *data, size_t size);
41
- int git_blob__getbuf(git_buf *buffer, git_blob *blob);
41
+ int git_blob__getbuf(git_str *buffer, git_blob *blob);
42
42
 
43
43
  extern int git_blob__create_from_paths(
44
44
  git_oid *out_oid,