rugged 1.1.1 → 1.4.3

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 (407) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +1 -0
  3. data/README.md +1 -1
  4. data/ext/rugged/extconf.rb +2 -2
  5. data/ext/rugged/rugged.c +7 -4
  6. data/ext/rugged/rugged_config.c +7 -2
  7. data/ext/rugged/rugged_object.c +1 -1
  8. data/ext/rugged/rugged_remote.c +17 -0
  9. data/ext/rugged/rugged_repo.c +3 -3
  10. data/lib/rugged/repository.rb +2 -2
  11. data/lib/rugged/version.rb +1 -1
  12. data/vendor/libgit2/CMakeLists.txt +103 -271
  13. data/vendor/libgit2/COPYING +149 -24
  14. data/vendor/libgit2/cmake/AddCFlagIfSupported.cmake +21 -21
  15. data/vendor/libgit2/cmake/DefaultCFlags.cmake +154 -0
  16. data/vendor/libgit2/cmake/EnableWarnings.cmake +13 -13
  17. data/vendor/libgit2/cmake/FindCoreFoundation.cmake +13 -13
  18. data/vendor/libgit2/cmake/FindGSSAPI.cmake +171 -287
  19. data/vendor/libgit2/cmake/FindGSSFramework.cmake +13 -13
  20. data/vendor/libgit2/cmake/{FindHTTP_Parser.cmake → FindHTTPParser.cmake} +17 -17
  21. data/vendor/libgit2/cmake/FindIconv.cmake +27 -27
  22. data/vendor/libgit2/cmake/FindLibSSH2.cmake +13 -0
  23. data/vendor/libgit2/cmake/FindPCRE.cmake +13 -13
  24. data/vendor/libgit2/cmake/FindPCRE2.cmake +12 -12
  25. data/vendor/libgit2/cmake/FindPkgLibraries.cmake +19 -19
  26. data/vendor/libgit2/cmake/FindSecurity.cmake +14 -14
  27. data/vendor/libgit2/cmake/FindStatNsec.cmake +12 -18
  28. data/vendor/libgit2/cmake/Findfutimens.cmake +14 -0
  29. data/vendor/libgit2/cmake/FindmbedTLS.cmake +63 -70
  30. data/vendor/libgit2/cmake/IdeSplitSources.cmake +18 -18
  31. data/vendor/libgit2/cmake/PkgBuildConfig.cmake +60 -60
  32. data/vendor/libgit2/cmake/SanitizeBool.cmake +20 -20
  33. data/vendor/libgit2/cmake/SelectGSSAPI.cmake +37 -37
  34. data/vendor/libgit2/cmake/SelectHTTPParser.cmake +19 -0
  35. data/vendor/libgit2/cmake/SelectHTTPSBackend.cmake +100 -96
  36. data/vendor/libgit2/cmake/SelectHashes.cmake +39 -48
  37. data/vendor/libgit2/cmake/SelectRegex.cmake +51 -0
  38. data/vendor/libgit2/cmake/SelectSSH.cmake +41 -0
  39. data/vendor/libgit2/cmake/SelectWinHTTP.cmake +17 -0
  40. data/vendor/libgit2/cmake/SelectZlib.cmake +34 -0
  41. data/vendor/libgit2/deps/chromium-zlib/CMakeLists.txt +101 -0
  42. data/vendor/libgit2/deps/ntlmclient/CMakeLists.txt +32 -20
  43. data/vendor/libgit2/deps/ntlmclient/crypt.h +14 -9
  44. data/vendor/libgit2/deps/ntlmclient/crypt_commoncrypto.c +20 -20
  45. data/vendor/libgit2/deps/ntlmclient/crypt_commoncrypto.h +3 -3
  46. data/vendor/libgit2/deps/ntlmclient/crypt_mbedtls.c +37 -36
  47. data/vendor/libgit2/deps/ntlmclient/crypt_mbedtls.h +4 -3
  48. data/vendor/libgit2/deps/ntlmclient/crypt_openssl.c +178 -51
  49. data/vendor/libgit2/deps/ntlmclient/crypt_openssl.h +74 -5
  50. data/vendor/libgit2/deps/ntlmclient/ntlm.c +154 -122
  51. data/vendor/libgit2/deps/ntlmclient/ntlm.h +17 -13
  52. data/vendor/libgit2/deps/ntlmclient/ntlmclient.h +17 -4
  53. data/vendor/libgit2/deps/ntlmclient/unicode.h +10 -4
  54. data/vendor/libgit2/deps/ntlmclient/unicode_builtin.c +16 -27
  55. data/vendor/libgit2/deps/ntlmclient/unicode_builtin.h +20 -0
  56. data/vendor/libgit2/deps/ntlmclient/unicode_iconv.c +28 -52
  57. data/vendor/libgit2/deps/ntlmclient/unicode_iconv.h +22 -0
  58. data/vendor/libgit2/deps/pcre/CMakeLists.txt +88 -88
  59. data/vendor/libgit2/deps/winhttp/CMakeLists.txt +14 -16
  60. data/vendor/libgit2/include/git2/apply.h +16 -2
  61. data/vendor/libgit2/include/git2/attr.h +106 -2
  62. data/vendor/libgit2/include/git2/blame.h +97 -43
  63. data/vendor/libgit2/include/git2/blob.h +33 -2
  64. data/vendor/libgit2/include/git2/branch.h +27 -0
  65. data/vendor/libgit2/include/git2/buffer.h +18 -78
  66. data/vendor/libgit2/include/git2/cert.h +43 -6
  67. data/vendor/libgit2/include/git2/checkout.h +32 -13
  68. data/vendor/libgit2/include/git2/clone.h +4 -4
  69. data/vendor/libgit2/include/git2/commit.h +37 -19
  70. data/vendor/libgit2/include/git2/common.h +46 -5
  71. data/vendor/libgit2/include/git2/config.h +19 -3
  72. data/vendor/libgit2/include/git2/credential.h +2 -1
  73. data/vendor/libgit2/include/git2/credential_helpers.h +1 -0
  74. data/vendor/libgit2/include/git2/deprecated.h +326 -6
  75. data/vendor/libgit2/include/git2/describe.h +7 -2
  76. data/vendor/libgit2/include/git2/diff.h +50 -121
  77. data/vendor/libgit2/include/git2/email.h +127 -0
  78. data/vendor/libgit2/include/git2/errors.h +7 -6
  79. data/vendor/libgit2/include/git2/filter.h +69 -18
  80. data/vendor/libgit2/include/git2/graph.h +21 -2
  81. data/vendor/libgit2/include/git2/ignore.h +1 -1
  82. data/vendor/libgit2/include/git2/index.h +13 -7
  83. data/vendor/libgit2/include/git2/indexer.h +19 -0
  84. data/vendor/libgit2/include/git2/merge.h +23 -3
  85. data/vendor/libgit2/include/git2/message.h +2 -0
  86. data/vendor/libgit2/include/git2/notes.h +2 -2
  87. data/vendor/libgit2/include/git2/object.h +23 -0
  88. data/vendor/libgit2/include/git2/odb.h +65 -6
  89. data/vendor/libgit2/include/git2/odb_backend.h +1 -1
  90. data/vendor/libgit2/include/git2/oidarray.h +5 -8
  91. data/vendor/libgit2/include/git2/pack.h +24 -8
  92. data/vendor/libgit2/include/git2/patch.h +16 -0
  93. data/vendor/libgit2/include/git2/pathspec.h +1 -1
  94. data/vendor/libgit2/include/git2/proxy.h +1 -1
  95. data/vendor/libgit2/include/git2/rebase.h +34 -2
  96. data/vendor/libgit2/include/git2/refdb.h +3 -0
  97. data/vendor/libgit2/include/git2/reflog.h +1 -1
  98. data/vendor/libgit2/include/git2/refs.h +8 -4
  99. data/vendor/libgit2/include/git2/remote.h +246 -46
  100. data/vendor/libgit2/include/git2/repository.h +25 -18
  101. data/vendor/libgit2/include/git2/reset.h +2 -2
  102. data/vendor/libgit2/include/git2/revparse.h +5 -5
  103. data/vendor/libgit2/include/git2/revwalk.h +4 -1
  104. data/vendor/libgit2/include/git2/signature.h +1 -1
  105. data/vendor/libgit2/include/git2/stash.h +4 -4
  106. data/vendor/libgit2/include/git2/status.h +124 -62
  107. data/vendor/libgit2/include/git2/stdint.h +3 -3
  108. data/vendor/libgit2/include/git2/submodule.h +16 -2
  109. data/vendor/libgit2/include/git2/sys/commit_graph.h +174 -0
  110. data/vendor/libgit2/include/git2/sys/email.h +45 -0
  111. data/vendor/libgit2/include/git2/sys/filter.h +49 -28
  112. data/vendor/libgit2/include/git2/sys/midx.h +74 -0
  113. data/vendor/libgit2/include/git2/sys/odb_backend.h +9 -5
  114. data/vendor/libgit2/include/git2/sys/remote.h +31 -0
  115. data/vendor/libgit2/include/git2/sys/stream.h +1 -1
  116. data/vendor/libgit2/include/git2/sys/transport.h +26 -34
  117. data/vendor/libgit2/include/git2/tag.h +13 -0
  118. data/vendor/libgit2/include/git2/tree.h +4 -17
  119. data/vendor/libgit2/include/git2/types.h +16 -7
  120. data/vendor/libgit2/include/git2/version.h +4 -4
  121. data/vendor/libgit2/include/git2/worktree.h +13 -2
  122. data/vendor/libgit2/include/git2.h +1 -0
  123. data/vendor/libgit2/src/CMakeLists.txt +192 -290
  124. data/vendor/libgit2/src/alloc.c +21 -8
  125. data/vendor/libgit2/src/allocators/failalloc.c +92 -0
  126. data/vendor/libgit2/src/allocators/failalloc.h +23 -0
  127. data/vendor/libgit2/src/allocators/stdalloc.c +41 -10
  128. data/vendor/libgit2/src/allocators/win32_leakcheck.c +118 -0
  129. data/vendor/libgit2/src/allocators/{win32_crtdbg.h → win32_leakcheck.h} +3 -3
  130. data/vendor/libgit2/src/annotated_commit.c +21 -9
  131. data/vendor/libgit2/src/annotated_commit.h +1 -1
  132. data/vendor/libgit2/src/apply.c +34 -25
  133. data/vendor/libgit2/src/apply.h +2 -2
  134. data/vendor/libgit2/src/array.h +11 -11
  135. data/vendor/libgit2/src/attr.c +204 -82
  136. data/vendor/libgit2/src/attr_file.c +105 -52
  137. data/vendor/libgit2/src/attr_file.h +36 -15
  138. data/vendor/libgit2/src/attrcache.c +55 -45
  139. data/vendor/libgit2/src/attrcache.h +4 -5
  140. data/vendor/libgit2/src/blame.c +15 -9
  141. data/vendor/libgit2/src/blame_git.c +2 -2
  142. data/vendor/libgit2/src/blob.c +76 -52
  143. data/vendor/libgit2/src/blob.h +1 -1
  144. data/vendor/libgit2/src/branch.c +203 -110
  145. data/vendor/libgit2/src/branch.h +15 -3
  146. data/vendor/libgit2/src/buf.c +126 -0
  147. data/vendor/libgit2/src/buf.h +50 -0
  148. data/vendor/libgit2/src/cache.c +2 -2
  149. data/vendor/libgit2/src/cache.h +7 -7
  150. data/vendor/libgit2/src/cc-compat.h +11 -9
  151. data/vendor/libgit2/src/checkout.c +118 -91
  152. data/vendor/libgit2/src/cherrypick.c +16 -12
  153. data/vendor/libgit2/src/clone.c +97 -103
  154. data/vendor/libgit2/src/commit.c +167 -84
  155. data/vendor/libgit2/src/commit.h +24 -1
  156. data/vendor/libgit2/src/commit_graph.c +1224 -0
  157. data/vendor/libgit2/src/commit_graph.h +169 -0
  158. data/vendor/libgit2/src/commit_list.c +48 -3
  159. data/vendor/libgit2/src/commit_list.h +2 -0
  160. data/vendor/libgit2/src/common.h +35 -5
  161. data/vendor/libgit2/src/config.c +119 -64
  162. data/vendor/libgit2/src/config.h +15 -2
  163. data/vendor/libgit2/src/config_cache.c +5 -3
  164. data/vendor/libgit2/src/config_file.c +120 -100
  165. data/vendor/libgit2/src/config_mem.c +9 -9
  166. data/vendor/libgit2/src/config_parse.c +29 -27
  167. data/vendor/libgit2/src/crlf.c +36 -23
  168. data/vendor/libgit2/src/date.c +13 -19
  169. data/vendor/libgit2/src/date.h +33 -0
  170. data/vendor/libgit2/src/delta.c +1 -1
  171. data/vendor/libgit2/src/describe.c +32 -21
  172. data/vendor/libgit2/src/diff.c +71 -183
  173. data/vendor/libgit2/src/diff.h +2 -4
  174. data/vendor/libgit2/src/diff_driver.c +53 -51
  175. data/vendor/libgit2/src/diff_driver.h +3 -3
  176. data/vendor/libgit2/src/diff_file.c +31 -26
  177. data/vendor/libgit2/src/diff_generate.c +76 -23
  178. data/vendor/libgit2/src/diff_generate.h +5 -3
  179. data/vendor/libgit2/src/diff_print.c +120 -95
  180. data/vendor/libgit2/src/diff_stats.c +47 -34
  181. data/vendor/libgit2/src/{message.h → diff_stats.h} +7 -6
  182. data/vendor/libgit2/src/diff_tform.c +18 -16
  183. data/vendor/libgit2/src/diff_xdiff.c +7 -10
  184. data/vendor/libgit2/src/diff_xdiff.h +1 -1
  185. data/vendor/libgit2/src/email.c +315 -0
  186. data/vendor/libgit2/src/email.h +25 -0
  187. data/vendor/libgit2/src/errors.c +37 -32
  188. data/vendor/libgit2/src/features.h.in +11 -2
  189. data/vendor/libgit2/src/fetch.c +77 -26
  190. data/vendor/libgit2/src/fetch.h +1 -1
  191. data/vendor/libgit2/src/fetchhead.c +27 -23
  192. data/vendor/libgit2/src/filebuf.c +36 -34
  193. data/vendor/libgit2/src/filebuf.h +1 -1
  194. data/vendor/libgit2/src/filter.c +278 -132
  195. data/vendor/libgit2/src/filter.h +46 -6
  196. data/vendor/libgit2/src/fs_path.c +2071 -0
  197. data/vendor/libgit2/src/fs_path.h +772 -0
  198. data/vendor/libgit2/src/futils.c +96 -90
  199. data/vendor/libgit2/src/futils.h +27 -15
  200. data/vendor/libgit2/src/graph.c +64 -9
  201. data/vendor/libgit2/src/hash/sha1/collisiondetect.c +5 -5
  202. data/vendor/libgit2/src/hash/sha1/common_crypto.c +5 -5
  203. data/vendor/libgit2/src/hash/sha1/generic.c +2 -2
  204. data/vendor/libgit2/src/hash/sha1/generic.h +1 -1
  205. data/vendor/libgit2/src/hash/sha1/mbedtls.c +13 -13
  206. data/vendor/libgit2/src/hash/sha1/openssl.c +5 -5
  207. data/vendor/libgit2/src/hash/sha1/sha1dc/sha1.c +9 -11
  208. data/vendor/libgit2/src/hash/sha1/win32.c +21 -17
  209. data/vendor/libgit2/src/hash/sha1.h +3 -1
  210. data/vendor/libgit2/src/hash.c +71 -36
  211. data/vendor/libgit2/src/hash.h +13 -13
  212. data/vendor/libgit2/src/hashsig.c +23 -10
  213. data/vendor/libgit2/src/ident.c +30 -20
  214. data/vendor/libgit2/src/ignore.c +63 -46
  215. data/vendor/libgit2/src/ignore.h +2 -2
  216. data/vendor/libgit2/src/index.c +184 -149
  217. data/vendor/libgit2/src/index.h +7 -4
  218. data/vendor/libgit2/src/indexer.c +143 -89
  219. data/vendor/libgit2/src/integer.h +64 -2
  220. data/vendor/libgit2/src/iterator.c +93 -73
  221. data/vendor/libgit2/src/iterator.h +6 -6
  222. data/vendor/libgit2/src/khash.h +3 -12
  223. data/vendor/libgit2/src/{settings.c → libgit2.c} +165 -56
  224. data/vendor/libgit2/src/libgit2.h +15 -0
  225. data/vendor/libgit2/src/mailmap.c +60 -45
  226. data/vendor/libgit2/src/map.h +3 -3
  227. data/vendor/libgit2/src/merge.c +104 -61
  228. data/vendor/libgit2/src/merge.h +3 -15
  229. data/vendor/libgit2/src/merge_driver.c +21 -15
  230. data/vendor/libgit2/src/merge_file.c +24 -6
  231. data/vendor/libgit2/src/message.c +21 -8
  232. data/vendor/libgit2/src/midx.c +501 -18
  233. data/vendor/libgit2/src/midx.h +29 -2
  234. data/vendor/libgit2/src/mwindow.c +103 -59
  235. data/vendor/libgit2/src/mwindow.h +3 -3
  236. data/vendor/libgit2/src/net.c +405 -71
  237. data/vendor/libgit2/src/net.h +26 -5
  238. data/vendor/libgit2/src/netops.c +7 -5
  239. data/vendor/libgit2/src/netops.h +3 -3
  240. data/vendor/libgit2/src/notes.c +40 -49
  241. data/vendor/libgit2/src/object.c +68 -20
  242. data/vendor/libgit2/src/object.h +1 -1
  243. data/vendor/libgit2/src/odb.c +320 -80
  244. data/vendor/libgit2/src/odb.h +17 -3
  245. data/vendor/libgit2/src/odb_loose.c +96 -86
  246. data/vendor/libgit2/src/odb_mempack.c +19 -6
  247. data/vendor/libgit2/src/odb_pack.c +402 -125
  248. data/vendor/libgit2/src/oid.c +16 -8
  249. data/vendor/libgit2/src/oid.h +15 -0
  250. data/vendor/libgit2/src/oidarray.c +10 -1
  251. data/vendor/libgit2/src/pack-objects.c +90 -69
  252. data/vendor/libgit2/src/pack-objects.h +11 -6
  253. data/vendor/libgit2/src/pack.c +337 -127
  254. data/vendor/libgit2/src/pack.h +25 -7
  255. data/vendor/libgit2/src/patch.c +17 -10
  256. data/vendor/libgit2/src/patch.h +1 -0
  257. data/vendor/libgit2/src/patch_generate.c +29 -13
  258. data/vendor/libgit2/src/patch_generate.h +5 -5
  259. data/vendor/libgit2/src/patch_parse.c +26 -25
  260. data/vendor/libgit2/src/path.c +86 -1768
  261. data/vendor/libgit2/src/path.h +39 -635
  262. data/vendor/libgit2/src/pathspec.c +12 -12
  263. data/vendor/libgit2/src/pathspec.h +2 -2
  264. data/vendor/libgit2/src/pool.c +13 -7
  265. data/vendor/libgit2/src/posix.c +14 -6
  266. data/vendor/libgit2/src/posix.h +1 -0
  267. data/vendor/libgit2/src/pqueue.h +1 -1
  268. data/vendor/libgit2/src/proxy.c +4 -1
  269. data/vendor/libgit2/src/proxy.h +1 -1
  270. data/vendor/libgit2/src/push.c +30 -35
  271. data/vendor/libgit2/src/push.h +4 -16
  272. data/vendor/libgit2/src/rand.c +226 -0
  273. data/vendor/libgit2/src/rand.h +37 -0
  274. data/vendor/libgit2/src/reader.c +18 -14
  275. data/vendor/libgit2/src/reader.h +2 -2
  276. data/vendor/libgit2/src/rebase.c +177 -132
  277. data/vendor/libgit2/src/refdb.c +30 -13
  278. data/vendor/libgit2/src/refdb_fs.c +548 -222
  279. data/vendor/libgit2/src/reflog.c +19 -14
  280. data/vendor/libgit2/src/refs.c +107 -72
  281. data/vendor/libgit2/src/refs.h +2 -2
  282. data/vendor/libgit2/src/refspec.c +53 -38
  283. data/vendor/libgit2/src/refspec.h +5 -2
  284. data/vendor/libgit2/src/regexp.c +1 -1
  285. data/vendor/libgit2/src/remote.c +960 -486
  286. data/vendor/libgit2/src/remote.h +16 -10
  287. data/vendor/libgit2/src/repository.c +702 -422
  288. data/vendor/libgit2/src/repository.h +26 -8
  289. data/vendor/libgit2/src/reset.c +16 -12
  290. data/vendor/libgit2/src/revert.c +16 -12
  291. data/vendor/libgit2/src/revparse.c +66 -48
  292. data/vendor/libgit2/src/revwalk.c +39 -22
  293. data/vendor/libgit2/src/runtime.c +162 -0
  294. data/vendor/libgit2/src/runtime.h +62 -0
  295. data/vendor/libgit2/src/settings.h +11 -0
  296. data/vendor/libgit2/src/signature.c +18 -11
  297. data/vendor/libgit2/src/signature.h +1 -1
  298. data/vendor/libgit2/src/sortedcache.c +1 -1
  299. data/vendor/libgit2/src/sortedcache.h +10 -8
  300. data/vendor/libgit2/src/stash.c +39 -38
  301. data/vendor/libgit2/src/status.c +11 -5
  302. data/vendor/libgit2/src/{buffer.c → str.c} +459 -136
  303. data/vendor/libgit2/src/str.h +357 -0
  304. data/vendor/libgit2/src/strarray.c +2 -1
  305. data/vendor/libgit2/src/streams/mbedtls.c +22 -23
  306. data/vendor/libgit2/src/streams/mbedtls.h +1 -1
  307. data/vendor/libgit2/src/streams/openssl.c +101 -201
  308. data/vendor/libgit2/src/streams/openssl.h +9 -1
  309. data/vendor/libgit2/src/streams/openssl_dynamic.c +309 -0
  310. data/vendor/libgit2/src/streams/openssl_dynamic.h +348 -0
  311. data/vendor/libgit2/src/streams/openssl_legacy.c +203 -0
  312. data/vendor/libgit2/src/streams/openssl_legacy.h +63 -0
  313. data/vendor/libgit2/src/streams/registry.c +5 -6
  314. data/vendor/libgit2/src/streams/socket.c +6 -2
  315. data/vendor/libgit2/src/streams/stransport.c +6 -3
  316. data/vendor/libgit2/src/streams/tls.c +5 -3
  317. data/vendor/libgit2/src/submodule.c +290 -212
  318. data/vendor/libgit2/src/submodule.h +10 -10
  319. data/vendor/libgit2/src/sysdir.c +70 -56
  320. data/vendor/libgit2/src/sysdir.h +15 -10
  321. data/vendor/libgit2/src/tag.c +72 -34
  322. data/vendor/libgit2/src/thread.c +140 -0
  323. data/vendor/libgit2/src/thread.h +479 -0
  324. data/vendor/libgit2/src/threadstate.c +84 -0
  325. data/vendor/libgit2/src/threadstate.h +24 -0
  326. data/vendor/libgit2/src/trace.c +3 -16
  327. data/vendor/libgit2/src/trace.h +17 -30
  328. data/vendor/libgit2/src/trailer.c +2 -2
  329. data/vendor/libgit2/src/transaction.c +20 -9
  330. data/vendor/libgit2/src/transport.c +13 -13
  331. data/vendor/libgit2/src/transports/auth.c +8 -10
  332. data/vendor/libgit2/src/transports/auth.h +2 -3
  333. data/vendor/libgit2/src/transports/auth_negotiate.c +23 -17
  334. data/vendor/libgit2/src/transports/auth_ntlm.c +20 -16
  335. data/vendor/libgit2/src/transports/auth_ntlm.h +0 -1
  336. data/vendor/libgit2/src/transports/credential.c +15 -7
  337. data/vendor/libgit2/src/transports/git.c +10 -14
  338. data/vendor/libgit2/src/transports/http.c +56 -34
  339. data/vendor/libgit2/src/transports/http.h +3 -3
  340. data/vendor/libgit2/src/transports/httpclient.c +106 -79
  341. data/vendor/libgit2/src/transports/httpclient.h +1 -1
  342. data/vendor/libgit2/src/transports/local.c +127 -119
  343. data/vendor/libgit2/src/transports/smart.c +61 -144
  344. data/vendor/libgit2/src/transports/smart.h +26 -32
  345. data/vendor/libgit2/src/transports/smart_pkt.c +33 -33
  346. data/vendor/libgit2/src/transports/smart_protocol.c +68 -44
  347. data/vendor/libgit2/src/transports/ssh.c +100 -131
  348. data/vendor/libgit2/src/transports/winhttp.c +86 -82
  349. data/vendor/libgit2/src/tree-cache.c +5 -5
  350. data/vendor/libgit2/src/tree-cache.h +2 -2
  351. data/vendor/libgit2/src/tree.c +150 -116
  352. data/vendor/libgit2/src/tree.h +1 -0
  353. data/vendor/libgit2/src/tsort.c +0 -2
  354. data/vendor/libgit2/src/unix/map.c +3 -3
  355. data/vendor/libgit2/src/unix/posix.h +1 -4
  356. data/vendor/libgit2/src/unix/pthread.h +2 -1
  357. data/vendor/libgit2/src/unix/realpath.c +0 -2
  358. data/vendor/libgit2/src/utf8.c +150 -0
  359. data/vendor/libgit2/src/utf8.h +52 -0
  360. data/vendor/libgit2/src/util.c +68 -144
  361. data/vendor/libgit2/src/util.h +36 -68
  362. data/vendor/libgit2/src/vector.c +23 -19
  363. data/vendor/libgit2/src/vector.h +5 -3
  364. data/vendor/libgit2/src/win32/findfile.c +172 -114
  365. data/vendor/libgit2/src/win32/findfile.h +7 -4
  366. data/vendor/libgit2/src/win32/map.c +1 -1
  367. data/vendor/libgit2/src/win32/msvc-compat.h +9 -1
  368. data/vendor/libgit2/src/win32/path_w32.c +162 -33
  369. data/vendor/libgit2/src/win32/path_w32.h +2 -1
  370. data/vendor/libgit2/src/win32/posix.h +6 -7
  371. data/vendor/libgit2/src/win32/posix_w32.c +26 -33
  372. data/vendor/libgit2/src/win32/precompiled.h +0 -1
  373. data/vendor/libgit2/src/win32/reparse.h +4 -4
  374. data/vendor/libgit2/src/win32/thread.c +24 -15
  375. data/vendor/libgit2/src/win32/thread.h +1 -1
  376. data/vendor/libgit2/src/win32/w32_buffer.c +5 -6
  377. data/vendor/libgit2/src/win32/w32_buffer.h +2 -3
  378. data/vendor/libgit2/src/win32/w32_common.h +18 -9
  379. data/vendor/libgit2/src/win32/{w32_crtdbg_stacktrace.c → w32_leakcheck.c} +269 -33
  380. data/vendor/libgit2/src/win32/w32_leakcheck.h +222 -0
  381. data/vendor/libgit2/src/win32/w32_util.h +6 -6
  382. data/vendor/libgit2/src/worktree.c +138 -105
  383. data/vendor/libgit2/src/worktree.h +1 -1
  384. data/vendor/libgit2/src/xdiff/git-xdiff.h +53 -0
  385. data/vendor/libgit2/src/xdiff/xdiff.h +15 -15
  386. data/vendor/libgit2/src/xdiff/xdiffi.c +134 -108
  387. data/vendor/libgit2/src/xdiff/xemit.c +23 -7
  388. data/vendor/libgit2/src/xdiff/xhistogram.c +87 -78
  389. data/vendor/libgit2/src/xdiff/xinclude.h +1 -12
  390. data/vendor/libgit2/src/xdiff/xmerge.c +104 -117
  391. data/vendor/libgit2/src/xdiff/xpatience.c +6 -17
  392. data/vendor/libgit2/src/xdiff/xprepare.c +15 -20
  393. data/vendor/libgit2/src/xdiff/xutils.c +18 -7
  394. data/vendor/libgit2/src/zstream.c +6 -6
  395. data/vendor/libgit2/src/zstream.h +4 -4
  396. metadata +60 -24
  397. data/vendor/libgit2/src/allocators/win32_crtdbg.c +0 -118
  398. data/vendor/libgit2/src/buf_text.c +0 -316
  399. data/vendor/libgit2/src/buf_text.h +0 -122
  400. data/vendor/libgit2/src/buffer.h +0 -222
  401. data/vendor/libgit2/src/global.c +0 -363
  402. data/vendor/libgit2/src/global.h +0 -41
  403. data/vendor/libgit2/src/thread-utils.c +0 -58
  404. data/vendor/libgit2/src/thread-utils.h +0 -369
  405. data/vendor/libgit2/src/win32/w32_crtdbg_stacktrace.h +0 -127
  406. data/vendor/libgit2/src/win32/w32_stack.c +0 -188
  407. data/vendor/libgit2/src/win32/w32_stack.h +0 -140
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3a1ceba88401d9f47e851b97baaa27f2604baa0bb47ee81a4616e238c0706867
4
- data.tar.gz: 514e432c6e411dfe4e185e5cfcd831c5110cf7a1da819390de46045b01446ea3
3
+ metadata.gz: fd9e9d1521fe3c4ead7642651af0bbf071c2b076be3144458d8f11abc58a95b3
4
+ data.tar.gz: 4f1cfdbbd40ec1cf1061a62ee73265b2e3b51b4cdc076096ab90984fa284549d
5
5
  SHA512:
