rugged 0.19.0 → 0.21.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +1 -1
- data/README.md +151 -25
- data/ext/rugged/extconf.rb +48 -27
- data/ext/rugged/rugged.c +107 -35
- data/ext/rugged/rugged.h +44 -8
- data/ext/rugged/rugged_blame.c +292 -0
- data/ext/rugged/rugged_blob.c +84 -31
- data/ext/rugged/rugged_branch.c +90 -223
- data/ext/rugged/rugged_branch_collection.c +445 -0
- data/ext/rugged/rugged_commit.c +190 -9
- data/ext/rugged/rugged_config.c +1 -1
- data/ext/rugged/rugged_cred.c +125 -0
- data/ext/rugged/rugged_diff.c +267 -94
- data/ext/rugged/rugged_diff_delta.c +14 -3
- data/ext/rugged/rugged_diff_hunk.c +31 -28
- data/ext/rugged/rugged_diff_line.c +21 -17
- data/ext/rugged/rugged_index.c +326 -6
- data/ext/rugged/rugged_note.c +39 -34
- data/ext/rugged/rugged_object.c +9 -9
- data/ext/rugged/rugged_patch.c +245 -0
- data/ext/rugged/rugged_reference.c +67 -332
- data/ext/rugged/rugged_reference_collection.c +490 -0
- data/ext/rugged/rugged_remote.c +447 -351
- data/ext/rugged/rugged_remote_collection.c +285 -0
- data/ext/rugged/rugged_repo.c +752 -203
- data/ext/rugged/rugged_revwalk.c +119 -27
- data/ext/rugged/rugged_settings.c +48 -1
- data/ext/rugged/rugged_signature.c +30 -16
- data/ext/rugged/rugged_tag.c +86 -191
- data/ext/rugged/rugged_tag_collection.c +279 -0
- data/ext/rugged/rugged_tree.c +159 -22
- data/lib/rugged/branch.rb +8 -17
- data/lib/rugged/credentials.rb +43 -0
- data/lib/rugged/diff/delta.rb +1 -2
- data/lib/rugged/diff/hunk.rb +4 -9
- data/lib/rugged/diff/line.rb +23 -3
- data/lib/rugged/diff.rb +3 -1
- data/lib/rugged/patch.rb +26 -0
- data/lib/rugged/reference.rb +1 -3
- data/lib/rugged/remote.rb +0 -9
- data/lib/rugged/repository.rb +70 -13
- data/lib/rugged/tag.rb +23 -18
- data/lib/rugged/tree.rb +7 -0
- data/lib/rugged/version.rb +1 -1
- data/lib/rugged.rb +8 -1
- data/vendor/libgit2/AUTHORS +75 -0
- data/vendor/libgit2/CMakeLists.txt +490 -0
- data/vendor/libgit2/COPYING +920 -0
- data/vendor/libgit2/Makefile.embed +25 -7
- data/vendor/libgit2/cmake/Modules/AddCFlagIfSupported.cmake +16 -0
- data/vendor/libgit2/cmake/Modules/FindHTTP_Parser.cmake +39 -0
- data/vendor/libgit2/cmake/Modules/FindIconv.cmake +43 -0
- data/vendor/libgit2/cmake/Modules/FindLIBSSH2.cmake +44 -0
- data/vendor/libgit2/deps/http-parser/LICENSE-MIT +23 -0
- data/vendor/libgit2/deps/regex/regex.c +10 -3
- data/vendor/libgit2/include/git2/attr.h +2 -1
- data/vendor/libgit2/include/git2/blame.h +213 -0
- data/vendor/libgit2/include/git2/blob.h +57 -29
- data/vendor/libgit2/include/git2/branch.h +56 -44
- data/vendor/libgit2/include/git2/buffer.h +112 -0
- data/vendor/libgit2/include/git2/checkout.h +72 -37
- data/vendor/libgit2/include/git2/cherrypick.h +87 -0
- data/vendor/libgit2/include/git2/clone.h +153 -56
- data/vendor/libgit2/include/git2/commit.h +82 -12
- data/vendor/libgit2/include/git2/common.h +31 -19
- data/vendor/libgit2/include/git2/config.h +124 -19
- data/vendor/libgit2/include/git2/cred_helpers.h +1 -1
- data/vendor/libgit2/include/git2/diff.h +636 -494
- data/vendor/libgit2/include/git2/errors.h +48 -15
- data/vendor/libgit2/include/git2/filter.h +149 -0
- data/vendor/libgit2/include/git2/graph.h +14 -0
- data/vendor/libgit2/include/git2/index.h +95 -54
- data/vendor/libgit2/include/git2/indexer.h +15 -9
- data/vendor/libgit2/include/git2/merge.h +402 -39
- data/vendor/libgit2/include/git2/message.h +9 -14
- data/vendor/libgit2/include/git2/net.h +5 -0
- data/vendor/libgit2/include/git2/notes.h +6 -6
- data/vendor/libgit2/include/git2/object.h +34 -2
- data/vendor/libgit2/include/git2/odb.h +77 -14
- data/vendor/libgit2/include/git2/odb_backend.h +50 -6
- data/vendor/libgit2/include/git2/oid.h +4 -8
- data/vendor/libgit2/include/git2/pack.h +58 -4
- data/vendor/libgit2/include/git2/patch.h +277 -0
- data/vendor/libgit2/include/git2/pathspec.h +263 -0
- data/vendor/libgit2/include/git2/push.h +55 -5
- data/vendor/libgit2/include/git2/reflog.h +11 -8
- data/vendor/libgit2/include/git2/refs.h +219 -33
- data/vendor/libgit2/include/git2/refspec.h +3 -4
- data/vendor/libgit2/include/git2/remote.h +216 -76
- data/vendor/libgit2/include/git2/repository.h +85 -40
- data/vendor/libgit2/include/git2/reset.h +15 -4
- data/vendor/libgit2/include/git2/revert.h +86 -0
- data/vendor/libgit2/include/git2/revparse.h +27 -16
- data/vendor/libgit2/include/git2/revwalk.h +44 -6
- data/vendor/libgit2/include/git2/signature.h +17 -3
- data/vendor/libgit2/include/git2/stash.h +8 -12
- data/vendor/libgit2/include/git2/status.h +67 -18
- data/vendor/libgit2/include/git2/submodule.h +100 -85
- data/vendor/libgit2/include/git2/sys/commit.h +38 -4
- data/vendor/libgit2/include/git2/sys/config.h +44 -3
- data/vendor/libgit2/include/git2/sys/diff.h +91 -0
- data/vendor/libgit2/include/git2/sys/filter.h +301 -0
- data/vendor/libgit2/include/git2/sys/index.h +0 -2
- data/vendor/libgit2/include/git2/sys/mempack.h +85 -0
- data/vendor/libgit2/include/git2/sys/odb_backend.h +33 -11
- data/vendor/libgit2/include/git2/sys/refdb_backend.h +51 -5
- data/vendor/libgit2/include/git2/sys/reflog.h +21 -0
- data/vendor/libgit2/include/git2/sys/refs.h +2 -2
- data/vendor/libgit2/include/git2/sys/repository.h +19 -1
- data/vendor/libgit2/include/git2/transport.h +216 -75
- data/vendor/libgit2/include/git2/tree.h +32 -11
- data/vendor/libgit2/include/git2/types.h +124 -10
- data/vendor/libgit2/include/git2/version.h +4 -2
- data/vendor/libgit2/include/git2.h +41 -40
- data/vendor/libgit2/libgit2.pc.in +10 -0
- data/vendor/libgit2/src/array.h +16 -8
- data/vendor/libgit2/src/attr.c +140 -402
- data/vendor/libgit2/src/attr.h +1 -33
- data/vendor/libgit2/src/attr_file.c +298 -135
- data/vendor/libgit2/src/attr_file.h +61 -22
- data/vendor/libgit2/src/attrcache.c +449 -0
- data/vendor/libgit2/src/attrcache.h +38 -6
- data/vendor/libgit2/src/bitvec.h +75 -0
- data/vendor/libgit2/src/blame.c +488 -0
- data/vendor/libgit2/src/blame.h +93 -0
- data/vendor/libgit2/src/blame_git.c +624 -0
- data/vendor/libgit2/src/blame_git.h +20 -0
- data/vendor/libgit2/src/blob.c +137 -92
- data/vendor/libgit2/src/blob.h +9 -0
- data/vendor/libgit2/src/branch.c +175 -156
- data/vendor/libgit2/src/buf_text.c +29 -14
- data/vendor/libgit2/src/buf_text.h +5 -4
- data/vendor/libgit2/src/buffer.c +158 -15
- data/vendor/libgit2/src/buffer.h +33 -20
- data/vendor/libgit2/src/cc-compat.h +8 -2
- data/vendor/libgit2/src/checkout.c +1081 -287
- data/vendor/libgit2/src/checkout.h +1 -1
- data/vendor/libgit2/src/cherrypick.c +226 -0
- data/vendor/libgit2/src/clone.c +297 -245
- data/vendor/libgit2/src/{compress.h → clone.h} +4 -8
- data/vendor/libgit2/src/commit.c +313 -101
- data/vendor/libgit2/src/commit.h +6 -3
- data/vendor/libgit2/src/commit_list.c +3 -3
- data/vendor/libgit2/src/commit_list.h +1 -1
- data/vendor/libgit2/src/common.h +74 -1
- data/vendor/libgit2/src/config.c +570 -145
- data/vendor/libgit2/src/config.h +39 -6
- data/vendor/libgit2/src/config_cache.c +32 -18
- data/vendor/libgit2/src/config_file.c +711 -424
- data/vendor/libgit2/src/config_file.h +4 -3
- data/vendor/libgit2/src/crlf.c +149 -109
- data/vendor/libgit2/src/date.c +35 -7
- data/vendor/libgit2/src/delta.c +1 -1
- data/vendor/libgit2/src/diff.c +719 -414
- data/vendor/libgit2/src/diff.h +52 -7
- data/vendor/libgit2/src/diff_driver.c +183 -85
- data/vendor/libgit2/src/diff_driver.h +1 -1
- data/vendor/libgit2/src/diff_file.c +65 -84
- data/vendor/libgit2/src/diff_file.h +12 -10
- data/vendor/libgit2/src/diff_patch.c +274 -333
- data/vendor/libgit2/src/diff_patch.h +10 -9
- data/vendor/libgit2/src/diff_print.c +381 -179
- data/vendor/libgit2/src/diff_stats.c +336 -0
- data/vendor/libgit2/src/diff_tform.c +393 -215
- data/vendor/libgit2/src/diff_xdiff.c +117 -42
- data/vendor/libgit2/src/errors.c +59 -4
- data/vendor/libgit2/src/fetch.c +40 -34
- data/vendor/libgit2/src/fetch.h +2 -5
- data/vendor/libgit2/src/fetchhead.c +14 -7
- data/vendor/libgit2/src/filebuf.c +13 -24
- data/vendor/libgit2/src/filebuf.h +3 -3
- data/vendor/libgit2/src/fileops.c +104 -296
- data/vendor/libgit2/src/fileops.h +23 -94
- data/vendor/libgit2/src/filter.c +642 -43
- data/vendor/libgit2/src/filter.h +7 -66
- data/vendor/libgit2/src/fnmatch.c +46 -3
- data/vendor/libgit2/src/fnmatch.h +24 -3
- data/vendor/libgit2/src/global.c +158 -42
- data/vendor/libgit2/src/global.h +9 -0
- data/vendor/libgit2/src/graph.c +34 -20
- data/vendor/libgit2/src/hash/hash_generic.h +0 -1
- data/vendor/libgit2/src/hash/hash_openssl.h +0 -1
- data/vendor/libgit2/src/hash/hash_win32.c +14 -29
- data/vendor/libgit2/src/hash.h +0 -2
- data/vendor/libgit2/src/hashsig.c +97 -117
- data/vendor/libgit2/src/ident.c +125 -0
- data/vendor/libgit2/src/ignore.c +159 -110
- data/vendor/libgit2/src/ignore.h +13 -3
- data/vendor/libgit2/src/index.c +803 -445
- data/vendor/libgit2/src/index.h +43 -6
- data/vendor/libgit2/src/indexer.c +475 -157
- data/vendor/libgit2/src/iterator.c +198 -55
- data/vendor/libgit2/src/iterator.h +28 -4
- data/vendor/libgit2/src/map.h +1 -0
- data/vendor/libgit2/src/merge.c +849 -142
- data/vendor/libgit2/src/merge.h +11 -4
- data/vendor/libgit2/src/merge_file.c +183 -78
- data/vendor/libgit2/src/merge_file.h +0 -57
- data/vendor/libgit2/src/message.c +4 -28
- data/vendor/libgit2/src/mwindow.c +117 -8
- data/vendor/libgit2/src/mwindow.h +9 -1
- data/vendor/libgit2/src/netops.c +164 -59
- data/vendor/libgit2/src/netops.h +37 -1
- data/vendor/libgit2/src/notes.c +9 -18
- data/vendor/libgit2/src/notes.h +1 -1
- data/vendor/libgit2/src/object.c +78 -2
- data/vendor/libgit2/src/odb.c +191 -59
- data/vendor/libgit2/src/odb.h +2 -1
- data/vendor/libgit2/src/odb_loose.c +66 -51
- data/vendor/libgit2/src/odb_mempack.c +182 -0
- data/vendor/libgit2/src/odb_pack.c +151 -61
- data/vendor/libgit2/src/oid.c +30 -19
- data/vendor/libgit2/src/oid.h +13 -10
- data/vendor/libgit2/src/pack-objects.c +198 -147
- data/vendor/libgit2/src/pack-objects.h +7 -0
- data/vendor/libgit2/src/pack.c +272 -101
- data/vendor/libgit2/src/pack.h +15 -1
- data/vendor/libgit2/src/path.c +359 -117
- data/vendor/libgit2/src/path.h +110 -20
- data/vendor/libgit2/src/pathspec.c +583 -57
- data/vendor/libgit2/src/pathspec.h +36 -15
- data/vendor/libgit2/src/pool.c +4 -5
- data/vendor/libgit2/src/posix.c +45 -2
- data/vendor/libgit2/src/posix.h +13 -5
- data/vendor/libgit2/src/pqueue.c +73 -119
- data/vendor/libgit2/src/pqueue.h +35 -82
- data/vendor/libgit2/src/push.c +116 -48
- data/vendor/libgit2/src/push.h +5 -0
- data/vendor/libgit2/src/refdb.c +45 -6
- data/vendor/libgit2/src/refdb.h +13 -3
- data/vendor/libgit2/src/refdb_fs.c +1130 -551
- data/vendor/libgit2/src/reflog.c +36 -327
- data/vendor/libgit2/src/reflog.h +6 -1
- data/vendor/libgit2/src/refs.c +345 -142
- data/vendor/libgit2/src/refs.h +9 -2
- data/vendor/libgit2/src/refspec.c +90 -62
- data/vendor/libgit2/src/refspec.h +7 -24
- data/vendor/libgit2/src/remote.c +815 -415
- data/vendor/libgit2/src/remote.h +3 -4
- data/vendor/libgit2/src/repository.c +360 -207
- data/vendor/libgit2/src/repository.h +16 -10
- data/vendor/libgit2/src/reset.c +28 -13
- data/vendor/libgit2/src/revert.c +228 -0
- data/vendor/libgit2/src/revparse.c +29 -30
- data/vendor/libgit2/src/revwalk.c +141 -96
- data/vendor/libgit2/src/revwalk.h +6 -1
- data/vendor/libgit2/src/settings.c +140 -0
- data/vendor/libgit2/src/sha1_lookup.c +71 -0
- data/vendor/libgit2/src/sha1_lookup.h +5 -0
- data/vendor/libgit2/src/signature.c +38 -10
- data/vendor/libgit2/src/sortedcache.c +378 -0
- data/vendor/libgit2/src/sortedcache.h +178 -0
- data/vendor/libgit2/src/stash.c +98 -116
- data/vendor/libgit2/src/status.c +88 -60
- data/vendor/libgit2/src/status.h +2 -2
- data/vendor/libgit2/src/strmap.c +32 -0
- data/vendor/libgit2/src/strmap.h +14 -1
- data/vendor/libgit2/src/strnlen.h +23 -0
- data/vendor/libgit2/src/submodule.c +1073 -615
- data/vendor/libgit2/src/submodule.h +89 -21
- data/vendor/libgit2/src/sysdir.c +252 -0
- data/vendor/libgit2/src/sysdir.h +101 -0
- data/vendor/libgit2/src/tag.c +31 -20
- data/vendor/libgit2/src/thread-utils.h +98 -17
- data/vendor/libgit2/src/trace.h +0 -2
- data/vendor/libgit2/src/transport.c +76 -6
- data/vendor/libgit2/src/transports/cred.c +164 -61
- data/vendor/libgit2/src/transports/git.c +41 -48
- data/vendor/libgit2/src/transports/http.c +65 -109
- data/vendor/libgit2/src/transports/local.c +88 -65
- data/vendor/libgit2/src/transports/smart.c +91 -19
- data/vendor/libgit2/src/transports/smart.h +13 -5
- data/vendor/libgit2/src/transports/smart_pkt.c +24 -14
- data/vendor/libgit2/src/transports/smart_protocol.c +268 -113
- data/vendor/libgit2/src/transports/ssh.c +284 -186
- data/vendor/libgit2/src/transports/winhttp.c +279 -198
- data/vendor/libgit2/src/tree-cache.c +21 -23
- data/vendor/libgit2/src/tree-cache.h +1 -0
- data/vendor/libgit2/src/tree.c +109 -92
- data/vendor/libgit2/src/tree.h +2 -3
- data/vendor/libgit2/src/unix/map.c +7 -1
- data/vendor/libgit2/src/unix/posix.h +0 -1
- data/vendor/libgit2/src/userdiff.h +208 -0
- data/vendor/libgit2/src/util.c +16 -112
- data/vendor/libgit2/src/util.h +107 -3
- data/vendor/libgit2/src/vector.c +72 -17
- data/vendor/libgit2/src/vector.h +32 -5
- data/vendor/libgit2/src/win32/dir.c +15 -40
- data/vendor/libgit2/src/win32/dir.h +3 -2
- data/vendor/libgit2/src/win32/error.c +5 -31
- data/vendor/libgit2/src/win32/findfile.c +47 -66
- data/vendor/libgit2/src/win32/findfile.h +1 -12
- data/vendor/libgit2/src/win32/git2.rc +40 -0
- data/vendor/libgit2/src/win32/map.c +7 -1
- data/vendor/libgit2/src/win32/mingw-compat.h +3 -0
- data/vendor/libgit2/src/win32/posix.h +17 -11
- data/vendor/libgit2/src/win32/posix_w32.c +424 -292
- data/vendor/libgit2/src/win32/precompiled.h +6 -2
- data/vendor/libgit2/src/win32/pthread.c +141 -18
- data/vendor/libgit2/src/win32/pthread.h +50 -8
- data/vendor/libgit2/src/win32/reparse.h +57 -0
- data/vendor/libgit2/src/win32/utf-conv.c +117 -60
- data/vendor/libgit2/src/win32/utf-conv.h +81 -6
- data/vendor/libgit2/src/win32/version.h +21 -4
- data/vendor/libgit2/src/win32/w32_util.c +139 -0
- data/vendor/libgit2/src/win32/w32_util.h +54 -0
- data/vendor/libgit2/src/zstream.c +156 -0
- data/vendor/libgit2/src/zstream.h +39 -0
- metadata +84 -167
- data/Rakefile +0 -61
- data/ext/rugged/rugged_diff_patch.c +0 -169
- data/lib/rugged/diff/patch.rb +0 -28
- data/test/blob_test.rb +0 -341
- data/test/branch_test.rb +0 -199
- data/test/commit_test.rb +0 -104
- data/test/config_test.rb +0 -45
- data/test/coverage/cover.rb +0 -133
- data/test/diff_test.rb +0 -777
- data/test/errors_test.rb +0 -34
- data/test/fixtures/alternate/objects/14/6ae76773c91e3b1d00cf7a338ec55ae58297e2 +0 -0
- data/test/fixtures/alternate/objects/14/9c32d47e99d0a3572ff1e70a2e0051bbf347a9 +0 -0
- data/test/fixtures/alternate/objects/14/fb3108588f9421bf764041e5e3ac305eb6277f +0 -0
- data/test/fixtures/archive.tar.gz +0 -0
- data/test/fixtures/attr/attr0 +0 -1
- data/test/fixtures/attr/attr1 +0 -29
- data/test/fixtures/attr/attr2 +0 -21
- data/test/fixtures/attr/attr3 +0 -4
- data/test/fixtures/attr/binfile +0 -1
- data/test/fixtures/attr/dir/file +0 -0
- data/test/fixtures/attr/file +0 -1
- data/test/fixtures/attr/gitattributes +0 -29
- data/test/fixtures/attr/gitignore +0 -2
- data/test/fixtures/attr/ign +0 -1
- data/test/fixtures/attr/macro_bad +0 -1
- data/test/fixtures/attr/macro_test +0 -1
- data/test/fixtures/attr/root_test1 +0 -1
- data/test/fixtures/attr/root_test2 +0 -6
- data/test/fixtures/attr/root_test3 +0 -19
- data/test/fixtures/attr/root_test4.txt +0 -14
- data/test/fixtures/attr/sub/abc +0 -37
- data/test/fixtures/attr/sub/dir/file +0 -0
- data/test/fixtures/attr/sub/file +0 -1
- data/test/fixtures/attr/sub/ign/file +0 -1
- data/test/fixtures/attr/sub/ign/sub/file +0 -1
- data/test/fixtures/attr/sub/sub/dir +0 -0
- data/test/fixtures/attr/sub/sub/file +0 -1
- data/test/fixtures/attr/sub/sub/subsub.txt +0 -1
- data/test/fixtures/attr/sub/subdir_test1 +0 -2
- data/test/fixtures/attr/sub/subdir_test2.txt +0 -1
- data/test/fixtures/diff/another.txt +0 -38
- data/test/fixtures/diff/readme.txt +0 -36
- data/test/fixtures/mergedrepo/conflicts-one.txt +0 -5
- data/test/fixtures/mergedrepo/conflicts-two.txt +0 -5
- data/test/fixtures/mergedrepo/one.txt +0 -10
- data/test/fixtures/mergedrepo/two.txt +0 -12
- data/test/fixtures/status/current_file +0 -1
- data/test/fixtures/status/ignored_file +0 -1
- data/test/fixtures/status/modified_file +0 -2
- data/test/fixtures/status/new_file +0 -1
- data/test/fixtures/status/staged_changes +0 -2
- data/test/fixtures/status/staged_changes_modified_file +0 -3
- data/test/fixtures/status/staged_delete_modified_file +0 -1
- data/test/fixtures/status/staged_new_file +0 -1
- data/test/fixtures/status/staged_new_file_modified_file +0 -2
- data/test/fixtures/status/subdir/current_file +0 -1
- data/test/fixtures/status/subdir/modified_file +0 -2
- data/test/fixtures/status/subdir/new_file +0 -1
- data/test/fixtures/status/subdir.txt +0 -2
- data/test/fixtures/status//350/277/231 +0 -1
- data/test/fixtures/testrepo.git/HEAD +0 -1
- data/test/fixtures/testrepo.git/config +0 -13
- data/test/fixtures/testrepo.git/description +0 -1
- data/test/fixtures/testrepo.git/index +0 -0
- data/test/fixtures/testrepo.git/info/exclude +0 -6
- data/test/fixtures/testrepo.git/logs/HEAD +0 -3
- data/test/fixtures/testrepo.git/logs/refs/heads/master +0 -3
- data/test/fixtures/testrepo.git/logs/refs/notes/commits +0 -1
- data/test/fixtures/testrepo.git/objects/0c/37a5391bbff43c37f0d0371823a5509eed5b1d +0 -0
- data/test/fixtures/testrepo.git/objects/13/85f264afb75a56a5bec74243be9b367ba4ca08 +0 -0
- data/test/fixtures/testrepo.git/objects/18/1037049a54a1eb5fab404658a3a250b44335d7 +0 -0
- data/test/fixtures/testrepo.git/objects/18/10dff58d8a660512d4832e740f692884338ccd +0 -0
- data/test/fixtures/testrepo.git/objects/2d/2eff63372b08adf0a9eb84109ccf7d19e2f3a2 +0 -0
- data/test/fixtures/testrepo.git/objects/36/060c58702ed4c2a40832c51758d5344201d89a +0 -2
- data/test/fixtures/testrepo.git/objects/44/1034f860c1d5d90e4188d11ae0d325176869a8 +0 -1
- data/test/fixtures/testrepo.git/objects/45/b983be36b73c0788dc9cbcb76cbb80fc7bb057 +0 -0
- data/test/fixtures/testrepo.git/objects/4a/202b346bb0fb0db7eff3cffeb3c70babbd2045 +0 -2
- data/test/fixtures/testrepo.git/objects/5b/5b025afb0b4c913b4c338a42934a3863bf3644 +0 -2
- data/test/fixtures/testrepo.git/objects/60/d415052a33de2150bf68757f6461df4f563ae4 +0 -0
- data/test/fixtures/testrepo.git/objects/61/9f9935957e010c419cb9d15621916ddfcc0b96 +0 -0
- data/test/fixtures/testrepo.git/objects/68/8a8f4ef7496901d15322972f96e212a9e466cc +0 -1
- data/test/fixtures/testrepo.git/objects/75/057dd4114e74cca1d750d0aee1647c903cb60a +0 -0
- data/test/fixtures/testrepo.git/objects/77/71329dfa3002caf8c61a0ceb62a31d09023f37 +0 -0
- data/test/fixtures/testrepo.git/objects/81/4889a078c031f61ed08ab5fa863aea9314344d +0 -0
- data/test/fixtures/testrepo.git/objects/84/96071c1b46c854b31185ea97743be6a8774479 +0 -0
- data/test/fixtures/testrepo.git/objects/94/eca2de348d5f672faf56b0decafa5937e3235e +0 -0
- data/test/fixtures/testrepo.git/objects/9b/7384fe1676186192842f5d3e129457b62db9e3 +0 -0
- data/test/fixtures/testrepo.git/objects/9f/d738e8f7967c078dceed8190330fc8648ee56a +0 -3
- data/test/fixtures/testrepo.git/objects/a4/a7dce85cf63874e984719f4fdd239f5145052f +0 -2
- data/test/fixtures/testrepo.git/objects/a7/1586c1dfe8a71c6cbf6c129f404c5642ff31bd +0 -0
- data/test/fixtures/testrepo.git/objects/a8/233120f6ad708f843d861ce2b7228ec4e3dec6 +0 -0
- data/test/fixtures/testrepo.git/objects/b7/4713326bc972cc15751ed504dca6f6f3b91f7a +0 -3
- data/test/fixtures/testrepo.git/objects/be/3563ae3f795b2b4353bcce3a527ad0a4f7f644 +0 -3
- data/test/fixtures/testrepo.git/objects/c4/7800c7266a2be04c571c04d5a6614691ea99bd +0 -3
- data/test/fixtures/testrepo.git/objects/c4/dc1555e4d4fa0e0c9c3fc46734c7c35b3ce90b +0 -0
- data/test/fixtures/testrepo.git/objects/e6/9de29bb2d1d6434b8b29ae775ad8c2e48c5391 +0 -0
- data/test/fixtures/testrepo.git/objects/f6/0079018b664e4e79329a7ef9559c8d9e0378d1 +0 -0
- data/test/fixtures/testrepo.git/objects/fa/49b077972391ad58037050f2a75f74e3671e92 +0 -0
- data/test/fixtures/testrepo.git/objects/fd/093bff70906175335656e6ce6ae05783708765 +0 -0
- data/test/fixtures/testrepo.git/objects/pack/pack-d7c6adf9f61318f041845b01440d09aa7a91e1b5.idx +0 -0
- data/test/fixtures/testrepo.git/objects/pack/pack-d7c6adf9f61318f041845b01440d09aa7a91e1b5.pack +0 -0
- data/test/fixtures/testrepo.git/packed-refs +0 -2
- data/test/fixtures/testrepo.git/refs/heads/master +0 -1
- data/test/fixtures/testrepo.git/refs/notes/commits +0 -1
- data/test/fixtures/testrepo.git/refs/tags/v0.9 +0 -1
- data/test/fixtures/testrepo.git/refs/tags/v1.0 +0 -1
- data/test/fixtures/text_file.md +0 -464
- data/test/fixtures/unsymlinked.git/HEAD +0 -1
- data/test/fixtures/unsymlinked.git/config +0 -6
- data/test/fixtures/unsymlinked.git/description +0 -1
- data/test/fixtures/unsymlinked.git/info/exclude +0 -2
- data/test/fixtures/unsymlinked.git/objects/08/8b64704e0d6b8bd061dea879418cb5442a3fbf +0 -0
- data/test/fixtures/unsymlinked.git/objects/13/a5e939bca25940c069fd2169d993dba328e30b +0 -0
- data/test/fixtures/unsymlinked.git/objects/19/bf568e59e3a0b363cafb4106226e62d4a4c41c +0 -0
- data/test/fixtures/unsymlinked.git/objects/58/1fadd35b4cf320d102a152f918729011604773 +0 -0
- data/test/fixtures/unsymlinked.git/objects/5c/87b6791e8b13da658a14d1ef7e09b5dc3bac8c +0 -0
- data/test/fixtures/unsymlinked.git/objects/6f/e5f5398af85fb3de8a6aba0339b6d3bfa26a27 +0 -0
- data/test/fixtures/unsymlinked.git/objects/7f/ccd75616ec188b8f1b23d67506a334cc34a49d +0 -0
- data/test/fixtures/unsymlinked.git/objects/80/6999882bf91d24241e4077906b9017605eb1f3 +0 -0
- data/test/fixtures/unsymlinked.git/objects/83/7d176303c5005505ec1e4a30231c40930c0230 +0 -0
- data/test/fixtures/unsymlinked.git/objects/a8/595ccca04f40818ae0155c8f9c77a230e597b6 +0 -2
- data/test/fixtures/unsymlinked.git/objects/cf/8f1cf5cce859c438d6cc067284cb5e161206e7 +0 -0
- data/test/fixtures/unsymlinked.git/objects/d5/278d05c8607ec420bfee4cf219fbc0eeebfd6a +0 -0
- data/test/fixtures/unsymlinked.git/objects/f4/e16fb76536591a41454194058d048d8e4dd2e9 +0 -0
- data/test/fixtures/unsymlinked.git/objects/f9/e65619d93fdf2673882e0a261c5e93b1a84006 +0 -0
- data/test/fixtures/unsymlinked.git/refs/heads/exe-file +0 -1
- data/test/fixtures/unsymlinked.git/refs/heads/master +0 -1
- data/test/fixtures/unsymlinked.git/refs/heads/reg-file +0 -1
- data/test/index_test.rb +0 -333
- data/test/lib_test.rb +0 -127
- data/test/note_test.rb +0 -158
- data/test/object_test.rb +0 -43
- data/test/reference_test.rb +0 -207
- data/test/remote_test.rb +0 -324
- data/test/repo_pack_test.rb +0 -24
- data/test/repo_reset_test.rb +0 -82
- data/test/repo_test.rb +0 -402
- data/test/tag_test.rb +0 -68
- data/test/test_helper.rb +0 -92
- data/test/tree_test.rb +0 -91
- data/test/walker_test.rb +0 -88
- data/vendor/libgit2/src/amiga/map.c +0 -48
- data/vendor/libgit2/src/compress.c +0 -53
data/lib/rugged/tree.rb
CHANGED
@@ -2,6 +2,13 @@ module Rugged
|
|
2
2
|
class Tree
|
3
3
|
include Enumerable
|
4
4
|
|
5
|
+
attr_reader :owner
|
6
|
+
alias repo owner
|
7
|
+
|
8
|
+
def diff(other = nil, options = nil)
|
9
|
+
Tree.diff(repo, self, other, options)
|
10
|
+
end
|
11
|
+
|
5
12
|
def inspect
|
6
13
|
data = "#<Rugged::Tree:#{object_id} {oid: #{oid}}>\n"
|
7
14
|
self.each { |e| data << " <\"#{e[:name]}\" #{e[:oid]}>\n" }
|
data/lib/rugged/version.rb
CHANGED
data/lib/rugged.rb
CHANGED
@@ -1,4 +1,9 @@
|
|
1
|
-
|
1
|
+
begin
|
2
|
+
RUBY_VERSION =~ /(\d+.\d+)/
|
3
|
+
require "rugged/#{$1}/rugged"
|
4
|
+
rescue LoadError
|
5
|
+
require "rugged/rugged"
|
6
|
+
end
|
2
7
|
require 'rugged/index'
|
3
8
|
require 'rugged/object'
|
4
9
|
require 'rugged/commit'
|
@@ -10,4 +15,6 @@ require 'rugged/tree'
|
|
10
15
|
require 'rugged/tag'
|
11
16
|
require 'rugged/branch'
|
12
17
|
require 'rugged/diff'
|
18
|
+
require 'rugged/patch'
|
13
19
|
require 'rugged/remote'
|
20
|
+
require 'rugged/credentials'
|
@@ -0,0 +1,75 @@
|
|
1
|
+
The following people contribute or have contributed
|
2
|
+
to the libgit2 project (sorted alphabetically):
|
3
|
+
|
4
|
+
Alex Budovski
|
5
|
+
Alexei Sholik
|
6
|
+
Andreas Ericsson
|
7
|
+
Anton "antong" Gyllenberg
|
8
|
+
Ankur Sethi
|
9
|
+
Arthur Schreiber
|
10
|
+
Ben Noordhuis
|
11
|
+
Ben Straub
|
12
|
+
Benjamin C Meyer
|
13
|
+
Brian Downing
|
14
|
+
Brian Lopez
|
15
|
+
Carlos Martín Nieto
|
16
|
+
Colin Timmermans
|
17
|
+
Daniel Huckstep
|
18
|
+
Dave Borowitz
|
19
|
+
David Boyce
|
20
|
+
David Glesser
|
21
|
+
Dmitry Kakurin
|
22
|
+
Dmitry Kovega
|
23
|
+
Emeric Fermas
|
24
|
+
Emmanuel Rodriguez
|
25
|
+
Florian Forster
|
26
|
+
Holger Weiss
|
27
|
+
Ingmar Vanhassel
|
28
|
+
J. David Ibáñez
|
29
|
+
Jacques Germishuys
|
30
|
+
Jakob Pfender
|
31
|
+
Jason Penny
|
32
|
+
Jason R. McNeil
|
33
|
+
Jerome Lambourg
|
34
|
+
Johan 't Hart
|
35
|
+
John Wiegley
|
36
|
+
Jonathan "Duke" Leto
|
37
|
+
Julien Miotte
|
38
|
+
Julio Espinoza-Sokal
|
39
|
+
Justin Love
|
40
|
+
Kelly "kelly.leahy" Leahy
|
41
|
+
Kirill A. Shutemov
|
42
|
+
Lambert CLARA
|
43
|
+
Luc Bertrand
|
44
|
+
Marc Pegon
|
45
|
+
Marcel Groothuis
|
46
|
+
Marco Villegas
|
47
|
+
Michael "schu" Schubert
|
48
|
+
Microsoft Corporation
|
49
|
+
Olivier Ramonat
|
50
|
+
Peter Drahoš
|
51
|
+
Pierre Habouzit
|
52
|
+
Przemyslaw Pawelczyk
|
53
|
+
Ramsay Jones
|
54
|
+
Robert G. Jakabosky
|
55
|
+
Romain Geissler
|
56
|
+
Romain Muller
|
57
|
+
Russell Belfer
|
58
|
+
Sakari Jokinen
|
59
|
+
Samuel Charles "Sam" Day
|
60
|
+
Sarath Lakshman
|
61
|
+
Sascha Cunz
|
62
|
+
Sascha Peilicke
|
63
|
+
Scott Chacon
|
64
|
+
Sebastian Schuberth
|
65
|
+
Sergey Nikishin
|
66
|
+
Shawn O. Pearce
|
67
|
+
Shuhei Tanuma
|
68
|
+
Steve Frécinaux
|
69
|
+
Sven Strickroth
|
70
|
+
Tim Branyen
|
71
|
+
Tim Clem
|
72
|
+
Tim Harder
|
73
|
+
Torsten Bögershausen
|
74
|
+
Trent Mick
|
75
|
+
Vicent Marti
|
@@ -0,0 +1,490 @@
|
|
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
|
13
|
+
|
14
|
+
PROJECT(libgit2 C)
|
15
|
+
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
|
16
|
+
|
17
|
+
# Add find modules to the path
|
18
|
+
SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/")
|
19
|
+
|
20
|
+
INCLUDE(CheckLibraryExists)
|
21
|
+
INCLUDE(AddCFlagIfSupported)
|
22
|
+
|
23
|
+
# Build options
|
24
|
+
#
|
25
|
+
OPTION( SONAME "Set the (SO)VERSION of the target" ON )
|
26
|
+
OPTION( BUILD_SHARED_LIBS "Build Shared Library (OFF for Static)" ON )
|
27
|
+
OPTION( THREADSAFE "Build libgit2 as threadsafe" OFF )
|
28
|
+
OPTION( BUILD_CLAR "Build Tests using the Clar suite" ON )
|
29
|
+
OPTION( BUILD_EXAMPLES "Build library usage example apps" OFF )
|
30
|
+
OPTION( TAGS "Generate tags" OFF )
|
31
|
+
OPTION( PROFILE "Generate profiling information" OFF )
|
32
|
+
OPTION( ENABLE_TRACE "Enables tracing support" OFF )
|
33
|
+
OPTION( LIBGIT2_FILENAME "Name of the produced binary" OFF )
|
34
|
+
|
35
|
+
OPTION( ANDROID "Build for android NDK" OFF )
|
36
|
+
|
37
|
+
OPTION( USE_ICONV "Link with and use iconv library" OFF )
|
38
|
+
OPTION( USE_SSH "Link with libssh to enable SSH support" ON )
|
39
|
+
OPTION( VALGRIND "Configure build for valgrind" OFF )
|
40
|
+
|
41
|
+
IF(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
42
|
+
SET( USE_ICONV ON )
|
43
|
+
ENDIF()
|
44
|
+
|
45
|
+
IF(MSVC)
|
46
|
+
# This option is only available when building with MSVC. By default, libgit2
|
47
|
+
# is build using the cdecl calling convention, which is useful if you're
|
48
|
+
# writing C. However, the CLR and Win32 API both expect stdcall.
|
49
|
+
#
|
50
|
+
# If you are writing a CLR program and want to link to libgit2, you'll want
|
51
|
+
# to turn this on by invoking CMake with the "-DSTDCALL=ON" argument.
|
52
|
+
OPTION( STDCALL "Build libgit2 with the __stdcall convention" OFF )
|
53
|
+
|
54
|
+
# This option must match the settings used in your program, in particular if you
|
55
|
+
# are linking statically
|
56
|
+
OPTION( STATIC_CRT "Link the static CRT libraries" ON )
|
57
|
+
|
58
|
+
# By default, libgit2 is built with WinHTTP. To use the built-in
|
59
|
+
# HTTP transport, invoke CMake with the "-DWINHTTP=OFF" argument.
|
60
|
+
OPTION( WINHTTP "Use Win32 WinHTTP routines" ON )
|
61
|
+
|
62
|
+
ADD_DEFINITIONS(-D_SCL_SECURE_NO_WARNINGS)
|
63
|
+
ADD_DEFINITIONS(-D_CRT_SECURE_NO_DEPRECATE)
|
64
|
+
ADD_DEFINITIONS(-D_CRT_NONSTDC_NO_DEPRECATE)
|
65
|
+
ENDIF()
|
66
|
+
|
67
|
+
# This variable will contain the libraries we need to put into
|
68
|
+
# libgit2.pc's Requires.private. That is, what we're linking to or
|
69
|
+
# what someone who's statically linking us needs to link to.
|
70
|
+
SET(LIBGIT2_PC_REQUIRES "")
|
71
|
+
# This will be set later if we use the system's http-parser library or
|
72
|
+
# use iconv (OSX) and will be written to the Libs.private field in the
|
73
|
+
# pc file.
|
74
|
+
SET(LIBGIT2_PC_LIBS "")
|
75
|
+
|
76
|
+
# Installation paths
|
77
|
+
#
|
78
|
+
SET(BIN_INSTALL_DIR bin CACHE PATH "Where to install binaries to.")
|
79
|
+
SET(LIB_INSTALL_DIR lib CACHE PATH "Where to install libraries to.")
|
80
|
+
SET(INCLUDE_INSTALL_DIR include CACHE PATH "Where to install headers to.")
|
81
|
+
|
82
|
+
FUNCTION(TARGET_OS_LIBRARIES target)
|
83
|
+
IF(WIN32)
|
84
|
+
TARGET_LINK_LIBRARIES(${target} ws2_32)
|
85
|
+
ELSEIF(CMAKE_SYSTEM_NAME MATCHES "(Solaris|SunOS)")
|
86
|
+
TARGET_LINK_LIBRARIES(${target} socket nsl)
|
87
|
+
SET(LIBGIT2_PC_LIBS "${LIBGIT2_PC_LIBS} -lsocket -lnsl" PARENT_SCOPE)
|
88
|
+
ENDIF()
|
89
|
+
CHECK_LIBRARY_EXISTS(rt clock_gettime "time.h" NEED_LIBRT)
|
90
|
+
IF(NEED_LIBRT)
|
91
|
+
TARGET_LINK_LIBRARIES(${target} rt)
|
92
|
+
SET(LIBGIT2_PC_LIBS "${LIBGIT2_PC_LIBS} -lrt" PARENT_SCOPE)
|
93
|
+
ENDIF()
|
94
|
+
|
95
|
+
IF(THREADSAFE)
|
96
|
+
TARGET_LINK_LIBRARIES(${target} ${CMAKE_THREAD_LIBS_INIT})
|
97
|
+
ENDIF()
|
98
|
+
ENDFUNCTION()
|
99
|
+
|
100
|
+
# For the MSVC IDE, this function splits up the source files like windows
|
101
|
+
# explorer does. This is esp. useful with the libgit2_clar project, were
|
102
|
+
# usually 2 or more files share the same name. Sadly, this file grouping
|
103
|
+
# is a per-directory option in cmake and not per-target, resulting in
|
104
|
+
# empty virtual folders "tests" for the git2.dll
|
105
|
+
FUNCTION(MSVC_SPLIT_SOURCES target)
|
106
|
+
IF(MSVC_IDE)
|
107
|
+
GET_TARGET_PROPERTY(sources ${target} SOURCES)
|
108
|
+
FOREACH(source ${sources})
|
109
|
+
IF(source MATCHES ".*/")
|
110
|
+
STRING(REPLACE ${CMAKE_CURRENT_SOURCE_DIR}/ "" rel ${source})
|
111
|
+
IF(rel)
|
112
|
+
STRING(REGEX REPLACE "/([^/]*)$" "" rel ${rel})
|
113
|
+
IF(rel)
|
114
|
+
STRING(REPLACE "/" "\\\\" rel ${rel})
|
115
|
+
SOURCE_GROUP(${rel} FILES ${source})
|
116
|
+
ENDIF()
|
117
|
+
ENDIF()
|
118
|
+
ENDIF()
|
119
|
+
ENDFOREACH()
|
120
|
+
ENDIF()
|
121
|
+
ENDFUNCTION()
|
122
|
+
|
123
|
+
FILE(STRINGS "include/git2/version.h" GIT2_HEADER REGEX "^#define LIBGIT2_VERSION \"[^\"]*\"$")
|
124
|
+
|
125
|
+
STRING(REGEX REPLACE "^.*LIBGIT2_VERSION \"([0-9]+).*$" "\\1" LIBGIT2_VERSION_MAJOR "${GIT2_HEADER}")
|
126
|
+
STRING(REGEX REPLACE "^.*LIBGIT2_VERSION \"[0-9]+\\.([0-9]+).*$" "\\1" LIBGIT2_VERSION_MINOR "${GIT2_HEADER}")
|
127
|
+
STRING(REGEX REPLACE "^.*LIBGIT2_VERSION \"[0-9]+\\.[0-9]+\\.([0-9]+).*$" "\\1" LIBGIT2_VERSION_REV "${GIT2_HEADER}")
|
128
|
+
SET(LIBGIT2_VERSION_STRING "${LIBGIT2_VERSION_MAJOR}.${LIBGIT2_VERSION_MINOR}.${LIBGIT2_VERSION_REV}")
|
129
|
+
|
130
|
+
FILE(STRINGS "include/git2/version.h" GIT2_HEADER_SOVERSION REGEX "^#define LIBGIT2_SOVERSION [0-9]+$")
|
131
|
+
STRING(REGEX REPLACE "^.*LIBGIT2_SOVERSION ([0-9]+)$" "\\1" LIBGIT2_SOVERSION "${GIT2_HEADER_SOVERSION}")
|
132
|
+
|
133
|
+
# Find required dependencies
|
134
|
+
INCLUDE_DIRECTORIES(src include)
|
135
|
+
|
136
|
+
IF (WIN32 AND WINHTTP AND NOT MINGW)
|
137
|
+
ADD_DEFINITIONS(-DGIT_WINHTTP)
|
138
|
+
INCLUDE_DIRECTORIES(deps/http-parser)
|
139
|
+
FILE(GLOB SRC_HTTP deps/http-parser/*.c deps/http-parser/*.h)
|
140
|
+
ELSE ()
|
141
|
+
IF (NOT AMIGA)
|
142
|
+
FIND_PACKAGE(OpenSSL)
|
143
|
+
ENDIF ()
|
144
|
+
|
145
|
+
FIND_PACKAGE(HTTP_Parser)
|
146
|
+
IF (HTTP_PARSER_FOUND AND HTTP_PARSER_VERSION_MAJOR EQUAL 2)
|
147
|
+
INCLUDE_DIRECTORIES(${HTTP_PARSER_INCLUDE_DIRS})
|
148
|
+
LINK_LIBRARIES(${HTTP_PARSER_LIBRARIES})
|
149
|
+
SET(LIBGIT2_PC_LIBS "${LIBGIT2_PC_LIBS} -lhttp_parser")
|
150
|
+
ELSE()
|
151
|
+
MESSAGE(STATUS "http-parser was not found or is too old; using bundled 3rd-party sources.")
|
152
|
+
INCLUDE_DIRECTORIES(deps/http-parser)
|
153
|
+
FILE(GLOB SRC_HTTP deps/http-parser/*.c deps/http-parser/*.h)
|
154
|
+
ENDIF()
|
155
|
+
ENDIF()
|
156
|
+
|
157
|
+
# Specify sha1 implementation
|
158
|
+
IF (WIN32 AND NOT MINGW AND NOT SHA1_TYPE STREQUAL "builtin")
|
159
|
+
ADD_DEFINITIONS(-DWIN32_SHA1)
|
160
|
+
FILE(GLOB SRC_SHA1 src/hash/hash_win32.c)
|
161
|
+
ELSEIF (OPENSSL_FOUND AND NOT SHA1_TYPE STREQUAL "builtin")
|
162
|
+
ADD_DEFINITIONS(-DOPENSSL_SHA1)
|
163
|
+
IF (CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
|
164
|
+
SET(LIBGIT2_PC_LIBS "${LIBGIT2_PC_LIBS} -lssl")
|
165
|
+
ELSE()
|
166
|
+
SET(LIBGIT2_PC_REQUIRES "${LIBGIT2_PC_REQUIRES} openssl")
|
167
|
+
ENDIF ()
|
168
|
+
ELSE()
|
169
|
+
FILE(GLOB SRC_SHA1 src/hash/hash_generic.c)
|
170
|
+
ENDIF()
|
171
|
+
|
172
|
+
# Enable tracing
|
173
|
+
IF (ENABLE_TRACE STREQUAL "ON")
|
174
|
+
ADD_DEFINITIONS(-DGIT_TRACE)
|
175
|
+
ENDIF()
|
176
|
+
|
177
|
+
# Include POSIX regex when it is required
|
178
|
+
IF(WIN32 OR AMIGA OR ANDROID OR CMAKE_SYSTEM_NAME MATCHES "(Solaris|SunOS)")
|
179
|
+
INCLUDE_DIRECTORIES(deps/regex)
|
180
|
+
SET(SRC_REGEX deps/regex/regex.c)
|
181
|
+
ENDIF()
|
182
|
+
|
183
|
+
# Optional external dependency: zlib
|
184
|
+
FIND_PACKAGE(ZLIB)
|
185
|
+
IF (ZLIB_FOUND)
|
186
|
+
INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIRS})
|
187
|
+
LINK_LIBRARIES(${ZLIB_LIBRARIES})
|
188
|
+
IF(APPLE OR CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
|
189
|
+
SET(LIBGIT2_PC_LIBS "${LIBGIT2_PC_LIBS} -lz")
|
190
|
+
ELSE()
|
191
|
+
SET(LIBGIT2_PC_REQUIRES "${LIBGIT2_PC_REQUIRES} zlib")
|
192
|
+
ENDIF()
|
193
|
+
ELSE()
|
194
|
+
MESSAGE(STATUS "zlib was not found; using bundled 3rd-party sources." )
|
195
|
+
INCLUDE_DIRECTORIES(deps/zlib)
|
196
|
+
ADD_DEFINITIONS(-DNO_VIZ -DSTDC -DNO_GZIP)
|
197
|
+
FILE(GLOB SRC_ZLIB deps/zlib/*.c deps/zlib/*.h)
|
198
|
+
ENDIF()
|
199
|
+
|
200
|
+
# Optional external dependency: libssh2
|
201
|
+
IF (USE_SSH)
|
202
|
+
FIND_PACKAGE(LIBSSH2)
|
203
|
+
ENDIF()
|
204
|
+
IF (LIBSSH2_FOUND)
|
205
|
+
ADD_DEFINITIONS(-DGIT_SSH)
|
206
|
+
INCLUDE_DIRECTORIES(${LIBSSH2_INCLUDE_DIR})
|
207
|
+
SET(LIBGIT2_PC_REQUIRES "${LIBGIT2_PC_REQUIRES} libssh2")
|
208
|
+
SET(SSH_LIBRARIES ${LIBSSH2_LIBRARIES})
|
209
|
+
ENDIF()
|
210
|
+
|
211
|
+
# Optional external dependency: iconv
|
212
|
+
IF (USE_ICONV)
|
213
|
+
FIND_PACKAGE(Iconv)
|
214
|
+
ENDIF()
|
215
|
+
IF (ICONV_FOUND)
|
216
|
+
ADD_DEFINITIONS(-DGIT_USE_ICONV)
|
217
|
+
INCLUDE_DIRECTORIES(${ICONV_INCLUDE_DIR})
|
218
|
+
SET(LIBGIT2_PC_LIBS "${LIBGIT2_PC_LIBS} ${ICONV_LIBRARIES}")
|
219
|
+
ENDIF()
|
220
|
+
|
221
|
+
# Platform specific compilation flags
|
222
|
+
IF (MSVC)
|
223
|
+
|
224
|
+
STRING(REPLACE "/Zm1000" " " CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
|
225
|
+
|
226
|
+
# /GF - String pooling
|
227
|
+
# /MP - Parallel build
|
228
|
+
SET(CMAKE_C_FLAGS "/GF /MP /nologo ${CMAKE_C_FLAGS}")
|
229
|
+
|
230
|
+
IF (STDCALL)
|
231
|
+
# /Gz - stdcall calling convention
|
232
|
+
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /Gz")
|
233
|
+
ENDIF ()
|
234
|
+
|
235
|
+
IF (STATIC_CRT)
|
236
|
+
SET(CRT_FLAG_DEBUG "/MTd")
|
237
|
+
SET(CRT_FLAG_RELEASE "/MT")
|
238
|
+
ELSE()
|
239
|
+
SET(CRT_FLAG_DEBUG "/MDd")
|
240
|
+
SET(CRT_FLAG_RELEASE "/MD")
|
241
|
+
ENDIF()
|
242
|
+
|
243
|
+
# /Zi - Create debugging information
|
244
|
+
# /Od - Disable optimization
|
245
|
+
# /D_DEBUG - #define _DEBUG
|
246
|
+
# /MTd - Statically link the multithreaded debug version of the CRT
|
247
|
+
# /MDd - Dynamically link the multithreaded debug version of the CRT
|
248
|
+
# /RTC1 - Run time checks
|
249
|
+
SET(CMAKE_C_FLAGS_DEBUG "/Zi /Od /D_DEBUG /RTC1 ${CRT_FLAG_DEBUG}")
|
250
|
+
|
251
|
+
# /DNDEBUG - Disables asserts
|
252
|
+
# /MT - Statically link the multithreaded release version of the CRT
|
253
|
+
# /MD - Dynamically link the multithreaded release version of the CRT
|
254
|
+
# /O2 - Optimize for speed
|
255
|
+
# /Oy - Enable frame pointer omission (FPO) (otherwise CMake will automatically turn it off)
|
256
|
+
# /GL - Link time code generation (whole program optimization)
|
257
|
+
# /Gy - Function-level linking
|
258
|
+
SET(CMAKE_C_FLAGS_RELEASE "/DNDEBUG /O2 /Oy /GL /Gy ${CRT_FLAG_RELEASE}")
|
259
|
+
|
260
|
+
# /Oy- - Disable frame pointer omission (FPO)
|
261
|
+
SET(CMAKE_C_FLAGS_RELWITHDEBINFO "/DNDEBUG /Zi /O2 /Oy- /GL /Gy ${CRT_FLAG_RELEASE}")
|
262
|
+
|
263
|
+
# /O1 - Optimize for size
|
264
|
+
SET(CMAKE_C_FLAGS_MINSIZEREL "/DNDEBUG /O1 /Oy /GL /Gy ${CRT_FLAG_RELEASE}")
|
265
|
+
|
266
|
+
# /DYNAMICBASE - Address space load randomization (ASLR)
|
267
|
+
# /NXCOMPAT - Data execution prevention (DEP)
|
268
|
+
# /LARGEADDRESSAWARE - >2GB user address space on x86
|
269
|
+
# /VERSION - Embed version information in PE header
|
270
|
+
SET(CMAKE_EXE_LINKER_FLAGS "/DYNAMICBASE /NXCOMPAT /LARGEADDRESSAWARE /VERSION:${LIBGIT2_VERSION_MAJOR}.${LIBGIT2_VERSION_MINOR}")
|
271
|
+
|
272
|
+
# /DEBUG - Create a PDB
|
273
|
+
# /LTCG - Link time code generation (whole program optimization)
|
274
|
+
# /OPT:REF /OPT:ICF - Fold out duplicate code at link step
|
275
|
+
# /INCREMENTAL:NO - Required to use /LTCG
|
276
|
+
# /DEBUGTYPE:cv,fixup - Additional data embedded in the PDB (requires /INCREMENTAL:NO, so not on for Debug)
|
277
|
+
SET(CMAKE_EXE_LINKER_FLAGS_DEBUG "/DEBUG")
|
278
|
+
SET(CMAKE_EXE_LINKER_FLAGS_RELEASE "/RELEASE /LTCG /OPT:REF /OPT:ICF /INCREMENTAL:NO")
|
279
|
+
SET(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "/DEBUG /RELEASE /LTCG /OPT:REF /OPT:ICF /INCREMENTAL:NO /DEBUGTYPE:cv,fixup")
|
280
|
+
SET(CMAKE_EXE_LINKER_FLAGS_MINSIZEREL "/RELEASE /LTCG /OPT:REF /OPT:ICF /INCREMENTAL:NO")
|
281
|
+
|
282
|
+
# Same linker settings for DLL as EXE
|
283
|
+
SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}")
|
284
|
+
SET(CMAKE_SHARED_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG}")
|
285
|
+
SET(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE}")
|
286
|
+
SET(CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO}")
|
287
|
+
SET(CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL "${CMAKE_EXE_LINKER_FLAGS_MINSIZEREL}")
|
288
|
+
|
289
|
+
SET(WIN_RC "src/win32/git2.rc")
|
290
|
+
|
291
|
+
# Precompiled headers
|
292
|
+
|
293
|
+
ELSE ()
|
294
|
+
SET(CMAKE_C_FLAGS "-D_GNU_SOURCE -Wall -Wextra ${CMAKE_C_FLAGS}")
|
295
|
+
|
296
|
+
IF (CMAKE_SYSTEM_NAME MATCHES "(Solaris|SunOS)")
|
297
|
+
SET(CMAKE_C_FLAGS "-std=c99 -D_POSIX_C_SOURCE=200112L -D__EXTENSIONS__ -D_POSIX_PTHREAD_SEMANTICS ${CMAKE_C_FLAGS}")
|
298
|
+
ENDIF()
|
299
|
+
|
300
|
+
IF (WIN32 AND NOT CYGWIN)
|
301
|
+
SET(CMAKE_C_FLAGS_DEBUG "-D_DEBUG")
|
302
|
+
ENDIF ()
|
303
|
+
|
304
|
+
IF (MINGW) # MinGW always does PIC and complains if we tell it to
|
305
|
+
STRING(REGEX REPLACE "-fPIC" "" CMAKE_SHARED_LIBRARY_C_FLAGS "${CMAKE_SHARED_LIBRARY_C_FLAGS}")
|
306
|
+
# MinGW >= 3.14 uses the C99-style stdio functions
|
307
|
+
# automatically, but forks like mingw-w64 still want
|
308
|
+
# us to define this in order to use them
|
309
|
+
ADD_DEFINITIONS(-D__USE_MINGW_ANSI_STDIO=1)
|
310
|
+
|
311
|
+
ELSEIF (BUILD_SHARED_LIBS)
|
312
|
+
ADD_C_FLAG_IF_SUPPORTED(-fvisibility=hidden)
|
313
|
+
|
314
|
+
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
|
315
|
+
ENDIF ()
|
316
|
+
|
317
|
+
ADD_C_FLAG_IF_SUPPORTED(-Wno-missing-field-initializers)
|
318
|
+
ADD_C_FLAG_IF_SUPPORTED(-Wstrict-aliasing=2)
|
319
|
+
ADD_C_FLAG_IF_SUPPORTED(-Wstrict-prototypes)
|
320
|
+
ADD_C_FLAG_IF_SUPPORTED(-Wdeclaration-after-statement)
|
321
|
+
ADD_C_FLAG_IF_SUPPORTED(-Wno-unused-const-variable)
|
322
|
+
ADD_C_FLAG_IF_SUPPORTED(-Wno-unused-function)
|
323
|
+
|
324
|
+
IF (APPLE) # Apple deprecated OpenSSL
|
325
|
+
ADD_C_FLAG_IF_SUPPORTED(-Wno-deprecated-declarations)
|
326
|
+
ENDIF()
|
327
|
+
|
328
|
+
IF (PROFILE)
|
329
|
+
SET(CMAKE_C_FLAGS "-pg ${CMAKE_C_FLAGS}")
|
330
|
+
SET(CMAKE_EXE_LINKER_FLAGS "-pg ${CMAKE_EXE_LINKER_FLAGS}")
|
331
|
+
ENDIF ()
|
332
|
+
ENDIF()
|
333
|
+
|
334
|
+
IF( NOT CMAKE_CONFIGURATION_TYPES )
|
335
|
+
# Build Debug by default
|
336
|
+
IF (NOT CMAKE_BUILD_TYPE)
|
337
|
+
SET(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel." FORCE)
|
338
|
+
ENDIF ()
|
339
|
+
ELSE()
|
340
|
+
# Using a multi-configuration generator eg MSVC or Xcode
|
341
|
+
# that uses CMAKE_CONFIGURATION_TYPES and not CMAKE_BUILD_TYPE
|
342
|
+
ENDIF()
|
343
|
+
|
344
|
+
IF (OPENSSL_FOUND)
|
345
|
+
ADD_DEFINITIONS(-DGIT_SSL)
|
346
|
+
INCLUDE_DIRECTORIES(${OPENSSL_INCLUDE_DIR})
|
347
|
+
SET(SSL_LIBRARIES ${OPENSSL_LIBRARIES})
|
348
|
+
ENDIF()
|
349
|
+
|
350
|
+
IF (THREADSAFE)
|
351
|
+
IF (NOT WIN32)
|
352
|
+
FIND_PACKAGE(Threads REQUIRED)
|
353
|
+
ENDIF()
|
354
|
+
|
355
|
+
ADD_DEFINITIONS(-DGIT_THREADS)
|
356
|
+
ENDIF()
|
357
|
+
|
358
|
+
ADD_DEFINITIONS(-D_FILE_OFFSET_BITS=64)
|
359
|
+
|
360
|
+
# Collect sourcefiles
|
361
|
+
FILE(GLOB SRC_H include/git2.h include/git2/*.h include/git2/sys/*.h)
|
362
|
+
|
363
|
+
# On Windows use specific platform sources
|
364
|
+
IF (WIN32 AND NOT CYGWIN)
|
365
|
+
ADD_DEFINITIONS(-DWIN32 -D_WIN32_WINNT=0x0501)
|
366
|
+
FILE(GLOB SRC_OS src/win32/*.c src/win32/*.h)
|
367
|
+
ELSEIF (AMIGA)
|
368
|
+
ADD_DEFINITIONS(-DNO_ADDRINFO -DNO_READDIR_R -DNO_MMAP)
|
369
|
+
ELSE()
|
370
|
+
IF (VALGRIND)
|
371
|
+
ADD_DEFINITIONS(-DNO_MMAP)
|
372
|
+
ENDIF()
|
373
|
+
FILE(GLOB SRC_OS src/unix/*.c src/unix/*.h)
|
374
|
+
ENDIF()
|
375
|
+
FILE(GLOB SRC_GIT2 src/*.c src/*.h src/transports/*.c src/transports/*.h src/xdiff/*.c src/xdiff/*.h)
|
376
|
+
|
377
|
+
# Determine architecture of the machine
|
378
|
+
IF (CMAKE_SIZEOF_VOID_P EQUAL 8)
|
379
|
+
ADD_DEFINITIONS(-DGIT_ARCH_64)
|
380
|
+
ELSEIF (CMAKE_SIZEOF_VOID_P EQUAL 4)
|
381
|
+
ADD_DEFINITIONS(-DGIT_ARCH_32)
|
382
|
+
ELSE()
|
383
|
+
MESSAGE(FATAL_ERROR "Unsupported architecture")
|
384
|
+
ENDIF()
|
385
|
+
|
386
|
+
# Compile and link libgit2
|
387
|
+
ADD_LIBRARY(git2 ${SRC_H} ${SRC_GIT2} ${SRC_OS} ${SRC_ZLIB} ${SRC_HTTP} ${SRC_REGEX} ${SRC_SHA1} ${WIN_RC})
|
388
|
+
TARGET_LINK_LIBRARIES(git2 ${SSL_LIBRARIES})
|
389
|
+
TARGET_LINK_LIBRARIES(git2 ${SSH_LIBRARIES})
|
390
|
+
TARGET_LINK_LIBRARIES(git2 ${ICONV_LIBRARIES})
|
391
|
+
TARGET_OS_LIBRARIES(git2)
|
392
|
+
|
393
|
+
# Workaround for Cmake bug #0011240 (see http://public.kitware.com/Bug/view.php?id=11240)
|
394
|
+
# Win64+MSVC+static libs = linker error
|
395
|
+
IF(MSVC AND GIT_ARCH_64 AND NOT BUILD_SHARED_LIBS)
|
396
|
+
SET_TARGET_PROPERTIES(git2 PROPERTIES STATIC_LIBRARY_FLAGS "/MACHINE:x64")
|
397
|
+
ENDIF()
|
398
|
+
|
399
|
+
MSVC_SPLIT_SOURCES(git2)
|
400
|
+
|
401
|
+
IF (SONAME)
|
402
|
+
SET_TARGET_PROPERTIES(git2 PROPERTIES VERSION ${LIBGIT2_VERSION_STRING})
|
403
|
+
SET_TARGET_PROPERTIES(git2 PROPERTIES SOVERSION ${LIBGIT2_SOVERSION})
|
404
|
+
IF (LIBGIT2_FILENAME)
|
405
|
+
ADD_DEFINITIONS(-DLIBGIT2_FILENAME=\"${LIBGIT2_FILENAME}\")
|
406
|
+
SET_TARGET_PROPERTIES(git2 PROPERTIES OUTPUT_NAME ${LIBGIT2_FILENAME})
|
407
|
+
ENDIF()
|
408
|
+
ENDIF()
|
409
|
+
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/libgit2.pc.in ${CMAKE_CURRENT_BINARY_DIR}/libgit2.pc @ONLY)
|
410
|
+
|
411
|
+
IF (MSVC_IDE)
|
412
|
+
# Precompiled headers
|
413
|
+
SET_TARGET_PROPERTIES(git2 PROPERTIES COMPILE_FLAGS "/Yuprecompiled.h /FIprecompiled.h")
|
414
|
+
SET_SOURCE_FILES_PROPERTIES(src/win32/precompiled.c COMPILE_FLAGS "/Ycprecompiled.h")
|
415
|
+
ENDIF ()
|
416
|
+
|
417
|
+
# Install
|
418
|
+
INSTALL(TARGETS git2
|
419
|
+
RUNTIME DESTINATION ${BIN_INSTALL_DIR}
|
420
|
+
LIBRARY DESTINATION ${LIB_INSTALL_DIR}
|
421
|
+
ARCHIVE DESTINATION ${LIB_INSTALL_DIR}
|
422
|
+
)
|
423
|
+
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/libgit2.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig )
|
424
|
+
INSTALL(DIRECTORY include/git2 DESTINATION ${INCLUDE_INSTALL_DIR} )
|
425
|
+
INSTALL(FILES include/git2.h DESTINATION ${INCLUDE_INSTALL_DIR} )
|
426
|
+
|
427
|
+
# Tests
|
428
|
+
IF (BUILD_CLAR)
|
429
|
+
FIND_PACKAGE(PythonInterp REQUIRED)
|
430
|
+
|
431
|
+
SET(CLAR_FIXTURES "${CMAKE_CURRENT_SOURCE_DIR}/tests/resources/")
|
432
|
+
SET(CLAR_PATH "${CMAKE_CURRENT_SOURCE_DIR}/tests")
|
433
|
+
SET(CLAR_RESOURCES "${CMAKE_CURRENT_SOURCE_DIR}/tests/resources" CACHE PATH "Path to test resources.")
|
434
|
+
ADD_DEFINITIONS(-DCLAR_FIXTURE_PATH=\"${CLAR_FIXTURES}\")
|
435
|
+
ADD_DEFINITIONS(-DCLAR_RESOURCES=\"${TEST_RESOURCES}\")
|
436
|
+
|
437
|
+
INCLUDE_DIRECTORIES(${CLAR_PATH})
|
438
|
+
FILE(GLOB_RECURSE SRC_TEST ${CLAR_PATH}/*/*.c ${CLAR_PATH}/*/*.h)
|
439
|
+
SET(SRC_CLAR "${CLAR_PATH}/main.c" "${CLAR_PATH}/clar_libgit2.c" "${CLAR_PATH}/clar.c")
|
440
|
+
|
441
|
+
ADD_CUSTOM_COMMAND(
|
442
|
+
OUTPUT ${CLAR_PATH}/clar.suite
|
443
|
+
COMMAND ${PYTHON_EXECUTABLE} generate.py -f -xonline -xstress .
|
444
|
+
DEPENDS ${SRC_TEST}
|
445
|
+
WORKING_DIRECTORY ${CLAR_PATH}
|
446
|
+
)
|
447
|
+
|
448
|
+
SET_SOURCE_FILES_PROPERTIES(
|
449
|
+
${CLAR_PATH}/clar.c
|
450
|
+
PROPERTIES OBJECT_DEPENDS ${CLAR_PATH}/clar.suite)
|
451
|
+
|
452
|
+
ADD_EXECUTABLE(libgit2_clar ${SRC_H} ${SRC_GIT2} ${SRC_OS} ${SRC_CLAR} ${SRC_TEST} ${SRC_ZLIB} ${SRC_HTTP} ${SRC_REGEX} ${SRC_SHA1})
|
453
|
+
|
454
|
+
TARGET_LINK_LIBRARIES(libgit2_clar ${SSL_LIBRARIES})
|
455
|
+
TARGET_LINK_LIBRARIES(libgit2_clar ${SSH_LIBRARIES})
|
456
|
+
TARGET_LINK_LIBRARIES(libgit2_clar ${ICONV_LIBRARIES})
|
457
|
+
TARGET_OS_LIBRARIES(libgit2_clar)
|
458
|
+
MSVC_SPLIT_SOURCES(libgit2_clar)
|
459
|
+
|
460
|
+
IF (MSVC_IDE)
|
461
|
+
# Precompiled headers
|
462
|
+
SET_TARGET_PROPERTIES(libgit2_clar PROPERTIES COMPILE_FLAGS "/Yuprecompiled.h /FIprecompiled.h")
|
463
|
+
ENDIF ()
|
464
|
+
|
465
|
+
ENABLE_TESTING()
|
466
|
+
ADD_TEST(libgit2_clar libgit2_clar -ionline)
|
467
|
+
ENDIF ()
|
468
|
+
|
469
|
+
IF (TAGS)
|
470
|
+
FIND_PROGRAM(CTAGS ctags)
|
471
|
+
IF (NOT CTAGS)
|
472
|
+
MESSAGE(FATAL_ERROR "Could not find ctags command")
|
473
|
+
ENDIF ()
|
474
|
+
|
475
|
+
FILE(GLOB_RECURSE SRC_ALL *.[ch])
|
476
|
+
|
477
|
+
ADD_CUSTOM_COMMAND(
|
478
|
+
OUTPUT tags
|
479
|
+
COMMAND ${CTAGS} -a ${SRC_ALL}
|
480
|
+
DEPENDS ${SRC_ALL}
|
481
|
+
)
|
482
|
+
ADD_CUSTOM_TARGET(
|
483
|
+
do_tags ALL
|
484
|
+
DEPENDS tags
|
485
|
+
)
|
486
|
+
ENDIF ()
|
487
|
+
|
488
|
+
IF (BUILD_EXAMPLES)
|
489
|
+
ADD_SUBDIRECTORY(examples)
|
490
|
+
ENDIF ()
|