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
@@ -1,5 +1,5 @@
|
|
1
1
|
/*
|
2
|
-
* Copyright (C) 2009-
|
2
|
+
* Copyright (C) 2009-2012 the libgit2 contributors
|
3
3
|
*
|
4
4
|
* This file is part of libgit2, distributed under the GNU GPL v2 with
|
5
5
|
* a Linking Exception. For full terms see the included COPYING file.
|
@@ -10,7 +10,7 @@
|
|
10
10
|
#include "vector.h"
|
11
11
|
|
12
12
|
static const double resize_factor = 1.75;
|
13
|
-
static const
|
13
|
+
static const unsigned int minimum_size = 8;
|
14
14
|
|
15
15
|
static int resize_vector(git_vector *v)
|
16
16
|
{
|
@@ -19,17 +19,20 @@ static int resize_vector(git_vector *v)
|
|
19
19
|
v->_alloc_size = minimum_size;
|
20
20
|
|
21
21
|
v->contents = git__realloc(v->contents, v->_alloc_size * sizeof(void *));
|
22
|
-
|
23
|
-
return GIT_ENOMEM;
|
22
|
+
GITERR_CHECK_ALLOC(v->contents);
|
24
23
|
|
25
|
-
return
|
24
|
+
return 0;
|
26
25
|
}
|
27
26
|
|
28
|
-
|
29
27
|
void git_vector_free(git_vector *v)
|
30
28
|
{
|
31
29
|
assert(v);
|
30
|
+
|
32
31
|
git__free(v->contents);
|
32
|
+
v->contents = NULL;
|
33
|
+
|
34
|
+
v->length = 0;
|
35
|
+
v->_alloc_size = 0;
|
33
36
|
}
|
34
37
|
|
35
38
|
int git_vector_init(git_vector *v, unsigned int initial_size, git_vector_cmp cmp)
|
@@ -48,25 +51,58 @@ int git_vector_init(git_vector *v, unsigned int initial_size, git_vector_cmp cmp
|
|
48
51
|
v->sorted = 1;
|
49
52
|
|
50
53
|
v->contents = git__malloc(v->_alloc_size * sizeof(void *));
|
51
|
-
|
52
|
-
return GIT_ENOMEM;
|
54
|
+
GITERR_CHECK_ALLOC(v->contents);
|
53
55
|
|
54
|
-
return
|
56
|
+
return 0;
|
55
57
|
}
|
56
58
|
|
57
59
|
int git_vector_insert(git_vector *v, void *element)
|
58
60
|
{
|
59
61
|
assert(v);
|
60
62
|
|
61
|
-
if (v->length >= v->_alloc_size
|
62
|
-
|
63
|
-
|
64
|
-
}
|
63
|
+
if (v->length >= v->_alloc_size &&
|
64
|
+
resize_vector(v) < 0)
|
65
|
+
return -1;
|
65
66
|
|
66
67
|
v->contents[v->length++] = element;
|
67
68
|
v->sorted = 0;
|
68
69
|
|
69
|
-
return
|
70
|
+
return 0;
|
71
|
+
}
|
72
|
+
|
73
|
+
int git_vector_insert_sorted(
|
74
|
+
git_vector *v, void *element, int (*on_dup)(void **old, void *new))
|
75
|
+
{
|
76
|
+
int result;
|
77
|
+
size_t pos;
|
78
|
+
|
79
|
+
assert(v && v->_cmp);
|
80
|
+
|
81
|
+
if (!v->sorted)
|
82
|
+
git_vector_sort(v);
|
83
|
+
|
84
|
+
if (v->length >= v->_alloc_size &&
|
85
|
+
resize_vector(v) < 0)
|
86
|
+
return -1;
|
87
|
+
|
88
|
+
/* If we find the element and have a duplicate handler callback,
|
89
|
+
* invoke it. If it returns non-zero, then cancel insert, otherwise
|
90
|
+
* proceed with normal insert.
|
91
|
+
*/
|
92
|
+
if (git__bsearch(v->contents, v->length, element, v->_cmp, &pos) >= 0 &&
|
93
|
+
on_dup != NULL &&
|
94
|
+
(result = on_dup(&v->contents[pos], element)) < 0)
|
95
|
+
return result;
|
96
|
+
|
97
|
+
/* shift elements to the right */
|
98
|
+
if (pos < v->length) {
|
99
|
+
memmove(v->contents + pos + 1, v->contents + pos,
|
100
|
+
(v->length - pos) * sizeof(void *));
|
101
|
+
}
|
102
|
+
|
103
|
+
v->contents[pos] = element;
|
104
|
+
v->length++;
|
105
|
+
return 0;
|
70
106
|
}
|
71
107
|
|
72
108
|
void git_vector_sort(git_vector *v)
|
@@ -80,26 +116,32 @@ void git_vector_sort(git_vector *v)
|
|
80
116
|
v->sorted = 1;
|
81
117
|
}
|
82
118
|
|
83
|
-
int
|
119
|
+
int git_vector_bsearch3(
|
120
|
+
unsigned int *at_pos,
|
121
|
+
git_vector *v,
|
122
|
+
git_vector_cmp key_lookup,
|
123
|
+
const void *key)
|
84
124
|
{
|
85
|
-
|
125
|
+
int rval;
|
126
|
+
size_t pos;
|
86
127
|
|
87
128
|
assert(v && key && key_lookup);
|
88
129
|
|
89
130
|
/* need comparison function to sort the vector */
|
90
|
-
|
91
|
-
return git__throw(GIT_ENOTFOUND, "Can't sort vector. No comparison function set");
|
131
|
+
assert(v->_cmp != NULL);
|
92
132
|
|
93
133
|
git_vector_sort(v);
|
94
134
|
|
95
|
-
|
96
|
-
|
97
|
-
|
135
|
+
rval = git__bsearch(v->contents, v->length, key, key_lookup, &pos);
|
136
|
+
|
137
|
+
if (at_pos != NULL)
|
138
|
+
*at_pos = (unsigned int)pos;
|
98
139
|
|
99
|
-
return
|
140
|
+
return (rval >= 0) ? (int)pos : GIT_ENOTFOUND;
|
100
141
|
}
|
101
142
|
|
102
|
-
int git_vector_search2(
|
143
|
+
int git_vector_search2(
|
144
|
+
git_vector *v, git_vector_cmp key_lookup, const void *key)
|
103
145
|
{
|
104
146
|
unsigned int i;
|
105
147
|
|
@@ -110,7 +152,7 @@ int git_vector_search2(git_vector *v, git_vector_cmp key_lookup, const void *key
|
|
110
152
|
return i;
|
111
153
|
}
|
112
154
|
|
113
|
-
return
|
155
|
+
return GIT_ENOTFOUND;
|
114
156
|
}
|
115
157
|
|
116
158
|
static int strict_comparison(const void *a, const void *b)
|
@@ -123,11 +165,6 @@ int git_vector_search(git_vector *v, const void *entry)
|
|
123
165
|
return git_vector_search2(v, v->_cmp ? v->_cmp : strict_comparison, entry);
|
124
166
|
}
|
125
167
|
|
126
|
-
int git_vector_bsearch(git_vector *v, const void *key)
|
127
|
-
{
|
128
|
-
return git_vector_bsearch2(v, v->_cmp, key);
|
129
|
-
}
|
130
|
-
|
131
168
|
int git_vector_remove(git_vector *v, unsigned int idx)
|
132
169
|
{
|
133
170
|
unsigned int i;
|
@@ -135,13 +172,19 @@ int git_vector_remove(git_vector *v, unsigned int idx)
|
|
135
172
|
assert(v);
|
136
173
|
|
137
174
|
if (idx >= v->length || v->length == 0)
|
138
|
-
return
|
175
|
+
return GIT_ENOTFOUND;
|
139
176
|
|
140
177
|
for (i = idx; i < v->length - 1; ++i)
|
141
178
|
v->contents[i] = v->contents[i + 1];
|
142
179
|
|
143
180
|
v->length--;
|
144
|
-
return
|
181
|
+
return 0;
|
182
|
+
}
|
183
|
+
|
184
|
+
void git_vector_pop(git_vector *v)
|
185
|
+
{
|
186
|
+
if (v->length > 0)
|
187
|
+
v->length--;
|
145
188
|
}
|
146
189
|
|
147
190
|
void git_vector_uniq(git_vector *v)
|
@@ -171,4 +214,14 @@ void git_vector_clear(git_vector *v)
|
|
171
214
|
v->sorted = 1;
|
172
215
|
}
|
173
216
|
|
217
|
+
void git_vector_swap(git_vector *a, git_vector *b)
|
218
|
+
{
|
219
|
+
git_vector t;
|
174
220
|
|
221
|
+
if (!a || !b || a == b)
|
222
|
+
return;
|
223
|
+
|
224
|
+
memcpy(&t, a, sizeof(t));
|
225
|
+
memcpy(a, b, sizeof(t));
|
226
|
+
memcpy(b, &t, sizeof(t));
|
227
|
+
}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/*
|
2
|
-
* Copyright (C) 2009-
|
2
|
+
* Copyright (C) 2009-2012 the libgit2 contributors
|
3
3
|
*
|
4
4
|
* This file is part of libgit2, distributed under the GNU GPL v2 with
|
5
5
|
* a Linking Exception. For full terms see the included COPYING file.
|
@@ -19,27 +19,60 @@ typedef struct git_vector {
|
|
19
19
|
int sorted;
|
20
20
|
} git_vector;
|
21
21
|
|
22
|
+
#define GIT_VECTOR_INIT {0}
|
23
|
+
|
22
24
|
int git_vector_init(git_vector *v, unsigned int initial_size, git_vector_cmp cmp);
|
23
25
|
void git_vector_free(git_vector *v);
|
24
26
|
void git_vector_clear(git_vector *v);
|
27
|
+
void git_vector_swap(git_vector *a, git_vector *b);
|
28
|
+
|
29
|
+
void git_vector_sort(git_vector *v);
|
25
30
|
|
26
31
|
int git_vector_search(git_vector *v, const void *entry);
|
27
32
|
int git_vector_search2(git_vector *v, git_vector_cmp cmp, const void *key);
|
28
33
|
|
29
|
-
int
|
30
|
-
int
|
34
|
+
int git_vector_bsearch3(
|
35
|
+
unsigned int *at_pos, git_vector *v, git_vector_cmp cmp, const void *key);
|
31
36
|
|
32
|
-
|
37
|
+
GIT_INLINE(int) git_vector_bsearch(git_vector *v, const void *key)
|
38
|
+
{
|
39
|
+
return git_vector_bsearch3(NULL, v, v->_cmp, key);
|
40
|
+
}
|
41
|
+
|
42
|
+
GIT_INLINE(int) git_vector_bsearch2(
|
43
|
+
git_vector *v, git_vector_cmp cmp, const void *key)
|
44
|
+
{
|
45
|
+
return git_vector_bsearch3(NULL, v, cmp, key);
|
46
|
+
}
|
33
47
|
|
34
48
|
GIT_INLINE(void *) git_vector_get(git_vector *v, unsigned int position)
|
35
49
|
{
|
36
50
|
return (position < v->length) ? v->contents[position] : NULL;
|
37
51
|
}
|
38
52
|
|
53
|
+
GIT_INLINE(const void *) git_vector_get_const(const git_vector *v, unsigned int position)
|
54
|
+
{
|
55
|
+
return (position < v->length) ? v->contents[position] : NULL;
|
56
|
+
}
|
57
|
+
|
58
|
+
#define GIT_VECTOR_GET(V,I) ((I) < (V)->length ? (V)->contents[(I)] : NULL)
|
59
|
+
|
60
|
+
GIT_INLINE(void *) git_vector_last(git_vector *v)
|
61
|
+
{
|
62
|
+
return (v->length > 0) ? git_vector_get(v, v->length - 1) : NULL;
|
63
|
+
}
|
64
|
+
|
39
65
|
#define git_vector_foreach(v, iter, elem) \
|
40
66
|
for ((iter) = 0; (iter) < (v)->length && ((elem) = (v)->contents[(iter)], 1); (iter)++ )
|
41
67
|
|
68
|
+
#define git_vector_rforeach(v, iter, elem) \
|
69
|
+
for ((iter) = (v)->length; (iter) > 0 && ((elem) = (v)->contents[(iter)-1], 1); (iter)-- )
|
70
|
+
|
42
71
|
int git_vector_insert(git_vector *v, void *element);
|
72
|
+
int git_vector_insert_sorted(git_vector *v, void *element,
|
73
|
+
int (*on_dup)(void **old, void *new));
|
43
74
|
int git_vector_remove(git_vector *v, unsigned int idx);
|
75
|
+
void git_vector_pop(git_vector *v);
|
44
76
|
void git_vector_uniq(git_vector *v);
|
77
|
+
|
45
78
|
#endif
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/*
|
2
|
-
* Copyright (C) 2009-
|
2
|
+
* Copyright (C) 2009-2012 the libgit2 contributors
|
3
3
|
*
|
4
4
|
* This file is part of libgit2, distributed under the GNU GPL v2 with
|
5
5
|
* a Linking Exception. For full terms see the included COPYING file.
|
@@ -27,8 +27,8 @@ static int init_filter(char *filter, size_t n, const char *dir)
|
|
27
27
|
git__DIR *git__opendir(const char *dir)
|
28
28
|
{
|
29
29
|
char filter[4096];
|
30
|
-
wchar_t* filter_w;
|
31
|
-
git__DIR *new;
|
30
|
+
wchar_t* filter_w = NULL;
|
31
|
+
git__DIR *new = NULL;
|
32
32
|
|
33
33
|
if (!dir || !init_filter(filter, sizeof(filter), dir))
|
34
34
|
return NULL;
|
@@ -37,46 +37,78 @@ git__DIR *git__opendir(const char *dir)
|
|
37
37
|
if (!new)
|
38
38
|
return NULL;
|
39
39
|
|
40
|
-
new->dir =
|
41
|
-
if (!new->dir)
|
42
|
-
|
43
|
-
return NULL;
|
44
|
-
}
|
45
|
-
strcpy(new->dir, dir);
|
40
|
+
new->dir = git__strdup(dir);
|
41
|
+
if (!new->dir)
|
42
|
+
goto fail;
|
46
43
|
|
47
44
|
filter_w = gitwin_to_utf16(filter);
|
45
|
+
if (!filter_w)
|
46
|
+
goto fail;
|
47
|
+
|
48
48
|
new->h = FindFirstFileW(filter_w, &new->f);
|
49
49
|
git__free(filter_w);
|
50
50
|
|
51
51
|
if (new->h == INVALID_HANDLE_VALUE) {
|
52
|
-
|
53
|
-
|
54
|
-
return NULL;
|
52
|
+
giterr_set(GITERR_OS, "Could not open directory '%s'", dir);
|
53
|
+
goto fail;
|
55
54
|
}
|
56
|
-
new->first = 1;
|
57
55
|
|
56
|
+
new->first = 1;
|
58
57
|
return new;
|
58
|
+
|
59
|
+
fail:
|
60
|
+
git__free(new->dir);
|
61
|
+
git__free(new);
|
62
|
+
return NULL;
|
59
63
|
}
|
60
64
|
|
61
|
-
|
65
|
+
int git__readdir_ext(
|
66
|
+
git__DIR *d,
|
67
|
+
struct git__dirent *entry,
|
68
|
+
struct git__dirent **result,
|
69
|
+
int *is_dir)
|
62
70
|
{
|
63
|
-
if (!d || d->h == INVALID_HANDLE_VALUE)
|
64
|
-
return
|
71
|
+
if (!d || !entry || !result || d->h == INVALID_HANDLE_VALUE)
|
72
|
+
return -1;
|
73
|
+
|
74
|
+
*result = NULL;
|
65
75
|
|
66
76
|
if (d->first)
|
67
77
|
d->first = 0;
|
68
|
-
else {
|
69
|
-
if (
|
70
|
-
return
|
78
|
+
else if (!FindNextFileW(d->h, &d->f)) {
|
79
|
+
if (GetLastError() == ERROR_NO_MORE_FILES)
|
80
|
+
return 0;
|
81
|
+
giterr_set(GITERR_OS, "Could not read from directory '%s'", d->dir);
|
82
|
+
return -1;
|
71
83
|
}
|
72
84
|
|
73
|
-
if (wcslen(d->f.cFileName) >= sizeof(
|
74
|
-
return
|
85
|
+
if (wcslen(d->f.cFileName) >= sizeof(entry->d_name))
|
86
|
+
return -1;
|
87
|
+
|
88
|
+
entry->d_ino = 0;
|
89
|
+
|
90
|
+
if (WideCharToMultiByte(
|
91
|
+
gitwin_get_codepage(), 0, d->f.cFileName, -1,
|
92
|
+
entry->d_name, GIT_PATH_MAX, NULL, NULL) == 0)
|
93
|
+
{
|
94
|
+
giterr_set(GITERR_OS, "Could not convert filename to UTF-8");
|
95
|
+
return -1;
|
96
|
+
}
|
75
97
|
|
76
|
-
|
77
|
-
WideCharToMultiByte(gitwin_get_codepage(), 0, d->f.cFileName, -1, d->entry.d_name, GIT_PATH_MAX, NULL, NULL);
|
98
|
+
*result = entry;
|
78
99
|
|
79
|
-
|
100
|
+
if (is_dir != NULL)
|
101
|
+
*is_dir = ((d->f.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0);
|
102
|
+
|
103
|
+
return 0;
|
104
|
+
}
|
105
|
+
|
106
|
+
struct git__dirent *git__readdir(git__DIR *d)
|
107
|
+
{
|
108
|
+
struct git__dirent *result;
|
109
|
+
if (git__readdir_ext(d, &d->entry, &result, NULL) < 0)
|
110
|
+
return NULL;
|
111
|
+
return result;
|
80
112
|
}
|
81
113
|
|
82
114
|
void git__rewinddir(git__DIR *d)
|
@@ -84,32 +116,40 @@ void git__rewinddir(git__DIR *d)
|
|
84
116
|
char filter[4096];
|
85
117
|
wchar_t* filter_w;
|
86
118
|
|
87
|
-
if (d)
|
88
|
-
|
89
|
-
|
119
|
+
if (!d)
|
120
|
+
return;
|
121
|
+
|
122
|
+
if (d->h != INVALID_HANDLE_VALUE) {
|
123
|
+
FindClose(d->h);
|
90
124
|
d->h = INVALID_HANDLE_VALUE;
|
91
125
|
d->first = 0;
|
126
|
+
}
|
92
127
|
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
git__free(filter_w);
|
128
|
+
if (!init_filter(filter, sizeof(filter), d->dir) ||
|
129
|
+
(filter_w = gitwin_to_utf16(filter)) == NULL)
|
130
|
+
return;
|
97
131
|
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
132
|
+
d->h = FindFirstFileW(filter_w, &d->f);
|
133
|
+
git__free(filter_w);
|
134
|
+
|
135
|
+
if (d->h == INVALID_HANDLE_VALUE)
|
136
|
+
giterr_set(GITERR_OS, "Could not open directory '%s'", d->dir);
|
137
|
+
else
|
138
|
+
d->first = 1;
|
102
139
|
}
|
103
140
|
|
104
141
|
int git__closedir(git__DIR *d)
|
105
142
|
{
|
106
|
-
if (d)
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
143
|
+
if (!d)
|
144
|
+
return 0;
|
145
|
+
|
146
|
+
if (d->h != INVALID_HANDLE_VALUE) {
|
147
|
+
FindClose(d->h);
|
148
|
+
d->h = INVALID_HANDLE_VALUE;
|
112
149
|
}
|
150
|
+
git__free(d->dir);
|
151
|
+
d->dir = NULL;
|
152
|
+
git__free(d);
|
113
153
|
return 0;
|
114
154
|
}
|
115
155
|
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/*
|
2
|
-
* Copyright (C) 2009-
|
2
|
+
* Copyright (C) 2009-2012 the libgit2 contributors
|
3
3
|
*
|
4
4
|
* This file is part of libgit2, distributed under the GNU GPL v2 with
|
5
5
|
* a Linking Exception. For full terms see the included COPYING file.
|
@@ -9,12 +9,6 @@
|
|
9
9
|
|
10
10
|
#include "common.h"
|
11
11
|
|
12
|
-
#ifndef GIT_WIN32
|
13
|
-
# include <dirent.h>
|
14
|
-
#endif
|
15
|
-
|
16
|
-
#ifdef GIT_WIN32
|
17
|
-
|
18
12
|
struct git__dirent {
|
19
13
|
int d_ino;
|
20
14
|
char d_name[261];
|
@@ -30,6 +24,8 @@ typedef struct {
|
|
30
24
|
|
31
25
|
extern git__DIR *git__opendir(const char *);
|
32
26
|
extern struct git__dirent *git__readdir(git__DIR *);
|
27
|
+
extern int git__readdir_ext(
|
28
|
+
git__DIR *, struct git__dirent *, struct git__dirent **, int *);
|
33
29
|
extern void git__rewinddir(git__DIR *);
|
34
30
|
extern int git__closedir(git__DIR *);
|
35
31
|
|
@@ -38,10 +34,9 @@ extern int git__closedir(git__DIR *);
|
|
38
34
|
# define DIR git__DIR
|
39
35
|
# define opendir git__opendir
|
40
36
|
# define readdir git__readdir
|
37
|
+
# define readdir_r(d,e,r) git__readdir_ext((d),(e),(r),NULL)
|
41
38
|
# define rewinddir git__rewinddir
|
42
39
|
# define closedir git__closedir
|
43
40
|
# endif
|
44
41
|
|
45
|
-
#endif
|
46
|
-
|
47
42
|
#endif /* INCLUDE_dir_h__ */
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/*
|
2
|
-
* Copyright (C) 2009-
|
2
|
+
* Copyright (C) 2009-2012 the libgit2 contributors
|
3
3
|
*
|
4
4
|
* This file is part of libgit2, distributed under the GNU GPL v2 with
|
5
5
|
* a Linking Exception. For full terms see the included COPYING file.
|
@@ -33,12 +33,7 @@ int p_mmap(git_map *out, size_t len, int prot, int flags, int fd, git_off_t offs
|
|
33
33
|
git_off_t page_start;
|
34
34
|
git_off_t page_offset;
|
35
35
|
|
36
|
-
|
37
|
-
|
38
|
-
if ((out == NULL) || (len == 0)) {
|
39
|
-
errno = EINVAL;
|
40
|
-
return git__throw(GIT_ERROR, "Failed to mmap. No map or zero length");
|
41
|
-
}
|
36
|
+
GIT_MMAP_VALIDATE(out, len, prot, flags);
|
42
37
|
|
43
38
|
out->data = NULL;
|
44
39
|
out->len = 0;
|
@@ -46,86 +41,75 @@ int p_mmap(git_map *out, size_t len, int prot, int flags, int fd, git_off_t offs
|
|
46
41
|
|
47
42
|
if (fh == INVALID_HANDLE_VALUE) {
|
48
43
|
errno = EBADF;
|
49
|
-
|
44
|
+
giterr_set(GITERR_OS, "Failed to mmap. Invalid handle value");
|
45
|
+
return -1;
|
50
46
|
}
|
51
47
|
|
52
48
|
if (prot & GIT_PROT_WRITE)
|
53
49
|
fmap_prot |= PAGE_READWRITE;
|
54
50
|
else if (prot & GIT_PROT_READ)
|
55
51
|
fmap_prot |= PAGE_READONLY;
|
56
|
-
else {
|
57
|
-
errno = EINVAL;
|
58
|
-
return git__throw(GIT_ERROR, "Failed to mmap. Invalid protection parameters");
|
59
|
-
}
|
60
52
|
|
61
53
|
if (prot & GIT_PROT_WRITE)
|
62
54
|
view_prot |= FILE_MAP_WRITE;
|
63
55
|
if (prot & GIT_PROT_READ)
|
64
56
|
view_prot |= FILE_MAP_READ;
|
65
57
|
|
66
|
-
if (flags & GIT_MAP_FIXED) {
|
67
|
-
errno = EINVAL;
|
68
|
-
return git__throw(GIT_ERROR, "Failed to mmap. FIXED not set");
|
69
|
-
}
|
70
|
-
|
71
58
|
page_start = (offset / page_size) * page_size;
|
72
59
|
page_offset = offset - page_start;
|
73
60
|
|
74
61
|
if (page_offset != 0) { /* offset must be multiple of page size */
|
75
62
|
errno = EINVAL;
|
76
|
-
|
63
|
+
giterr_set(GITERR_OS, "Failed to mmap. Offset must be multiple of page size");
|
64
|
+
return -1;
|
77
65
|
}
|
78
66
|
|
79
67
|
out->fmh = CreateFileMapping(fh, NULL, fmap_prot, 0, 0, NULL);
|
80
68
|
if (!out->fmh || out->fmh == INVALID_HANDLE_VALUE) {
|
81
|
-
|
69
|
+
giterr_set(GITERR_OS, "Failed to mmap. Invalid handle value");
|
82
70
|
out->fmh = NULL;
|
83
|
-
return
|
71
|
+
return -1;
|
84
72
|
}
|
85
73
|
|
86
74
|
assert(sizeof(git_off_t) == 8);
|
75
|
+
|
87
76
|
off_low = (DWORD)(page_start);
|
88
77
|
off_hi = (DWORD)(page_start >> 32);
|
89
78
|
out->data = MapViewOfFile(out->fmh, view_prot, off_hi, off_low, len);
|
90
79
|
if (!out->data) {
|
91
|
-
|
80
|
+
giterr_set(GITERR_OS, "Failed to mmap. No data written");
|
92
81
|
CloseHandle(out->fmh);
|
93
82
|
out->fmh = NULL;
|
94
|
-
return
|
83
|
+
return -1;
|
95
84
|
}
|
96
85
|
out->len = len;
|
97
86
|
|
98
|
-
return
|
87
|
+
return 0;
|
99
88
|
}
|
100
89
|
|
101
90
|
int p_munmap(git_map *map)
|
102
91
|
{
|
103
|
-
|
92
|
+
int error = 0;
|
104
93
|
|
105
|
-
|
106
|
-
return git__throw(GIT_ERROR, "Failed to munmap. Map does not exist");
|
94
|
+
assert(map != NULL);
|
107
95
|
|
108
96
|
if (map->data) {
|
109
97
|
if (!UnmapViewOfFile(map->data)) {
|
110
|
-
|
111
|
-
|
112
|
-
map->data = NULL;
|
113
|
-
map->fmh = NULL;
|
114
|
-
return git__throw(GIT_ERROR, "Failed to munmap. Could not unmap view of file");
|
98
|
+
giterr_set(GITERR_OS, "Failed to munmap. Could not unmap view of file");
|
99
|
+
error = -1;
|
115
100
|
}
|
116
101
|
map->data = NULL;
|
117
102
|
}
|
118
103
|
|
119
104
|
if (map->fmh) {
|
120
105
|
if (!CloseHandle(map->fmh)) {
|
121
|
-
|
122
|
-
|
123
|
-
return git__throw(GIT_ERROR, "Failed to munmap. Could not close handle");
|
106
|
+
giterr_set(GITERR_OS, "Failed to munmap. Could not close handle");
|
107
|
+
error = -1;
|
124
108
|
}
|
125
109
|
map->fmh = NULL;
|
126
110
|
}
|
127
111
|
|
128
|
-
return
|
112
|
+
return error;
|
129
113
|
}
|
130
114
|
|
131
115
|
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/*
|
2
|
-
* Copyright (C) 2009-
|
2
|
+
* Copyright (C) 2009-2012 the libgit2 contributors
|
3
3
|
*
|
4
4
|
* This file is part of libgit2, distributed under the GNU GPL v2 with
|
5
5
|
* a Linking Exception. For full terms see the included COPYING file.
|
@@ -21,6 +21,7 @@
|
|
21
21
|
/* stat: file mode type testing macros */
|
22
22
|
# define _S_IFLNK 0120000
|
23
23
|
# define S_IFLNK _S_IFLNK
|
24
|
+
# define S_IXUSR 00100
|
24
25
|
|
25
26
|
# define S_ISDIR(m) (((m) & _S_IFMT) == _S_IFDIR)
|
26
27
|
# define S_ISREG(m) (((m) & _S_IFMT) == _S_IFREG)
|
@@ -33,6 +34,9 @@
|
|
33
34
|
# define strcasecmp _stricmp
|
34
35
|
# define strncasecmp _strnicmp
|
35
36
|
|
37
|
+
/* MSVC doesn't define ssize_t at all */
|
38
|
+
typedef SSIZE_T ssize_t;
|
39
|
+
|
36
40
|
#endif
|
37
41
|
|
38
42
|
#endif /* INCLUDE_msvc_compat__ */
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/*
|
2
|
-
* Copyright (C) 2009-
|
2
|
+
* Copyright (C) 2009-2012 the libgit2 contributors
|
3
3
|
*
|
4
4
|
* This file is part of libgit2, distributed under the GNU GPL v2 with
|
5
5
|
* a Linking Exception. For full terms see the included COPYING file.
|
@@ -8,23 +8,23 @@
|
|
8
8
|
#define INCLUDE_posix__w32_h__
|
9
9
|
|
10
10
|
#include "common.h"
|
11
|
-
#include "fnmatch.h"
|
11
|
+
#include "compat/fnmatch.h"
|
12
12
|
#include "utf-conv.h"
|
13
13
|
|
14
|
-
GIT_INLINE(int) p_link(const char *
|
14
|
+
GIT_INLINE(int) p_link(const char *old, const char *new)
|
15
15
|
{
|
16
|
-
|
17
|
-
|
16
|
+
GIT_UNUSED(old);
|
17
|
+
GIT_UNUSED(new);
|
18
18
|
errno = ENOSYS;
|
19
19
|
return -1;
|
20
20
|
}
|
21
21
|
|
22
|
-
GIT_INLINE(int) p_mkdir(const char *path, mode_t
|
22
|
+
GIT_INLINE(int) p_mkdir(const char *path, mode_t mode)
|
23
23
|
{
|
24
24
|
wchar_t* buf = gitwin_to_utf16(path);
|
25
25
|
int ret = _wmkdir(buf);
|
26
26
|
|
27
|
-
|
27
|
+
GIT_UNUSED(mode);
|
28
28
|
|
29
29
|
git__free(buf);
|
30
30
|
return ret;
|
@@ -45,9 +45,11 @@ extern int p_chmod(const char* path, mode_t mode);
|
|
45
45
|
extern int p_rmdir(const char* path);
|
46
46
|
extern int p_access(const char* path, mode_t mode);
|
47
47
|
extern int p_fsync(int fd);
|
48
|
-
extern int p_open(const char *path, int flags);
|
48
|
+
extern int p_open(const char *path, int flags, ...);
|
49
49
|
extern int p_creat(const char *path, mode_t mode);
|
50
50
|
extern int p_getcwd(char *buffer_out, size_t size);
|
51
51
|
extern int p_rename(const char *from, const char *to);
|
52
|
+
extern int p_recv(GIT_SOCKET socket, void *buffer, size_t length, int flags);
|
53
|
+
extern int p_send(GIT_SOCKET socket, const void *buffer, size_t length, int flags);
|
52
54
|
|
53
55
|
#endif
|