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
@@ -19,24 +19,39 @@ GIT_BEGIN_DECL
|
|
19
19
|
|
20
20
|
/** Generic return codes */
|
21
21
|
typedef enum {
|
22
|
-
GIT_OK
|
23
|
-
GIT_ERROR = -1,
|
24
|
-
GIT_ENOTFOUND = -3,
|
25
|
-
GIT_EEXISTS = -4,
|
26
|
-
GIT_EAMBIGUOUS = -5,
|
27
|
-
GIT_EBUFS = -6,
|
28
|
-
GIT_EUSER = -7,
|
29
|
-
GIT_EBAREREPO = -8,
|
30
|
-
GIT_EORPHANEDHEAD = -9,
|
31
|
-
GIT_EUNMERGED = -10,
|
32
|
-
GIT_ENONFASTFORWARD = -11,
|
33
|
-
GIT_EINVALIDSPEC = -12,
|
34
|
-
GIT_EMERGECONFLICT = -13,
|
22
|
+
GIT_OK = 0, /**< No error */
|
35
23
|
|
36
|
-
|
37
|
-
|
24
|
+
GIT_ERROR = -1, /**< Generic error */
|
25
|
+
GIT_ENOTFOUND = -3, /**< Requested object could not be found */
|
26
|
+
GIT_EEXISTS = -4, /**< Object exists preventing operation */
|
27
|
+
GIT_EAMBIGUOUS = -5, /**< More than one object matches */
|
28
|
+
GIT_EBUFS = -6, /**< Output buffer too short to hold data */
|
29
|
+
|
30
|
+
/* GIT_EUSER is a special error that is never generated by libgit2
|
31
|
+
* code. You can return it from a callback (e.g to stop an iteration)
|
32
|
+
* to know that it was generated by the callback and not by libgit2.
|
33
|
+
*/
|
34
|
+
GIT_EUSER = -7,
|
35
|
+
|
36
|
+
GIT_EBAREREPO = -8, /**< Operation not allowed on bare repository */
|
37
|
+
GIT_EUNBORNBRANCH = -9, /**< HEAD refers to branch with no commits */
|
38
|
+
GIT_EUNMERGED = -10, /**< Merge in progress prevented operation */
|
39
|
+
GIT_ENONFASTFORWARD = -11, /**< Reference was not fast-forwardable */
|
40
|
+
GIT_EINVALIDSPEC = -12, /**< Name/ref spec was not in a valid format */
|
41
|
+
GIT_EMERGECONFLICT = -13, /**< Merge conflicts prevented operation */
|
42
|
+
GIT_ELOCKED = -14, /**< Lock file prevented operation */
|
43
|
+
GIT_EMODIFIED = -15, /**< Reference value does not match expected */
|
44
|
+
|
45
|
+
GIT_PASSTHROUGH = -30, /**< Internal only */
|
46
|
+
GIT_ITEROVER = -31, /**< Signals end of iteration with iterator */
|
38
47
|
} git_error_code;
|
39
48
|
|
49
|
+
/**
|
50
|
+
* Structure to store extra details of the last error that occurred.
|
51
|
+
*
|
52
|
+
* This is kept on a per-thread basis if GIT_THREADS was defined when the
|
53
|
+
* library was build, otherwise one is kept globally for the library
|
54
|
+
*/
|
40
55
|
typedef struct {
|
41
56
|
char *message;
|
42
57
|
int klass;
|
@@ -44,6 +59,7 @@ typedef struct {
|
|
44
59
|
|
45
60
|
/** Error classes */
|
46
61
|
typedef enum {
|
62
|
+
GITERR_NONE = 0,
|
47
63
|
GITERR_NOMEMORY,
|
48
64
|
GITERR_OS,
|
49
65
|
GITERR_INVALID,
|
@@ -66,6 +82,11 @@ typedef enum {
|
|
66
82
|
GITERR_CHECKOUT,
|
67
83
|
GITERR_FETCHHEAD,
|
68
84
|
GITERR_MERGE,
|
85
|
+
GITERR_SSH,
|
86
|
+
GITERR_FILTER,
|
87
|
+
GITERR_REVERT,
|
88
|
+
GITERR_CALLBACK,
|
89
|
+
GITERR_CHERRYPICK,
|
69
90
|
} git_error_t;
|
70
91
|
|
71
92
|
/**
|
@@ -81,6 +102,18 @@ GIT_EXTERN(const git_error *) giterr_last(void);
|
|
81
102
|
*/
|
82
103
|
GIT_EXTERN(void) giterr_clear(void);
|
83
104
|
|
105
|
+
/**
|
106
|
+
* Get the last error data and clear it.
|
107
|
+
*
|
108
|
+
* This copies the last error into the given `git_error` struct
|
109
|
+
* and returns 0 if the copy was successful, leaving the error
|
110
|
+
* cleared as if `giterr_clear` had been called.
|
111
|
+
*
|
112
|
+
* If there was no existing error in the library, -1 will be returned
|
113
|
+
* and the contents of `cpy` will be left unmodified.
|
114
|
+
*/
|
115
|
+
GIT_EXTERN(int) giterr_detach(git_error *cpy);
|
116
|
+
|
84
117
|
/**
|
85
118
|
* Set the error message string for this thread.
|
86
119
|
*
|
@@ -0,0 +1,149 @@
|
|
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
|
+
#ifndef INCLUDE_git_filter_h__
|
8
|
+
#define INCLUDE_git_filter_h__
|
9
|
+
|
10
|
+
#include "common.h"
|
11
|
+
#include "types.h"
|
12
|
+
#include "oid.h"
|
13
|
+
#include "buffer.h"
|
14
|
+
|
15
|
+
/**
|
16
|
+
* @file git2/filter.h
|
17
|
+
* @brief Git filter APIs
|
18
|
+
*
|
19
|
+
* @ingroup Git
|
20
|
+
* @{
|
21
|
+
*/
|
22
|
+
GIT_BEGIN_DECL
|
23
|
+
|
24
|
+
/**
|
25
|
+
* Filters are applied in one of two directions: smudging - which is
|
26
|
+
* exporting a file from the Git object database to the working directory,
|
27
|
+
* and cleaning - which is importing a file from the working directory to
|
28
|
+
* the Git object database. These values control which direction of
|
29
|
+
* change is being applied.
|
30
|
+
*/
|
31
|
+
typedef enum {
|
32
|
+
GIT_FILTER_TO_WORKTREE = 0,
|
33
|
+
GIT_FILTER_SMUDGE = GIT_FILTER_TO_WORKTREE,
|
34
|
+
GIT_FILTER_TO_ODB = 1,
|
35
|
+
GIT_FILTER_CLEAN = GIT_FILTER_TO_ODB,
|
36
|
+
} git_filter_mode_t;
|
37
|
+
|
38
|
+
typedef enum {
|
39
|
+
GIT_FILTER_OPT_DEFAULT = 0u,
|
40
|
+
GIT_FILTER_OPT_ALLOW_UNSAFE = (1u << 0),
|
41
|
+
} git_filter_opt_t;
|
42
|
+
|
43
|
+
/**
|
44
|
+
* A filter that can transform file data
|
45
|
+
*
|
46
|
+
* This represents a filter that can be used to transform or even replace
|
47
|
+
* file data. Libgit2 includes one built in filter and it is possible to
|
48
|
+
* write your own (see git2/sys/filter.h for information on that).
|
49
|
+
*
|
50
|
+
* The two builtin filters are:
|
51
|
+
*
|
52
|
+
* * "crlf" which uses the complex rules with the "text", "eol", and
|
53
|
+
* "crlf" file attributes to decide how to convert between LF and CRLF
|
54
|
+
* line endings
|
55
|
+
* * "ident" which replaces "$Id$" in a blob with "$Id: <blob OID>$" upon
|
56
|
+
* checkout and replaced "$Id: <anything>$" with "$Id$" on checkin.
|
57
|
+
*/
|
58
|
+
typedef struct git_filter git_filter;
|
59
|
+
|
60
|
+
/**
|
61
|
+
* List of filters to be applied
|
62
|
+
*
|
63
|
+
* This represents a list of filters to be applied to a file / blob. You
|
64
|
+
* can build the list with one call, apply it with another, and dispose it
|
65
|
+
* with a third. In typical usage, there are not many occasions where a
|
66
|
+
* git_filter_list is needed directly since the library will generally
|
67
|
+
* handle conversions for you, but it can be convenient to be able to
|
68
|
+
* build and apply the list sometimes.
|
69
|
+
*/
|
70
|
+
typedef struct git_filter_list git_filter_list;
|
71
|
+
|
72
|
+
/**
|
73
|
+
* Load the filter list for a given path.
|
74
|
+
*
|
75
|
+
* This will return 0 (success) but set the output git_filter_list to NULL
|
76
|
+
* if no filters are requested for the given file.
|
77
|
+
*
|
78
|
+
* @param filters Output newly created git_filter_list (or NULL)
|
79
|
+
* @param repo Repository object that contains `path`
|
80
|
+
* @param blob The blob to which the filter will be applied (if known)
|
81
|
+
* @param path Relative path of the file to be filtered
|
82
|
+
* @param mode Filtering direction (WT->ODB or ODB->WT)
|
83
|
+
* @param options Combination of `git_filter_opt_t` flags
|
84
|
+
* @return 0 on success (which could still return NULL if no filters are
|
85
|
+
* needed for the requested file), <0 on error
|
86
|
+
*/
|
87
|
+
GIT_EXTERN(int) git_filter_list_load(
|
88
|
+
git_filter_list **filters,
|
89
|
+
git_repository *repo,
|
90
|
+
git_blob *blob, /* can be NULL */
|
91
|
+
const char *path,
|
92
|
+
git_filter_mode_t mode,
|
93
|
+
uint32_t options);
|
94
|
+
|
95
|
+
/**
|
96
|
+
* Apply filter list to a data buffer.
|
97
|
+
*
|
98
|
+
* See `git2/buffer.h` for background on `git_buf` objects.
|
99
|
+
*
|
100
|
+
* If the `in` buffer holds data allocated by libgit2 (i.e. `in->asize` is
|
101
|
+
* not zero), then it will be overwritten when applying the filters. If
|
102
|
+
* not, then it will be left untouched.
|
103
|
+
*
|
104
|
+
* If there are no filters to apply (or `filters` is NULL), then the `out`
|
105
|
+
* buffer will reference the `in` buffer data (with `asize` set to zero)
|
106
|
+
* instead of allocating data. This keeps allocations to a minimum, but
|
107
|
+
* it means you have to be careful about freeing the `in` data since `out`
|
108
|
+
* may be pointing to it!
|
109
|
+
*
|
110
|
+
* @param out Buffer to store the result of the filtering
|
111
|
+
* @param filters A loaded git_filter_list (or NULL)
|
112
|
+
* @param in Buffer containing the data to filter
|
113
|
+
* @return 0 on success, an error code otherwise
|
114
|
+
*/
|
115
|
+
GIT_EXTERN(int) git_filter_list_apply_to_data(
|
116
|
+
git_buf *out,
|
117
|
+
git_filter_list *filters,
|
118
|
+
git_buf *in);
|
119
|
+
|
120
|
+
/**
|
121
|
+
* Apply filter list to the contents of a file on disk
|
122
|
+
*/
|
123
|
+
GIT_EXTERN(int) git_filter_list_apply_to_file(
|
124
|
+
git_buf *out,
|
125
|
+
git_filter_list *filters,
|
126
|
+
git_repository *repo,
|
127
|
+
const char *path);
|
128
|
+
|
129
|
+
/**
|
130
|
+
* Apply filter list to the contents of a blob
|
131
|
+
*/
|
132
|
+
GIT_EXTERN(int) git_filter_list_apply_to_blob(
|
133
|
+
git_buf *out,
|
134
|
+
git_filter_list *filters,
|
135
|
+
git_blob *blob);
|
136
|
+
|
137
|
+
/**
|
138
|
+
* Free a git_filter_list
|
139
|
+
*
|
140
|
+
* @param filters A git_filter_list created by `git_filter_list_load`
|
141
|
+
*/
|
142
|
+
GIT_EXTERN(void) git_filter_list_free(git_filter_list *filters);
|
143
|
+
|
144
|
+
|
145
|
+
GIT_END_DECL
|
146
|
+
|
147
|
+
/** @} */
|
148
|
+
|
149
|
+
#endif
|
@@ -36,6 +36,20 @@ GIT_BEGIN_DECL
|
|
36
36
|
*/
|
37
37
|
GIT_EXTERN(int) git_graph_ahead_behind(size_t *ahead, size_t *behind, git_repository *repo, const git_oid *local, const git_oid *upstream);
|
38
38
|
|
39
|
+
|
40
|
+
/**
|
41
|
+
* Determine if a commit is the descendant of another commit.
|
42
|
+
*
|
43
|
+
* @param commit a previously loaded commit.
|
44
|
+
* @param ancestor a potential ancestor commit.
|
45
|
+
* @return 1 if the given commit is a descendant of the potential ancestor,
|
46
|
+
* 0 if not, error code otherwise.
|
47
|
+
*/
|
48
|
+
GIT_EXTERN(int) git_graph_descendant_of(
|
49
|
+
git_repository *repo,
|
50
|
+
const git_oid *commit,
|
51
|
+
const git_oid *ancestor);
|
52
|
+
|
39
53
|
/** @} */
|
40
54
|
GIT_END_DECL
|
41
55
|
#endif
|
@@ -56,12 +56,12 @@ typedef struct git_index_entry {
|
|
56
56
|
unsigned int gid;
|
57
57
|
git_off_t file_size;
|
58
58
|
|
59
|
-
git_oid
|
59
|
+
git_oid id;
|
60
60
|
|
61
61
|
unsigned short flags;
|
62
62
|
unsigned short flags_extended;
|
63
63
|
|
64
|
-
char *path;
|
64
|
+
const char *path;
|
65
65
|
} git_index_entry;
|
66
66
|
|
67
67
|
/**
|
@@ -73,11 +73,19 @@ typedef struct git_index_entry {
|
|
73
73
|
*/
|
74
74
|
#define GIT_IDXENTRY_NAMEMASK (0x0fff)
|
75
75
|
#define GIT_IDXENTRY_STAGEMASK (0x3000)
|
76
|
-
#define GIT_IDXENTRY_EXTENDED (0x4000)
|
77
|
-
#define GIT_IDXENTRY_VALID (0x8000)
|
78
76
|
#define GIT_IDXENTRY_STAGESHIFT 12
|
79
77
|
|
80
|
-
|
78
|
+
typedef enum {
|
79
|
+
GIT_IDXENTRY_EXTENDED = (0x4000),
|
80
|
+
GIT_IDXENTRY_VALID = (0x8000),
|
81
|
+
} git_indxentry_flag_t;
|
82
|
+
|
83
|
+
#define GIT_IDXENTRY_STAGE(E) \
|
84
|
+
(((E)->flags & GIT_IDXENTRY_STAGEMASK) >> GIT_IDXENTRY_STAGESHIFT)
|
85
|
+
|
86
|
+
#define GIT_IDXENTRY_STAGE_SET(E,S) do { \
|
87
|
+
(E)->flags = ((E)->flags & ~GIT_IDXENTRY_STAGEMASK) | \
|
88
|
+
(((S) & 0x03) << GIT_IDXENTRY_STAGESHIFT); } while (0)
|
81
89
|
|
82
90
|
/**
|
83
91
|
* Bitmasks for on-disk fields of `git_index_entry`'s `flags_extended`
|
@@ -87,43 +95,43 @@ typedef struct git_index_entry {
|
|
87
95
|
* in-memory only and used by libgit2. Only the flags in
|
88
96
|
* `GIT_IDXENTRY_EXTENDED_FLAGS` will get saved on-disk.
|
89
97
|
*
|
90
|
-
*
|
91
|
-
* `flags_extended` value that belong on disk. You
|
92
|
-
* interpret the data in the `flags_extended`.
|
98
|
+
* Thee first three bitmasks match the three fields in the
|
99
|
+
* `git_index_entry` `flags_extended` value that belong on disk. You
|
100
|
+
* can use them to interpret the data in the `flags_extended`.
|
101
|
+
*
|
102
|
+
* The rest of the bitmasks match the other fields in the `git_index_entry`
|
103
|
+
* `flags_extended` value that are only used in-memory by libgit2.
|
104
|
+
* You can use them to interpret the data in the `flags_extended`.
|
105
|
+
*
|
93
106
|
*/
|
94
|
-
|
95
|
-
#define GIT_IDXENTRY_SKIP_WORKTREE (1 << 14)
|
96
|
-
/* GIT_IDXENTRY_EXTENDED2 is reserved for future extension */
|
97
|
-
#define GIT_IDXENTRY_EXTENDED2 (1 << 15)
|
107
|
+
typedef enum {
|
98
108
|
|
99
|
-
|
109
|
+
GIT_IDXENTRY_INTENT_TO_ADD = (1 << 13),
|
110
|
+
GIT_IDXENTRY_SKIP_WORKTREE = (1 << 14),
|
111
|
+
/** Reserved for future extension */
|
112
|
+
GIT_IDXENTRY_EXTENDED2 = (1 << 15),
|
100
113
|
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
* can use them to interpret the data in the `flags_extended`.
|
107
|
-
*/
|
108
|
-
#define GIT_IDXENTRY_UPDATE (1 << 0)
|
109
|
-
#define GIT_IDXENTRY_REMOVE (1 << 1)
|
110
|
-
#define GIT_IDXENTRY_UPTODATE (1 << 2)
|
111
|
-
#define GIT_IDXENTRY_ADDED (1 << 3)
|
114
|
+
GIT_IDXENTRY_EXTENDED_FLAGS = (GIT_IDXENTRY_INTENT_TO_ADD | GIT_IDXENTRY_SKIP_WORKTREE),
|
115
|
+
GIT_IDXENTRY_UPDATE = (1 << 0),
|
116
|
+
GIT_IDXENTRY_REMOVE = (1 << 1),
|
117
|
+
GIT_IDXENTRY_UPTODATE = (1 << 2),
|
118
|
+
GIT_IDXENTRY_ADDED = (1 << 3),
|
112
119
|
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
120
|
+
GIT_IDXENTRY_HASHED = (1 << 4),
|
121
|
+
GIT_IDXENTRY_UNHASHED = (1 << 5),
|
122
|
+
GIT_IDXENTRY_WT_REMOVE = (1 << 6), /**< remove in work directory */
|
123
|
+
GIT_IDXENTRY_CONFLICTED = (1 << 7),
|
117
124
|
|
118
|
-
|
119
|
-
|
125
|
+
GIT_IDXENTRY_UNPACKED = (1 << 8),
|
126
|
+
GIT_IDXENTRY_NEW_SKIP_WORKTREE = (1 << 9),
|
127
|
+
} git_idxentry_extended_flag_t;
|
120
128
|
|
121
129
|
/** Capabilities of system that affect index actions. */
|
122
130
|
typedef enum {
|
123
131
|
GIT_INDEXCAP_IGNORE_CASE = 1,
|
124
132
|
GIT_INDEXCAP_NO_FILEMODE = 2,
|
125
133
|
GIT_INDEXCAP_NO_SYMLINKS = 4,
|
126
|
-
GIT_INDEXCAP_FROM_OWNER =
|
134
|
+
GIT_INDEXCAP_FROM_OWNER = -1,
|
127
135
|
} git_indexcap_t;
|
128
136
|
|
129
137
|
/** Callback for APIs that add/remove/update files matching pathspec */
|
@@ -138,6 +146,14 @@ typedef enum {
|
|
138
146
|
GIT_INDEX_ADD_CHECK_PATHSPEC = (1u << 2),
|
139
147
|
} git_index_add_option_t;
|
140
148
|
|
149
|
+
/**
|
150
|
+
* Match any index stage.
|
151
|
+
*
|
152
|
+
* Some index APIs take a stage to match; pass this value to match
|
153
|
+
* any entry matching the path regardless of stage.
|
154
|
+
*/
|
155
|
+
#define GIT_INDEX_STAGE_ANY -1
|
156
|
+
|
141
157
|
/** @name Index File Functions
|
142
158
|
*
|
143
159
|
* These functions work on the index file itself.
|
@@ -150,8 +166,8 @@ typedef enum {
|
|
150
166
|
* to back it.
|
151
167
|
*
|
152
168
|
* Since there is no ODB or working directory behind this index,
|
153
|
-
* any Index methods which rely on these (e.g.
|
154
|
-
* fail with the
|
169
|
+
* any Index methods which rely on these (e.g. index_add_bypath)
|
170
|
+
* will fail with the GIT_ERROR error code.
|
155
171
|
*
|
156
172
|
* If you need to access the index of an actual repository,
|
157
173
|
* use the `git_repository_index` wrapper.
|
@@ -198,7 +214,7 @@ GIT_EXTERN(git_repository *) git_index_owner(const git_index *index);
|
|
198
214
|
* @param index An existing index object
|
199
215
|
* @return A combination of GIT_INDEXCAP values
|
200
216
|
*/
|
201
|
-
GIT_EXTERN(
|
217
|
+
GIT_EXTERN(int) git_index_caps(const git_index *index);
|
202
218
|
|
203
219
|
/**
|
204
220
|
* Set index capabilities flags.
|
@@ -211,16 +227,26 @@ GIT_EXTERN(unsigned int) git_index_caps(const git_index *index);
|
|
211
227
|
* @param caps A combination of GIT_INDEXCAP values
|
212
228
|
* @return 0 on success, -1 on failure
|
213
229
|
*/
|
214
|
-
GIT_EXTERN(int) git_index_set_caps(git_index *index,
|
230
|
+
GIT_EXTERN(int) git_index_set_caps(git_index *index, int caps);
|
215
231
|
|
216
232
|
/**
|
217
|
-
* Update the contents of an existing index object in memory
|
218
|
-
*
|
233
|
+
* Update the contents of an existing index object in memory by reading
|
234
|
+
* from the hard disk.
|
235
|
+
*
|
236
|
+
* If `force` is true, this performs a "hard" read that discards in-memory
|
237
|
+
* changes and always reloads the on-disk index data. If there is no
|
238
|
+
* on-disk version, the index will be cleared.
|
239
|
+
*
|
240
|
+
* If `force` is false, this does a "soft" read that reloads the index
|
241
|
+
* data from disk only if it has changed since the last time it was
|
242
|
+
* loaded. Purely in-memory index data will be untouched. Be aware: if
|
243
|
+
* there are changes on disk, unwritten in-memory changes are discarded.
|
219
244
|
*
|
220
245
|
* @param index an existing index object
|
246
|
+
* @param force if true, always reload, vs. only read if file has changed
|
221
247
|
* @return 0 or an error code
|
222
248
|
*/
|
223
|
-
GIT_EXTERN(int) git_index_read(git_index *index);
|
249
|
+
GIT_EXTERN(int) git_index_read(git_index *index, int force);
|
224
250
|
|
225
251
|
/**
|
226
252
|
* Write an existing index object from memory back to disk
|
@@ -231,6 +257,14 @@ GIT_EXTERN(int) git_index_read(git_index *index);
|
|
231
257
|
*/
|
232
258
|
GIT_EXTERN(int) git_index_write(git_index *index);
|
233
259
|
|
260
|
+
/**
|
261
|
+
* Get the full path to the index file on disk.
|
262
|
+
*
|
263
|
+
* @param index an existing index object
|
264
|
+
* @return path to index file or NULL for in-memory index
|
265
|
+
*/
|
266
|
+
GIT_EXTERN(const char *) git_index_path(const git_index *index);
|
267
|
+
|
234
268
|
/**
|
235
269
|
* Read a tree into the index file with stats
|
236
270
|
*
|
@@ -301,12 +335,14 @@ GIT_EXTERN(size_t) git_index_entrycount(const git_index *index);
|
|
301
335
|
|
302
336
|
/**
|
303
337
|
* Clear the contents (all the entries) of an index object.
|
304
|
-
*
|
305
|
-
*
|
338
|
+
*
|
339
|
+
* This clears the index object in memory; changes must be explicitly
|
340
|
+
* written to disk for them to take effect persistently.
|
306
341
|
*
|
307
342
|
* @param index an existing index object
|
343
|
+
* @return 0 on success, error code < 0 on failure
|
308
344
|
*/
|
309
|
-
GIT_EXTERN(
|
345
|
+
GIT_EXTERN(int) git_index_clear(git_index *index);
|
310
346
|
|
311
347
|
/**
|
312
348
|
* Get a pointer to one of the entries in the index
|
@@ -379,10 +415,10 @@ GIT_EXTERN(int) git_index_add(git_index *index, const git_index_entry *source_en
|
|
379
415
|
*
|
380
416
|
* This entry is calculated from the entry's flag attribute like this:
|
381
417
|
*
|
382
|
-
*
|
418
|
+
* (entry->flags & GIT_IDXENTRY_STAGEMASK) >> GIT_IDXENTRY_STAGESHIFT
|
383
419
|
*
|
384
420
|
* @param entry The entry
|
385
|
-
* @
|
421
|
+
* @return the stage number
|
386
422
|
*/
|
387
423
|
GIT_EXTERN(int) git_index_entry_stage(const git_index_entry *entry);
|
388
424
|
|
@@ -467,7 +503,7 @@ GIT_EXTERN(int) git_index_remove_bypath(git_index *index, const char *path);
|
|
467
503
|
* item in the working directory immediately *before* it is added to /
|
468
504
|
* updated in the index. Returning zero will add the item to the index,
|
469
505
|
* greater than zero will skip the item, and less than zero will abort the
|
470
|
-
* scan and
|
506
|
+
* scan and return that value to the caller.
|
471
507
|
*
|
472
508
|
* @param index an existing index object
|
473
509
|
* @param pathspec array of path patterns
|
@@ -476,7 +512,7 @@ GIT_EXTERN(int) git_index_remove_bypath(git_index *index, const char *path);
|
|
476
512
|
* gets index of matching pathspec entry); can be NULL;
|
477
513
|
* return 0 to add, >0 to skip, <0 to abort scan.
|
478
514
|
* @param payload payload passed through to callback function
|
479
|
-
* @return 0 or
|
515
|
+
* @return 0 on success, negative callback return value, or error code
|
480
516
|
*/
|
481
517
|
GIT_EXTERN(int) git_index_add_all(
|
482
518
|
git_index *index,
|
@@ -498,7 +534,7 @@ GIT_EXTERN(int) git_index_add_all(
|
|
498
534
|
* gets index of matching pathspec entry); can be NULL;
|
499
535
|
* return 0 to add, >0 to skip, <0 to abort scan.
|
500
536
|
* @param payload payload passed through to callback function
|
501
|
-
* @return 0 or
|
537
|
+
* @return 0 on success, negative callback return value, or error code
|
502
538
|
*/
|
503
539
|
GIT_EXTERN(int) git_index_remove_all(
|
504
540
|
git_index *index,
|
@@ -527,7 +563,7 @@ GIT_EXTERN(int) git_index_remove_all(
|
|
527
563
|
* gets index of matching pathspec entry); can be NULL;
|
528
564
|
* return 0 to add, >0 to skip, <0 to abort scan.
|
529
565
|
* @param payload payload passed through to callback function
|
530
|
-
* @return 0 or
|
566
|
+
* @return 0 on success, negative callback return value, or error code
|
531
567
|
*/
|
532
568
|
GIT_EXTERN(int) git_index_update_all(
|
533
569
|
git_index *index,
|
@@ -542,8 +578,7 @@ GIT_EXTERN(int) git_index_update_all(
|
|
542
578
|
* @param at_pos the address to which the position of the index entry is written (optional)
|
543
579
|
* @param index an existing index object
|
544
580
|
* @param path path to search
|
545
|
-
* @return a zero-based position in the index if found;
|
546
|
-
* GIT_ENOTFOUND otherwise
|
581
|
+
* @return a zero-based position in the index if found; GIT_ENOTFOUND otherwise
|
547
582
|
*/
|
548
583
|
GIT_EXTERN(int) git_index_find(size_t *at_pos, git_index *index, const char *path);
|
549
584
|
|
@@ -587,6 +622,7 @@ GIT_EXTERN(int) git_index_conflict_add(
|
|
587
622
|
* @param their_out Pointer to store the their entry
|
588
623
|
* @param index an existing index object
|
589
624
|
* @param path path to search
|
625
|
+
* @return 0 or an error code
|
590
626
|
*/
|
591
627
|
GIT_EXTERN(int) git_index_conflict_get(
|
592
628
|
const git_index_entry **ancestor_out,
|
@@ -599,16 +635,18 @@ GIT_EXTERN(int) git_index_conflict_get(
|
|
599
635
|
* Removes the index entries that represent a conflict of a single file.
|
600
636
|
*
|
601
637
|
* @param index an existing index object
|
602
|
-
* @param path to
|
638
|
+
* @param path path to remove conflicts for
|
639
|
+
* @return 0 or an error code
|
603
640
|
*/
|
604
641
|
GIT_EXTERN(int) git_index_conflict_remove(git_index *index, const char *path);
|
605
642
|
|
606
643
|
/**
|
607
|
-
* Remove all conflicts in the index (entries with a stage greater than 0.
|
644
|
+
* Remove all conflicts in the index (entries with a stage greater than 0).
|
608
645
|
*
|
609
646
|
* @param index an existing index object
|
647
|
+
* @return 0 or an error code
|
610
648
|
*/
|
611
|
-
GIT_EXTERN(
|
649
|
+
GIT_EXTERN(int) git_index_conflict_cleanup(git_index *index);
|
612
650
|
|
613
651
|
/**
|
614
652
|
* Determine if the index contains entries representing file conflicts.
|
@@ -618,9 +656,12 @@ GIT_EXTERN(void) git_index_conflict_cleanup(git_index *index);
|
|
618
656
|
GIT_EXTERN(int) git_index_has_conflicts(const git_index *index);
|
619
657
|
|
620
658
|
/**
|
621
|
-
* Create an iterator for the conflicts in the index.
|
622
|
-
*
|
659
|
+
* Create an iterator for the conflicts in the index.
|
660
|
+
*
|
661
|
+
* The index must not be modified while iterating; the results are undefined.
|
623
662
|
*
|
663
|
+
* @param iterator_out The newly created conflict iterator
|
664
|
+
* @param index The index to scan
|
624
665
|
* @return 0 or an error code
|
625
666
|
*/
|
626
667
|
GIT_EXTERN(int) git_index_conflict_iterator_new(
|
@@ -13,20 +13,26 @@
|
|
13
13
|
|
14
14
|
GIT_BEGIN_DECL
|
15
15
|
|
16
|
-
typedef struct
|
16
|
+
typedef struct git_indexer git_indexer;
|
17
17
|
|
18
18
|
/**
|
19
|
-
* Create a new
|
19
|
+
* Create a new indexer instance
|
20
20
|
*
|
21
21
|
* @param out where to store the indexer instance
|
22
22
|
* @param path to the directory where the packfile should be stored
|
23
|
+
* @param mode permissions to use creating packfile or 0 for defaults
|
24
|
+
* @param odb object database from which to read base objects when
|
25
|
+
* fixing thin packs. Pass NULL if no thin pack is expected (an error
|
26
|
+
* will be returned if there are bases missing)
|
23
27
|
* @param progress_cb function to call with progress information
|
24
28
|
* @param progress_cb_payload payload for the progress callback
|
25
29
|
*/
|
26
|
-
GIT_EXTERN(int)
|
27
|
-
|
30
|
+
GIT_EXTERN(int) git_indexer_new(
|
31
|
+
git_indexer **out,
|
28
32
|
const char *path,
|
29
|
-
|
33
|
+
unsigned int mode,
|
34
|
+
git_odb *odb,
|
35
|
+
git_transfer_progress_cb progress_cb,
|
30
36
|
void *progress_cb_payload);
|
31
37
|
|
32
38
|
/**
|
@@ -37,7 +43,7 @@ GIT_EXTERN(int) git_indexer_stream_new(
|
|
37
43
|
* @param size the size of the data in bytes
|
38
44
|
* @param stats stat storage
|
39
45
|
*/
|
40
|
-
GIT_EXTERN(int)
|
46
|
+
GIT_EXTERN(int) git_indexer_append(git_indexer *idx, const void *data, size_t size, git_transfer_progress *stats);
|
41
47
|
|
42
48
|
/**
|
43
49
|
* Finalize the pack and index
|
@@ -46,7 +52,7 @@ GIT_EXTERN(int) git_indexer_stream_add(git_indexer_stream *idx, const void *data
|
|
46
52
|
*
|
47
53
|
* @param idx the indexer
|
48
54
|
*/
|
49
|
-
GIT_EXTERN(int)
|
55
|
+
GIT_EXTERN(int) git_indexer_commit(git_indexer *idx, git_transfer_progress *stats);
|
50
56
|
|
51
57
|
/**
|
52
58
|
* Get the packfile's hash
|
@@ -56,14 +62,14 @@ GIT_EXTERN(int) git_indexer_stream_finalize(git_indexer_stream *idx, git_transfe
|
|
56
62
|
*
|
57
63
|
* @param idx the indexer instance
|
58
64
|
*/
|
59
|
-
GIT_EXTERN(const git_oid *)
|
65
|
+
GIT_EXTERN(const git_oid *) git_indexer_hash(const git_indexer *idx);
|
60
66
|
|
61
67
|
/**
|
62
68
|
* Free the indexer and its resources
|
63
69
|
*
|
64
70
|
* @param idx the indexer to free
|
65
71
|
*/
|
66
|
-
GIT_EXTERN(void)
|
72
|
+
GIT_EXTERN(void) git_indexer_free(git_indexer *idx);
|
67
73
|
|
68
74
|
GIT_END_DECL
|
69
75
|
|