rugged 0.26.7 → 0.27.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (341) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -2
  3. data/ext/rugged/rugged_blame.c +6 -3
  4. data/ext/rugged/rugged_branch_collection.c +3 -6
  5. data/ext/rugged/rugged_commit.c +56 -0
  6. data/ext/rugged/rugged_config.c +44 -9
  7. data/ext/rugged/rugged_diff.c +3 -14
  8. data/ext/rugged/rugged_diff_hunk.c +1 -3
  9. data/ext/rugged/rugged_index.c +1 -5
  10. data/ext/rugged/rugged_note.c +1 -4
  11. data/ext/rugged/rugged_patch.c +1 -4
  12. data/ext/rugged/rugged_reference_collection.c +1 -7
  13. data/ext/rugged/rugged_remote.c +5 -8
  14. data/ext/rugged/rugged_remote_collection.c +1 -6
  15. data/ext/rugged/rugged_repo.c +16 -48
  16. data/ext/rugged/rugged_revwalk.c +7 -16
  17. data/ext/rugged/rugged_settings.c +28 -0
  18. data/ext/rugged/rugged_submodule_collection.c +3 -4
  19. data/ext/rugged/rugged_tag_collection.c +1 -5
  20. data/ext/rugged/rugged_tree.c +2 -3
  21. data/lib/rugged/repository.rb +43 -0
  22. data/lib/rugged/version.rb +1 -1
  23. data/vendor/libgit2/AUTHORS +1 -0
  24. data/vendor/libgit2/CMakeLists.txt +61 -510
  25. data/vendor/libgit2/cmake/Modules/EnableWarnings.cmake +14 -0
  26. data/vendor/libgit2/cmake/Modules/FindCoreFoundation.cmake +25 -8
  27. data/vendor/libgit2/cmake/Modules/FindSecurity.cmake +27 -8
  28. data/vendor/libgit2/cmake/Modules/FindStatNsec.cmake +20 -0
  29. data/vendor/libgit2/cmake/Modules/IdeSplitSources.cmake +22 -0
  30. data/vendor/libgit2/deps/http-parser/CMakeLists.txt +3 -0
  31. data/vendor/libgit2/deps/regex/CMakeLists.txt +2 -0
  32. data/vendor/libgit2/deps/winhttp/CMakeLists.txt +26 -0
  33. data/vendor/libgit2/deps/zlib/CMakeLists.txt +4 -0
  34. data/vendor/libgit2/include/git2/config.h +29 -2
  35. data/vendor/libgit2/include/git2/describe.h +1 -1
  36. data/vendor/libgit2/include/git2/diff.h +59 -8
  37. data/vendor/libgit2/include/git2/graph.h +3 -0
  38. data/vendor/libgit2/include/git2/merge.h +6 -0
  39. data/vendor/libgit2/include/git2/message.h +43 -3
  40. data/vendor/libgit2/include/git2/notes.h +89 -0
  41. data/vendor/libgit2/include/git2/odb.h +8 -1
  42. data/vendor/libgit2/include/git2/patch.h +2 -2
  43. data/vendor/libgit2/include/git2/pathspec.h +35 -18
  44. data/vendor/libgit2/include/git2/refs.h +3 -0
  45. data/vendor/libgit2/include/git2/remote.h +34 -4
  46. data/vendor/libgit2/include/git2/repository.h +6 -6
  47. data/vendor/libgit2/include/git2/reset.h +4 -4
  48. data/vendor/libgit2/include/git2/status.h +4 -0
  49. data/vendor/libgit2/include/git2/sys/config.h +4 -1
  50. data/vendor/libgit2/include/git2/sys/odb_backend.h +2 -1
  51. data/vendor/libgit2/include/git2/tree.h +4 -3
  52. data/vendor/libgit2/include/git2/types.h +1 -0
  53. data/vendor/libgit2/include/git2/version.h +4 -4
  54. data/vendor/libgit2/include/git2/worktree.h +1 -1
  55. data/vendor/libgit2/src/CMakeLists.txt +463 -0
  56. data/vendor/libgit2/src/annotated_commit.c +1 -1
  57. data/vendor/libgit2/src/annotated_commit.h +2 -0
  58. data/vendor/libgit2/src/apply.c +2 -1
  59. data/vendor/libgit2/src/apply.h +2 -0
  60. data/vendor/libgit2/src/attr.c +24 -4
  61. data/vendor/libgit2/src/attr.h +2 -0
  62. data/vendor/libgit2/src/attr_file.c +9 -2
  63. data/vendor/libgit2/src/attr_file.h +2 -0
  64. data/vendor/libgit2/src/attrcache.c +9 -1
  65. data/vendor/libgit2/src/attrcache.h +2 -0
  66. data/vendor/libgit2/src/blame.c +1 -0
  67. data/vendor/libgit2/src/blame.h +2 -1
  68. data/vendor/libgit2/src/blame_git.c +1 -0
  69. data/vendor/libgit2/src/blame_git.h +2 -0
  70. data/vendor/libgit2/src/blob.c +2 -2
  71. data/vendor/libgit2/src/blob.h +2 -0
  72. data/vendor/libgit2/src/branch.c +8 -1
  73. data/vendor/libgit2/src/branch.h +2 -0
  74. data/vendor/libgit2/src/buf_text.c +7 -7
  75. data/vendor/libgit2/src/buf_text.h +3 -3
  76. data/vendor/libgit2/src/buffer.c +31 -1
  77. data/vendor/libgit2/src/buffer.h +3 -0
  78. data/vendor/libgit2/src/cache.c +2 -2
  79. data/vendor/libgit2/src/cache.h +2 -0
  80. data/vendor/libgit2/src/cc-compat.h +3 -3
  81. data/vendor/libgit2/src/checkout.c +30 -19
  82. data/vendor/libgit2/src/checkout.h +2 -0
  83. data/vendor/libgit2/src/cherrypick.c +1 -0
  84. data/vendor/libgit2/src/clone.c +2 -1
  85. data/vendor/libgit2/src/clone.h +4 -0
  86. data/vendor/libgit2/src/commit.c +2 -1
  87. data/vendor/libgit2/src/commit.h +2 -0
  88. data/vendor/libgit2/src/commit_list.c +1 -1
  89. data/vendor/libgit2/src/commit_list.h +2 -0
  90. data/vendor/libgit2/src/common.h +11 -5
  91. data/vendor/libgit2/src/config.c +12 -10
  92. data/vendor/libgit2/src/config.h +2 -0
  93. data/vendor/libgit2/src/config_cache.c +1 -0
  94. data/vendor/libgit2/src/config_file.c +287 -786
  95. data/vendor/libgit2/src/config_file.h +4 -3
  96. data/vendor/libgit2/src/config_parse.c +525 -0
  97. data/vendor/libgit2/src/config_parse.h +64 -0
  98. data/vendor/libgit2/src/crlf.c +2 -1
  99. data/vendor/libgit2/src/delta.c +28 -30
  100. data/vendor/libgit2/src/delta.h +1 -0
  101. data/vendor/libgit2/src/describe.c +3 -1
  102. data/vendor/libgit2/src/diff.c +148 -2
  103. data/vendor/libgit2/src/diff.h +3 -1
  104. data/vendor/libgit2/src/diff_driver.c +12 -9
  105. data/vendor/libgit2/src/diff_driver.h +4 -1
  106. data/vendor/libgit2/src/diff_file.c +7 -4
  107. data/vendor/libgit2/src/diff_file.h +1 -0
  108. data/vendor/libgit2/src/diff_generate.c +6 -3
  109. data/vendor/libgit2/src/diff_generate.h +6 -1
  110. data/vendor/libgit2/src/diff_parse.c +5 -4
  111. data/vendor/libgit2/src/diff_parse.h +2 -0
  112. data/vendor/libgit2/src/diff_print.c +2 -0
  113. data/vendor/libgit2/src/diff_stats.c +2 -0
  114. data/vendor/libgit2/src/diff_tform.c +2 -1
  115. data/vendor/libgit2/src/diff_tform.h +4 -1
  116. data/vendor/libgit2/src/diff_xdiff.c +5 -2
  117. data/vendor/libgit2/src/diff_xdiff.h +2 -0
  118. data/vendor/libgit2/src/errors.c +2 -0
  119. data/vendor/libgit2/src/features.h.in +36 -0
  120. data/vendor/libgit2/src/fetch.c +2 -2
  121. data/vendor/libgit2/src/fetch.h +4 -0
  122. data/vendor/libgit2/src/fetchhead.c +3 -3
  123. data/vendor/libgit2/src/fetchhead.h +3 -0
  124. data/vendor/libgit2/src/filebuf.c +2 -1
  125. data/vendor/libgit2/src/filebuf.h +2 -0
  126. data/vendor/libgit2/src/fileops.c +12 -1
  127. data/vendor/libgit2/src/fileops.h +7 -1
  128. data/vendor/libgit2/src/filter.c +2 -1
  129. data/vendor/libgit2/src/filter.h +1 -0
  130. data/vendor/libgit2/src/fnmatch.c +2 -2
  131. data/vendor/libgit2/src/fnmatch.h +3 -4
  132. data/vendor/libgit2/src/global.c +4 -3
  133. data/vendor/libgit2/src/global.h +1 -5
  134. data/vendor/libgit2/src/graph.c +2 -0
  135. data/vendor/libgit2/src/hash.c +0 -1
  136. data/vendor/libgit2/src/hash.h +3 -1
  137. data/vendor/libgit2/src/hash/hash_collisiondetect.h +3 -3
  138. data/vendor/libgit2/src/hash/hash_common_crypto.h +18 -5
  139. data/vendor/libgit2/src/hash/hash_generic.c +2 -2
  140. data/vendor/libgit2/src/hash/hash_generic.h +5 -3
  141. data/vendor/libgit2/src/hash/hash_openssl.h +3 -3
  142. data/vendor/libgit2/src/hash/hash_win32.c +57 -14
  143. data/vendor/libgit2/src/hash/hash_win32.h +4 -3
  144. data/vendor/libgit2/src/hashsig.c +3 -0
  145. data/vendor/libgit2/src/ident.c +2 -0
  146. data/vendor/libgit2/src/idxmap.h +2 -1
  147. data/vendor/libgit2/src/ignore.c +14 -2
  148. data/vendor/libgit2/src/ignore.h +2 -0
  149. data/vendor/libgit2/src/index.c +20 -40
  150. data/vendor/libgit2/src/index.h +2 -0
  151. data/vendor/libgit2/src/indexer.c +13 -5
  152. data/vendor/libgit2/src/indexer.h +5 -1
  153. data/vendor/libgit2/src/integer.h +1 -1
  154. data/vendor/libgit2/src/iterator.c +44 -3
  155. data/vendor/libgit2/src/iterator.h +3 -0
  156. data/vendor/libgit2/src/map.h +1 -1
  157. data/vendor/libgit2/src/merge.c +155 -33
  158. data/vendor/libgit2/src/merge.h +2 -0
  159. data/vendor/libgit2/src/merge_driver.c +2 -2
  160. data/vendor/libgit2/src/merge_driver.h +2 -0
  161. data/vendor/libgit2/src/merge_file.c +3 -0
  162. data/vendor/libgit2/src/message.h +3 -1
  163. data/vendor/libgit2/src/mwindow.c +1 -1
  164. data/vendor/libgit2/src/mwindow.h +2 -0
  165. data/vendor/libgit2/src/netops.c +75 -62
  166. data/vendor/libgit2/src/netops.h +2 -1
  167. data/vendor/libgit2/src/notes.c +164 -48
  168. data/vendor/libgit2/src/notes.h +1 -1
  169. data/vendor/libgit2/src/object.c +14 -3
  170. data/vendor/libgit2/src/object.h +4 -0
  171. data/vendor/libgit2/src/object_api.c +3 -2
  172. data/vendor/libgit2/src/odb.c +104 -38
  173. data/vendor/libgit2/src/odb.h +3 -1
  174. data/vendor/libgit2/src/odb_loose.c +414 -267
  175. data/vendor/libgit2/src/odb_mempack.c +1 -0
  176. data/vendor/libgit2/src/odb_pack.c +2 -1
  177. data/vendor/libgit2/src/offmap.h +1 -0
  178. data/vendor/libgit2/src/oid.c +2 -1
  179. data/vendor/libgit2/src/oid.h +3 -8
  180. data/vendor/libgit2/src/oidarray.c +2 -1
  181. data/vendor/libgit2/src/oidarray.h +1 -0
  182. data/vendor/libgit2/src/oidmap.h +1 -0
  183. data/vendor/libgit2/src/pack-objects.c +5 -1
  184. data/vendor/libgit2/src/pack-objects.h +1 -1
  185. data/vendor/libgit2/src/pack.c +2 -6
  186. data/vendor/libgit2/src/pack.h +2 -1
  187. data/vendor/libgit2/src/parse.c +121 -0
  188. data/vendor/libgit2/src/parse.h +61 -0
  189. data/vendor/libgit2/src/patch.c +9 -2
  190. data/vendor/libgit2/src/patch.h +2 -0
  191. data/vendor/libgit2/src/patch_generate.c +6 -5
  192. data/vendor/libgit2/src/patch_generate.h +1 -0
  193. data/vendor/libgit2/src/patch_parse.c +265 -276
  194. data/vendor/libgit2/src/patch_parse.h +6 -11
  195. data/vendor/libgit2/src/path.c +24 -181
  196. data/vendor/libgit2/src/path.h +14 -73
  197. data/vendor/libgit2/src/pathspec.c +2 -1
  198. data/vendor/libgit2/src/pathspec.h +2 -1
  199. data/vendor/libgit2/src/pool.c +8 -0
  200. data/vendor/libgit2/src/pool.h +1 -0
  201. data/vendor/libgit2/src/posix.c +2 -1
  202. data/vendor/libgit2/src/posix.h +1 -0
  203. data/vendor/libgit2/src/pqueue.c +1 -0
  204. data/vendor/libgit2/src/pqueue.h +2 -0
  205. data/vendor/libgit2/src/proxy.c +2 -1
  206. data/vendor/libgit2/src/proxy.h +3 -1
  207. data/vendor/libgit2/src/push.c +4 -171
  208. data/vendor/libgit2/src/push.h +2 -0
  209. data/vendor/libgit2/src/rebase.c +1 -0
  210. data/vendor/libgit2/src/refdb.c +2 -3
  211. data/vendor/libgit2/src/refdb.h +2 -0
  212. data/vendor/libgit2/src/refdb_fs.c +5 -3
  213. data/vendor/libgit2/src/refdb_fs.h +4 -0
  214. data/vendor/libgit2/src/reflog.c +1 -0
  215. data/vendor/libgit2/src/reflog.h +2 -1
  216. data/vendor/libgit2/src/refs.c +1 -0
  217. data/vendor/libgit2/src/refs.h +2 -1
  218. data/vendor/libgit2/src/refspec.c +2 -2
  219. data/vendor/libgit2/src/refspec.h +2 -0
  220. data/vendor/libgit2/src/remote.c +56 -10
  221. data/vendor/libgit2/src/remote.h +2 -0
  222. data/vendor/libgit2/src/repository.c +16 -14
  223. data/vendor/libgit2/src/repository.h +2 -0
  224. data/vendor/libgit2/src/reset.c +6 -5
  225. data/vendor/libgit2/src/revert.c +1 -0
  226. data/vendor/libgit2/src/revparse.c +3 -5
  227. data/vendor/libgit2/src/revwalk.c +2 -2
  228. data/vendor/libgit2/src/revwalk.h +2 -0
  229. data/vendor/libgit2/src/settings.c +6 -8
  230. data/vendor/libgit2/src/sha1_lookup.c +2 -216
  231. data/vendor/libgit2/src/sha1_lookup.h +2 -6
  232. data/vendor/libgit2/src/signature.c +8 -3
  233. data/vendor/libgit2/src/signature.h +2 -0
  234. data/vendor/libgit2/src/sortedcache.c +7 -0
  235. data/vendor/libgit2/src/sortedcache.h +2 -0
  236. data/vendor/libgit2/src/stash.c +1 -0
  237. data/vendor/libgit2/src/status.c +14 -9
  238. data/vendor/libgit2/src/status.h +2 -0
  239. data/vendor/libgit2/src/{curl_stream.c → streams/curl.c} +2 -0
  240. data/vendor/libgit2/src/{curl_stream.h → streams/curl.h} +4 -2
  241. data/vendor/libgit2/src/{openssl_stream.c → streams/openssl.c} +47 -18
  242. data/vendor/libgit2/src/{openssl_stream.h → streams/openssl.h} +6 -2
  243. data/vendor/libgit2/src/{socket_stream.c → streams/socket.c} +2 -2
  244. data/vendor/libgit2/src/{socket_stream.h → streams/socket.h} +4 -2
  245. data/vendor/libgit2/src/{stransport_stream.c → streams/stransport.c} +4 -2
  246. data/vendor/libgit2/src/{stransport_stream.h → streams/stransport.h} +4 -2
  247. data/vendor/libgit2/src/{tls_stream.c → streams/tls.c} +4 -3
  248. data/vendor/libgit2/src/{tls_stream.h → streams/tls.h} +4 -2
  249. data/vendor/libgit2/src/submodule.c +28 -80
  250. data/vendor/libgit2/src/submodule.h +2 -13
  251. data/vendor/libgit2/src/sysdir.c +75 -8
  252. data/vendor/libgit2/src/sysdir.h +2 -1
  253. data/vendor/libgit2/src/tag.c +2 -2
  254. data/vendor/libgit2/src/tag.h +2 -0
  255. data/vendor/libgit2/src/thread-utils.c +1 -0
  256. data/vendor/libgit2/src/thread-utils.h +1 -1
  257. data/vendor/libgit2/src/trace.c +2 -2
  258. data/vendor/libgit2/src/trace.h +2 -0
  259. data/vendor/libgit2/src/trailer.c +416 -0
  260. data/vendor/libgit2/src/transaction.c +2 -1
  261. data/vendor/libgit2/src/transport.c +2 -0
  262. data/vendor/libgit2/src/transports/auth.c +2 -1
  263. data/vendor/libgit2/src/transports/auth.h +4 -3
  264. data/vendor/libgit2/src/transports/auth_negotiate.c +2 -1
  265. data/vendor/libgit2/src/transports/auth_negotiate.h +3 -3
  266. data/vendor/libgit2/src/transports/cred.c +2 -0
  267. data/vendor/libgit2/src/transports/cred.h +4 -2
  268. data/vendor/libgit2/src/transports/cred_helpers.c +1 -0
  269. data/vendor/libgit2/src/transports/git.c +3 -1
  270. data/vendor/libgit2/src/transports/http.c +10 -14
  271. data/vendor/libgit2/src/transports/http.h +23 -0
  272. data/vendor/libgit2/src/transports/local.c +23 -5
  273. data/vendor/libgit2/src/transports/smart.c +3 -1
  274. data/vendor/libgit2/src/transports/smart.h +23 -16
  275. data/vendor/libgit2/src/transports/smart_pkt.c +114 -130
  276. data/vendor/libgit2/src/transports/smart_protocol.c +26 -22
  277. data/vendor/libgit2/src/transports/ssh.c +12 -7
  278. data/vendor/libgit2/src/transports/ssh.h +4 -2
  279. data/vendor/libgit2/src/transports/winhttp.c +19 -21
  280. data/vendor/libgit2/src/tree-cache.c +1 -0
  281. data/vendor/libgit2/src/tree-cache.h +1 -0
  282. data/vendor/libgit2/src/tree.c +20 -14
  283. data/vendor/libgit2/src/tree.h +2 -0
  284. data/vendor/libgit2/src/tsort.c +0 -1
  285. data/vendor/libgit2/src/unix/map.c +4 -1
  286. data/vendor/libgit2/src/unix/posix.h +8 -4
  287. data/vendor/libgit2/src/unix/pthread.h +1 -1
  288. data/vendor/libgit2/src/unix/realpath.c +4 -1
  289. data/vendor/libgit2/src/util.c +6 -5
  290. data/vendor/libgit2/src/util.h +39 -111
  291. data/vendor/libgit2/src/varint.c +0 -1
  292. data/vendor/libgit2/src/varint.h +2 -0
  293. data/vendor/libgit2/src/vector.c +1 -1
  294. data/vendor/libgit2/src/win32/dir.c +3 -0
  295. data/vendor/libgit2/src/win32/dir.h +4 -3
  296. data/vendor/libgit2/src/win32/error.c +1 -1
  297. data/vendor/libgit2/src/win32/error.h +4 -2
  298. data/vendor/libgit2/src/win32/findfile.c +2 -1
  299. data/vendor/libgit2/src/win32/findfile.h +4 -2
  300. data/vendor/libgit2/src/win32/map.c +2 -0
  301. data/vendor/libgit2/src/win32/mingw-compat.h +3 -3
  302. data/vendor/libgit2/src/win32/msvc-compat.h +3 -3
  303. data/vendor/libgit2/src/win32/path_w32.c +7 -12
  304. data/vendor/libgit2/src/win32/path_w32.h +3 -2
  305. data/vendor/libgit2/src/win32/posix.h +2 -2
  306. data/vendor/libgit2/src/win32/posix_w32.c +11 -5
  307. data/vendor/libgit2/src/win32/precompiled.h +2 -1
  308. data/vendor/libgit2/src/win32/reparse.h +2 -2
  309. data/vendor/libgit2/src/win32/thread.c +1 -0
  310. data/vendor/libgit2/src/win32/thread.h +2 -2
  311. data/vendor/libgit2/src/win32/utf-conv.c +0 -1
  312. data/vendor/libgit2/src/win32/utf-conv.h +4 -3
  313. data/vendor/libgit2/src/win32/w32_buffer.c +1 -1
  314. data/vendor/libgit2/src/win32/w32_buffer.h +4 -2
  315. data/vendor/libgit2/src/win32/w32_crtdbg_stacktrace.c +2 -1
  316. data/vendor/libgit2/src/win32/w32_crtdbg_stacktrace.h +85 -2
  317. data/vendor/libgit2/src/win32/w32_stack.c +2 -1
  318. data/vendor/libgit2/src/win32/w32_stack.h +5 -3
  319. data/vendor/libgit2/src/win32/w32_util.h +4 -2
  320. data/vendor/libgit2/src/win32/win32-compat.h +3 -3
  321. data/vendor/libgit2/src/worktree.c +4 -5
  322. data/vendor/libgit2/src/worktree.h +2 -0
  323. data/vendor/libgit2/src/xdiff/xdiff.h +22 -13
  324. data/vendor/libgit2/src/xdiff/xdiffi.c +523 -81
  325. data/vendor/libgit2/src/xdiff/xdiffi.h +2 -2
  326. data/vendor/libgit2/src/xdiff/xemit.c +63 -39
  327. data/vendor/libgit2/src/xdiff/xemit.h +2 -2
  328. data/vendor/libgit2/src/xdiff/xhistogram.c +0 -1
  329. data/vendor/libgit2/src/xdiff/xinclude.h +3 -2
  330. data/vendor/libgit2/src/xdiff/xmacros.h +2 -2
  331. data/vendor/libgit2/src/xdiff/xmerge.c +80 -20
  332. data/vendor/libgit2/src/xdiff/xpatience.c +41 -9
  333. data/vendor/libgit2/src/xdiff/xprepare.c +2 -2
  334. data/vendor/libgit2/src/xdiff/xprepare.h +2 -2
  335. data/vendor/libgit2/src/xdiff/xtypes.h +2 -2
  336. data/vendor/libgit2/src/xdiff/xutils.c +47 -27
  337. data/vendor/libgit2/src/xdiff/xutils.h +2 -5
  338. data/vendor/libgit2/src/zstream.c +65 -45
  339. data/vendor/libgit2/src/zstream.h +9 -2
  340. metadata +27 -13
  341. data/vendor/libgit2/include/git2/sys/remote.h +0 -16