6
- metadata.gz: cb345a0ed8a223c30f86e0878b098d9e88b9d2b096bdb67b3b3fb9c82be6c8b9dd5677224f50b1d765032386eaa3926b331864af5b754bc175cd9a268fd939da
7
- data.tar.gz: 959b9bb61ab95c6f250a605984846577f74a1b33a9165ca1daa7641f8f1b507f239d5b17bfb4de01180c81eb1e7d3ff3ba5aa6aa40740cb0788753040e5d887d
6
+ metadata.gz: 8bb5a3504f11e676cfc01ae0212e8d0e67cd3bf79bf32e73f4d88662e15f1e6997b50ade4cc7cd4d453f55670d921fa00f2feeec17bbfc69e82e31323114a837
7
+ data.tar.gz: 3c1d68d25b56f587ab5e7532d077cc793feebed4d1d90d25b566c7969c326328d0c96d847f90774c2beb0b33de914b7887b0316a1960cd8620133bdc5e451449
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
@@ -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
 
@@ -98,12 +98,12 @@ else
98
98
  end
99
99
 
100
100
  Dir.chdir(LIBGIT2_DIR) do
101
- Dir.mkdir("build") if !Dir.exists?("build")
101
+ Dir.mkdir("build") if !Dir.exist?("build")
102
102
 
