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
@@ -1,26 +1,44 @@
|
|
1
|
-
PLATFORM=$(shell uname -
|
1
|
+
PLATFORM=$(shell uname -s)
|
2
|
+
|
3
|
+
ifneq (,$(CROSS_COMPILE))
|
4
|
+
PREFIX=$(CROSS_COMPILE)-
|
5
|
+
else
|
6
|
+
PREFIX=
|
7
|
+
endif
|
8
|
+
|
9
|
+
MINGW=0
|
10
|
+
ifneq (,$(findstring MINGW32,$(PLATFORM)))
|
11
|
+
MINGW=1
|
12
|
+
endif
|
13
|
+
ifneq (,$(findstring mingw,$(CROSS_COMPILE)))
|
14
|
+
MINGW=1
|
15
|
+
endif
|
2
16
|
|
3
17
|
rm=rm -f
|
4
|
-
AR
|
5
|
-
RANLIB
|
18
|
+
AR=$(PREFIX)ar cq
|
19
|
+
RANLIB=$(PREFIX)ranlib
|
20
|
+
|
6
21
|
LIBNAME=libgit2.a
|
7
|
-
|
22
|
+
|
23
|
+
ifeq ($(MINGW),1)
|
8
24
|
CC=gcc
|
9
25
|
else
|
10
26
|
CC=cc
|
11
27
|
endif
|
12
28
|
|
29
|
+
CC:=$(PREFIX)$(CC)
|
30
|
+
|
13
31
|
INCLUDES= -I. -Isrc -Iinclude -Ideps/http-parser -Ideps/zlib
|
14
32
|
|
15
33
|
DEFINES= $(INCLUDES) -DNO_VIZ -DSTDC -DNO_GZIP -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE $(EXTRA_DEFINES)
|
16
|
-
CFLAGS= -g $(DEFINES) -Wall -Wextra -O2 $(EXTRA_CFLAGS)
|
34
|
+
CFLAGS= -g $(DEFINES) -Wall -Wextra -Wno-missing-field-initializers -O2 $(EXTRA_CFLAGS)
|
17
35
|
|
18
36
|
SRCS = $(wildcard src/*.c) $(wildcard src/transports/*.c) $(wildcard src/xdiff/*.c) $(wildcard deps/http-parser/*.c) $(wildcard deps/zlib/*.c) src/hash/hash_generic.c
|
19
37
|
|
20
|
-
ifeq ($(
|
38
|
+
ifeq ($(MINGW),1)
|
21
39
|
SRCS += $(wildcard src/win32/*.c) $(wildcard src/compat/*.c) deps/regex/regex.c
|
22
40
|
INCLUDES += -Ideps/regex
|
23
|
-
DEFINES += -DWIN32 -D_WIN32_WINNT=0x0501
|
41
|
+
DEFINES += -DWIN32 -D_WIN32_WINNT=0x0501 -D__USE_MINGW_ANSI_STDIO=1
|
24
42
|
else
|
25
43
|
SRCS += $(wildcard src/unix/*.c)
|
26
44
|
CFLAGS += -fPIC
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# - Append compiler flag to CMAKE_C_FLAGS if compiler supports it
|
2
|
+
# ADD_C_FLAG_IF_SUPPORTED(<flag>)
|
3
|
+
# <flag> - the compiler flag to test
|
4
|
+
# This internally calls the CHECK_C_COMPILER_FLAG macro.
|
5
|
+
|
6
|
+
INCLUDE(CheckCCompilerFlag)
|
7
|
+
|
8
|
+
MACRO(ADD_C_FLAG_IF_SUPPORTED _FLAG)
|
9
|
+
STRING(TOUPPER ${_FLAG} UPCASE)
|
10
|
+
STRING(REGEX REPLACE "^-" "" UPCASE_PRETTY ${UPCASE})
|
11
|
+
CHECK_C_COMPILER_FLAG(${_FLAG} IS_${UPCASE_PRETTY}_SUPPORTED)
|
12
|
+
|
13
|
+
IF(IS_${UPCASE_PRETTY}_SUPPORTED)
|
14
|
+
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${_FLAG}")
|
15
|
+
ENDIF()
|
16
|
+
ENDMACRO()
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# - Try to find http-parser
|
2
|
+
#
|
3
|
+
# Defines the following variables:
|
4
|
+
#
|
5
|
+
# HTTP_PARSER_FOUND - system has http-parser
|
6
|
+
# HTTP_PARSER_INCLUDE_DIR - the http-parser include directory
|
7
|
+
# HTTP_PARSER_LIBRARIES - Link these to use http-parser
|
8
|
+
# HTTP_PARSER_VERSION_MAJOR - major version
|
9
|
+
# HTTP_PARSER_VERSION_MINOR - minor version
|
10
|
+
# HTTP_PARSER_VERSION_STRING - the version of http-parser found
|
11
|
+
|
12
|
+
# Find the header and library
|
13
|
+
FIND_PATH(HTTP_PARSER_INCLUDE_DIR NAMES http_parser.h)
|
14
|
+
FIND_LIBRARY(HTTP_PARSER_LIBRARY NAMES http_parser libhttp_parser)
|
15
|
+
|
16
|
+
# Found the header, read version
|
17
|
+
if (HTTP_PARSER_INCLUDE_DIR AND EXISTS "${HTTP_PARSER_INCLUDE_DIR}/http_parser.h")
|
18
|
+
FILE(READ "${HTTP_PARSER_INCLUDE_DIR}/http_parser.h" HTTP_PARSER_H)
|
19
|
+
IF (HTTP_PARSER_H)
|
20
|
+
STRING(REGEX REPLACE ".*#define[\t ]+HTTP_PARSER_VERSION_MAJOR[\t ]+([0-9]+).*" "\\1" HTTP_PARSER_VERSION_MAJOR "${HTTP_PARSER_H}")
|
21
|
+
STRING(REGEX REPLACE ".*#define[\t ]+HTTP_PARSER_VERSION_MINOR[\t ]+([0-9]+).*" "\\1" HTTP_PARSER_VERSION_MINOR "${HTTP_PARSER_H}")
|
22
|
+
SET(HTTP_PARSER_VERSION_STRING "${HTTP_PARSER_VERSION_MAJOR}.${HTTP_PARSER_VERSION_MINOR}")
|
23
|
+
ENDIF()
|
24
|
+
UNSET(HTTP_PARSER_H)
|
25
|
+
ENDIF()
|
26
|
+
|
27
|
+
# Handle the QUIETLY and REQUIRED arguments and set HTTP_PARSER_FOUND
|
28
|
+
# to TRUE if all listed variables are TRUE
|
29
|
+
INCLUDE(FindPackageHandleStandardArgs)
|
30
|
+
FIND_PACKAGE_HANDLE_STANDARD_ARGS(HTTP_Parser REQUIRED_VARS HTTP_PARSER_INCLUDE_DIR HTTP_PARSER_LIBRARY)
|
31
|
+
|
32
|
+
# Hide advanced variables
|
33
|
+
MARK_AS_ADVANCED(HTTP_PARSER_INCLUDE_DIR HTTP_PARSER_LIBRARY)
|
34
|
+
|
35
|
+
# Set standard variables
|
36
|
+
IF (HTTP_PARSER_FOUND)
|
37
|
+
SET(HTTP_PARSER_LIBRARIES ${HTTP_PARSER_LIBRARY})
|
38
|
+
set(HTTP_PARSER_INCLUDE_DIRS ${HTTP_PARSER_INCLUDE_DIR})
|
39
|
+
ENDIF()
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# - Try to find Iconv
|
2
|
+
# Once done this will define
|
3
|
+
#
|
4
|
+
# ICONV_FOUND - system has Iconv
|
5
|
+
# ICONV_INCLUDE_DIR - the Iconv include directory
|
6
|
+
# ICONV_LIBRARIES - Link these to use Iconv
|
7
|
+
#
|
8
|
+
|
9
|
+
IF(ICONV_INCLUDE_DIR AND ICONV_LIBRARIES)
|
10
|
+
# Already in cache, be silent
|
11
|
+
SET(ICONV_FIND_QUIETLY TRUE)
|
12
|
+
ENDIF()
|
13
|
+
|
14
|
+
FIND_PATH(ICONV_INCLUDE_DIR iconv.h PATHS /opt/local/include NO_DEFAULT_PATH)
|
15
|
+
FIND_PATH(ICONV_INCLUDE_DIR iconv.h)
|
16
|
+
|
17
|
+
FIND_LIBRARY(iconv_lib NAMES iconv libiconv libiconv-2 c NO_DEFAULT_PATH PATHS /opt/local/lib)
|
18
|
+
FIND_LIBRARY(iconv_lib NAMES iconv libiconv libiconv-2 c)
|
19
|
+
|
20
|
+
IF(ICONV_INCLUDE_DIR AND iconv_lib)
|
21
|
+
SET(ICONV_FOUND TRUE)
|
22
|
+
ENDIF()
|
23
|
+
|
24
|
+
IF(ICONV_FOUND)
|
25
|
+
# split iconv into -L and -l linker options, so we can set them for pkg-config
|
26
|
+
GET_FILENAME_COMPONENT(iconv_path ${iconv_lib} PATH)
|
27
|
+
GET_FILENAME_COMPONENT(iconv_name ${iconv_lib} NAME_WE)
|
28
|
+
STRING(REGEX REPLACE "^lib" "" iconv_name ${iconv_name})
|
29
|
+
SET(ICONV_LIBRARIES "-L${iconv_path} -l${iconv_name}")
|
30
|
+
|
31
|
+
IF(NOT ICONV_FIND_QUIETLY)
|
32
|
+
MESSAGE(STATUS "Found Iconv: ${ICONV_LIBRARIES}")
|
33
|
+
ENDIF(NOT ICONV_FIND_QUIETLY)
|
34
|
+
ELSE()
|
35
|
+
IF(Iconv_FIND_REQUIRED)
|
36
|
+
MESSAGE(FATAL_ERROR "Could not find Iconv")
|
37
|
+
ENDIF(Iconv_FIND_REQUIRED)
|
38
|
+
ENDIF()
|
39
|
+
|
40
|
+
MARK_AS_ADVANCED(
|
41
|
+
ICONV_INCLUDE_DIR
|
42
|
+
ICONV_LIBRARIES
|
43
|
+
)
|
@@ -0,0 +1,44 @@
|
|
1
|
+
if (LIBSSH2_LIBRARIES AND LIBSSH2_INCLUDE_DIRS)
|
2
|
+
set(LIBSSH2_FOUND TRUE)
|
3
|
+
else (LIBSSH2_LIBRARIES AND LIBSSH2_INCLUDE_DIRS)
|
4
|
+
find_path(LIBSSH2_INCLUDE_DIR
|
5
|
+
NAMES
|
6
|
+
libssh2.h
|
7
|
+
PATHS
|
8
|
+
/usr/include
|
9
|
+
/usr/local/include
|
10
|
+
/opt/local/include
|
11
|
+
/sw/include
|
12
|
+
${CMAKE_INCLUDE_PATH}
|
13
|
+
${CMAKE_INSTALL_PREFIX}/include
|
14
|
+
)
|
15
|
+
|
16
|
+
find_library(LIBSSH2_LIBRARY
|
17
|
+
NAMES
|
18
|
+
ssh2
|
19
|
+
libssh2
|
20
|
+
PATHS
|
21
|
+
/usr/lib
|
22
|
+
/usr/local/lib
|
23
|
+
/opt/local/lib
|
24
|
+
/sw/lib
|
25
|
+
${CMAKE_LIBRARY_PATH}
|
26
|
+
${CMAKE_INSTALL_PREFIX}/lib
|
27
|
+
)
|
28
|
+
|
29
|
+
if (LIBSSH2_INCLUDE_DIR AND LIBSSH2_LIBRARY)
|
30
|
+
set(LIBSSH2_FOUND TRUE)
|
31
|
+
endif (LIBSSH2_INCLUDE_DIR AND LIBSSH2_LIBRARY)
|
32
|
+
|
33
|
+
if (LIBSSH2_FOUND)
|
34
|
+
set(LIBSSH2_INCLUDE_DIRS
|
35
|
+
${LIBSSH2_INCLUDE_DIR}
|
36
|
+
)
|
37
|
+
|
38
|
+
set(LIBSSH2_LIBRARIES
|
39
|
+
${LIBSSH2_LIBRARIES}
|
40
|
+
${LIBSSH2_LIBRARY}
|
41
|
+
)
|
42
|
+
endif (LIBSSH2_FOUND)
|
43
|
+
endif (LIBSSH2_LIBRARIES AND LIBSSH2_INCLUDE_DIRS)
|
44
|
+
|
@@ -0,0 +1,23 @@
|
|
1
|
+
http_parser.c is based on src/http/ngx_http_parse.c from NGINX copyright
|
2
|
+
Igor Sysoev.
|
3
|
+
|
4
|
+
Additional changes are licensed under the same terms as NGINX and
|
5
|
+
copyright Joyent, Inc. and other Node contributors. All rights reserved.
|
6
|
+
|
7
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
8
|
+
of this software and associated documentation files (the "Software"), to
|
9
|
+
deal in the Software without restriction, including without limitation the
|
10
|
+
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
11
|
+
sell copies of the Software, and to permit persons to whom the Software is
|
12
|
+
furnished to do so, subject to the following conditions:
|
13
|
+
|
14
|
+
The above copyright notice and this permission notice shall be included in
|
15
|
+
all copies or substantial portions of the Software.
|
16
|
+
|
17
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
18
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
19
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
20
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
21
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
22
|
+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
23
|
+
IN THE SOFTWARE.
|
@@ -67,10 +67,17 @@
|
|
67
67
|
#include "regex_internal.h"
|
68
68
|
|
69
69
|
#include "regex_internal.c"
|
70
|
+
|
70
71
|
#ifdef GAWK
|
71
|
-
#define bool int
|
72
|
-
|
73
|
-
#
|
72
|
+
# define bool int
|
73
|
+
|
74
|
+
# ifndef true
|
75
|
+
# define true (1)
|
76
|
+
# endif
|
77
|
+
|
78
|
+
# ifndef false
|
79
|
+
# define false (0)
|
80
|
+
# endif
|
74
81
|
#endif
|
75
82
|
#include "regcomp.c"
|
76
83
|
#include "regexec.c"
|
@@ -199,8 +199,9 @@ typedef int (*git_attr_foreach_cb)(const char *name, const char *value, void *pa
|
|
199
199
|
* only once per attribute name, even if there are multiple
|
200
200
|
* rules for a given file. The highest priority rule will be
|
201
201
|
* used. Return a non-zero value from this to stop looping.
|
202
|
+
* The value will be returned from `git_attr_foreach`.
|
202
203
|
* @param payload Passed on as extra parameter to callback function.
|
203
|
-
* @return 0 on success,
|
204
|
+
* @return 0 on success, non-zero callback return value, or error code
|
204
205
|
*/
|
205
206
|
GIT_EXTERN(int) git_attr_foreach(
|
206
207
|
git_repository *repo,
|
@@ -0,0 +1,213 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright (C) the libgit2 contributors. All rights reserved.
|
3
|
+
*
|
4
|
+
* This file is part of libgit2, distributed under the GNU GPL v2 with
|
5
|
+
* a Linking Exception. For full terms see the included COPYING file.
|
6
|
+
*/
|
7
|
+
|
8
|
+
#ifndef INCLUDE_git_blame_h__
|
9
|
+
#define INCLUDE_git_blame_h__
|
10
|
+
|
11
|
+
#include "common.h"
|
12
|
+
#include "oid.h"
|
13
|
+
|
14
|
+
/**
|
15
|
+
* @file git2/blame.h
|
16
|
+
* @brief Git blame routines
|
17
|
+
* @defgroup git_blame Git blame routines
|
18
|
+
* @ingroup Git
|
19
|
+
* @{
|
20
|
+
*/
|
21
|
+
GIT_BEGIN_DECL
|
22
|
+
|
23
|
+
/**
|
24
|
+
* Flags for indicating option behavior for git_blame APIs.
|
25
|
+
*/
|
26
|
+
typedef enum {
|
27
|
+
/** Normal blame, the default */
|
28
|
+
GIT_BLAME_NORMAL = 0,
|
29
|
+
/** Track lines that have moved within a file (like `git blame -M`).
|
30
|
+
* NOT IMPLEMENTED. */
|
31
|
+
GIT_BLAME_TRACK_COPIES_SAME_FILE = (1<<0),
|
32
|
+
/** Track lines that have moved across files in the same commit (like `git blame -C`).
|
33
|
+
* NOT IMPLEMENTED. */
|
34
|
+
GIT_BLAME_TRACK_COPIES_SAME_COMMIT_MOVES = (1<<1),
|
35
|
+
/** Track lines that have been copied from another file that exists in the
|
36
|
+
* same commit (like `git blame -CC`). Implies SAME_FILE.
|
37
|
+
* NOT IMPLEMENTED. */
|
38
|
+
GIT_BLAME_TRACK_COPIES_SAME_COMMIT_COPIES = (1<<2),
|
39
|
+
/** Track lines that have been copied from another file that exists in *any*
|
40
|
+
* commit (like `git blame -CCC`). Implies SAME_COMMIT_COPIES.
|
41
|
+
* NOT IMPLEMENTED. */
|
42
|
+
GIT_BLAME_TRACK_COPIES_ANY_COMMIT_COPIES = (1<<3),
|
43
|
+
/** Restrict the search of commits to those reachable following only the
|
44
|
+
* first parents. */
|
45
|
+
GIT_BLAME_FIRST_PARENT = (1<<4),
|
46
|
+
} git_blame_flag_t;
|
47
|
+
|
48
|
+
/**
|
49
|
+
* Blame options structure
|
50
|
+
*
|
51
|
+
* Use zeros to indicate default settings. It's easiest to use the
|
52
|
+
* `GIT_BLAME_OPTIONS_INIT` macro:
|
53
|
+
* git_blame_options opts = GIT_BLAME_OPTIONS_INIT;
|
54
|
+
*
|
55
|
+
* - `flags` is a combination of the `git_blame_flag_t` values above.
|
56
|
+
* - `min_match_characters` is the lower bound on the number of alphanumeric
|
57
|
+
* characters that must be detected as moving/copying within a file for it to
|
58
|
+
* associate those lines with the parent commit. The default value is 20.
|
59
|
+
* This value only takes effect if any of the `GIT_BLAME_TRACK_COPIES_*`
|
60
|
+
* flags are specified.
|
61
|
+
* - `newest_commit` is the id of the newest commit to consider. The default
|
62
|
+
* is HEAD.
|
63
|
+
* - `oldest_commit` is the id of the oldest commit to consider. The default
|
64
|
+
* is the first commit encountered with a NULL parent.
|
65
|
+
* - `min_line` is the first line in the file to blame. The default is 1 (line
|
66
|
+
* numbers start with 1).
|
67
|
+
* - `max_line` is the last line in the file to blame. The default is the last
|
68
|
+
* line of the file.
|
69
|
+
*/
|
70
|
+
|
71
|
+
typedef struct git_blame_options {
|
72
|
+
unsigned int version;
|
73
|
+
|
74
|
+
uint32_t flags;
|
75
|
+
uint16_t min_match_characters;
|
76
|
+
git_oid newest_commit;
|
77
|
+
git_oid oldest_commit;
|
78
|
+
uint32_t min_line;
|
79
|
+
uint32_t max_line;
|
80
|
+
} git_blame_options;
|
81
|
+
|
82
|
+
#define GIT_BLAME_OPTIONS_VERSION 1
|
83
|
+
#define GIT_BLAME_OPTIONS_INIT {GIT_BLAME_OPTIONS_VERSION}
|
84
|
+
|
85
|
+
/**
|
86
|
+
* Initializes a `git_blame_options` with default values. Equivalent to
|
87
|
+
* creating an instance with GIT_BLAME_OPTIONS_INIT.
|
88
|
+
*
|
89
|
+
* @param opts The `git_blame_options` struct to initialize
|
90
|
+
* @param version Version of struct; pass `GIT_BLAME_OPTIONS_VERSION`
|
91
|
+
* @return Zero on success; -1 on failure.
|
92
|
+
*/
|
93
|
+
GIT_EXTERN(int) git_blame_init_options(
|
94
|
+
git_blame_options *opts,
|
95
|
+
unsigned int version);
|
96
|
+
|
97
|
+
/**
|
98
|
+
* Structure that represents a blame hunk.
|
99
|
+
*
|
100
|
+
* - `lines_in_hunk` is the number of lines in this hunk
|
101
|
+
* - `final_commit_id` is the OID of the commit where this line was last
|
102
|
+
* changed.
|
103
|
+
* - `final_start_line_number` is the 1-based line number where this hunk
|
104
|
+
* begins, in the final version of the file
|
105
|
+
* - `orig_commit_id` is the OID of the commit where this hunk was found. This
|
106
|
+
* will usually be the same as `final_commit_id`, except when
|
107
|
+
* `GIT_BLAME_TRACK_COPIES_ANY_COMMIT_COPIES` has been specified.
|
108
|
+
* - `orig_path` is the path to the file where this hunk originated, as of the
|
109
|
+
* commit specified by `orig_commit_id`.
|
110
|
+
* - `orig_start_line_number` is the 1-based line number where this hunk begins
|
111
|
+
* in the file named by `orig_path` in the commit specified by
|
112
|
+
* `orig_commit_id`.
|
113
|
+
* - `boundary` is 1 iff the hunk has been tracked to a boundary commit (the
|
114
|
+
* root, or the commit specified in git_blame_options.oldest_commit)
|
115
|
+
*/
|
116
|
+
typedef struct git_blame_hunk {
|
117
|
+
uint16_t lines_in_hunk;
|
118
|
+
|
119
|
+
git_oid final_commit_id;
|
120
|
+
uint16_t final_start_line_number;
|
121
|
+
git_signature *final_signature;
|
122
|
+
|
123
|
+
git_oid orig_commit_id;
|
124
|
+
const char *orig_path;
|
125
|
+
uint16_t orig_start_line_number;
|
126
|
+
git_signature *orig_signature;
|
127
|
+
|
128
|
+
char boundary;
|
129
|
+
} git_blame_hunk;
|
130
|
+
|
131
|
+
|
132
|
+
/* Opaque structure to hold blame results */
|
133
|
+
typedef struct git_blame git_blame;
|
134
|
+
|
135
|
+
/**
|
136
|
+
* Gets the number of hunks that exist in the blame structure.
|
137
|
+
*/
|
138
|
+
GIT_EXTERN(uint32_t) git_blame_get_hunk_count(git_blame *blame);
|
139
|
+
|
140
|
+
/**
|
141
|
+
* Gets the blame hunk at the given index.
|
142
|
+
*
|
143
|
+
* @param blame the blame structure to query
|
144
|
+
* @param index index of the hunk to retrieve
|
145
|
+
* @return the hunk at the given index, or NULL on error
|
146
|
+
*/
|
147
|
+
GIT_EXTERN(const git_blame_hunk*) git_blame_get_hunk_byindex(
|
148
|
+
git_blame *blame,
|
149
|
+
uint32_t index);
|
150
|
+
|
151
|
+
/**
|
152
|
+
* Gets the hunk that relates to the given line number in the newest commit.
|
153
|
+
*
|
154
|
+
* @param blame the blame structure to query
|
155
|
+
* @param lineno the (1-based) line number to find a hunk for
|
156
|
+
* @return the hunk that contains the given line, or NULL on error
|
157
|
+
*/
|
158
|
+
GIT_EXTERN(const git_blame_hunk*) git_blame_get_hunk_byline(
|
159
|
+
git_blame *blame,
|
160
|
+
uint32_t lineno);
|
161
|
+
|
162
|
+
/**
|
163
|
+
* Get the blame for a single file.
|
164
|
+
*
|
165
|
+
* @param out pointer that will receive the blame object
|
166
|
+
* @param repo repository whose history is to be walked
|
167
|
+
* @param path path to file to consider
|
168
|
+
* @param options options for the blame operation. If NULL, this is treated as
|
169
|
+
* though GIT_BLAME_OPTIONS_INIT were passed.
|
170
|
+
* @return 0 on success, or an error code. (use giterr_last for information
|
171
|
+
* about the error.)
|
172
|
+
*/
|
173
|
+
GIT_EXTERN(int) git_blame_file(
|
174
|
+
git_blame **out,
|
175
|
+
git_repository *repo,
|
176
|
+
const char *path,
|
177
|
+
git_blame_options *options);
|
178
|
+
|
179
|
+
|
180
|
+
/**
|
181
|
+
* Get blame data for a file that has been modified in memory. The `reference`
|
182
|
+
* parameter is a pre-calculated blame for the in-odb history of the file. This
|
183
|
+
* means that once a file blame is completed (which can be expensive), updating
|
184
|
+
* the buffer blame is very fast.
|
185
|
+
*
|
186
|
+
* Lines that differ between the buffer and the committed version are marked as
|
187
|
+
* having a zero OID for their final_commit_id.
|
188
|
+
*
|
189
|
+
* @param out pointer that will receive the resulting blame data
|
190
|
+
* @param reference cached blame from the history of the file (usually the output
|
191
|
+
* from git_blame_file)
|
192
|
+
* @param buffer the (possibly) modified contents of the file
|
193
|
+
* @param buffer_len number of valid bytes in the buffer
|
194
|
+
* @return 0 on success, or an error code. (use giterr_last for information
|
195
|
+
* about the error)
|
196
|
+
*/
|
197
|
+
GIT_EXTERN(int) git_blame_buffer(
|
198
|
+
git_blame **out,
|
199
|
+
git_blame *reference,
|
200
|
+
const char *buffer,
|
201
|
+
size_t buffer_len);
|
202
|
+
|
203
|
+
/**
|
204
|
+
* Free memory allocated by git_blame_file or git_blame_buffer.
|
205
|
+
*
|
206
|
+
* @param blame the blame structure to free
|
207
|
+
*/
|
208
|
+
GIT_EXTERN(void) git_blame_free(git_blame *blame);
|
209
|
+
|
210
|
+
/** @} */
|
211
|
+
GIT_END_DECL
|
212
|
+
#endif
|
213
|
+
|
@@ -11,6 +11,7 @@
|
|
11
11
|
#include "types.h"
|
12
12
|
#include "oid.h"
|
13
13
|
#include "object.h"
|
14
|
+
#include "buffer.h"
|
14
15
|
|
15
16
|
/**
|
16
17
|
* @file git2/blob.h
|
@@ -83,7 +84,7 @@ GIT_EXTERN(git_repository *) git_blob_owner(const git_blob *blob);
|
|
83
84
|
* time.
|
84
85
|
*
|
85
86
|
* @param blob pointer to the blob
|
86
|
-
* @return the pointer
|
87
|
+
* @return the pointer
|
87
88
|
*/
|
88
89
|
GIT_EXTERN(const void *) git_blob_rawcontent(const git_blob *blob);
|
89
90
|
|
@@ -95,6 +96,37 @@ GIT_EXTERN(const void *) git_blob_rawcontent(const git_blob *blob);
|
|
95
96
|
*/
|
96
97
|
GIT_EXTERN(git_off_t) git_blob_rawsize(const git_blob *blob);
|
97
98
|
|
99
|
+
/**
|
100
|
+
* Get a buffer with the filtered content of a blob.
|
101
|
+
*
|
102
|
+
* This applies filters as if the blob was being checked out to the
|
103
|
+
* working directory under the specified filename. This may apply
|
104
|
+
* CRLF filtering or other types of changes depending on the file
|
105
|
+
* attributes set for the blob and the content detected in it.
|
106
|
+
*
|
107
|
+
* The output is written into a `git_buf` which the caller must free
|
108
|
+
* when done (via `git_buf_free`).
|
109
|
+
*
|
110
|
+
* If no filters need to be applied, then the `out` buffer will just be
|
111
|
+
* populated with a pointer to the raw content of the blob. In that case,
|
112
|
+
* be careful to *not* free the blob until done with the buffer. To keep
|
113
|
+
* the data detached from the blob, call `git_buf_grow` on the buffer
|
114
|
+
* with a `want_size` of 0 and the buffer will be reallocated to be
|
115
|
+
* detached from the blob.
|
116
|
+
*
|
117
|
+
* @param out The git_buf to be filled in
|
118
|
+
* @param blob Pointer to the blob
|
119
|
+
* @param as_path Path used for file attribute lookups, etc.
|
120
|
+
* @param check_for_binary_data Should this test if blob content contains
|
121
|
+
* NUL bytes / looks like binary data before applying filters?
|
122
|
+
* @return 0 on success or an error code
|
123
|
+
*/
|
124
|
+
GIT_EXTERN(int) git_blob_filtered_content(
|
125
|
+
git_buf *out,
|
126
|
+
git_blob *blob,
|
127
|
+
const char *as_path,
|
128
|
+
int check_for_binary_data);
|
129
|
+
|
98
130
|
/**
|
99
131
|
* Read a file from the working folder of a repository
|
100
132
|
* and write it to the Object Database as a loose blob
|
@@ -127,37 +159,32 @@ typedef int (*git_blob_chunk_cb)(char *content, size_t max_length, void *payload
|
|
127
159
|
* Write a loose blob to the Object Database from a
|
128
160
|
* provider of chunks of data.
|
129
161
|
*
|
130
|
-
*
|
131
|
-
*
|
132
|
-
* to the object
|
162
|
+
* If the `hintpath` parameter is filled, it will be used to determine
|
163
|
+
* what git filters should be applied to the object before it is written
|
164
|
+
* to the object database.
|
133
165
|
*
|
166
|
+
* The implementation of the callback MUST respect the following rules:
|
134
167
|
*
|
135
|
-
*
|
136
|
-
*
|
168
|
+
* - `content` must be filled by the callback. The maximum number of
|
169
|
+
* bytes that the buffer can accept per call is defined by the
|
170
|
+
* `max_length` parameter. Allocation and freeing of the buffer will
|
171
|
+
* be taken care of by libgit2.
|
137
172
|
*
|
138
|
-
* - `
|
139
|
-
*
|
140
|
-
* `max_length` parameter. Allocation and freeing of the buffer will be taken
|
141
|
-
* care of by the function.
|
173
|
+
* - The `callback` must return the number of bytes that have been
|
174
|
+
* written to the `content` buffer.
|
142
175
|
*
|
143
|
-
* -
|
144
|
-
*
|
145
|
-
*
|
146
|
-
* - When there is no more data to stream, the callback should
|
147
|
-
* return 0. This will prevent it from being invoked anymore.
|
148
|
-
*
|
149
|
-
* - When an error occurs, the callback should return -1.
|
176
|
+
* - When there is no more data to stream, `callback` should return
|
177
|
+
* 0. This will prevent it from being invoked anymore.
|
150
178
|
*
|
179
|
+
* - If an error occurs, the callback should return a negative value.
|
180
|
+
* This value will be returned to the caller.
|
151
181
|
*
|
152
182
|
* @param id Return the id of the written blob
|
153
|
-
*
|
154
|
-
*
|
155
|
-
*
|
156
|
-
*
|
157
|
-
* @
|
158
|
-
* to apply onto the content of the blob to be created.
|
159
|
-
*
|
160
|
-
* @return 0 or an error code
|
183
|
+
* @param repo Repository where the blob will be written.
|
184
|
+
* This repository can be bare or not.
|
185
|
+
* @param hintpath If not NULL, will be used to select data filters
|
186
|
+
* to apply onto the content of the blob to be created.
|
187
|
+
* @return 0 or error code (from either libgit2 or callback function)
|
161
188
|
*/
|
162
189
|
GIT_EXTERN(int) git_blob_create_fromchunks(
|
163
190
|
git_oid *id,
|
@@ -169,26 +196,27 @@ GIT_EXTERN(int) git_blob_create_fromchunks(
|
|
169
196
|
/**
|
170
197
|
* Write an in-memory buffer to the ODB as a blob
|
171
198
|
*
|
172
|
-
* @param
|
199
|
+
* @param id return the id of the written blob
|
173
200
|
* @param repo repository where to blob will be written
|
174
201
|
* @param buffer data to be written into the blob
|
175
202
|
* @param len length of the data
|
176
203
|
* @return 0 or an error code
|
177
204
|
*/
|
178
|
-
GIT_EXTERN(int) git_blob_create_frombuffer(
|
205
|
+
GIT_EXTERN(int) git_blob_create_frombuffer(
|
206
|
+
git_oid *id, git_repository *repo, const void *buffer, size_t len);
|
179
207
|
|
180
208
|
/**
|
181
209
|
* Determine if the blob content is most certainly binary or not.
|
182
210
|
*
|
183
211
|
* The heuristic used to guess if a file is binary is taken from core git:
|
184
212
|
* Searching for NUL bytes and looking for a reasonable ratio of printable
|
185
|
-
* to non-printable characters among the first
|
213
|
+
* to non-printable characters among the first 8000 bytes.
|
186
214
|
*
|
187
215
|
* @param blob The blob which content should be analyzed
|
188
216
|
* @return 1 if the content of the blob is detected
|
189
217
|
* as binary; 0 otherwise.
|
190
218
|
*/
|
191
|
-
GIT_EXTERN(int) git_blob_is_binary(git_blob *blob);
|
219
|
+
GIT_EXTERN(int) git_blob_is_binary(const git_blob *blob);
|
192
220
|
|
193
221
|
/** @} */
|
194
222
|
GIT_END_DECL
|