@@ -7,12 +7,12 @@
7
7
  #ifndef INCLUDE_git_version_h__
8
8
  #define INCLUDE_git_version_h__
9
9
 
10
- #define LIBGIT2_VERSION "0.26.7"
10
+ #define LIBGIT2_VERSION "0.27.0"
11
11
  #define LIBGIT2_VER_MAJOR 0
12
- #define LIBGIT2_VER_MINOR 26
13
- #define LIBGIT2_VER_REVISION 7
12
+ #define LIBGIT2_VER_MINOR 27
13
+ #define LIBGIT2_VER_REVISION 0
14
14
  #define LIBGIT2_VER_PATCH 0
15
15
 
16
- #define LIBGIT2_SOVERSION 26
16
+ #define LIBGIT2_SOVERSION 27
17
17
 
18
18
  #endif
@@ -123,7 +123,7 @@ GIT_EXTERN(int) git_worktree_add(git_worktree **out, git_repository *repo,
123
123
  * @param reason Reason why the working tree is being locked
124
124
  * @return 0 on success, non-zero otherwise
125
125
  */
126
- GIT_EXTERN(int) git_worktree_lock(git_worktree *wt, char *reason);
126
+ GIT_EXTERN(int) git_worktree_lock(git_worktree *wt, const char *reason);
127
127
 
128
128
  /**
129
129
  * Unlock a locked worktree
@@ -0,0 +1,463 @@
1
+ IF(DEBUG_POOL)
2
+ SET(GIT_DEBUG_POOL 1)
3
+ ENDIF()
4
+ ADD_FEATURE_INFO(debugpool GIT_DEBUG_POOL "debug pool allocator")
5
+
6
+ # This variable will contain the libraries we need to put into
7
+ # libgit2.pc's Requires.private. That is, what we're linking to or
8
+ # what someone who's statically linking us needs to link to.
9
+ SET(LIBGIT2_PC_REQUIRES "")
10
+ # This will be set later if we use the system's http-parser library or
11
+ # use iconv (OSX) and will be written to the Libs.private field in the
12
+ # pc file.
13
+ SET(LIBGIT2_PC_LIBS "")
14
+
15
+ SET(LIBGIT2_INCLUDES
16
+ "${CMAKE_CURRENT_BINARY_DIR}"
17
+ "${libgit2_SOURCE_DIR}/src"
18
+ "${libgit2_SOURCE_DIR}/include")
19
+ SET(LIBGIT2_LIBS "")
20
+ SET(LIBGIT2_LIBDIRS "")
21
+
22
+ # Installation paths
23
+ #
24
+ SET(BIN_INSTALL_DIR bin CACHE PATH "Where to install binaries to.")
25
+ SET(LIB_INSTALL_DIR lib CACHE PATH "Where to install libraries to.")
26
+ SET(INCLUDE_INSTALL_DIR include CACHE PATH "Where to install headers to.")
27
+
28
+ # Set a couple variables to be substituted inside the .pc file.
29
+ # We can't just use LIB_INSTALL_DIR in the .pc file, as passing them as absolue
30
+ # or relative paths is both valid and supported by cmake.
31
+ SET (PKGCONFIG_PREFIX ${CMAKE_INSTALL_PREFIX})
32
+
33
+ IF(IS_ABSOLUTE ${LIB_INSTALL_DIR})
34
+ SET (PKGCONFIG_LIBDIR ${LIB_INSTALL_DIR})
35
+ ELSE(IS_ABSOLUTE ${LIB_INSTALL_DIR})
36
+ SET (PKGCONFIG_LIBDIR "\${prefix}/${LIB_INSTALL_DIR}")
37
+ ENDIF (IS_ABSOLUTE ${LIB_INSTALL_DIR})
38
+
39
+ IF(IS_ABSOLUTE ${INCLUDE_INSTALL_DIR})
40
+ SET (PKGCONFIG_INCLUDEDIR ${INCLUDE_INSTALL_DIR})
41
+ ELSE(IS_ABSOLUTE ${INCLUDE_INSTALL_DIR})
42
+ SET (PKGCONFIG_INCLUDEDIR "\${prefix}/${INCLUDE_INSTALL_DIR}")
43
+ ENDIF(IS_ABSOLUTE ${INCLUDE_INSTALL_DIR})
44
+
45
+ # Enable tracing
46
+ IF (ENABLE_TRACE STREQUAL "ON")
47
+ SET(GIT_TRACE 1)
48
+ ENDIF()
49
+ ADD_FEATURE_INFO(tracing GIT_TRACE "tracing support")
50
+
51
+ CHECK_SYMBOL_EXISTS(regcomp_l "regex.h;xlocale.h" HAVE_REGCOMP_L)
52
+ IF (HAVE_REGCOMP_L)
53
+ SET(GIT_USE_REGCOMP_L 1)
54
+ ENDIF ()
55
+
56
+ CHECK_FUNCTION_EXISTS(futimens HAVE_FUTIMENS)
57
+ IF (HAVE_FUTIMENS)
58
+ SET(GIT_USE_FUTIMENS 1)
59
+ ENDIF ()
60
+
61
+ CHECK_FUNCTION_EXISTS(qsort_r HAVE_QSORT_R)
62
+ IF (HAVE_QSORT_R)
63
+ ADD_DEFINITIONS(-DHAVE_QSORT_R)
64
+ ENDIF ()
65
+
66
+ CHECK_FUNCTION_EXISTS(qsort_s HAVE_QSORT_S)
67
+ IF (HAVE_QSORT_S)
68
+ ADD_DEFINITIONS(-DHAVE_QSORT_S)
69
+ ENDIF ()
70
+
71
+ # Find required dependencies
72
+
73
+ IF(WIN32)
74
+ LIST(APPEND LIBGIT2_LIBS ws2_32)
75
+ ELSEIF(CMAKE_SYSTEM_NAME MATCHES "(Solaris|SunOS)")
76
+ LIST(APPEND LIBGIT2_LIBS socket nsl)
77
+ LIST(APPEND LIBGIT2_PC_LIBS "-lsocket" "-lnsl")
78
+ ELSEIF(CMAKE_SYSTEM_NAME MATCHES "Haiku")
79
+ LIST(APPEND LIBGIT2_LIBS network)
80
+ LIST(APPEND LIBGIT2_PC_LIBS "-lnetwork")
81
+ ENDIF()
82
+
83
+ CHECK_LIBRARY_EXISTS(rt clock_gettime "time.h" NEED_LIBRT)
84
+ IF(NEED_LIBRT)
85
+ LIST(APPEND LIBGIT2_LIBS rt)
86
+ LIST(APPEND LIBGIT2_PC_LIBS "-lrt")
87
+ ENDIF()
88
+
89
+ IF(THREADSAFE)
90
+ LIST(APPEND LIBGIT2_LIBS ${CMAKE_THREAD_LIBS_INIT})
91
+ LIST(APPEND LIBGIT2_PC_LIBS ${CMAKE_THREAD_LIBS_INIT})
92
+ ENDIF()
93
+ ADD_FEATURE_INFO(threadsafe THREADSAFE "threadsafe support")
94
+
95
+
96
+ IF (WIN32 AND EMBED_SSH_PATH)
97
+ FILE(GLOB SRC_SSH "${EMBED_SSH_PATH}/src/*.c")
98
+ LIST(APPEND LIBGIT2_INCLUDES "${EMBED_SSH_PATH}/include")
99
+ FILE(WRITE "${EMBED_SSH_PATH}/src/libssh2_config.h" "#define HAVE_WINCNG\n#define LIBSSH2_WINCNG\n#include \"../win32/libssh2_config.h\"")
100
+ SET(GIT_SSH 1)
101
+ ENDIF()
102
+
103
+ IF (WIN32 AND WINHTTP)
104
+ SET(GIT_WINHTTP 1)
105
+
106
+ # Since MinGW does not come with headers or an import library for winhttp,
107
+ # we have to include a private header and generate our own import library
108
+ IF (MINGW)
109
+ ADD_SUBDIRECTORY("${libgit2_SOURCE_DIR}/deps/winhttp" "${libgit2_BINARY_DIR}/deps/winhttp")
110
+ LIST(APPEND LIBGIT2_LIBS winhttp)
111
+ LIST(APPEND LIBGIT2_INCLUDES "${libgit2_SOURCE_DIR}/deps/winhttp")
112
+ LIST(APPEND LIBGIT2_LIBDIRS ${LIBWINHTTP_PATH})
113
+ ELSE()
114
+ LIST(APPEND LIBGIT2_LIBS "winhttp")
115
+ LIST(APPEND LIBGIT2_PC_LIBS "-lwinhttp")
116
+ ENDIF ()
117
+
118
+ LIST(APPEND LIBGIT2_LIBS "rpcrt4" "crypt32" "ole32")
119
+ LIST(APPEND LIBGIT2_PC_LIBS "-lrpcrt4" "-lcrypt32" "-lole32")
120
+ ELSE ()
121
+ IF (CURL)
122
+ PKG_CHECK_MODULES(CURL libcurl)
123
+ ENDIF ()
124
+
125
+ IF (CURL_FOUND)
126
+ SET(GIT_CURL 1)
127
+ LIST(APPEND LIBGIT2_INCLUDES ${CURL_INCLUDE_DIRS})
128
+ LIST(APPEND LIBGIT2_LIBDIRS ${CURL_LIBRARY_DIRS})
129
+ LIST(APPEND LIBGIT2_LIBS ${CURL_LIBRARIES})
130
+ LIST(APPEND LIBGIT2_PC_LIBS ${CURL_LDFLAGS})
131
+ ENDIF()
132
+ ADD_FEATURE_INFO(cURL GIT_CURL "cURL for HTTP proxy support")
133
+ ENDIF()
134
+
135
+ IF (USE_HTTPS)
136
+ IF (CMAKE_SYSTEM_NAME MATCHES "Darwin")
137
+ FIND_PACKAGE(Security)
138
+ FIND_PACKAGE(CoreFoundation)
139
+ ENDIF()
140
+
141
+ # Auto-select TLS backend
142
+ IF (USE_HTTPS STREQUAL ON)
143
+ IF (SECURITY_FOUND)
144
+ IF (SECURITY_HAS_SSLCREATECONTEXT)
145
+ SET(HTTPS_BACKEND "SecureTransport")
146
+ ELSE()
147
+ MESSAGE("-- Security framework is too old, falling back to OpenSSL")
148
+ SET(HTTPS_BACKEND "OpenSSL")
149
+ ENDIF()
150
+ ELSEIF (WINHTTP)
151
+ SET(HTTPS_BACKEND "WinHTTP")
152
+ ELSE()
153
+ SET(HTTPS_BACKEND "OpenSSL")
154
+ ENDIF()
155
+ ELSE()
156
+ # Backend was explicitly set
157
+ SET(HTTPS_BACKEND ${USE_HTTPS})
158
+ ENDIF()
159
+
160
+ # Check that we can find what's required for the selected backend
161
+ IF (HTTPS_BACKEND STREQUAL "SecureTransport")
162
+ IF (NOT COREFOUNDATION_FOUND)
163
+ MESSAGE(FATAL_ERROR "Cannot use SecureTransport backend, CoreFoundation.framework not found")
164
+ ENDIF()
165
+ IF (NOT SECURITY_FOUND)
166
+ MESSAGE(FATAL_ERROR "Cannot use SecureTransport backend, Security.framework not found")
167
+ ENDIF()
168
+ IF (NOT SECURITY_HAS_SSLCREATECONTEXT)
169
+ MESSAGE(FATAL_ERROR "Cannot use SecureTransport backend, SSLCreateContext not supported")
170
+ ENDIF()
171
+
172
+ SET(GIT_SECURE_TRANSPORT 1)
173
+ LIST(APPEND LIBGIT2_INCLUDES ${SECURITY_INCLUDE_DIR})
174
+ LIST(APPEND LIBGIT2_LIBS ${COREFOUNDATION_LIBRARIES} ${SECURITY_LIBRARIES})
175
+ LIST(APPEND LIBGIT2_PC_LIBS ${COREFOUNDATION_LDFLAGS} ${SECURITY_LDFLAGS})
176
+ ELSEIF (HTTPS_BACKEND STREQUAL "OpenSSL")
177
+ FIND_PACKAGE(OpenSSL)
178
+
179
+ IF (NOT OPENSSL_FOUND)
180
+ MESSAGE(FATAL_ERROR "Asked for OpenSSL TLS backend, but it wasn't found")
181
+ ENDIF()
182
+
183
+ SET(GIT_OPENSSL 1)
184
+ LIST(APPEND LIBGIT2_INCLUDES ${OPENSSL_INCLUDE_DIR})
185
+ LIST(APPEND LIBGIT2_LIBS ${OPENSSL_LIBRARIES})
186
+ LIST(APPEND LIBGIT2_PC_LIBS ${OPENSSL_LDFLAGS})
187
+ LIST(APPEND LIBGIT2_PC_REQUIRES "openssl")
188
+ ELSEIF (HTTPS_BACKEND STREQUAL "WinHTTP")
189
+ # WinHTTP setup was handled in the WinHTTP-specific block above
190
+ ELSE()
191
+ MESSAGE(FATAL_ERROR "Asked for backend ${HTTPS_BACKEND} but it wasn't found")
192
+ ENDIF()
193
+
194
+ ADD_FEATURE_INFO(HTTPS ON "using ${HTTPS_BACKEND}")
195
+ SET(GIT_HTTPS 1)
196
+ ELSE()
197
+ ADD_FEATURE_INFO(HTTPS OFF "no support")
198
+ ENDIF()
199
+
200
+ # Specify sha1 implementation
201
+ IF(SHA1_BACKEND STREQUAL "OpenSSL")
202
+ IF(NOT OPENSSL_FOUND)
203
+ FIND_PACKAGE(OpenSSL)
204
+ IF(NOT OPENSSL_FOUND)
205
+ MESSAGE(FATAL_ERROR "Requested OpenSSL SHA1 backend, but OpenSSL could not be found")
206
+ ENDIF()
207
+ ENDIF()
208
+
209
+ ADD_FEATURE_INFO(SHA ON "using OpenSSL")
210
+ SET(GIT_SHA1_OPENSSL 1)
211
+ IF(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
212
+ LIST(APPEND LIBGIT2_PC_LIBS "-lssl")
213
+ ELSE()
214
+ LIST(APPEND LIBGIT2_PC_REQUIRES "openssl")
215
+ ENDIF()
216
+ ELSEIF(SHA1_BACKEND STREQUAL "CollisionDetection")
217
+ ADD_FEATURE_INFO(SHA ON "using CollisionDetection")
218
+ SET(GIT_SHA1_COLLISIONDETECT 1)
219
+ ADD_DEFINITIONS(-DSHA1DC_NO_STANDARD_INCLUDES=1)
220
+ ADD_DEFINITIONS(-DSHA1DC_CUSTOM_INCLUDE_SHA1_C=\"common.h\")
221
+ ADD_DEFINITIONS(-DSHA1DC_CUSTOM_INCLUDE_UBC_CHECK_C=\"common.h\")
222
+ FILE(GLOB SRC_SHA1 hash/hash_collisiondetect.c hash/sha1dc/*)
223
+ ELSEIF(SHA1_BACKEND STREQUAL "Generic")
224
+ ADD_FEATURE_INFO(SHA ON "using Generic")
225
+ FILE(GLOB SRC_SHA1 hash/hash_generic.c)
226
+ ELSEIF(SHA1_BACKEND STREQUAL "Win32")
227
+ ADD_FEATURE_INFO(SHA ON "using Win32")
228
+ SET(GIT_SHA1_WIN32 1)
229
+ FILE(GLOB SRC_SHA1 hash/hash_win32.c)
230
+ ELSEIF(SHA1_BACKEND STREQUAL "CommonCrypto")
231
+ ADD_FEATURE_INFO(SHA ON "using CommonCrypto")
232
+ SET(GIT_SHA1_COMMON_CRYPTO 1)
233
+ ELSE()
234
+ MESSAGE(FATAL_ERROR "Asked for unknown SHA1 backend ${SHA1_BACKEND}")
235
+ ENDIF()
236
+
237
+ # Include POSIX regex when it is required
238
+ IF(WIN32 OR AMIGA OR CMAKE_SYSTEM_NAME MATCHES "(Solaris|SunOS)")
239
+ ADD_SUBDIRECTORY("${libgit2_SOURCE_DIR}/deps/regex" "${libgit2_BINARY_DIR}/deps/regex")
240
+ LIST(APPEND LIBGIT2_INCLUDES "${libgit2_SOURCE_DIR}/deps/regex")
241
+ LIST(APPEND LIBGIT2_OBJECTS $<TARGET_OBJECTS:regex>)
242
+ ENDIF()
243
+
244
+ # Optional external dependency: http-parser
245
+ FIND_PACKAGE(HTTP_Parser)
246
+ IF (USE_EXT_HTTP_PARSER AND HTTP_PARSER_FOUND AND HTTP_PARSER_VERSION_MAJOR EQUAL 2)
247
+ LIST(APPEND LIBGIT2_INCLUDES ${HTTP_PARSER_INCLUDE_DIRS})
248
+ LIST(APPEND LIBGIT2_LIBS ${HTTP_PARSER_LIBRARIES})
249
+ LIST(APPEND LIBGIT2_PC_LIBS "-lhttp_parser")
250
+ ADD_FEATURE_INFO(http-parser ON "http-parser support")
251
+ ELSE()
252
+ MESSAGE(STATUS "http-parser version 2 was not found or disabled; using bundled 3rd-party sources.")
253
+ ADD_SUBDIRECTORY("${libgit2_SOURCE_DIR}/deps/http-parser" "${libgit2_BINARY_DIR}/deps/http-parser")
254
+ LIST(APPEND LIBGIT2_INCLUDES "${libgit2_SOURCE_DIR}/deps/http-parser")
255
+ LIST(APPEND LIBGIT2_OBJECTS "$<TARGET_OBJECTS:http-parser>")
256
+ ADD_FEATURE_INFO(http-parser ON "http-parser support (bundled)")
257
+ ENDIF()
258
+
259
+ # Optional external dependency: zlib
260
+ IF(NOT USE_BUNDLED_ZLIB)
261
+ FIND_PACKAGE(ZLIB)
262
+ IF(ZLIB_FOUND)
263
+ LIST(APPEND LIBGIT2_INCLUDES ${ZLIB_INCLUDE_DIRS})
264
+ LIST(APPEND LIBGIT2_LIBS ${ZLIB_LIBRARIES})
265
+ IF(APPLE OR CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
266
+ LIST(APPEND LIBGIT2_LIBS "z")
267
+ LIST(APPEND LIBGIT2_PC_LIBS "-lz")
268
+ ELSE()
269
+ LIST(APPEND LIBGIT2_PC_REQUIRES "zlib")
270
+ ENDIF()
271
+ ADD_FEATURE_INFO(zlib ON "using system zlib")
272
+ ELSE()
273
+ MESSAGE(STATUS "zlib was not found; using bundled 3rd-party sources." )
274
+ ENDIF()
275
+ ENDIF()
276
+ IF(USE_BUNDLED_ZLIB OR NOT ZLIB_FOUND)
277
+ ADD_SUBDIRECTORY("${libgit2_SOURCE_DIR}/deps/zlib" "${libgit2_BINARY_DIR}/deps/zlib")
278
+ LIST(APPEND LIBGIT2_INCLUDES "${libgit2_SOURCE_DIR}/deps/zlib")
279
+ LIST(APPEND LIBGIT2_OBJECTS $<TARGET_OBJECTS:zlib>)
280
+ ADD_FEATURE_INFO(zlib ON "using bundled zlib")
281
+ ENDIF()
282
+
283
+ # Optional external dependency: libssh2
284
+ IF (USE_SSH)
285
+ PKG_CHECK_MODULES(LIBSSH2 libssh2)
286
+ ENDIF()
287
+ IF (LIBSSH2_FOUND)
288
+ SET(GIT_SSH 1)
289
+ LIST(APPEND LIBGIT2_INCLUDES ${LIBSSH2_INCLUDE_DIRS})
290
+ LIST(APPEND LIBGIT2_LIBS ${LIBSSH2_LIBRARIES})
291
+ LIST(APPEND LIBGIT2_LIBDIRS ${LIBSSH2_LIBRARY_DIRS})
292
+ LIST(APPEND LIBGIT2_PC_LIBS ${LIBSSH2_LDFLAGS})
293
+ #SET(LIBGIT2_PC_LIBS "${LIBGIT2_PC_LIBS} ${LIBSSH2_LDFLAGS}")
294
+
295
+ CHECK_LIBRARY_EXISTS("${LIBSSH2_LIBRARIES}" libssh2_userauth_publickey_frommemory "${LIBSSH2_LIBRARY_DIRS}" HAVE_LIBSSH2_MEMORY_CREDENTIALS)
296
+ IF (HAVE_LIBSSH2_MEMORY_CREDENTIALS)
297
+ SET(GIT_SSH_MEMORY_CREDENTIALS 1)
298
+ ENDIF()
299
+ ELSE()
300
+ MESSAGE(STATUS "LIBSSH2 not found. Set CMAKE_PREFIX_PATH if it is installed outside of the default search path.")
301
+ ENDIF()
302
+ ADD_FEATURE_INFO(SSH GIT_SSH "SSH transport support")
303
+
304
+ # Optional external dependency: libgssapi
305
+ IF (USE_GSSAPI)
306
+ FIND_PACKAGE(GSSAPI)
307
+ ENDIF()
308
+ IF (GSSAPI_FOUND)
309
+ SET(GIT_GSSAPI 1)
310
+ LIST(APPEND LIBGIT2_LIBS ${GSSAPI_LIBRARIES})
311
+ ENDIF()
312
+ ADD_FEATURE_INFO(SPNEGO GIT_GSSAPI "SPNEGO authentication support")
313
+
314
+ # Optional external dependency: iconv
315
+ IF (USE_ICONV)
316
+ FIND_PACKAGE(Iconv)
317
+ ENDIF()
318
+ IF (ICONV_FOUND)
319
+ SET(GIT_USE_ICONV 1)
320
+ LIST(APPEND LIBGIT2_INCLUDES ${ICONV_INCLUDE_DIR})
321
+ LIST(APPEND LIBGIT2_LIBS ${ICONV_LIBRARIES})
322
+ LIST(APPEND LIBGIT2_PC_LIBS ${ICONV_LIBRARIES})
323
+ ENDIF()
324
+ ADD_FEATURE_INFO(iconv GIT_USE_ICONV "iconv encoding conversion support")
325
+
326
+
327
+ IF (THREADSAFE)
328
+ IF (NOT WIN32)
329
+ FIND_PACKAGE(Threads REQUIRED)
330
+ ENDIF()
331
+
332
+ SET(GIT_THREADS 1)
333
+ ENDIF()
334
+
335
+ IF (USE_NSEC)
336
+ SET(GIT_USE_NSEC 1)
337
+ ENDIF()
338
+
339
+ IF (HAVE_STRUCT_STAT_ST_MTIM)
340
+ SET(GIT_USE_STAT_MTIM 1)
341
+ ELSEIF (HAVE_STRUCT_STAT_ST_MTIMESPEC)
342
+ SET(GIT_USE_STAT_MTIMESPEC 1)
343
+ ELSEIF (HAVE_STRUCT_STAT_ST_MTIME_NSEC)
344
+ SET(GIT_USE_STAT_MTIME_NSEC 1)
345
+ ENDIF()
346
+
347
+ ADD_DEFINITIONS(-D_FILE_OFFSET_BITS=64)
348
+
349
+ # Collect sourcefiles
350
+ FILE(GLOB SRC_H
351
+ "${libgit2_SOURCE_DIR}/include/git2.h"
352
+ "${libgit2_SOURCE_DIR}/include/git2/*.h"
353
+ "${libgit2_SOURCE_DIR}/include/git2/sys/*.h")
354
+
355
+ # On Windows use specific platform sources
356
+ IF (WIN32 AND NOT CYGWIN)
357
+ ADD_DEFINITIONS(-DWIN32 -D_WIN32_WINNT=0x0501)
358
+
359
+ IF(MSVC)
360
+ SET(WIN_RC "win32/git2.rc")
361
+ ENDIF()
362
+
363
+ FILE(GLOB SRC_OS win32/*.c win32/*.h)
364
+ ELSEIF (AMIGA)
365
+ ADD_DEFINITIONS(-DNO_ADDRINFO -DNO_READDIR_R -DNO_MMAP)
366
+ ELSE()
367
+ IF (VALGRIND)
368
+ ADD_DEFINITIONS(-DNO_MMAP)
369
+ ENDIF()
370
+ FILE(GLOB SRC_OS unix/*.c unix/*.h)
371
+ ENDIF()
372
+ FILE(GLOB SRC_GIT2 *.c *.h
373
+ streams/*.c streams/*.h
374
+ transports/*.c transports/*.h
375
+ xdiff/*.c xdiff/*.h)
376
+
377
+ # Determine architecture of the machine
378
+ IF (CMAKE_SIZEOF_VOID_P EQUAL 8)
379
+ SET(GIT_ARCH_64 1)
380
+ ELSEIF (CMAKE_SIZEOF_VOID_P EQUAL 4)
381
+ SET(GIT_ARCH_32 1)
382
+ ELSEIF (CMAKE_SIZEOF_VOID_P)
383
+ MESSAGE(FATAL_ERROR "Unsupported architecture (pointer size is ${CMAKE_SIZEOF_VOID_P} bytes)")
384
+ ELSE()
385
+ MESSAGE(FATAL_ERROR "Unsupported architecture (CMAKE_SIZEOF_VOID_P is unset)")
386
+ ENDIF()
387
+
388
+ CONFIGURE_FILE(features.h.in git2/sys/features.h)
389
+
390
+ SET(LIBGIT2_SOURCES ${SRC_H} ${SRC_GIT2} ${SRC_OS} ${SRC_SSH} ${SRC_SHA1})
391
+
392
+ ADD_LIBRARY(git2internal OBJECT ${LIBGIT2_SOURCES})
393
+ IDE_SPLIT_SOURCES(git2internal)
394
+ LIST(APPEND LIBGIT2_OBJECTS $<TARGET_OBJECTS:git2internal>)
395
+
396
+ IF (${CMAKE_VERSION} VERSION_LESS 2.8.12)
397
+ INCLUDE_DIRECTORIES(${LIBGIT2_INCLUDES})
398
+ ELSE()
399
+ TARGET_INCLUDE_DIRECTORIES(git2internal
400
+ PRIVATE ${LIBGIT2_INCLUDES}
401
+ PUBLIC ${libgit2_SOURCE_DIR}/include)
402
+ ENDIF()
403
+
404
+ SET(LIBGIT2_OBJECTS ${LIBGIT2_OBJECTS} PARENT_SCOPE)
405
+ SET(LIBGIT2_INCLUDES ${LIBGIT2_INCLUDES} PARENT_SCOPE)
406
+ SET(LIBGIT2_LIBS ${LIBGIT2_LIBS} PARENT_SCOPE)
407
+ SET(LIBGIT2_LIBDIRS ${LIBGIT2_LIBDIRS} PARENT_SCOPE)
408
+
409
+ IF(XCODE_VERSION)
410
+ # This is required for Xcode to actually link the libgit2 library
411
+ # when using only object libraries.
412
+ FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/dummy.c "")
413
+ LIST(APPEND LIBGIT2_OBJECTS ${CMAKE_CURRENT_BINARY_DIR}/dummy.c)
414
+ ENDIF()
415
+
416
+ # Compile and link libgit2
417
+ LINK_DIRECTORIES(${LIBGIT2_LIBDIRS})
418
+ ADD_LIBRARY(git2 ${WIN_RC} ${LIBGIT2_OBJECTS})
419
+ TARGET_LINK_LIBRARIES(git2 ${LIBGIT2_LIBS})
420
+
421
+ SET_TARGET_PROPERTIES(git2 PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${libgit2_BINARY_DIR})
422
+ SET_TARGET_PROPERTIES(git2 PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${libgit2_BINARY_DIR})
423
+ SET_TARGET_PROPERTIES(git2 PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${libgit2_BINARY_DIR})
424
+
425
+ # Workaround for Cmake bug #0011240 (see http://public.kitware.com/Bug/view.php?id=11240)
426
+ # Win64+MSVC+static libs = linker error
427
+ IF(MSVC AND GIT_ARCH_64 AND NOT BUILD_SHARED_LIBS)
428
+ SET_TARGET_PROPERTIES(git2 PROPERTIES STATIC_LIBRARY_FLAGS "/MACHINE:x64")
429
+ ENDIF()
430
+
431
+ IDE_SPLIT_SOURCES(git2)
432
+
433
+ IF (SONAME)
434
+ SET_TARGET_PROPERTIES(git2 PROPERTIES VERSION ${LIBGIT2_VERSION_STRING})
435
+ SET_TARGET_PROPERTIES(git2 PROPERTIES SOVERSION ${LIBGIT2_SOVERSION})
436
+ IF (LIBGIT2_FILENAME)
437
+ ADD_DEFINITIONS(-DLIBGIT2_FILENAME=\"${LIBGIT2_FILENAME}\")
438
+ SET_TARGET_PROPERTIES(git2 PROPERTIES OUTPUT_NAME ${LIBGIT2_FILENAME})
439
+ ELSEIF (DEFINED LIBGIT2_PREFIX)
440
+ SET_TARGET_PROPERTIES(git2 PROPERTIES PREFIX "${LIBGIT2_PREFIX}")
441
+ ENDIF()
442
+ ENDIF()
443
+
444
+ LIST(REMOVE_DUPLICATES LIBGIT2_PC_REQUIRES)
445
+ STRING(REPLACE ";" " " LIBGIT2_PC_REQUIRES "${LIBGIT2_PC_REQUIRES}")
446
+ STRING(REPLACE ";" " " LIBGIT2_PC_LIBS "${LIBGIT2_PC_LIBS}")
447
+ CONFIGURE_FILE(${libgit2_SOURCE_DIR}/libgit2.pc.in ${libgit2_BINARY_DIR}/libgit2.pc @ONLY)
448
+
449
+ IF (MSVC_IDE)
450
+ # Precompiled headers
451
+ SET_TARGET_PROPERTIES(git2 PROPERTIES COMPILE_FLAGS "/Yuprecompiled.h /FIprecompiled.h")
452
+ SET_SOURCE_FILES_PROPERTIES(win32/precompiled.c COMPILE_FLAGS "/Ycprecompiled.h")
453
+ ENDIF ()
454
+
455
+ # Install
456
+ INSTALL(TARGETS git2
457
+ RUNTIME DESTINATION ${BIN_INSTALL_DIR}
458
+ LIBRARY DESTINATION ${LIB_INSTALL_DIR}
459
+ ARCHIVE DESTINATION ${LIB_INSTALL_DIR}
460
+ )
461
+ INSTALL(FILES ${libgit2_BINARY_DIR}/libgit2.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig )
462
+ INSTALL(DIRECTORY ${libgit2_SOURCE_DIR}/include/git2 DESTINATION ${INCLUDE_INSTALL_DIR} )
463
+ INSTALL(FILES ${libgit2_SOURCE_DIR}/include/git2.h DESTINATION ${INCLUDE_INSTALL_DIR} )