rugged 1.0.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
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
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3da2dd9613a57a897d79059d83ed3383a8b814dda9dd3b0a850dc52addc354c0
4
- data.tar.gz: 27a171313a2b9c7031ec1e5f104676934b16a347487a4533a660b47e98e77eac
3
+ metadata.gz: 19936f56e898dca579bf9fcf65f00269b370f258cacf7ca8bd5078a87adc4671
4
+ data.tar.gz: 401815655a41971104e0a4f798c9558caf435810b30f26057b3685f597e1252a
5
5
  SHA512:
6
- metadata.gz: f5c3e519057e1154b0245b221524fcda071ddaae994c81d277fa466adc20ec38f83d69b6632ab5ab65ceadbd903c400d81f1f31cec8b6b214d14a7b9c48cd390
7
- data.tar.gz: e0a2246325bdf104f4d2c9a5654694705d7fd41674f0dd520888067cdfa8939877a05cdaa34baeff954555fd4528ea668af8446ff450f9080601b7e8a0d9b2c6
6
+ metadata.gz: 1f2c4a448530f16527106b68698d8515680c6bd5bb2e2cccd06ce3abffdae089f8b9a230adc89ce25866c13279ede19a4bb7ba0319f5afc05062e8bcb6046bce
7
+ data.tar.gz: faad75d0f246a51902dec3f8805fd91dce80add042e737b1bf6df437e41988987e1f88cd9296e798fbba3f94d246e2592895b28d484a63b5b507417a0605d147
data/LICENSE CHANGED
@@ -1,6 +1,7 @@
1
1
  The MIT License
2
2
 
3
3
  Copyright (c) 2016 GitHub, Inc
4
+ Copyright (c) Rugged Contributors
4
5
 
5
6
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
7
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -17,9 +17,9 @@ Rugged is a self-contained gem. You can install it by running:
17
17
 
18
18
  $ gem install rugged
19
19
 
