rugged 0.17.0b2 → 0.17.0.b6
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +10 -11
- data/ext/rugged/extconf.rb +5 -13
- data/ext/rugged/rugged_commit.c +2 -5
- data/ext/rugged/rugged_reference.c +29 -28
- data/ext/rugged/rugged_remote.c +1 -1
- data/ext/rugged/rugged_repo.c +4 -1
- data/ext/rugged/rugged_tree.c +20 -19
- data/lib/rugged/commit.rb +5 -1
- data/lib/rugged/repository.rb +6 -4
- data/lib/rugged/version.rb +1 -1
- data/test/config_test.rb +1 -1
- data/test/index_test.rb +4 -2
- data/test/object_test.rb +3 -3
- data/test/reference_test.rb +66 -1
- data/test/repo_test.rb +4 -4
- data/test/tree_test.rb +1 -1
- data/test/walker_test.rb +1 -1
- data/vendor/libgit2/Makefile.embed +42 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/deps/http-parser/http_parser.c +0 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/deps/http-parser/http_parser.h +0 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/deps/regex/config.h +0 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/deps/regex/regcomp.c +0 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/deps/regex/regex.c +0 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/deps/regex/regex.h +0 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/deps/regex/regex_internal.c +0 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/deps/regex/regex_internal.h +0 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/deps/regex/regexec.c +0 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/deps/zlib/adler32.c +0 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/deps/zlib/crc32.c +0 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/deps/zlib/crc32.h +0 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/deps/zlib/deflate.c +0 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/deps/zlib/deflate.h +0 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/deps/zlib/inffast.c +0 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/deps/zlib/inffast.h +0 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/deps/zlib/inffixed.h +0 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/deps/zlib/inflate.c +0 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/deps/zlib/inflate.h +0 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/deps/zlib/inftrees.c +0 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/deps/zlib/inftrees.h +0 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/deps/zlib/trees.c +0 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/deps/zlib/trees.h +0 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/deps/zlib/zconf.h +0 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/deps/zlib/zlib.h +0 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/deps/zlib/zutil.c +0 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/deps/zlib/zutil.h +0 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/include/git2.h +6 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/include/git2/attr.h +35 -20
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/include/git2/blob.h +1 -1
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/include/git2/branch.h +62 -24
- data/vendor/libgit2/include/git2/checkout.h +66 -0
- data/vendor/libgit2/include/git2/clone.h +59 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/include/git2/commit.h +22 -3
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/include/git2/common.h +27 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/include/git2/config.h +22 -4
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/include/git2/diff.h +20 -1
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/include/git2/errors.h +2 -37
- data/vendor/libgit2/include/git2/ignore.h +74 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/include/git2/index.h +37 -5
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/include/git2/indexer.h +2 -2
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/include/git2/inttypes.h +0 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/include/git2/merge.h +10 -0
- data/vendor/libgit2/include/git2/message.h +43 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/include/git2/net.h +0 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/include/git2/notes.h +24 -20
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/include/git2/object.h +18 -1
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/include/git2/odb.h +16 -1
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/include/git2/odb_backend.h +8 -1
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/include/git2/oid.h +26 -2
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/include/git2/reflog.h +39 -9
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/include/git2/refs.h +55 -3
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/include/git2/refspec.h +0 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/include/git2/remote.h +68 -2
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/include/git2/repository.h +39 -1
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/include/git2/reset.h +0 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/include/git2/revparse.h +0 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/include/git2/revwalk.h +2 -2
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/include/git2/signature.h +3 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/include/git2/status.h +5 -2
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/include/git2/stdint.h +0 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/include/git2/submodule.h +0 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/include/git2/tag.h +3 -3
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/include/git2/threads.h +0 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/include/git2/tree.h +77 -20
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/include/git2/types.h +14 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/include/git2/version.h +0 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/include/git2/windows.h +0 -0
- data/vendor/libgit2/src/amiga/map.c +51 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/attr.c +39 -6
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/attr.h +1 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/attr_file.c +2 -16
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/attr_file.h +4 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/blob.c +0 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/blob.h +0 -0
- data/vendor/libgit2/src/branch.c +294 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/bswap.h +0 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/buffer.c +40 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/buffer.h +22 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/cache.c +1 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/cache.h +0 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/cc-compat.h +0 -0
- data/vendor/libgit2/src/checkout.c +230 -0
- data/vendor/libgit2/src/clone.c +254 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/commit.c +42 -16
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/commit.h +0 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/common.h +3 -9
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/compat/fnmatch.c +0 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/compat/fnmatch.h +0 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/config.c +15 -5
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/config.h +0 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/config_cache.c +0 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/config_file.c +86 -19
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/config_file.h +16 -1
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/crlf.c +92 -4
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/date.c +20 -20
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/delta-apply.c +0 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/delta-apply.h +0 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/diff.c +45 -18
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/diff.h +0 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/diff_output.c +63 -46
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/errors.c +0 -0
- data/vendor/libgit2/src/fetch.c +380 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/fetch.h +1 -2
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/filebuf.c +7 -2
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/filebuf.h +0 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/fileops.c +16 -1
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/fileops.h +10 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/filter.c +38 -2
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/filter.h +15 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/global.c +5 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/global.h +2 -6
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/hash.c +0 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/hash.h +0 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/ignore.c +50 -1
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/ignore.h +0 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/index.c +95 -28
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/index.h +5 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/indexer.c +27 -25
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/iterator.c +0 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/iterator.h +0 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/khash.h +6 -4
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/map.h +4 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/message.c +27 -2
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/message.h +2 -1
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/mwindow.c +54 -10
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/mwindow.h +1 -1
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/netops.c +48 -38
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/netops.h +7 -4
- data/vendor/libgit2/src/notes.c +610 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/notes.h +0 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/object.c +73 -2
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/odb.c +20 -1
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/odb.h +0 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/odb_loose.c +89 -3
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/odb_pack.c +61 -3
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/oid.c +1 -6
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/oidmap.h +1 -6
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/pack.c +49 -4
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/pack.h +5 -1
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/path.c +144 -21
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/path.h +46 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/pkt.c +30 -8
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/pkt.h +0 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/pool.c +7 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/pool.h +7 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/posix.c +92 -1
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/posix.h +36 -1
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/ppc/sha1.c +0 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/ppc/sha1.h +0 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/pqueue.c +0 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/pqueue.h +0 -0
- data/vendor/libgit2/src/protocol.c +88 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/protocol.h +3 -9
- data/vendor/libgit2/src/reflog.c +489 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/reflog.h +3 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/refs.c +95 -52
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/refs.h +0 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/refspec.c +0 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/refspec.h +0 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/remote.c +130 -8
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/remote.h +6 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/repository.c +167 -42
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/repository.h +7 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/reset.c +1 -1
- data/vendor/libgit2/src/revparse.c +830 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/revwalk.c +83 -15
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/sha1.c +0 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/sha1.h +5 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/sha1_lookup.c +0 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/sha1_lookup.h +0 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/signature.c +19 -5
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/signature.h +0 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/status.c +24 -18
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/strmap.h +1 -1
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/submodule.c +3 -3
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/tag.c +2 -9
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/tag.h +0 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/thread-utils.c +0 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/thread-utils.h +0 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/transport.c +0 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/transport.h +13 -9
- data/vendor/libgit2/src/transports/git.c +245 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/transports/http.c +93 -336
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/transports/local.c +35 -32
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/tree-cache.c +0 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/tree-cache.h +0 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/tree.c +214 -124
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/tree.h +7 -3
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/tsort.c +0 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/unix/map.c +2 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/unix/posix.h +2 -1
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/util.c +30 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/util.h +13 -6
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/vector.c +1 -1
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/vector.h +5 -5
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/win32/dir.c +0 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/win32/dir.h +0 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/win32/map.c +0 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/win32/mingw-compat.h +0 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/win32/msvc-compat.h +0 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/win32/posix.h +1 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/win32/posix_w32.c +17 -1
- data/vendor/libgit2/src/win32/precompiled.c +1 -0
- data/vendor/libgit2/src/win32/precompiled.h +19 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/win32/pthread.c +0 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/win32/pthread.h +0 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/win32/utf-conv.c +0 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/win32/utf-conv.h +0 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/xdiff/xdiff.h +0 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/xdiff/xdiffi.c +0 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/xdiff/xdiffi.h +0 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/xdiff/xemit.c +0 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/xdiff/xemit.h +0 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/xdiff/xhistogram.c +0 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/xdiff/xinclude.h +0 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/xdiff/xmacros.h +0 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/xdiff/xmerge.c +0 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/xdiff/xpatience.c +0 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/xdiff/xprepare.c +0 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/xdiff/xprepare.h +0 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/xdiff/xtypes.h +0 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/xdiff/xutils.c +0 -0
- data/{ext/rugged/vendor/libgit2-dist → vendor/libgit2}/src/xdiff/xutils.h +0 -0
- metadata +265 -348
- data/ext/rugged/vendor/libgit2-dist.tar.gz +0 -0
- data/ext/rugged/vendor/libgit2-dist/examples/diff.c +0 -238
- data/ext/rugged/vendor/libgit2-dist/examples/general.c +0 -451
- data/ext/rugged/vendor/libgit2-dist/examples/network/common.h +0 -14
- data/ext/rugged/vendor/libgit2-dist/examples/network/fetch.c +0 -113
- data/ext/rugged/vendor/libgit2-dist/examples/network/git2.c +0 -62
- data/ext/rugged/vendor/libgit2-dist/examples/network/index-pack.c +0 -102
- data/ext/rugged/vendor/libgit2-dist/examples/network/ls-remote.c +0 -76
- data/ext/rugged/vendor/libgit2-dist/examples/showindex.c +0 -43
- data/ext/rugged/vendor/libgit2-dist/src/branch.c +0 -208
- data/ext/rugged/vendor/libgit2-dist/src/branch.h +0 -17
- data/ext/rugged/vendor/libgit2-dist/src/fetch.c +0 -200
- data/ext/rugged/vendor/libgit2-dist/src/notes.c +0 -548
- data/ext/rugged/vendor/libgit2-dist/src/protocol.c +0 -58
- data/ext/rugged/vendor/libgit2-dist/src/reflog.c +0 -340
- data/ext/rugged/vendor/libgit2-dist/src/revparse.c +0 -748
- data/ext/rugged/vendor/libgit2-dist/src/transports/git.c +0 -477
- data/ext/rugged/vendor/libgit2-dist/tests-clar/attr/attr_expect.h +0 -43
- data/ext/rugged/vendor/libgit2-dist/tests-clar/attr/file.c +0 -226
- data/ext/rugged/vendor/libgit2-dist/tests-clar/attr/flags.c +0 -108
- data/ext/rugged/vendor/libgit2-dist/tests-clar/attr/lookup.c +0 -262
- data/ext/rugged/vendor/libgit2-dist/tests-clar/attr/repo.c +0 -273
- data/ext/rugged/vendor/libgit2-dist/tests-clar/buf/basic.c +0 -29
- data/ext/rugged/vendor/libgit2-dist/tests-clar/clar_helpers.c +0 -181
- data/ext/rugged/vendor/libgit2-dist/tests-clar/clar_libgit2.h +0 -55
- data/ext/rugged/vendor/libgit2-dist/tests-clar/commit/commit.c +0 -44
- data/ext/rugged/vendor/libgit2-dist/tests-clar/commit/parse.c +0 -350
- data/ext/rugged/vendor/libgit2-dist/tests-clar/commit/signature.c +0 -65
- data/ext/rugged/vendor/libgit2-dist/tests-clar/commit/write.c +0 -140
- data/ext/rugged/vendor/libgit2-dist/tests-clar/config/add.c +0 -37
- data/ext/rugged/vendor/libgit2-dist/tests-clar/config/multivar.c +0 -151
- data/ext/rugged/vendor/libgit2-dist/tests-clar/config/new.c +0 -36
- data/ext/rugged/vendor/libgit2-dist/tests-clar/config/read.c +0 -221
- data/ext/rugged/vendor/libgit2-dist/tests-clar/config/stress.c +0 -61
- data/ext/rugged/vendor/libgit2-dist/tests-clar/config/write.c +0 -92
- data/ext/rugged/vendor/libgit2-dist/tests-clar/core/buffer.c +0 -613
- data/ext/rugged/vendor/libgit2-dist/tests-clar/core/dirent.c +0 -235
- data/ext/rugged/vendor/libgit2-dist/tests-clar/core/env.c +0 -115
- data/ext/rugged/vendor/libgit2-dist/tests-clar/core/errors.c +0 -60
- data/ext/rugged/vendor/libgit2-dist/tests-clar/core/filebuf.c +0 -92
- data/ext/rugged/vendor/libgit2-dist/tests-clar/core/hex.c +0 -22
- data/ext/rugged/vendor/libgit2-dist/tests-clar/core/oid.c +0 -18
- data/ext/rugged/vendor/libgit2-dist/tests-clar/core/path.c +0 -420
- data/ext/rugged/vendor/libgit2-dist/tests-clar/core/pool.c +0 -85
- data/ext/rugged/vendor/libgit2-dist/tests-clar/core/rmdir.c +0 -68
- data/ext/rugged/vendor/libgit2-dist/tests-clar/core/string.c +0 -28
- data/ext/rugged/vendor/libgit2-dist/tests-clar/core/strmap.c +0 -102
- data/ext/rugged/vendor/libgit2-dist/tests-clar/core/strtol.c +0 -37
- data/ext/rugged/vendor/libgit2-dist/tests-clar/core/vector.c +0 -191
- data/ext/rugged/vendor/libgit2-dist/tests-clar/date/date.c +0 -15
- data/ext/rugged/vendor/libgit2-dist/tests-clar/diff/blob.c +0 -254
- data/ext/rugged/vendor/libgit2-dist/tests-clar/diff/diff_helpers.c +0 -104
- data/ext/rugged/vendor/libgit2-dist/tests-clar/diff/diff_helpers.h +0 -47
- data/ext/rugged/vendor/libgit2-dist/tests-clar/diff/index.c +0 -92
- data/ext/rugged/vendor/libgit2-dist/tests-clar/diff/iterator.c +0 -572
- data/ext/rugged/vendor/libgit2-dist/tests-clar/diff/patch.c +0 -99
- data/ext/rugged/vendor/libgit2-dist/tests-clar/diff/tree.c +0 -210
- data/ext/rugged/vendor/libgit2-dist/tests-clar/diff/workdir.c +0 -543
- data/ext/rugged/vendor/libgit2-dist/tests-clar/index/read_tree.c +0 -46
- data/ext/rugged/vendor/libgit2-dist/tests-clar/index/rename.c +0 -50
- data/ext/rugged/vendor/libgit2-dist/tests-clar/index/tests.c +0 -246
- data/ext/rugged/vendor/libgit2-dist/tests-clar/network/createremotethenload.c +0 -33
- data/ext/rugged/vendor/libgit2-dist/tests-clar/network/remotelocal.c +0 -137
- data/ext/rugged/vendor/libgit2-dist/tests-clar/network/remotes.c +0 -183
- data/ext/rugged/vendor/libgit2-dist/tests-clar/notes/notes.c +0 -133
- data/ext/rugged/vendor/libgit2-dist/tests-clar/notes/notesref.c +0 -57
- data/ext/rugged/vendor/libgit2-dist/tests-clar/object/blob/filter.c +0 -125
- data/ext/rugged/vendor/libgit2-dist/tests-clar/object/blob/fromchunks.c +0 -87
- data/ext/rugged/vendor/libgit2-dist/tests-clar/object/blob/write.c +0 -69
- data/ext/rugged/vendor/libgit2-dist/tests-clar/object/commit/commitstagedfile.c +0 -126
- data/ext/rugged/vendor/libgit2-dist/tests-clar/object/lookup.c +0 -63
- data/ext/rugged/vendor/libgit2-dist/tests-clar/object/message.c +0 -171
- data/ext/rugged/vendor/libgit2-dist/tests-clar/object/raw/chars.c +0 -41
- data/ext/rugged/vendor/libgit2-dist/tests-clar/object/raw/compare.c +0 -124
- data/ext/rugged/vendor/libgit2-dist/tests-clar/object/raw/convert.c +0 -75
- data/ext/rugged/vendor/libgit2-dist/tests-clar/object/raw/data.h +0 -323
- data/ext/rugged/vendor/libgit2-dist/tests-clar/object/raw/fromstr.c +0 -30
- data/ext/rugged/vendor/libgit2-dist/tests-clar/object/raw/hash.c +0 -166
- data/ext/rugged/vendor/libgit2-dist/tests-clar/object/raw/short.c +0 -94
- data/ext/rugged/vendor/libgit2-dist/tests-clar/object/raw/size.c +0 -13
- data/ext/rugged/vendor/libgit2-dist/tests-clar/object/raw/type2string.c +0 -54
- data/ext/rugged/vendor/libgit2-dist/tests-clar/object/raw/write.c +0 -455
- data/ext/rugged/vendor/libgit2-dist/tests-clar/object/tag/peel.c +0 -56
- data/ext/rugged/vendor/libgit2-dist/tests-clar/object/tag/read.c +0 -130
- data/ext/rugged/vendor/libgit2-dist/tests-clar/object/tag/write.c +0 -192
- data/ext/rugged/vendor/libgit2-dist/tests-clar/object/tree/frompath.c +0 -81
- data/ext/rugged/vendor/libgit2-dist/tests-clar/object/tree/read.c +0 -75
- data/ext/rugged/vendor/libgit2-dist/tests-clar/object/tree/write.c +0 -84
- data/ext/rugged/vendor/libgit2-dist/tests-clar/odb/loose.c +0 -84
- data/ext/rugged/vendor/libgit2-dist/tests-clar/odb/loose_data.h +0 -522
- data/ext/rugged/vendor/libgit2-dist/tests-clar/odb/mixed.c +0 -24
- data/ext/rugged/vendor/libgit2-dist/tests-clar/odb/pack_data.h +0 -151
- data/ext/rugged/vendor/libgit2-dist/tests-clar/odb/packed.c +0 -78
- data/ext/rugged/vendor/libgit2-dist/tests-clar/odb/sorting.c +0 -71
- data/ext/rugged/vendor/libgit2-dist/tests-clar/refs/branches/create.c +0 -113
- data/ext/rugged/vendor/libgit2-dist/tests-clar/refs/branches/delete.c +0 -91
- data/ext/rugged/vendor/libgit2-dist/tests-clar/refs/branches/listall.c +0 -78
- data/ext/rugged/vendor/libgit2-dist/tests-clar/refs/branches/move.c +0 -72
- data/ext/rugged/vendor/libgit2-dist/tests-clar/refs/crashes.c +0 -17
- data/ext/rugged/vendor/libgit2-dist/tests-clar/refs/create.c +0 -149
- data/ext/rugged/vendor/libgit2-dist/tests-clar/refs/delete.c +0 -85
- data/ext/rugged/vendor/libgit2-dist/tests-clar/refs/list.c +0 -53
- data/ext/rugged/vendor/libgit2-dist/tests-clar/refs/listall.c +0 -36
- data/ext/rugged/vendor/libgit2-dist/tests-clar/refs/lookup.c +0 -42
- data/ext/rugged/vendor/libgit2-dist/tests-clar/refs/normalize.c +0 -200
- data/ext/rugged/vendor/libgit2-dist/tests-clar/refs/overwrite.c +0 -136
- data/ext/rugged/vendor/libgit2-dist/tests-clar/refs/pack.c +0 -67
- data/ext/rugged/vendor/libgit2-dist/tests-clar/refs/read.c +0 -194
- data/ext/rugged/vendor/libgit2-dist/tests-clar/refs/reflog.c +0 -123
- data/ext/rugged/vendor/libgit2-dist/tests-clar/refs/rename.c +0 -339
- data/ext/rugged/vendor/libgit2-dist/tests-clar/refs/revparse.c +0 -174
- data/ext/rugged/vendor/libgit2-dist/tests-clar/refs/unicode.c +0 -42
- data/ext/rugged/vendor/libgit2-dist/tests-clar/repo/discover.c +0 -142
- data/ext/rugged/vendor/libgit2-dist/tests-clar/repo/getters.c +0 -86
- data/ext/rugged/vendor/libgit2-dist/tests-clar/repo/init.c +0 -249
- data/ext/rugged/vendor/libgit2-dist/tests-clar/repo/open.c +0 -282
- data/ext/rugged/vendor/libgit2-dist/tests-clar/repo/setters.c +0 -80
- data/ext/rugged/vendor/libgit2-dist/tests-clar/reset/mixed.c +0 -47
- data/ext/rugged/vendor/libgit2-dist/tests-clar/reset/reset_helpers.c +0 -10
- data/ext/rugged/vendor/libgit2-dist/tests-clar/reset/reset_helpers.h +0 -6
- data/ext/rugged/vendor/libgit2-dist/tests-clar/reset/soft.c +0 -102
- data/ext/rugged/vendor/libgit2-dist/tests-clar/revwalk/basic.c +0 -181
- data/ext/rugged/vendor/libgit2-dist/tests-clar/revwalk/mergebase.c +0 -148
- data/ext/rugged/vendor/libgit2-dist/tests-clar/status/ignore.c +0 -147
- data/ext/rugged/vendor/libgit2-dist/tests-clar/status/single.c +0 -29
- data/ext/rugged/vendor/libgit2-dist/tests-clar/status/status_data.h +0 -202
- data/ext/rugged/vendor/libgit2-dist/tests-clar/status/status_helpers.c +0 -49
- data/ext/rugged/vendor/libgit2-dist/tests-clar/status/status_helpers.h +0 -33
- data/ext/rugged/vendor/libgit2-dist/tests-clar/status/submodules.c +0 -112
- data/ext/rugged/vendor/libgit2-dist/tests-clar/status/worktree.c +0 -649
- data/ext/rugged/vendor/libgit2-dist/tests-clar/threads/basic.c +0 -20
@@ -1,174 +0,0 @@
|
|
1
|
-
#include "clar_libgit2.h"
|
2
|
-
|
3
|
-
#include "git2/revparse.h"
|
4
|
-
|
5
|
-
static git_repository *g_repo;
|
6
|
-
static git_object *g_obj;
|
7
|
-
static char g_orig_tz[16] = {0};
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
/* Helpers */
|
12
|
-
static void test_object(const char *spec, const char *expected_oid)
|
13
|
-
{
|
14
|
-
char objstr[64] = {0};
|
15
|
-
|
16
|
-
cl_git_pass(git_revparse_single(&g_obj, g_repo, spec));
|
17
|
-
git_oid_fmt(objstr, git_object_id(g_obj));
|
18
|
-
cl_assert_equal_s(objstr, expected_oid);
|
19
|
-
|
20
|
-
git_object_free(g_obj);
|
21
|
-
g_obj = NULL;
|
22
|
-
}
|
23
|
-
|
24
|
-
|
25
|
-
void test_refs_revparse__initialize(void)
|
26
|
-
{
|
27
|
-
char *tz = cl_getenv("TZ");
|
28
|
-
if (tz)
|
29
|
-
strcpy(g_orig_tz, tz);
|
30
|
-
cl_setenv("TZ", "UTC");
|
31
|
-
g_repo = cl_git_sandbox_init("testrepo.git");
|
32
|
-
}
|
33
|
-
|
34
|
-
void test_refs_revparse__cleanup(void)
|
35
|
-
{
|
36
|
-
cl_git_sandbox_cleanup();
|
37
|
-
g_obj = NULL;
|
38
|
-
cl_setenv("TZ", g_orig_tz);
|
39
|
-
}
|
40
|
-
|
41
|
-
|
42
|
-
void test_refs_revparse__nonexistant_object(void)
|
43
|
-
{
|
44
|
-
cl_git_fail(git_revparse_single(&g_obj, g_repo, "this doesn't exist"));
|
45
|
-
cl_git_fail(git_revparse_single(&g_obj, g_repo, "this doesn't exist^1"));
|
46
|
-
cl_git_fail(git_revparse_single(&g_obj, g_repo, "this doesn't exist~2"));
|
47
|
-
}
|
48
|
-
|
49
|
-
void test_refs_revparse__shas(void)
|
50
|
-
{
|
51
|
-
test_object("c47800c7266a2be04c571c04d5a6614691ea99bd", "c47800c7266a2be04c571c04d5a6614691ea99bd");
|
52
|
-
test_object("c47800c", "c47800c7266a2be04c571c04d5a6614691ea99bd");
|
53
|
-
}
|
54
|
-
|
55
|
-
void test_refs_revparse__head(void)
|
56
|
-
{
|
57
|
-
test_object("HEAD", "a65fedf39aefe402d3bb6e24df4d4f5fe4547750");
|
58
|
-
}
|
59
|
-
|
60
|
-
void test_refs_revparse__full_refs(void)
|
61
|
-
{
|
62
|
-
test_object("refs/heads/master", "a65fedf39aefe402d3bb6e24df4d4f5fe4547750");
|
63
|
-
test_object("refs/heads/test", "e90810b8df3e80c413d903f631643c716887138d");
|
64
|
-
test_object("refs/tags/test", "b25fa35b38051e4ae45d4222e795f9df2e43f1d1");
|
65
|
-
}
|
66
|
-
|
67
|
-
void test_refs_revparse__partial_refs(void)
|
68
|
-
{
|
69
|
-
test_object("point_to_blob", "1385f264afb75a56a5bec74243be9b367ba4ca08");
|
70
|
-
test_object("packed-test", "4a202b346bb0fb0db7eff3cffeb3c70babbd2045");
|
71
|
-
test_object("br2", "a4a7dce85cf63874e984719f4fdd239f5145052f");
|
72
|
-
}
|
73
|
-
|
74
|
-
void test_refs_revparse__describe_output(void)
|
75
|
-
{
|
76
|
-
test_object("blah-7-gc47800c", "c47800c7266a2be04c571c04d5a6614691ea99bd");
|
77
|
-
test_object("not-good", "a65fedf39aefe402d3bb6e24df4d4f5fe4547750");
|
78
|
-
}
|
79
|
-
|
80
|
-
void test_refs_revparse__nth_parent(void)
|
81
|
-
{
|
82
|
-
test_object("be3563a^1", "9fd738e8f7967c078dceed8190330fc8648ee56a");
|
83
|
-
test_object("be3563a^", "9fd738e8f7967c078dceed8190330fc8648ee56a");
|
84
|
-
test_object("be3563a^2", "c47800c7266a2be04c571c04d5a6614691ea99bd");
|
85
|
-
test_object("be3563a^1^1", "4a202b346bb0fb0db7eff3cffeb3c70babbd2045");
|
86
|
-
test_object("be3563a^2^1", "5b5b025afb0b4c913b4c338a42934a3863bf3644");
|
87
|
-
test_object("be3563a^0", "be3563ae3f795b2b4353bcce3a527ad0a4f7f644");
|
88
|
-
}
|
89
|
-
|
90
|
-
void test_refs_revparse__not_tag(void)
|
91
|
-
{
|
92
|
-
test_object("point_to_blob^{}", "1385f264afb75a56a5bec74243be9b367ba4ca08");
|
93
|
-
test_object("wrapped_tag^{}", "a65fedf39aefe402d3bb6e24df4d4f5fe4547750");
|
94
|
-
}
|
95
|
-
|
96
|
-
void test_refs_revparse__to_type(void)
|
97
|
-
{
|
98
|
-
test_object("wrapped_tag^{commit}", "a65fedf39aefe402d3bb6e24df4d4f5fe4547750");
|
99
|
-
test_object("wrapped_tag^{tree}", "944c0f6e4dfa41595e6eb3ceecdb14f50fe18162");
|
100
|
-
test_object("point_to_blob^{blob}", "1385f264afb75a56a5bec74243be9b367ba4ca08");
|
101
|
-
|
102
|
-
cl_git_fail(git_revparse_single(&g_obj, g_repo, "wrapped_tag^{blob}"));
|
103
|
-
}
|
104
|
-
|
105
|
-
void test_refs_revparse__linear_history(void)
|
106
|
-
{
|
107
|
-
test_object("master~0", "a65fedf39aefe402d3bb6e24df4d4f5fe4547750");
|
108
|
-
test_object("master~1", "be3563ae3f795b2b4353bcce3a527ad0a4f7f644");
|
109
|
-
test_object("master~2", "9fd738e8f7967c078dceed8190330fc8648ee56a");
|
110
|
-
test_object("master~1~1", "9fd738e8f7967c078dceed8190330fc8648ee56a");
|
111
|
-
}
|
112
|
-
|
113
|
-
void test_refs_revparse__chaining(void)
|
114
|
-
{
|
115
|
-
test_object("master~1^1", "9fd738e8f7967c078dceed8190330fc8648ee56a");
|
116
|
-
test_object("master~1^2", "c47800c7266a2be04c571c04d5a6614691ea99bd");
|
117
|
-
test_object("master^1^2~1", "5b5b025afb0b4c913b4c338a42934a3863bf3644");
|
118
|
-
test_object("master^1^1^1^1^1", "8496071c1b46c854b31185ea97743be6a8774479");
|
119
|
-
}
|
120
|
-
|
121
|
-
void test_refs_revparse__reflog(void)
|
122
|
-
{
|
123
|
-
cl_git_fail(git_revparse_single(&g_obj, g_repo, "@{-xyz}"));
|
124
|
-
cl_git_fail(git_revparse_single(&g_obj, g_repo, "@{-0}"));
|
125
|
-
cl_git_fail(git_revparse_single(&g_obj, g_repo, "@{1000}"));
|
126
|
-
|
127
|
-
test_object("@{-2}", "a65fedf39aefe402d3bb6e24df4d4f5fe4547750");
|
128
|
-
test_object("@{-1}", "a4a7dce85cf63874e984719f4fdd239f5145052f");
|
129
|
-
test_object("master@{0}", "a65fedf39aefe402d3bb6e24df4d4f5fe4547750");
|
130
|
-
test_object("master@{1}", "be3563ae3f795b2b4353bcce3a527ad0a4f7f644");
|
131
|
-
test_object("@{0}", "a65fedf39aefe402d3bb6e24df4d4f5fe4547750");
|
132
|
-
test_object("@{1}", "be3563ae3f795b2b4353bcce3a527ad0a4f7f644");
|
133
|
-
test_object("master@{upstream}", "be3563ae3f795b2b4353bcce3a527ad0a4f7f644");
|
134
|
-
test_object("master@{u}", "be3563ae3f795b2b4353bcce3a527ad0a4f7f644");
|
135
|
-
}
|
136
|
-
|
137
|
-
void test_refs_revparse__revwalk(void)
|
138
|
-
{
|
139
|
-
cl_git_fail(git_revparse_single(&g_obj, g_repo, "master^{/not found in any commit}"));
|
140
|
-
cl_git_fail(git_revparse_single(&g_obj, g_repo, "master^{/merge}"));
|
141
|
-
cl_git_fail(git_revparse_single(&g_obj, g_repo, "master^{/((}"));
|
142
|
-
|
143
|
-
test_object("master^{/anoth}", "5b5b025afb0b4c913b4c338a42934a3863bf3644");
|
144
|
-
test_object("master^{/Merge}", "be3563ae3f795b2b4353bcce3a527ad0a4f7f644");
|
145
|
-
test_object("br2^{/Merge}", "a4a7dce85cf63874e984719f4fdd239f5145052f");
|
146
|
-
test_object("master^{/fo.rth}", "9fd738e8f7967c078dceed8190330fc8648ee56a");
|
147
|
-
}
|
148
|
-
|
149
|
-
void test_refs_revparse__date(void)
|
150
|
-
{
|
151
|
-
test_object("HEAD@{10 years ago}", "be3563ae3f795b2b4353bcce3a527ad0a4f7f644");
|
152
|
-
test_object("HEAD@{1 second}", "a65fedf39aefe402d3bb6e24df4d4f5fe4547750");
|
153
|
-
test_object("master@{2012-4-30 10:23:20 -0800}", "be3563ae3f795b2b4353bcce3a527ad0a4f7f644");
|
154
|
-
test_object("master@{2012-4-30 18:24 -0800}", "a65fedf39aefe402d3bb6e24df4d4f5fe4547750");
|
155
|
-
test_object("master@{2012-4-30 23:24 -0300}", "a65fedf39aefe402d3bb6e24df4d4f5fe4547750");
|
156
|
-
|
157
|
-
/* Core git gives a65fedf, because they don't take time zones into account. */
|
158
|
-
test_object("master@{1335806640}", "be3563ae3f795b2b4353bcce3a527ad0a4f7f644");
|
159
|
-
}
|
160
|
-
|
161
|
-
void test_refs_revparse__colon(void)
|
162
|
-
{
|
163
|
-
cl_git_fail(git_revparse_single(&g_obj, g_repo, ":/"));
|
164
|
-
cl_git_fail(git_revparse_single(&g_obj, g_repo, ":/not found in any commit"));
|
165
|
-
cl_git_fail(git_revparse_single(&g_obj, g_repo, ":2:README"));
|
166
|
-
|
167
|
-
test_object("subtrees:ab/4.txt", "d6c93164c249c8000205dd4ec5cbca1b516d487f");
|
168
|
-
test_object("subtrees:ab/de/fgh/1.txt", "1f67fc4386b2d171e0d21be1c447e12660561f9b");
|
169
|
-
test_object("master:README", "a8233120f6ad708f843d861ce2b7228ec4e3dec6");
|
170
|
-
test_object("master:new.txt", "a71586c1dfe8a71c6cbf6c129f404c5642ff31bd");
|
171
|
-
test_object(":/Merge", "a4a7dce85cf63874e984719f4fdd239f5145052f");
|
172
|
-
test_object(":/one", "c47800c7266a2be04c571c04d5a6614691ea99bd");
|
173
|
-
test_object(":/packed commit t", "41bc8c69075bbdb46c5c6f0566cc8cc5b46e8bd9");
|
174
|
-
}
|
@@ -1,42 +0,0 @@
|
|
1
|
-
#include "clar_libgit2.h"
|
2
|
-
|
3
|
-
static git_repository *repo;
|
4
|
-
|
5
|
-
void test_refs_unicode__initialize(void)
|
6
|
-
{
|
7
|
-
cl_fixture_sandbox("testrepo.git");
|
8
|
-
|
9
|
-
cl_git_pass(git_repository_open(&repo, "testrepo.git"));
|
10
|
-
}
|
11
|
-
|
12
|
-
void test_refs_unicode__cleanup(void)
|
13
|
-
{
|
14
|
-
git_repository_free(repo);
|
15
|
-
cl_fixture_cleanup("testrepo.git");
|
16
|
-
}
|
17
|
-
|
18
|
-
void test_refs_unicode__create_and_lookup(void)
|
19
|
-
{
|
20
|
-
git_reference *ref0, *ref1, *ref2;
|
21
|
-
git_repository *repo2;
|
22
|
-
|
23
|
-
const char *REFNAME = "refs/heads/" "\305" "ngstr" "\366" "m";
|
24
|
-
const char *master = "refs/heads/master";
|
25
|
-
|
26
|
-
/* Create the reference */
|
27
|
-
cl_git_pass(git_reference_lookup(&ref0, repo, master));
|
28
|
-
cl_git_pass(git_reference_create_oid(&ref1, repo, REFNAME, git_reference_oid(ref0), 0));
|
29
|
-
cl_assert(strcmp(REFNAME, git_reference_name(ref1)) == 0);
|
30
|
-
|
31
|
-
/* Lookup the reference in a different instance of the repository */
|
32
|
-
cl_git_pass(git_repository_open(&repo2, "testrepo.git"));
|
33
|
-
cl_git_pass(git_reference_lookup(&ref2, repo2, REFNAME));
|
34
|
-
|
35
|
-
cl_assert(git_oid_cmp(git_reference_oid(ref1), git_reference_oid(ref2)) == 0);
|
36
|
-
cl_assert(strcmp(REFNAME, git_reference_name(ref2)) == 0);
|
37
|
-
|
38
|
-
git_reference_free(ref0);
|
39
|
-
git_reference_free(ref1);
|
40
|
-
git_reference_free(ref2);
|
41
|
-
git_repository_free(repo2);
|
42
|
-
}
|
@@ -1,142 +0,0 @@
|
|
1
|
-
#include "clar_libgit2.h"
|
2
|
-
|
3
|
-
#include "odb.h"
|
4
|
-
#include "repository.h"
|
5
|
-
|
6
|
-
|
7
|
-
#define TEMP_REPO_FOLDER "temprepo/"
|
8
|
-
#define DISCOVER_FOLDER TEMP_REPO_FOLDER "discover.git"
|
9
|
-
|
10
|
-
#define SUB_REPOSITORY_FOLDER_NAME "sub_repo"
|
11
|
-
#define SUB_REPOSITORY_FOLDER DISCOVER_FOLDER "/" SUB_REPOSITORY_FOLDER_NAME
|
12
|
-
#define SUB_REPOSITORY_FOLDER_SUB SUB_REPOSITORY_FOLDER "/sub"
|
13
|
-
#define SUB_REPOSITORY_FOLDER_SUB_SUB SUB_REPOSITORY_FOLDER_SUB "/subsub"
|
14
|
-
#define SUB_REPOSITORY_FOLDER_SUB_SUB_SUB SUB_REPOSITORY_FOLDER_SUB_SUB "/subsubsub"
|
15
|
-
|
16
|
-
#define REPOSITORY_ALTERNATE_FOLDER DISCOVER_FOLDER "/alternate_sub_repo"
|
17
|
-
#define REPOSITORY_ALTERNATE_FOLDER_SUB REPOSITORY_ALTERNATE_FOLDER "/sub"
|
18
|
-
#define REPOSITORY_ALTERNATE_FOLDER_SUB_SUB REPOSITORY_ALTERNATE_FOLDER_SUB "/subsub"
|
19
|
-
#define REPOSITORY_ALTERNATE_FOLDER_SUB_SUB_SUB REPOSITORY_ALTERNATE_FOLDER_SUB_SUB "/subsubsub"
|
20
|
-
|
21
|
-
#define ALTERNATE_MALFORMED_FOLDER1 DISCOVER_FOLDER "/alternate_malformed_repo1"
|
22
|
-
#define ALTERNATE_MALFORMED_FOLDER2 DISCOVER_FOLDER "/alternate_malformed_repo2"
|
23
|
-
#define ALTERNATE_MALFORMED_FOLDER3 DISCOVER_FOLDER "/alternate_malformed_repo3"
|
24
|
-
#define ALTERNATE_NOT_FOUND_FOLDER DISCOVER_FOLDER "/alternate_not_found_repo"
|
25
|
-
|
26
|
-
static void ensure_repository_discover(const char *start_path,
|
27
|
-
const char *ceiling_dirs,
|
28
|
-
const char *expected_path)
|
29
|
-
{
|
30
|
-
char found_path[GIT_PATH_MAX];
|
31
|
-
cl_git_pass(git_repository_discover(found_path, sizeof(found_path), start_path, 0, ceiling_dirs));
|
32
|
-
//across_fs is always 0 as we can't automate the filesystem change tests
|
33
|
-
cl_assert_equal_s(found_path, expected_path);
|
34
|
-
}
|
35
|
-
|
36
|
-
static void write_file(const char *path, const char *content)
|
37
|
-
{
|
38
|
-
git_file file;
|
39
|
-
int error;
|
40
|
-
|
41
|
-
if (git_path_exists(path)) {
|
42
|
-
cl_git_pass(p_unlink(path));
|
43
|
-
}
|
44
|
-
|
45
|
-
file = git_futils_creat_withpath(path, 0777, 0666);
|
46
|
-
cl_assert(file >= 0);
|
47
|
-
|
48
|
-
error = p_write(file, content, strlen(content) * sizeof(char));
|
49
|
-
p_close(file);
|
50
|
-
cl_git_pass(error);
|
51
|
-
}
|
52
|
-
|
53
|
-
//no check is performed on ceiling_dirs length, so be sure it's long enough
|
54
|
-
static void append_ceiling_dir(git_buf *ceiling_dirs, const char *path)
|
55
|
-
{
|
56
|
-
git_buf pretty_path = GIT_BUF_INIT;
|
57
|
-
char ceiling_separator[2] = { GIT_PATH_LIST_SEPARATOR, '\0' };
|
58
|
-
|
59
|
-
cl_git_pass(git_path_prettify_dir(&pretty_path, path, NULL));
|
60
|
-
|
61
|
-
if (ceiling_dirs->size > 0)
|
62
|
-
git_buf_puts(ceiling_dirs, ceiling_separator);
|
63
|
-
|
64
|
-
git_buf_puts(ceiling_dirs, pretty_path.ptr);
|
65
|
-
|
66
|
-
git_buf_free(&pretty_path);
|
67
|
-
cl_assert(git_buf_oom(ceiling_dirs) == 0);
|
68
|
-
}
|
69
|
-
|
70
|
-
void test_repo_discover__0(void)
|
71
|
-
{
|
72
|
-
// test discover
|
73
|
-
git_repository *repo;
|
74
|
-
git_buf ceiling_dirs_buf = GIT_BUF_INIT;
|
75
|
-
const char *ceiling_dirs;
|
76
|
-
char repository_path[GIT_PATH_MAX];
|
77
|
-
char sub_repository_path[GIT_PATH_MAX];
|
78
|
-
char found_path[GIT_PATH_MAX];
|
79
|
-
const mode_t mode = 0777;
|
80
|
-
|
81
|
-
git_futils_mkdir_r(DISCOVER_FOLDER, NULL, mode);
|
82
|
-
append_ceiling_dir(&ceiling_dirs_buf, TEMP_REPO_FOLDER);
|
83
|
-
ceiling_dirs = git_buf_cstr(&ceiling_dirs_buf);
|
84
|
-
|
85
|
-
cl_assert_equal_i(GIT_ENOTFOUND, git_repository_discover(repository_path, sizeof(repository_path), DISCOVER_FOLDER, 0, ceiling_dirs));
|
86
|
-
|
87
|
-
cl_git_pass(git_repository_init(&repo, DISCOVER_FOLDER, 1));
|
88
|
-
cl_git_pass(git_repository_discover(repository_path, sizeof(repository_path), DISCOVER_FOLDER, 0, ceiling_dirs));
|
89
|
-
git_repository_free(repo);
|
90
|
-
|
91
|
-
cl_git_pass(git_repository_init(&repo, SUB_REPOSITORY_FOLDER, 0));
|
92
|
-
cl_git_pass(git_futils_mkdir_r(SUB_REPOSITORY_FOLDER_SUB_SUB_SUB, NULL, mode));
|
93
|
-
cl_git_pass(git_repository_discover(sub_repository_path, sizeof(sub_repository_path), SUB_REPOSITORY_FOLDER, 0, ceiling_dirs));
|
94
|
-
|
95
|
-
cl_git_pass(git_futils_mkdir_r(SUB_REPOSITORY_FOLDER_SUB_SUB_SUB, NULL, mode));
|
96
|
-
ensure_repository_discover(SUB_REPOSITORY_FOLDER_SUB, ceiling_dirs, sub_repository_path);
|
97
|
-
ensure_repository_discover(SUB_REPOSITORY_FOLDER_SUB_SUB, ceiling_dirs, sub_repository_path);
|
98
|
-
ensure_repository_discover(SUB_REPOSITORY_FOLDER_SUB_SUB_SUB, ceiling_dirs, sub_repository_path);
|
99
|
-
|
100
|
-
cl_git_pass(git_futils_mkdir_r(REPOSITORY_ALTERNATE_FOLDER_SUB_SUB_SUB, NULL, mode));
|
101
|
-
write_file(REPOSITORY_ALTERNATE_FOLDER "/" DOT_GIT, "gitdir: ../" SUB_REPOSITORY_FOLDER_NAME "/" DOT_GIT);
|
102
|
-
write_file(REPOSITORY_ALTERNATE_FOLDER_SUB_SUB "/" DOT_GIT, "gitdir: ../../../" SUB_REPOSITORY_FOLDER_NAME "/" DOT_GIT);
|
103
|
-
write_file(REPOSITORY_ALTERNATE_FOLDER_SUB_SUB_SUB "/" DOT_GIT, "gitdir: ../../../../");
|
104
|
-
ensure_repository_discover(REPOSITORY_ALTERNATE_FOLDER, ceiling_dirs, sub_repository_path);
|
105
|
-
ensure_repository_discover(REPOSITORY_ALTERNATE_FOLDER_SUB, ceiling_dirs, sub_repository_path);
|
106
|
-
ensure_repository_discover(REPOSITORY_ALTERNATE_FOLDER_SUB_SUB, ceiling_dirs, sub_repository_path);
|
107
|
-
ensure_repository_discover(REPOSITORY_ALTERNATE_FOLDER_SUB_SUB_SUB, ceiling_dirs, repository_path);
|
108
|
-
|
109
|
-
cl_git_pass(git_futils_mkdir_r(ALTERNATE_MALFORMED_FOLDER1, NULL, mode));
|
110
|
-
write_file(ALTERNATE_MALFORMED_FOLDER1 "/" DOT_GIT, "Anything but not gitdir:");
|
111
|
-
cl_git_pass(git_futils_mkdir_r(ALTERNATE_MALFORMED_FOLDER2, NULL, mode));
|
112
|
-
write_file(ALTERNATE_MALFORMED_FOLDER2 "/" DOT_GIT, "gitdir:");
|
113
|
-
cl_git_pass(git_futils_mkdir_r(ALTERNATE_MALFORMED_FOLDER3, NULL, mode));
|
114
|
-
write_file(ALTERNATE_MALFORMED_FOLDER3 "/" DOT_GIT, "gitdir: \n\n\n");
|
115
|
-
cl_git_pass(git_futils_mkdir_r(ALTERNATE_NOT_FOUND_FOLDER, NULL, mode));
|
116
|
-
write_file(ALTERNATE_NOT_FOUND_FOLDER "/" DOT_GIT, "gitdir: a_repository_that_surely_does_not_exist");
|
117
|
-
cl_git_fail(git_repository_discover(found_path, sizeof(found_path), ALTERNATE_MALFORMED_FOLDER1, 0, ceiling_dirs));
|
118
|
-
cl_git_fail(git_repository_discover(found_path, sizeof(found_path), ALTERNATE_MALFORMED_FOLDER2, 0, ceiling_dirs));
|
119
|
-
cl_git_fail(git_repository_discover(found_path, sizeof(found_path), ALTERNATE_MALFORMED_FOLDER3, 0, ceiling_dirs));
|
120
|
-
cl_assert_equal_i(GIT_ENOTFOUND, git_repository_discover(found_path, sizeof(found_path), ALTERNATE_NOT_FOUND_FOLDER, 0, ceiling_dirs));
|
121
|
-
|
122
|
-
append_ceiling_dir(&ceiling_dirs_buf, SUB_REPOSITORY_FOLDER);
|
123
|
-
ceiling_dirs = git_buf_cstr(&ceiling_dirs_buf);
|
124
|
-
|
125
|
-
//this must pass as ceiling_directories cannot predent the current
|
126
|
-
//working directory to be checked
|
127
|
-
cl_git_pass(git_repository_discover(found_path, sizeof(found_path), SUB_REPOSITORY_FOLDER, 0, ceiling_dirs));
|
128
|
-
cl_assert_equal_i(GIT_ENOTFOUND, git_repository_discover(found_path, sizeof(found_path), SUB_REPOSITORY_FOLDER_SUB, 0, ceiling_dirs));
|
129
|
-
cl_assert_equal_i(GIT_ENOTFOUND, git_repository_discover(found_path, sizeof(found_path), SUB_REPOSITORY_FOLDER_SUB_SUB, 0, ceiling_dirs));
|
130
|
-
cl_assert_equal_i(GIT_ENOTFOUND, git_repository_discover(found_path, sizeof(found_path), SUB_REPOSITORY_FOLDER_SUB_SUB_SUB, 0, ceiling_dirs));
|
131
|
-
|
132
|
-
//.gitfile redirection should not be affected by ceiling directories
|
133
|
-
ensure_repository_discover(REPOSITORY_ALTERNATE_FOLDER, ceiling_dirs, sub_repository_path);
|
134
|
-
ensure_repository_discover(REPOSITORY_ALTERNATE_FOLDER_SUB, ceiling_dirs, sub_repository_path);
|
135
|
-
ensure_repository_discover(REPOSITORY_ALTERNATE_FOLDER_SUB_SUB, ceiling_dirs, sub_repository_path);
|
136
|
-
ensure_repository_discover(REPOSITORY_ALTERNATE_FOLDER_SUB_SUB_SUB, ceiling_dirs, repository_path);
|
137
|
-
|
138
|
-
cl_git_pass(git_futils_rmdir_r(TEMP_REPO_FOLDER, GIT_DIRREMOVAL_FILES_AND_DIRS));
|
139
|
-
git_repository_free(repo);
|
140
|
-
git_buf_free(&ceiling_dirs_buf);
|
141
|
-
}
|
142
|
-
|
@@ -1,86 +0,0 @@
|
|
1
|
-
#include "clar_libgit2.h"
|
2
|
-
|
3
|
-
void test_repo_getters__initialize(void)
|
4
|
-
{
|
5
|
-
cl_fixture_sandbox("testrepo.git");
|
6
|
-
}
|
7
|
-
|
8
|
-
void test_repo_getters__cleanup(void)
|
9
|
-
{
|
10
|
-
cl_fixture_cleanup("testrepo.git");
|
11
|
-
}
|
12
|
-
|
13
|
-
void test_repo_getters__empty(void)
|
14
|
-
{
|
15
|
-
git_repository *repo_empty, *repo_normal;
|
16
|
-
|
17
|
-
cl_git_pass(git_repository_open(&repo_normal, cl_fixture("testrepo.git")));
|
18
|
-
cl_assert(git_repository_is_empty(repo_normal) == 0);
|
19
|
-
git_repository_free(repo_normal);
|
20
|
-
|
21
|
-
cl_git_pass(git_repository_open(&repo_empty, cl_fixture("empty_bare.git")));
|
22
|
-
cl_assert(git_repository_is_empty(repo_empty) == 1);
|
23
|
-
git_repository_free(repo_empty);
|
24
|
-
}
|
25
|
-
|
26
|
-
void test_repo_getters__head_detached(void)
|
27
|
-
{
|
28
|
-
git_repository *repo;
|
29
|
-
git_reference *ref;
|
30
|
-
git_oid oid;
|
31
|
-
|
32
|
-
cl_git_pass(git_repository_open(&repo, "testrepo.git"));
|
33
|
-
|
34
|
-
cl_assert(git_repository_head_detached(repo) == 0);
|
35
|
-
|
36
|
-
/* detach the HEAD */
|
37
|
-
git_oid_fromstr(&oid, "c47800c7266a2be04c571c04d5a6614691ea99bd");
|
38
|
-
cl_git_pass(git_reference_create_oid(&ref, repo, "HEAD", &oid, 1));
|
39
|
-
cl_assert(git_repository_head_detached(repo) == 1);
|
40
|
-
git_reference_free(ref);
|
41
|
-
|
42
|
-
/* take the reop back to it's original state */
|
43
|
-
cl_git_pass(git_reference_create_symbolic(&ref, repo, "HEAD", "refs/heads/master", 1));
|
44
|
-
cl_assert(git_repository_head_detached(repo) == 0);
|
45
|
-
|
46
|
-
git_reference_free(ref);
|
47
|
-
git_repository_free(repo);
|
48
|
-
}
|
49
|
-
|
50
|
-
void test_repo_getters__head_orphan(void)
|
51
|
-
{
|
52
|
-
git_repository *repo;
|
53
|
-
git_reference *ref;
|
54
|
-
|
55
|
-
cl_git_pass(git_repository_open(&repo, "testrepo.git"));
|
56
|
-
|
57
|
-
cl_assert(git_repository_head_orphan(repo) == 0);
|
58
|
-
|
59
|
-
/* orphan HEAD */
|
60
|
-
cl_git_pass(git_reference_create_symbolic(&ref, repo, "HEAD", "refs/heads/orphan", 1));
|
61
|
-
cl_assert(git_repository_head_orphan(repo) == 1);
|
62
|
-
git_reference_free(ref);
|
63
|
-
|
64
|
-
/* take the reop back to it's original state */
|
65
|
-
cl_git_pass(git_reference_create_symbolic(&ref, repo, "HEAD", "refs/heads/master", 1));
|
66
|
-
cl_assert(git_repository_head_orphan(repo) == 0);
|
67
|
-
|
68
|
-
git_reference_free(ref);
|
69
|
-
git_repository_free(repo);
|
70
|
-
}
|
71
|
-
|
72
|
-
void test_repo_getters__retrieving_the_odb_honors_the_refcount(void)
|
73
|
-
{
|
74
|
-
git_odb *odb;
|
75
|
-
git_repository *repo;
|
76
|
-
|
77
|
-
cl_git_pass(git_repository_open(&repo, "testrepo.git"));
|
78
|
-
|
79
|
-
cl_git_pass(git_repository_odb(&odb, repo));
|
80
|
-
cl_assert(((git_refcount *)odb)->refcount == 2);
|
81
|
-
|
82
|
-
git_repository_free(repo);
|
83
|
-
cl_assert(((git_refcount *)odb)->refcount == 1);
|
84
|
-
|
85
|
-
git_odb_free(odb);
|
86
|
-
}
|
@@ -1,249 +0,0 @@
|
|
1
|
-
#include "clar_libgit2.h"
|
2
|
-
#include "fileops.h"
|
3
|
-
#include "repository.h"
|
4
|
-
#include "config.h"
|
5
|
-
|
6
|
-
enum repo_mode {
|
7
|
-
STANDARD_REPOSITORY = 0,
|
8
|
-
BARE_REPOSITORY = 1
|
9
|
-
};
|
10
|
-
|
11
|
-
static git_repository *_repo;
|
12
|
-
|
13
|
-
void test_repo_init__initialize(void)
|
14
|
-
{
|
15
|
-
_repo = NULL;
|
16
|
-
}
|
17
|
-
|
18
|
-
static void cleanup_repository(void *path)
|
19
|
-
{
|
20
|
-
git_repository_free(_repo);
|
21
|
-
cl_fixture_cleanup((const char *)path);
|
22
|
-
}
|
23
|
-
|
24
|
-
static void ensure_repository_init(
|
25
|
-
const char *working_directory,
|
26
|
-
int is_bare,
|
27
|
-
const char *expected_path_repository,
|
28
|
-
const char *expected_working_directory)
|
29
|
-
{
|
30
|
-
const char *workdir;
|
31
|
-
|
32
|
-
cl_git_pass(git_repository_init(&_repo, working_directory, is_bare));
|
33
|
-
|
34
|
-
workdir = git_repository_workdir(_repo);
|
35
|
-
if (workdir != NULL || expected_working_directory != NULL) {
|
36
|
-
cl_assert(
|
37
|
-
git__suffixcmp(workdir, expected_working_directory) == 0
|
38
|
-
);
|
39
|
-
}
|
40
|
-
|
41
|
-
cl_assert(
|
42
|
-
git__suffixcmp(git_repository_path(_repo), expected_path_repository) == 0
|
43
|
-
);
|
44
|
-
|
45
|
-
cl_assert(git_repository_is_bare(_repo) == is_bare);
|
46
|
-
|
47
|
-
#ifdef GIT_WIN32
|
48
|
-
if (!is_bare) {
|
49
|
-
cl_assert((GetFileAttributes(git_repository_path(_repo)) & FILE_ATTRIBUTE_HIDDEN) != 0);
|
50
|
-
}
|
51
|
-
#endif
|
52
|
-
|
53
|
-
cl_assert(git_repository_is_empty(_repo));
|
54
|
-
}
|
55
|
-
|
56
|
-
void test_repo_init__standard_repo(void)
|
57
|
-
{
|
58
|
-
cl_set_cleanup(&cleanup_repository, "testrepo");
|
59
|
-
ensure_repository_init("testrepo/", 0, "testrepo/.git/", "testrepo/");
|
60
|
-
}
|
61
|
-
|
62
|
-
void test_repo_init__standard_repo_noslash(void)
|
63
|
-
{
|
64
|
-
cl_set_cleanup(&cleanup_repository, "testrepo");
|
65
|
-
ensure_repository_init("testrepo", 0, "testrepo/.git/", "testrepo/");
|
66
|
-
}
|
67
|
-
|
68
|
-
void test_repo_init__bare_repo(void)
|
69
|
-
{
|
70
|
-
cl_set_cleanup(&cleanup_repository, "testrepo.git");
|
71
|
-
ensure_repository_init("testrepo.git/", 1, "testrepo.git/", NULL);
|
72
|
-
}
|
73
|
-
|
74
|
-
void test_repo_init__bare_repo_noslash(void)
|
75
|
-
{
|
76
|
-
cl_set_cleanup(&cleanup_repository, "testrepo.git");
|
77
|
-
ensure_repository_init("testrepo.git", 1, "testrepo.git/", NULL);
|
78
|
-
}
|
79
|
-
|
80
|
-
void test_repo_init__bare_repo_escaping_current_workdir(void)
|
81
|
-
{
|
82
|
-
git_buf path_repository = GIT_BUF_INIT;
|
83
|
-
git_buf path_current_workdir = GIT_BUF_INIT;
|
84
|
-
|
85
|
-
cl_git_pass(git_path_prettify_dir(&path_current_workdir, ".", NULL));
|
86
|
-
|
87
|
-
cl_git_pass(git_buf_joinpath(&path_repository, git_buf_cstr(&path_current_workdir), "a/b/c"));
|
88
|
-
cl_git_pass(git_futils_mkdir_r(git_buf_cstr(&path_repository), NULL, GIT_DIR_MODE));
|
89
|
-
|
90
|
-
/* Change the current working directory */
|
91
|
-
cl_git_pass(chdir(git_buf_cstr(&path_repository)));
|
92
|
-
|
93
|
-
/* Initialize a bare repo with a relative path escaping out of the current working directory */
|
94
|
-
cl_git_pass(git_repository_init(&_repo, "../d/e.git", 1));
|
95
|
-
cl_git_pass(git__suffixcmp(git_repository_path(_repo), "/a/b/d/e.git/"));
|
96
|
-
|
97
|
-
git_repository_free(_repo);
|
98
|
-
|
99
|
-
/* Open a bare repo with a relative path escaping out of the current working directory */
|
100
|
-
cl_git_pass(git_repository_open(&_repo, "../d/e.git"));
|
101
|
-
|
102
|
-
cl_git_pass(chdir(git_buf_cstr(&path_current_workdir)));
|
103
|
-
|
104
|
-
git_buf_free(&path_current_workdir);
|
105
|
-
git_buf_free(&path_repository);
|
106
|
-
|
107
|
-
cleanup_repository("a");
|
108
|
-
}
|
109
|
-
|
110
|
-
void test_repo_init__reinit_bare_repo(void)
|
111
|
-
{
|
112
|
-
cl_set_cleanup(&cleanup_repository, "reinit.git");
|
113
|
-
|
114
|
-
/* Initialize the repository */
|
115
|
-
cl_git_pass(git_repository_init(&_repo, "reinit.git", 1));
|
116
|
-
git_repository_free(_repo);
|
117
|
-
|
118
|
-
/* Reinitialize the repository */
|
119
|
-
cl_git_pass(git_repository_init(&_repo, "reinit.git", 1));
|
120
|
-
}
|
121
|
-
|
122
|
-
void test_repo_init__reinit_too_recent_bare_repo(void)
|
123
|
-
{
|
124
|
-
git_config *config;
|
125
|
-
|
126
|
-
/* Initialize the repository */
|
127
|
-
cl_git_pass(git_repository_init(&_repo, "reinit.git", 1));
|
128
|
-
git_repository_config(&config, _repo);
|
129
|
-
|
130
|
-
/*
|
131
|
-
* Hack the config of the repository to make it look like it has
|
132
|
-
* been created by a recenter version of git/libgit2
|
133
|
-
*/
|
134
|
-
cl_git_pass(git_config_set_int32(config, "core.repositoryformatversion", 42));
|
135
|
-
|
136
|
-
git_config_free(config);
|
137
|
-
git_repository_free(_repo);
|
138
|
-
|
139
|
-
/* Try to reinitialize the repository */
|
140
|
-
cl_git_fail(git_repository_init(&_repo, "reinit.git", 1));
|
141
|
-
|
142
|
-
cl_fixture_cleanup("reinit.git");
|
143
|
-
}
|
144
|
-
|
145
|
-
void test_repo_init__additional_templates(void)
|
146
|
-
{
|
147
|
-
git_buf path = GIT_BUF_INIT;
|
148
|
-
|
149
|
-
cl_set_cleanup(&cleanup_repository, "tester");
|
150
|
-
|
151
|
-
ensure_repository_init("tester", 0, "tester/.git/", "tester/");
|
152
|
-
|
153
|
-
cl_git_pass(
|
154
|
-
git_buf_joinpath(&path, git_repository_path(_repo), "description"));
|
155
|
-
cl_assert(git_path_isfile(git_buf_cstr(&path)));
|
156
|
-
|
157
|
-
cl_git_pass(
|
158
|
-
git_buf_joinpath(&path, git_repository_path(_repo), "info/exclude"));
|
159
|
-
cl_assert(git_path_isfile(git_buf_cstr(&path)));
|
160
|
-
|
161
|
-
cl_git_pass(
|
162
|
-
git_buf_joinpath(&path, git_repository_path(_repo), "hooks"));
|
163
|
-
cl_assert(git_path_isdir(git_buf_cstr(&path)));
|
164
|
-
/* won't confirm specific contents of hooks dir since it may vary */
|
165
|
-
|
166
|
-
git_buf_free(&path);
|
167
|
-
}
|
168
|
-
|
169
|
-
static void assert_config_entry_on_init_bytype(const char *config_key, int expected_value, bool is_bare)
|
170
|
-
{
|
171
|
-
git_config *config;
|
172
|
-
int current_value;
|
173
|
-
|
174
|
-
cl_set_cleanup(&cleanup_repository, "config_entry");
|
175
|
-
|
176
|
-
cl_git_pass(git_repository_init(&_repo, "config_entry/test.git", is_bare));
|
177
|
-
git_repository_config(&config, _repo);
|
178
|
-
|
179
|
-
if (expected_value >= 0) {
|
180
|
-
cl_git_pass(git_config_get_bool(¤t_value, config, config_key));
|
181
|
-
|
182
|
-
cl_assert_equal_i(expected_value, current_value);
|
183
|
-
} else {
|
184
|
-
int error = git_config_get_bool(¤t_value, config, config_key);
|
185
|
-
|
186
|
-
cl_assert_equal_i(expected_value, error);
|
187
|
-
}
|
188
|
-
|
189
|
-
git_config_free(config);
|
190
|
-
}
|
191
|
-
|
192
|
-
static void assert_config_entry_on_init(const char *config_key, int expected_value)
|
193
|
-
{
|
194
|
-
assert_config_entry_on_init_bytype(config_key, expected_value, true);
|
195
|
-
git_repository_free(_repo);
|
196
|
-
|
197
|
-
assert_config_entry_on_init_bytype(config_key, expected_value, false);
|
198
|
-
}
|
199
|
-
|
200
|
-
void test_repo_init__detect_filemode(void)
|
201
|
-
{
|
202
|
-
#ifdef GIT_WIN32
|
203
|
-
assert_config_entry_on_init("core.filemode", false);
|
204
|
-
#else
|
205
|
-
assert_config_entry_on_init("core.filemode", true);
|
206
|
-
#endif
|
207
|
-
}
|
208
|
-
|
209
|
-
#define CASE_INSENSITIVE_FILESYSTEM (defined GIT_WIN32 || defined __APPLE__)
|
210
|
-
|
211
|
-
void test_repo_init__detect_ignorecase(void)
|
212
|
-
{
|
213
|
-
#if CASE_INSENSITIVE_FILESYSTEM
|
214
|
-
assert_config_entry_on_init("core.ignorecase", true);
|
215
|
-
#else
|
216
|
-
assert_config_entry_on_init("core.ignorecase", GIT_ENOTFOUND);
|
217
|
-
#endif
|
218
|
-
}
|
219
|
-
|
220
|
-
void test_repo_init__reinit_doesnot_overwrite_ignorecase(void)
|
221
|
-
{
|
222
|
-
git_config *config;
|
223
|
-
int current_value;
|
224
|
-
|
225
|
-
/* Init a new repo */
|
226
|
-
test_repo_init__detect_ignorecase();
|
227
|
-
|
228
|
-
/* Change the "core.ignorecase" config value to something unlikely */
|
229
|
-
git_repository_config(&config, _repo);
|
230
|
-
git_config_set_int32(config, "core.ignorecase", 42);
|
231
|
-
git_config_free(config);
|
232
|
-
git_repository_free(_repo);
|
233
|
-
|
234
|
-
/* Reinit the repository */
|
235
|
-
cl_git_pass(git_repository_init(&_repo, "config_entry/test.git", 1));
|
236
|
-
git_repository_config(&config, _repo);
|
237
|
-
|
238
|
-
/* Ensure the "core.ignorecase" config value hasn't been updated */
|
239
|
-
cl_git_pass(git_config_get_int32(¤t_value, config, "core.ignorecase"));
|
240
|
-
cl_assert_equal_i(42, current_value);
|
241
|
-
|
242
|
-
git_config_free(config);
|
243
|
-
}
|
244
|
-
|
245
|
-
void test_repo_init__sets_logAllRefUpdates_according_to_type_of_repository(void)
|
246
|
-
{
|
247
|
-
assert_config_entry_on_init_bytype("core.logallrefupdates", GIT_ENOTFOUND, true);
|
248
|
-
assert_config_entry_on_init_bytype("core.logallrefupdates", true, false);
|
249
|
-
}
|