rugged 0.26.7 → 0.27.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/ext/rugged/rugged_blame.c +6 -3
- data/ext/rugged/rugged_branch_collection.c +3 -6
- data/ext/rugged/rugged_commit.c +56 -0
- data/ext/rugged/rugged_config.c +44 -9
- data/ext/rugged/rugged_diff.c +3 -14
- data/ext/rugged/rugged_diff_hunk.c +1 -3
- data/ext/rugged/rugged_index.c +1 -5
- data/ext/rugged/rugged_note.c +1 -4
- data/ext/rugged/rugged_patch.c +1 -4
- data/ext/rugged/rugged_reference_collection.c +1 -7
- data/ext/rugged/rugged_remote.c +5 -8
- data/ext/rugged/rugged_remote_collection.c +1 -6
- data/ext/rugged/rugged_repo.c +16 -48
- data/ext/rugged/rugged_revwalk.c +7 -16
- data/ext/rugged/rugged_settings.c +28 -0
- data/ext/rugged/rugged_submodule_collection.c +3 -4
- data/ext/rugged/rugged_tag_collection.c +1 -5
- data/ext/rugged/rugged_tree.c +2 -3
- data/lib/rugged/repository.rb +43 -0
- data/lib/rugged/version.rb +1 -1
- data/vendor/libgit2/AUTHORS +1 -0
- data/vendor/libgit2/CMakeLists.txt +61 -510
- data/vendor/libgit2/cmake/Modules/EnableWarnings.cmake +14 -0
- data/vendor/libgit2/cmake/Modules/FindCoreFoundation.cmake +25 -8
- data/vendor/libgit2/cmake/Modules/FindSecurity.cmake +27 -8
- data/vendor/libgit2/cmake/Modules/FindStatNsec.cmake +20 -0
- data/vendor/libgit2/cmake/Modules/IdeSplitSources.cmake +22 -0
- data/vendor/libgit2/deps/http-parser/CMakeLists.txt +3 -0
- data/vendor/libgit2/deps/regex/CMakeLists.txt +2 -0
- data/vendor/libgit2/deps/winhttp/CMakeLists.txt +26 -0
- data/vendor/libgit2/deps/zlib/CMakeLists.txt +4 -0
- data/vendor/libgit2/include/git2/config.h +29 -2
- data/vendor/libgit2/include/git2/describe.h +1 -1
- data/vendor/libgit2/include/git2/diff.h +59 -8
- data/vendor/libgit2/include/git2/graph.h +3 -0
- data/vendor/libgit2/include/git2/merge.h +6 -0
- data/vendor/libgit2/include/git2/message.h +43 -3
- data/vendor/libgit2/include/git2/notes.h +89 -0
- data/vendor/libgit2/include/git2/odb.h +8 -1
- data/vendor/libgit2/include/git2/patch.h +2 -2
- data/vendor/libgit2/include/git2/pathspec.h +35 -18
- data/vendor/libgit2/include/git2/refs.h +3 -0
- data/vendor/libgit2/include/git2/remote.h +34 -4
- data/vendor/libgit2/include/git2/repository.h +6 -6
- data/vendor/libgit2/include/git2/reset.h +4 -4
- data/vendor/libgit2/include/git2/status.h +4 -0
- data/vendor/libgit2/include/git2/sys/config.h +4 -1
- data/vendor/libgit2/include/git2/sys/odb_backend.h +2 -1
- data/vendor/libgit2/include/git2/tree.h +4 -3
- data/vendor/libgit2/include/git2/types.h +1 -0
- data/vendor/libgit2/include/git2/version.h +4 -4
- data/vendor/libgit2/include/git2/worktree.h +1 -1
- data/vendor/libgit2/src/CMakeLists.txt +463 -0
- data/vendor/libgit2/src/annotated_commit.c +1 -1
- data/vendor/libgit2/src/annotated_commit.h +2 -0
- data/vendor/libgit2/src/apply.c +2 -1
- data/vendor/libgit2/src/apply.h +2 -0
- data/vendor/libgit2/src/attr.c +24 -4
- data/vendor/libgit2/src/attr.h +2 -0
- data/vendor/libgit2/src/attr_file.c +9 -2
- data/vendor/libgit2/src/attr_file.h +2 -0
- data/vendor/libgit2/src/attrcache.c +9 -1
- data/vendor/libgit2/src/attrcache.h +2 -0
- data/vendor/libgit2/src/blame.c +1 -0
- data/vendor/libgit2/src/blame.h +2 -1
- data/vendor/libgit2/src/blame_git.c +1 -0
- data/vendor/libgit2/src/blame_git.h +2 -0
- data/vendor/libgit2/src/blob.c +2 -2
- data/vendor/libgit2/src/blob.h +2 -0
- data/vendor/libgit2/src/branch.c +8 -1
- data/vendor/libgit2/src/branch.h +2 -0
- data/vendor/libgit2/src/buf_text.c +7 -7
- data/vendor/libgit2/src/buf_text.h +3 -3
- data/vendor/libgit2/src/buffer.c +31 -1
- data/vendor/libgit2/src/buffer.h +3 -0
- data/vendor/libgit2/src/cache.c +2 -2
- data/vendor/libgit2/src/cache.h +2 -0
- data/vendor/libgit2/src/cc-compat.h +3 -3
- data/vendor/libgit2/src/checkout.c +30 -19
- data/vendor/libgit2/src/checkout.h +2 -0
- data/vendor/libgit2/src/cherrypick.c +1 -0
- data/vendor/libgit2/src/clone.c +2 -1
- data/vendor/libgit2/src/clone.h +4 -0
- data/vendor/libgit2/src/commit.c +2 -1
- data/vendor/libgit2/src/commit.h +2 -0
- data/vendor/libgit2/src/commit_list.c +1 -1
- data/vendor/libgit2/src/commit_list.h +2 -0
- data/vendor/libgit2/src/common.h +11 -5
- data/vendor/libgit2/src/config.c +12 -10
- data/vendor/libgit2/src/config.h +2 -0
- data/vendor/libgit2/src/config_cache.c +1 -0
- data/vendor/libgit2/src/config_file.c +287 -786
- data/vendor/libgit2/src/config_file.h +4 -3
- data/vendor/libgit2/src/config_parse.c +525 -0
- data/vendor/libgit2/src/config_parse.h +64 -0
- data/vendor/libgit2/src/crlf.c +2 -1
- data/vendor/libgit2/src/delta.c +28 -30
- data/vendor/libgit2/src/delta.h +1 -0
- data/vendor/libgit2/src/describe.c +3 -1
- data/vendor/libgit2/src/diff.c +148 -2
- data/vendor/libgit2/src/diff.h +3 -1
- data/vendor/libgit2/src/diff_driver.c +12 -9
- data/vendor/libgit2/src/diff_driver.h +4 -1
- data/vendor/libgit2/src/diff_file.c +7 -4
- data/vendor/libgit2/src/diff_file.h +1 -0
- data/vendor/libgit2/src/diff_generate.c +6 -3
- data/vendor/libgit2/src/diff_generate.h +6 -1
- data/vendor/libgit2/src/diff_parse.c +5 -4
- data/vendor/libgit2/src/diff_parse.h +2 -0
- data/vendor/libgit2/src/diff_print.c +2 -0
- data/vendor/libgit2/src/diff_stats.c +2 -0
- data/vendor/libgit2/src/diff_tform.c +2 -1
- data/vendor/libgit2/src/diff_tform.h +4 -1
- data/vendor/libgit2/src/diff_xdiff.c +5 -2
- data/vendor/libgit2/src/diff_xdiff.h +2 -0
- data/vendor/libgit2/src/errors.c +2 -0
- data/vendor/libgit2/src/features.h.in +36 -0
- data/vendor/libgit2/src/fetch.c +2 -2
- data/vendor/libgit2/src/fetch.h +4 -0
- data/vendor/libgit2/src/fetchhead.c +3 -3
- data/vendor/libgit2/src/fetchhead.h +3 -0
- data/vendor/libgit2/src/filebuf.c +2 -1
- data/vendor/libgit2/src/filebuf.h +2 -0
- data/vendor/libgit2/src/fileops.c +12 -1
- data/vendor/libgit2/src/fileops.h +7 -1
- data/vendor/libgit2/src/filter.c +2 -1
- data/vendor/libgit2/src/filter.h +1 -0
- data/vendor/libgit2/src/fnmatch.c +2 -2
- data/vendor/libgit2/src/fnmatch.h +3 -4
- data/vendor/libgit2/src/global.c +4 -3
- data/vendor/libgit2/src/global.h +1 -5
- data/vendor/libgit2/src/graph.c +2 -0
- data/vendor/libgit2/src/hash.c +0 -1
- data/vendor/libgit2/src/hash.h +3 -1
- data/vendor/libgit2/src/hash/hash_collisiondetect.h +3 -3
- data/vendor/libgit2/src/hash/hash_common_crypto.h +18 -5
- data/vendor/libgit2/src/hash/hash_generic.c +2 -2
- data/vendor/libgit2/src/hash/hash_generic.h +5 -3
- data/vendor/libgit2/src/hash/hash_openssl.h +3 -3
- data/vendor/libgit2/src/hash/hash_win32.c +57 -14
- data/vendor/libgit2/src/hash/hash_win32.h +4 -3
- data/vendor/libgit2/src/hashsig.c +3 -0
- data/vendor/libgit2/src/ident.c +2 -0
- data/vendor/libgit2/src/idxmap.h +2 -1
- data/vendor/libgit2/src/ignore.c +14 -2
- data/vendor/libgit2/src/ignore.h +2 -0
- data/vendor/libgit2/src/index.c +20 -40
- data/vendor/libgit2/src/index.h +2 -0
- data/vendor/libgit2/src/indexer.c +13 -5
- data/vendor/libgit2/src/indexer.h +5 -1
- data/vendor/libgit2/src/integer.h +1 -1
- data/vendor/libgit2/src/iterator.c +44 -3
- data/vendor/libgit2/src/iterator.h +3 -0
- data/vendor/libgit2/src/map.h +1 -1
- data/vendor/libgit2/src/merge.c +155 -33
- data/vendor/libgit2/src/merge.h +2 -0
- data/vendor/libgit2/src/merge_driver.c +2 -2
- data/vendor/libgit2/src/merge_driver.h +2 -0
- data/vendor/libgit2/src/merge_file.c +3 -0
- data/vendor/libgit2/src/message.h +3 -1
- data/vendor/libgit2/src/mwindow.c +1 -1
- data/vendor/libgit2/src/mwindow.h +2 -0
- data/vendor/libgit2/src/netops.c +75 -62
- data/vendor/libgit2/src/netops.h +2 -1
- data/vendor/libgit2/src/notes.c +164 -48
- data/vendor/libgit2/src/notes.h +1 -1
- data/vendor/libgit2/src/object.c +14 -3
- data/vendor/libgit2/src/object.h +4 -0
- data/vendor/libgit2/src/object_api.c +3 -2
- data/vendor/libgit2/src/odb.c +104 -38
- data/vendor/libgit2/src/odb.h +3 -1
- data/vendor/libgit2/src/odb_loose.c +414 -267
- data/vendor/libgit2/src/odb_mempack.c +1 -0
- data/vendor/libgit2/src/odb_pack.c +2 -1
- data/vendor/libgit2/src/offmap.h +1 -0
- data/vendor/libgit2/src/oid.c +2 -1
- data/vendor/libgit2/src/oid.h +3 -8
- data/vendor/libgit2/src/oidarray.c +2 -1
- data/vendor/libgit2/src/oidarray.h +1 -0
- data/vendor/libgit2/src/oidmap.h +1 -0
- data/vendor/libgit2/src/pack-objects.c +5 -1
- data/vendor/libgit2/src/pack-objects.h +1 -1
- data/vendor/libgit2/src/pack.c +2 -6
- data/vendor/libgit2/src/pack.h +2 -1
- data/vendor/libgit2/src/parse.c +121 -0
- data/vendor/libgit2/src/parse.h +61 -0
- data/vendor/libgit2/src/patch.c +9 -2
- data/vendor/libgit2/src/patch.h +2 -0
- data/vendor/libgit2/src/patch_generate.c +6 -5
- data/vendor/libgit2/src/patch_generate.h +1 -0
- data/vendor/libgit2/src/patch_parse.c +265 -276
- data/vendor/libgit2/src/patch_parse.h +6 -11
- data/vendor/libgit2/src/path.c +24 -181
- data/vendor/libgit2/src/path.h +14 -73
- data/vendor/libgit2/src/pathspec.c +2 -1
- data/vendor/libgit2/src/pathspec.h +2 -1
- data/vendor/libgit2/src/pool.c +8 -0
- data/vendor/libgit2/src/pool.h +1 -0
- data/vendor/libgit2/src/posix.c +2 -1
- data/vendor/libgit2/src/posix.h +1 -0
- data/vendor/libgit2/src/pqueue.c +1 -0
- data/vendor/libgit2/src/pqueue.h +2 -0
- data/vendor/libgit2/src/proxy.c +2 -1
- data/vendor/libgit2/src/proxy.h +3 -1
- data/vendor/libgit2/src/push.c +4 -171
- data/vendor/libgit2/src/push.h +2 -0
- data/vendor/libgit2/src/rebase.c +1 -0
- data/vendor/libgit2/src/refdb.c +2 -3
- data/vendor/libgit2/src/refdb.h +2 -0
- data/vendor/libgit2/src/refdb_fs.c +5 -3
- data/vendor/libgit2/src/refdb_fs.h +4 -0
- data/vendor/libgit2/src/reflog.c +1 -0
- data/vendor/libgit2/src/reflog.h +2 -1
- data/vendor/libgit2/src/refs.c +1 -0
- data/vendor/libgit2/src/refs.h +2 -1
- data/vendor/libgit2/src/refspec.c +2 -2
- data/vendor/libgit2/src/refspec.h +2 -0
- data/vendor/libgit2/src/remote.c +56 -10
- data/vendor/libgit2/src/remote.h +2 -0
- data/vendor/libgit2/src/repository.c +16 -14
- data/vendor/libgit2/src/repository.h +2 -0
- data/vendor/libgit2/src/reset.c +6 -5
- data/vendor/libgit2/src/revert.c +1 -0
- data/vendor/libgit2/src/revparse.c +3 -5
- data/vendor/libgit2/src/revwalk.c +2 -2
- data/vendor/libgit2/src/revwalk.h +2 -0
- data/vendor/libgit2/src/settings.c +6 -8
- data/vendor/libgit2/src/sha1_lookup.c +2 -216
- data/vendor/libgit2/src/sha1_lookup.h +2 -6
- data/vendor/libgit2/src/signature.c +8 -3
- data/vendor/libgit2/src/signature.h +2 -0
- data/vendor/libgit2/src/sortedcache.c +7 -0
- data/vendor/libgit2/src/sortedcache.h +2 -0
- data/vendor/libgit2/src/stash.c +1 -0
- data/vendor/libgit2/src/status.c +14 -9
- data/vendor/libgit2/src/status.h +2 -0
- data/vendor/libgit2/src/{curl_stream.c → streams/curl.c} +2 -0
- data/vendor/libgit2/src/{curl_stream.h → streams/curl.h} +4 -2
- data/vendor/libgit2/src/{openssl_stream.c → streams/openssl.c} +47 -18
- data/vendor/libgit2/src/{openssl_stream.h → streams/openssl.h} +6 -2
- data/vendor/libgit2/src/{socket_stream.c → streams/socket.c} +2 -2
- data/vendor/libgit2/src/{socket_stream.h → streams/socket.h} +4 -2
- data/vendor/libgit2/src/{stransport_stream.c → streams/stransport.c} +4 -2
- data/vendor/libgit2/src/{stransport_stream.h → streams/stransport.h} +4 -2
- data/vendor/libgit2/src/{tls_stream.c → streams/tls.c} +4 -3
- data/vendor/libgit2/src/{tls_stream.h → streams/tls.h} +4 -2
- data/vendor/libgit2/src/submodule.c +28 -80
- data/vendor/libgit2/src/submodule.h +2 -13
- data/vendor/libgit2/src/sysdir.c +75 -8
- data/vendor/libgit2/src/sysdir.h +2 -1
- data/vendor/libgit2/src/tag.c +2 -2
- data/vendor/libgit2/src/tag.h +2 -0
- data/vendor/libgit2/src/thread-utils.c +1 -0
- data/vendor/libgit2/src/thread-utils.h +1 -1
- data/vendor/libgit2/src/trace.c +2 -2
- data/vendor/libgit2/src/trace.h +2 -0
- data/vendor/libgit2/src/trailer.c +416 -0
- data/vendor/libgit2/src/transaction.c +2 -1
- data/vendor/libgit2/src/transport.c +2 -0
- data/vendor/libgit2/src/transports/auth.c +2 -1
- data/vendor/libgit2/src/transports/auth.h +4 -3
- data/vendor/libgit2/src/transports/auth_negotiate.c +2 -1
- data/vendor/libgit2/src/transports/auth_negotiate.h +3 -3
- data/vendor/libgit2/src/transports/cred.c +2 -0
- data/vendor/libgit2/src/transports/cred.h +4 -2
- data/vendor/libgit2/src/transports/cred_helpers.c +1 -0
- data/vendor/libgit2/src/transports/git.c +3 -1
- data/vendor/libgit2/src/transports/http.c +10 -14
- data/vendor/libgit2/src/transports/http.h +23 -0
- data/vendor/libgit2/src/transports/local.c +23 -5
- data/vendor/libgit2/src/transports/smart.c +3 -1
- data/vendor/libgit2/src/transports/smart.h +23 -16
- data/vendor/libgit2/src/transports/smart_pkt.c +114 -130
- data/vendor/libgit2/src/transports/smart_protocol.c +26 -22
- data/vendor/libgit2/src/transports/ssh.c +12 -7
- data/vendor/libgit2/src/transports/ssh.h +4 -2
- data/vendor/libgit2/src/transports/winhttp.c +19 -21
- data/vendor/libgit2/src/tree-cache.c +1 -0
- data/vendor/libgit2/src/tree-cache.h +1 -0
- data/vendor/libgit2/src/tree.c +20 -14
- data/vendor/libgit2/src/tree.h +2 -0
- data/vendor/libgit2/src/tsort.c +0 -1
- data/vendor/libgit2/src/unix/map.c +4 -1
- data/vendor/libgit2/src/unix/posix.h +8 -4
- data/vendor/libgit2/src/unix/pthread.h +1 -1
- data/vendor/libgit2/src/unix/realpath.c +4 -1
- data/vendor/libgit2/src/util.c +6 -5
- data/vendor/libgit2/src/util.h +39 -111
- data/vendor/libgit2/src/varint.c +0 -1
- data/vendor/libgit2/src/varint.h +2 -0
- data/vendor/libgit2/src/vector.c +1 -1
- data/vendor/libgit2/src/win32/dir.c +3 -0
- data/vendor/libgit2/src/win32/dir.h +4 -3
- data/vendor/libgit2/src/win32/error.c +1 -1
- data/vendor/libgit2/src/win32/error.h +4 -2
- data/vendor/libgit2/src/win32/findfile.c +2 -1
- data/vendor/libgit2/src/win32/findfile.h +4 -2
- data/vendor/libgit2/src/win32/map.c +2 -0
- data/vendor/libgit2/src/win32/mingw-compat.h +3 -3
- data/vendor/libgit2/src/win32/msvc-compat.h +3 -3
- data/vendor/libgit2/src/win32/path_w32.c +7 -12
- data/vendor/libgit2/src/win32/path_w32.h +3 -2
- data/vendor/libgit2/src/win32/posix.h +2 -2
- data/vendor/libgit2/src/win32/posix_w32.c +11 -5
- data/vendor/libgit2/src/win32/precompiled.h +2 -1
- data/vendor/libgit2/src/win32/reparse.h +2 -2
- data/vendor/libgit2/src/win32/thread.c +1 -0
- data/vendor/libgit2/src/win32/thread.h +2 -2
- data/vendor/libgit2/src/win32/utf-conv.c +0 -1
- data/vendor/libgit2/src/win32/utf-conv.h +4 -3
- data/vendor/libgit2/src/win32/w32_buffer.c +1 -1
- data/vendor/libgit2/src/win32/w32_buffer.h +4 -2
- data/vendor/libgit2/src/win32/w32_crtdbg_stacktrace.c +2 -1
- data/vendor/libgit2/src/win32/w32_crtdbg_stacktrace.h +85 -2
- data/vendor/libgit2/src/win32/w32_stack.c +2 -1
- data/vendor/libgit2/src/win32/w32_stack.h +5 -3
- data/vendor/libgit2/src/win32/w32_util.h +4 -2
- data/vendor/libgit2/src/win32/win32-compat.h +3 -3
- data/vendor/libgit2/src/worktree.c +4 -5
- data/vendor/libgit2/src/worktree.h +2 -0
- data/vendor/libgit2/src/xdiff/xdiff.h +22 -13
- data/vendor/libgit2/src/xdiff/xdiffi.c +523 -81
- data/vendor/libgit2/src/xdiff/xdiffi.h +2 -2
- data/vendor/libgit2/src/xdiff/xemit.c +63 -39
- data/vendor/libgit2/src/xdiff/xemit.h +2 -2
- data/vendor/libgit2/src/xdiff/xhistogram.c +0 -1
- data/vendor/libgit2/src/xdiff/xinclude.h +3 -2
- data/vendor/libgit2/src/xdiff/xmacros.h +2 -2
- data/vendor/libgit2/src/xdiff/xmerge.c +80 -20
- data/vendor/libgit2/src/xdiff/xpatience.c +41 -9
- data/vendor/libgit2/src/xdiff/xprepare.c +2 -2
- data/vendor/libgit2/src/xdiff/xprepare.h +2 -2
- data/vendor/libgit2/src/xdiff/xtypes.h +2 -2
- data/vendor/libgit2/src/xdiff/xutils.c +47 -27
- data/vendor/libgit2/src/xdiff/xutils.h +2 -5
- data/vendor/libgit2/src/zstream.c +65 -45
- data/vendor/libgit2/src/zstream.h +9 -2
- metadata +27 -13
- data/vendor/libgit2/include/git2/sys/remote.h +0 -16
data/ext/rugged/rugged_revwalk.c
CHANGED
@@ -345,11 +345,11 @@ static VALUE do_walk(VALUE _payload)
|
|
345
345
|
* Example:
|
346
346
|
*
|
347
347
|
* Rugged::Walker.walk(repo,
|
348
|
-
*
|
349
|
-
*
|
350
|
-
*
|
351
|
-
*
|
352
|
-
*
|
348
|
+
* show: "92b22bbcb37caf4f6f53d30292169e84f5e4283b",
|
349
|
+
* sort: Rugged::SORT_DATE|Rugged::SORT_TOPO,
|
350
|
+
* oid_only: true) do |commit_oid|
|
351
|
+
* puts commit_oid
|
352
|
+
* end
|
353
353
|
*
|
354
354
|
* generates:
|
355
355
|
*
|
@@ -365,14 +365,9 @@ static VALUE rb_git_walk(int argc, VALUE *argv, VALUE self)
|
|
365
365
|
struct walk_options w;
|
366
366
|
int exception = 0;
|
367
367
|
|
368
|
+
RETURN_ENUMERATOR(self, argc, argv);
|
368
369
|
rb_scan_args(argc, argv, "10:", &rb_repo, &rb_options);
|
369
370
|
|
370
|
-
if (!rb_block_given_p()) {
|
371
|
-
ID iter_method = ID2SYM(rb_intern("walk"));
|
372
|
-
return rb_funcall(self, rb_intern("to_enum"), 3,
|
373
|
-
iter_method, rb_repo, rb_options);
|
374
|
-
}
|
375
|
-
|
376
371
|
Data_Get_Struct(rb_repo, git_repository, w.repo);
|
377
372
|
rugged_exception_check(git_revwalk_new(&w.walk, w.repo));
|
378
373
|
|
@@ -402,13 +397,9 @@ static VALUE rb_git_walk_with_opts(int argc, VALUE *argv, VALUE self, int oid_on
|
|
402
397
|
VALUE rb_options;
|
403
398
|
struct walk_options w;
|
404
399
|
|
400
|
+
RETURN_ENUMERATOR(self, argc, argv);
|
405
401
|
rb_scan_args(argc, argv, "01", &rb_options);
|
406
402
|
|
407
|
-
if (!rb_block_given_p()) {
|
408
|
-
ID iter_method = ID2SYM(rb_intern(oid_only ? "each_oid" : "each"));
|
409
|
-
return rb_funcall(self, rb_intern("to_enum"), 2, iter_method, rb_options);
|
410
|
-
}
|
411
|
-
|
412
403
|
Data_Get_Struct(self, git_revwalk, w.walk);
|
413
404
|
w.repo = git_revwalk_repository(w.walk);
|
414
405
|
|
@@ -135,9 +135,37 @@ static VALUE rb_git_get_option(VALUE self, VALUE option)
|
|
135
135
|
}
|
136
136
|
}
|
137
137
|
|
138
|
+
/*
|
139
|
+
* call-seq:
|
140
|
+
* Rugged::Settings.max_cache_size -> max cache size
|
141
|
+
*
|
142
|
+
* Returns the maximum amount of memory the cache will consume.
|
143
|
+
*/
|
144
|
+
static VALUE rb_git_get_max_cache_size(VALUE mod) {
|
145
|
+
size_t val;
|
146
|
+
size_t max;
|
147
|
+
git_libgit2_opts(GIT_OPT_GET_CACHED_MEMORY, &val, &max);
|
148
|
+
return SIZET2NUM(max);
|
149
|
+
}
|
150
|
+
|
151
|
+
/*
|
152
|
+
* call-seq:
|
153
|
+
* Rugged::Settings.used_cache_size -> used cache size
|
154
|
+
*
|
155
|
+
* Returns the amount of memory the cache is currently consuming.
|
156
|
+
*/
|
157
|
+
static VALUE rb_git_get_used_cache_size(VALUE mod) {
|
158
|
+
size_t val;
|
159
|
+
size_t max;
|
160
|
+
git_libgit2_opts(GIT_OPT_GET_CACHED_MEMORY, &val, &max);
|
161
|
+
return SIZET2NUM(val);
|
162
|
+
}
|
163
|
+
|
138
164
|
void Init_rugged_settings(void)
|
139
165
|
{
|
140
166
|
VALUE rb_cRuggedSettings = rb_define_class_under(rb_mRugged, "Settings", rb_cObject);
|
141
167
|
rb_define_module_function(rb_cRuggedSettings, "[]=", rb_git_set_option, 2);
|
142
168
|
rb_define_module_function(rb_cRuggedSettings, "[]", rb_git_get_option, 1);
|
169
|
+
rb_define_module_function(rb_cRuggedSettings, "max_cache_size", rb_git_get_max_cache_size, 0);
|
170
|
+
rb_define_module_function(rb_cRuggedSettings, "used_cache_size", rb_git_get_used_cache_size, 0);
|
143
171
|
}
|
@@ -124,13 +124,12 @@ static VALUE rb_git_submodule_collection_each(VALUE self)
|
|
124
124
|
git_repository *repo;
|
125
125
|
int error;
|
126
126
|
struct rugged_cb_payload payload;
|
127
|
+
VALUE rb_repo;
|
127
128
|
|
128
|
-
|
129
|
+
RETURN_ENUMERATOR(self, 0, 0);
|
130
|
+
rb_repo = rugged_owner(self);
|
129
131
|
Data_Get_Struct(rb_repo, git_repository, repo);
|
130
132
|
|
131
|
-
if (!rb_block_given_p())
|
132
|
-
return rb_funcall(self, rb_intern("to_enum"), 1, CSTR2SYM("each"));
|
133
|
-
|
134
133
|
payload.exception = 0;
|
135
134
|
payload.rb_data = rb_repo;
|
136
135
|
|
@@ -236,13 +236,9 @@ static VALUE each_tag(int argc, VALUE *argv, VALUE self, int tag_names_only)
|
|
236
236
|
VALUE rb_repo = rugged_owner(self), rb_pattern;
|
237
237
|
const char *pattern = NULL;
|
238
238
|
|
239
|
+
RETURN_ENUMERATOR(self, argc, argv);
|
239
240
|
rb_scan_args(argc, argv, "01", &rb_pattern);
|
240
241
|
|
241
|
-
if (!rb_block_given_p()) {
|
242
|
-
VALUE symbol = tag_names_only ? CSTR2SYM("each_name") : CSTR2SYM("each");
|
243
|
-
return rb_funcall(self, rb_intern("to_enum"), 2, symbol, rb_pattern);
|
244
|
-
}
|
245
|
-
|
246
242
|
if (!NIL_P(rb_pattern)) {
|
247
243
|
Check_Type(rb_pattern, T_STRING);
|
248
244
|
pattern = StringValueCStr(rb_pattern);
|
data/ext/rugged/rugged_tree.c
CHANGED
@@ -220,10 +220,9 @@ static VALUE rb_git_tree_each(VALUE self)
|
|
220
220
|
{
|
221
221
|
git_tree *tree;
|
222
222
|
size_t i, count;
|
223
|
-
Data_Get_Struct(self, git_tree, tree);
|
224
223
|
|
225
|
-
|
226
|
-
|
224
|
+
RETURN_ENUMERATOR(self, 0, 0);
|
225
|
+
Data_Get_Struct(self, git_tree, tree);
|
227
226
|
|
228
227
|
count = git_tree_entrycount(tree);
|
229
228
|
|
data/lib/rugged/repository.rb
CHANGED
@@ -53,6 +53,49 @@ module Rugged
|
|
53
53
|
end
|
54
54
|
end
|
55
55
|
|
56
|
+
###
|
57
|
+
# call-seq:
|
58
|
+
# repo.status { |file, status_data| block }
|
59
|
+
# repo.status(path) -> status_data
|
60
|
+
#
|
61
|
+
# Returns the status for one or more files in the working directory
|
62
|
+
# of the repository. This is equivalent to the +git status+ command.
|
63
|
+
#
|
64
|
+
# The returned +status_data+ is always an array containing one or more
|
65
|
+
# status flags as Ruby symbols. Possible flags are:
|
66
|
+
#
|
67
|
+
# - +:index_new+: the file is new in the index
|
68
|
+
# - +:index_modified+: the file has been modified in the index
|
69
|
+
# - +:index_deleted+: the file has been deleted from the index
|
70
|
+
# - +:worktree_new+: the file is new in the working directory
|
71
|
+
# - +:worktree_modified+: the file has been modified in the working directory
|
72
|
+
# - +:worktree_deleted+: the file has been deleted from the working directory
|
73
|
+
#
|
74
|
+
# If a +block+ is given, status information will be gathered for every
|
75
|
+
# single file on the working dir. The +block+ will be called with the
|
76
|
+
# status data for each file.
|
77
|
+
#
|
78
|
+
# repo.status { |file, status_data| puts "#{file} has status: #{status_data.inspect}" }
|
79
|
+
#
|
80
|
+
# results in, for example:
|
81
|
+
#
|
82
|
+
# src/diff.c has status: [:index_new, :worktree_new]
|
83
|
+
# README has status: [:worktree_modified]
|
84
|
+
#
|
85
|
+
# If a +path+ is given instead, the function will return the +status_data+ for
|
86
|
+
# the file pointed to by path, or raise an exception if the path doesn't exist.
|
87
|
+
#
|
88
|
+
# +path+ must be relative to the repository's working directory.
|
89
|
+
#
|
90
|
+
# repo.status('src/diff.c') #=> [:index_new, :worktree_new]
|
91
|
+
def status(file = nil, &block)
|
92
|
+
if file
|
93
|
+
file_status file
|
94
|
+
else
|
95
|
+
each_status(&block)
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
56
99
|
def diff(left, right, opts = {})
|
57
100
|
left = rev_parse(left) if left.kind_of?(String)
|
58
101
|
right = rev_parse(right) if right.kind_of?(String)
|
data/lib/rugged/version.rb
CHANGED
data/vendor/libgit2/AUTHORS
CHANGED
@@ -12,11 +12,17 @@
|
|
12
12
|
# > cmake --build . --target install
|
13
13
|
|
14
14
|
PROJECT(libgit2 C)
|
15
|
-
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
|
15
|
+
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.11)
|
16
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()
|
17
23
|
|
18
24
|
# Add find modules to the path
|
19
|
-
SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${
|
25
|
+
SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${libgit2_SOURCE_DIR}/cmake/Modules/")
|
20
26
|
|
21
27
|
INCLUDE(CheckLibraryExists)
|
22
28
|
INCLUDE(CheckFunctionExists)
|
@@ -24,6 +30,11 @@ INCLUDE(CheckSymbolExists)
|
|
24
30
|
INCLUDE(CheckStructHasMember)
|
25
31
|
INCLUDE(AddCFlagIfSupported)
|
26
32
|
INCLUDE(FindPkgConfig)
|
33
|
+
INCLUDE(FindThreads)
|
34
|
+
INCLUDE(FindStatNsec)
|
35
|
+
INCLUDE(IdeSplitSources)
|
36
|
+
INCLUDE(FeatureSummary)
|
37
|
+
INCLUDE(EnableWarnings)
|
27
38
|
|
28
39
|
# Build options
|
29
40
|
#
|
@@ -37,22 +48,23 @@ OPTION( PROFILE "Generate profiling information" OFF )
|
|
37
48
|
OPTION( ENABLE_TRACE "Enables tracing support" OFF )
|
38
49
|
OPTION( LIBGIT2_FILENAME "Name of the produced binary" OFF )
|
39
50
|
|
40
|
-
|
41
|
-
OPTION( USE_ICONV "Link with and use iconv library" OFF )
|
51
|
+
SET(SHA1_BACKEND "CollisionDetection" CACHE STRING "Backend to use for SHA1. One of Generic, OpenSSL, Win32, CommonCrypto, CollisionDetection. ")
|
42
52
|
OPTION( USE_SSH "Link with libssh to enable SSH support" ON )
|
53
|
+
OPTION( USE_HTTPS "Enable HTTPS support. Can be set to a specific backend" ON )
|
43
54
|
OPTION( USE_GSSAPI "Link with libgssapi for SPNEGO auth" OFF )
|
44
55
|
OPTION( VALGRIND "Configure build for valgrind" OFF )
|
45
56
|
OPTION( CURL "Use curl for HTTP if available" ON)
|
57
|
+
OPTION( USE_EXT_HTTP_PARSER "Use system HTTP_Parser if available" ON)
|
46
58
|
OPTION( DEBUG_POOL "Enable debug pool allocator" OFF )
|
59
|
+
OPTION( ENABLE_WERROR "Enable compilation with -Werror" OFF )
|
60
|
+
OPTION( USE_BUNDLED_ZLIB "Use the bundled version of zlib" OFF )
|
47
61
|
|
48
|
-
IF(
|
49
|
-
|
62
|
+
IF (UNIX AND NOT APPLE)
|
63
|
+
OPTION( ENABLE_REPRODUCIBLE_BUILDS "Enable reproducible builds" OFF )
|
50
64
|
ENDIF()
|
51
65
|
|
52
|
-
IF(
|
53
|
-
|
54
|
-
FIND_PACKAGE(Security)
|
55
|
-
FIND_PACKAGE(CoreFoundation REQUIRED)
|
66
|
+
IF (APPLE)
|
67
|
+
OPTION( USE_ICONV "Link with and use iconv library" ON )
|
56
68
|
ENDIF()
|
57
69
|
|
58
70
|
IF(MSVC)
|
@@ -71,10 +83,6 @@ IF(MSVC)
|
|
71
83
|
# If you want to embed a copy of libssh2 into libgit2, pass a
|
72
84
|
# path to libssh2
|
73
85
|
OPTION( EMBED_SSH_PATH "Path to libssh2 to embed (Windows)" OFF )
|
74
|
-
|
75
|
-
ADD_DEFINITIONS(-D_SCL_SECURE_NO_WARNINGS)
|
76
|
-
ADD_DEFINITIONS(-D_CRT_SECURE_NO_DEPRECATE)
|
77
|
-
ADD_DEFINITIONS(-D_CRT_NONSTDC_NO_DEPRECATE)
|
78
86
|
ENDIF()
|
79
87
|
|
80
88
|
|
@@ -89,313 +97,21 @@ IF(MSVC)
|
|
89
97
|
OPTION(MSVC_CRTDBG "Enable CRTDBG memory leak reporting" OFF)
|
90
98
|
ENDIF()
|
91
99
|
|
92
|
-
|
93
|
-
OPTION( USE_OPENSSL "Link with and use openssl library" ON )
|
94
|
-
ENDIF()
|
95
|
-
|
96
|
-
CHECK_STRUCT_HAS_MEMBER ("struct stat" st_mtim "sys/types.h;sys/stat.h"
|
97
|
-
HAVE_STRUCT_STAT_ST_MTIM LANGUAGE C)
|
98
|
-
CHECK_STRUCT_HAS_MEMBER ("struct stat" st_mtimespec "sys/types.h;sys/stat.h"
|
99
|
-
HAVE_STRUCT_STAT_ST_MTIMESPEC LANGUAGE C)
|
100
|
-
CHECK_STRUCT_HAS_MEMBER("struct stat" st_mtime_nsec sys/stat.h
|
101
|
-
HAVE_STRUCT_STAT_MTIME_NSEC LANGUAGE C)
|
102
|
-
|
103
|
-
IF (HAVE_STRUCT_STAT_ST_MTIM)
|
104
|
-
CHECK_STRUCT_HAS_MEMBER("struct stat" st_mtim.tv_nsec sys/stat.h
|
105
|
-
HAVE_STRUCT_STAT_NSEC LANGUAGE C)
|
106
|
-
ELSEIF (HAVE_STRUCT_STAT_ST_MTIMESPEC)
|
107
|
-
CHECK_STRUCT_HAS_MEMBER("struct stat" st_mtimespec.tv_nsec sys/stat.h
|
108
|
-
HAVE_STRUCT_STAT_NSEC LANGUAGE C)
|
109
|
-
ELSE ()
|
110
|
-
SET( HAVE_STRUCT_STAT_NSEC ON )
|
111
|
-
ENDIF()
|
112
|
-
|
113
|
-
IF (HAVE_STRUCT_STAT_NSEC OR WIN32)
|
114
|
-
OPTION( USE_NSEC "Care about sub-second file mtimes and ctimes" ON )
|
115
|
-
ENDIF()
|
116
|
-
|
117
|
-
# This variable will contain the libraries we need to put into
|
118
|
-
# libgit2.pc's Requires.private. That is, what we're linking to or
|
119
|
-
# what someone who's statically linking us needs to link to.
|
120
|
-
SET(LIBGIT2_PC_REQUIRES "")
|
121
|
-
# This will be set later if we use the system's http-parser library or
|
122
|
-
# use iconv (OSX) and will be written to the Libs.private field in the
|
123
|
-
# pc file.
|
124
|
-
SET(LIBGIT2_PC_LIBS "")
|
125
|
-
|
126
|
-
# Installation paths
|
127
|
-
#
|
128
|
-
SET(BIN_INSTALL_DIR bin CACHE PATH "Where to install binaries to.")
|
129
|
-
SET(LIB_INSTALL_DIR lib CACHE PATH "Where to install libraries to.")
|
130
|
-
SET(INCLUDE_INSTALL_DIR include CACHE PATH "Where to install headers to.")
|
131
|
-
|
132
|
-
# Set a couple variables to be substituted inside the .pc file.
|
133
|
-
# We can't just use LIB_INSTALL_DIR in the .pc file, as passing them as absolue
|
134
|
-
# or relative paths is both valid and supported by cmake.
|
135
|
-
SET (PKGCONFIG_PREFIX ${CMAKE_INSTALL_PREFIX})
|
136
|
-
|
137
|
-
IF(IS_ABSOLUTE ${LIB_INSTALL_DIR})
|
138
|
-
SET (PKGCONFIG_LIBDIR ${LIB_INSTALL_DIR})
|
139
|
-
ELSE(IS_ABSOLUTE ${LIB_INSTALL_DIR})
|
140
|
-
SET (PKGCONFIG_LIBDIR "\${prefix}/${LIB_INSTALL_DIR}")
|
141
|
-
ENDIF (IS_ABSOLUTE ${LIB_INSTALL_DIR})
|
142
|
-
|
143
|
-
IF(IS_ABSOLUTE ${INCLUDE_INSTALL_DIR})
|
144
|
-
SET (PKGCONFIG_INCLUDEDIR ${INCLUDE_INSTALL_DIR})
|
145
|
-
ELSE(IS_ABSOLUTE ${INCLUDE_INSTALL_DIR})
|
146
|
-
SET (PKGCONFIG_INCLUDEDIR "\${prefix}/${INCLUDE_INSTALL_DIR}")
|
147
|
-
ENDIF(IS_ABSOLUTE ${INCLUDE_INSTALL_DIR})
|
148
|
-
|
149
|
-
FUNCTION(TARGET_OS_LIBRARIES target)
|
150
|
-
IF(WIN32)
|
151
|
-
TARGET_LINK_LIBRARIES(${target} ws2_32)
|
152
|
-
ELSEIF(CMAKE_SYSTEM_NAME MATCHES "(Solaris|SunOS)")
|
153
|
-
TARGET_LINK_LIBRARIES(${target} socket nsl)
|
154
|
-
LIST(APPEND LIBGIT2_PC_LIBS "-lsocket" "-lnsl")
|
155
|
-
SET(LIBGIT2_PC_LIBS ${LIBGIT2_PC_LIBS} PARENT_SCOPE)
|
156
|
-
ELSEIF(CMAKE_SYSTEM_NAME MATCHES "Haiku")
|
157
|
-
TARGET_LINK_LIBRARIES(${target} network)
|
158
|
-
LIST(APPEND LIBGIT2_PC_LIBS "-lnetwork")
|
159
|
-
SET(LIBGIT2_PC_LIBS ${LIBGIT2_PC_LIBS} PARENT_SCOPE)
|
160
|
-
ENDIF()
|
161
|
-
CHECK_LIBRARY_EXISTS(rt clock_gettime "time.h" NEED_LIBRT)
|
162
|
-
IF(NEED_LIBRT)
|
163
|
-
TARGET_LINK_LIBRARIES(${target} rt)
|
164
|
-
LIST(APPEND LIBGIT2_PC_LIBS "-lrt")
|
165
|
-
SET(LIBGIT2_PC_LIBS ${LIBGIT2_PC_LIBS} PARENT_SCOPE)
|
166
|
-
ENDIF()
|
167
|
-
|
168
|
-
IF(THREADSAFE)
|
169
|
-
TARGET_LINK_LIBRARIES(${target} ${CMAKE_THREAD_LIBS_INIT})
|
170
|
-
LIST(APPEND LIBGIT2_PC_LIBS ${CMAKE_THREAD_LIBS_INIT})
|
171
|
-
SET(LIBGIT2_PC_LIBS ${LIBGIT2_PC_LIBS} PARENT_SCOPE)
|
172
|
-
ENDIF()
|
173
|
-
ENDFUNCTION()
|
174
|
-
|
175
|
-
# This function splits the sources files up into their appropriate
|
176
|
-
# subdirectories. This is especially useful for IDEs like Xcode and
|
177
|
-
# Visual Studio, so that you can navigate into the libgit2_clar project,
|
178
|
-
# and see the folders within the tests folder (instead of just seeing all
|
179
|
-
# source and tests in a single folder.)
|
180
|
-
FUNCTION(IDE_SPLIT_SOURCES target)
|
181
|
-
IF(MSVC_IDE OR CMAKE_GENERATOR STREQUAL Xcode)
|
182
|
-
GET_TARGET_PROPERTY(sources ${target} SOURCES)
|
183
|
-
FOREACH(source ${sources})
|
184
|
-
IF(source MATCHES ".*/")
|
185
|
-
STRING(REPLACE ${CMAKE_CURRENT_SOURCE_DIR}/ "" rel ${source})
|
186
|
-
IF(rel)
|
187
|
-
STRING(REGEX REPLACE "/([^/]*)$" "" rel ${rel})
|
188
|
-
IF(rel)
|
189
|
-
STRING(REPLACE "/" "\\\\" rel ${rel})
|
190
|
-
SOURCE_GROUP(${rel} FILES ${source})
|
191
|
-
ENDIF()
|
192
|
-
ENDIF()
|
193
|
-
ENDIF()
|
194
|
-
ENDFOREACH()
|
195
|
-
ENDIF()
|
196
|
-
ENDFUNCTION()
|
197
|
-
|
198
|
-
FILE(STRINGS "include/git2/version.h" GIT2_HEADER REGEX "^#define LIBGIT2_VERSION \"[^\"]*\"$")
|
100
|
+
FILE(STRINGS "${libgit2_SOURCE_DIR}/include/git2/version.h" GIT2_HEADER REGEX "^#define LIBGIT2_VERSION \"[^\"]*\"$")
|
199
101
|
|
200
102
|
STRING(REGEX REPLACE "^.*LIBGIT2_VERSION \"([0-9]+).*$" "\\1" LIBGIT2_VERSION_MAJOR "${GIT2_HEADER}")
|
201
103
|
STRING(REGEX REPLACE "^.*LIBGIT2_VERSION \"[0-9]+\\.([0-9]+).*$" "\\1" LIBGIT2_VERSION_MINOR "${GIT2_HEADER}")
|
202
104
|
STRING(REGEX REPLACE "^.*LIBGIT2_VERSION \"[0-9]+\\.[0-9]+\\.([0-9]+).*$" "\\1" LIBGIT2_VERSION_REV "${GIT2_HEADER}")
|
203
105
|
SET(LIBGIT2_VERSION_STRING "${LIBGIT2_VERSION_MAJOR}.${LIBGIT2_VERSION_MINOR}.${LIBGIT2_VERSION_REV}")
|
204
106
|
|
205
|
-
FILE(STRINGS "include/git2/version.h" GIT2_HEADER_SOVERSION REGEX "^#define LIBGIT2_SOVERSION [0-9]+$")
|
107
|
+
FILE(STRINGS "${libgit2_SOURCE_DIR}/include/git2/version.h" GIT2_HEADER_SOVERSION REGEX "^#define LIBGIT2_SOVERSION [0-9]+$")
|
206
108
|
STRING(REGEX REPLACE "^.*LIBGIT2_SOVERSION ([0-9]+)$" "\\1" LIBGIT2_SOVERSION "${GIT2_HEADER_SOVERSION}")
|
207
109
|
|
208
|
-
# Find required dependencies
|
209
|
-
INCLUDE_DIRECTORIES(src include)
|
210
|
-
|
211
|
-
IF (SECURITY_FOUND)
|
212
|
-
# OS X 10.7 and older do not have some functions we use, fall back to OpenSSL there
|
213
|
-
CHECK_LIBRARY_EXISTS("${SECURITY_DIRS}" SSLCreateContext "Security/SecureTransport.h" HAVE_NEWER_SECURITY)
|
214
|
-
IF (HAVE_NEWER_SECURITY)
|
215
|
-
MESSAGE("-- Found Security ${SECURITY_DIRS}")
|
216
|
-
LIST(APPEND LIBGIT2_PC_LIBS "-framework Security")
|
217
|
-
ELSE()
|
218
|
-
MESSAGE("-- Security framework is too old, falling back to OpenSSL")
|
219
|
-
SET(SECURITY_FOUND "NO")
|
220
|
-
SET(SECURITY_DIRS "")
|
221
|
-
SET(SECURITY_DIR "")
|
222
|
-
SET(USE_OPENSSL "ON")
|
223
|
-
ENDIF()
|
224
|
-
ENDIF()
|
225
|
-
|
226
|
-
IF (COREFOUNDATION_FOUND)
|
227
|
-
MESSAGE("-- Found CoreFoundation ${COREFOUNDATION_DIRS}")
|
228
|
-
LIST(APPEND LIBGIT2_PC_LIBS "-framework CoreFoundation")
|
229
|
-
ENDIF()
|
230
|
-
|
231
|
-
|
232
|
-
IF (WIN32 AND EMBED_SSH_PATH)
|
233
|
-
FILE(GLOB SRC_SSH "${EMBED_SSH_PATH}/src/*.c")
|
234
|
-
INCLUDE_DIRECTORIES("${EMBED_SSH_PATH}/include")
|
235
|
-
FILE(WRITE "${EMBED_SSH_PATH}/src/libssh2_config.h" "#define HAVE_WINCNG\n#define LIBSSH2_WINCNG\n#include \"../win32/libssh2_config.h\"")
|
236
|
-
ADD_DEFINITIONS(-DGIT_SSH)
|
237
|
-
ENDIF()
|
238
|
-
|
239
|
-
IF (WIN32 AND WINHTTP)
|
240
|
-
ADD_DEFINITIONS(-DGIT_WINHTTP)
|
241
|
-
ADD_DEFINITIONS(-DGIT_HTTPS)
|
242
|
-
|
243
|
-
# Since MinGW does not come with headers or an import library for winhttp,
|
244
|
-
# we have to include a private header and generate our own import library
|
245
|
-
IF (MINGW)
|
246
|
-
FIND_PROGRAM(DLLTOOL dlltool CMAKE_FIND_ROOT_PATH_BOTH)
|
247
|
-
IF (NOT DLLTOOL)
|
248
|
-
MESSAGE(FATAL_ERROR "Could not find dlltool command")
|
249
|
-
ENDIF ()
|
250
|
-
|
251
|
-
SET(LIBWINHTTP_PATH "${CMAKE_CURRENT_BINARY_DIR}/deps/winhttp")
|
252
|
-
FILE(MAKE_DIRECTORY ${LIBWINHTTP_PATH})
|
253
|
-
|
254
|
-
IF (CMAKE_SIZEOF_VOID_P EQUAL 8)
|
255
|
-
set(WINHTTP_DEF "${CMAKE_CURRENT_SOURCE_DIR}/deps/winhttp/winhttp64.def")
|
256
|
-
ELSE()
|
257
|
-
set(WINHTTP_DEF "${CMAKE_CURRENT_SOURCE_DIR}/deps/winhttp/winhttp.def")
|
258
|
-
ENDIF()
|
259
|
-
|
260
|
-
ADD_CUSTOM_COMMAND(
|
261
|
-
OUTPUT ${LIBWINHTTP_PATH}/libwinhttp.a
|
262
|
-
COMMAND ${DLLTOOL} -d ${WINHTTP_DEF} -k -D winhttp.dll -l libwinhttp.a
|
263
|
-
DEPENDS ${WINHTTP_DEF}
|
264
|
-
WORKING_DIRECTORY ${LIBWINHTTP_PATH}
|
265
|
-
)
|
266
|
-
|
267
|
-
SET_SOURCE_FILES_PROPERTIES(
|
268
|
-
${CMAKE_CURRENT_SOURCE_DIR}/src/transports/winhttp.c
|
269
|
-
PROPERTIES OBJECT_DEPENDS ${LIBWINHTTP_PATH}/libwinhttp.a
|
270
|
-
)
|
271
|
-
|
272
|
-
INCLUDE_DIRECTORIES(deps/winhttp)
|
273
|
-
LINK_DIRECTORIES(${LIBWINHTTP_PATH})
|
274
|
-
ENDIF ()
|
275
|
-
|
276
|
-
LINK_LIBRARIES(winhttp rpcrt4 crypt32 ole32)
|
277
|
-
LIST(APPEND LIBGIT2_PC_LIBS "-lwinhttp" "-lrpcrt4" "-lcrypt32" "-lole32")
|
278
|
-
ELSE ()
|
279
|
-
IF (CURL)
|
280
|
-
PKG_CHECK_MODULES(CURL libcurl)
|
281
|
-
ENDIF ()
|
282
|
-
|
283
|
-
IF (NOT AMIGA AND USE_OPENSSL)
|
284
|
-
FIND_PACKAGE(OpenSSL)
|
285
|
-
ENDIF ()
|
286
|
-
|
287
|
-
IF (CURL_FOUND)
|
288
|
-
ADD_DEFINITIONS(-DGIT_CURL)
|
289
|
-
INCLUDE_DIRECTORIES(${CURL_INCLUDE_DIRS})
|
290
|
-
LINK_DIRECTORIES(${CURL_LIBRARY_DIRS})
|
291
|
-
LINK_LIBRARIES(${CURL_LIBRARIES})
|
292
|
-
LIST(APPEND LIBGIT2_PC_LIBS ${CURL_LDFLAGS})
|
293
|
-
ENDIF()
|
294
|
-
ENDIF()
|
295
|
-
|
296
|
-
# Specify sha1 implementation
|
297
|
-
IF (USE_SHA1DC)
|
298
|
-
ADD_DEFINITIONS(-DGIT_SHA1_COLLISIONDETECT)
|
299
|
-
ADD_DEFINITIONS(-DSHA1DC_NO_STANDARD_INCLUDES=1)
|
300
|
-
ADD_DEFINITIONS(-DSHA1DC_CUSTOM_INCLUDE_SHA1_C=\"common.h\")
|
301
|
-
ADD_DEFINITIONS(-DSHA1DC_CUSTOM_INCLUDE_UBC_CHECK_C=\"common.h\")
|
302
|
-
FILE(GLOB SRC_SHA1 src/hash/hash_collisiondetect.c src/hash/sha1dc/*)
|
303
|
-
ELSEIF (WIN32 AND NOT MINGW)
|
304
|
-
ADD_DEFINITIONS(-DGIT_SHA1_WIN32)
|
305
|
-
FILE(GLOB SRC_SHA1 src/hash/hash_win32.c)
|
306
|
-
ELSEIF (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
307
|
-
ADD_DEFINITIONS(-DGIT_SHA1_COMMON_CRYPTO)
|
308
|
-
ELSEIF (OPENSSL_FOUND)
|
309
|
-
ADD_DEFINITIONS(-DGIT_SHA1_OPENSSL)
|
310
|
-
IF (CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
|
311
|
-
LIST(APPEND LIBGIT2_PC_LIBS "-lssl")
|
312
|
-
ELSE()
|
313
|
-
SET(LIBGIT2_PC_REQUIRES "${LIBGIT2_PC_REQUIRES} openssl")
|
314
|
-
ENDIF ()
|
315
|
-
ELSE()
|
316
|
-
FILE(GLOB SRC_SHA1 src/hash/hash_generic.c)
|
317
|
-
ENDIF()
|
318
|
-
|
319
|
-
# Enable tracing
|
320
|
-
IF (ENABLE_TRACE STREQUAL "ON")
|
321
|
-
ADD_DEFINITIONS(-DGIT_TRACE)
|
322
|
-
ENDIF()
|
323
|
-
|
324
|
-
# Include POSIX regex when it is required
|
325
|
-
IF(WIN32 OR AMIGA OR CMAKE_SYSTEM_NAME MATCHES "(Solaris|SunOS)")
|
326
|
-
INCLUDE_DIRECTORIES(deps/regex)
|
327
|
-
SET(SRC_REGEX deps/regex/regex.c)
|
328
|
-
ENDIF()
|
329
|
-
|
330
|
-
# Optional external dependency: http-parser
|
331
|
-
FIND_PACKAGE(HTTP_Parser)
|
332
|
-
IF (HTTP_PARSER_FOUND AND HTTP_PARSER_VERSION_MAJOR EQUAL 2)
|
333
|
-
INCLUDE_DIRECTORIES(${HTTP_PARSER_INCLUDE_DIRS})
|
334
|
-
LINK_LIBRARIES(${HTTP_PARSER_LIBRARIES})
|
335
|
-
LIST(APPEND LIBGIT2_PC_LIBS "-lhttp_parser")
|
336
|
-
ELSE()
|
337
|
-
MESSAGE(STATUS "http-parser version 2 was not found; using bundled 3rd-party sources.")
|
338
|
-
INCLUDE_DIRECTORIES(deps/http-parser)
|
339
|
-
FILE(GLOB SRC_HTTP deps/http-parser/*.c deps/http-parser/*.h)
|
340
|
-
ENDIF()
|
341
|
-
|
342
|
-
# Optional external dependency: zlib
|
343
|
-
FIND_PACKAGE(ZLIB)
|
344
|
-
IF (ZLIB_FOUND)
|
345
|
-
INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIRS})
|
346
|
-
LINK_LIBRARIES(${ZLIB_LIBRARIES})
|
347
|
-
IF(APPLE OR CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
|
348
|
-
LIST(APPEND LIBGIT2_PC_LIBS "-lz")
|
349
|
-
ELSE()
|
350
|
-
SET(LIBGIT2_PC_REQUIRES "${LIBGIT2_PC_REQUIRES} zlib")
|
351
|
-
ENDIF()
|
352
|
-
ELSE()
|
353
|
-
MESSAGE(STATUS "zlib was not found; using bundled 3rd-party sources." )
|
354
|
-
INCLUDE_DIRECTORIES(deps/zlib)
|
355
|
-
ADD_DEFINITIONS(-DNO_VIZ -DSTDC -DNO_GZIP)
|
356
|
-
FILE(GLOB SRC_ZLIB deps/zlib/*.c deps/zlib/*.h)
|
357
|
-
ENDIF()
|
358
|
-
|
359
|
-
# Optional external dependency: libssh2
|
360
|
-
IF (USE_SSH)
|
361
|
-
PKG_CHECK_MODULES(LIBSSH2 libssh2)
|
362
|
-
ENDIF()
|
363
|
-
IF (LIBSSH2_FOUND)
|
364
|
-
ADD_DEFINITIONS(-DGIT_SSH)
|
365
|
-
INCLUDE_DIRECTORIES(${LIBSSH2_INCLUDE_DIRS})
|
366
|
-
LINK_DIRECTORIES(${LIBSSH2_LIBRARY_DIRS})
|
367
|
-
LIST(APPEND LIBGIT2_PC_LIBS ${LIBSSH2_LDFLAGS})
|
368
|
-
#SET(LIBGIT2_PC_LIBS "${LIBGIT2_PC_LIBS} ${LIBSSH2_LDFLAGS}")
|
369
|
-
SET(SSH_LIBRARIES ${LIBSSH2_LIBRARIES})
|
370
|
-
|
371
|
-
CHECK_LIBRARY_EXISTS("${LIBSSH2_LIBRARIES}" libssh2_userauth_publickey_frommemory "${LIBSSH2_LIBRARY_DIRS}" HAVE_LIBSSH2_MEMORY_CREDENTIALS)
|
372
|
-
IF (HAVE_LIBSSH2_MEMORY_CREDENTIALS)
|
373
|
-
ADD_DEFINITIONS(-DGIT_SSH_MEMORY_CREDENTIALS)
|
374
|
-
ENDIF()
|
375
|
-
ELSE()
|
376
|
-
MESSAGE(STATUS "LIBSSH2 not found. Set CMAKE_PREFIX_PATH if it is installed outside of the default search path.")
|
377
|
-
ENDIF()
|
378
|
-
|
379
|
-
# Optional external dependency: libgssapi
|
380
|
-
IF (USE_GSSAPI)
|
381
|
-
FIND_PACKAGE(GSSAPI)
|
382
|
-
ENDIF()
|
383
|
-
IF (GSSAPI_FOUND)
|
384
|
-
ADD_DEFINITIONS(-DGIT_GSSAPI)
|
385
|
-
ENDIF()
|
386
|
-
|
387
|
-
# Optional external dependency: iconv
|
388
|
-
IF (USE_ICONV)
|
389
|
-
FIND_PACKAGE(Iconv)
|
390
|
-
ENDIF()
|
391
|
-
IF (ICONV_FOUND)
|
392
|
-
ADD_DEFINITIONS(-DGIT_USE_ICONV)
|
393
|
-
INCLUDE_DIRECTORIES(${ICONV_INCLUDE_DIR})
|
394
|
-
LIST(APPEND LIBGIT2_PC_LIBS ${ICONV_LIBRARIES})
|
395
|
-
ENDIF()
|
396
|
-
|
397
110
|
# Platform specific compilation flags
|
398
111
|
IF (MSVC)
|
112
|
+
ADD_DEFINITIONS(-D_SCL_SECURE_NO_WARNINGS)
|
113
|
+
ADD_DEFINITIONS(-D_CRT_SECURE_NO_DEPRECATE)
|
114
|
+
ADD_DEFINITIONS(-D_CRT_NONSTDC_NO_DEPRECATE)
|
399
115
|
|
400
116
|
STRING(REPLACE "/Zm1000" " " CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
|
401
117
|
|
@@ -417,7 +133,8 @@ IF (MSVC)
|
|
417
133
|
ENDIF()
|
418
134
|
|
419
135
|
IF (MSVC_CRTDBG)
|
420
|
-
SET(
|
136
|
+
SET(GIT_MSVC_CRTDBG 1)
|
137
|
+
SET(CRT_FLAG_DEBUG "${CRT_FLAG_DEBUG}")
|
421
138
|
SET(CMAKE_C_STANDARD_LIBRARIES "${CMAKE_C_STANDARD_LIBRARIES} Dbghelp.lib")
|
422
139
|
ENDIF()
|
423
140
|
|
@@ -466,13 +183,17 @@ IF (MSVC)
|
|
466
183
|
SET(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE}")
|
467
184
|
SET(CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO}")
|
468
185
|
SET(CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL "${CMAKE_EXE_LINKER_FLAGS_MINSIZEREL}")
|
469
|
-
|
470
|
-
SET(WIN_RC "src/win32/git2.rc")
|
471
186
|
ELSE ()
|
187
|
+
IF (ENABLE_REPRODUCIBLE_BUILDS)
|
188
|
+
SET(CMAKE_C_ARCHIVE_CREATE "<CMAKE_AR> Dqc <TARGET> <LINK_FLAGS> <OBJECTS>")
|
189
|
+
SET(CMAKE_C_ARCHIVE_APPEND "<CMAKE_AR> Dq <TARGET> <LINK_FLAGS> <OBJECTS>")
|
190
|
+
SET(CMAKE_C_ARCHIVE_FINISH "<CMAKE_RANLIB> -D <TARGET>")
|
191
|
+
ENDIF()
|
192
|
+
|
472
193
|
SET(CMAKE_C_FLAGS "-D_GNU_SOURCE ${CMAKE_C_FLAGS}")
|
473
194
|
|
474
|
-
|
475
|
-
|
195
|
+
ENABLE_WARNINGS(all)
|
196
|
+
ENABLE_WARNINGS(extra)
|
476
197
|
|
477
198
|
IF (CMAKE_SYSTEM_NAME MATCHES "(Solaris|SunOS)")
|
478
199
|
SET(CMAKE_C_FLAGS "-std=c99 -D_POSIX_C_SOURCE=200112L -D__EXTENSIONS__ -D_POSIX_PTHREAD_SEMANTICS ${CMAKE_C_FLAGS}")
|
@@ -495,16 +216,17 @@ ELSE ()
|
|
495
216
|
ADD_DEFINITIONS(-D__USE_MINGW_ANSI_STDIO=1)
|
496
217
|
ENDIF ()
|
497
218
|
|
498
|
-
|
499
|
-
|
500
|
-
|
501
|
-
|
502
|
-
|
503
|
-
|
504
|
-
|
219
|
+
ENABLE_WARNINGS(documentation)
|
220
|
+
DISABLE_WARNINGS(missing-field-initializers)
|
221
|
+
ENABLE_WARNINGS(strict-aliasing)
|
222
|
+
ENABLE_WARNINGS(strict-prototypes)
|
223
|
+
ENABLE_WARNINGS(declaration-after-statement)
|
224
|
+
ENABLE_WARNINGS(shift-count-overflow)
|
225
|
+
DISABLE_WARNINGS(unused-const-variable)
|
226
|
+
DISABLE_WARNINGS(unused-function)
|
505
227
|
|
506
228
|
IF (APPLE) # Apple deprecated OpenSSL
|
507
|
-
|
229
|
+
DISABLE_WARNINGS(deprecated-declarations)
|
508
230
|
ENDIF()
|
509
231
|
|
510
232
|
IF (PROFILE)
|
@@ -513,26 +235,6 @@ ELSE ()
|
|
513
235
|
ENDIF ()
|
514
236
|
ENDIF()
|
515
237
|
|
516
|
-
CHECK_SYMBOL_EXISTS(regcomp_l "regex.h;xlocale.h" HAVE_REGCOMP_L)
|
517
|
-
IF (HAVE_REGCOMP_L)
|
518
|
-
ADD_DEFINITIONS(-DHAVE_REGCOMP_L)
|
519
|
-
ENDIF ()
|
520
|
-
|
521
|
-
CHECK_FUNCTION_EXISTS(futimens HAVE_FUTIMENS)
|
522
|
-
IF (HAVE_FUTIMENS)
|
523
|
-
ADD_DEFINITIONS(-DHAVE_FUTIMENS)
|
524
|
-
ENDIF ()
|
525
|
-
|
526
|
-
CHECK_FUNCTION_EXISTS(qsort_r HAVE_QSORT_R)
|
527
|
-
IF (HAVE_QSORT_R)
|
528
|
-
ADD_DEFINITIONS(-DHAVE_QSORT_R)
|
529
|
-
ENDIF ()
|
530
|
-
|
531
|
-
CHECK_FUNCTION_EXISTS(qsort_s HAVE_QSORT_S)
|
532
|
-
IF (HAVE_QSORT_S)
|
533
|
-
ADD_DEFINITIONS(-DHAVE_QSORT_S)
|
534
|
-
ENDIF ()
|
535
|
-
|
536
238
|
IF( NOT CMAKE_CONFIGURATION_TYPES )
|
537
239
|
# Build Debug by default
|
538
240
|
IF (NOT CMAKE_BUILD_TYPE)
|
@@ -543,177 +245,18 @@ ELSE()
|
|
543
245
|
# that uses CMAKE_CONFIGURATION_TYPES and not CMAKE_BUILD_TYPE
|
544
246
|
ENDIF()
|
545
247
|
|
546
|
-
|
547
|
-
ADD_DEFINITIONS(-DGIT_SECURE_TRANSPORT)
|
548
|
-
ADD_DEFINITIONS(-DGIT_HTTPS)
|
549
|
-
INCLUDE_DIRECTORIES(${SECURITY_INCLUDE_DIR})
|
550
|
-
ENDIF ()
|
551
|
-
|
552
|
-
IF (OPENSSL_FOUND)
|
553
|
-
ADD_DEFINITIONS(-DGIT_OPENSSL)
|
554
|
-
ADD_DEFINITIONS(-DGIT_HTTPS)
|
555
|
-
INCLUDE_DIRECTORIES(${OPENSSL_INCLUDE_DIR})
|
556
|
-
SET(SSL_LIBRARIES ${OPENSSL_LIBRARIES})
|
557
|
-
ENDIF()
|
558
|
-
|
559
|
-
|
560
|
-
|
561
|
-
IF (THREADSAFE)
|
562
|
-
IF (NOT WIN32)
|
563
|
-
FIND_PACKAGE(Threads REQUIRED)
|
564
|
-
ENDIF()
|
565
|
-
|
566
|
-
ADD_DEFINITIONS(-DGIT_THREADS)
|
567
|
-
ENDIF()
|
568
|
-
|
569
|
-
IF (USE_NSEC)
|
570
|
-
ADD_DEFINITIONS(-DGIT_USE_NSEC)
|
571
|
-
ENDIF()
|
572
|
-
|
573
|
-
IF (HAVE_STRUCT_STAT_ST_MTIM)
|
574
|
-
ADD_DEFINITIONS(-DGIT_USE_STAT_MTIM)
|
575
|
-
ELSEIF (HAVE_STRUCT_STAT_ST_MTIMESPEC)
|
576
|
-
ADD_DEFINITIONS(-DGIT_USE_STAT_MTIMESPEC)
|
577
|
-
ELSEIF (HAVE_STRUCT_STAT_ST_MTIME_NSEC)
|
578
|
-
ADD_DEFINITIONS(-DGIT_USE_STAT_MTIME_NSEC)
|
579
|
-
ENDIF()
|
580
|
-
|
581
|
-
ADD_DEFINITIONS(-D_FILE_OFFSET_BITS=64)
|
248
|
+
ADD_SUBDIRECTORY(src)
|
582
249
|
|
583
|
-
#
|
584
|
-
|
585
|
-
|
586
|
-
|
587
|
-
|
588
|
-
ADD_DEFINITIONS(-DWIN32 -D_WIN32_WINNT=0x0501)
|
589
|
-
FILE(GLOB SRC_OS src/win32/*.c src/win32/*.h)
|
590
|
-
ELSEIF (AMIGA)
|
591
|
-
ADD_DEFINITIONS(-DNO_ADDRINFO -DNO_READDIR_R -DNO_MMAP)
|
592
|
-
ELSE()
|
593
|
-
IF (VALGRIND)
|
594
|
-
ADD_DEFINITIONS(-DNO_MMAP)
|
595
|
-
ENDIF()
|
596
|
-
FILE(GLOB SRC_OS src/unix/*.c src/unix/*.h)
|
597
|
-
ENDIF()
|
598
|
-
FILE(GLOB SRC_GIT2 src/*.c src/*.h src/transports/*.c src/transports/*.h src/xdiff/*.c src/xdiff/*.h)
|
599
|
-
|
600
|
-
# Determine architecture of the machine
|
601
|
-
IF (CMAKE_SIZEOF_VOID_P EQUAL 8)
|
602
|
-
ADD_DEFINITIONS(-DGIT_ARCH_64)
|
603
|
-
ELSEIF (CMAKE_SIZEOF_VOID_P EQUAL 4)
|
604
|
-
ADD_DEFINITIONS(-DGIT_ARCH_32)
|
605
|
-
ELSEIF (CMAKE_SIZEOF_VOID_P)
|
606
|
-
MESSAGE(FATAL_ERROR "Unsupported architecture (pointer size is ${CMAKE_SIZEOF_VOID_P} bytes)")
|
607
|
-
ELSE()
|
608
|
-
MESSAGE(FATAL_ERROR "Unsupported architecture (CMAKE_SIZEOF_VOID_P is unset)")
|
609
|
-
ENDIF()
|
610
|
-
|
611
|
-
# Compile and link libgit2
|
612
|
-
ADD_LIBRARY(git2 ${SRC_H} ${SRC_GIT2} ${SRC_OS} ${SRC_ZLIB} ${SRC_HTTP} ${SRC_REGEX} ${SRC_SSH} ${SRC_SHA1} ${WIN_RC})
|
613
|
-
TARGET_LINK_LIBRARIES(git2 ${SECURITY_DIRS})
|
614
|
-
TARGET_LINK_LIBRARIES(git2 ${COREFOUNDATION_DIRS})
|
615
|
-
TARGET_LINK_LIBRARIES(git2 ${SSL_LIBRARIES})
|
616
|
-
TARGET_LINK_LIBRARIES(git2 ${SSH_LIBRARIES})
|
617
|
-
TARGET_LINK_LIBRARIES(git2 ${GSSAPI_LIBRARIES})
|
618
|
-
TARGET_LINK_LIBRARIES(git2 ${ICONV_LIBRARIES})
|
619
|
-
TARGET_OS_LIBRARIES(git2)
|
620
|
-
|
621
|
-
# Workaround for Cmake bug #0011240 (see http://public.kitware.com/Bug/view.php?id=11240)
|
622
|
-
# Win64+MSVC+static libs = linker error
|
623
|
-
IF(MSVC AND GIT_ARCH_64 AND NOT BUILD_SHARED_LIBS)
|
624
|
-
SET_TARGET_PROPERTIES(git2 PROPERTIES STATIC_LIBRARY_FLAGS "/MACHINE:x64")
|
625
|
-
ENDIF()
|
626
|
-
|
627
|
-
IDE_SPLIT_SOURCES(git2)
|
628
|
-
|
629
|
-
IF (SONAME)
|
630
|
-
SET_TARGET_PROPERTIES(git2 PROPERTIES VERSION ${LIBGIT2_VERSION_STRING})
|
631
|
-
SET_TARGET_PROPERTIES(git2 PROPERTIES SOVERSION ${LIBGIT2_SOVERSION})
|
632
|
-
IF (LIBGIT2_FILENAME)
|
633
|
-
ADD_DEFINITIONS(-DLIBGIT2_FILENAME=\"${LIBGIT2_FILENAME}\")
|
634
|
-
SET_TARGET_PROPERTIES(git2 PROPERTIES OUTPUT_NAME ${LIBGIT2_FILENAME})
|
635
|
-
ELSEIF (DEFINED LIBGIT2_PREFIX)
|
636
|
-
SET_TARGET_PROPERTIES(git2 PROPERTIES PREFIX "${LIBGIT2_PREFIX}")
|
637
|
-
ENDIF()
|
638
|
-
ENDIF()
|
639
|
-
STRING(REPLACE ";" " " LIBGIT2_PC_LIBS "${LIBGIT2_PC_LIBS}")
|
640
|
-
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/libgit2.pc.in ${CMAKE_CURRENT_BINARY_DIR}/libgit2.pc @ONLY)
|
641
|
-
|
642
|
-
IF (MSVC_IDE)
|
643
|
-
# Precompiled headers
|
644
|
-
SET_TARGET_PROPERTIES(git2 PROPERTIES COMPILE_FLAGS "/Yuprecompiled.h /FIprecompiled.h")
|
645
|
-
SET_SOURCE_FILES_PROPERTIES(src/win32/precompiled.c COMPILE_FLAGS "/Ycprecompiled.h")
|
250
|
+
# Tests
|
251
|
+
IF (NOT MSVC)
|
252
|
+
IF (NOT BUILD_SHARED_LIBS)
|
253
|
+
SET(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
|
254
|
+
ENDIF()
|
646
255
|
ENDIF ()
|
647
256
|
|
648
|
-
# Install
|
649
|
-
INSTALL(TARGETS git2
|
650
|
-
RUNTIME DESTINATION ${BIN_INSTALL_DIR}
|
651
|
-
LIBRARY DESTINATION ${LIB_INSTALL_DIR}
|
652
|
-
ARCHIVE DESTINATION ${LIB_INSTALL_DIR}
|
653
|
-
)
|
654
|
-
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/libgit2.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig )
|
655
|
-
INSTALL(DIRECTORY include/git2 DESTINATION ${INCLUDE_INSTALL_DIR} )
|
656
|
-
INSTALL(FILES include/git2.h DESTINATION ${INCLUDE_INSTALL_DIR} )
|
657
|
-
|
658
|
-
# Tests
|
659
257
|
IF (BUILD_CLAR)
|
660
|
-
FIND_PACKAGE(PythonInterp)
|
661
|
-
|
662
|
-
IF(NOT PYTHONINTERP_FOUND)
|
663
|
-
MESSAGE(FATAL_ERROR "Could not find a python interpeter, which is needed to build the tests. "
|
664
|
-
"Make sure python is available, or pass -DBUILD_CLAR=OFF to skip building the tests")
|
665
|
-
ENDIF()
|
666
|
-
|
667
|
-
SET(CLAR_FIXTURES "${CMAKE_CURRENT_SOURCE_DIR}/tests/resources/")
|
668
|
-
SET(CLAR_PATH "${CMAKE_CURRENT_SOURCE_DIR}/tests")
|
669
|
-
SET(CLAR_RESOURCES "${CMAKE_CURRENT_SOURCE_DIR}/tests/resources" CACHE PATH "Path to test resources.")
|
670
|
-
ADD_DEFINITIONS(-DCLAR_FIXTURE_PATH=\"${CLAR_FIXTURES}\")
|
671
|
-
ADD_DEFINITIONS(-DCLAR_RESOURCES=\"${TEST_RESOURCES}\")
|
672
|
-
ADD_DEFINITIONS(-DCLAR_TMPDIR=\"libgit2_tests\")
|
673
|
-
|
674
|
-
INCLUDE_DIRECTORIES(${CLAR_PATH})
|
675
|
-
FILE(GLOB_RECURSE SRC_TEST ${CLAR_PATH}/*/*.c ${CLAR_PATH}/*/*.h)
|
676
|
-
SET(SRC_CLAR "${CLAR_PATH}/main.c" "${CLAR_PATH}/clar_libgit2.c" "${CLAR_PATH}/clar_libgit2_trace.c" "${CLAR_PATH}/clar_libgit2_timer.c" "${CLAR_PATH}/clar.c")
|
677
|
-
|
678
|
-
ADD_CUSTOM_COMMAND(
|
679
|
-
OUTPUT ${CLAR_PATH}/clar.suite
|
680
|
-
COMMAND ${PYTHON_EXECUTABLE} generate.py -f -xonline -xstress .
|
681
|
-
DEPENDS ${SRC_TEST}
|
682
|
-
WORKING_DIRECTORY ${CLAR_PATH}
|
683
|
-
)
|
684
|
-
|
685
|
-
SET_SOURCE_FILES_PROPERTIES(
|
686
|
-
${CLAR_PATH}/clar.c
|
687
|
-
PROPERTIES OBJECT_DEPENDS ${CLAR_PATH}/clar.suite)
|
688
|
-
|
689
|
-
ADD_EXECUTABLE(libgit2_clar ${SRC_H} ${SRC_GIT2} ${SRC_OS} ${SRC_CLAR} ${SRC_TEST} ${SRC_ZLIB} ${SRC_HTTP} ${SRC_REGEX} ${SRC_SSH} ${SRC_SHA1})
|
690
|
-
|
691
|
-
TARGET_LINK_LIBRARIES(libgit2_clar ${COREFOUNDATION_DIRS})
|
692
|
-
TARGET_LINK_LIBRARIES(libgit2_clar ${SECURITY_DIRS})
|
693
|
-
TARGET_LINK_LIBRARIES(libgit2_clar ${SSL_LIBRARIES})
|
694
|
-
TARGET_LINK_LIBRARIES(libgit2_clar ${SSH_LIBRARIES})
|
695
|
-
TARGET_LINK_LIBRARIES(libgit2_clar ${GSSAPI_LIBRARIES})
|
696
|
-
TARGET_LINK_LIBRARIES(libgit2_clar ${ICONV_LIBRARIES})
|
697
|
-
TARGET_OS_LIBRARIES(libgit2_clar)
|
698
|
-
IDE_SPLIT_SOURCES(libgit2_clar)
|
699
|
-
|
700
|
-
IF (MSVC_IDE)
|
701
|
-
# Precompiled headers
|
702
|
-
SET_TARGET_PROPERTIES(libgit2_clar PROPERTIES COMPILE_FLAGS "/Yuprecompiled.h /FIprecompiled.h")
|
703
|
-
ENDIF ()
|
704
|
-
|
705
258
|
ENABLE_TESTING()
|
706
|
-
|
707
|
-
ADD_TEST(libgit2_clar libgit2_clar -ionline -xclone::local::git_style_unc_paths -xclone::local::standard_unc_paths_are_written_git_style)
|
708
|
-
ELSE ()
|
709
|
-
ADD_TEST(libgit2_clar libgit2_clar -v -xclone::local::git_style_unc_paths -xclone::local::standard_unc_paths_are_written_git_style)
|
710
|
-
ENDIF ()
|
711
|
-
|
712
|
-
# Add a test target which runs the cred callback tests, to be
|
713
|
-
# called after setting the url and user
|
714
|
-
ADD_TEST(libgit2_clar-cred_callback libgit2_clar -v -sonline::clone::cred_callback)
|
715
|
-
ADD_TEST(libgit2_clar-proxy_credentials_in_url libgit2_clar -v -sonline::clone::proxy_credentials_in_url)
|
716
|
-
ADD_TEST(libgit2_clar-proxy_credentials_request libgit2_clar -v -sonline::clone::proxy_credentials_request)
|
259
|
+
ADD_SUBDIRECTORY(tests)
|
717
260
|
ENDIF ()
|
718
261
|
|
719
262
|
IF (TAGS)
|
@@ -738,3 +281,11 @@ ENDIF ()
|
|
738
281
|
IF (BUILD_EXAMPLES)
|
739
282
|
ADD_SUBDIRECTORY(examples)
|
740
283
|
ENDIF ()
|
284
|
+
|
285
|
+
IF(CMAKE_VERSION VERSION_GREATER 3)
|
286
|
+
FEATURE_SUMMARY(WHAT ENABLED_FEATURES DESCRIPTION "Enabled features:")
|
287
|
+
FEATURE_SUMMARY(WHAT DISABLED_FEATURES DESCRIPTION "Disabled features:")
|
288
|
+
ELSE()
|
289
|
+
PRINT_ENABLED_FEATURES()
|
290
|
+
PRINT_DISABLED_FEATURES()
|
291
|
+
ENDIF()
|