rugged 0.26.7 → 0.27.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/ext/rugged/rugged_blame.c +6 -3
- data/ext/rugged/rugged_branch_collection.c +3 -6
- data/ext/rugged/rugged_commit.c +56 -0
- data/ext/rugged/rugged_config.c +44 -9
- data/ext/rugged/rugged_diff.c +3 -14
- data/ext/rugged/rugged_diff_hunk.c +1 -3
- data/ext/rugged/rugged_index.c +1 -5
- data/ext/rugged/rugged_note.c +1 -4
- data/ext/rugged/rugged_patch.c +1 -4
- data/ext/rugged/rugged_reference_collection.c +1 -7
- data/ext/rugged/rugged_remote.c +5 -8
- data/ext/rugged/rugged_remote_collection.c +1 -6
- data/ext/rugged/rugged_repo.c +16 -48
- data/ext/rugged/rugged_revwalk.c +7 -16
- data/ext/rugged/rugged_settings.c +28 -0
- data/ext/rugged/rugged_submodule_collection.c +3 -4
- data/ext/rugged/rugged_tag_collection.c +1 -5
- data/ext/rugged/rugged_tree.c +2 -3
- data/lib/rugged/repository.rb +43 -0
- data/lib/rugged/version.rb +1 -1
- data/vendor/libgit2/AUTHORS +1 -0
- data/vendor/libgit2/CMakeLists.txt +61 -510
- data/vendor/libgit2/cmake/Modules/EnableWarnings.cmake +14 -0
- data/vendor/libgit2/cmake/Modules/FindCoreFoundation.cmake +25 -8
- data/vendor/libgit2/cmake/Modules/FindSecurity.cmake +27 -8
- data/vendor/libgit2/cmake/Modules/FindStatNsec.cmake +20 -0
- data/vendor/libgit2/cmake/Modules/IdeSplitSources.cmake +22 -0
- data/vendor/libgit2/deps/http-parser/CMakeLists.txt +3 -0
- data/vendor/libgit2/deps/regex/CMakeLists.txt +2 -0
- data/vendor/libgit2/deps/winhttp/CMakeLists.txt +26 -0
- data/vendor/libgit2/deps/zlib/CMakeLists.txt +4 -0
- data/vendor/libgit2/include/git2/config.h +29 -2
- data/vendor/libgit2/include/git2/describe.h +1 -1
- data/vendor/libgit2/include/git2/diff.h +59 -8
- data/vendor/libgit2/include/git2/graph.h +3 -0
- data/vendor/libgit2/include/git2/merge.h +6 -0
- data/vendor/libgit2/include/git2/message.h +43 -3
- data/vendor/libgit2/include/git2/notes.h +89 -0
- data/vendor/libgit2/include/git2/odb.h +8 -1
- data/vendor/libgit2/include/git2/patch.h +2 -2
- data/vendor/libgit2/include/git2/pathspec.h +35 -18
- data/vendor/libgit2/include/git2/refs.h +3 -0
- data/vendor/libgit2/include/git2/remote.h +34 -4
- data/vendor/libgit2/include/git2/repository.h +6 -6
- data/vendor/libgit2/include/git2/reset.h +4 -4
- data/vendor/libgit2/include/git2/status.h +4 -0
- data/vendor/libgit2/include/git2/sys/config.h +4 -1
- data/vendor/libgit2/include/git2/sys/odb_backend.h +2 -1
- data/vendor/libgit2/include/git2/tree.h +4 -3
- data/vendor/libgit2/include/git2/types.h +1 -0
- data/vendor/libgit2/include/git2/version.h +4 -4
- data/vendor/libgit2/include/git2/worktree.h +1 -1
- data/vendor/libgit2/src/CMakeLists.txt +463 -0
- data/vendor/libgit2/src/annotated_commit.c +1 -1
- data/vendor/libgit2/src/annotated_commit.h +2 -0
- data/vendor/libgit2/src/apply.c +2 -1
- data/vendor/libgit2/src/apply.h +2 -0
- data/vendor/libgit2/src/attr.c +24 -4
- data/vendor/libgit2/src/attr.h +2 -0
- data/vendor/libgit2/src/attr_file.c +9 -2
- data/vendor/libgit2/src/attr_file.h +2 -0
- data/vendor/libgit2/src/attrcache.c +9 -1
- data/vendor/libgit2/src/attrcache.h +2 -0
- data/vendor/libgit2/src/blame.c +1 -0
- data/vendor/libgit2/src/blame.h +2 -1
- data/vendor/libgit2/src/blame_git.c +1 -0
- data/vendor/libgit2/src/blame_git.h +2 -0
- data/vendor/libgit2/src/blob.c +2 -2
- data/vendor/libgit2/src/blob.h +2 -0
- data/vendor/libgit2/src/branch.c +8 -1
- data/vendor/libgit2/src/branch.h +2 -0
- data/vendor/libgit2/src/buf_text.c +7 -7
- data/vendor/libgit2/src/buf_text.h +3 -3
- data/vendor/libgit2/src/buffer.c +31 -1
- data/vendor/libgit2/src/buffer.h +3 -0
- data/vendor/libgit2/src/cache.c +2 -2
- data/vendor/libgit2/src/cache.h +2 -0
- data/vendor/libgit2/src/cc-compat.h +3 -3
- data/vendor/libgit2/src/checkout.c +30 -19
- data/vendor/libgit2/src/checkout.h +2 -0
- data/vendor/libgit2/src/cherrypick.c +1 -0
- data/vendor/libgit2/src/clone.c +2 -1
- data/vendor/libgit2/src/clone.h +4 -0
- data/vendor/libgit2/src/commit.c +2 -1
- data/vendor/libgit2/src/commit.h +2 -0
- data/vendor/libgit2/src/commit_list.c +1 -1
- data/vendor/libgit2/src/commit_list.h +2 -0
- data/vendor/libgit2/src/common.h +11 -5
- data/vendor/libgit2/src/config.c +12 -10
- data/vendor/libgit2/src/config.h +2 -0
- data/vendor/libgit2/src/config_cache.c +1 -0
- data/vendor/libgit2/src/config_file.c +287 -786
- data/vendor/libgit2/src/config_file.h +4 -3
- data/vendor/libgit2/src/config_parse.c +525 -0
- data/vendor/libgit2/src/config_parse.h +64 -0
- data/vendor/libgit2/src/crlf.c +2 -1
- data/vendor/libgit2/src/delta.c +28 -30
- data/vendor/libgit2/src/delta.h +1 -0
- data/vendor/libgit2/src/describe.c +3 -1
- data/vendor/libgit2/src/diff.c +148 -2
- data/vendor/libgit2/src/diff.h +3 -1
- data/vendor/libgit2/src/diff_driver.c +12 -9
- data/vendor/libgit2/src/diff_driver.h +4 -1
- data/vendor/libgit2/src/diff_file.c +7 -4
- data/vendor/libgit2/src/diff_file.h +1 -0
- data/vendor/libgit2/src/diff_generate.c +6 -3
- data/vendor/libgit2/src/diff_generate.h +6 -1
- data/vendor/libgit2/src/diff_parse.c +5 -4
- data/vendor/libgit2/src/diff_parse.h +2 -0
- data/vendor/libgit2/src/diff_print.c +2 -0
- data/vendor/libgit2/src/diff_stats.c +2 -0
- data/vendor/libgit2/src/diff_tform.c +2 -1
- data/vendor/libgit2/src/diff_tform.h +4 -1
- data/vendor/libgit2/src/diff_xdiff.c +5 -2
- data/vendor/libgit2/src/diff_xdiff.h +2 -0
- data/vendor/libgit2/src/errors.c +2 -0
- data/vendor/libgit2/src/features.h.in +36 -0
- data/vendor/libgit2/src/fetch.c +2 -2
- data/vendor/libgit2/src/fetch.h +4 -0
- data/vendor/libgit2/src/fetchhead.c +3 -3
- data/vendor/libgit2/src/fetchhead.h +3 -0
- data/vendor/libgit2/src/filebuf.c +2 -1
- data/vendor/libgit2/src/filebuf.h +2 -0
- data/vendor/libgit2/src/fileops.c +12 -1
- data/vendor/libgit2/src/fileops.h +7 -1
- data/vendor/libgit2/src/filter.c +2 -1
- data/vendor/libgit2/src/filter.h +1 -0
- data/vendor/libgit2/src/fnmatch.c +2 -2
- data/vendor/libgit2/src/fnmatch.h +3 -4
- data/vendor/libgit2/src/global.c +4 -3
- data/vendor/libgit2/src/global.h +1 -5
- data/vendor/libgit2/src/graph.c +2 -0
- data/vendor/libgit2/src/hash.c +0 -1
- data/vendor/libgit2/src/hash.h +3 -1
- data/vendor/libgit2/src/hash/hash_collisiondetect.h +3 -3
- data/vendor/libgit2/src/hash/hash_common_crypto.h +18 -5
- data/vendor/libgit2/src/hash/hash_generic.c +2 -2
- data/vendor/libgit2/src/hash/hash_generic.h +5 -3
- data/vendor/libgit2/src/hash/hash_openssl.h +3 -3
- data/vendor/libgit2/src/hash/hash_win32.c +57 -14
- data/vendor/libgit2/src/hash/hash_win32.h +4 -3
- data/vendor/libgit2/src/hashsig.c +3 -0
- data/vendor/libgit2/src/ident.c +2 -0
- data/vendor/libgit2/src/idxmap.h +2 -1
- data/vendor/libgit2/src/ignore.c +14 -2
- data/vendor/libgit2/src/ignore.h +2 -0
- data/vendor/libgit2/src/index.c +20 -40
- data/vendor/libgit2/src/index.h +2 -0
- data/vendor/libgit2/src/indexer.c +13 -5
- data/vendor/libgit2/src/indexer.h +5 -1
- data/vendor/libgit2/src/integer.h +1 -1
- data/vendor/libgit2/src/iterator.c +44 -3
- data/vendor/libgit2/src/iterator.h +3 -0
- data/vendor/libgit2/src/map.h +1 -1
- data/vendor/libgit2/src/merge.c +155 -33
- data/vendor/libgit2/src/merge.h +2 -0
- data/vendor/libgit2/src/merge_driver.c +2 -2
- data/vendor/libgit2/src/merge_driver.h +2 -0
- data/vendor/libgit2/src/merge_file.c +3 -0
- data/vendor/libgit2/src/message.h +3 -1
- data/vendor/libgit2/src/mwindow.c +1 -1
- data/vendor/libgit2/src/mwindow.h +2 -0
- data/vendor/libgit2/src/netops.c +75 -62
- data/vendor/libgit2/src/netops.h +2 -1
- data/vendor/libgit2/src/notes.c +164 -48
- data/vendor/libgit2/src/notes.h +1 -1
- data/vendor/libgit2/src/object.c +14 -3
- data/vendor/libgit2/src/object.h +4 -0
- data/vendor/libgit2/src/object_api.c +3 -2
- data/vendor/libgit2/src/odb.c +104 -38
- data/vendor/libgit2/src/odb.h +3 -1
- data/vendor/libgit2/src/odb_loose.c +414 -267
- data/vendor/libgit2/src/odb_mempack.c +1 -0
- data/vendor/libgit2/src/odb_pack.c +2 -1
- data/vendor/libgit2/src/offmap.h +1 -0
- data/vendor/libgit2/src/oid.c +2 -1
- data/vendor/libgit2/src/oid.h +3 -8
- data/vendor/libgit2/src/oidarray.c +2 -1
- data/vendor/libgit2/src/oidarray.h +1 -0
- data/vendor/libgit2/src/oidmap.h +1 -0
- data/vendor/libgit2/src/pack-objects.c +5 -1
- data/vendor/libgit2/src/pack-objects.h +1 -1
- data/vendor/libgit2/src/pack.c +2 -6
- data/vendor/libgit2/src/pack.h +2 -1
- data/vendor/libgit2/src/parse.c +121 -0
- data/vendor/libgit2/src/parse.h +61 -0
- data/vendor/libgit2/src/patch.c +9 -2
- data/vendor/libgit2/src/patch.h +2 -0
- data/vendor/libgit2/src/patch_generate.c +6 -5
- data/vendor/libgit2/src/patch_generate.h +1 -0
- data/vendor/libgit2/src/patch_parse.c +265 -276
- data/vendor/libgit2/src/patch_parse.h +6 -11
- data/vendor/libgit2/src/path.c +24 -181
- data/vendor/libgit2/src/path.h +14 -73
- data/vendor/libgit2/src/pathspec.c +2 -1
- data/vendor/libgit2/src/pathspec.h +2 -1
- data/vendor/libgit2/src/pool.c +8 -0
- data/vendor/libgit2/src/pool.h +1 -0
- data/vendor/libgit2/src/posix.c +2 -1
- data/vendor/libgit2/src/posix.h +1 -0
- data/vendor/libgit2/src/pqueue.c +1 -0
- data/vendor/libgit2/src/pqueue.h +2 -0
- data/vendor/libgit2/src/proxy.c +2 -1
- data/vendor/libgit2/src/proxy.h +3 -1
- data/vendor/libgit2/src/push.c +4 -171
- data/vendor/libgit2/src/push.h +2 -0
- data/vendor/libgit2/src/rebase.c +1 -0
- data/vendor/libgit2/src/refdb.c +2 -3
- data/vendor/libgit2/src/refdb.h +2 -0
- data/vendor/libgit2/src/refdb_fs.c +5 -3
- data/vendor/libgit2/src/refdb_fs.h +4 -0
- data/vendor/libgit2/src/reflog.c +1 -0
- data/vendor/libgit2/src/reflog.h +2 -1
- data/vendor/libgit2/src/refs.c +1 -0
- data/vendor/libgit2/src/refs.h +2 -1
- data/vendor/libgit2/src/refspec.c +2 -2
- data/vendor/libgit2/src/refspec.h +2 -0
- data/vendor/libgit2/src/remote.c +56 -10
- data/vendor/libgit2/src/remote.h +2 -0
- data/vendor/libgit2/src/repository.c +16 -14
- data/vendor/libgit2/src/repository.h +2 -0
- data/vendor/libgit2/src/reset.c +6 -5
- data/vendor/libgit2/src/revert.c +1 -0
- data/vendor/libgit2/src/revparse.c +3 -5
- data/vendor/libgit2/src/revwalk.c +2 -2
- data/vendor/libgit2/src/revwalk.h +2 -0
- data/vendor/libgit2/src/settings.c +6 -8
- data/vendor/libgit2/src/sha1_lookup.c +2 -216
- data/vendor/libgit2/src/sha1_lookup.h +2 -6
- data/vendor/libgit2/src/signature.c +8 -3
- data/vendor/libgit2/src/signature.h +2 -0
- data/vendor/libgit2/src/sortedcache.c +7 -0
- data/vendor/libgit2/src/sortedcache.h +2 -0
- data/vendor/libgit2/src/stash.c +1 -0
- data/vendor/libgit2/src/status.c +14 -9
- data/vendor/libgit2/src/status.h +2 -0
- data/vendor/libgit2/src/{curl_stream.c → streams/curl.c} +2 -0
- data/vendor/libgit2/src/{curl_stream.h → streams/curl.h} +4 -2
- data/vendor/libgit2/src/{openssl_stream.c → streams/openssl.c} +47 -18
- data/vendor/libgit2/src/{openssl_stream.h → streams/openssl.h} +6 -2
- data/vendor/libgit2/src/{socket_stream.c → streams/socket.c} +2 -2
- data/vendor/libgit2/src/{socket_stream.h → streams/socket.h} +4 -2
- data/vendor/libgit2/src/{stransport_stream.c → streams/stransport.c} +4 -2
- data/vendor/libgit2/src/{stransport_stream.h → streams/stransport.h} +4 -2
- data/vendor/libgit2/src/{tls_stream.c → streams/tls.c} +4 -3
- data/vendor/libgit2/src/{tls_stream.h → streams/tls.h} +4 -2
- data/vendor/libgit2/src/submodule.c +28 -80
- data/vendor/libgit2/src/submodule.h +2 -13
- data/vendor/libgit2/src/sysdir.c +75 -8
- data/vendor/libgit2/src/sysdir.h +2 -1
- data/vendor/libgit2/src/tag.c +2 -2
- data/vendor/libgit2/src/tag.h +2 -0
- data/vendor/libgit2/src/thread-utils.c +1 -0
- data/vendor/libgit2/src/thread-utils.h +1 -1
- data/vendor/libgit2/src/trace.c +2 -2
- data/vendor/libgit2/src/trace.h +2 -0
- data/vendor/libgit2/src/trailer.c +416 -0
- data/vendor/libgit2/src/transaction.c +2 -1
- data/vendor/libgit2/src/transport.c +2 -0
- data/vendor/libgit2/src/transports/auth.c +2 -1
- data/vendor/libgit2/src/transports/auth.h +4 -3
- data/vendor/libgit2/src/transports/auth_negotiate.c +2 -1
- data/vendor/libgit2/src/transports/auth_negotiate.h +3 -3
- data/vendor/libgit2/src/transports/cred.c +2 -0
- data/vendor/libgit2/src/transports/cred.h +4 -2
- data/vendor/libgit2/src/transports/cred_helpers.c +1 -0
- data/vendor/libgit2/src/transports/git.c +3 -1
- data/vendor/libgit2/src/transports/http.c +10 -14
- data/vendor/libgit2/src/transports/http.h +23 -0
- data/vendor/libgit2/src/transports/local.c +23 -5
- data/vendor/libgit2/src/transports/smart.c +3 -1
- data/vendor/libgit2/src/transports/smart.h +23 -16
- data/vendor/libgit2/src/transports/smart_pkt.c +114 -130
- data/vendor/libgit2/src/transports/smart_protocol.c +26 -22
- data/vendor/libgit2/src/transports/ssh.c +12 -7
- data/vendor/libgit2/src/transports/ssh.h +4 -2
- data/vendor/libgit2/src/transports/winhttp.c +19 -21
- data/vendor/libgit2/src/tree-cache.c +1 -0
- data/vendor/libgit2/src/tree-cache.h +1 -0
- data/vendor/libgit2/src/tree.c +20 -14
- data/vendor/libgit2/src/tree.h +2 -0
- data/vendor/libgit2/src/tsort.c +0 -1
- data/vendor/libgit2/src/unix/map.c +4 -1
- data/vendor/libgit2/src/unix/posix.h +8 -4
- data/vendor/libgit2/src/unix/pthread.h +1 -1
- data/vendor/libgit2/src/unix/realpath.c +4 -1
- data/vendor/libgit2/src/util.c +6 -5
- data/vendor/libgit2/src/util.h +39 -111
- data/vendor/libgit2/src/varint.c +0 -1
- data/vendor/libgit2/src/varint.h +2 -0
- data/vendor/libgit2/src/vector.c +1 -1
- data/vendor/libgit2/src/win32/dir.c +3 -0
- data/vendor/libgit2/src/win32/dir.h +4 -3
- data/vendor/libgit2/src/win32/error.c +1 -1
- data/vendor/libgit2/src/win32/error.h +4 -2
- data/vendor/libgit2/src/win32/findfile.c +2 -1
- data/vendor/libgit2/src/win32/findfile.h +4 -2
- data/vendor/libgit2/src/win32/map.c +2 -0
- data/vendor/libgit2/src/win32/mingw-compat.h +3 -3
- data/vendor/libgit2/src/win32/msvc-compat.h +3 -3
- data/vendor/libgit2/src/win32/path_w32.c +7 -12
- data/vendor/libgit2/src/win32/path_w32.h +3 -2
- data/vendor/libgit2/src/win32/posix.h +2 -2
- data/vendor/libgit2/src/win32/posix_w32.c +11 -5
- data/vendor/libgit2/src/win32/precompiled.h +2 -1
- data/vendor/libgit2/src/win32/reparse.h +2 -2
- data/vendor/libgit2/src/win32/thread.c +1 -0
- data/vendor/libgit2/src/win32/thread.h +2 -2
- data/vendor/libgit2/src/win32/utf-conv.c +0 -1
- data/vendor/libgit2/src/win32/utf-conv.h +4 -3
- data/vendor/libgit2/src/win32/w32_buffer.c +1 -1
- data/vendor/libgit2/src/win32/w32_buffer.h +4 -2
- data/vendor/libgit2/src/win32/w32_crtdbg_stacktrace.c +2 -1
- data/vendor/libgit2/src/win32/w32_crtdbg_stacktrace.h +85 -2
- data/vendor/libgit2/src/win32/w32_stack.c +2 -1
- data/vendor/libgit2/src/win32/w32_stack.h +5 -3
- data/vendor/libgit2/src/win32/w32_util.h +4 -2
- data/vendor/libgit2/src/win32/win32-compat.h +3 -3
- data/vendor/libgit2/src/worktree.c +4 -5
- data/vendor/libgit2/src/worktree.h +2 -0
- data/vendor/libgit2/src/xdiff/xdiff.h +22 -13
- data/vendor/libgit2/src/xdiff/xdiffi.c +523 -81
- data/vendor/libgit2/src/xdiff/xdiffi.h +2 -2
- data/vendor/libgit2/src/xdiff/xemit.c +63 -39
- data/vendor/libgit2/src/xdiff/xemit.h +2 -2
- data/vendor/libgit2/src/xdiff/xhistogram.c +0 -1
- data/vendor/libgit2/src/xdiff/xinclude.h +3 -2
- data/vendor/libgit2/src/xdiff/xmacros.h +2 -2
- data/vendor/libgit2/src/xdiff/xmerge.c +80 -20
- data/vendor/libgit2/src/xdiff/xpatience.c +41 -9
- data/vendor/libgit2/src/xdiff/xprepare.c +2 -2
- data/vendor/libgit2/src/xdiff/xprepare.h +2 -2
- data/vendor/libgit2/src/xdiff/xtypes.h +2 -2
- data/vendor/libgit2/src/xdiff/xutils.c +47 -27
- data/vendor/libgit2/src/xdiff/xutils.h +2 -5
- data/vendor/libgit2/src/zstream.c +65 -45
- data/vendor/libgit2/src/zstream.h +9 -2
- metadata +27 -13
- data/vendor/libgit2/include/git2/sys/remote.h +0 -16
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e29dd42f856fd7e0e631d3c3235ebf227fc47490338078fa91e0e4769b16cc64
|
|
4
|
+
data.tar.gz: 3f9c8ea45f76799f7eb9096e2de3d551f481f27f5df54cfc21e987a88f9eb019
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c4e6fefc154bc8e6095cab238a698eb3ccae43e8d07f67192f07dbbe5fbee2f766aa024cec42783c16da914a80abd6c975f928d378a06f378b98a73f2b1abe11
|
|
7
|
+
data.tar.gz: e6a565322fd8bb4910168a34791a3793a336012193d5d193a89552d2b806ef946f421e289192a22f3314a1524e2593d80789bfa3d0ec65440b53a1e77afa7192
|
data/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Rugged
|
|
1
|
+
# Rugged [](https://travis-ci.org/libgit2/rugged)
|
|
2
2
|
**libgit2 bindings in Ruby**
|
|
3
3
|
|
|
4
4
|
Rugged is a library for accessing [libgit2](https://github.com/libgit2/libgit2) in Ruby. It gives you the speed and
|
|
@@ -571,7 +571,7 @@ Rugged.raw_to_hex("\277\336Y\315\320\337\254\035\211(\024\366j\225d\032\275\212\
|
|
|
571
571
|
|
|
572
572
|
---
|
|
573
573
|
|
|
574
|
-
###
|
|
574
|
+
### Alternative backends
|
|
575
575
|
|
|
576
576
|
You can store bare repositories in alternative backends instead of storing on disk. (see
|
|
577
577
|
`redbadger/rugged-redis` for an example of how a rugged backend works).
|
data/ext/rugged/rugged_blame.c
CHANGED
|
@@ -188,6 +188,11 @@ static VALUE rb_git_blame_count(VALUE self)
|
|
|
188
188
|
return UINT2NUM(git_blame_get_hunk_count(blame));
|
|
189
189
|
}
|
|
190
190
|
|
|
191
|
+
static VALUE rugged_blame_enum_size(VALUE rb_blame, VALUE rb_args, VALUE rb_eobj)
|
|
192
|
+
{
|
|
193
|
+
return rb_git_blame_count(rb_blame);
|
|
194
|
+
}
|
|
195
|
+
|
|
191
196
|
/*
|
|
192
197
|
* call-seq:
|
|
193
198
|
* blame[index] -> hunk
|
|
@@ -242,9 +247,7 @@ static VALUE rb_git_blame_each(VALUE self)
|
|
|
242
247
|
git_blame *blame;
|
|
243
248
|
uint32_t i, blame_count;
|
|
244
249
|
|
|
245
|
-
|
|
246
|
-
return rb_funcall(self, rb_intern("to_enum"), 1, CSTR2SYM("each"), self);
|
|
247
|
-
}
|
|
250
|
+
RETURN_SIZED_ENUMERATOR(self, 0, 0, rugged_blame_enum_size);
|
|
248
251
|
|
|
249
252
|
Data_Get_Struct(self, git_blame, blame);
|
|
250
253
|
|
|
@@ -178,19 +178,16 @@ static VALUE rb_git_branch_collection_aref(VALUE self, VALUE rb_name) {
|
|
|
178
178
|
|
|
179
179
|
static VALUE each_branch(int argc, VALUE *argv, VALUE self, int branch_names_only)
|
|
180
180
|
{
|
|
181
|
-
VALUE rb_repo
|
|
181
|
+
VALUE rb_repo, rb_filter;
|
|
182
182
|
git_repository *repo;
|
|
183
183
|
git_branch_iterator *iter;
|
|
184
184
|
int error, exception = 0;
|
|
185
185
|
git_branch_t filter = (GIT_BRANCH_LOCAL | GIT_BRANCH_REMOTE), branch_type;
|
|
186
186
|
|
|
187
|
+
RETURN_ENUMERATOR(self, argc, argv);
|
|
187
188
|
rb_scan_args(argc, argv, "01", &rb_filter);
|
|
188
189
|
|
|
189
|
-
|
|
190
|
-
VALUE symbol = branch_names_only ? CSTR2SYM("each_name") : CSTR2SYM("each");
|
|
191
|
-
return rb_funcall(self, rb_intern("to_enum"), 2, symbol, rb_filter);
|
|
192
|
-
}
|
|
193
|
-
|
|
190
|
+
rb_repo = rugged_owner(self);
|
|
194
191
|
rugged_check_repo(rb_repo);
|
|
195
192
|
|
|
196
193
|
if (!NIL_P(rb_filter))
|
data/ext/rugged/rugged_commit.c
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
#include "rugged.h"
|
|
9
9
|
#include "git2/commit.h"
|
|
10
|
+
#include "git2/message.h"
|
|
10
11
|
|
|
11
12
|
extern VALUE rb_mRugged;
|
|
12
13
|
extern VALUE rb_cRuggedObject;
|
|
@@ -44,6 +45,60 @@ static VALUE rb_git_commit_message_GET(VALUE self)
|
|
|
44
45
|
return rb_enc_str_new(message, strlen(message), encoding);
|
|
45
46
|
}
|
|
46
47
|
|
|
48
|
+
/*
|
|
49
|
+
* call-seq:
|
|
50
|
+
* commit.trailers -> [["Trailer-name", "trailer value"], ...]
|
|
51
|
+
*
|
|
52
|
+
* Return an array of arrays, each of which is a key/value pair representing a
|
|
53
|
+
* commit message trailer. Both the keys and values will be strings. An array
|
|
54
|
+
* is used to preserve the order the trailers were found.
|
|
55
|
+
*
|
|
56
|
+
* In Ruby 1.9+, the returned strings will be encoded with the encoding
|
|
57
|
+
* specified in the +Encoding+ header of the commit, if available.
|
|
58
|
+
*
|
|
59
|
+
*/
|
|
60
|
+
static VALUE rb_git_commit_trailers_GET(VALUE self)
|
|
61
|
+
{
|
|
62
|
+
git_commit *commit;
|
|
63
|
+
const char *message;
|
|
64
|
+
rb_encoding *encoding = rb_utf8_encoding();
|
|
65
|
+
const char *encoding_name;
|
|
66
|
+
git_message_trailer_array arr;
|
|
67
|
+
VALUE trailers = rb_ary_new();
|
|
68
|
+
int error;
|
|
69
|
+
size_t i;
|
|
70
|
+
|
|
71
|
+
Data_Get_Struct(self, git_commit, commit);
|
|
72
|
+
|
|
73
|
+
encoding_name = git_commit_message_encoding(commit);
|
|
74
|
+
if (encoding_name != NULL)
|
|
75
|
+
encoding = rb_enc_find(encoding_name);
|
|
76
|
+
|
|
77
|
+
message = git_commit_message(commit);
|
|
78
|
+
|
|
79
|
+
error = git_message_trailers(&arr, message);
|
|
80
|
+
rugged_exception_check(error);
|
|
81
|
+
|
|
82
|
+
for(i = 0; i < arr.count; i++) {
|
|
83
|
+
VALUE pair = rb_ary_new();
|
|
84
|
+
const char *key = arr.trailers[i].key;
|
|
85
|
+
const char *value = arr.trailers[i].value;
|
|
86
|
+
|
|
87
|
+
// trailer key
|
|
88
|
+
rb_ary_push(pair, rb_enc_str_new(key, strlen(key), encoding));
|
|
89
|
+
|
|
90
|
+
// trailer value
|
|
91
|
+
rb_ary_push(pair, rb_enc_str_new(value, strlen(value), encoding));
|
|
92
|
+
|
|
93
|
+
// add it to the list
|
|
94
|
+
rb_ary_push(trailers, pair);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
git_message_trailer_array_free(&arr);
|
|
98
|
+
|
|
99
|
+
return trailers;
|
|
100
|
+
}
|
|
101
|
+
|
|
47
102
|
/*
|
|
48
103
|
* call-seq:
|
|
49
104
|
* commit.summary -> summary
|
|
@@ -819,6 +874,7 @@ void Init_rugged_commit(void)
|
|
|
819
874
|
rb_define_singleton_method(rb_cRuggedCommit, "extract_signature", rb_git_commit_extract_signature, -1);
|
|
820
875
|
|
|
821
876
|
rb_define_method(rb_cRuggedCommit, "message", rb_git_commit_message_GET, 0);
|
|
877
|
+
rb_define_method(rb_cRuggedCommit, "trailers", rb_git_commit_trailers_GET, 0);
|
|
822
878
|
rb_define_method(rb_cRuggedCommit, "summary", rb_git_commit_summary_GET, 0);
|
|
823
879
|
rb_define_method(rb_cRuggedCommit, "epoch_time", rb_git_commit_epoch_time_GET, 0);
|
|
824
880
|
rb_define_method(rb_cRuggedCommit, "committer", rb_git_commit_committer_GET, 0);
|
data/ext/rugged/rugged_config.c
CHANGED
|
@@ -43,7 +43,7 @@ static VALUE rb_git_config_new(VALUE klass, VALUE rb_path)
|
|
|
43
43
|
for (i = 0; i < RARRAY_LEN(rb_path) && !error; ++i) {
|
|
44
44
|
VALUE f = rb_ary_entry(rb_path, i);
|
|
45
45
|
Check_Type(f, T_STRING);
|
|
46
|
-
error = git_config_add_file_ondisk(config, StringValueCStr(f), i + 1, 1);
|
|
46
|
+
error = git_config_add_file_ondisk(config, StringValueCStr(f), i + 1, NULL, 1);
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
if (error) {
|
|
@@ -198,7 +198,7 @@ static int cb_config__to_hash(const git_config_entry *entry, void *opaque)
|
|
|
198
198
|
/*
|
|
199
199
|
* call-seq:
|
|
200
200
|
* cfg.each_key { |key| block }
|
|
201
|
-
* cfg.each_key ->
|
|
201
|
+
* cfg.each_key -> enumerator
|
|
202
202
|
*
|
|
203
203
|
* Call the given block once for each key in the config file. If no block
|
|
204
204
|
* is given, an enumerator is returned.
|
|
@@ -212,11 +212,9 @@ static VALUE rb_git_config_each_key(VALUE self)
|
|
|
212
212
|
git_config *config;
|
|
213
213
|
int error;
|
|
214
214
|
|
|
215
|
+
RETURN_ENUMERATOR(self, 0, 0);
|
|
215
216
|
Data_Get_Struct(self, git_config, config);
|
|
216
217
|
|
|
217
|
-
if (!rb_block_given_p())
|
|
218
|
-
return rb_funcall(self, rb_intern("to_enum"), 1, CSTR2SYM("each_key"));
|
|
219
|
-
|
|
220
218
|
error = git_config_foreach(config, &cb_config__each_key, (void *)rb_block_proc());
|
|
221
219
|
rugged_exception_check(error);
|
|
222
220
|
return Qnil;
|
|
@@ -240,12 +238,10 @@ static VALUE rb_git_config_each_pair(VALUE self)
|
|
|
240
238
|
{
|
|
241
239
|
git_config *config;
|
|
242
240
|
int error;
|
|
243
|
-
|
|
241
|
+
|
|
242
|
+
RETURN_ENUMERATOR(self, 0, 0);
|
|
244
243
|
Data_Get_Struct(self, git_config, config);
|
|
245
244
|
|
|
246
|
-
if (!rb_block_given_p())
|
|
247
|
-
return rb_funcall(self, rb_intern("to_enum"), 1, CSTR2SYM("each_pair"));
|
|
248
|
-
|
|
249
245
|
error = git_config_foreach(config, &cb_config__each_pair, (void *)rb_block_proc());
|
|
250
246
|
rugged_exception_check(error);
|
|
251
247
|
return Qnil;
|
|
@@ -358,6 +354,44 @@ static VALUE rb_git_config_transaction(VALUE self)
|
|
|
358
354
|
return rb_result;
|
|
359
355
|
}
|
|
360
356
|
|
|
357
|
+
static int each_config_value(const git_config_entry * entry, void *ctx)
|
|
358
|
+
{
|
|
359
|
+
VALUE list = (VALUE)ctx;
|
|
360
|
+
rb_ary_push(list, rb_str_new_utf8(entry->value));
|
|
361
|
+
return 0;
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
/*
|
|
365
|
+
* call-seq:
|
|
366
|
+
* cfg.get_all(key) -> [value1, value2, ...]
|
|
367
|
+
*
|
|
368
|
+
* Get a list of values for the given config +key+. Values are always
|
|
369
|
+
* returned as an +Array+ of +String+, or +nil+ if the given key doesn't exist
|
|
370
|
+
* in the Config file.
|
|
371
|
+
*
|
|
372
|
+
* cfg['apply.whitespace'] #=> ['fix']
|
|
373
|
+
* cfg['diff.renames'] #=> ['true']
|
|
374
|
+
* cfg['remote.origin.fetch'] #=> ["+refs/heads/*:refs/remotes/origin/*", "+refs/heads/*:refs/lolol/origin/*"]
|
|
375
|
+
*/
|
|
376
|
+
static VALUE rb_git_config_get_all(VALUE self, VALUE key)
|
|
377
|
+
{
|
|
378
|
+
git_config *config;
|
|
379
|
+
VALUE list;
|
|
380
|
+
int error;
|
|
381
|
+
|
|
382
|
+
Data_Get_Struct(self, git_config, config);
|
|
383
|
+
|
|
384
|
+
list = rb_ary_new();
|
|
385
|
+
error = git_config_get_multivar_foreach(
|
|
386
|
+
config, StringValueCStr(key), NULL, each_config_value, (void *)list);
|
|
387
|
+
|
|
388
|
+
if (error == GIT_ENOTFOUND)
|
|
389
|
+
return Qnil;
|
|
390
|
+
|
|
391
|
+
rugged_exception_check(error);
|
|
392
|
+
return list;
|
|
393
|
+
}
|
|
394
|
+
|
|
361
395
|
void Init_rugged_config(void)
|
|
362
396
|
{
|
|
363
397
|
/*
|
|
@@ -376,6 +410,7 @@ void Init_rugged_config(void)
|
|
|
376
410
|
|
|
377
411
|
rb_define_method(rb_cRuggedConfig, "get", rb_git_config_get, 1);
|
|
378
412
|
rb_define_method(rb_cRuggedConfig, "[]", rb_git_config_get, 1);
|
|
413
|
+
rb_define_method(rb_cRuggedConfig, "get_all", rb_git_config_get_all, 1);
|
|
379
414
|
|
|
380
415
|
rb_define_method(rb_cRuggedConfig, "each_key", rb_git_config_each_key, 0);
|
|
381
416
|
rb_define_method(rb_cRuggedConfig, "each_pair", rb_git_config_each_pair, 0);
|
data/ext/rugged/rugged_diff.c
CHANGED
|
@@ -447,10 +447,7 @@ static VALUE rb_git_diff_each_patch(VALUE self)
|
|
|
447
447
|
int error = 0;
|
|
448
448
|
size_t d, delta_count;
|
|
449
449
|
|
|
450
|
-
|
|
451
|
-
return rb_funcall(self, rb_intern("to_enum"), 1, CSTR2SYM("each_patch"), self);
|
|
452
|
-
}
|
|
453
|
-
|
|
450
|
+
RETURN_ENUMERATOR(self, 0, 0);
|
|
454
451
|
Data_Get_Struct(self, git_diff, diff);
|
|
455
452
|
|
|
456
453
|
delta_count = git_diff_num_deltas(diff);
|
|
@@ -481,13 +478,9 @@ static VALUE rb_git_diff_each_delta(VALUE self)
|
|
|
481
478
|
{
|
|
482
479
|
git_diff *diff;
|
|
483
480
|
const git_diff_delta *delta;
|
|
484
|
-
int error = 0;
|
|
485
481
|
size_t d, delta_count;
|
|
486
482
|
|
|
487
|
-
|
|
488
|
-
return rb_funcall(self, rb_intern("to_enum"), 1, CSTR2SYM("each_delta"), self);
|
|
489
|
-
}
|
|
490
|
-
|
|
483
|
+
RETURN_ENUMERATOR(self, 0, 0);
|
|
491
484
|
Data_Get_Struct(self, git_diff, diff);
|
|
492
485
|
|
|
493
486
|
delta_count = git_diff_num_deltas(diff);
|
|
@@ -496,8 +489,6 @@ static VALUE rb_git_diff_each_delta(VALUE self)
|
|
|
496
489
|
rb_yield(rugged_diff_delta_new(self, delta));
|
|
497
490
|
}
|
|
498
491
|
|
|
499
|
-
rugged_exception_check(error);
|
|
500
|
-
|
|
501
492
|
return self;
|
|
502
493
|
}
|
|
503
494
|
|
|
@@ -524,6 +515,7 @@ static VALUE rb_git_diff_each_line(int argc, VALUE *argv, VALUE self)
|
|
|
524
515
|
git_diff_format_t format;
|
|
525
516
|
int exception = 0, error;
|
|
526
517
|
|
|
518
|
+
RETURN_ENUMERATOR(self, argc, argv);
|
|
527
519
|
Data_Get_Struct(self, git_diff, diff);
|
|
528
520
|
|
|
529
521
|
if (rb_scan_args(argc, argv, "01", &rb_format) == 1) {
|
|
@@ -532,9 +524,6 @@ static VALUE rb_git_diff_each_line(int argc, VALUE *argv, VALUE self)
|
|
|
532
524
|
rb_format = CSTR2SYM("patch");
|
|
533
525
|
}
|
|
534
526
|
|
|
535
|
-
if (!rb_block_given_p())
|
|
536
|
-
return rb_funcall(self, rb_intern("to_enum"), 2, CSTR2SYM("each_line"), rb_format);
|
|
537
|
-
|
|
538
527
|
if (SYM2ID(rb_format) == rb_intern("patch")) {
|
|
539
528
|
format = GIT_DIFF_FORMAT_PATCH;
|
|
540
529
|
} else if (SYM2ID(rb_format) == rb_intern("patch_header")) {
|
|
@@ -42,9 +42,7 @@ static VALUE rb_git_diff_hunk_each_line(VALUE self)
|
|
|
42
42
|
git_patch *patch;
|
|
43
43
|
int error = 0, l, lines_count, hunk_idx;
|
|
44
44
|
|
|
45
|
-
|
|
46
|
-
return rb_funcall(self, rb_intern("to_enum"), 1, CSTR2SYM("each_line"), self);
|
|
47
|
-
}
|
|
45
|
+
RETURN_ENUMERATOR(self, 0, 0);
|
|
48
46
|
|
|
49
47
|
Data_Get_Struct(rugged_owner(self), git_patch, patch);
|
|
50
48
|
|
data/ext/rugged/rugged_index.c
CHANGED
|
@@ -190,11 +190,9 @@ static VALUE rb_git_index_each(VALUE self)
|
|
|
190
190
|
git_index *index;
|
|
191
191
|
unsigned int i, count;
|
|
192
192
|
|
|
193
|
+
RETURN_ENUMERATOR(self, 0, 0);
|
|
193
194
|
Data_Get_Struct(self, git_index, index);
|
|
194
195
|
|
|
195
|
-
if (!rb_block_given_p())
|
|
196
|
-
return rb_funcall(self, rb_intern("to_enum"), 0);
|
|
197
|
-
|
|
198
196
|
count = (unsigned int)git_index_entrycount(index);
|
|
199
197
|
for (i = 0; i < count; ++i) {
|
|
200
198
|
const git_index_entry *entry = git_index_get_byindex(index, i);
|
|
@@ -607,8 +605,6 @@ static void rb_git_indexentry_toC(git_index_entry *entry, VALUE rb_entry)
|
|
|
607
605
|
entry->flags &= ~GIT_IDXENTRY_VALID;
|
|
608
606
|
if (rugged_parse_bool(val))
|
|
609
607
|
entry->flags |= GIT_IDXENTRY_VALID;
|
|
610
|
-
} else {
|
|
611
|
-
entry->flags |= GIT_IDXENTRY_VALID;
|
|
612
608
|
}
|
|
613
609
|
}
|
|
614
610
|
|
data/ext/rugged/rugged_note.c
CHANGED
|
@@ -297,12 +297,9 @@ static VALUE rb_git_note_each(int argc, VALUE *argv, VALUE self)
|
|
|
297
297
|
struct rugged_cb_payload payload = { self, 0 };
|
|
298
298
|
VALUE rb_notes_ref;
|
|
299
299
|
|
|
300
|
+
RETURN_ENUMERATOR(self, argc, argv);
|
|
300
301
|
rb_scan_args(argc, argv, "01", &rb_notes_ref);
|
|
301
302
|
|
|
302
|
-
if (!rb_block_given_p()) {
|
|
303
|
-
return rb_funcall(self, rb_intern("to_enum"), 3, CSTR2SYM("each_note"), self, rb_notes_ref);
|
|
304
|
-
}
|
|
305
|
-
|
|
306
303
|
if (!NIL_P(rb_notes_ref)) {
|
|
307
304
|
Check_Type(rb_notes_ref, T_STRING);
|
|
308
305
|
notes_ref = StringValueCStr(rb_notes_ref);
|
data/ext/rugged/rugged_patch.c
CHANGED
|
@@ -93,10 +93,7 @@ static VALUE rb_git_diff_patch_each_hunk(VALUE self)
|
|
|
93
93
|
int error = 0;
|
|
94
94
|
size_t hunks_count, h;
|
|
95
95
|
|
|
96
|
-
|
|
97
|
-
return rb_funcall(self, rb_intern("to_enum"), 1, CSTR2SYM("each_hunk"), self);
|
|
98
|
-
}
|
|
99
|
-
|
|
96
|
+
RETURN_ENUMERATOR(self, 0, 0);
|
|
100
97
|
Data_Get_Struct(self, git_patch, patch);
|
|
101
98
|
|
|
102
99
|
hunks_count = git_patch_num_hunks(patch);
|
|
@@ -114,15 +114,9 @@ static VALUE rb_git_reference_collection__each(int argc, VALUE *argv, VALUE self
|
|
|
114
114
|
git_reference_iterator *iter;
|
|
115
115
|
int error, exception = 0;
|
|
116
116
|
|
|
117
|
+
RETURN_ENUMERATOR(self, argc, argv);
|
|
117
118
|
rb_scan_args(argc, argv, "01", &rb_glob);
|
|
118
119
|
|
|
119
|
-
if (!rb_block_given_p()) {
|
|
120
|
-
return rb_funcall(self,
|
|
121
|
-
rb_intern("to_enum"), 2,
|
|
122
|
-
only_names ? CSTR2SYM("each_name") : CSTR2SYM("each"),
|
|
123
|
-
rb_glob);
|
|
124
|
-
}
|
|
125
|
-
|
|
126
120
|
rugged_check_repo(rb_repo);
|
|
127
121
|
|
|
128
122
|
Data_Get_Struct(rb_repo, git_repository, repo);
|
data/ext/rugged/rugged_remote.c
CHANGED
|
@@ -304,13 +304,10 @@ static VALUE rb_git_remote_ls(int argc, VALUE *argv, VALUE self)
|
|
|
304
304
|
int error;
|
|
305
305
|
size_t heads_len, i;
|
|
306
306
|
|
|
307
|
+
RETURN_ENUMERATOR(self, argc, argv);
|
|
307
308
|
Data_Get_Struct(self, git_remote, remote);
|
|
308
|
-
|
|
309
309
|
rb_scan_args(argc, argv, ":", &rb_options);
|
|
310
310
|
|
|
311
|
-
if (!rb_block_given_p())
|
|
312
|
-
return rb_funcall(self, rb_intern("to_enum"), 2, CSTR2SYM("ls"), rb_options);
|
|
313
|
-
|
|
314
311
|
rugged_remote_init_callbacks_and_payload_from_options(rb_options, &callbacks, &payload);
|
|
315
312
|
init_custom_headers(rb_options, &custom_headers);
|
|
316
313
|
|
|
@@ -324,7 +321,7 @@ static VALUE rb_git_remote_ls(int argc, VALUE *argv, VALUE self)
|
|
|
324
321
|
cleanup:
|
|
325
322
|
|
|
326
323
|
git_remote_disconnect(remote);
|
|
327
|
-
|
|
324
|
+
xfree(custom_headers.strings);
|
|
328
325
|
|
|
329
326
|
if (payload.exception)
|
|
330
327
|
rb_jump_tag(payload.exception);
|
|
@@ -517,7 +514,7 @@ static VALUE rb_git_remote_check_connection(int argc, VALUE *argv, VALUE self)
|
|
|
517
514
|
error = git_remote_connect(remote, direction, &callbacks, NULL, &custom_headers);
|
|
518
515
|
git_remote_disconnect(remote);
|
|
519
516
|
|
|
520
|
-
|
|
517
|
+
xfree(custom_headers.strings);
|
|
521
518
|
|
|
522
519
|
if (payload.exception)
|
|
523
520
|
rb_jump_tag(payload.exception);
|
|
@@ -617,7 +614,7 @@ static VALUE rb_git_remote_fetch(int argc, VALUE *argv, VALUE self)
|
|
|
617
614
|
error = git_remote_fetch(remote, &refspecs, &opts, log_message);
|
|
618
615
|
|
|
619
616
|
xfree(refspecs.strings);
|
|
620
|
-
|
|
617
|
+
xfree(opts.custom_headers.strings);
|
|
621
618
|
|
|
622
619
|
if (payload.exception)
|
|
623
620
|
rb_jump_tag(payload.exception);
|
|
@@ -692,7 +689,7 @@ static VALUE rb_git_remote_push(int argc, VALUE *argv, VALUE self)
|
|
|
692
689
|
error = git_remote_push(remote, &refspecs, &opts);
|
|
693
690
|
|
|
694
691
|
xfree(refspecs.strings);
|
|
695
|
-
|
|
692
|
+
xfree(opts.custom_headers.strings);
|
|
696
693
|
|
|
697
694
|
if (payload.exception)
|
|
698
695
|
rb_jump_tag(payload.exception);
|
|
@@ -139,12 +139,7 @@ static VALUE rb_git_remote_collection__each(VALUE self, int only_names)
|
|
|
139
139
|
|
|
140
140
|
VALUE rb_repo;
|
|
141
141
|
|
|
142
|
-
|
|
143
|
-
if (only_names)
|
|
144
|
-
return rb_funcall(self, rb_intern("to_enum"), 1, CSTR2SYM("each_name"));
|
|
145
|
-
else
|
|
146
|
-
return rb_funcall(self, rb_intern("to_enum"), 1, CSTR2SYM("each"));
|
|
147
|
-
}
|
|
142
|
+
RETURN_ENUMERATOR(self, 0, 0);
|
|
148
143
|
|
|
149
144
|
rb_repo = rugged_owner(self);
|
|
150
145
|
rugged_check_repo(rb_repo);
|
data/ext/rugged/rugged_repo.c
CHANGED
|
@@ -1511,58 +1511,26 @@ static int rugged__status_cb(const char *path, unsigned int flags, void *payload
|
|
|
1511
1511
|
return GIT_OK;
|
|
1512
1512
|
}
|
|
1513
1513
|
|
|
1514
|
-
|
|
1515
|
-
* call-seq:
|
|
1516
|
-
* repo.status { |file, status_data| block }
|
|
1517
|
-
* repo.status(path) -> status_data
|
|
1518
|
-
*
|
|
1519
|
-
* Returns the status for one or more files in the working directory
|
|
1520
|
-
* of the repository. This is equivalent to the +git status+ command.
|
|
1521
|
-
*
|
|
1522
|
-
* The returned +status_data+ is always an array containing one or more
|
|
1523
|
-
* status flags as Ruby symbols. Possible flags are:
|
|
1524
|
-
*
|
|
1525
|
-
* - +:index_new+: the file is new in the index
|
|
1526
|
-
* - +:index_modified+: the file has been modified in the index
|
|
1527
|
-
* - +:index_deleted+: the file has been deleted from the index
|
|
1528
|
-
* - +:worktree_new+: the file is new in the working directory
|
|
1529
|
-
* - +:worktree_modified+: the file has been modified in the working directory
|
|
1530
|
-
* - +:worktree_deleted+: the file has been deleted from the working directory
|
|
1531
|
-
*
|
|
1532
|
-
* If a +block+ is given, status information will be gathered for every
|
|
1533
|
-
* single file on the working dir. The +block+ will be called with the
|
|
1534
|
-
* status data for each file.
|
|
1535
|
-
*
|
|
1536
|
-
* repo.status { |file, status_data| puts "#{file} has status: #{status_data.inspect}" }
|
|
1537
|
-
*
|
|
1538
|
-
* results in, for example:
|
|
1539
|
-
*
|
|
1540
|
-
* src/diff.c has status: [:index_new, :worktree_new]
|
|
1541
|
-
* README has status: [:worktree_modified]
|
|
1542
|
-
*
|
|
1543
|
-
* If a +path+ is given instead, the function will return the +status_data+ for
|
|
1544
|
-
* the file pointed to by path, or raise an exception if the path doesn't exist.
|
|
1545
|
-
*
|
|
1546
|
-
* +path+ must be relative to the repository's working directory.
|
|
1547
|
-
*
|
|
1548
|
-
* repo.status('src/diff.c') #=> [:index_new, :worktree_new]
|
|
1549
|
-
*/
|
|
1550
|
-
static VALUE rb_git_repo_status(int argc, VALUE *argv, VALUE self)
|
|
1514
|
+
static VALUE rb_git_repo_file_status(VALUE self, VALUE rb_path)
|
|
1551
1515
|
{
|
|
1516
|
+
unsigned int flags;
|
|
1552
1517
|
int error;
|
|
1553
|
-
VALUE rb_path;
|
|
1554
1518
|
git_repository *repo;
|
|
1555
1519
|
|
|
1556
1520
|
Data_Get_Struct(self, git_repository, repo);
|
|
1521
|
+
Check_Type(rb_path, T_STRING);
|
|
1522
|
+
error = git_status_file(&flags, repo, StringValueCStr(rb_path));
|
|
1523
|
+
rugged_exception_check(error);
|
|
1557
1524
|
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
Check_Type(rb_path, T_STRING);
|
|
1561
|
-
error = git_status_file(&flags, repo, StringValueCStr(rb_path));
|
|
1562
|
-
rugged_exception_check(error);
|
|
1525
|
+
return flags_to_rb(flags);
|
|
1526
|
+
}
|
|
1563
1527
|
|
|
1564
|
-
|
|
1565
|
-
|
|
1528
|
+
static VALUE rb_git_repo_file_each_status(VALUE self)
|
|
1529
|
+
{
|
|
1530
|
+
int error;
|
|
1531
|
+
git_repository *repo;
|
|
1532
|
+
|
|
1533
|
+
Data_Get_Struct(self, git_repository, repo);
|
|
1566
1534
|
|
|
1567
1535
|
if (!rb_block_given_p())
|
|
1568
1536
|
rb_raise(rb_eRuntimeError,
|
|
@@ -1601,8 +1569,7 @@ static VALUE rb_git_repo_each_id(VALUE self)
|
|
|
1601
1569
|
git_odb *odb;
|
|
1602
1570
|
int error, exception = 0;
|
|
1603
1571
|
|
|
1604
|
-
|
|
1605
|
-
return rb_funcall(self, rb_intern("to_enum"), 1, CSTR2SYM("each_id"));
|
|
1572
|
+
RETURN_ENUMERATOR(self, 0, 0);
|
|
1606
1573
|
|
|
1607
1574
|
Data_Get_Struct(self, git_repository, repo);
|
|
1608
1575
|
|
|
@@ -2605,7 +2572,8 @@ void Init_rugged_repo(void)
|
|
|
2605
2572
|
rb_define_method(rb_cRuggedRepo, "path", rb_git_repo_path, 0);
|
|
2606
2573
|
rb_define_method(rb_cRuggedRepo, "workdir", rb_git_repo_workdir, 0);
|
|
2607
2574
|
rb_define_method(rb_cRuggedRepo, "workdir=", rb_git_repo_set_workdir, 1);
|
|
2608
|
-
|
|
2575
|
+
rb_define_private_method(rb_cRuggedRepo, "file_status", rb_git_repo_file_status, 1);
|
|
2576
|
+
rb_define_private_method(rb_cRuggedRepo, "each_status", rb_git_repo_file_each_status, 0);
|
|
2609
2577
|
|
|
2610
2578
|
rb_define_method(rb_cRuggedRepo, "index", rb_git_repo_get_index, 0);
|
|
2611
2579
|
rb_define_method(rb_cRuggedRepo, "index=", rb_git_repo_set_index, 1);
|