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
@@ -0,0 +1,649 @@
|
|
1
|
+
#include "clar_libgit2.h"
|
2
|
+
#include "fileops.h"
|
3
|
+
#include "ignore.h"
|
4
|
+
#include "status_data.h"
|
5
|
+
#include "posix.h"
|
6
|
+
#include "util.h"
|
7
|
+
#include "path.h"
|
8
|
+
|
9
|
+
/**
|
10
|
+
* Initializer
|
11
|
+
*
|
12
|
+
* Not all of the tests in this file use the same fixtures, so we allow each
|
13
|
+
* test to load their fixture at the top of the test function.
|
14
|
+
*/
|
15
|
+
void test_status_worktree__initialize(void)
|
16
|
+
{
|
17
|
+
}
|
18
|
+
|
19
|
+
/**
|
20
|
+
* Cleanup
|
21
|
+
*
|
22
|
+
* This will be called once after each test finishes, even
|
23
|
+
* if the test failed
|
24
|
+
*/
|
25
|
+
void test_status_worktree__cleanup(void)
|
26
|
+
{
|
27
|
+
cl_git_sandbox_cleanup();
|
28
|
+
}
|
29
|
+
|
30
|
+
/**
|
31
|
+
* Tests - Status determination on a working tree
|
32
|
+
*/
|
33
|
+
/* this test is equivalent to t18-status.c:statuscb0 */
|
34
|
+
void test_status_worktree__whole_repository(void)
|
35
|
+
{
|
36
|
+
status_entry_counts counts;
|
37
|
+
git_repository *repo = cl_git_sandbox_init("status");
|
38
|
+
|
39
|
+
memset(&counts, 0x0, sizeof(status_entry_counts));
|
40
|
+
counts.expected_entry_count = entry_count0;
|
41
|
+
counts.expected_paths = entry_paths0;
|
42
|
+
counts.expected_statuses = entry_statuses0;
|
43
|
+
|
44
|
+
cl_git_pass(
|
45
|
+
git_status_foreach(repo, cb_status__normal, &counts)
|
46
|
+
);
|
47
|
+
|
48
|
+
cl_assert_equal_i(counts.expected_entry_count, counts.entry_count);
|
49
|
+
cl_assert_equal_i(0, counts.wrong_status_flags_count);
|
50
|
+
cl_assert_equal_i(0, counts.wrong_sorted_path);
|
51
|
+
}
|
52
|
+
|
53
|
+
/* this test is equivalent to t18-status.c:statuscb1 */
|
54
|
+
void test_status_worktree__empty_repository(void)
|
55
|
+
{
|
56
|
+
int count = 0;
|
57
|
+
git_repository *repo = cl_git_sandbox_init("empty_standard_repo");
|
58
|
+
|
59
|
+
cl_git_pass(git_status_foreach(repo, cb_status__count, &count));
|
60
|
+
|
61
|
+
cl_assert_equal_i(0, count);
|
62
|
+
}
|
63
|
+
|
64
|
+
static int remove_file_cb(void *data, git_buf *file)
|
65
|
+
{
|
66
|
+
const char *filename = git_buf_cstr(file);
|
67
|
+
|
68
|
+
GIT_UNUSED(data);
|
69
|
+
|
70
|
+
if (git__suffixcmp(filename, ".git") == 0)
|
71
|
+
return 0;
|
72
|
+
|
73
|
+
if (git_path_isdir(filename))
|
74
|
+
cl_git_pass(git_futils_rmdir_r(filename, GIT_DIRREMOVAL_FILES_AND_DIRS));
|
75
|
+
else
|
76
|
+
cl_git_pass(p_unlink(git_buf_cstr(file)));
|
77
|
+
|
78
|
+
return 0;
|
79
|
+
}
|
80
|
+
|
81
|
+
/* this test is equivalent to t18-status.c:statuscb2 */
|
82
|
+
void test_status_worktree__purged_worktree(void)
|
83
|
+
{
|
84
|
+
status_entry_counts counts;
|
85
|
+
git_repository *repo = cl_git_sandbox_init("status");
|
86
|
+
git_buf workdir = GIT_BUF_INIT;
|
87
|
+
|
88
|
+
/* first purge the contents of the worktree */
|
89
|
+
cl_git_pass(git_buf_sets(&workdir, git_repository_workdir(repo)));
|
90
|
+
cl_git_pass(git_path_direach(&workdir, remove_file_cb, NULL));
|
91
|
+
git_buf_free(&workdir);
|
92
|
+
|
93
|
+
/* now get status */
|
94
|
+
memset(&counts, 0x0, sizeof(status_entry_counts));
|
95
|
+
counts.expected_entry_count = entry_count2;
|
96
|
+
counts.expected_paths = entry_paths2;
|
97
|
+
counts.expected_statuses = entry_statuses2;
|
98
|
+
|
99
|
+
cl_git_pass(
|
100
|
+
git_status_foreach(repo, cb_status__normal, &counts)
|
101
|
+
);
|
102
|
+
|
103
|
+
cl_assert_equal_i(counts.expected_entry_count, counts.entry_count);
|
104
|
+
cl_assert_equal_i(0, counts.wrong_status_flags_count);
|
105
|
+
cl_assert_equal_i(0, counts.wrong_sorted_path);
|
106
|
+
}
|
107
|
+
|
108
|
+
/* this test is similar to t18-status.c:statuscb3 */
|
109
|
+
void test_status_worktree__swap_subdir_and_file(void)
|
110
|
+
{
|
111
|
+
status_entry_counts counts;
|
112
|
+
git_repository *repo = cl_git_sandbox_init("status");
|
113
|
+
git_status_options opts;
|
114
|
+
|
115
|
+
/* first alter the contents of the worktree */
|
116
|
+
cl_git_pass(p_rename("status/current_file", "status/swap"));
|
117
|
+
cl_git_pass(p_rename("status/subdir", "status/current_file"));
|
118
|
+
cl_git_pass(p_rename("status/swap", "status/subdir"));
|
119
|
+
|
120
|
+
cl_git_mkfile("status/.HEADER", "dummy");
|
121
|
+
cl_git_mkfile("status/42-is-not-prime.sigh", "dummy");
|
122
|
+
cl_git_mkfile("status/README.md", "dummy");
|
123
|
+
|
124
|
+
/* now get status */
|
125
|
+
memset(&counts, 0x0, sizeof(status_entry_counts));
|
126
|
+
counts.expected_entry_count = entry_count3;
|
127
|
+
counts.expected_paths = entry_paths3;
|
128
|
+
counts.expected_statuses = entry_statuses3;
|
129
|
+
|
130
|
+
memset(&opts, 0, sizeof(opts));
|
131
|
+
opts.flags = GIT_STATUS_OPT_INCLUDE_UNTRACKED |
|
132
|
+
GIT_STATUS_OPT_INCLUDE_IGNORED;
|
133
|
+
|
134
|
+
cl_git_pass(
|
135
|
+
git_status_foreach_ext(repo, &opts, cb_status__normal, &counts)
|
136
|
+
);
|
137
|
+
|
138
|
+
cl_assert_equal_i(counts.expected_entry_count, counts.entry_count);
|
139
|
+
cl_assert_equal_i(0, counts.wrong_status_flags_count);
|
140
|
+
cl_assert_equal_i(0, counts.wrong_sorted_path);
|
141
|
+
}
|
142
|
+
|
143
|
+
void test_status_worktree__swap_subdir_with_recurse_and_pathspec(void)
|
144
|
+
{
|
145
|
+
status_entry_counts counts;
|
146
|
+
git_repository *repo = cl_git_sandbox_init("status");
|
147
|
+
git_status_options opts;
|
148
|
+
|
149
|
+
/* first alter the contents of the worktree */
|
150
|
+
cl_git_pass(p_rename("status/current_file", "status/swap"));
|
151
|
+
cl_git_pass(p_rename("status/subdir", "status/current_file"));
|
152
|
+
cl_git_pass(p_rename("status/swap", "status/subdir"));
|
153
|
+
cl_git_mkfile("status/.new_file", "dummy");
|
154
|
+
cl_git_pass(git_futils_mkdir_r("status/zzz_new_dir", NULL, 0777));
|
155
|
+
cl_git_mkfile("status/zzz_new_dir/new_file", "dummy");
|
156
|
+
cl_git_mkfile("status/zzz_new_file", "dummy");
|
157
|
+
|
158
|
+
/* now get status */
|
159
|
+
memset(&counts, 0x0, sizeof(status_entry_counts));
|
160
|
+
counts.expected_entry_count = entry_count4;
|
161
|
+
counts.expected_paths = entry_paths4;
|
162
|
+
counts.expected_statuses = entry_statuses4;
|
163
|
+
|
164
|
+
memset(&opts, 0, sizeof(opts));
|
165
|
+
opts.flags = GIT_STATUS_OPT_INCLUDE_UNTRACKED |
|
166
|
+
GIT_STATUS_OPT_RECURSE_UNTRACKED_DIRS;
|
167
|
+
/* TODO: set pathspec to "current_file" eventually */
|
168
|
+
|
169
|
+
cl_git_pass(
|
170
|
+
git_status_foreach_ext(repo, &opts, cb_status__normal, &counts)
|
171
|
+
);
|
172
|
+
|
173
|
+
cl_assert_equal_i(counts.expected_entry_count, counts.entry_count);
|
174
|
+
cl_assert_equal_i(0, counts.wrong_status_flags_count);
|
175
|
+
cl_assert_equal_i(0, counts.wrong_sorted_path);
|
176
|
+
}
|
177
|
+
|
178
|
+
/* this test is equivalent to t18-status.c:singlestatus0 */
|
179
|
+
void test_status_worktree__single_file(void)
|
180
|
+
{
|
181
|
+
int i;
|
182
|
+
unsigned int status_flags;
|
183
|
+
git_repository *repo = cl_git_sandbox_init("status");
|
184
|
+
|
185
|
+
for (i = 0; i < (int)entry_count0; i++) {
|
186
|
+
cl_git_pass(
|
187
|
+
git_status_file(&status_flags, repo, entry_paths0[i])
|
188
|
+
);
|
189
|
+
cl_assert(entry_statuses0[i] == status_flags);
|
190
|
+
}
|
191
|
+
}
|
192
|
+
|
193
|
+
/* this test is equivalent to t18-status.c:singlestatus1 */
|
194
|
+
void test_status_worktree__single_nonexistent_file(void)
|
195
|
+
{
|
196
|
+
int error;
|
197
|
+
unsigned int status_flags;
|
198
|
+
git_repository *repo = cl_git_sandbox_init("status");
|
199
|
+
|
200
|
+
error = git_status_file(&status_flags, repo, "nonexistent");
|
201
|
+
cl_git_fail(error);
|
202
|
+
cl_assert(error == GIT_ENOTFOUND);
|
203
|
+
}
|
204
|
+
|
205
|
+
/* this test is equivalent to t18-status.c:singlestatus2 */
|
206
|
+
void test_status_worktree__single_nonexistent_file_empty_repo(void)
|
207
|
+
{
|
208
|
+
int error;
|
209
|
+
unsigned int status_flags;
|
210
|
+
git_repository *repo = cl_git_sandbox_init("empty_standard_repo");
|
211
|
+
|
212
|
+
error = git_status_file(&status_flags, repo, "nonexistent");
|
213
|
+
cl_git_fail(error);
|
214
|
+
cl_assert(error == GIT_ENOTFOUND);
|
215
|
+
}
|
216
|
+
|
217
|
+
/* this test is equivalent to t18-status.c:singlestatus3 */
|
218
|
+
void test_status_worktree__single_file_empty_repo(void)
|
219
|
+
{
|
220
|
+
unsigned int status_flags;
|
221
|
+
git_repository *repo = cl_git_sandbox_init("empty_standard_repo");
|
222
|
+
|
223
|
+
cl_git_mkfile("empty_standard_repo/new_file", "new_file\n");
|
224
|
+
|
225
|
+
cl_git_pass(git_status_file(&status_flags, repo, "new_file"));
|
226
|
+
cl_assert(status_flags == GIT_STATUS_WT_NEW);
|
227
|
+
}
|
228
|
+
|
229
|
+
/* this test is equivalent to t18-status.c:singlestatus4 */
|
230
|
+
void test_status_worktree__single_folder(void)
|
231
|
+
{
|
232
|
+
int error;
|
233
|
+
unsigned int status_flags;
|
234
|
+
git_repository *repo = cl_git_sandbox_init("status");
|
235
|
+
|
236
|
+
error = git_status_file(&status_flags, repo, "subdir");
|
237
|
+
cl_git_fail(error);
|
238
|
+
cl_assert(error != GIT_ENOTFOUND);
|
239
|
+
}
|
240
|
+
|
241
|
+
|
242
|
+
void test_status_worktree__ignores(void)
|
243
|
+
{
|
244
|
+
int i, ignored;
|
245
|
+
git_repository *repo = cl_git_sandbox_init("status");
|
246
|
+
|
247
|
+
for (i = 0; i < (int)entry_count0; i++) {
|
248
|
+
cl_git_pass(
|
249
|
+
git_status_should_ignore(&ignored, repo, entry_paths0[i])
|
250
|
+
);
|
251
|
+
cl_assert(ignored == (entry_statuses0[i] == GIT_STATUS_IGNORED));
|
252
|
+
}
|
253
|
+
|
254
|
+
cl_git_pass(
|
255
|
+
git_status_should_ignore(&ignored, repo, "nonexistent_file")
|
256
|
+
);
|
257
|
+
cl_assert(!ignored);
|
258
|
+
|
259
|
+
cl_git_pass(
|
260
|
+
git_status_should_ignore(&ignored, repo, "ignored_nonexistent_file")
|
261
|
+
);
|
262
|
+
cl_assert(ignored);
|
263
|
+
}
|
264
|
+
|
265
|
+
static int cb_status__check_592(const char *p, unsigned int s, void *payload)
|
266
|
+
{
|
267
|
+
GIT_UNUSED(payload);
|
268
|
+
|
269
|
+
if (s != GIT_STATUS_WT_DELETED || (payload != NULL && strcmp(p, (const char *)payload) != 0))
|
270
|
+
return -1;
|
271
|
+
|
272
|
+
return 0;
|
273
|
+
}
|
274
|
+
|
275
|
+
void test_status_worktree__issue_592(void)
|
276
|
+
{
|
277
|
+
git_repository *repo;
|
278
|
+
git_buf path = GIT_BUF_INIT;
|
279
|
+
|
280
|
+
repo = cl_git_sandbox_init("issue_592");
|
281
|
+
cl_git_pass(git_buf_joinpath(&path, git_repository_workdir(repo), "l.txt"));
|
282
|
+
cl_git_pass(p_unlink(git_buf_cstr(&path)));
|
283
|
+
|
284
|
+
cl_git_pass(git_status_foreach(repo, cb_status__check_592, "l.txt"));
|
285
|
+
|
286
|
+
git_buf_free(&path);
|
287
|
+
}
|
288
|
+
|
289
|
+
void test_status_worktree__issue_592_2(void)
|
290
|
+
{
|
291
|
+
git_repository *repo;
|
292
|
+
git_buf path = GIT_BUF_INIT;
|
293
|
+
|
294
|
+
repo = cl_git_sandbox_init("issue_592");
|
295
|
+
cl_git_pass(git_buf_joinpath(&path, git_repository_workdir(repo), "c/a.txt"));
|
296
|
+
cl_git_pass(p_unlink(git_buf_cstr(&path)));
|
297
|
+
|
298
|
+
cl_git_pass(git_status_foreach(repo, cb_status__check_592, "c/a.txt"));
|
299
|
+
|
300
|
+
git_buf_free(&path);
|
301
|
+
}
|
302
|
+
|
303
|
+
void test_status_worktree__issue_592_3(void)
|
304
|
+
{
|
305
|
+
git_repository *repo;
|
306
|
+
git_buf path = GIT_BUF_INIT;
|
307
|
+
|
308
|
+
repo = cl_git_sandbox_init("issue_592");
|
309
|
+
|
310
|
+
cl_git_pass(git_buf_joinpath(&path, git_repository_workdir(repo), "c"));
|
311
|
+
cl_git_pass(git_futils_rmdir_r(git_buf_cstr(&path), GIT_DIRREMOVAL_FILES_AND_DIRS));
|
312
|
+
|
313
|
+
cl_git_pass(git_status_foreach(repo, cb_status__check_592, "c/a.txt"));
|
314
|
+
|
315
|
+
git_buf_free(&path);
|
316
|
+
}
|
317
|
+
|
318
|
+
void test_status_worktree__issue_592_4(void)
|
319
|
+
{
|
320
|
+
git_repository *repo;
|
321
|
+
git_buf path = GIT_BUF_INIT;
|
322
|
+
|
323
|
+
repo = cl_git_sandbox_init("issue_592");
|
324
|
+
|
325
|
+
cl_git_pass(git_buf_joinpath(&path, git_repository_workdir(repo), "t/b.txt"));
|
326
|
+
cl_git_pass(p_unlink(git_buf_cstr(&path)));
|
327
|
+
|
328
|
+
cl_git_pass(git_status_foreach(repo, cb_status__check_592, "t/b.txt"));
|
329
|
+
|
330
|
+
git_buf_free(&path);
|
331
|
+
}
|
332
|
+
|
333
|
+
void test_status_worktree__issue_592_5(void)
|
334
|
+
{
|
335
|
+
git_repository *repo;
|
336
|
+
git_buf path = GIT_BUF_INIT;
|
337
|
+
|
338
|
+
repo = cl_git_sandbox_init("issue_592");
|
339
|
+
|
340
|
+
cl_git_pass(git_buf_joinpath(&path, git_repository_workdir(repo), "t"));
|
341
|
+
cl_git_pass(git_futils_rmdir_r(git_buf_cstr(&path), GIT_DIRREMOVAL_FILES_AND_DIRS));
|
342
|
+
cl_git_pass(p_mkdir(git_buf_cstr(&path), 0777));
|
343
|
+
|
344
|
+
cl_git_pass(git_status_foreach(repo, cb_status__check_592, NULL));
|
345
|
+
|
346
|
+
git_buf_free(&path);
|
347
|
+
}
|
348
|
+
|
349
|
+
void test_status_worktree__issue_592_ignores_0(void)
|
350
|
+
{
|
351
|
+
int count = 0;
|
352
|
+
status_entry_single st;
|
353
|
+
git_repository *repo = cl_git_sandbox_init("issue_592");
|
354
|
+
|
355
|
+
cl_git_pass(git_status_foreach(repo, cb_status__count, &count));
|
356
|
+
cl_assert_equal_i(0, count);
|
357
|
+
|
358
|
+
cl_git_rewritefile("issue_592/.gitignore",
|
359
|
+
".gitignore\n*.txt\nc/\n[tT]*/\n");
|
360
|
+
|
361
|
+
cl_git_pass(git_status_foreach(repo, cb_status__count, &count));
|
362
|
+
cl_assert_equal_i(1, count);
|
363
|
+
|
364
|
+
/* This is a situation where the behavior of libgit2 is
|
365
|
+
* different from core git. Core git will show ignored.txt
|
366
|
+
* in the list of ignored files, even though the directory
|
367
|
+
* "t" is ignored and the file is untracked because we have
|
368
|
+
* the explicit "*.txt" ignore rule. Libgit2 just excludes
|
369
|
+
* all untracked files that are contained within ignored
|
370
|
+
* directories without explicitly listing them.
|
371
|
+
*/
|
372
|
+
cl_git_rewritefile("issue_592/t/ignored.txt", "ping");
|
373
|
+
|
374
|
+
memset(&st, 0, sizeof(st));
|
375
|
+
cl_git_pass(git_status_foreach(repo, cb_status__single, &st));
|
376
|
+
cl_assert_equal_i(1, st.count);
|
377
|
+
cl_assert(st.status == GIT_STATUS_IGNORED);
|
378
|
+
|
379
|
+
cl_git_rewritefile("issue_592/c/ignored_by_dir", "ping");
|
380
|
+
|
381
|
+
memset(&st, 0, sizeof(st));
|
382
|
+
cl_git_pass(git_status_foreach(repo, cb_status__single, &st));
|
383
|
+
cl_assert_equal_i(1, st.count);
|
384
|
+
cl_assert(st.status == GIT_STATUS_IGNORED);
|
385
|
+
|
386
|
+
cl_git_rewritefile("issue_592/t/ignored_by_dir_pattern", "ping");
|
387
|
+
|
388
|
+
memset(&st, 0, sizeof(st));
|
389
|
+
cl_git_pass(git_status_foreach(repo, cb_status__single, &st));
|
390
|
+
cl_assert_equal_i(1, st.count);
|
391
|
+
cl_assert(st.status == GIT_STATUS_IGNORED);
|
392
|
+
}
|
393
|
+
|
394
|
+
void test_status_worktree__issue_592_ignored_dirs_with_tracked_content(void)
|
395
|
+
{
|
396
|
+
int count = 0;
|
397
|
+
git_repository *repo = cl_git_sandbox_init("issue_592b");
|
398
|
+
|
399
|
+
cl_git_pass(git_status_foreach(repo, cb_status__count, &count));
|
400
|
+
cl_assert_equal_i(1, count);
|
401
|
+
|
402
|
+
/* if we are really mimicking core git, then only ignored1.txt
|
403
|
+
* at the top level will show up in the ignores list here.
|
404
|
+
* everything else will be unmodified or skipped completely.
|
405
|
+
*/
|
406
|
+
}
|
407
|
+
|
408
|
+
void test_status_worktree__cannot_retrieve_the_status_of_a_bare_repository(void)
|
409
|
+
{
|
410
|
+
git_repository *repo;
|
411
|
+
int error;
|
412
|
+
unsigned int status = 0;
|
413
|
+
|
414
|
+
cl_git_pass(git_repository_open(&repo, cl_fixture("testrepo.git")));
|
415
|
+
|
416
|
+
error = git_status_file(&status, repo, "dummy");
|
417
|
+
|
418
|
+
cl_git_fail(error);
|
419
|
+
cl_assert(error != GIT_ENOTFOUND);
|
420
|
+
|
421
|
+
git_repository_free(repo);
|
422
|
+
}
|
423
|
+
|
424
|
+
void test_status_worktree__first_commit_in_progress(void)
|
425
|
+
{
|
426
|
+
git_repository *repo;
|
427
|
+
git_index *index;
|
428
|
+
status_entry_single result;
|
429
|
+
|
430
|
+
cl_git_pass(git_repository_init(&repo, "getting_started", 0));
|
431
|
+
cl_git_mkfile("getting_started/testfile.txt", "content\n");
|
432
|
+
|
433
|
+
memset(&result, 0, sizeof(result));
|
434
|
+
cl_git_pass(git_status_foreach(repo, cb_status__single, &result));
|
435
|
+
cl_assert_equal_i(1, result.count);
|
436
|
+
cl_assert(result.status == GIT_STATUS_WT_NEW);
|
437
|
+
|
438
|
+
cl_git_pass(git_repository_index(&index, repo));
|
439
|
+
cl_git_pass(git_index_add(index, "testfile.txt", 0));
|
440
|
+
cl_git_pass(git_index_write(index));
|
441
|
+
|
442
|
+
memset(&result, 0, sizeof(result));
|
443
|
+
cl_git_pass(git_status_foreach(repo, cb_status__single, &result));
|
444
|
+
cl_assert_equal_i(1, result.count);
|
445
|
+
cl_assert(result.status == GIT_STATUS_INDEX_NEW);
|
446
|
+
|
447
|
+
git_index_free(index);
|
448
|
+
git_repository_free(repo);
|
449
|
+
}
|
450
|
+
|
451
|
+
|
452
|
+
|
453
|
+
void test_status_worktree__status_file_without_index_or_workdir(void)
|
454
|
+
{
|
455
|
+
git_repository *repo;
|
456
|
+
unsigned int status = 0;
|
457
|
+
git_index *index;
|
458
|
+
|
459
|
+
cl_git_pass(p_mkdir("wd", 0777));
|
460
|
+
|
461
|
+
cl_git_pass(git_repository_open(&repo, cl_fixture("testrepo.git")));
|
462
|
+
cl_git_pass(git_repository_set_workdir(repo, "wd"));
|
463
|
+
|
464
|
+
cl_git_pass(git_index_open(&index, "empty-index"));
|
465
|
+
cl_assert_equal_i(0, git_index_entrycount(index));
|
466
|
+
git_repository_set_index(repo, index);
|
467
|
+
|
468
|
+
cl_git_pass(git_status_file(&status, repo, "branch_file.txt"));
|
469
|
+
|
470
|
+
cl_assert_equal_i(GIT_STATUS_INDEX_DELETED, status);
|
471
|
+
|
472
|
+
git_repository_free(repo);
|
473
|
+
git_index_free(index);
|
474
|
+
cl_git_pass(p_rmdir("wd"));
|
475
|
+
}
|
476
|
+
|
477
|
+
static void fill_index_wth_head_entries(git_repository *repo, git_index *index)
|
478
|
+
{
|
479
|
+
git_oid oid;
|
480
|
+
git_commit *commit;
|
481
|
+
git_tree *tree;
|
482
|
+
|
483
|
+
cl_git_pass(git_reference_name_to_oid(&oid, repo, "HEAD"));
|
484
|
+
cl_git_pass(git_commit_lookup(&commit, repo, &oid));
|
485
|
+
cl_git_pass(git_commit_tree(&tree, commit));
|
486
|
+
|
487
|
+
cl_git_pass(git_index_read_tree(index, tree));
|
488
|
+
cl_git_pass(git_index_write(index));
|
489
|
+
|
490
|
+
git_tree_free(tree);
|
491
|
+
git_commit_free(commit);
|
492
|
+
}
|
493
|
+
|
494
|
+
void test_status_worktree__status_file_with_clean_index_and_empty_workdir(void)
|
495
|
+
{
|
496
|
+
git_repository *repo;
|
497
|
+
unsigned int status = 0;
|
498
|
+
git_index *index;
|
499
|
+
|
500
|
+
cl_git_pass(p_mkdir("wd", 0777));
|
501
|
+
|
502
|
+
cl_git_pass(git_repository_open(&repo, cl_fixture("testrepo.git")));
|
503
|
+
cl_git_pass(git_repository_set_workdir(repo, "wd"));
|
504
|
+
|
505
|
+
cl_git_pass(git_index_open(&index, "my-index"));
|
506
|
+
fill_index_wth_head_entries(repo, index);
|
507
|
+
|
508
|
+
git_repository_set_index(repo, index);
|
509
|
+
|
510
|
+
cl_git_pass(git_status_file(&status, repo, "branch_file.txt"));
|
511
|
+
|
512
|
+
cl_assert_equal_i(GIT_STATUS_WT_DELETED, status);
|
513
|
+
|
514
|
+
git_repository_free(repo);
|
515
|
+
git_index_free(index);
|
516
|
+
cl_git_pass(p_rmdir("wd"));
|
517
|
+
cl_git_pass(p_unlink("my-index"));
|
518
|
+
}
|
519
|
+
|
520
|
+
|
521
|
+
void test_status_worktree__space_in_filename(void)
|
522
|
+
{
|
523
|
+
git_repository *repo;
|
524
|
+
git_index *index;
|
525
|
+
status_entry_single result;
|
526
|
+
unsigned int status_flags;
|
527
|
+
|
528
|
+
#define FILE_WITH_SPACE "LICENSE - copy.md"
|
529
|
+
|
530
|
+
cl_git_pass(git_repository_init(&repo, "with_space", 0));
|
531
|
+
cl_git_mkfile("with_space/" FILE_WITH_SPACE, "I have a space in my name\n");
|
532
|
+
|
533
|
+
/* file is new to working directory */
|
534
|
+
|
535
|
+
memset(&result, 0, sizeof(result));
|
536
|
+
cl_git_pass(git_status_foreach(repo, cb_status__single, &result));
|
537
|
+
cl_assert_equal_i(1, result.count);
|
538
|
+
cl_assert(result.status == GIT_STATUS_WT_NEW);
|
539
|
+
|
540
|
+
cl_git_pass(git_status_file(&status_flags, repo, FILE_WITH_SPACE));
|
541
|
+
cl_assert(status_flags == GIT_STATUS_WT_NEW);
|
542
|
+
|
543
|
+
/* ignore the file */
|
544
|
+
|
545
|
+
cl_git_rewritefile("with_space/.gitignore", "*.md\n.gitignore\n");
|
546
|
+
|
547
|
+
memset(&result, 0, sizeof(result));
|
548
|
+
cl_git_pass(git_status_foreach(repo, cb_status__single, &result));
|
549
|
+
cl_assert_equal_i(2, result.count);
|
550
|
+
cl_assert(result.status == GIT_STATUS_IGNORED);
|
551
|
+
|
552
|
+
cl_git_pass(git_status_file(&status_flags, repo, FILE_WITH_SPACE));
|
553
|
+
cl_assert(status_flags == GIT_STATUS_IGNORED);
|
554
|
+
|
555
|
+
/* don't ignore the file */
|
556
|
+
|
557
|
+
cl_git_rewritefile("with_space/.gitignore", ".gitignore\n");
|
558
|
+
|
559
|
+
memset(&result, 0, sizeof(result));
|
560
|
+
cl_git_pass(git_status_foreach(repo, cb_status__single, &result));
|
561
|
+
cl_assert_equal_i(2, result.count);
|
562
|
+
cl_assert(result.status == GIT_STATUS_WT_NEW);
|
563
|
+
|
564
|
+
cl_git_pass(git_status_file(&status_flags, repo, FILE_WITH_SPACE));
|
565
|
+
cl_assert(status_flags == GIT_STATUS_WT_NEW);
|
566
|
+
|
567
|
+
/* add the file to the index */
|
568
|
+
|
569
|
+
cl_git_pass(git_repository_index(&index, repo));
|
570
|
+
cl_git_pass(git_index_add(index, FILE_WITH_SPACE, 0));
|
571
|
+
cl_git_pass(git_index_write(index));
|
572
|
+
|
573
|
+
memset(&result, 0, sizeof(result));
|
574
|
+
cl_git_pass(git_status_foreach(repo, cb_status__single, &result));
|
575
|
+
cl_assert_equal_i(2, result.count);
|
576
|
+
cl_assert(result.status == GIT_STATUS_INDEX_NEW);
|
577
|
+
|
578
|
+
cl_git_pass(git_status_file(&status_flags, repo, FILE_WITH_SPACE));
|
579
|
+
cl_assert(status_flags == GIT_STATUS_INDEX_NEW);
|
580
|
+
|
581
|
+
git_index_free(index);
|
582
|
+
git_repository_free(repo);
|
583
|
+
}
|
584
|
+
|
585
|
+
static const char *filemode_paths[] = {
|
586
|
+
"exec_off",
|
587
|
+
"exec_off2on_staged",
|
588
|
+
"exec_off2on_workdir",
|
589
|
+
"exec_off_untracked",
|
590
|
+
"exec_on",
|
591
|
+
"exec_on2off_staged",
|
592
|
+
"exec_on2off_workdir",
|
593
|
+
"exec_on_untracked",
|
594
|
+
};
|
595
|
+
|
596
|
+
static unsigned int filemode_statuses[] = {
|
597
|
+
GIT_STATUS_CURRENT,
|
598
|
+
GIT_STATUS_INDEX_MODIFIED,
|
599
|
+
GIT_STATUS_WT_MODIFIED,
|
600
|
+
GIT_STATUS_WT_NEW,
|
601
|
+
GIT_STATUS_CURRENT,
|
602
|
+
GIT_STATUS_INDEX_MODIFIED,
|
603
|
+
GIT_STATUS_WT_MODIFIED,
|
604
|
+
GIT_STATUS_WT_NEW
|
605
|
+
};
|
606
|
+
|
607
|
+
static const size_t filemode_count = 8;
|
608
|
+
|
609
|
+
void test_status_worktree__filemode_changes(void)
|
610
|
+
{
|
611
|
+
git_repository *repo = cl_git_sandbox_init("filemodes");
|
612
|
+
status_entry_counts counts;
|
613
|
+
git_status_options opts;
|
614
|
+
git_config *cfg;
|
615
|
+
|
616
|
+
/* overwrite stored filemode with platform appropriate value */
|
617
|
+
cl_git_pass(git_repository_config(&cfg, repo));
|
618
|
+
if (cl_is_chmod_supported())
|
619
|
+
cl_git_pass(git_config_set_bool(cfg, "core.filemode", true));
|
620
|
+
else {
|
621
|
+
unsigned int i;
|
622
|
+
cl_git_pass(git_config_set_bool(cfg, "core.filemode", false));
|
623
|
+
|
624
|
+
/* won't trust filesystem mode diffs, so these will appear unchanged */
|
625
|
+
for (i = 0; i < filemode_count; ++i)
|
626
|
+
if (filemode_statuses[i] == GIT_STATUS_WT_MODIFIED)
|
627
|
+
filemode_statuses[i] = GIT_STATUS_CURRENT;
|
628
|
+
}
|
629
|
+
|
630
|
+
memset(&opts, 0, sizeof(opts));
|
631
|
+
opts.flags = GIT_STATUS_OPT_INCLUDE_UNTRACKED |
|
632
|
+
GIT_STATUS_OPT_INCLUDE_IGNORED |
|
633
|
+
GIT_STATUS_OPT_INCLUDE_UNMODIFIED;
|
634
|
+
|
635
|
+
memset(&counts, 0, sizeof(counts));
|
636
|
+
counts.expected_entry_count = filemode_count;
|
637
|
+
counts.expected_paths = filemode_paths;
|
638
|
+
counts.expected_statuses = filemode_statuses;
|
639
|
+
|
640
|
+
cl_git_pass(
|
641
|
+
git_status_foreach_ext(repo, &opts, cb_status__normal, &counts)
|
642
|
+
);
|
643
|
+
|
644
|
+
cl_assert_equal_i(counts.expected_entry_count, counts.entry_count);
|
645
|
+
cl_assert_equal_i(0, counts.wrong_status_flags_count);
|
646
|
+
cl_assert_equal_i(0, counts.wrong_sorted_path);
|
647
|
+
|
648
|
+
git_config_free(cfg);
|
649
|
+
}
|
@@ -0,0 +1,20 @@
|
|
1
|
+
#include "clar_libgit2.h"
|
2
|
+
|
3
|
+
#include "cache.h"
|
4
|
+
|
5
|
+
|
6
|
+
static git_repository *g_repo;
|
7
|
+
|
8
|
+
void test_threads_basic__initialize(void) {
|
9
|
+
g_repo = cl_git_sandbox_init("testrepo");
|
10
|
+
}
|
11
|
+
|
12
|
+
void test_threads_basic__cleanup(void) {
|
13
|
+
cl_git_sandbox_cleanup();
|
14
|
+
}
|
15
|
+
|
16
|
+
|
17
|
+
void test_threads_basic__cache(void) {
|
18
|
+
// run several threads polling the cache at the same time
|
19
|
+
cl_assert(1 == 1);
|
20
|
+
}
|
Binary file
|
@@ -0,0 +1,35 @@
|
|
1
|
+
module Rugged
|
2
|
+
class Commit
|
3
|
+
|
4
|
+
def inspect
|
5
|
+
"#<Rugged::Commit:#{object_id} {message: #{message.inspect}, tree: #{tree.inspect}, parents: #{parent_ids}>"
|
6
|
+
end
|
7
|
+
|
8
|
+
# The time when this commit was made effective. This is the same value
|
9
|
+
# as the +:time+ attribute for +commit.committer+.
|
10
|
+
#
|
11
|
+
# Returns a Time object
|
12
|
+
def time
|
13
|
+
@time ||= Time.at(self.epoch_time)
|
14
|
+
end
|
15
|
+
|
16
|
+
def to_hash
|
17
|
+
{
|
18
|
+
:message => message,
|
19
|
+
:committer => committer,
|
20
|
+
:author => author,
|
21
|
+
:tree => tree,
|
22
|
+
:parents => parents,
|
23
|
+
}
|
24
|
+
end
|
25
|
+
|
26
|
+
def parent_ids
|
27
|
+
parents.map { |parent| parent.oid }
|
28
|
+
end
|
29
|
+
|
30
|
+
def modify(new_args, update_ref=nil)
|
31
|
+
args = self.to_hash.merge(new_args)
|
32
|
+
Commit.create(args, update_ref)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|