rugged 1.0.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (338) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +1 -0
  3. data/README.md +3 -3
  4. data/ext/rugged/rugged.c +7 -4
  5. data/ext/rugged/rugged_commit.c +1 -1
  6. data/ext/rugged/rugged_config.c +1 -1
  7. data/ext/rugged/rugged_object.c +1 -1
  8. data/ext/rugged/rugged_remote.c +32 -2
  9. data/ext/rugged/rugged_repo.c +13 -3
  10. data/lib/rugged/commit.rb +17 -4
  11. data/lib/rugged/repository.rb +7 -8
  12. data/lib/rugged/submodule_collection.rb +4 -4
  13. data/lib/rugged/version.rb +1 -1
  14. data/vendor/libgit2/CMakeLists.txt +41 -74
  15. data/vendor/libgit2/COPYING +109 -1
  16. data/vendor/libgit2/cmake/{Modules/AddCFlagIfSupported.cmake → AddCFlagIfSupported.cmake} +0 -0
  17. data/vendor/libgit2/cmake/{Modules/EnableWarnings.cmake → EnableWarnings.cmake} +0 -0
  18. data/vendor/libgit2/cmake/{Modules/FindCoreFoundation.cmake → FindCoreFoundation.cmake} +0 -0
  19. data/vendor/libgit2/cmake/{Modules/FindGSSAPI.cmake → FindGSSAPI.cmake} +0 -0
  20. data/vendor/libgit2/cmake/{Modules/FindGSSFramework.cmake → FindGSSFramework.cmake} +0 -0
  21. data/vendor/libgit2/cmake/{Modules/FindHTTP_Parser.cmake → FindHTTP_Parser.cmake} +0 -0
  22. data/vendor/libgit2/cmake/{Modules/FindIconv.cmake → FindIconv.cmake} +0 -0
  23. data/vendor/libgit2/cmake/{Modules/FindPCRE.cmake → FindPCRE.cmake} +0 -0
  24. data/vendor/libgit2/cmake/{Modules/FindPCRE2.cmake → FindPCRE2.cmake} +0 -0
  25. data/vendor/libgit2/cmake/{Modules/FindPkgLibraries.cmake → FindPkgLibraries.cmake} +0 -0
  26. data/vendor/libgit2/cmake/{Modules/FindSecurity.cmake → FindSecurity.cmake} +0 -0
  27. data/vendor/libgit2/cmake/{Modules/FindStatNsec.cmake → FindStatNsec.cmake} +0 -0
  28. data/vendor/libgit2/cmake/Findfutimens.cmake +14 -0
  29. data/vendor/libgit2/cmake/{Modules/FindmbedTLS.cmake → FindmbedTLS.cmake} +0 -0
  30. data/vendor/libgit2/cmake/{Modules/IdeSplitSources.cmake → IdeSplitSources.cmake} +0 -0
  31. data/vendor/libgit2/cmake/{Modules/PkgBuildConfig.cmake → PkgBuildConfig.cmake} +0 -0
  32. data/vendor/libgit2/cmake/{Modules/SanitizeBool.cmake → SanitizeBool.cmake} +0 -0
  33. data/vendor/libgit2/cmake/{Modules/SelectGSSAPI.cmake → SelectGSSAPI.cmake} +18 -26
  34. data/vendor/libgit2/cmake/{Modules/SelectHTTPSBackend.cmake → SelectHTTPSBackend.cmake} +29 -32
  35. data/vendor/libgit2/cmake/{Modules/SelectHashes.cmake → SelectHashes.cmake} +21 -28
  36. data/vendor/libgit2/deps/chromium-zlib/CMakeLists.txt +101 -0
  37. data/vendor/libgit2/deps/http-parser/CMakeLists.txt +4 -3
  38. data/vendor/libgit2/deps/ntlmclient/CMakeLists.txt +24 -10
  39. data/vendor/libgit2/deps/ntlmclient/compat.h +0 -27
  40. data/vendor/libgit2/deps/ntlmclient/crypt.h +14 -9
  41. data/vendor/libgit2/deps/ntlmclient/crypt_commoncrypto.c +20 -20
  42. data/vendor/libgit2/deps/ntlmclient/crypt_commoncrypto.h +3 -3
  43. data/vendor/libgit2/deps/ntlmclient/crypt_mbedtls.c +37 -36
  44. data/vendor/libgit2/deps/ntlmclient/crypt_mbedtls.h +4 -3
  45. data/vendor/libgit2/deps/ntlmclient/crypt_openssl.c +178 -51
  46. data/vendor/libgit2/deps/ntlmclient/crypt_openssl.h +74 -5
  47. data/vendor/libgit2/deps/ntlmclient/ntlm.c +164 -135
  48. data/vendor/libgit2/deps/ntlmclient/ntlm.h +13 -9
  49. data/vendor/libgit2/deps/ntlmclient/ntlmclient.h +16 -3
  50. data/vendor/libgit2/deps/ntlmclient/unicode.h +10 -4
  51. data/vendor/libgit2/deps/ntlmclient/unicode_builtin.c +16 -27
  52. data/vendor/libgit2/deps/ntlmclient/unicode_builtin.h +20 -0
  53. data/vendor/libgit2/deps/ntlmclient/unicode_iconv.c +28 -52
  54. data/vendor/libgit2/deps/ntlmclient/unicode_iconv.h +22 -0
  55. data/vendor/libgit2/deps/ntlmclient/util.c +15 -1
  56. data/vendor/libgit2/deps/ntlmclient/util.h +2 -1
  57. data/vendor/libgit2/deps/pcre/LICENCE +93 -0
  58. data/vendor/libgit2/deps/pcre/pcre.h +2 -2
  59. data/vendor/libgit2/deps/pcre/pcre_compile.c +29 -17
  60. data/vendor/libgit2/deps/pcre/pcre_jit_compile.c +4 -4
  61. data/vendor/libgit2/deps/pcre/pcreposix.c +2 -3
  62. data/vendor/libgit2/deps/zlib/CMakeLists.txt +6 -5
  63. data/vendor/libgit2/deps/zlib/deflate.c +1 -0
  64. data/vendor/libgit2/include/git2/annotated_commit.h +1 -1
  65. data/vendor/libgit2/include/git2/apply.h +2 -0
  66. data/vendor/libgit2/include/git2/attr.h +89 -0
  67. data/vendor/libgit2/include/git2/blame.h +95 -42
  68. data/vendor/libgit2/include/git2/blob.h +31 -3
  69. data/vendor/libgit2/include/git2/branch.h +25 -0
  70. data/vendor/libgit2/include/git2/cert.h +42 -5
  71. data/vendor/libgit2/include/git2/checkout.h +28 -12
  72. data/vendor/libgit2/include/git2/commit.h +35 -19
  73. data/vendor/libgit2/include/git2/common.h +33 -6
  74. data/vendor/libgit2/include/git2/config.h +1 -1
  75. data/vendor/libgit2/include/git2/deprecated.h +248 -8
  76. data/vendor/libgit2/include/git2/diff.h +35 -20
  77. data/vendor/libgit2/include/git2/errors.h +8 -7
  78. data/vendor/libgit2/include/git2/filter.h +57 -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/odb.h +44 -20
  83. data/vendor/libgit2/include/git2/pack.h +1 -1
  84. data/vendor/libgit2/include/git2/patch.h +8 -0
  85. data/vendor/libgit2/include/git2/rebase.h +25 -1
  86. data/vendor/libgit2/include/git2/refs.h +9 -5
  87. data/vendor/libgit2/include/git2/remote.h +59 -6
  88. data/vendor/libgit2/include/git2/repository.h +95 -52
  89. data/vendor/libgit2/include/git2/revparse.h +5 -5
  90. data/vendor/libgit2/include/git2/status.h +115 -59
  91. data/vendor/libgit2/include/git2/strarray.h +6 -10
  92. data/vendor/libgit2/include/git2/submodule.h +9 -0
  93. data/vendor/libgit2/include/git2/sys/commit_graph.h +174 -0
  94. data/vendor/libgit2/include/git2/sys/filter.h +49 -28
  95. data/vendor/libgit2/include/git2/sys/midx.h +74 -0
  96. data/vendor/libgit2/include/git2/sys/odb_backend.h +7 -0
  97. data/vendor/libgit2/include/git2/sys/transport.h +1 -0
  98. data/vendor/libgit2/include/git2/tag.h +12 -0
  99. data/vendor/libgit2/include/git2/transport.h +1 -1
  100. data/vendor/libgit2/include/git2/tree.h +2 -14
  101. data/vendor/libgit2/include/git2/types.h +9 -0
  102. data/vendor/libgit2/include/git2/version.h +3 -3
  103. data/vendor/libgit2/include/git2/worktree.h +1 -0
  104. data/vendor/libgit2/src/CMakeLists.txt +77 -44
  105. data/vendor/libgit2/src/alloc.c +21 -8
  106. data/vendor/libgit2/src/allocators/failalloc.c +92 -0
  107. data/vendor/libgit2/src/allocators/failalloc.h +23 -0
  108. data/vendor/libgit2/src/allocators/stdalloc.c +41 -10
  109. data/vendor/libgit2/src/allocators/win32_leakcheck.c +118 -0
  110. data/vendor/libgit2/src/allocators/{win32_crtdbg.h → win32_leakcheck.h} +3 -3
  111. data/vendor/libgit2/src/annotated_commit.c +21 -9
  112. data/vendor/libgit2/src/apply.c +21 -8
  113. data/vendor/libgit2/src/array.h +11 -11
  114. data/vendor/libgit2/src/assert_safe.h +58 -0
  115. data/vendor/libgit2/src/attr.c +181 -74
  116. data/vendor/libgit2/src/attr_file.c +92 -42
  117. data/vendor/libgit2/src/attr_file.h +32 -11
  118. data/vendor/libgit2/src/attrcache.c +44 -40
  119. data/vendor/libgit2/src/attrcache.h +4 -5
  120. data/vendor/libgit2/src/blame.c +28 -15
  121. data/vendor/libgit2/src/blame_git.c +6 -3
  122. data/vendor/libgit2/src/blob.c +46 -24
  123. data/vendor/libgit2/src/branch.c +87 -37
  124. data/vendor/libgit2/src/buffer.c +339 -27
  125. data/vendor/libgit2/src/buffer.h +153 -2
  126. data/vendor/libgit2/src/cache.c +3 -24
  127. data/vendor/libgit2/src/cache.h +7 -7
  128. data/vendor/libgit2/src/cc-compat.h +10 -2
  129. data/vendor/libgit2/src/checkout.c +97 -98
  130. data/vendor/libgit2/src/cherrypick.c +8 -2
  131. data/vendor/libgit2/src/clone.c +104 -29
  132. data/vendor/libgit2/src/commit.c +41 -28
  133. data/vendor/libgit2/src/commit_graph.c +1209 -0
  134. data/vendor/libgit2/src/commit_graph.h +162 -0
  135. data/vendor/libgit2/src/commit_list.c +46 -0
  136. data/vendor/libgit2/src/commit_list.h +2 -0
  137. data/vendor/libgit2/src/common.h +26 -2
  138. data/vendor/libgit2/src/config.c +40 -22
  139. data/vendor/libgit2/src/config_cache.c +9 -4
  140. data/vendor/libgit2/src/config_entries.c +35 -27
  141. data/vendor/libgit2/src/config_file.c +25 -8
  142. data/vendor/libgit2/src/config_parse.c +5 -7
  143. data/vendor/libgit2/src/config_snapshot.c +2 -1
  144. data/vendor/libgit2/src/crlf.c +16 -6
  145. data/vendor/libgit2/src/date.c +4 -3
  146. data/vendor/libgit2/src/delta.c +1 -1
  147. data/vendor/libgit2/src/describe.c +11 -4
  148. data/vendor/libgit2/src/diff.c +23 -19
  149. data/vendor/libgit2/src/diff_driver.c +21 -17
  150. data/vendor/libgit2/src/diff_file.c +5 -7
  151. data/vendor/libgit2/src/diff_generate.c +56 -28
  152. data/vendor/libgit2/src/diff_parse.c +2 -3
  153. data/vendor/libgit2/src/diff_print.c +81 -65
  154. data/vendor/libgit2/src/diff_stats.c +19 -16
  155. data/vendor/libgit2/src/diff_tform.c +13 -13
  156. data/vendor/libgit2/src/diff_xdiff.c +4 -2
  157. data/vendor/libgit2/src/diff_xdiff.h +1 -1
  158. data/vendor/libgit2/src/errors.c +26 -19
  159. data/vendor/libgit2/src/features.h.in +5 -1
  160. data/vendor/libgit2/src/fetch.c +7 -2
  161. data/vendor/libgit2/src/fetchhead.c +8 -4
  162. data/vendor/libgit2/src/filebuf.c +9 -7
  163. data/vendor/libgit2/src/filter.c +209 -113
  164. data/vendor/libgit2/src/filter.h +24 -5
  165. data/vendor/libgit2/src/futils.c +8 -8
  166. data/vendor/libgit2/src/futils.h +4 -4
  167. data/vendor/libgit2/src/graph.c +64 -9
  168. data/vendor/libgit2/src/hash/sha1/collisiondetect.c +3 -3
  169. data/vendor/libgit2/src/hash/sha1/common_crypto.c +3 -3
  170. data/vendor/libgit2/src/hash/sha1/generic.h +1 -1
  171. data/vendor/libgit2/src/hash/sha1/mbedtls.c +12 -12
  172. data/vendor/libgit2/src/hash/sha1/openssl.c +3 -3
  173. data/vendor/libgit2/src/hash/sha1/sha1dc/sha1.c +0 -2
  174. data/vendor/libgit2/src/hash/sha1/win32.c +15 -11
  175. data/vendor/libgit2/src/hash.c +16 -13
  176. data/vendor/libgit2/src/hash.h +1 -1
  177. data/vendor/libgit2/src/hashsig.c +23 -10
  178. data/vendor/libgit2/src/ident.c +13 -3
  179. data/vendor/libgit2/src/idxmap.c +0 -22
  180. data/vendor/libgit2/src/ignore.c +35 -19
  181. data/vendor/libgit2/src/index.c +126 -84
  182. data/vendor/libgit2/src/index.h +1 -1
  183. data/vendor/libgit2/src/indexer.c +60 -36
  184. data/vendor/libgit2/src/integer.h +79 -2
  185. data/vendor/libgit2/src/iterator.c +40 -28
  186. data/vendor/libgit2/src/iterator.h +1 -1
  187. data/vendor/libgit2/src/khash.h +2 -11
  188. data/vendor/libgit2/src/{settings.c → libgit2.c} +125 -49
  189. data/vendor/libgit2/src/libgit2.h +15 -0
  190. data/vendor/libgit2/src/mailmap.c +23 -10
  191. data/vendor/libgit2/src/map.h +3 -3
  192. data/vendor/libgit2/src/merge.c +108 -46
  193. data/vendor/libgit2/src/merge.h +2 -1
  194. data/vendor/libgit2/src/merge_driver.c +19 -13
  195. data/vendor/libgit2/src/merge_file.c +15 -9
  196. data/vendor/libgit2/src/message.c +3 -1
  197. data/vendor/libgit2/src/midx.c +879 -0
  198. data/vendor/libgit2/src/midx.h +110 -0
  199. data/vendor/libgit2/src/mwindow.c +214 -95
  200. data/vendor/libgit2/src/mwindow.h +3 -3
  201. data/vendor/libgit2/src/net.c +133 -4
  202. data/vendor/libgit2/src/net.h +16 -2
  203. data/vendor/libgit2/src/netops.c +6 -4
  204. data/vendor/libgit2/src/netops.h +2 -2
  205. data/vendor/libgit2/src/notes.c +10 -10
  206. data/vendor/libgit2/src/object.c +24 -15
  207. data/vendor/libgit2/src/odb.c +298 -57
  208. data/vendor/libgit2/src/odb.h +16 -2
  209. data/vendor/libgit2/src/odb_loose.c +31 -21
  210. data/vendor/libgit2/src/odb_mempack.c +3 -1
  211. data/vendor/libgit2/src/odb_pack.c +391 -114
  212. data/vendor/libgit2/src/oid.c +7 -4
  213. data/vendor/libgit2/src/pack-objects.c +83 -69
  214. data/vendor/libgit2/src/pack.c +383 -150
  215. data/vendor/libgit2/src/pack.h +44 -9
  216. data/vendor/libgit2/src/patch.c +14 -7
  217. data/vendor/libgit2/src/patch_generate.c +3 -5
  218. data/vendor/libgit2/src/patch_parse.c +6 -3
  219. data/vendor/libgit2/src/path.c +102 -57
  220. data/vendor/libgit2/src/path.h +79 -6
  221. data/vendor/libgit2/src/pathspec.c +12 -11
  222. data/vendor/libgit2/src/pool.c +34 -22
  223. data/vendor/libgit2/src/pool.h +9 -1
  224. data/vendor/libgit2/src/posix.c +43 -12
  225. data/vendor/libgit2/src/posix.h +9 -0
  226. data/vendor/libgit2/src/proxy.c +2 -0
  227. data/vendor/libgit2/src/push.c +2 -0
  228. data/vendor/libgit2/src/reader.c +10 -6
  229. data/vendor/libgit2/src/rebase.c +95 -49
  230. data/vendor/libgit2/src/refdb.c +165 -13
  231. data/vendor/libgit2/src/refdb.h +69 -0
  232. data/vendor/libgit2/src/refdb_fs.c +144 -152
  233. data/vendor/libgit2/src/reflog.c +21 -20
  234. data/vendor/libgit2/src/refs.c +151 -231
  235. data/vendor/libgit2/src/refs.h +2 -20
  236. data/vendor/libgit2/src/refspec.c +80 -44
  237. data/vendor/libgit2/src/regexp.c +2 -2
  238. data/vendor/libgit2/src/remote.c +312 -121
  239. data/vendor/libgit2/src/remote.h +2 -1
  240. data/vendor/libgit2/src/repository.c +351 -189
  241. data/vendor/libgit2/src/repository.h +23 -29
  242. data/vendor/libgit2/src/reset.c +7 -6
  243. data/vendor/libgit2/src/revert.c +8 -2
  244. data/vendor/libgit2/src/revparse.c +19 -13
  245. data/vendor/libgit2/src/revwalk.c +35 -20
  246. data/vendor/libgit2/src/runtime.c +162 -0
  247. data/vendor/libgit2/src/runtime.h +62 -0
  248. data/vendor/libgit2/src/{refdb_fs.h → settings.h} +3 -11
  249. data/vendor/libgit2/src/signature.c +6 -5
  250. data/vendor/libgit2/src/sortedcache.c +2 -3
  251. data/vendor/libgit2/src/sortedcache.h +10 -8
  252. data/vendor/libgit2/src/stash.c +7 -3
  253. data/vendor/libgit2/src/status.c +9 -4
  254. data/vendor/libgit2/src/strarray.c +64 -0
  255. data/vendor/libgit2/src/streams/mbedtls.c +14 -17
  256. data/vendor/libgit2/src/streams/mbedtls.h +1 -1
  257. data/vendor/libgit2/src/streams/openssl.c +113 -207
  258. data/vendor/libgit2/src/streams/openssl.h +9 -1
  259. data/vendor/libgit2/src/streams/openssl_dynamic.c +309 -0
  260. data/vendor/libgit2/src/streams/openssl_dynamic.h +348 -0
  261. data/vendor/libgit2/src/streams/openssl_legacy.c +203 -0
  262. data/vendor/libgit2/src/streams/openssl_legacy.h +63 -0
  263. data/vendor/libgit2/src/streams/registry.c +10 -9
  264. data/vendor/libgit2/src/streams/socket.c +6 -2
  265. data/vendor/libgit2/src/streams/stransport.c +6 -3
  266. data/vendor/libgit2/src/streams/tls.c +5 -3
  267. data/vendor/libgit2/src/submodule.c +134 -66
  268. data/vendor/libgit2/src/submodule.h +9 -9
  269. data/vendor/libgit2/src/sysdir.c +8 -26
  270. data/vendor/libgit2/src/sysdir.h +0 -11
  271. data/vendor/libgit2/src/tag.c +49 -11
  272. data/vendor/libgit2/src/thread.c +140 -0
  273. data/vendor/libgit2/src/thread.h +479 -0
  274. data/vendor/libgit2/src/threadstate.c +83 -0
  275. data/vendor/libgit2/src/threadstate.h +24 -0
  276. data/vendor/libgit2/src/trace.c +2 -2
  277. data/vendor/libgit2/src/trace.h +17 -13
  278. data/vendor/libgit2/src/transaction.c +21 -9
  279. data/vendor/libgit2/src/transport.c +3 -3
  280. data/vendor/libgit2/src/transports/auth.c +1 -1
  281. data/vendor/libgit2/src/transports/auth_negotiate.c +11 -4
  282. data/vendor/libgit2/src/transports/auth_ntlm.c +10 -6
  283. data/vendor/libgit2/src/transports/credential.c +17 -7
  284. data/vendor/libgit2/src/transports/credential_helpers.c +2 -0
  285. data/vendor/libgit2/src/transports/git.c +1 -3
  286. data/vendor/libgit2/src/transports/http.c +19 -17
  287. data/vendor/libgit2/src/transports/http.h +1 -0
  288. data/vendor/libgit2/src/transports/httpclient.c +84 -42
  289. data/vendor/libgit2/src/transports/httpclient.h +1 -1
  290. data/vendor/libgit2/src/transports/local.c +5 -5
  291. data/vendor/libgit2/src/transports/smart.c +14 -9
  292. data/vendor/libgit2/src/transports/smart.h +1 -1
  293. data/vendor/libgit2/src/transports/smart_protocol.c +11 -5
  294. data/vendor/libgit2/src/transports/ssh.c +51 -17
  295. data/vendor/libgit2/src/transports/winhttp.c +156 -88
  296. data/vendor/libgit2/src/tree.c +100 -77
  297. data/vendor/libgit2/src/tree.h +1 -0
  298. data/vendor/libgit2/src/tsort.c +0 -2
  299. data/vendor/libgit2/src/unix/map.c +3 -1
  300. data/vendor/libgit2/src/unix/posix.h +16 -1
  301. data/vendor/libgit2/src/unix/pthread.h +2 -1
  302. data/vendor/libgit2/src/utf8.c +150 -0
  303. data/vendor/libgit2/src/utf8.h +52 -0
  304. data/vendor/libgit2/src/util.c +74 -183
  305. data/vendor/libgit2/src/util.h +33 -39
  306. data/vendor/libgit2/src/vector.c +23 -19
  307. data/vendor/libgit2/src/vector.h +4 -2
  308. data/vendor/libgit2/src/win32/findfile.c +4 -2
  309. data/vendor/libgit2/src/win32/git2.rc +18 -3
  310. data/vendor/libgit2/src/win32/map.c +1 -1
  311. data/vendor/libgit2/src/win32/msvc-compat.h +9 -1
  312. data/vendor/libgit2/src/win32/path_w32.c +23 -25
  313. data/vendor/libgit2/src/win32/path_w32.h +0 -1
  314. data/vendor/libgit2/src/win32/posix_w32.c +77 -1
  315. data/vendor/libgit2/src/win32/precompiled.h +0 -1
  316. data/vendor/libgit2/src/win32/reparse.h +4 -4
  317. data/vendor/libgit2/src/win32/thread.c +24 -15
  318. data/vendor/libgit2/src/win32/thread.h +1 -1
  319. data/vendor/libgit2/src/win32/w32_buffer.c +3 -3
  320. data/vendor/libgit2/src/win32/w32_common.h +18 -9
  321. data/vendor/libgit2/src/win32/{w32_crtdbg_stacktrace.c → w32_leakcheck.c} +269 -33
  322. data/vendor/libgit2/src/win32/w32_leakcheck.h +222 -0
  323. data/vendor/libgit2/src/win32/w32_util.h +6 -6
  324. data/vendor/libgit2/src/worktree.c +37 -15
  325. data/vendor/libgit2/src/zstream.c +1 -1
  326. metadata +56 -38
  327. data/vendor/libgit2/cmake/Modules/CheckPrototypeDefinition.c.in +0 -29
  328. data/vendor/libgit2/cmake/Modules/CheckPrototypeDefinition.cmake +0 -96
  329. data/vendor/libgit2/src/allocators/win32_crtdbg.c +0 -118
  330. data/vendor/libgit2/src/buf_text.c +0 -316
  331. data/vendor/libgit2/src/buf_text.h +0 -122
  332. data/vendor/libgit2/src/global.c +0 -361
  333. data/vendor/libgit2/src/global.h +0 -41
  334. data/vendor/libgit2/src/thread-utils.c +0 -58
  335. data/vendor/libgit2/src/thread-utils.h +0 -246
  336. data/vendor/libgit2/src/win32/w32_crtdbg_stacktrace.h +0 -127
  337. data/vendor/libgit2/src/win32/w32_stack.c +0 -188
  338. data/vendor/libgit2/src/win32/w32_stack.h +0 -140