103
103
  Dir.chdir("build") do
104
104
  # On Windows, Ruby-DevKit is MSYS-based, so ensure to use MSYS Makefiles.
105
105
  generator = "-G \"MSYS Makefiles\"" if Gem.win_platform?
106
- run_cmake(5 * 60, ".. -DBUILD_CLAR=OFF -DTHREADSAFE=ON -DBUILD_SHARED_LIBS=OFF -DCMAKE_C_FLAGS=-fPIC -DCMAKE_BUILD_TYPE=RelWithDebInfo #{cmake_flags.join(' ')} #{generator}")
106
+ run_cmake(5 * 60, ".. -DBUILD_TESTS=OFF -DUSE_THREADS=ON -DBUILD_SHARED_LIBS=OFF -DCMAKE_C_FLAGS=-fPIC -DCMAKE_BUILD_TYPE=RelWithDebInfo #{cmake_flags.join(' ')} #{generator}")
107
107
  sys(MAKE)
108
108
 
109
109
  # "normal" libraries (and libgit2 builds) get all these when they build but we're doing it
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
 
@@ -181,17 +181,22 @@ static int cb_config__each_key(const git_config_entry *entry, void *payload)
181
181
  static int cb_config__each_pair(const git_config_entry *entry, void *payload)
182
182
  {
183
183
  int *exception = (int *) payload;
184
+ VALUE value;
184
185
 
185
- rb_protect(rb_yield, rb_ary_new3(2, rb_str_new_utf8(entry->name), rb_str_new_utf8(entry->value)), exception);
186
+ value = entry->value ? rb_str_new_utf8(entry->value) : Qnil;
187
+ rb_protect(rb_yield, rb_ary_new3(2, rb_str_new_utf8(entry->name), value), exception);
186
188
 
187
189
  return (*exception != 0) ? GIT_EUSER : GIT_OK;
188
190
  }
