rugged 0.16.0 → 0.17.0b1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +373 -243
- data/Rakefile +22 -0
- data/ext/rugged/extconf.rb +9 -6
- data/ext/rugged/rugged.c +123 -31
- data/ext/rugged/rugged.h +11 -10
- data/ext/rugged/rugged_blob.c +181 -18
- data/ext/rugged/rugged_commit.c +196 -18
- data/ext/rugged/rugged_config.c +94 -5
- data/ext/rugged/rugged_object.c +54 -1
- data/ext/rugged/rugged_reference.c +203 -15
- data/ext/rugged/{remote.c → rugged_remote.c} +35 -10
- data/ext/rugged/rugged_repo.c +323 -81
- data/ext/rugged/rugged_revwalk.c +57 -4
- data/ext/rugged/rugged_signature.c +3 -3
- data/ext/rugged/rugged_tag.c +72 -1
- data/ext/rugged/rugged_tree.c +70 -2
- data/ext/rugged/vendor/libgit2-dist/deps/regex/config.h +7 -0
- data/ext/rugged/vendor/libgit2-dist/deps/regex/regcomp.c +3856 -0
- data/ext/rugged/vendor/libgit2-dist/deps/regex/regex.c +85 -0
- data/ext/rugged/vendor/libgit2-dist/deps/regex/regex.h +582 -0
- data/ext/rugged/vendor/libgit2-dist/deps/regex/regex_internal.c +1744 -0
- data/ext/rugged/vendor/libgit2-dist/deps/regex/regex_internal.h +810 -0
- data/ext/rugged/vendor/libgit2-dist/deps/regex/regexec.c +4369 -0
- data/ext/rugged/vendor/libgit2-dist/examples/diff.c +238 -0
- data/ext/rugged/vendor/libgit2-dist/examples/general.c +4 -4
- data/ext/rugged/vendor/libgit2-dist/examples/network/fetch.c +101 -85
- data/ext/rugged/vendor/libgit2-dist/examples/network/git2.c +7 -3
- data/ext/rugged/vendor/libgit2-dist/examples/network/index-pack.c +80 -25
- data/ext/rugged/vendor/libgit2-dist/examples/network/ls-remote.c +6 -6
- data/ext/rugged/vendor/libgit2-dist/include/git2/attr.h +224 -0
- data/ext/rugged/vendor/libgit2-dist/include/git2/blob.h +59 -5
- data/ext/rugged/vendor/libgit2-dist/include/git2/branch.h +114 -7
- data/ext/rugged/vendor/libgit2-dist/include/git2/commit.h +14 -7
- data/ext/rugged/vendor/libgit2-dist/include/git2/common.h +4 -3
- data/ext/rugged/vendor/libgit2-dist/include/git2/config.h +105 -27
- data/ext/rugged/vendor/libgit2-dist/include/git2/diff.h +409 -0
- data/ext/rugged/vendor/libgit2-dist/include/git2/errors.h +47 -82
- data/ext/rugged/vendor/libgit2-dist/include/git2/index.h +25 -10
- data/ext/rugged/vendor/libgit2-dist/include/git2/indexer.h +46 -1
- data/ext/rugged/vendor/libgit2-dist/include/git2/merge.h +35 -0
- data/ext/rugged/vendor/libgit2-dist/include/git2/net.h +1 -1
- data/ext/rugged/vendor/libgit2-dist/include/git2/notes.h +139 -0
- data/ext/rugged/vendor/libgit2-dist/include/git2/object.h +5 -5
- data/ext/rugged/vendor/libgit2-dist/include/git2/odb.h +13 -13
- data/ext/rugged/vendor/libgit2-dist/include/git2/odb_backend.h +8 -8
- data/ext/rugged/vendor/libgit2-dist/include/git2/oid.h +14 -9
- data/ext/rugged/vendor/libgit2-dist/include/git2/reflog.h +5 -5
- data/ext/rugged/vendor/libgit2-dist/include/git2/refs.h +37 -17
- data/ext/rugged/vendor/libgit2-dist/include/git2/refspec.h +17 -9
- data/ext/rugged/vendor/libgit2-dist/include/git2/remote.h +83 -16
- data/ext/rugged/vendor/libgit2-dist/include/git2/repository.h +24 -10
- data/ext/rugged/vendor/libgit2-dist/include/git2/reset.h +44 -0
- data/ext/rugged/vendor/libgit2-dist/include/git2/revparse.h +36 -0
- data/ext/rugged/vendor/libgit2-dist/include/git2/revwalk.h +74 -6
- data/ext/rugged/vendor/libgit2-dist/include/git2/signature.h +3 -3
- data/ext/rugged/vendor/libgit2-dist/include/git2/status.h +120 -19
- data/ext/rugged/vendor/libgit2-dist/include/git2/submodule.h +103 -0
- data/ext/rugged/vendor/libgit2-dist/include/git2/tag.h +28 -10
- data/ext/rugged/vendor/libgit2-dist/include/git2/threads.h +1 -1
- data/ext/rugged/vendor/libgit2-dist/include/git2/tree.h +13 -13
- data/ext/rugged/vendor/libgit2-dist/include/git2/types.h +16 -2
- data/ext/rugged/vendor/libgit2-dist/include/git2/version.h +3 -3
- data/ext/rugged/vendor/libgit2-dist/include/git2/windows.h +1 -1
- data/ext/rugged/vendor/libgit2-dist/include/git2.h +7 -2
- data/ext/rugged/vendor/libgit2-dist/src/attr.c +677 -0
- data/ext/rugged/vendor/libgit2-dist/src/attr.h +56 -0
- data/ext/rugged/vendor/libgit2-dist/src/attr_file.c +609 -0
- data/ext/rugged/vendor/libgit2-dist/src/attr_file.h +145 -0
- data/ext/rugged/vendor/libgit2-dist/src/blob.c +213 -60
- data/ext/rugged/vendor/libgit2-dist/src/blob.h +2 -1
- data/ext/rugged/vendor/libgit2-dist/src/branch.c +208 -0
- data/ext/rugged/vendor/libgit2-dist/src/branch.h +17 -0
- data/ext/rugged/vendor/libgit2-dist/src/bswap.h +1 -1
- data/ext/rugged/vendor/libgit2-dist/src/buffer.c +395 -46
- data/ext/rugged/vendor/libgit2-dist/src/buffer.h +112 -9
- data/ext/rugged/vendor/libgit2-dist/src/cache.c +37 -49
- data/ext/rugged/vendor/libgit2-dist/src/cache.h +7 -17
- data/ext/rugged/vendor/libgit2-dist/src/cc-compat.h +18 -16
- data/ext/rugged/vendor/libgit2-dist/src/commit.c +56 -90
- data/ext/rugged/vendor/libgit2-dist/src/commit.h +1 -1
- data/ext/rugged/vendor/libgit2-dist/src/common.h +12 -5
- data/ext/rugged/vendor/libgit2-dist/src/{win32 → compat}/fnmatch.c +1 -1
- data/ext/rugged/vendor/libgit2-dist/src/{win32 → compat}/fnmatch.h +3 -3
- data/ext/rugged/vendor/libgit2-dist/src/config.c +247 -158
- data/ext/rugged/vendor/libgit2-dist/src/config.h +10 -1
- data/ext/rugged/vendor/libgit2-dist/src/config_cache.c +94 -0
- data/ext/rugged/vendor/libgit2-dist/src/config_file.c +606 -496
- data/ext/rugged/vendor/libgit2-dist/src/config_file.h +31 -0
- data/ext/rugged/vendor/libgit2-dist/src/crlf.c +228 -0
- data/ext/rugged/vendor/libgit2-dist/src/date.c +876 -0
- data/ext/rugged/vendor/libgit2-dist/src/delta-apply.c +15 -9
- data/ext/rugged/vendor/libgit2-dist/src/delta-apply.h +2 -2
- data/ext/rugged/vendor/libgit2-dist/src/diff.c +814 -0
- data/ext/rugged/vendor/libgit2-dist/src/diff.h +43 -0
- data/ext/rugged/vendor/libgit2-dist/src/diff_output.c +794 -0
- data/ext/rugged/vendor/libgit2-dist/src/errors.c +89 -74
- data/ext/rugged/vendor/libgit2-dist/src/fetch.c +94 -66
- data/ext/rugged/vendor/libgit2-dist/src/fetch.h +5 -4
- data/ext/rugged/vendor/libgit2-dist/src/filebuf.c +157 -100
- data/ext/rugged/vendor/libgit2-dist/src/filebuf.h +22 -8
- data/ext/rugged/vendor/libgit2-dist/src/fileops.c +330 -206
- data/ext/rugged/vendor/libgit2-dist/src/fileops.h +82 -51
- data/ext/rugged/vendor/libgit2-dist/src/filter.c +165 -0
- data/ext/rugged/vendor/libgit2-dist/src/filter.h +119 -0
- data/ext/rugged/vendor/libgit2-dist/src/global.c +4 -4
- data/ext/rugged/vendor/libgit2-dist/src/global.h +4 -1
- data/ext/rugged/vendor/libgit2-dist/src/hash.c +1 -1
- data/ext/rugged/vendor/libgit2-dist/src/hash.h +1 -1
- data/ext/rugged/vendor/libgit2-dist/src/ignore.c +203 -0
- data/ext/rugged/vendor/libgit2-dist/src/ignore.h +38 -0
- data/ext/rugged/vendor/libgit2-dist/src/index.c +220 -169
- data/ext/rugged/vendor/libgit2-dist/src/index.h +5 -1
- data/ext/rugged/vendor/libgit2-dist/src/indexer.c +601 -102
- data/ext/rugged/vendor/libgit2-dist/src/iterator.c +748 -0
- data/ext/rugged/vendor/libgit2-dist/src/iterator.h +151 -0
- data/ext/rugged/vendor/libgit2-dist/src/khash.h +608 -0
- data/ext/rugged/vendor/libgit2-dist/src/map.h +6 -1
- data/ext/rugged/vendor/libgit2-dist/src/message.c +61 -0
- data/ext/rugged/vendor/libgit2-dist/src/message.h +14 -0
- data/ext/rugged/vendor/libgit2-dist/src/mwindow.c +27 -29
- data/ext/rugged/vendor/libgit2-dist/src/mwindow.h +4 -4
- data/ext/rugged/vendor/libgit2-dist/src/netops.c +375 -56
- data/ext/rugged/vendor/libgit2-dist/src/netops.h +12 -9
- data/ext/rugged/vendor/libgit2-dist/src/notes.c +548 -0
- data/ext/rugged/vendor/libgit2-dist/src/notes.h +28 -0
- data/ext/rugged/vendor/libgit2-dist/src/object.c +59 -21
- data/ext/rugged/vendor/libgit2-dist/src/odb.c +212 -175
- data/ext/rugged/vendor/libgit2-dist/src/odb.h +39 -2
- data/ext/rugged/vendor/libgit2-dist/src/odb_loose.c +238 -241
- data/ext/rugged/vendor/libgit2-dist/src/odb_pack.c +94 -106
- data/ext/rugged/vendor/libgit2-dist/src/oid.c +59 -60
- data/ext/rugged/vendor/libgit2-dist/src/oidmap.h +42 -0
- data/ext/rugged/vendor/libgit2-dist/src/pack.c +198 -170
- data/ext/rugged/vendor/libgit2-dist/src/pack.h +16 -9
- data/ext/rugged/vendor/libgit2-dist/src/path.c +496 -106
- data/ext/rugged/vendor/libgit2-dist/src/path.h +214 -20
- data/ext/rugged/vendor/libgit2-dist/src/pkt.c +88 -159
- data/ext/rugged/vendor/libgit2-dist/src/pkt.h +9 -5
- data/ext/rugged/vendor/libgit2-dist/src/pool.c +294 -0
- data/ext/rugged/vendor/libgit2-dist/src/pool.h +125 -0
- data/ext/rugged/vendor/libgit2-dist/src/posix.c +38 -16
- data/ext/rugged/vendor/libgit2-dist/src/posix.h +20 -2
- data/ext/rugged/vendor/libgit2-dist/src/ppc/sha1.c +1 -1
- data/ext/rugged/vendor/libgit2-dist/src/ppc/sha1.h +1 -1
- data/ext/rugged/vendor/libgit2-dist/src/pqueue.c +7 -7
- data/ext/rugged/vendor/libgit2-dist/src/pqueue.h +1 -1
- data/ext/rugged/vendor/libgit2-dist/src/protocol.c +21 -13
- data/ext/rugged/vendor/libgit2-dist/src/protocol.h +1 -1
- data/ext/rugged/vendor/libgit2-dist/src/reflog.c +125 -103
- data/ext/rugged/vendor/libgit2-dist/src/reflog.h +1 -1
- data/ext/rugged/vendor/libgit2-dist/src/refs.c +713 -640
- data/ext/rugged/vendor/libgit2-dist/src/refs.h +27 -3
- data/ext/rugged/vendor/libgit2-dist/src/refspec.c +51 -17
- data/ext/rugged/vendor/libgit2-dist/src/refspec.h +13 -1
- data/ext/rugged/vendor/libgit2-dist/src/remote.c +307 -119
- data/ext/rugged/vendor/libgit2-dist/src/remote.h +3 -2
- data/ext/rugged/vendor/libgit2-dist/src/repository.c +593 -442
- data/ext/rugged/vendor/libgit2-dist/src/repository.h +80 -2
- data/ext/rugged/vendor/libgit2-dist/src/reset.c +103 -0
- data/ext/rugged/vendor/libgit2-dist/src/revparse.c +753 -0
- data/ext/rugged/vendor/libgit2-dist/src/revwalk.c +434 -158
- data/ext/rugged/vendor/libgit2-dist/src/sha1.c +3 -3
- data/ext/rugged/vendor/libgit2-dist/src/sha1.h +2 -2
- data/ext/rugged/vendor/libgit2-dist/src/sha1_lookup.c +3 -2
- data/ext/rugged/vendor/libgit2-dist/src/sha1_lookup.h +1 -1
- data/ext/rugged/vendor/libgit2-dist/src/signature.c +69 -80
- data/ext/rugged/vendor/libgit2-dist/src/signature.h +1 -1
- data/ext/rugged/vendor/libgit2-dist/src/status.c +184 -638
- data/ext/rugged/vendor/libgit2-dist/src/strmap.h +64 -0
- data/ext/rugged/vendor/libgit2-dist/src/submodule.c +387 -0
- data/ext/rugged/vendor/libgit2-dist/src/tag.c +162 -137
- data/ext/rugged/vendor/libgit2-dist/src/tag.h +2 -1
- data/ext/rugged/vendor/libgit2-dist/src/thread-utils.c +1 -1
- data/ext/rugged/vendor/libgit2-dist/src/thread-utils.h +8 -8
- data/ext/rugged/vendor/libgit2-dist/src/transport.c +31 -19
- data/ext/rugged/vendor/libgit2-dist/src/transport.h +31 -11
- data/ext/rugged/vendor/libgit2-dist/src/transports/git.c +168 -193
- data/ext/rugged/vendor/libgit2-dist/src/transports/http.c +192 -241
- data/ext/rugged/vendor/libgit2-dist/src/transports/local.c +92 -86
- data/ext/rugged/vendor/libgit2-dist/src/tree-cache.c +32 -49
- data/ext/rugged/vendor/libgit2-dist/src/tree-cache.h +1 -1
- data/ext/rugged/vendor/libgit2-dist/src/tree.c +172 -145
- data/ext/rugged/vendor/libgit2-dist/src/tree.h +16 -2
- data/ext/rugged/vendor/libgit2-dist/src/tsort.c +16 -14
- data/ext/rugged/vendor/libgit2-dist/src/unix/map.c +8 -24
- data/ext/rugged/vendor/libgit2-dist/src/unix/posix.h +9 -3
- data/ext/rugged/vendor/libgit2-dist/src/util.c +94 -38
- data/ext/rugged/vendor/libgit2-dist/src/util.h +119 -13
- data/ext/rugged/vendor/libgit2-dist/src/vector.c +84 -31
- data/ext/rugged/vendor/libgit2-dist/src/vector.h +37 -4
- data/ext/rugged/vendor/libgit2-dist/src/win32/dir.c +81 -41
- data/ext/rugged/vendor/libgit2-dist/src/{dir.h → win32/dir.h} +4 -9
- data/ext/rugged/vendor/libgit2-dist/src/win32/map.c +19 -35
- data/ext/rugged/vendor/libgit2-dist/src/win32/mingw-compat.h +1 -1
- data/ext/rugged/vendor/libgit2-dist/src/win32/msvc-compat.h +5 -1
- data/ext/rugged/vendor/libgit2-dist/src/win32/posix.h +10 -8
- data/ext/rugged/vendor/libgit2-dist/src/win32/posix_w32.c +262 -118
- data/ext/rugged/vendor/libgit2-dist/src/win32/pthread.c +12 -9
- data/ext/rugged/vendor/libgit2-dist/src/win32/pthread.h +1 -1
- data/ext/rugged/vendor/libgit2-dist/src/win32/utf-conv.c +30 -26
- data/ext/rugged/vendor/libgit2-dist/src/win32/utf-conv.h +2 -1
- data/ext/rugged/vendor/libgit2-dist/src/xdiff/xdiff.h +135 -0
- data/ext/rugged/vendor/libgit2-dist/src/xdiff/xdiffi.c +572 -0
- data/ext/rugged/vendor/libgit2-dist/src/xdiff/xdiffi.h +63 -0
- data/ext/rugged/vendor/libgit2-dist/src/xdiff/xemit.c +253 -0
- data/ext/rugged/vendor/libgit2-dist/src/xdiff/xemit.h +36 -0
- data/ext/rugged/vendor/libgit2-dist/src/xdiff/xhistogram.c +371 -0
- data/ext/rugged/vendor/libgit2-dist/src/xdiff/xinclude.h +46 -0
- data/ext/rugged/vendor/libgit2-dist/src/xdiff/xmacros.h +54 -0
- data/ext/rugged/vendor/libgit2-dist/src/xdiff/xmerge.c +619 -0
- data/ext/rugged/vendor/libgit2-dist/src/xdiff/xpatience.c +358 -0
- data/ext/rugged/vendor/libgit2-dist/src/xdiff/xprepare.c +483 -0
- data/ext/rugged/vendor/libgit2-dist/src/xdiff/xprepare.h +34 -0
- data/ext/rugged/vendor/libgit2-dist/src/xdiff/xtypes.h +67 -0
- data/ext/rugged/vendor/libgit2-dist/src/xdiff/xutils.c +419 -0
- data/ext/rugged/vendor/libgit2-dist/src/xdiff/xutils.h +49 -0
- data/ext/rugged/vendor/libgit2-dist/tests-clar/attr/attr_expect.h +43 -0
- data/ext/rugged/vendor/libgit2-dist/tests-clar/attr/file.c +226 -0
- data/ext/rugged/vendor/libgit2-dist/tests-clar/attr/flags.c +108 -0
- data/ext/rugged/vendor/libgit2-dist/tests-clar/attr/lookup.c +262 -0
- data/ext/rugged/vendor/libgit2-dist/tests-clar/attr/repo.c +273 -0
- data/ext/rugged/vendor/libgit2-dist/{tests-clay → tests-clar}/buf/basic.c +5 -5
- data/ext/rugged/vendor/libgit2-dist/tests-clar/clar_helpers.c +181 -0
- data/ext/rugged/vendor/libgit2-dist/tests-clar/clar_libgit2.h +55 -0
- data/ext/rugged/vendor/libgit2-dist/tests-clar/commit/commit.c +44 -0
- data/ext/rugged/vendor/libgit2-dist/tests-clar/commit/parse.c +350 -0
- data/ext/rugged/vendor/libgit2-dist/tests-clar/commit/signature.c +65 -0
- data/ext/rugged/vendor/libgit2-dist/tests-clar/commit/write.c +140 -0
- data/ext/rugged/vendor/libgit2-dist/{tests-clay → tests-clar}/config/add.c +3 -3
- data/ext/rugged/vendor/libgit2-dist/tests-clar/config/multivar.c +151 -0
- data/ext/rugged/vendor/libgit2-dist/{tests-clay → tests-clar}/config/new.c +5 -5
- data/ext/rugged/vendor/libgit2-dist/{tests-clay → tests-clar}/config/read.c +44 -32
- data/ext/rugged/vendor/libgit2-dist/tests-clar/config/stress.c +61 -0
- data/ext/rugged/vendor/libgit2-dist/{tests-clay → tests-clar}/config/write.c +20 -5
- data/ext/rugged/vendor/libgit2-dist/tests-clar/core/buffer.c +613 -0
- data/ext/rugged/vendor/libgit2-dist/{tests-clay → tests-clar}/core/dirent.c +39 -26
- data/ext/rugged/vendor/libgit2-dist/tests-clar/core/env.c +115 -0
- data/ext/rugged/vendor/libgit2-dist/tests-clar/core/errors.c +60 -0
- data/ext/rugged/vendor/libgit2-dist/{tests-clay → tests-clar}/core/filebuf.c +4 -18
- data/ext/rugged/vendor/libgit2-dist/tests-clar/core/hex.c +22 -0
- data/ext/rugged/vendor/libgit2-dist/{tests-clay → tests-clar}/core/oid.c +6 -6
- data/ext/rugged/vendor/libgit2-dist/tests-clar/core/path.c +420 -0
- data/ext/rugged/vendor/libgit2-dist/tests-clar/core/pool.c +85 -0
- data/ext/rugged/vendor/libgit2-dist/tests-clar/core/rmdir.c +68 -0
- data/ext/rugged/vendor/libgit2-dist/{tests-clay → tests-clar}/core/string.c +1 -1
- data/ext/rugged/vendor/libgit2-dist/tests-clar/core/strmap.c +102 -0
- data/ext/rugged/vendor/libgit2-dist/{tests-clay → tests-clar}/core/strtol.c +1 -1
- data/ext/rugged/vendor/libgit2-dist/tests-clar/core/vector.c +191 -0
- data/ext/rugged/vendor/libgit2-dist/tests-clar/date/date.c +15 -0
- data/ext/rugged/vendor/libgit2-dist/tests-clar/diff/blob.c +254 -0
- data/ext/rugged/vendor/libgit2-dist/tests-clar/diff/diff_helpers.c +104 -0
- data/ext/rugged/vendor/libgit2-dist/tests-clar/diff/diff_helpers.h +47 -0
- data/ext/rugged/vendor/libgit2-dist/tests-clar/diff/index.c +92 -0
- data/ext/rugged/vendor/libgit2-dist/tests-clar/diff/iterator.c +572 -0
- data/ext/rugged/vendor/libgit2-dist/tests-clar/diff/patch.c +99 -0
- data/ext/rugged/vendor/libgit2-dist/tests-clar/diff/tree.c +210 -0
- data/ext/rugged/vendor/libgit2-dist/tests-clar/diff/workdir.c +543 -0
- data/ext/rugged/vendor/libgit2-dist/tests-clar/index/read_tree.c +46 -0
- data/ext/rugged/vendor/libgit2-dist/{tests-clay → tests-clar}/index/rename.c +2 -12
- data/ext/rugged/vendor/libgit2-dist/tests-clar/index/tests.c +246 -0
- data/ext/rugged/vendor/libgit2-dist/tests-clar/network/createremotethenload.c +33 -0
- data/ext/rugged/vendor/libgit2-dist/tests-clar/network/remotelocal.c +137 -0
- data/ext/rugged/vendor/libgit2-dist/tests-clar/network/remotes.c +183 -0
- data/ext/rugged/vendor/libgit2-dist/tests-clar/notes/notes.c +133 -0
- data/ext/rugged/vendor/libgit2-dist/tests-clar/notes/notesref.c +57 -0
- data/ext/rugged/vendor/libgit2-dist/tests-clar/object/blob/filter.c +125 -0
- data/ext/rugged/vendor/libgit2-dist/tests-clar/object/blob/fromchunks.c +87 -0
- data/ext/rugged/vendor/libgit2-dist/tests-clar/object/blob/write.c +69 -0
- data/ext/rugged/vendor/libgit2-dist/tests-clar/object/commit/commitstagedfile.c +126 -0
- data/ext/rugged/vendor/libgit2-dist/tests-clar/object/lookup.c +63 -0
- data/ext/rugged/vendor/libgit2-dist/tests-clar/object/message.c +171 -0
- data/ext/rugged/vendor/libgit2-dist/{tests-clay → tests-clar}/object/raw/chars.c +3 -14
- data/ext/rugged/vendor/libgit2-dist/{tests-clay → tests-clar}/object/raw/compare.c +4 -4
- data/ext/rugged/vendor/libgit2-dist/{tests-clay → tests-clar}/object/raw/convert.c +10 -10
- data/ext/rugged/vendor/libgit2-dist/{tests-clay → tests-clar}/object/raw/data.h +0 -0
- data/ext/rugged/vendor/libgit2-dist/{tests-clay → tests-clar}/object/raw/fromstr.c +1 -1
- data/ext/rugged/vendor/libgit2-dist/{tests-clay → tests-clar}/object/raw/hash.c +21 -17
- data/ext/rugged/vendor/libgit2-dist/{tests-clay → tests-clar}/object/raw/short.c +1 -1
- data/ext/rugged/vendor/libgit2-dist/{tests-clay → tests-clar}/object/raw/size.c +1 -1
- data/ext/rugged/vendor/libgit2-dist/{tests-clay → tests-clar}/object/raw/type2string.c +14 -14
- data/ext/rugged/vendor/libgit2-dist/tests-clar/object/raw/write.c +455 -0
- data/ext/rugged/vendor/libgit2-dist/tests-clar/object/tag/peel.c +56 -0
- data/ext/rugged/vendor/libgit2-dist/tests-clar/object/tag/read.c +130 -0
- data/ext/rugged/vendor/libgit2-dist/tests-clar/object/tag/write.c +192 -0
- data/ext/rugged/vendor/libgit2-dist/{tests-clay → tests-clar}/object/tree/frompath.c +22 -16
- data/ext/rugged/vendor/libgit2-dist/tests-clar/object/tree/read.c +75 -0
- data/ext/rugged/vendor/libgit2-dist/tests-clar/object/tree/write.c +84 -0
- data/ext/rugged/vendor/libgit2-dist/{tests-clay → tests-clar}/odb/loose.c +1 -1
- data/ext/rugged/vendor/libgit2-dist/{tests-clay → tests-clar}/odb/loose_data.h +0 -0
- data/ext/rugged/vendor/libgit2-dist/tests-clar/odb/mixed.c +24 -0
- data/ext/rugged/vendor/libgit2-dist/{tests-clay → tests-clar}/odb/pack_data.h +0 -0
- data/ext/rugged/vendor/libgit2-dist/{tests-clay → tests-clar}/odb/packed.c +1 -1
- data/ext/rugged/vendor/libgit2-dist/{tests-clay → tests-clar}/odb/sorting.c +1 -1
- data/ext/rugged/vendor/libgit2-dist/tests-clar/refs/branches/create.c +113 -0
- data/ext/rugged/vendor/libgit2-dist/tests-clar/refs/branches/delete.c +91 -0
- data/ext/rugged/vendor/libgit2-dist/tests-clar/refs/branches/listall.c +78 -0
- data/ext/rugged/vendor/libgit2-dist/tests-clar/refs/branches/move.c +72 -0
- data/ext/rugged/vendor/libgit2-dist/tests-clar/refs/crashes.c +17 -0
- data/ext/rugged/vendor/libgit2-dist/tests-clar/refs/create.c +149 -0
- data/ext/rugged/vendor/libgit2-dist/tests-clar/refs/delete.c +85 -0
- data/ext/rugged/vendor/libgit2-dist/tests-clar/refs/list.c +53 -0
- data/ext/rugged/vendor/libgit2-dist/tests-clar/refs/listall.c +36 -0
- data/ext/rugged/vendor/libgit2-dist/tests-clar/refs/lookup.c +42 -0
- data/ext/rugged/vendor/libgit2-dist/tests-clar/refs/normalize.c +200 -0
- data/ext/rugged/vendor/libgit2-dist/tests-clar/refs/overwrite.c +136 -0
- data/ext/rugged/vendor/libgit2-dist/tests-clar/refs/pack.c +67 -0
- data/ext/rugged/vendor/libgit2-dist/tests-clar/refs/read.c +194 -0
- data/ext/rugged/vendor/libgit2-dist/tests-clar/refs/reflog.c +123 -0
- data/ext/rugged/vendor/libgit2-dist/tests-clar/refs/rename.c +339 -0
- data/ext/rugged/vendor/libgit2-dist/tests-clar/refs/revparse.c +174 -0
- data/ext/rugged/vendor/libgit2-dist/tests-clar/refs/unicode.c +42 -0
- data/ext/rugged/vendor/libgit2-dist/tests-clar/repo/discover.c +142 -0
- data/ext/rugged/vendor/libgit2-dist/{tests-clay → tests-clar}/repo/getters.c +19 -1
- data/ext/rugged/vendor/libgit2-dist/tests-clar/repo/init.c +235 -0
- data/ext/rugged/vendor/libgit2-dist/tests-clar/repo/open.c +282 -0
- data/ext/rugged/vendor/libgit2-dist/tests-clar/repo/setters.c +80 -0
- data/ext/rugged/vendor/libgit2-dist/tests-clar/reset/mixed.c +47 -0
- data/ext/rugged/vendor/libgit2-dist/tests-clar/reset/reset_helpers.c +10 -0
- data/ext/rugged/vendor/libgit2-dist/tests-clar/reset/reset_helpers.h +6 -0
- data/ext/rugged/vendor/libgit2-dist/tests-clar/reset/soft.c +102 -0
- data/ext/rugged/vendor/libgit2-dist/{tests/t05-revwalk.c → tests-clar/revwalk/basic.c} +85 -44
- data/ext/rugged/vendor/libgit2-dist/tests-clar/revwalk/mergebase.c +148 -0
- data/ext/rugged/vendor/libgit2-dist/tests-clar/status/ignore.c +133 -0
- data/ext/rugged/vendor/libgit2-dist/{tests-clay → tests-clar}/status/single.c +2 -11
- data/ext/rugged/vendor/libgit2-dist/tests-clar/status/status_data.h +202 -0
- data/ext/rugged/vendor/libgit2-dist/tests-clar/status/status_helpers.c +49 -0
- data/ext/rugged/vendor/libgit2-dist/tests-clar/status/status_helpers.h +33 -0
- data/ext/rugged/vendor/libgit2-dist/tests-clar/status/submodules.c +112 -0
- data/ext/rugged/vendor/libgit2-dist/tests-clar/status/worktree.c +649 -0
- data/ext/rugged/vendor/libgit2-dist/tests-clar/threads/basic.c +20 -0
- data/ext/rugged/vendor/libgit2-dist.tar.gz +0 -0
- data/lib/rugged/commit.rb +35 -0
- data/lib/rugged/object.rb +7 -0
- data/lib/rugged/reference.rb +9 -0
- data/lib/rugged/repository.rb +99 -3
- data/lib/rugged/tag.rb +22 -0
- data/lib/rugged/tree.rb +8 -0
- data/lib/rugged/version.rb +1 -1
- data/lib/rugged.rb +4 -1
- data/test/blob_test.rb +2 -2
- data/test/commit_test.rb +27 -13
- data/test/config_test.rb +44 -0
- data/test/coverage/HEAD.json +1 -1
- data/test/fixtures/testrepo.git/config +2 -0
- data/test/fixtures/testrepo.git/objects/7f/043268ea43ce18e3540acaabf9e090c91965b0 +0 -0
- data/test/lib_test.rb +7 -0
- data/test/object_test.rb +3 -3
- data/test/reference_test.rb +46 -8
- data/test/remote_test.rb +8 -2
- data/test/repo_pack_test.rb +3 -3
- data/test/repo_test.rb +79 -11
- data/test/tag_test.rb +9 -2
- data/test/test_helper.rb +21 -0
- data/test/tree_test.rb +18 -6
- metadata +205 -81
- data/ext/rugged/vendor/libgit2-dist/include/git2/zlib.h +0 -40
- data/ext/rugged/vendor/libgit2-dist/src/hashtable.c +0 -243
- data/ext/rugged/vendor/libgit2-dist/src/hashtable.h +0 -80
- data/ext/rugged/vendor/libgit2-dist/tests/t00-core.c +0 -628
- data/ext/rugged/vendor/libgit2-dist/tests/t01-data.h +0 -322
- data/ext/rugged/vendor/libgit2-dist/tests/t01-rawobj.c +0 -638
- data/ext/rugged/vendor/libgit2-dist/tests/t03-data.h +0 -344
- data/ext/rugged/vendor/libgit2-dist/tests/t03-objwrite.c +0 -255
- data/ext/rugged/vendor/libgit2-dist/tests/t04-commit.c +0 -788
- data/ext/rugged/vendor/libgit2-dist/tests/t06-index.c +0 -219
- data/ext/rugged/vendor/libgit2-dist/tests/t07-hashtable.c +0 -192
- data/ext/rugged/vendor/libgit2-dist/tests/t08-tag.c +0 -357
- data/ext/rugged/vendor/libgit2-dist/tests/t09-tree.c +0 -221
- data/ext/rugged/vendor/libgit2-dist/tests/t10-refs.c +0 -1294
- data/ext/rugged/vendor/libgit2-dist/tests/t12-repo.c +0 -174
- data/ext/rugged/vendor/libgit2-dist/tests/t13-threads.c +0 -41
- data/ext/rugged/vendor/libgit2-dist/tests/t17-bufs.c +0 -61
- data/ext/rugged/vendor/libgit2-dist/tests/t18-status.c +0 -448
- data/ext/rugged/vendor/libgit2-dist/tests/test_helpers.c +0 -310
- data/ext/rugged/vendor/libgit2-dist/tests/test_helpers.h +0 -83
- data/ext/rugged/vendor/libgit2-dist/tests/test_lib.c +0 -198
- data/ext/rugged/vendor/libgit2-dist/tests/test_lib.h +0 -54
- data/ext/rugged/vendor/libgit2-dist/tests/test_main.c +0 -89
- data/ext/rugged/vendor/libgit2-dist/tests-clay/clay.h +0 -187
- data/ext/rugged/vendor/libgit2-dist/tests-clay/clay_libgit2.h +0 -28
- data/ext/rugged/vendor/libgit2-dist/tests-clay/clay_main.c +0 -1073
- data/ext/rugged/vendor/libgit2-dist/tests-clay/config/stress.c +0 -39
- data/ext/rugged/vendor/libgit2-dist/tests-clay/core/path.c +0 -139
- data/ext/rugged/vendor/libgit2-dist/tests-clay/core/rmdir.c +0 -50
- data/ext/rugged/vendor/libgit2-dist/tests-clay/core/vector.c +0 -66
- data/ext/rugged/vendor/libgit2-dist/tests-clay/network/remotes.c +0 -50
- data/ext/rugged/vendor/libgit2-dist/tests-clay/repo/init.c +0 -104
- data/ext/rugged/vendor/libgit2-dist/tests-clay/repo/open.c +0 -54
- data/ext/rugged/vendor/libgit2-dist/tests-clay/status/status_data.h +0 -48
- data/ext/rugged/vendor/libgit2-dist/tests-clay/status/worktree.c +0 -124
- data/lib/rugged/objects.rb +0 -45
- data/test/fixtures/testrepo.git/refs/heads/new_name +0 -1
data/ext/rugged/rugged_commit.c
CHANGED
@@ -2,17 +2,17 @@
|
|
2
2
|
* The MIT License
|
3
3
|
*
|
4
4
|
* Copyright (c) 2011 GitHub, Inc
|
5
|
-
*
|
5
|
+
*
|
6
6
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
7
7
|
* of this software and associated documentation files (the "Software"), to deal
|
8
8
|
* in the Software without restriction, including without limitation the rights
|
9
9
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
10
10
|
* copies of the Software, and to permit persons to whom the Software is
|
11
11
|
* furnished to do so, subject to the following conditions:
|
12
|
-
*
|
12
|
+
*
|
13
13
|
* The above copyright notice and this permission notice shall be included in
|
14
14
|
* all copies or substantial portions of the Software.
|
15
|
-
*
|
15
|
+
*
|
16
16
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
17
17
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
18
18
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
@@ -33,6 +33,19 @@ VALUE rb_cRuggedCommit;
|
|
33
33
|
/*
|
34
34
|
* Commit code
|
35
35
|
*/
|
36
|
+
/*
|
37
|
+
* call-seq:
|
38
|
+
* commit.message -> msg
|
39
|
+
*
|
40
|
+
* Return the message of this commit. This includes the full body of the
|
41
|
+
* message, with the short description, detailed descritpion, and any
|
42
|
+
* optional footers or signatures after it.
|
43
|
+
*
|
44
|
+
* In Ruby 1.9.X, the returned string will be encoded with the encoding
|
45
|
+
* specified in the +Encoding+ header of the commit, if available.
|
46
|
+
*
|
47
|
+
* commit.message #=> "add a lot of RDoc docs\n\nthis includes docs for commit and blob"
|
48
|
+
*/
|
36
49
|
static VALUE rb_git_commit_message_GET(VALUE self)
|
37
50
|
{
|
38
51
|
git_commit *commit;
|
@@ -53,6 +66,22 @@ static VALUE rb_git_commit_message_GET(VALUE self)
|
|
53
66
|
return rugged_str_new2(git_commit_message(commit), encoding);
|
54
67
|
}
|
55
68
|
|
69
|
+
/*
|
70
|
+
* call-seq:
|
71
|
+
* commit.committer -> signature
|
72
|
+
*
|
73
|
+
* Return the signature for the committer of this +commit+. The signature
|
74
|
+
* is returned as a +Hash+ containing +:name+, +:email+ of the author
|
75
|
+
* and +:time+ of the change.
|
76
|
+
*
|
77
|
+
* The committer of a commit is the person who actually applied the changes
|
78
|
+
* of the commit; in most cases it's the same as the author.
|
79
|
+
*
|
80
|
+
* In Ruby 1.9.X, the returned string will be encoded with the encoding
|
81
|
+
* specified in the +Encoding+ header of the commit, if available.
|
82
|
+
*
|
83
|
+
* commit.committer #=> {:email=>"tanoku@gmail.com", :time=>Tue Jan 24 05:42:45 UTC 2012, :name=>"Vicent Mart\303\255"}
|
84
|
+
*/
|
56
85
|
static VALUE rb_git_commit_committer_GET(VALUE self)
|
57
86
|
{
|
58
87
|
git_commit *commit;
|
@@ -63,6 +92,21 @@ static VALUE rb_git_commit_committer_GET(VALUE self)
|
|
63
92
|
git_commit_message_encoding(commit));
|
64
93
|
}
|
65
94
|
|
95
|
+
/*
|
96
|
+
* call-seq:
|
97
|
+
* commit.author -> signature
|
98
|
+
*
|
99
|
+
* Return the signature for the author of this +commit+. The signature
|
100
|
+
* is returned as a +Hash+ containing +:name+, +:email+ of the author
|
101
|
+
* and +:time+ of the change.
|
102
|
+
*
|
103
|
+
* The author of the commit is the person who intially created the changes.
|
104
|
+
*
|
105
|
+
* In Ruby 1.9.X, the returned string will be encoded with the encoding
|
106
|
+
* specified in the +Encoding+ header of the commit, if available.
|
107
|
+
*
|
108
|
+
* commit.author #=> {:email=>"tanoku@gmail.com", :time=>Tue Jan 24 05:42:45 UTC 2012, :name=>"Vicent Mart\303\255"}
|
109
|
+
*/
|
66
110
|
static VALUE rb_git_commit_author_GET(VALUE self)
|
67
111
|
{
|
68
112
|
git_commit *commit;
|
@@ -73,7 +117,17 @@ static VALUE rb_git_commit_author_GET(VALUE self)
|
|
73
117
|
git_commit_message_encoding(commit));
|
74
118
|
}
|
75
119
|
|
76
|
-
|
120
|
+
/*
|
121
|
+
* call-seq:
|
122
|
+
* commit.epoch_time -> t
|
123
|
+
*
|
124
|
+
* Return the time when this commit was made effective. This is the same value
|
125
|
+
* as the +:time+ attribute for +commit.committer+, but represented as an +Integer+
|
126
|
+
* value in seconds since the Epoch.
|
127
|
+
*
|
128
|
+
* commit.time #=> 1327383765
|
129
|
+
*/
|
130
|
+
static VALUE rb_git_commit_epoch_time_GET(VALUE self)
|
77
131
|
{
|
78
132
|
git_commit *commit;
|
79
133
|
Data_Get_Struct(self, git_commit, commit);
|
@@ -81,6 +135,15 @@ static VALUE rb_git_commit_time_GET(VALUE self)
|
|
81
135
|
return ULONG2NUM(git_commit_time(commit));
|
82
136
|
}
|
83
137
|
|
138
|
+
/*
|
139
|
+
* call-seq:
|
140
|
+
* commit.tree -> tree
|
141
|
+
*
|
142
|
+
* Return the tree pointed at by this +commit+. The tree is
|
143
|
+
* returned as a +Rugged::Tree+ object.
|
144
|
+
*
|
145
|
+
* commit.tree #=> #<Rugged::Tree:0x10882c680>
|
146
|
+
*/
|
84
147
|
static VALUE rb_git_commit_tree_GET(VALUE self)
|
85
148
|
{
|
86
149
|
git_commit *commit;
|
@@ -97,6 +160,39 @@ static VALUE rb_git_commit_tree_GET(VALUE self)
|
|
97
160
|
return rugged_object_new(owner, (git_object *)tree);
|
98
161
|
}
|
99
162
|
|
163
|
+
/*
|
164
|
+
* call-seq:
|
165
|
+
* commit.tree_oid -> oid
|
166
|
+
*
|
167
|
+
* Return the tree oid pointed at by this +commit+. The tree is
|
168
|
+
* returned as a String object.
|
169
|
+
*
|
170
|
+
* commit.tree #=> "f148106ca58764adc93ad4e2d6b1d168422b9796"
|
171
|
+
*/
|
172
|
+
static VALUE rb_git_commit_tree_oid_GET(VALUE self)
|
173
|
+
{
|
174
|
+
git_commit *commit;
|
175
|
+
const git_oid *tree_oid;
|
176
|
+
int error;
|
177
|
+
|
178
|
+
Data_Get_Struct(self, git_commit, commit);
|
179
|
+
|
180
|
+
tree_oid = git_commit_tree_oid(commit);
|
181
|
+
|
182
|
+
return rugged_create_oid(tree_oid);
|
183
|
+
}
|
184
|
+
|
185
|
+
/*
|
186
|
+
* call-seq:
|
187
|
+
* commit.parents -> [commit, ...]
|
188
|
+
*
|
189
|
+
* Return the parent(s) of this commit as an array of +Rugged::Commit+
|
190
|
+
* objects. An array is always returned even when the commit has only
|
191
|
+
* one or zero parents.
|
192
|
+
*
|
193
|
+
* commit.parents #=> => [#<Rugged::Commit:0x108828918>]
|
194
|
+
* root.parents #=> []
|
195
|
+
*/
|
100
196
|
static VALUE rb_git_commit_parents_GET(VALUE self)
|
101
197
|
{
|
102
198
|
git_commit *commit;
|
@@ -120,15 +216,80 @@ static VALUE rb_git_commit_parents_GET(VALUE self)
|
|
120
216
|
return ret_arr;
|
121
217
|
}
|
122
218
|
|
219
|
+
/*
|
220
|
+
* call-seq:
|
221
|
+
* commit.parent_oids -> [oid, ...]
|
222
|
+
*
|
223
|
+
* Return the parent oid(s) of this commit as an array of oid String
|
224
|
+
* objects. An array is always returned even when the commit has only
|
225
|
+
* one or zero parents.
|
226
|
+
*
|
227
|
+
* commit.parent_oids #=> => ["2cb831a8aea28b2c1b9c63385585b864e4d3bad1", ...]
|
228
|
+
* root.parent_oids #=> []
|
229
|
+
*/
|
230
|
+
static VALUE rb_git_commit_parent_oids_GET(VALUE self)
|
231
|
+
{
|
232
|
+
git_commit *commit;
|
233
|
+
const git_oid *parent_oid;
|
234
|
+
unsigned int n, parent_count;
|
235
|
+
VALUE ret_arr;
|
236
|
+
int error;
|
237
|
+
|
238
|
+
Data_Get_Struct(self, git_commit, commit);
|
239
|
+
|
240
|
+
parent_count = git_commit_parentcount(commit);
|
241
|
+
ret_arr = rb_ary_new2((long)parent_count);
|
242
|
+
|
243
|
+
for (n = 0; n < parent_count; n++) {
|
244
|
+
parent_oid = git_commit_parent_oid(commit, n);
|
245
|
+
if (parent_oid) {
|
246
|
+
rb_ary_push(ret_arr, rugged_create_oid(parent_oid));
|
247
|
+
}
|
248
|
+
}
|
249
|
+
|
250
|
+
return ret_arr;
|
251
|
+
}
|
252
|
+
|
253
|
+
/*
|
254
|
+
* call-seq:
|
255
|
+
* Commit.create(repository, data = {}) -> oid
|
256
|
+
*
|
257
|
+
* Write a new +Commit+ object to +repository+, with the given +data+
|
258
|
+
* arguments, passed as a +Hash+:
|
259
|
+
*
|
260
|
+
* - +:message+: a string with the full text for the commit's message
|
261
|
+
* - +:committer+: a hash with the signature for the committer
|
262
|
+
* - +:author+: a hash with the signature for the author
|
263
|
+
* - +:parents+: an +Array+ with zero or more parents for this commit,
|
264
|
+
* represented as <tt>Rugged::Commit</tt> instances, or OID +String+.
|
265
|
+
* - +:tree+: the tree for this commit, represented as a <tt>Rugged::Tree</tt>
|
266
|
+
* instance or an OID +String+.
|
267
|
+
* - +:update_ref+ (optional): a +String+ with the name of a reference in the
|
268
|
+
* repository which should be updated to point to this commit (e.g. "HEAD")
|
269
|
+
*
|
270
|
+
* When the commit is successfully written to disk, its +oid+ will be
|
271
|
+
* returned as a hex +String+.
|
272
|
+
*
|
273
|
+
* author = {:email=>"tanoku@gmail.com", :time=>Time.now, :name=>"Vicent Mart\303\255"}
|
274
|
+
*
|
275
|
+
* Rugged::Commit.create(r,
|
276
|
+
* :author => author,
|
277
|
+
* :message => "Hello world\n\n",
|
278
|
+
* :committer => author,
|
279
|
+
* :parents => ["2cb831a8aea28b2c1b9c63385585b864e4d3bad1"],
|
280
|
+
* :tree => some_tree) #=> "f148106ca58764adc93ad4e2d6b1d168422b9796"
|
281
|
+
*/
|
123
282
|
static VALUE rb_git_commit_create(VALUE self, VALUE rb_repo, VALUE rb_data)
|
124
283
|
{
|
125
|
-
VALUE rb_message, rb_tree, rb_parents;
|
284
|
+
VALUE rb_message, rb_tree, rb_parents, rb_ref;
|
126
285
|
int parent_count, i, error;
|
127
|
-
const git_commit **parents;
|
286
|
+
const git_commit **parents = NULL;
|
287
|
+
git_commit **free_list = NULL;
|
128
288
|
git_tree *tree;
|
129
289
|
git_signature *author, *committer;
|
130
290
|
git_oid commit_oid;
|
131
291
|
git_repository *repo;
|
292
|
+
const char *update_ref = NULL;
|
132
293
|
|
133
294
|
Check_Type(rb_data, T_HASH);
|
134
295
|
|
@@ -136,6 +297,12 @@ static VALUE rb_git_commit_create(VALUE self, VALUE rb_repo, VALUE rb_data)
|
|
136
297
|
rb_raise(rb_eTypeError, "Expeting a Rugged::Repository instance");
|
137
298
|
Data_Get_Struct(rb_repo, git_repository, repo);
|
138
299
|
|
300
|
+
rb_ref = rb_hash_aref(rb_data, CSTR2SYM("update_ref"));
|
301
|
+
if (!NIL_P(rb_ref)) {
|
302
|
+
Check_Type(rb_ref, T_STRING);
|
303
|
+
update_ref = StringValueCStr(rb_ref);
|
304
|
+
}
|
305
|
+
|
139
306
|
rb_message = rb_hash_aref(rb_data, CSTR2SYM("message"));
|
140
307
|
Check_Type(rb_message, T_STRING);
|
141
308
|
|
@@ -153,38 +320,46 @@ static VALUE rb_git_commit_create(VALUE self, VALUE rb_repo, VALUE rb_data)
|
|
153
320
|
rb_tree = rb_hash_aref(rb_data, CSTR2SYM("tree"));
|
154
321
|
tree = (git_tree *)rugged_object_load(repo, rb_tree, GIT_OBJ_TREE);
|
155
322
|
|
156
|
-
|
157
|
-
|
323
|
+
parents = xmalloc(RARRAY_LEN(rb_parents) * sizeof(void *));
|
324
|
+
free_list = xmalloc(RARRAY_LEN(rb_parents) * sizeof(void *));
|
325
|
+
parent_count = 0;
|
158
326
|
|
159
|
-
for (i = 0; i <
|
327
|
+
for (i = 0; i < (int)RARRAY_LEN(rb_parents); ++i) {
|
160
328
|
VALUE p = rb_ary_entry(rb_parents, i);
|
161
329
|
git_commit *parent = NULL;
|
330
|
+
git_commit *free_ptr = NULL;
|
331
|
+
|
332
|
+
if (NIL_P(p))
|
333
|
+
continue;
|
162
334
|
|
163
335
|
if (TYPE(p) == T_STRING) {
|
164
336
|
git_oid oid;
|
165
337
|
|
166
338
|
error = git_oid_fromstr(&oid, StringValueCStr(p));
|
167
|
-
if (error <
|
339
|
+
if (error < GIT_OK)
|
168
340
|
goto cleanup;
|
169
341
|
|
170
342
|
error = git_commit_lookup(&parent, repo, &oid);
|
171
|
-
if (error <
|
343
|
+
if (error < GIT_OK)
|
172
344
|
goto cleanup;
|
173
345
|
|
346
|
+
free_ptr = parent;
|
347
|
+
|
174
348
|
} else if (rb_obj_is_kind_of(p, rb_cRuggedCommit)) {
|
175
349
|
Data_Get_Struct(p, git_commit, parent);
|
176
350
|
} else {
|
177
|
-
|
178
|
-
goto cleanup;
|
351
|
+
rb_raise(rb_eTypeError, "Invalid type for parent object");
|
179
352
|
}
|
180
353
|
|
181
|
-
parents[
|
354
|
+
parents[parent_count] = parent;
|
355
|
+
free_list[parent_count] = free_ptr;
|
356
|
+
parent_count++;
|
182
357
|
}
|
183
358
|
|
184
359
|
error = git_commit_create(
|
185
360
|
&commit_oid,
|
186
361
|
repo,
|
187
|
-
|
362
|
+
update_ref,
|
188
363
|
author,
|
189
364
|
committer,
|
190
365
|
NULL,
|
@@ -200,9 +375,10 @@ cleanup:
|
|
200
375
|
git_object_free((git_object *)tree);
|
201
376
|
|
202
377
|
for (i = 0; i < parent_count; ++i)
|
203
|
-
git_object_free((git_object *)
|
378
|
+
git_object_free((git_object *)free_list[i]);
|
204
379
|
|
205
|
-
|
380
|
+
xfree(parents);
|
381
|
+
xfree(free_list);
|
206
382
|
rugged_exception_check(error);
|
207
383
|
|
208
384
|
return rugged_create_oid(&commit_oid);
|
@@ -215,10 +391,12 @@ void Init_rugged_commit()
|
|
215
391
|
rb_define_singleton_method(rb_cRuggedCommit, "create", rb_git_commit_create, 2);
|
216
392
|
|
217
393
|
rb_define_method(rb_cRuggedCommit, "message", rb_git_commit_message_GET, 0);
|
218
|
-
rb_define_method(rb_cRuggedCommit, "
|
394
|
+
rb_define_method(rb_cRuggedCommit, "epoch_time", rb_git_commit_epoch_time_GET, 0);
|
219
395
|
rb_define_method(rb_cRuggedCommit, "committer", rb_git_commit_committer_GET, 0);
|
220
396
|
rb_define_method(rb_cRuggedCommit, "author", rb_git_commit_author_GET, 0);
|
221
397
|
rb_define_method(rb_cRuggedCommit, "tree", rb_git_commit_tree_GET, 0);
|
398
|
+
rb_define_method(rb_cRuggedCommit, "tree_oid", rb_git_commit_tree_oid_GET, 0);
|
222
399
|
rb_define_method(rb_cRuggedCommit, "parents", rb_git_commit_parents_GET, 0);
|
400
|
+
rb_define_method(rb_cRuggedCommit, "parent_oids", rb_git_commit_parent_oids_GET, 0);
|
223
401
|
}
|
224
402
|
|
data/ext/rugged/rugged_config.c
CHANGED
@@ -36,9 +36,17 @@ VALUE rugged_config_new(VALUE klass, VALUE owner, git_config *cfg)
|
|
36
36
|
{
|
37
37
|
VALUE rb_config = Data_Wrap_Struct(klass, NULL, &rb_git_config__free, cfg);
|
38
38
|
rugged_set_owner(rb_config, owner);
|
39
|
-
return
|
39
|
+
return rb_config;
|
40
40
|
}
|
41
41
|
|
42
|
+
/*
|
43
|
+
* call-seq:
|
44
|
+
* Config.new(path) -> new_config
|
45
|
+
*
|
46
|
+
* Open the file specified in +path+ as a +Rugged::Config+ file.
|
47
|
+
* If +path+ cannot be found, or the file is an invalid Git config,
|
48
|
+
* an exception will be raised.
|
49
|
+
*/
|
42
50
|
static VALUE rb_git_config_new(VALUE klass, VALUE rb_path)
|
43
51
|
{
|
44
52
|
git_config *config = NULL;
|
@@ -64,6 +72,18 @@ static VALUE rb_git_config_new(VALUE klass, VALUE rb_path)
|
|
64
72
|
return rugged_config_new(klass, Qnil, config);
|
65
73
|
}
|
66
74
|
|
75
|
+
/*
|
76
|
+
* call-seq:
|
77
|
+
* cfg.get(key) -> value
|
78
|
+
* cfg[key] -> value
|
79
|
+
*
|
80
|
+
* Get the value for the given config +key+. Values are always
|
81
|
+
* returned as +String+, or +nil+ if the given key doesn't exist
|
82
|
+
* in the Config file.
|
83
|
+
*
|
84
|
+
* cfg['apply.whitespace'] #=> 'fix'
|
85
|
+
* cfg['diff.renames'] #=> 'true'
|
86
|
+
*/
|
67
87
|
static VALUE rb_git_config_get(VALUE self, VALUE rb_key)
|
68
88
|
{
|
69
89
|
git_config *config;
|
@@ -73,7 +93,7 @@ static VALUE rb_git_config_get(VALUE self, VALUE rb_key)
|
|
73
93
|
Data_Get_Struct(self, git_config, config);
|
74
94
|
Check_Type(rb_key, T_STRING);
|
75
95
|
|
76
|
-
error = git_config_get_string(config, StringValueCStr(rb_key)
|
96
|
+
error = git_config_get_string(&value, config, StringValueCStr(rb_key));
|
77
97
|
if (error == GIT_ENOTFOUND)
|
78
98
|
return Qnil;
|
79
99
|
|
@@ -83,6 +103,21 @@ static VALUE rb_git_config_get(VALUE self, VALUE rb_key)
|
|
83
103
|
return rugged_str_new2(value, NULL);
|
84
104
|
}
|
85
105
|
|
106
|
+
/*
|
107
|
+
* call-seq:
|
108
|
+
* cfg.store(key, value)
|
109
|
+
* cfg[key] = value
|
110
|
+
*
|
111
|
+
* Store the given +value+ in the Config file, under the section
|
112
|
+
* and name specified by +key+. Value can be any of the following
|
113
|
+
* Ruby types: +String+, +true+, +false+ and +Fixnum+.
|
114
|
+
*
|
115
|
+
* The config file will be automatically stored to disk.
|
116
|
+
*
|
117
|
+
* cfg['apply.whitespace'] = 'fix'
|
118
|
+
* cfg['diff.renames'] = true
|
119
|
+
* cfg['gc.reflogexpre'] = 90
|
120
|
+
*/
|
86
121
|
static VALUE rb_git_config_store(VALUE self, VALUE rb_key, VALUE rb_val)
|
87
122
|
{
|
88
123
|
git_config *config;
|
@@ -117,6 +152,16 @@ static VALUE rb_git_config_store(VALUE self, VALUE rb_key, VALUE rb_val)
|
|
117
152
|
return Qnil;
|
118
153
|
}
|
119
154
|
|
155
|
+
/*
|
156
|
+
* call-seq:
|
157
|
+
* cfg.delete(key) -> true or false
|
158
|
+
*
|
159
|
+
* Delete the given +key+ from the config file. Return +true+ if
|
160
|
+
* the deletion was successful, or +false+ if the key was not
|
161
|
+
* found in the Config file.
|
162
|
+
*
|
163
|
+
* The config file is immediately updated on disk.
|
164
|
+
*/
|
120
165
|
static VALUE rb_git_config_delete(VALUE self, VALUE rb_key)
|
121
166
|
{
|
122
167
|
git_config *config;
|
@@ -137,7 +182,7 @@ static VALUE rb_git_config_delete(VALUE self, VALUE rb_key)
|
|
137
182
|
static int cb_config__each_key(const char *key, const char *value, void *opaque)
|
138
183
|
{
|
139
184
|
rb_funcall((VALUE)opaque, rb_intern("call"), 1, rugged_str_new2(key, NULL));
|
140
|
-
return
|
185
|
+
return GIT_OK;
|
141
186
|
}
|
142
187
|
|
143
188
|
static int cb_config__each_pair(const char *key, const char *value, void *opaque)
|
@@ -146,7 +191,7 @@ static int cb_config__each_pair(const char *key, const char *value, void *opaque
|
|
146
191
|
rugged_str_new2(key, NULL),
|
147
192
|
rugged_str_new2(value, NULL));
|
148
193
|
|
149
|
-
return
|
194
|
+
return GIT_OK;
|
150
195
|
}
|
151
196
|
|
152
197
|
static int cb_config__to_hash(const char *key, const char *value, void *opaque)
|
@@ -155,9 +200,21 @@ static int cb_config__to_hash(const char *key, const char *value, void *opaque)
|
|
155
200
|
rugged_str_new2(key, NULL),
|
156
201
|
rugged_str_new2(value, NULL));
|
157
202
|
|
158
|
-
return
|
203
|
+
return GIT_OK;
|
159
204
|
}
|
160
205
|
|
206
|
+
/*
|
207
|
+
* call-seq:
|
208
|
+
* cfg.each_key { |key| block }
|
209
|
+
* cfg.each_key -> Iterator
|
210
|
+
*
|
211
|
+
* Call the given block once for each key in the config file. If no block
|
212
|
+
* is given, an +Iterator+ is returned.
|
213
|
+
*
|
214
|
+
* cfg.each_key do |key|
|
215
|
+
* puts key
|
216
|
+
* end
|
217
|
+
*/
|
161
218
|
static VALUE rb_git_config_each_key(VALUE self)
|
162
219
|
{
|
163
220
|
git_config *config;
|
@@ -173,6 +230,20 @@ static VALUE rb_git_config_each_key(VALUE self)
|
|
173
230
|
return Qnil;
|
174
231
|
}
|
175
232
|
|
233
|
+
/*
|
234
|
+
* call-seq:
|
235
|
+
* cfg.each_pair { |key, value| block }
|
236
|
+
* cfg.each_pair -> Iterator
|
237
|
+
* cfg.each { |key, value| block }
|
238
|
+
* cfg.each -> Iterator
|
239
|
+
*
|
240
|
+
* Call the given block once for each key/value pair in the config file.
|
241
|
+
* If no block is given, an +Iterator+ is returned.
|
242
|
+
*
|
243
|
+
* cfg.each do |key, value|
|
244
|
+
* puts "#{key} => #{value}"
|
245
|
+
* end
|
246
|
+
*/
|
176
247
|
static VALUE rb_git_config_each_pair(VALUE self)
|
177
248
|
{
|
178
249
|
git_config *config;
|
@@ -188,6 +259,16 @@ static VALUE rb_git_config_each_pair(VALUE self)
|
|
188
259
|
return Qnil;
|
189
260
|
}
|
190
261
|
|
262
|
+
/*
|
263
|
+
* call-seq:
|
264
|
+
* cfg.to_hash -> hash
|
265
|
+
*
|
266
|
+
* Returns the config file represented as a Ruby hash, where
|
267
|
+
* each configuration entry appears as a key with its
|
268
|
+
* corresponding value.
|
269
|
+
*
|
270
|
+
* cfg.to_hash #=> {"core.autolf" => "true", "core.bare" => "true"}
|
271
|
+
*/
|
191
272
|
static VALUE rb_git_config_to_hash(VALUE self)
|
192
273
|
{
|
193
274
|
git_config *config;
|
@@ -202,6 +283,14 @@ static VALUE rb_git_config_to_hash(VALUE self)
|
|
202
283
|
return hash;
|
203
284
|
}
|
204
285
|
|
286
|
+
/*
|
287
|
+
* call-seq:
|
288
|
+
* Config.open_global() -> new_config
|
289
|
+
*
|
290
|
+
* Open the global config file as a new +Rugged::Config+ object.
|
291
|
+
* An exception will be raised if the global config file doesn't
|
292
|
+
* exist.
|
293
|
+
*/
|
205
294
|
static VALUE rb_git_config_open_global(VALUE klass)
|
206
295
|
{
|
207
296
|
git_config *cfg;
|
data/ext/rugged/rugged_object.c
CHANGED
@@ -33,6 +33,59 @@ extern VALUE rb_cRuggedRepo;
|
|
33
33
|
|
34
34
|
VALUE rb_cRuggedObject;
|
35
35
|
|
36
|
+
git_otype rugged_otype_get(VALUE self)
|
37
|
+
{
|
38
|
+
git_otype type = GIT_OBJ_BAD;
|
39
|
+
|
40
|
+
if (NIL_P(self))
|
41
|
+
return GIT_OBJ_ANY;
|
42
|
+
|
43
|
+
switch (TYPE(self)) {
|
44
|
+
case T_STRING:
|
45
|
+
type = git_object_string2type(StringValueCStr(self));
|
46
|
+
break;
|
47
|
+
|
48
|
+
case T_FIXNUM:
|
49
|
+
type = FIX2INT(self);
|
50
|
+
break;
|
51
|
+
|
52
|
+
case T_SYMBOL: {
|
53
|
+
ID t = SYM2ID(self);
|
54
|
+
|
55
|
+
if (t == rb_intern("commit"))
|
56
|
+
type = GIT_OBJ_COMMIT;
|
57
|
+
else if (t == rb_intern("tree"))
|
58
|
+
type = GIT_OBJ_TREE;
|
59
|
+
else if (t == rb_intern("tag"))
|
60
|
+
type = GIT_OBJ_TAG;
|
61
|
+
else if (t == rb_intern("blob"))
|
62
|
+
type = GIT_OBJ_BLOB;
|
63
|
+
}
|
64
|
+
}
|
65
|
+
|
66
|
+
if (!git_object_typeisloose(type))
|
67
|
+
rb_raise(rb_eTypeError, "Invalid Git object type specifier");
|
68
|
+
|
69
|
+
return type;
|
70
|
+
}
|
71
|
+
|
72
|
+
VALUE rugged_otype_new(git_otype t)
|
73
|
+
{
|
74
|
+
switch (t) {
|
75
|
+
case GIT_OBJ_COMMIT:
|
76
|
+
return CSTR2SYM("commit");
|
77
|
+
case GIT_OBJ_TAG:
|
78
|
+
return CSTR2SYM("tag");
|
79
|
+
case GIT_OBJ_TREE:
|
80
|
+
return CSTR2SYM("tree");
|
81
|
+
case GIT_OBJ_BLOB:
|
82
|
+
return CSTR2SYM("blob");
|
83
|
+
default:
|
84
|
+
return Qnil;
|
85
|
+
}
|
86
|
+
}
|
87
|
+
|
88
|
+
|
36
89
|
git_object *rugged_object_load(git_repository *repo, VALUE object_value, git_otype type)
|
37
90
|
{
|
38
91
|
git_object *object = NULL;
|
@@ -179,7 +232,7 @@ static VALUE rb_git_object_type_GET(VALUE self)
|
|
179
232
|
git_object *object;
|
180
233
|
Data_Get_Struct(self, git_object, object);
|
181
234
|
|
182
|
-
return
|
235
|
+
return rugged_otype_new(git_object_type(object));
|
183
236
|
}
|
184
237
|
|
185
238
|
static VALUE rb_git_object_read_raw(VALUE self)
|