@@ -263,7 +263,7 @@ GIT_INLINE(bool) git_iterator_ignore_case(git_iterator *iter)
263
263
  return ((iter->flags & GIT_ITERATOR_IGNORE_CASE) != 0);
264
264
  }
265
265
 
266
- extern void git_iterator_set_ignore_case(
266
+ extern int git_iterator_set_ignore_case(
267
267
  git_iterator *iter, bool ignore_case);
268
268
 
269
269
  extern int git_iterator_current_tree_entry(
@@ -131,17 +131,8 @@ int main() {
131
131
 
132
132
  /* compiler specific configuration */
133
133
 
134
- #if UINT_MAX == 0xffffffffu
135
- typedef unsigned int khint32_t;
136
- #elif ULONG_MAX == 0xffffffffu
137
- typedef unsigned long khint32_t;
138
- #endif
139
-
140
- #if ULONG_MAX == ULLONG_MAX
141
- typedef unsigned long khint64_t;
142
- #else
143
- typedef unsigned long long khint64_t;
144
- #endif
134
+ typedef uint32_t khint32_t;
135
+ typedef uint64_t khint64_t;
145
136
 
146
137
  #ifndef kh_inline
147
138
  #ifdef _MSC_VER
@@ -5,29 +5,94 @@
5
5
  * a Linking Exception. For full terms see the included COPYING file.
6
6
  */
7
7
 
8
- #include "common.h"
9
-
10
- #ifdef GIT_OPENSSL
11
- # include <openssl/err.h>
12
- #endif
13
-
14
- #ifdef GIT_MBEDTLS
15
- # include <mbedtls/error.h>
16
- #endif
8
+ #include "libgit2.h"
17
9
 
18
10
  #include <git2.h>
19
11
  #include "alloc.h"
20
- #include "sysdir.h"
21
12
  #include "cache.h"
22
- #include "global.h"
13
+ #include "common.h"
14
+ #include "filter.h"
15
+ #include "hash.h"
16
+ #include "index.h"
17
+ #include "merge_driver.h"
18
+ #include "pool.h"
19
+ #include "mwindow.h"
23
20
  #include "object.h"
24
21
  #include "odb.h"
25
22
  #include "refs.h"
26
- #include "index.h"
23
+ #include "runtime.h"
24
+ #include "sysdir.h"
25
+ #include "thread.h"
26
+ #include "threadstate.h"
27
+ #include "git2/global.h"
28
+ #include "streams/registry.h"
29
+ #include "streams/mbedtls.h"
30
+ #include "streams/openssl.h"
27
31
  #include "transports/smart.h"
28
32
  #include "transports/http.h"
29
- #include "streams/openssl.h"
30
- #include "streams/mbedtls.h"
33
+ #include "transports/ssh.h"
34
+
35
+ #ifdef GIT_WIN32
36
+ # include "win32/w32_leakcheck.h"
37
+ #endif
38
+
39
+ /* Declarations for tuneable settings */
40
+ extern size_t git_mwindow__window_size;
41
+ extern size_t git_mwindow__mapped_limit;
42
+ extern size_t git_mwindow__file_limit;
43
+ extern size_t git_indexer__max_objects;
44
+ extern bool git_disable_pack_keep_file_checks;
45
+ extern int git_odb__packed_priority;
46
+ extern int git_odb__loose_priority;
47
+
48
+ char *git__user_agent;
49
+ char *git__ssl_ciphers;
50
+
51
+ static void libgit2_settings_global_shutdown(void)
52
+ {
53
+ git__free(git__user_agent);
54
+ git__free(git__ssl_ciphers);
55
+ }
56
+
57
+ static int git_libgit2_settings_global_init(void)
58
+ {
59
+ return git_runtime_shutdown_register(libgit2_settings_global_shutdown);
60
+ }
61
+
62
+ int git_libgit2_init(void)
63
+ {
64
+ static git_runtime_init_fn init_fns[] = {
65
+ #ifdef GIT_WIN32
66
+ git_win32_leakcheck_global_init,
67
+ #endif
68
+ git_allocator_global_init,
69
+ git_threadstate_global_init,
70
+ git_threads_global_init,
71
+ git_hash_global_init,
72
+ git_sysdir_global_init,
73
+ git_filter_global_init,
74
+ git_merge_driver_global_init,
75
+ git_transport_ssh_global_init,
76
+ git_stream_registry_global_init,
77
+ git_openssl_stream_global_init,
78
+ git_mbedtls_stream_global_init,
79
+ git_mwindow_global_init,
80
+ git_pool_global_init,
81
+ git_libgit2_settings_global_init
82
+ };
83
+
84
+ return git_runtime_init(init_fns, ARRAY_SIZE(init_fns));
85
+ }
86
+
87
+ int git_libgit2_init_count(void)
88
+ {
89
+ return git_runtime_init_count();
90
+ }
91
+
92
+ int git_libgit2_shutdown(void)
93
+ {
94
+ return git_runtime_shutdown();
95
+ }
31
96
 
32
97
  int git_libgit2_version(int *major, int *minor, int *rev)
33
98
  {
@@ -56,40 +121,30 @@ int git_libgit2_features(void)
56
121
  ;
57
122
  }
58
123
 
59
- /* Declarations for tuneable settings */
60
- extern size_t git_mwindow__window_size;
61
- extern size_t git_mwindow__mapped_limit;
62
- extern size_t git_indexer__max_objects;
63
- extern bool git_disable_pack_keep_file_checks;
64
-
65
- static int config_level_to_sysdir(int config_level)
124
+ static int config_level_to_sysdir(int *out, int config_level)
66
125
  {
67
- int val = -1;
68
-
69
126
  switch (config_level) {
70
127
  case GIT_CONFIG_LEVEL_SYSTEM:
71
- val = GIT_SYSDIR_SYSTEM;
72
- break;
128
+ *out = GIT_SYSDIR_SYSTEM;
129
+ return 0;
73
130
  case GIT_CONFIG_LEVEL_XDG:
74
- val = GIT_SYSDIR_XDG;
75
- break;
131
+ *out = GIT_SYSDIR_XDG;
132
+ return 0;
76
133
  case GIT_CONFIG_LEVEL_GLOBAL:
77
- val = GIT_SYSDIR_GLOBAL;
78
- break;
134
+ *out = GIT_SYSDIR_GLOBAL;
135
+ return 0;
79
136
  case GIT_CONFIG_LEVEL_PROGRAMDATA:
80
- val = GIT_SYSDIR_PROGRAMDATA;
81
- break;
137
+ *out = GIT_SYSDIR_PROGRAMDATA;
138
+ return 0;
82
139
  default:
83
- git_error_set(
84
- GIT_ERROR_INVALID, "invalid config path selector %d", config_level);
140
+ break;
85
141
  }
86
142
 
87
- return val;
143
+ git_error_set(
144
+ GIT_ERROR_INVALID, "invalid config path selector %d", config_level);
145
+ return -1;
88
146
  }
89
147
 
90
- extern char *git__user_agent;
91
- extern char *git__ssl_ciphers;
92
-
93
148
  const char *git_libgit2__user_agent(void)
94
149
  {
95
150
  return git__user_agent;
@@ -124,13 +179,24 @@ int git_libgit2_opts(int key, ...)
124
179
  *(va_arg(ap, size_t *)) = git_mwindow__mapped_limit;
125
180
  break;
126
181
 
182
+ case GIT_OPT_SET_MWINDOW_FILE_LIMIT:
183
+ git_mwindow__file_limit = va_arg(ap, size_t);
184
+ break;
185
+
186
+ case GIT_OPT_GET_MWINDOW_FILE_LIMIT:
187
+ *(va_arg(ap, size_t *)) = git_mwindow__file_limit;
188
+ break;
189
+
127
190
  case GIT_OPT_GET_SEARCH_PATH:
128
- if ((error = config_level_to_sysdir(va_arg(ap, int))) >= 0) {
191
+ {
192
+ int sysdir = va_arg(ap, int);
129
193
  git_buf *out = va_arg(ap, git_buf *);
130
194
  const git_buf *tmp;
195
+ int level;
131
196
 
132
- git_buf_sanitize(out);
133
- if ((error = git_sysdir_get(&tmp, error)) < 0)
197
+ if ((error = config_level_to_sysdir(&level, sysdir)) < 0 ||
198
+ (error = git_buf_sanitize(out)) < 0 ||
199
+ (error = git_sysdir_get(&tmp, level)) < 0)
134
200
  break;
135
201
 
136
202
  error = git_buf_sets(out, tmp->ptr);
@@ -138,8 +204,12 @@ int git_libgit2_opts(int key, ...)
138
204
  break;
139
205
 
140
206
  case GIT_OPT_SET_SEARCH_PATH:
141
- if ((error = config_level_to_sysdir(va_arg(ap, int))) >= 0)
142
- error = git_sysdir_set(error, va_arg(ap, const char *));
207
+ {
208
+ int level;
209
+
210
+ if ((error = config_level_to_sysdir(&level, va_arg(ap, int))) >= 0)
211
+ error = git_sysdir_set(level, va_arg(ap, const char *));
212
+ }
143
213
  break;
144
214
 
145
215
  case GIT_OPT_SET_CACHE_OBJECT_LIMIT:
@@ -168,8 +238,8 @@ int git_libgit2_opts(int key, ...)
168
238
  git_buf *out = va_arg(ap, git_buf *);
169
239
  const git_buf *tmp;
170
240
 
171
- git_buf_sanitize(out);
172
- if ((error = git_sysdir_get(&tmp, GIT_SYSDIR_TEMPLATE)) < 0)
241
+ if ((error = git_buf_sanitize(out)) < 0 ||
242
+ (error = git_sysdir_get(&tmp, GIT_SYSDIR_TEMPLATE)) < 0)
173
243
  break;
174
244
 
175
245
  error = git_buf_sets(out, tmp->ptr);
@@ -191,10 +261,7 @@ int git_libgit2_opts(int key, ...)
191
261
  {
192
262
  const char *file = va_arg(ap, const char *);
193
263
  const char *path = va_arg(ap, const char *);
194
- if (file)
195
- error = git_mbedtls__set_cert_location(file, 0);
196
- if (error && path)
197
- error = git_mbedtls__set_cert_location(path, 1);
264
+ error = git_mbedtls__set_cert_location(file, path);
198
265
  }
199
266
  #else
200
267
  git_error_set(GIT_ERROR_SSL, "TLS backend doesn't support certificate locations");
@@ -238,7 +305,8 @@ int git_libgit2_opts(int key, ...)
238
305
  case GIT_OPT_GET_USER_AGENT:
239
306
  {
240
307
  git_buf *out = va_arg(ap, git_buf *);
241
- git_buf_sanitize(out);
308
+ if ((error = git_buf_sanitize(out)) < 0)
309
+ break;
242
310
  error = git_buf_sets(out, git__user_agent);
243
311
  }
244
312
  break;
@@ -291,6 +359,14 @@ int git_libgit2_opts(int key, ...)
291
359
  git_http__expect_continue = (va_arg(ap, int) != 0);
292
360
  break;
293
361
 
362
+ case GIT_OPT_SET_ODB_PACKED_PRIORITY:
363
+ git_odb__packed_priority = va_arg(ap, int);
364
+ break;
365
+
366
+ case GIT_OPT_SET_ODB_LOOSE_PRIORITY:
367
+ git_odb__loose_priority = va_arg(ap, int);
368
+ break;
369
+
294
370
  default:
295
371
  git_error_set(GIT_ERROR_INVALID, "invalid option key");
296
372
  error = -1;
@@ -0,0 +1,15 @@
1
+ /*
2
+ * Copyright (C) the libgit2 contributors. All rights reserved.
3
+ *
4
+ * This file is part of libgit2, distributed under the GNU GPL v2 with
5
+ * a Linking Exception. For full terms see the included COPYING file.
6
+ */
7
+ #ifndef INCLUDE_libgit2_h__
8
+ #define INCLUDE_libgit2_h__
9
+
10
+ extern int git_libgit2_init_count(void);
11
+
12
+ extern const char *git_libgit2__user_agent(void);
13
+ extern const char *git_libgit2__ssl_ciphers(void);
14
+
15
+ #endif
@@ -43,7 +43,8 @@ static int mailmap_entry_cmp(const void *a_raw, const void *b_raw)
43
43
  const git_mailmap_entry *b = (const git_mailmap_entry *)b_raw;
44
44
  int cmp;
45
45
 
46
- assert(a && b && a->replace_email && b->replace_email);
46
+ GIT_ASSERT_ARG(a && a->replace_email);
47
+ GIT_ASSERT_ARG(b && b->replace_email);
47
48
 
48
49
  cmp = git__strcmp(a->replace_email, b->replace_email);
49
50
  if (cmp)
@@ -185,7 +186,8 @@ static int mailmap_add_entry_unterminated(
185
186
  git_mailmap_entry *entry = git__calloc(1, sizeof(git_mailmap_entry));
186
187
  GIT_ERROR_CHECK_ALLOC(entry);
187
188
 
188
- assert(mm && replace_email && *replace_email);
189
+ GIT_ASSERT_ARG(mm);
190
+ GIT_ASSERT_ARG(replace_email && *replace_email);
189
191
 
190
192
  if (real_name_size > 0) {
191
193
  entry->real_name = git__substrdup(real_name, real_name_size);
@@ -290,7 +292,8 @@ static int mailmap_add_blob(
290
292
  git_buf content = GIT_BUF_INIT;
291
293
  int error;
292
294
 
293
- assert(mm && repo);
295
+ GIT_ASSERT_ARG(mm);
296
+ GIT_ASSERT_ARG(repo);
294
297
 
295
298
  error = git_revparse_single(&object, repo, rev);
296
299
  if (error < 0)
@@ -327,6 +330,10 @@ static int mailmap_add_file_ondisk(
327
330
  if (error < 0)
328
331
  goto cleanup;
329
332
 
333
+ error = git_path_validate_workdir_buf(repo, &fullpath);
334
+ if (error < 0)
335
+ goto cleanup;
336
+
330
337
  error = git_futils_readbuffer(&content, fullpath.ptr);
331
338
  if (error < 0)
332
339
  goto cleanup;
@@ -350,8 +357,6 @@ static void mailmap_add_from_repository(git_mailmap *mm, git_repository *repo)
350
357
  const char *rev = NULL;
351
358
  const char *path = NULL;
352
359
 
353
- assert(mm && repo);
354
-
355
360
  /* If we're in a bare repo, default blob to 'HEAD:.mailmap' */
356
361
  if (repo->is_bare)
357
362
  rev = MM_BLOB_DEFAULT;
@@ -389,9 +394,14 @@ static void mailmap_add_from_repository(git_mailmap *mm, git_repository *repo)
389
394
 
390
395
  int git_mailmap_from_repository(git_mailmap **out, git_repository *repo)
391
396
  {
392
- int error = git_mailmap_new(out);
393
- if (error < 0)
397
+ int error;
398
+
399
+ GIT_ASSERT_ARG(out);
400
+ GIT_ASSERT_ARG(repo);
401
+
402
+ if ((error = git_mailmap_new(out)) < 0)
394
403
  return error;
404
+
395
405
  mailmap_add_from_repository(*out, repo);
396
406
  return 0;
397
407
  }
@@ -408,7 +418,7 @@ const git_mailmap_entry *git_mailmap_entry_lookup(
408
418
  git_mailmap_entry needle = { NULL };
409
419
  needle.replace_email = (char *)email;
410
420
 
411
- assert(email);
421
+ GIT_ASSERT_ARG_WITH_RETVAL(email, NULL);
412
422
 
413
423
  if (!mm)
414
424
  return NULL;
@@ -431,7 +441,8 @@ const git_mailmap_entry *git_mailmap_entry_lookup(
431
441
  if (git__strcmp(entry->replace_email, email))
432
442
  break; /* it's a different email, so we're done looking */
433
443
 
434
- assert(entry->replace_name); /* should be specific */
444
+ /* should be specific */
445
+ GIT_ASSERT_WITH_RETVAL(entry->replace_name, NULL);
435
446
  if (!name || !git__strcmp(entry->replace_name, name))
436
447
  return entry;
437
448
  }
@@ -447,7 +458,9 @@ int git_mailmap_resolve(
447
458
  const char *name, const char *email)
448
459
  {
449
460
  const git_mailmap_entry *entry = NULL;
450
- assert(name && email);
461
+
462
+ GIT_ASSERT(name);
463
+ GIT_ASSERT(email);
451
464
 
452
465
  *real_name = name;
453
466
  *real_email = email;
@@ -36,9 +36,9 @@ typedef struct { /* memory mapped buffer */
36
36
  } git_map;
37
37
 
38
38
  #define GIT_MMAP_VALIDATE(out, len, prot, flags) do { \
39
- assert(out != NULL && len > 0); \
40
- assert((prot & GIT_PROT_WRITE) || (prot & GIT_PROT_READ)); \
41
- assert((flags & GIT_MAP_FIXED) == 0); } while (0)
39
+ GIT_ASSERT(out != NULL && len > 0); \
40
+ GIT_ASSERT((prot & GIT_PROT_WRITE) || (prot & GIT_PROT_READ)); \
41
+ GIT_ASSERT((flags & GIT_MAP_FIXED) == 0); } while (0)
42
42
 
43
43
  extern int p_mmap(git_map *out, size_t len, int prot, int flags, int fd, off64_t offset);
44
44
  extern int p_munmap(git_map *map);
@@ -68,9 +68,19 @@ struct merge_diff_df_data {
68
68
  git_merge_diff *prev_conflict;
69
69
  };
70
70
 
71
+ /*
72
+ * This acts as a negative cache entry marker. In case we've tried to calculate
73
+ * similarity metrics for a given blob already but `git_hashsig` determined
74
+ * that it's too small in order to have a meaningful hash signature, we will
75
+ * insert the address of this marker instead of `NULL`. Like this, we can
76
+ * easily check whether we have checked a gien entry already and skip doing the
77
+ * calculation again and again.
78
+ */
79
+ static int cache_invalid_marker;
80
+
71
81
  /* Merge base computation */
72
82
 
73
- int merge_bases_many(git_commit_list **out, git_revwalk **walk_out, git_repository *repo, size_t length, const git_oid input_array[])
83
+ static int merge_bases_many(git_commit_list **out, git_revwalk **walk_out, git_repository *repo, size_t length, const git_oid input_array[])
74
84
  {
75
85
  git_revwalk *walk = NULL;
76
86
  git_vector list;
@@ -102,7 +112,7 @@ int merge_bases_many(git_commit_list **out, git_revwalk **walk_out, git_reposito
102
112
  if (commit == NULL)
103
113
  goto on_error;
104
114
 
105
- if (git_merge__bases_many(&result, walk, commit, &list) < 0)
115
+ if (git_merge__bases_many(&result, walk, commit, &list, 0) < 0)
106
116
  goto on_error;
107
117
 
108
118
  if (!result) {
@@ -129,7 +139,9 @@ int git_merge_base_many(git_oid *out, git_repository *repo, size_t length, const
129
139
  git_commit_list *result = NULL;
130
140
  int error = 0;
131
141
 
132
- assert(out && repo && input_array);
142
+ GIT_ASSERT_ARG(out);
143
+ GIT_ASSERT_ARG(repo);
144
+ GIT_ASSERT_ARG(input_array);
133
145
 
134
146
  if ((error = merge_bases_many(&result, &walk, repo, length, input_array)) < 0)
135
147
  return error;
@@ -149,7 +161,9 @@ int git_merge_bases_many(git_oidarray *out, git_repository *repo, size_t length,
149
161
  int error = 0;
150
162
  git_array_oid_t array;
151
163
 
152
- assert(out && repo && input_array);
164
+ GIT_ASSERT_ARG(out);
165
+ GIT_ASSERT_ARG(repo);
166
+ GIT_ASSERT_ARG(input_array);
153
167
 
154
168
  if ((error = merge_bases_many(&result, &walk, repo, length, input_array)) < 0)
155
169
  return error;
@@ -183,7 +197,9 @@ int git_merge_base_octopus(git_oid *out, git_repository *repo, size_t length, co
183
197
  unsigned int i;
184
198
  int error = -1;
185
199
 
186
- assert(out && repo && input_array);
200
+ GIT_ASSERT_ARG(out);
201
+ GIT_ASSERT_ARG(repo);
202
+ GIT_ASSERT_ARG(input_array);
187
203
 
188
204
  if (length < 2) {
189
205
  git_error_set(GIT_ERROR_INVALID, "at least two commits are required to find an ancestor");
@@ -227,7 +243,7 @@ static int merge_bases(git_commit_list **out, git_revwalk **walk_out, git_reposi
227
243
  if (commit == NULL)
228
244
  goto on_error;
229
245
 
230
- if (git_merge__bases_many(&result, walk, commit, &list) < 0)
246
+ if (git_merge__bases_many(&result, walk, commit, &list, 0) < 0)
231
247
  goto on_error;
232
248
 
233
249
  if (!result) {
@@ -362,7 +378,11 @@ static int clear_commit_marks(git_commit_list_node *commit, unsigned int mark)
362
378
  }
363
379
 
364
380
  static int paint_down_to_common(
365
- git_commit_list **out, git_revwalk *walk, git_commit_list_node *one, git_vector *twos)
381
+ git_commit_list **out,
382
+ git_revwalk *walk,
383
+ git_commit_list_node *one,
384
+ git_vector *twos,
385
+ uint32_t minimum_generation)
366
386
  {
367
387
  git_pqueue list;
368
388
  git_commit_list *result = NULL;
@@ -371,7 +391,7 @@ static int paint_down_to_common(
371
391
  int error;
372
392
  unsigned int i;
373
393
 
374
- if (git_pqueue_init(&list, 0, twos->length * 2, git_commit_list_time_cmp) < 0)
394
+ if (git_pqueue_init(&list, 0, twos->length * 2, git_commit_list_generation_cmp) < 0)
375
395
  return -1;
376
396
 
377
397
  one->flags |= PARENT1;
@@ -383,7 +403,6 @@ static int paint_down_to_common(
383
403
  return -1;
384
404
 
385
405
  two->flags |= PARENT2;
386
-
387
406
  if (git_pqueue_insert(&list, two) < 0)
388
407
  return -1;
389
408
  }
@@ -411,6 +430,8 @@ static int paint_down_to_common(
411
430
  git_commit_list_node *p = commit->parents[i];
412
431
  if ((p->flags & flags) == flags)
413
432
  continue;
433
+ if (p->generation < minimum_generation)
434
+ continue;
414
435
 
415
436
  if ((error = git_commit_list_parse(walk, p)) < 0)
416
437
  return error;
@@ -426,7 +447,7 @@ static int paint_down_to_common(
426
447
  return 0;
427
448
  }
428
449
 
429
- static int remove_redundant(git_revwalk *walk, git_vector *commits)
450
+ static int remove_redundant(git_revwalk *walk, git_vector *commits, uint32_t minimum_generation)
430
451
  {
431
452
  git_vector work = GIT_VECTOR_INIT;
432
453
  unsigned char *redundant;
@@ -462,7 +483,7 @@ static int remove_redundant(git_revwalk *walk, git_vector *commits)
462
483
  goto done;
463
484
  }
464
485
 
465
- error = paint_down_to_common(&common, walk, commit, &work);
486
+ error = paint_down_to_common(&common, walk, commit, &work, minimum_generation);
466
487
  if (error < 0)
467
488
  goto done;
468
489
 
@@ -494,7 +515,12 @@ done:
494
515
  return error;
495
516
  }
496
517
 
497
- int git_merge__bases_many(git_commit_list **out, git_revwalk *walk, git_commit_list_node *one, git_vector *twos)
518
+ int git_merge__bases_many(
519
+ git_commit_list **out,
520
+ git_revwalk *walk,
521
+ git_commit_list_node *one,
522
+ git_vector *twos,
523
+ uint32_t minimum_generation)
498
524
  {
499
525
  int error;
500
526
  unsigned int i;
@@ -516,7 +542,7 @@ int git_merge__bases_many(git_commit_list **out, git_revwalk *walk, git_commit_l
516
542
  if (git_commit_list_parse(walk, one) < 0)
517
543
  return -1;
518
544
 
519
- error = paint_down_to_common(&result, walk, one, twos);
545
+ error = paint_down_to_common(&result, walk, one, twos, minimum_generation);
520
546
  if (error < 0)
521
547
  return error;
522
548
 
@@ -543,7 +569,7 @@ int git_merge__bases_many(git_commit_list **out, git_revwalk *walk, git_commit_l
543
569
 
544
570
  if ((error = clear_commit_marks(one, ALL_FLAGS)) < 0 ||
545
571
  (error = clear_commit_marks_many(twos, ALL_FLAGS)) < 0 ||
546
- (error = remove_redundant(walk, &redundant)) < 0) {
572
+ (error = remove_redundant(walk, &redundant, minimum_generation)) < 0) {
547
573
  git_vector_free(&redundant);
548
574
  return error;
549
575
  }
@@ -571,7 +597,8 @@ int git_repository_mergehead_foreach(
571
597
  git_oid oid;
572
598
  int error = 0;
573
599
 
574
- assert(repo && cb);
600
+ GIT_ASSERT_ARG(repo);
601
+ GIT_ASSERT_ARG(cb);
575
602
 
576
603
  if ((error = git_buf_joinpath(&merge_head_path, repo->gitdir,
577
604
  GIT_MERGE_HEAD_FILE)) < 0)
@@ -640,7 +667,9 @@ static int merge_conflict_resolve_trivial(
640
667
  git_index_entry const *result = NULL;
641
668
  int error = 0;
642
669
 
643
- assert(resolved && diff_list && conflict);
670
+ GIT_ASSERT_ARG(resolved);
671
+ GIT_ASSERT_ARG(diff_list);
672
+ GIT_ASSERT_ARG(conflict);
644
673
 
645
674
  *resolved = 0;
646
675
 
@@ -723,7 +752,9 @@ static int merge_conflict_resolve_one_removed(
723
752
  int ours_changed, theirs_changed;
724
753
  int error = 0;
725
754
 
726
- assert(resolved && diff_list && conflict);
755
+ GIT_ASSERT_ARG(resolved);
756
+ GIT_ASSERT_ARG(diff_list);
757
+ GIT_ASSERT_ARG(conflict);
727
758
 
728
759
  *resolved = 0;
729
760
 
@@ -763,7 +794,9 @@ static int merge_conflict_resolve_one_renamed(
763
794
  git_index_entry *merged;
764
795
  int error = 0;
765
796
 
766
- assert(resolved && diff_list && conflict);
797
+ GIT_ASSERT_ARG(resolved);
798
+ GIT_ASSERT_ARG(diff_list);
799
+ GIT_ASSERT_ARG(conflict);
767
800
 
768
801
  *resolved = 0;
769
802
 
@@ -907,7 +940,9 @@ static int merge_conflict_resolve_contents(
907
940
  bool fallback = false;
908
941
  int error;
909
942
 
910
- assert(resolved && diff_list && conflict);
943
+ GIT_ASSERT_ARG(resolved);
944
+ GIT_ASSERT_ARG(diff_list);
945
+ GIT_ASSERT_ARG(conflict);
911
946
 
912
947
  *resolved = 0;
913
948
 
@@ -1027,6 +1062,9 @@ static int index_entry_similarity_calc(
1027
1062
  git_object_size_t blobsize;
1028
1063
  int error;
1029
1064
 
1065
+ if (*out || *out == &cache_invalid_marker)
1066
+ return 0;
1067
+
1030
1068
  *out = NULL;
1031
1069
 
1032
1070
  if ((error = git_blob_lookup(&blob, repo, &entry->id)) < 0)
@@ -1047,6 +1085,8 @@ static int index_entry_similarity_calc(
1047
1085
  error = opts->metric->buffer_signature(out, &diff_file,
1048
1086
  git_blob_rawcontent(blob), (size_t)blobsize,
1049
1087
  opts->metric->payload);
1088
+ if (error == GIT_EBUFS)
1089
+ *out = &cache_invalid_marker;
1050
1090
 
1051
1091
  git_blob_free(blob);
1052
1092
 
@@ -1069,18 +1109,16 @@ static int index_entry_similarity_inexact(
1069
1109
  return 0;
1070
1110
 
1071
1111
  /* update signature cache if needed */
1072
- if (!cache[a_idx] && (error = index_entry_similarity_calc(&cache[a_idx], repo, a, opts)) < 0)
1073
- return error;
1074
- if (!cache[b_idx] && (error = index_entry_similarity_calc(&cache[b_idx], repo, b, opts)) < 0)
1112
+ if ((error = index_entry_similarity_calc(&cache[a_idx], repo, a, opts)) < 0 ||
1113
+ (error = index_entry_similarity_calc(&cache[b_idx], repo, b, opts)) < 0)
1075
1114
  return error;
1076
1115
 
1077
1116
  /* some metrics may not wish to process this file (too big / too small) */
1078
- if (!cache[a_idx] || !cache[b_idx])
1117
+ if (cache[a_idx] == &cache_invalid_marker || cache[b_idx] == &cache_invalid_marker)
1079
1118
  return 0;
1080
1119
 
1081
1120
  /* compare signatures */
1082
- if (opts->metric->similarity(
1083
- &score, cache[a_idx], cache[b_idx], opts->metric->payload) < 0)
1121
+ if (opts->metric->similarity(&score, cache[a_idx], cache[b_idx], opts->metric->payload) < 0)
1084
1122
  return -1;
1085
1123
 
1086
1124
  /* clip score */
@@ -1504,9 +1542,11 @@ int git_merge_diff_list__find_renames(
1504
1542
  size_t src_count, tgt_count, i;
1505
1543
  int error = 0;
1506
1544
 
1507
- assert(diff_list && opts);
1545
+ GIT_ASSERT_ARG(diff_list);
1546
+ GIT_ASSERT_ARG(opts);
1508
1547
 
1509
- if ((opts->flags & GIT_MERGE_FIND_RENAMES) == 0)
1548
+ if ((opts->flags & GIT_MERGE_FIND_RENAMES) == 0 ||
1549
+ !diff_list->conflicts.length)
1510
1550
  return 0;
1511
1551
 
1512
1552
  similarity_ours = git__calloc(diff_list->conflicts.length,
@@ -1550,7 +1590,7 @@ int git_merge_diff_list__find_renames(
1550
1590
  done:
1551
1591
  if (cache != NULL) {
1552
1592
  for (i = 0; i < cache_size; ++i) {
1553
- if (cache[i] != NULL)
1593
+ if (cache[i] != NULL && cache[i] != &cache_invalid_marker)
1554
1594
  opts->metric->free_signature(cache[i], opts->metric->payload);
1555
1595
  }
1556
1596
 
@@ -1797,12 +1837,12 @@ git_merge_diff_list *git_merge_diff_list__alloc(git_repository *repo)
1797
1837
 
1798
1838
  diff_list->repo = repo;
1799
1839
 
1800
- git_pool_init(&diff_list->pool, 1);
1801
1840
 
1802
- if (git_vector_init(&diff_list->staged, 0, NULL) < 0 ||
1803
- git_vector_init(&diff_list->conflicts, 0, NULL) < 0 ||
1804
- git_vector_init(&diff_list->resolved, 0, NULL) < 0) {
1805
- git_merge_diff_list__free(diff_list);
1841
+ if (git_pool_init(&diff_list->pool, 1) < 0 ||
1842
+ git_vector_init(&diff_list->staged, 0, NULL) < 0 ||
1843
+ git_vector_init(&diff_list->conflicts, 0, NULL) < 0 ||
1844
+ git_vector_init(&diff_list->resolved, 0, NULL) < 0) {
1845
+ git_merge_diff_list__free(diff_list);
1806
1846
  return NULL;
1807
1847
  }
1808
1848
 
@@ -1830,7 +1870,8 @@ static int merge_normalize_opts(
1830
1870
  git_config_entry *entry = NULL;
1831
1871
  int error = 0;
1832
1872
 
1833
- assert(repo && opts);
1873
+ GIT_ASSERT_ARG(repo);
1874
+ GIT_ASSERT_ARG(opts);
1834
1875
 
1835
1876
  if ((error = git_repository_config__weakptr(&cfg, repo)) < 0)
1836
1877
  return error;
@@ -2057,7 +2098,8 @@ int git_merge__iterators(
2057
2098
  size_t i;
2058
2099
  int error = 0;
2059
2100
 
2060
- assert(out && repo);
2101
+ GIT_ASSERT_ARG(out);
2102
+ GIT_ASSERT_ARG(repo);
2061
2103
 
2062
2104
  *out = NULL;
2063
2105
 
@@ -2141,7 +2183,8 @@ int git_merge_trees(
2141
2183
  git_iterator_options iter_opts = GIT_ITERATOR_OPTIONS_INIT;
2142
2184
  int error;
2143
2185
 
2144
- assert(out && repo);
2186
+ GIT_ASSERT_ARG(out);
2187
+ GIT_ASSERT_ARG(repo);
2145
2188
 
2146
2189
  /* if one side is treesame to the ancestor, take the other side */
2147
2190
  if (ancestor_tree && merge_opts && (merge_opts->flags & GIT_MERGE_SKIP_REUC)) {
@@ -2245,8 +2288,11 @@ static int create_virtual_base(
2245
2288
  result->type = GIT_ANNOTATED_COMMIT_VIRTUAL;
2246
2289
  result->index = index;
2247
2290
 
2248
- insert_head_ids(&result->parents, one);
2249
- insert_head_ids(&result->parents, two);
2291
+ if (insert_head_ids(&result->parents, one) < 0 ||
2292
+ insert_head_ids(&result->parents, two) < 0) {
2293
+ git_annotated_commit_free(result);
2294
+ return -1;
2295
+ }
2250
2296
 
2251
2297
  *out = result;
2252
2298
  return 0;
@@ -2428,7 +2474,8 @@ static int write_merge_head(
2428
2474
  size_t i;
2429
2475
  int error = 0;
2430
2476
 
2431
- assert(repo && heads);
2477
+ GIT_ASSERT_ARG(repo);
2478
+ GIT_ASSERT_ARG(heads);
2432
2479
 
2433
2480
  if ((error = git_buf_joinpath(&file_path, repo->gitdir, GIT_MERGE_HEAD_FILE)) < 0 ||
2434
2481
  (error = git_filebuf_open(&file, file_path.ptr, GIT_FILEBUF_CREATE_LEADING_DIRS, GIT_MERGE_FILE_MODE)) < 0)
@@ -2456,7 +2503,7 @@ static int write_merge_mode(git_repository *repo)
2456
2503
  git_buf file_path = GIT_BUF_INIT;
2457
2504
  int error = 0;
2458
2505
 
2459
- assert(repo);
2506
+ GIT_ASSERT_ARG(repo);
2460
2507
 
2461
2508
  if ((error = git_buf_joinpath(&file_path, repo->gitdir, GIT_MERGE_MODE_FILE)) < 0 ||
2462
2509
  (error = git_filebuf_open(&file, file_path.ptr, GIT_FILEBUF_CREATE_LEADING_DIRS, GIT_MERGE_FILE_MODE)) < 0)
@@ -2676,7 +2723,8 @@ static int write_merge_msg(
2676
2723
  char sep = 0;
2677
2724
  int error = 0;
2678
2725
 
2679
- assert(repo && heads);
2726
+ GIT_ASSERT_ARG(repo);
2727
+ GIT_ASSERT_ARG(heads);
2680
2728
 
2681
2729
  entries = git__calloc(heads_len, sizeof(struct merge_msg_entry));
2682
2730
  GIT_ERROR_CHECK_ALLOC(entries);
@@ -2787,7 +2835,9 @@ int git_merge__setup(
2787
2835
  {
2788
2836
  int error = 0;
2789
2837
 
2790
- assert (repo && our_head && heads);
2838
+ GIT_ASSERT_ARG(repo);
2839
+ GIT_ASSERT_ARG(our_head);
2840
+ GIT_ASSERT_ARG(heads);
2791
2841
 
2792
2842
  if ((error = git_repository__set_orig_head(repo, git_annotated_commit_id(our_head))) == 0 &&
2793
2843
  (error = write_merge_head(repo, heads, heads_len)) == 0 &&
@@ -2811,7 +2861,9 @@ static int merge_ancestor_head(
2811
2861
  size_t i, alloc_len;
2812
2862
  int error = 0;
2813
2863
 
2814
- assert(repo && our_head && their_heads);
2864
+ GIT_ASSERT_ARG(repo);
2865
+ GIT_ASSERT_ARG(our_head);
2866
+ GIT_ASSERT_ARG(their_heads);
2815
2867
 
2816
2868
  GIT_ERROR_CHECK_ALLOC_ADD(&alloc_len, their_heads_len, 1);
2817
2869
  oids = git__calloc(alloc_len, sizeof(git_oid));
@@ -2832,7 +2884,7 @@ on_error:
2832
2884
  return error;
2833
2885
  }
2834
2886
 
2835
- const char *merge_their_label(const char *branchname)
2887
+ static const char *merge_their_label(const char *branchname)
2836
2888
  {
2837
2889
  const char *slash;
2838
2890
 
@@ -3189,7 +3241,10 @@ int git_merge_analysis_for_ref(
3189
3241
  int error = 0;
3190
3242
  bool unborn;
3191
3243
 
3192
- assert(analysis_out && preference_out && repo && their_heads && their_heads_len > 0);
3244
+ GIT_ASSERT_ARG(analysis_out);
3245
+ GIT_ASSERT_ARG(preference_out);
3246
+ GIT_ASSERT_ARG(repo);
3247
+ GIT_ASSERT_ARG(their_heads && their_heads_len > 0);
3193
3248
 
3194
3249
  if (their_heads_len != 1) {
3195
3250
  git_error_set(GIT_ERROR_MERGE, "can only merge a single branch");
@@ -3271,7 +3326,8 @@ int git_merge(
3271
3326
  unsigned int checkout_strategy;
3272
3327
  int error = 0;
3273
3328
 
3274
- assert(repo && their_heads && their_heads_len > 0);
3329
+ GIT_ASSERT_ARG(repo);
3330
+ GIT_ASSERT_ARG(their_heads && their_heads_len > 0);
3275
3331
 
3276
3332
  if (their_heads_len != 1) {
3277
3333
  git_error_set(GIT_ERROR_MERGE, "can only merge a single branch");
@@ -3338,10 +3394,12 @@ int git_merge_options_init(git_merge_options *opts, unsigned int version)
3338
3394
  return 0;
3339
3395
  }
3340
3396
 
3397
+ #ifndef GIT_DEPRECATE_HARD
3341
3398
  int git_merge_init_options(git_merge_options *opts, unsigned int version)
3342
3399
  {
3343
3400
  return git_merge_options_init(opts, version);
3344
3401
  }
3402
+ #endif
3345
3403
 
3346
3404
  int git_merge_file_input_init(git_merge_file_input *input, unsigned int version)
3347
3405
  {
@@ -3350,10 +3408,12 @@ int git_merge_file_input_init(git_merge_file_input *input, unsigned int version)
3350
3408
  return 0;
3351
3409
  }
3352
3410
 
3411
+ #ifndef GIT_DEPRECATE_HARD
3353
3412
  int git_merge_file_init_input(git_merge_file_input *input, unsigned int version)
3354
3413
  {
3355
3414
  return git_merge_file_input_init(input, version);
3356
3415
  }
3416
+ #endif
3357
3417
 
3358
3418
  int git_merge_file_options_init(
3359
3419
  git_merge_file_options *opts, unsigned int version)
@@ -3363,8 +3423,10 @@ int git_merge_file_options_init(
3363
3423
  return 0;
3364
3424
  }
3365
3425
 
3426
+ #ifndef GIT_DEPRECATE_HARD
3366
3427
  int git_merge_file_init_options(
3367
3428
  git_merge_file_options *opts, unsigned int version)
3368
3429
  {
3369
3430
  return git_merge_file_options_init(opts, version);
3370
3431
  }
3432
+ #endif