189
191
 
190
192
  static int cb_config__to_hash(const git_config_entry *entry, void *opaque)
191
193
  {
194
+ VALUE value;
195
+
196
+ value = entry->value ? rb_str_new_utf8(entry->value) : Qnil;
192
197
  rb_hash_aset((VALUE)opaque,
193
198
  rb_str_new_utf8(entry->name),
194
- rb_str_new_utf8(entry->value)
199
+ value
195
200
  );
196
201
 
197
202
  return GIT_OK;
@@ -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);
@@ -219,6 +219,17 @@ static void init_proxy_options(VALUE rb_options, git_proxy_options *proxy_option
219
219
  }
220
220
  }
221
221
 
222
+ static void init_pb_parallelism(VALUE rb_options, git_push_options *opts)
223
+ {
224
+ if (NIL_P(rb_options)) return;
225
+
226
+ VALUE val = rb_hash_aref(rb_options, CSTR2SYM("pb_parallelism"));
227
+ if (!NIL_P(val)) {
228
+ Check_Type(val, T_FIXNUM);
229
+ opts->pb_parallelism = FIX2UINT(val);
230
+ }
231
+ }
232
+
222
233
  static int parse_prune_type(VALUE rb_prune_type)
223
234
  {
224
235
  if (rb_prune_type == Qtrue) {
@@ -683,6 +694,11 @@ static VALUE rb_git_remote_fetch(int argc, VALUE *argv, VALUE self)
683
694
  * :proxy_url ::
684
695
  * The url of an http proxy to use to access the remote repository.
685
696
  *
697
+ * :pb_parallelism ::
698
+ * Sets the number of worker threads that will be available to the packbuilder when generating
699
+ * a pack file, if required by the transport being used. A value of 0 means the packbuilder will
700
+ * auto-detect the number of of threads to use.
701
+ *
686
702
  * Example:
687
703
  *
688
704
  * remote = Rugged::Remote.lookup(@repo, 'origin')
@@ -709,6 +725,7 @@ static VALUE rb_git_remote_push(int argc, VALUE *argv, VALUE self)
709
725
  rugged_remote_init_callbacks_and_payload_from_options(rb_options, &opts.callbacks, &payload);
710
726
  init_custom_headers(rb_options, &opts.custom_headers);
711
727
  init_proxy_options(rb_options, &opts.proxy_opts);
728
+ init_pb_parallelism(rb_options, &opts);
712
729
 
713
730
  error = git_remote_push(remote, &refspecs, &opts);
714
731
 
@@ -1460,8 +1460,8 @@ static VALUE rb_git_repo_is_shallow(VALUE self)
1460
1460
  * call-seq:
1461
1461
  * repo.empty? -> true or false
1462
1462
  *
1463
- * Return whether a repository is empty or not. An empty repository has just
1464
- * 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.
1465
1465
  */
1466
1466
  static VALUE rb_git_repo_is_empty(VALUE self)
1467
1467
  {
@@ -2845,7 +2845,7 @@ void Init_rugged_repo(void)
2845
2845
  rb_define_method(rb_cRuggedRepo, "cherrypick_commit", rb_git_repo_cherrypick_commit, -1);
2846
2846
  rb_define_method(rb_cRuggedRepo, "fetch_attributes", rb_git_repo_attributes, -1);
2847
2847
 
2848
- rb_cRuggedOdbObject = rb_define_class_under(rb_mRugged, "OdbObject", rb_cData);
2848
+ rb_cRuggedOdbObject = rb_define_class_under(rb_mRugged, "OdbObject", rb_cObject);
2849
2849
  rb_define_method(rb_cRuggedOdbObject, "data", rb_git_odbobj_data, 0);
2850
2850
  rb_define_method(rb_cRuggedOdbObject, "len", rb_git_odbobj_size, 0);
2851
2851
  rb_define_method(rb_cRuggedOdbObject, "type", rb_git_odbobj_type, 0);
@@ -263,12 +263,12 @@ module Rugged
263
263
  #
264
264
  # Returns a hash containing the pushed refspecs as keys and
265
265
  # any error messages or +nil+ as values.
266
- def push(remote_or_url, *args)
266
+ def push(remote_or_url, *args, **kwargs)
267
267
  unless remote_or_url.kind_of? Remote
268
268
  remote_or_url = remotes[remote_or_url] || remotes.create_anonymous(remote_or_url)
269
269
  end
270
270
 
271
- remote_or_url.push(*args)
271
+ remote_or_url.push(*args, **kwargs)
272
272
  end
273
273
  end
274
274
  end
@@ -4,5 +4,5 @@
4
4
  # For full terms see the included LICENSE file.
5
5
 
6
6
  module Rugged
7
- Version = VERSION = '1.1.1'
7
+ Version = VERSION = '1.4.3'
8
8
  end
@@ -1,301 +1,133 @@
1
1
  # CMake build script for the libgit2 project
2
- #
3
- # Building (out of source build):
4
- # > mkdir build && cd build
5
- # > cmake .. [-DSETTINGS=VALUE]
6
- # > cmake --build .
7
- #
8
- # Testing:
9
- # > ctest -V
10
- #
11
- # Install:
12
- # > cmake --build . --target install
2
+ # See `README.md` for build instructions.
13
3
 
14
- CMAKE_MINIMUM_REQUIRED(VERSION 3.5.1)
4
+ cmake_minimum_required(VERSION 3.5.1)
15
5
 
16
- project(libgit2 VERSION "1.1.1" LANGUAGES C)
6
+ project(libgit2 VERSION "1.4.3" LANGUAGES C)
17
7
 
18
8
  # Add find modules to the path
19
- set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${libgit2_SOURCE_DIR}/cmake/")
20
-
21
- INCLUDE(CheckLibraryExists)
22
- INCLUDE(CheckFunctionExists)
23
- INCLUDE(CheckSymbolExists)
24
- INCLUDE(CheckStructHasMember)
25
- INCLUDE(CheckPrototypeDefinition) # Added in CMake 3.0
26
- INCLUDE(AddCFlagIfSupported)
27
- INCLUDE(FindPkgLibraries)
28
- INCLUDE(FindThreads)
29
- INCLUDE(FindStatNsec)
30
- INCLUDE(GNUInstallDirs)
31
- INCLUDE(IdeSplitSources)
32
- INCLUDE(FeatureSummary)
33
- INCLUDE(EnableWarnings)
9
+ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/cmake")
34
10
 
11
+ #
35
12
  # Build options
36
13
  #
37
- OPTION(SONAME "Set the (SO)VERSION of the target" ON)
38
- OPTION(BUILD_SHARED_LIBS "Build Shared Library (OFF for Static)" ON)
39
- OPTION(THREADSAFE "Build libgit2 as threadsafe" ON)
40
- OPTION(BUILD_CLAR "Build Tests using the Clar suite" ON)
41
- OPTION(BUILD_EXAMPLES "Build library usage example apps" OFF)
42
- OPTION(BUILD_FUZZERS "Build the fuzz targets" OFF)
43
- OPTION(ENABLE_TRACE "Enables tracing support" ON)
44
- OPTION(LIBGIT2_FILENAME "Name of the produced binary" OFF)
45
- OPTION(USE_SSH "Link with libssh2 to enable SSH support" ON)
46
- OPTION(USE_HTTPS "Enable HTTPS support. Can be set to a specific backend" ON)
47
- OPTION(USE_SHA1 "Enable SHA1. Can be set to CollisionDetection(ON)/HTTPS/Generic" ON)
48
- OPTION(USE_GSSAPI "Link with libgssapi for SPNEGO auth" OFF)
49
- OPTION(USE_STANDALONE_FUZZERS "Enable standalone fuzzers (compatible with gcc)" OFF)
50
- OPTION(USE_LEAK_CHECKER "Run tests with leak checker" OFF)
51
- OPTION(DEBUG_POOL "Enable debug pool allocator" OFF)
52
- OPTION(ENABLE_WERROR "Enable compilation with -Werror" OFF)
53
- OPTION(USE_BUNDLED_ZLIB "Use the bundled version of zlib" OFF)
54
- SET(USE_HTTP_PARSER "" CACHE STRING "Specifies the HTTP Parser implementation; either system or builtin.")
55
- OPTION(DEPRECATE_HARD "Do not include deprecated functions in the library" OFF)
56
- SET(REGEX_BACKEND "" CACHE STRING "Regular expression implementation. One of regcomp_l, pcre2, pcre, regcomp, or builtin.")
57
14
 
58
- IF (UNIX)
59
- IF (NOT USE_HTTPS)
60
- OPTION(USE_NTLMCLIENT "Enable NTLM support on Unix." OFF )
61
- ELSE()
62
- OPTION(USE_NTLMCLIENT "Enable NTLM support on Unix." ON )
63
- ENDIF()
64
- ENDIF()
15
+ # Optional subsystems
16
+ option(BUILD_SHARED_LIBS "Build Shared Library (OFF for Static)" ON)
17
+ option(BUILD_TESTS "Build Tests using the Clar suite" ON)
18
+ option(BUILD_EXAMPLES "Build library usage example apps" OFF)
19
+ option(BUILD_FUZZERS "Build the fuzz targets" OFF)
20
+
21
+ # Suggested functionality that may not be available on a per-platform basis
22
+ option(USE_THREADS "Use threads for parallel processing when possible" ON)
23
+ option(USE_NSEC "Support nanosecond precision file mtimes and ctimes" ON)
24
+
25
+ # Backend selection
26
+ option(USE_SSH "Link with libssh2 to enable SSH support" OFF)
27
+ option(USE_HTTPS "Enable HTTPS support. Can be set to a specific backend" ON)
28
+ option(USE_SHA1 "Enable SHA1. Can be set to CollisionDetection(ON)/HTTPS/Generic" ON)
29
+ option(USE_GSSAPI "Link with libgssapi for SPNEGO auth" OFF)
30
+ set(USE_HTTP_PARSER "" CACHE STRING "Specifies the HTTP Parser implementation; either system or builtin.")
31
+ set(REGEX_BACKEND "" CACHE STRING "Regular expression implementation. One of regcomp_l, pcre2, pcre, regcomp, or builtin.")
32
+ 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)
33
+
34
+ # Debugging options
35
+ option(USE_LEAK_CHECKER "Run tests with leak checker" OFF)
36
+ option(USE_STANDALONE_FUZZERS "Enable standalone fuzzers (compatible with gcc)" OFF)
37
+ option(DEBUG_POOL "Enable debug pool allocator" OFF)
38
+ option(DEBUG_STRICT_ALLOC "Enable strict allocator behavior" OFF)
39
+ option(DEBUG_STRICT_OPEN "Enable path validation in open" OFF)
40
+
41
+ # Output options
42
+ option(SONAME "Set the (SO)VERSION of the target" ON)
43
+ set(LIBGIT2_FILENAME "git2" CACHE STRING "Name of the produced binary")
44
+ option(DEPRECATE_HARD "Do not include deprecated functions in the library" OFF)
45
+
46
+ # Compilation options
47
+ option(ENABLE_WERROR "Enable compilation with -Werror" OFF)
48
+
49
+ if(UNIX)
50
+ # NTLM client requires crypto libraries from the system HTTPS stack
51
+ if(NOT USE_HTTPS)
52
+ option(USE_NTLMCLIENT "Enable NTLM support on Unix." OFF)
53
+ else()
54
+ option(USE_NTLMCLIENT "Enable NTLM support on Unix." ON)
55
+ endif()
65
56
 
66
- IF (UNIX AND NOT APPLE)
67
- OPTION(ENABLE_REPRODUCIBLE_BUILDS "Enable reproducible builds" OFF)
68
- ENDIF()
57
+ option(ENABLE_REPRODUCIBLE_BUILDS "Enable reproducible builds" OFF)
58
+ endif()
69
59
 
70
- IF (APPLE)
71
- OPTION(USE_ICONV "Link with and use iconv library" ON)
72
- ENDIF()
60
+ if(APPLE)
61
+ option(USE_ICONV "Link with and use iconv library" ON)
62
+ endif()
73
63
 
74
- IF(MSVC)
64
+ if(MSVC)
75
65
  # This option must match the settings used in your program, in particular if you
76
66
  # are linking statically
77
- OPTION(STATIC_CRT "Link the static CRT libraries" ON)
67
+ option(STATIC_CRT "Link the static CRT libraries" ON)
78
68
 
79
69
  # If you want to embed a copy of libssh2 into libgit2, pass a
80
70
  # path to libssh2
81
- OPTION(EMBED_SSH_PATH "Path to libssh2 to embed (Windows)" OFF)
82
- ENDIF()
71
+ option(EMBED_SSH_PATH "Path to libssh2 to embed (Windows)" OFF)
83
72
 
73
+ # Enable leak checking using the debugging C runtime.
74
+ option(WIN32_LEAKCHECK "Enable leak reporting via crtdbg" OFF)
75
+ endif()
84
76
 
85
- IF(WIN32)
77
+ if(WIN32)
86
78
  # By default, libgit2 is built with WinHTTP. To use the built-in
87
- # HTTP transport, invoke CMake with the "-DWINHTTP=OFF" argument.
88
- OPTION(WINHTTP "Use Win32 WinHTTP routines" ON)
89
- ENDIF()
90
-
91
- IF(MSVC)
92
- # Enable MSVC CRTDBG memory leak reporting when in debug mode.
93
- OPTION(MSVC_CRTDBG "Enable CRTDBG memory leak reporting" OFF)
94
- ENDIF()
95
-
96
- IF (DEPRECATE_HARD)
97
- ADD_DEFINITIONS(-DGIT_DEPRECATE_HARD)
98
- ENDIF()
99
-
100
- # Platform specific compilation flags
101
- IF (MSVC)
102
- IF (STDCALL)
103
- MESSAGE(FATAL_ERROR "The STDCALL option is no longer supported; libgit2 is now always built as a cdecl library. If you're using PInvoke, please add the CallingConventions.Cdecl attribute for support.")
104
- ENDIF()
105
-
106
- ADD_DEFINITIONS(-D_SCL_SECURE_NO_WARNINGS)
107
- ADD_DEFINITIONS(-D_CRT_SECURE_NO_DEPRECATE)
108
- ADD_DEFINITIONS(-D_CRT_NONSTDC_NO_DEPRECATE)
109
-
110
- STRING(REPLACE "/Zm1000" " " CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
111
-
112
- # /GF - String pooling
113
- # /MP - Parallel build
114
- SET(CMAKE_C_FLAGS "/GF /MP /nologo ${CMAKE_C_FLAGS}")
115
-
116
- # /Gd - explicitly set cdecl calling convention
117
- SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /Gd")
118
-
119
- IF (NOT (MSVC_VERSION LESS 1900))
120
- # /guard:cf - Enable Control Flow Guard
121
- SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /guard:cf")
122
- ENDIF()
123
-
124
- IF (STATIC_CRT)
125
- SET(CRT_FLAG_DEBUG "/MTd")
126
- SET(CRT_FLAG_RELEASE "/MT")
127
- ELSE()
128
- SET(CRT_FLAG_DEBUG "/MDd")
129
- SET(CRT_FLAG_RELEASE "/MD")
130
- ENDIF()
131
-
132
- IF (MSVC_CRTDBG)
133
- SET(GIT_MSVC_CRTDBG 1)
134
- SET(CRT_FLAG_DEBUG "${CRT_FLAG_DEBUG}")
135
- SET(CMAKE_C_STANDARD_LIBRARIES "${CMAKE_C_STANDARD_LIBRARIES} Dbghelp.lib")
136
- ENDIF()
137
-
138
- # /Zi - Create debugging information
139
- # /Od - Disable optimization
140
- # /D_DEBUG - #define _DEBUG
141
- # /MTd - Statically link the multithreaded debug version of the CRT
142
- # /MDd - Dynamically link the multithreaded debug version of the CRT
143
- # /RTC1 - Run time checks
144
- SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /Zi /Od /D_DEBUG /RTC1 ${CRT_FLAG_DEBUG}")
145
-
146
- # /DNDEBUG - Disables asserts
147
- # /MT - Statically link the multithreaded release version of the CRT
148
- # /MD - Dynamically link the multithreaded release version of the CRT
149
- # /O2 - Optimize for speed
150
- # /Oy - Enable frame pointer omission (FPO) (otherwise CMake will automatically turn it off)
151
- # /GL - Link time code generation (whole program optimization)
152
- # /Gy - Function-level linking
153
- SET(CMAKE_C_FLAGS_RELEASE "/DNDEBUG /O2 /Oy /GL /Gy ${CRT_FLAG_RELEASE}")
79
+ # HTTP transport, invoke CMake with the "-DUSE_WINHTTP=OFF" argument.
80
+ option(USE_WINHTTP "Use Win32 WinHTTP routines" ON)
81
+ endif()
82
+
83
+ if(NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE)
84
+ set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel." FORCE)
85
+ endif()
86
+
87
+
88
+ # Modules
89
+
90
+ include(CheckLibraryExists)
91
+ include(CheckFunctionExists)
92
+ include(CheckSymbolExists)
93
+ include(CheckStructHasMember)
94
+ include(CheckPrototypeDefinition)
95
+ include(AddCFlagIfSupported)
96
+ include(FindPkgLibraries)
97
+ include(FindThreads)
98
+ include(FindStatNsec)
99
+ include(Findfutimens)
100
+ include(GNUInstallDirs)
101
+ include(IdeSplitSources)
102
+ include(FeatureSummary)
103
+ include(EnableWarnings)
104
+ include(DefaultCFlags)
154
105
 
155
- # /Oy- - Disable frame pointer omission (FPO)
156
- SET(CMAKE_C_FLAGS_RELWITHDEBINFO "/DNDEBUG /Zi /O2 /Oy- /GL /Gy ${CRT_FLAG_RELEASE}")
157
106
 
158
- # /O1 - Optimize for size
159
- SET(CMAKE_C_FLAGS_MINSIZEREL "/DNDEBUG /O1 /Oy /GL /Gy ${CRT_FLAG_RELEASE}")
160
-
161
- # /IGNORE:4221 - Ignore empty compilation units
162
- SET(CMAKE_STATIC_LINKER_FLAGS "/IGNORE:4221")
163
-
164
- # /DYNAMICBASE - Address space load randomization (ASLR)
165
- # /NXCOMPAT - Data execution prevention (DEP)
166
- # /LARGEADDRESSAWARE - >2GB user address space on x86
167
- # /VERSION - Embed version information in PE header
168
- SET(CMAKE_EXE_LINKER_FLAGS "/DYNAMICBASE /NXCOMPAT /LARGEADDRESSAWARE /VERSION:${libgit2_VERSION_MAJOR}.${libgit2_VERSION_MINOR}")
169
-
170
- IF (NOT (MSVC_VERSION LESS 1900))
171
- # /GUARD:CF - Enable Control Flow Guard
172
- SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /GUARD:CF")
173
- ENDIF()
174
-
175
- # /DEBUG - Create a PDB
176
- # /LTCG - Link time code generation (whole program optimization)
177
- # /OPT:REF /OPT:ICF - Fold out duplicate code at link step
178
- # /INCREMENTAL:NO - Required to use /LTCG
179
- # /DEBUGTYPE:cv,fixup - Additional data embedded in the PDB (requires /INCREMENTAL:NO, so not on for Debug)
180
- SET(CMAKE_EXE_LINKER_FLAGS_DEBUG "/DEBUG")
181
- SET(CMAKE_EXE_LINKER_FLAGS_RELEASE "/RELEASE /LTCG /OPT:REF /OPT:ICF /INCREMENTAL:NO")
182
- SET(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "/DEBUG /RELEASE /LTCG /OPT:REF /OPT:ICF /INCREMENTAL:NO /DEBUGTYPE:cv,fixup")
183
- SET(CMAKE_EXE_LINKER_FLAGS_MINSIZEREL "/RELEASE /LTCG /OPT:REF /OPT:ICF /INCREMENTAL:NO")
184
-
185
- # Same linker settings for DLL as EXE
186
- SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}")
187
- SET(CMAKE_SHARED_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG}")
188
- SET(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE}")
189
- SET(CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO}")
190
- SET(CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL "${CMAKE_EXE_LINKER_FLAGS_MINSIZEREL}")
191
- ELSE ()
192
- IF (ENABLE_REPRODUCIBLE_BUILDS)
193
- SET(CMAKE_C_ARCHIVE_CREATE "<CMAKE_AR> Dqc <TARGET> <LINK_FLAGS> <OBJECTS>")
194
- SET(CMAKE_C_ARCHIVE_APPEND "<CMAKE_AR> Dq <TARGET> <LINK_FLAGS> <OBJECTS>")
195
- SET(CMAKE_C_ARCHIVE_FINISH "<CMAKE_RANLIB> -D <TARGET>")
196
- ENDIF()
197
-
198
- SET(CMAKE_C_FLAGS "-D_GNU_SOURCE ${CMAKE_C_FLAGS}")
199
-
200
- ENABLE_WARNINGS(all)
201
- ENABLE_WARNINGS(extra)
202
-
203
- IF (CMAKE_SYSTEM_NAME MATCHES "(Solaris|SunOS)")
204
- SET(CMAKE_C_FLAGS "-D_POSIX_C_SOURCE=200112L -D__EXTENSIONS__ -D_POSIX_PTHREAD_SEMANTICS ${CMAKE_C_FLAGS}")
205
- ENDIF()
206
-
207
- SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D_DEBUG -O0")
208
-
209
- IF (MINGW OR MSYS) # MinGW and MSYS always do PIC and complain if we tell them to
210
- STRING(REGEX REPLACE "-fPIC" "" CMAKE_SHARED_LIBRARY_C_FLAGS "${CMAKE_SHARED_LIBRARY_C_FLAGS}")
211
- ELSEIF (BUILD_SHARED_LIBS)
212
- ADD_C_FLAG_IF_SUPPORTED(-fvisibility=hidden)
107
+ #
108
+ # Subdirectories
109
+ #
213
110
 
214
- SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
215
- ENDIF ()
111
+ add_subdirectory(src)
216
112
 
217
- IF (MINGW)
218
- # MinGW >= 3.14 uses the C99-style stdio functions
219
- # automatically, but forks like mingw-w64 still want
220
- # us to define this in order to use them
221
- ADD_DEFINITIONS(-D__USE_MINGW_ANSI_STDIO=1)
222
- ENDIF ()
113
+ if(BUILD_TESTS)
114
+ enable_testing()
115
+ add_subdirectory(tests)
116
+ endif()
223
117
 
224
- enable_warnings(documentation)
225
- disable_warnings(documentation-deprecated-sync)
226
- disable_warnings(missing-field-initializers)
227
- enable_warnings(strict-aliasing)
228
- enable_warnings(strict-prototypes)
229
- enable_warnings(declaration-after-statement)
230
- enable_warnings(shift-count-overflow)
231
- enable_warnings(unused-const-variable)
232
- enable_warnings(unused-function)
233
- enable_warnings(int-conversion)
118
+ if(BUILD_EXAMPLES)
119
+ add_subdirectory(examples)
120
+ endif()
234
121
 
235
- # MinGW uses gcc, which expects POSIX formatting for printf, but
236
- # uses the Windows C library, which uses its own format specifiers.
237
- # Disable format specifier warnings.
238
- if(MINGW)
239
- disable_warnings(format)
240
- disable_warnings(format-security)
241
- else()
242
- enable_warnings(format)
243
- enable_warnings(format-security)
122
+ if(BUILD_FUZZERS)
123
+ if((BUILD_TESTS OR BUILD_EXAMPLES) AND NOT USE_STANDALONE_FUZZERS)
124
+ message(FATAL_ERROR "Cannot build the fuzzer and the tests or examples together")
244
125
  endif()
245
- ENDIF()
246
-
247
- # Ensure that MinGW provides the correct header files.
248
- IF (WIN32 AND NOT CYGWIN)
249
- ADD_DEFINITIONS(-DWIN32 -D_WIN32_WINNT=0x0600)
250
- ENDIF()
251
-
252
- IF( NOT CMAKE_CONFIGURATION_TYPES )
253
- # Build Debug by default
254
- IF (NOT CMAKE_BUILD_TYPE)
255
- SET(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel." FORCE)
256
- ENDIF ()
257
- ELSE()
258
- # Using a multi-configuration generator eg MSVC or Xcode
259
- # that uses CMAKE_CONFIGURATION_TYPES and not CMAKE_BUILD_TYPE
260
- ENDIF()
261
-
262
- IF(BUILD_FUZZERS AND NOT USE_STANDALONE_FUZZERS)
263
- # The actual sanitizer link target will be added when linking the fuzz
264
- # targets.
265
- SET(CMAKE_REQUIRED_FLAGS "-fsanitize=fuzzer-no-link")
266
- ADD_C_FLAG(-fsanitize=fuzzer-no-link)
267
- UNSET(CMAKE_REQUIRED_FLAGS)
268
- ENDIF ()
269
-
270
- ADD_SUBDIRECTORY(src)
271
-
272
- # Tests
273
- IF (NOT MSVC)
274
- IF (NOT BUILD_SHARED_LIBS)
275
- SET(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
276
- ENDIF()
277
- ENDIF ()
278
-
279
- IF (BUILD_CLAR)
280
- ENABLE_TESTING()
281
- ADD_SUBDIRECTORY(tests)
282
- ENDIF ()
126
+ add_subdirectory(fuzzers)
127
+ endif()
283
128
 
284
- IF (BUILD_EXAMPLES)
285
- ADD_SUBDIRECTORY(examples)
286
- ENDIF ()
287
129
 
288
- IF(BUILD_FUZZERS)
289
- IF(NOT USE_STANDALONE_FUZZERS)
290
- IF(BUILD_EXAMPLES)
291
- MESSAGE(FATAL_ERROR "Cannot build the fuzzer targets and the examples together")
292
- ENDIF()
293
- IF(BUILD_CLAR)
294
- MESSAGE(FATAL_ERROR "Cannot build the fuzzer targets and the tests together")
295
- ENDIF()
296
- ENDIF()
297
- ADD_SUBDIRECTORY(fuzzers)
298
- ENDIF()
130
+ # Summary
299
131
 
300
- FEATURE_SUMMARY(WHAT ENABLED_FEATURES DESCRIPTION "Enabled features:")
301
- FEATURE_SUMMARY(WHAT DISABLED_FEATURES DESCRIPTION "Disabled features:")
132
+ feature_summary(WHAT ENABLED_FEATURES DESCRIPTION "Enabled features:")
133
+ feature_summary(WHAT DISABLED_FEATURES DESCRIPTION "Disabled features:")