20
- You need to have CMake and `pkg-config` installed on your system to be able to build the included version of `libgit2`. On OS X, after installing [Homebrew](http://brew.sh/), you can get CMake with:
20
+ You need to have CMake and `pkg-config` installed on your system to be able to build the included version of `libgit2`. On OS X, after installing [Homebrew](http://brew.sh/), you can get the required packages with:
21
21
  ```bash
22
- $ brew install cmake
22
+ $ brew install cmake pkg-config
23
23
  ```
24
24
 
25
25
  Please follow the above in case installation of the gem fails with `ERROR: CMake is required to build Rugged.`.
@@ -577,7 +577,7 @@ You can store bare repositories in alternative backends instead of storing on di
577
577
  `redbadger/rugged-redis` for an example of how a rugged backend works).
578
578
 
579
579
  ```ruby
580
- a_backend = Rugged::InMemory::Backend.new(opt1: 'setting', opt2: 'setting')
580
+ a_backend = MyProject::CustomObjectDB(opt1: 'setting', opt2: 'setting')
581
581
 
582
582
  repo = Rugged::Repository.init_at('repo_name', :bare, backend: a_backend)
583
583
 
data/ext/rugged/rugged.c CHANGED
@@ -220,15 +220,18 @@ static VALUE rb_git_prettify_message(int argc, VALUE *argv, VALUE self)
220
220
  return result;
221
221
  }
222
222
 
223
- static VALUE minimize_cb(VALUE rb_oid, git_oid_shorten *shortener)
223
+ static VALUE minimize_cb(RB_BLOCK_CALL_FUNC_ARGLIST(rb_oid, shorten))
224
224
  {
225
+ git_oid_shorten *shortener = (git_oid_shorten*) shorten;
226
+
225
227
  Check_Type(rb_oid, T_STRING);
226
228
  git_oid_shorten_add(shortener, RSTRING_PTR(rb_oid));
227
229
  return Qnil;
228
230
  }
229
231
 
230
- static VALUE minimize_yield(VALUE rb_oid, VALUE *data)
232
+ static VALUE minimize_yield(RB_BLOCK_CALL_FUNC_ARGLIST(rb_oid, args))
231
233
  {
234
+ VALUE *data = (VALUE*) args;
232
235
  rb_funcall(data[0], rb_intern("call"), 1,
233
236
  rb_str_substr(rb_oid, 0, FIX2INT(data[1])));
234
237
  return Qnil;
@@ -293,7 +296,7 @@ static VALUE rb_git_minimize_oid(int argc, VALUE *argv, VALUE self)
293
296
 
294
297
  shrt = git_oid_shorten_new(minlen);
295
298
 
296
- rb_iterate(rb_each, rb_enum, &minimize_cb, (VALUE)shrt);
299
+ rb_block_call(rb_enum, rb_intern("each"), 0, NULL, minimize_cb, (VALUE)shrt);
297
300
  length = git_oid_shorten_add(shrt, NULL);
298
301
 
299
302
  git_oid_shorten_free(shrt);
@@ -305,7 +308,7 @@ static VALUE rb_git_minimize_oid(int argc, VALUE *argv, VALUE self)
305
308
  yield_data[0] = rb_block;
306
309
  yield_data[1] = INT2FIX(length);
307
310
 
308
- rb_iterate(rb_each, rb_enum, &minimize_yield, (VALUE)yield_data);
311
+ rb_block_call(rb_enum, rb_intern("each"), 0, NULL, minimize_yield, (VALUE)yield_data);
309
312
  return Qnil;
310
313
  }
311
314
 
@@ -425,7 +425,7 @@ struct commit_data {
425
425
  * Note that parents may be set even when the function errors, so make
426
426
  * sure to free this data.
427
427
  */
428
- static VALUE parse_commit_options(struct commit_data *out, git_repository *repo, VALUE rb_data)
428
+ static int parse_commit_options(struct commit_data *out, git_repository *repo, VALUE rb_data)
429
429
  {
430
430
  VALUE rb_message, rb_tree, rb_parents, rb_ref;
431
431
  int error = 0, parent_count, i;
@@ -173,7 +173,7 @@ static int cb_config__each_key(const git_config_entry *entry, void *payload)
173
173
  {
174
174
  int *exception = (int *) payload;
175
175
 
176
- rb_protect(rb_yield, rb_ary_new3(1, rb_str_new_utf8(entry->name)), exception);
176
+ rb_protect(rb_yield, rb_str_new_utf8(entry->name), exception);
177
177
 
178
178
  return (*exception != 0) ? GIT_EUSER : GIT_OK;
179
179
  }
@@ -400,7 +400,7 @@ static VALUE rb_git_object_read_raw(VALUE self)
400
400
 
401
401
  void Init_rugged_object(void)
402
402
  {
403
- rb_cRuggedObject = rb_define_class_under(rb_mRugged, "Object", rb_cData);
403
+ rb_cRuggedObject = rb_define_class_under(rb_mRugged, "Object", rb_cObject);
404
404
  rb_define_singleton_method(rb_cRuggedObject, "lookup", rb_git_object_lookup, 2);
405
405
  rb_define_singleton_method(rb_cRuggedObject, "rev_parse", rb_git_object_rev_parse, 2);
406
406
  rb_define_singleton_method(rb_cRuggedObject, "rev_parse_oid", rb_git_object_rev_parse_oid, 2);
@@ -207,6 +207,18 @@ static void init_custom_headers(VALUE rb_options, git_strarray *custom_headers)
207
207
  }
208
208
  }
209
209
 
210
+ static void init_proxy_options(VALUE rb_options, git_proxy_options *proxy_options)
211
+ {
212
+ if (NIL_P(rb_options)) return;
213
+
214
+ VALUE val = rb_hash_aref(rb_options, CSTR2SYM("proxy_url"));
215
+ if (!NIL_P(val)) {
216
+ Check_Type(val, T_STRING);
217
+ proxy_options->type = GIT_PROXY_SPECIFIED;
218
+ proxy_options->url = StringValueCStr(val);
219
+ }
220
+ }
221
+
210
222
  static int parse_prune_type(VALUE rb_prune_type)
211
223
  {
212
224
  if (rb_prune_type == Qtrue) {
@@ -283,11 +295,15 @@ static VALUE rugged_rhead_new(const git_remote_head *head)
283
295
  *
284
296
  * :headers ::
285
297
  * Extra HTTP headers to include with the request (only applies to http:// or https:// remotes)
298
+ *
299
+ * :proxy_url ::
300
+ * The url of an http proxy to use to access the remote repository.
286
301
  */
287
302
  static VALUE rb_git_remote_ls(int argc, VALUE *argv, VALUE self)
288
303
  {
289
304
  git_remote *remote;
290
305
  git_remote_callbacks callbacks = GIT_REMOTE_CALLBACKS_INIT;
306
+ git_proxy_options proxy_options = GIT_PROXY_OPTIONS_INIT;
291
307
  git_strarray custom_headers = {0};
292
308
  const git_remote_head **heads;
293
309
 
@@ -304,8 +320,9 @@ static VALUE rb_git_remote_ls(int argc, VALUE *argv, VALUE self)
304
320
 
305
321
  rugged_remote_init_callbacks_and_payload_from_options(rb_options, &callbacks, &payload);
306
322
  init_custom_headers(rb_options, &custom_headers);
323
+ init_proxy_options(rb_options, &proxy_options);
307
324
 
308
- if ((error = git_remote_connect(remote, GIT_DIRECTION_FETCH, &callbacks, NULL, &custom_headers)) ||
325
+ if ((error = git_remote_connect(remote, GIT_DIRECTION_FETCH, &callbacks, &proxy_options, &custom_headers)) ||
309
326
  (error = git_remote_ls(&heads, &heads_len, remote)))
310
327
  goto cleanup;
311
328
 
@@ -474,6 +491,9 @@ static VALUE rb_git_remote_push_refspecs(VALUE self)
474
491
  * :headers ::
475
492
  * Extra HTTP headers to include with the request (only applies to http:// or https:// remotes)
476
493
  *
494
+ * :proxy_url ::
495
+ * The url of an http proxy to use to access the remote repository.
496
+ *
477
497
  * Example:
478
498
  *
479
499
  * remote = repo.remotes["origin"]
@@ -484,6 +504,7 @@ static VALUE rb_git_remote_check_connection(int argc, VALUE *argv, VALUE self)
484
504
  {
485
505
  git_remote *remote;
486
506
  git_remote_callbacks callbacks = GIT_REMOTE_CALLBACKS_INIT;
507
+ git_proxy_options proxy_options = GIT_PROXY_OPTIONS_INIT;
487
508
  git_strarray custom_headers = {0};
488
509
  struct rugged_remote_cb_payload payload = { Qnil, Qnil, Qnil, Qnil, Qnil, Qnil, Qnil, 0 };
489
510
  VALUE rb_direction, rb_options;
@@ -504,8 +525,9 @@ static VALUE rb_git_remote_check_connection(int argc, VALUE *argv, VALUE self)
504
525
 
505
526
  rugged_remote_init_callbacks_and_payload_from_options(rb_options, &callbacks, &payload);
506
527
  init_custom_headers(rb_options, &custom_headers);
528
+ init_proxy_options(rb_options, &proxy_options);
507
529
 
508
- error = git_remote_connect(remote, direction, &callbacks, NULL, &custom_headers);
530
+ error = git_remote_connect(remote, direction, &callbacks, &proxy_options, &custom_headers);
509
531
  git_remote_disconnect(remote);
510
532
 
511
533
  xfree(custom_headers.strings);
@@ -563,6 +585,9 @@ static VALUE rb_git_remote_check_connection(int argc, VALUE *argv, VALUE self)
563
585
  * Specifies the prune mode for the fetch. +true+ remove any remote-tracking references that
564
586
  * no longer exist, +false+ do not prune, +nil+ use configured settings Defaults to "nil".
565
587
  *
588
+ * :proxy_url ::
589
+ * The url of an http proxy to use to access the remote repository.
590
+ *
566
591
  * Example:
567
592
  *
568
593
  * remote = Rugged::Remote.lookup(@repo, 'origin')
@@ -593,6 +618,7 @@ static VALUE rb_git_remote_fetch(int argc, VALUE *argv, VALUE self)
593
618
 
594
619
  rugged_remote_init_callbacks_and_payload_from_options(rb_options, &opts.callbacks, &payload);
595
620
  init_custom_headers(rb_options, &opts.custom_headers);
621
+ init_proxy_options(rb_options, &opts.proxy_opts);
596
622
 
597
623
  if (!NIL_P(rb_options)) {
598
624
  VALUE rb_prune_type;
@@ -654,6 +680,9 @@ static VALUE rb_git_remote_fetch(int argc, VALUE *argv, VALUE self)
654
680
  * :headers ::
655
681
  * Extra HTTP headers to include with the push (only applies to http:// or https:// remotes)
656
682
  *
683
+ * :proxy_url ::
684
+ * The url of an http proxy to use to access the remote repository.
685
+ *
657
686
  * Example:
658
687
  *
659
688
  * remote = Rugged::Remote.lookup(@repo, 'origin')
@@ -679,6 +708,7 @@ static VALUE rb_git_remote_push(int argc, VALUE *argv, VALUE self)
679
708
 
680
709
  rugged_remote_init_callbacks_and_payload_from_options(rb_options, &opts.callbacks, &payload);
681
710
  init_custom_headers(rb_options, &opts.custom_headers);
711
+ init_proxy_options(rb_options, &opts.proxy_opts);
682
712
 
683
713
  error = git_remote_push(remote, &refspecs, &opts);
684
714
 
@@ -528,6 +528,13 @@ static void parse_clone_options(git_clone_options *ret, VALUE rb_options, struct
528
528
  ret->checkout_branch = StringValueCStr(val);
529
529
  }
530
530
 
531
+ val = rb_hash_aref(rb_options, CSTR2SYM("proxy_url"));
532
+ if (!NIL_P(val)) {
533
+ Check_Type(val, T_STRING);
534
+ ret->fetch_opts.proxy_opts.type = GIT_PROXY_SPECIFIED;
535
+ ret->fetch_opts.proxy_opts.url = StringValueCStr(val);
536
+ }
537
+
531
538
  rugged_remote_init_callbacks_and_payload_from_options(rb_options, &ret->fetch_opts.callbacks, remote_payload);
532
539
  }
533
540
 
@@ -552,6 +559,9 @@ static void parse_clone_options(git_clone_options *ret, VALUE rb_options, struct
552
559
  * :ignore_cert_errors ::
553
560
  * If set to +true+, errors while validating the remote's host certificate will be ignored.
554
561
  *
562
+ * :proxy_url ::
563
+ * The url of an http proxy to use to access the remote repository.
564
+ *
555
565
  * :credentials ::
556
566
  * The credentials to use for the clone operation. Can be either an instance of one
557
567
  * of the Rugged::Credentials types, or a proc returning one of the former.
@@ -1450,8 +1460,8 @@ static VALUE rb_git_repo_is_shallow(VALUE self)
1450
1460
  * call-seq:
1451
1461
  * repo.empty? -> true or false
1452
1462
  *
1453
- * Return whether a repository is empty or not. An empty repository has just
1454
- * been initialized and has no commits yet.
1463
+ * Return whether a repository is empty or not. An empty repository has HEAD
1464
+ * pointing to the default value and there are no other references.
1455
1465
  */
1456
1466
  static VALUE rb_git_repo_is_empty(VALUE self)
1457
1467
  {
@@ -2835,7 +2845,7 @@ void Init_rugged_repo(void)
2835
2845
  rb_define_method(rb_cRuggedRepo, "cherrypick_commit", rb_git_repo_cherrypick_commit, -1);
2836
2846
  rb_define_method(rb_cRuggedRepo, "fetch_attributes", rb_git_repo_attributes, -1);
2837
2847
 
2838
- rb_cRuggedOdbObject = rb_define_class_under(rb_mRugged, "OdbObject", rb_cData);
2848
+ rb_cRuggedOdbObject = rb_define_class_under(rb_mRugged, "OdbObject", rb_cObject);
2839
2849
  rb_define_method(rb_cRuggedOdbObject, "data", rb_git_odbobj_data, 0);
2840
2850
  rb_define_method(rb_cRuggedOdbObject, "len", rb_git_odbobj_size, 0);
2841
2851
  rb_define_method(rb_cRuggedOdbObject, "type", rb_git_odbobj_type, 0);
data/lib/rugged/commit.rb CHANGED
@@ -5,7 +5,6 @@
5
5
 
6
6
  module Rugged
7
7
  class Commit
8
-
9
8
  def self.prettify_message(msg, strip_comments = true)
10
9
  Rugged::prettify_message(msg, strip_comments)
11
10
  end
@@ -20,17 +19,31 @@ module Rugged
20
19
 
21
20
  # Return a diff between this commit and its first parent or another commit or tree.
22
21
  #
22
+ # The commit is treated as the new side of the diff by default
23
+ #
23
24
  # See Rugged::Tree#diff for more details.
24
25
  def diff(*args)
25
- args.unshift(parents.first) if args.size == 1 && args.first.is_a?(Hash)
26
- self.tree.diff(*args)
26
+ raise ArgumentError("wrong number of arguments (given #{args.length}, expected 0..2") if args.length > 2
27
+ other, opts = args
28
+ if other.is_a?(Hash)
29
+ opts = other
30
+ other = nil
31
+ end
32
+ opts ||= {}
33
+ # if other is not provided at all (as opposed to explicitly nil, or given)
34
+ # then diff against the prior commit
35
+ if args.empty? || args.first.is_a?(Hash)
36
+ other = parents.first
37
+ opts[:reverse] = !opts[:reverse]
38
+ end
39
+ self.tree.diff(other, opts)
27
40
  end
28
41
 
29
42
  # Return a diff between this commit and the workdir.
30
43
  #
31
44
  # See Rugged::Tree#diff_workdir for more details.
32
45
  def diff_workdir(options = {})
33
- self.tree.diff_workdir(options)
46
+ self.tree.diff_workdir(**options)
34
47
  end
35
48
 
36
49
  # The time when this commit was made effective. This is the same value
@@ -30,7 +30,7 @@ module Rugged
30
30
  options[:strategy] ||= :safe
31
31
  options.delete(:paths)
32
32
 
33
- return checkout_head(options) if target == "HEAD"
33
+ return checkout_head(**options) if target == "HEAD"
34
34
 
35
35
  if target.kind_of?(Rugged::Branch)
36
36
  branch = target
@@ -39,7 +39,7 @@ module Rugged
39
39
  end
40
40
 
41
41
  if branch
42
- self.checkout_tree(branch.target, options)
42
+ self.checkout_tree(branch.target, **options)
43
43
 
44
44
  if branch.remote?
45
45
  references.create("HEAD", branch.target_id, force: true)
@@ -49,7 +49,7 @@ module Rugged
49
49
  else
50
50
  commit = Commit.lookup(self, self.rev_parse_oid(target))
51
51
  references.create("HEAD", commit.oid, force: true)
52
- self.checkout_tree(commit, options)
52
+ self.checkout_tree(commit, **options)
53
53
  end
54
54
  end
55
55
 
@@ -250,12 +250,11 @@ module Rugged
250
250
  (blob.type == :blob) ? blob : nil
251
251
  end
252
252
 
253
- def fetch(remote_or_url, *args)
253
+ def fetch(remote_or_url, *args, **kwargs)
254
254
  unless remote_or_url.kind_of? Remote
255
255
  remote_or_url = remotes[remote_or_url] || remotes.create_anonymous(remote_or_url)
256
256
  end
257
-
258
- remote_or_url.fetch(*args)
257
+ remote_or_url.fetch(*args, **kwargs)
259
258
  end
260
259
 
261
260
  # Push a list of refspecs to the given remote.
@@ -264,12 +263,12 @@ module Rugged
264
263
  #
265
264
  # Returns a hash containing the pushed refspecs as keys and
266
265
  # any error messages or +nil+ as values.
267
- def push(remote_or_url, *args)
266
+ def push(remote_or_url, *args, **kwargs)
268
267
  unless remote_or_url.kind_of? Remote
269
268
  remote_or_url = remotes[remote_or_url] || remotes.create_anonymous(remote_or_url)
270
269
  end
271
270
 
272
- remote_or_url.push(*args)
271
+ remote_or_url.push(*args, **kwargs)
273
272
  end
274
273
  end
275
274
  end
@@ -26,8 +26,8 @@ module Rugged
26
26
  #
27
27
  # Returns the newly created +submodule+
28
28
  def add(url, path, options = {})
29
- submodule = setup_add(url, path, options)
30
- clone_submodule(submodule.repository, options)
29
+ submodule = setup_add(url, path, **options)
30
+ clone_submodule(submodule.repository, **options)
31
31
  submodule.finalize_add
32
32
  end
33
33
 
@@ -40,9 +40,9 @@ module Rugged
40
40
  # 1. fetches the remote
41
41
  # 2. sets up a master branch to be tracking origin/master
42
42
  # 3. checkouts the submodule
43
- def clone_submodule(repo, fetch_options)
43
+ def clone_submodule(repo, **fetch_options)
44
44
  # the remote was just added by setup_add, no need to check presence
45
- repo.remotes['origin'].fetch(fetch_options)
45
+ repo.remotes['origin'].fetch(**fetch_options)
46
46
 
47
47
  repo.branches.create('master','origin/master')
48
48
  repo.branches['master'].upstream = repo.branches['origin/master']
@@ -4,5 +4,5 @@
4
4
  # For full terms see the included LICENSE file.
5
5
 
6
6
  module Rugged
7
- Version = VERSION = '1.0.0'
7
+ Version = VERSION = '1.2.0'
8
8
  end
@@ -11,21 +11,12 @@
11
11
  # Install:
12
12
  # > cmake --build . --target install
13
13
 
14
- PROJECT(libgit2 C)
15
14
  CMAKE_MINIMUM_REQUIRED(VERSION 3.5.1)
16
- CMAKE_POLICY(SET CMP0015 NEW)
17
- IF(POLICY CMP0051)
18
- CMAKE_POLICY(SET CMP0051 NEW)
19
- ENDIF()
20
- IF(POLICY CMP0042)
21
- CMAKE_POLICY(SET CMP0042 NEW)
22
- ENDIF()
23
- IF(POLICY CMP0054)
24
- CMAKE_POLICY(SET CMP0054 NEW)
25
- ENDIF()
15
+
16
+ project(libgit2 VERSION "1.2.0" LANGUAGES C)
26
17
 
27
18
  # Add find modules to the path
28
- SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${libgit2_SOURCE_DIR}/cmake/Modules/")
19
+ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${libgit2_SOURCE_DIR}/cmake/")
29
20
 
30
21
  INCLUDE(CheckLibraryExists)
31
22
  INCLUDE(CheckFunctionExists)
@@ -36,6 +27,7 @@ INCLUDE(AddCFlagIfSupported)
36
27
  INCLUDE(FindPkgLibraries)
37
28
  INCLUDE(FindThreads)
38
29
  INCLUDE(FindStatNsec)
30
+ INCLUDE(Findfutimens)
39
31
  INCLUDE(GNUInstallDirs)
40
32
  INCLUDE(IdeSplitSources)
41
33
  INCLUDE(FeatureSummary)
@@ -49,8 +41,6 @@ OPTION(THREADSAFE "Build libgit2 as threadsafe" ON)
49
41
  OPTION(BUILD_CLAR "Build Tests using the Clar suite" ON)
50
42
  OPTION(BUILD_EXAMPLES "Build library usage example apps" OFF)
51
43
  OPTION(BUILD_FUZZERS "Build the fuzz targets" OFF)
52
- OPTION(TAGS "Generate tags" OFF)
53
- OPTION(PROFILE "Generate profiling information" OFF)
54
44
  OPTION(ENABLE_TRACE "Enables tracing support" ON)
55
45
  OPTION(LIBGIT2_FILENAME "Name of the produced binary" OFF)
56
46
  OPTION(USE_SSH "Link with libssh2 to enable SSH support" ON)
@@ -60,8 +50,10 @@ OPTION(USE_GSSAPI "Link with libgssapi for SPNEGO auth" OFF)
60
50
  OPTION(USE_STANDALONE_FUZZERS "Enable standalone fuzzers (compatible with gcc)" OFF)
61
51
  OPTION(USE_LEAK_CHECKER "Run tests with leak checker" OFF)
62
52
  OPTION(DEBUG_POOL "Enable debug pool allocator" OFF)
53
+ OPTION(DEBUG_STRICT_ALLOC "Enable strict allocator behavior" OFF)
54
+ OPTION(DEBUG_STRICT_OPEN "Enable path validation in open" OFF)
63
55
  OPTION(ENABLE_WERROR "Enable compilation with -Werror" OFF)
64
- OPTION(USE_BUNDLED_ZLIB "Use the bundled version of zlib" OFF)
56
+ OPTION(USE_BUNDLED_ZLIB "Use the bundled version of zlib. Can be set to one of Bundled(ON)/Chromium. The Chromium option requires a x86_64 processor with SSE4.2 and CLMUL" OFF)
65
57
  SET(USE_HTTP_PARSER "" CACHE STRING "Specifies the HTTP Parser implementation; either system or builtin.")
66
58
  OPTION(DEPRECATE_HARD "Do not include deprecated functions in the library" OFF)
67
59
  SET(REGEX_BACKEND "" CACHE STRING "Regular expression implementation. One of regcomp_l, pcre2, pcre, regcomp, or builtin.")
@@ -100,20 +92,10 @@ IF(WIN32)
100
92
  ENDIF()
101
93
 
102
94
  IF(MSVC)
103
- # Enable MSVC CRTDBG memory leak reporting when in debug mode.
104
- OPTION(MSVC_CRTDBG "Enable CRTDBG memory leak reporting" OFF)
95
+ # Enable leak checking using the debugging C runtime.
96
+ OPTION(WIN32_LEAKCHECK "Enable leak reporting via crtdbg" OFF)
105
97
  ENDIF()
106
98
 
107
- FILE(STRINGS "${libgit2_SOURCE_DIR}/include/git2/version.h" GIT2_HEADER REGEX "^#define LIBGIT2_VERSION \"[^\"]*\"$")
108
-
109
- STRING(REGEX REPLACE "^.*LIBGIT2_VERSION \"([0-9]+).*$" "\\1" LIBGIT2_VERSION_MAJOR "${GIT2_HEADER}")
110
- STRING(REGEX REPLACE "^.*LIBGIT2_VERSION \"[0-9]+\\.([0-9]+).*$" "\\1" LIBGIT2_VERSION_MINOR "${GIT2_HEADER}")
111
- STRING(REGEX REPLACE "^.*LIBGIT2_VERSION \"[0-9]+\\.[0-9]+\\.([0-9]+).*$" "\\1" LIBGIT2_VERSION_REV "${GIT2_HEADER}")
112
- SET(LIBGIT2_VERSION_STRING "${LIBGIT2_VERSION_MAJOR}.${LIBGIT2_VERSION_MINOR}.${LIBGIT2_VERSION_REV}")
113
-
114
- FILE(STRINGS "${libgit2_SOURCE_DIR}/include/git2/version.h" GIT2_HEADER_SOVERSION REGEX "^#define LIBGIT2_SOVERSION \"([0-9.]+)\"$")
115
- STRING(REGEX REPLACE "^.*LIBGIT2_SOVERSION \"([0-9.]+)\"$" "\\1" LIBGIT2_SOVERSION "${GIT2_HEADER_SOVERSION}")
116
-
117
99
  IF (DEPRECATE_HARD)
118
100
  ADD_DEFINITIONS(-DGIT_DEPRECATE_HARD)
119
101
  ENDIF()
@@ -137,6 +119,11 @@ IF (MSVC)
137
119
  # /Gd - explicitly set cdecl calling convention
138
120
  SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /Gd")
139
121
 
122
+ IF (NOT (MSVC_VERSION LESS 1900))
123
+ # /guard:cf - Enable Control Flow Guard
124
+ SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /guard:cf")
125
+ ENDIF()
126
+
140
127
  IF (STATIC_CRT)
141
128
  SET(CRT_FLAG_DEBUG "/MTd")
142
129
  SET(CRT_FLAG_RELEASE "/MT")
@@ -145,8 +132,8 @@ IF (MSVC)
145
132
  SET(CRT_FLAG_RELEASE "/MD")
146
133
  ENDIF()
147
134
 
148
- IF (MSVC_CRTDBG)
149
- SET(GIT_MSVC_CRTDBG 1)
135
+ IF (WIN32_LEAKCHECK)
136
+ SET(GIT_WIN32_LEAKCHECK 1)
150
137
  SET(CRT_FLAG_DEBUG "${CRT_FLAG_DEBUG}")
151
138
  SET(CMAKE_C_STANDARD_LIBRARIES "${CMAKE_C_STANDARD_LIBRARIES} Dbghelp.lib")
152
139
  ENDIF()
@@ -181,7 +168,12 @@ IF (MSVC)
181
168
  # /NXCOMPAT - Data execution prevention (DEP)
182
169
  # /LARGEADDRESSAWARE - >2GB user address space on x86
183
170
  # /VERSION - Embed version information in PE header
184
- SET(CMAKE_EXE_LINKER_FLAGS "/DYNAMICBASE /NXCOMPAT /LARGEADDRESSAWARE /VERSION:${LIBGIT2_VERSION_MAJOR}.${LIBGIT2_VERSION_MINOR}")
171
+ SET(CMAKE_EXE_LINKER_FLAGS "/DYNAMICBASE /NXCOMPAT /LARGEADDRESSAWARE /VERSION:${libgit2_VERSION_MAJOR}.${libgit2_VERSION_MINOR}")
172
+
173
+ IF (NOT (MSVC_VERSION LESS 1900))
174
+ # /GUARD:CF - Enable Control Flow Guard
175
+ SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /GUARD:CF")
176
+ ENDIF()
185
177
 
186
178
  # /DEBUG - Create a PDB
187
179
  # /LTCG - Link time code generation (whole program optimization)
@@ -232,35 +224,29 @@ ELSE ()
232
224
  ADD_DEFINITIONS(-D__USE_MINGW_ANSI_STDIO=1)
233
225
  ENDIF ()
234
226
 
235
- ENABLE_WARNINGS(documentation)
236
- DISABLE_WARNINGS(missing-field-initializers)
237
- ENABLE_WARNINGS(strict-aliasing)
238
- ENABLE_WARNINGS(strict-prototypes)
239
- ENABLE_WARNINGS(declaration-after-statement)
240
- ENABLE_WARNINGS(shift-count-overflow)
241
- ENABLE_WARNINGS(unused-const-variable)
242
- ENABLE_WARNINGS(unused-function)
243
- ENABLE_WARNINGS(int-conversion)
227
+ enable_warnings(documentation)
228
+ disable_warnings(documentation-deprecated-sync)
229
+ disable_warnings(missing-field-initializers)
230
+ enable_warnings(strict-aliasing)
231
+ enable_warnings(strict-prototypes)
232
+ enable_warnings(declaration-after-statement)
233
+ enable_warnings(shift-count-overflow)
234
+ enable_warnings(unused-const-variable)
235
+ enable_warnings(unused-function)
236
+ enable_warnings(int-conversion)
237
+ enable_warnings(c11-extensions)
238
+ enable_warnings(c99-c11-compat)
244
239
 
245
240
  # MinGW uses gcc, which expects POSIX formatting for printf, but
246
241
  # uses the Windows C library, which uses its own format specifiers.
247
242
  # Disable format specifier warnings.
248
- IF(MINGW)
249
- DISABLE_WARNINGS(format)
250
- DISABLE_WARNINGS(format-security)
251
- ELSE()
252
- ENABLE_WARNINGS(format)
253
- ENABLE_WARNINGS(format-security)
254
- ENDIF()
255
-
256
- IF("${CMAKE_C_COMPILER_ID}" STREQUAL "Clang")
257
- DISABLE_WARNINGS(documentation-deprecated-sync)
258
- ENDIF()
259
-
260
- IF (PROFILE)
261
- SET(CMAKE_C_FLAGS "-pg ${CMAKE_C_FLAGS}")
262
- SET(CMAKE_EXE_LINKER_FLAGS "-pg ${CMAKE_EXE_LINKER_FLAGS}")
263
- ENDIF ()
243
+ if(MINGW)
244
+ disable_warnings(format)
245
+ disable_warnings(format-security)
246
+ else()
247
+ enable_warnings(format)
248
+ enable_warnings(format-security)
249
+ endif()
264
250
  ENDIF()
265
251
 
266
252
  # Ensure that MinGW provides the correct header files.
@@ -300,25 +286,6 @@ IF (BUILD_CLAR)
300
286
  ADD_SUBDIRECTORY(tests)
301
287
  ENDIF ()
302
288
 
303
- IF (TAGS)
304
- FIND_PROGRAM(CTAGS ctags)
305
- IF (NOT CTAGS)
306
- MESSAGE(FATAL_ERROR "Could not find ctags command")
307
- ENDIF ()
308
-
309
- FILE(GLOB_RECURSE SRC_ALL *.[ch])
310
-
311
- ADD_CUSTOM_COMMAND(
312
- OUTPUT tags
313
- COMMAND ${CTAGS} -a ${SRC_ALL}
314
- DEPENDS ${SRC_ALL}
315
- )
316
- ADD_CUSTOM_TARGET(
317
- do_tags ALL
318
- DEPENDS tags
319
- )
320
- ENDIF ()
321
-
322
289
  IF (BUILD_EXAMPLES)
323
290
  ADD_SUBDIRECTORY(examples)
324
291
  ENDIF ()