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,194 +0,0 @@
|
|
1
|
-
#include "clar_libgit2.h"
|
2
|
-
|
3
|
-
#include "repository.h"
|
4
|
-
#include "git2/reflog.h"
|
5
|
-
#include "reflog.h"
|
6
|
-
|
7
|
-
static const char *loose_tag_ref_name = "refs/tags/e90810b";
|
8
|
-
static const char *non_existing_tag_ref_name = "refs/tags/i-do-not-exist";
|
9
|
-
static const char *head_tracker_sym_ref_name = "head-tracker";
|
10
|
-
static const char *current_head_target = "refs/heads/master";
|
11
|
-
static const char *current_master_tip = "a65fedf39aefe402d3bb6e24df4d4f5fe4547750";
|
12
|
-
static const char *packed_head_name = "refs/heads/packed";
|
13
|
-
static const char *packed_test_head_name = "refs/heads/packed-test";
|
14
|
-
|
15
|
-
static git_repository *g_repo;
|
16
|
-
|
17
|
-
void test_refs_read__initialize(void)
|
18
|
-
{
|
19
|
-
g_repo = cl_git_sandbox_init("testrepo");
|
20
|
-
}
|
21
|
-
|
22
|
-
void test_refs_read__cleanup(void)
|
23
|
-
{
|
24
|
-
cl_git_sandbox_cleanup();
|
25
|
-
}
|
26
|
-
|
27
|
-
void test_refs_read__loose_tag(void)
|
28
|
-
{
|
29
|
-
// lookup a loose tag reference
|
30
|
-
git_reference *reference;
|
31
|
-
git_object *object;
|
32
|
-
git_buf ref_name_from_tag_name = GIT_BUF_INIT;
|
33
|
-
|
34
|
-
cl_git_pass(git_reference_lookup(&reference, g_repo, loose_tag_ref_name));
|
35
|
-
cl_assert(git_reference_type(reference) & GIT_REF_OID);
|
36
|
-
cl_assert(git_reference_is_packed(reference) == 0);
|
37
|
-
cl_assert_equal_s(reference->name, loose_tag_ref_name);
|
38
|
-
|
39
|
-
cl_git_pass(git_object_lookup(&object, g_repo, git_reference_oid(reference), GIT_OBJ_ANY));
|
40
|
-
cl_assert(object != NULL);
|
41
|
-
cl_assert(git_object_type(object) == GIT_OBJ_TAG);
|
42
|
-
|
43
|
-
/* Ensure the name of the tag matches the name of the reference */
|
44
|
-
cl_git_pass(git_buf_joinpath(&ref_name_from_tag_name, GIT_REFS_TAGS_DIR, git_tag_name((git_tag *)object)));
|
45
|
-
cl_assert_equal_s(ref_name_from_tag_name.ptr, loose_tag_ref_name);
|
46
|
-
git_buf_free(&ref_name_from_tag_name);
|
47
|
-
|
48
|
-
git_object_free(object);
|
49
|
-
|
50
|
-
git_reference_free(reference);
|
51
|
-
}
|
52
|
-
|
53
|
-
void test_refs_read__nonexisting_tag(void)
|
54
|
-
{
|
55
|
-
// lookup a loose tag reference that doesn't exist
|
56
|
-
git_reference *reference;
|
57
|
-
|
58
|
-
cl_git_fail(git_reference_lookup(&reference, g_repo, non_existing_tag_ref_name));
|
59
|
-
|
60
|
-
git_reference_free(reference);
|
61
|
-
}
|
62
|
-
|
63
|
-
|
64
|
-
void test_refs_read__symbolic(void)
|
65
|
-
{
|
66
|
-
// lookup a symbolic reference
|
67
|
-
git_reference *reference, *resolved_ref;
|
68
|
-
git_object *object;
|
69
|
-
git_oid id;
|
70
|
-
|
71
|
-
cl_git_pass(git_reference_lookup(&reference, g_repo, GIT_HEAD_FILE));
|
72
|
-
cl_assert(git_reference_type(reference) & GIT_REF_SYMBOLIC);
|
73
|
-
cl_assert(git_reference_is_packed(reference) == 0);
|
74
|
-
cl_assert_equal_s(reference->name, GIT_HEAD_FILE);
|
75
|
-
|
76
|
-
cl_git_pass(git_reference_resolve(&resolved_ref, reference));
|
77
|
-
cl_assert(git_reference_type(resolved_ref) == GIT_REF_OID);
|
78
|
-
|
79
|
-
cl_git_pass(git_object_lookup(&object, g_repo, git_reference_oid(resolved_ref), GIT_OBJ_ANY));
|
80
|
-
cl_assert(object != NULL);
|
81
|
-
cl_assert(git_object_type(object) == GIT_OBJ_COMMIT);
|
82
|
-
|
83
|
-
git_oid_fromstr(&id, current_master_tip);
|
84
|
-
cl_assert(git_oid_cmp(&id, git_object_id(object)) == 0);
|
85
|
-
|
86
|
-
git_object_free(object);
|
87
|
-
|
88
|
-
git_reference_free(reference);
|
89
|
-
git_reference_free(resolved_ref);
|
90
|
-
}
|
91
|
-
|
92
|
-
void test_refs_read__nested_symbolic(void)
|
93
|
-
{
|
94
|
-
// lookup a nested symbolic reference
|
95
|
-
git_reference *reference, *resolved_ref;
|
96
|
-
git_object *object;
|
97
|
-
git_oid id;
|
98
|
-
|
99
|
-
cl_git_pass(git_reference_lookup(&reference, g_repo, head_tracker_sym_ref_name));
|
100
|
-
cl_assert(git_reference_type(reference) & GIT_REF_SYMBOLIC);
|
101
|
-
cl_assert(git_reference_is_packed(reference) == 0);
|
102
|
-
cl_assert_equal_s(reference->name, head_tracker_sym_ref_name);
|
103
|
-
|
104
|
-
cl_git_pass(git_reference_resolve(&resolved_ref, reference));
|
105
|
-
cl_assert(git_reference_type(resolved_ref) == GIT_REF_OID);
|
106
|
-
|
107
|
-
cl_git_pass(git_object_lookup(&object, g_repo, git_reference_oid(resolved_ref), GIT_OBJ_ANY));
|
108
|
-
cl_assert(object != NULL);
|
109
|
-
cl_assert(git_object_type(object) == GIT_OBJ_COMMIT);
|
110
|
-
|
111
|
-
git_oid_fromstr(&id, current_master_tip);
|
112
|
-
cl_assert(git_oid_cmp(&id, git_object_id(object)) == 0);
|
113
|
-
|
114
|
-
git_object_free(object);
|
115
|
-
|
116
|
-
git_reference_free(reference);
|
117
|
-
git_reference_free(resolved_ref);
|
118
|
-
}
|
119
|
-
|
120
|
-
void test_refs_read__head_then_master(void)
|
121
|
-
{
|
122
|
-
// lookup the HEAD and resolve the master branch
|
123
|
-
git_reference *reference, *resolved_ref, *comp_base_ref;
|
124
|
-
|
125
|
-
cl_git_pass(git_reference_lookup(&reference, g_repo, head_tracker_sym_ref_name));
|
126
|
-
cl_git_pass(git_reference_resolve(&comp_base_ref, reference));
|
127
|
-
git_reference_free(reference);
|
128
|
-
|
129
|
-
cl_git_pass(git_reference_lookup(&reference, g_repo, GIT_HEAD_FILE));
|
130
|
-
cl_git_pass(git_reference_resolve(&resolved_ref, reference));
|
131
|
-
cl_git_pass(git_oid_cmp(git_reference_oid(comp_base_ref), git_reference_oid(resolved_ref)));
|
132
|
-
git_reference_free(reference);
|
133
|
-
git_reference_free(resolved_ref);
|
134
|
-
|
135
|
-
cl_git_pass(git_reference_lookup(&reference, g_repo, current_head_target));
|
136
|
-
cl_git_pass(git_reference_resolve(&resolved_ref, reference));
|
137
|
-
cl_git_pass(git_oid_cmp(git_reference_oid(comp_base_ref), git_reference_oid(resolved_ref)));
|
138
|
-
git_reference_free(reference);
|
139
|
-
git_reference_free(resolved_ref);
|
140
|
-
|
141
|
-
git_reference_free(comp_base_ref);
|
142
|
-
}
|
143
|
-
|
144
|
-
void test_refs_read__master_then_head(void)
|
145
|
-
{
|
146
|
-
// lookup the master branch and then the HEAD
|
147
|
-
git_reference *reference, *master_ref, *resolved_ref;
|
148
|
-
|
149
|
-
cl_git_pass(git_reference_lookup(&master_ref, g_repo, current_head_target));
|
150
|
-
cl_git_pass(git_reference_lookup(&reference, g_repo, GIT_HEAD_FILE));
|
151
|
-
|
152
|
-
cl_git_pass(git_reference_resolve(&resolved_ref, reference));
|
153
|
-
cl_git_pass(git_oid_cmp(git_reference_oid(master_ref), git_reference_oid(resolved_ref)));
|
154
|
-
|
155
|
-
git_reference_free(reference);
|
156
|
-
git_reference_free(resolved_ref);
|
157
|
-
git_reference_free(master_ref);
|
158
|
-
}
|
159
|
-
|
160
|
-
|
161
|
-
void test_refs_read__packed(void)
|
162
|
-
{
|
163
|
-
// lookup a packed reference
|
164
|
-
git_reference *reference;
|
165
|
-
git_object *object;
|
166
|
-
|
167
|
-
cl_git_pass(git_reference_lookup(&reference, g_repo, packed_head_name));
|
168
|
-
cl_assert(git_reference_type(reference) & GIT_REF_OID);
|
169
|
-
cl_assert(git_reference_is_packed(reference));
|
170
|
-
cl_assert_equal_s(reference->name, packed_head_name);
|
171
|
-
|
172
|
-
cl_git_pass(git_object_lookup(&object, g_repo, git_reference_oid(reference), GIT_OBJ_ANY));
|
173
|
-
cl_assert(object != NULL);
|
174
|
-
cl_assert(git_object_type(object) == GIT_OBJ_COMMIT);
|
175
|
-
|
176
|
-
git_object_free(object);
|
177
|
-
|
178
|
-
git_reference_free(reference);
|
179
|
-
}
|
180
|
-
|
181
|
-
void test_refs_read__loose_first(void)
|
182
|
-
{
|
183
|
-
// assure that a loose reference is looked up before a packed reference
|
184
|
-
git_reference *reference;
|
185
|
-
|
186
|
-
cl_git_pass(git_reference_lookup(&reference, g_repo, packed_head_name));
|
187
|
-
git_reference_free(reference);
|
188
|
-
cl_git_pass(git_reference_lookup(&reference, g_repo, packed_test_head_name));
|
189
|
-
cl_assert(git_reference_type(reference) & GIT_REF_OID);
|
190
|
-
cl_assert(git_reference_is_packed(reference) == 0);
|
191
|
-
cl_assert_equal_s(reference->name, packed_test_head_name);
|
192
|
-
|
193
|
-
git_reference_free(reference);
|
194
|
-
}
|
@@ -1,123 +0,0 @@
|
|
1
|
-
#include "clar_libgit2.h"
|
2
|
-
|
3
|
-
#include "repository.h"
|
4
|
-
#include "git2/reflog.h"
|
5
|
-
#include "reflog.h"
|
6
|
-
|
7
|
-
|
8
|
-
static const char *new_ref = "refs/heads/test-reflog";
|
9
|
-
static const char *current_master_tip = "a65fedf39aefe402d3bb6e24df4d4f5fe4547750";
|
10
|
-
static const char *commit_msg = "commit: bla bla";
|
11
|
-
|
12
|
-
static git_repository *g_repo;
|
13
|
-
|
14
|
-
|
15
|
-
// helpers
|
16
|
-
static void assert_signature(git_signature *expected, git_signature *actual)
|
17
|
-
{
|
18
|
-
cl_assert(actual);
|
19
|
-
cl_assert_equal_s(expected->name, actual->name);
|
20
|
-
cl_assert_equal_s(expected->email, actual->email);
|
21
|
-
cl_assert(expected->when.offset == actual->when.offset);
|
22
|
-
cl_assert(expected->when.time == actual->when.time);
|
23
|
-
}
|
24
|
-
|
25
|
-
|
26
|
-
// Fixture setup and teardown
|
27
|
-
void test_refs_reflog__initialize(void)
|
28
|
-
{
|
29
|
-
g_repo = cl_git_sandbox_init("testrepo");
|
30
|
-
}
|
31
|
-
|
32
|
-
void test_refs_reflog__cleanup(void)
|
33
|
-
{
|
34
|
-
cl_git_sandbox_cleanup();
|
35
|
-
}
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
void test_refs_reflog__write_then_read(void)
|
40
|
-
{
|
41
|
-
// write a reflog for a given reference and ensure it can be read back
|
42
|
-
git_repository *repo2;
|
43
|
-
git_reference *ref, *lookedup_ref;
|
44
|
-
git_oid oid;
|
45
|
-
git_signature *committer;
|
46
|
-
git_reflog *reflog;
|
47
|
-
git_reflog_entry *entry;
|
48
|
-
char oid_str[GIT_OID_HEXSZ+1];
|
49
|
-
|
50
|
-
/* Create a new branch pointing at the HEAD */
|
51
|
-
git_oid_fromstr(&oid, current_master_tip);
|
52
|
-
cl_git_pass(git_reference_create_oid(&ref, g_repo, new_ref, &oid, 0));
|
53
|
-
git_reference_free(ref);
|
54
|
-
cl_git_pass(git_reference_lookup(&ref, g_repo, new_ref));
|
55
|
-
|
56
|
-
cl_git_pass(git_signature_now(&committer, "foo", "foo@bar"));
|
57
|
-
|
58
|
-
cl_git_pass(git_reflog_write(ref, NULL, committer, NULL));
|
59
|
-
cl_git_fail(git_reflog_write(ref, NULL, committer, "no ancestor NULL for an existing reflog"));
|
60
|
-
cl_git_fail(git_reflog_write(ref, NULL, committer, "no\nnewline"));
|
61
|
-
cl_git_pass(git_reflog_write(ref, &oid, committer, commit_msg));
|
62
|
-
|
63
|
-
/* Reopen a new instance of the repository */
|
64
|
-
cl_git_pass(git_repository_open(&repo2, "testrepo"));
|
65
|
-
|
66
|
-
/* Lookup the preivously created branch */
|
67
|
-
cl_git_pass(git_reference_lookup(&lookedup_ref, repo2, new_ref));
|
68
|
-
|
69
|
-
/* Read and parse the reflog for this branch */
|
70
|
-
cl_git_pass(git_reflog_read(&reflog, lookedup_ref));
|
71
|
-
cl_assert(reflog->entries.length == 2);
|
72
|
-
|
73
|
-
entry = (git_reflog_entry *)git_vector_get(&reflog->entries, 0);
|
74
|
-
assert_signature(committer, entry->committer);
|
75
|
-
git_oid_tostr(oid_str, GIT_OID_HEXSZ+1, &entry->oid_old);
|
76
|
-
cl_assert_equal_s("0000000000000000000000000000000000000000", oid_str);
|
77
|
-
git_oid_tostr(oid_str, GIT_OID_HEXSZ+1, &entry->oid_cur);
|
78
|
-
cl_assert_equal_s(current_master_tip, oid_str);
|
79
|
-
cl_assert(entry->msg == NULL);
|
80
|
-
|
81
|
-
entry = (git_reflog_entry *)git_vector_get(&reflog->entries, 1);
|
82
|
-
assert_signature(committer, entry->committer);
|
83
|
-
git_oid_tostr(oid_str, GIT_OID_HEXSZ+1, &entry->oid_old);
|
84
|
-
cl_assert_equal_s(current_master_tip, oid_str);
|
85
|
-
git_oid_tostr(oid_str, GIT_OID_HEXSZ+1, &entry->oid_cur);
|
86
|
-
cl_assert_equal_s(current_master_tip, oid_str);
|
87
|
-
cl_assert_equal_s(commit_msg, entry->msg);
|
88
|
-
|
89
|
-
git_signature_free(committer);
|
90
|
-
git_reflog_free(reflog);
|
91
|
-
git_repository_free(repo2);
|
92
|
-
|
93
|
-
git_reference_free(ref);
|
94
|
-
git_reference_free(lookedup_ref);
|
95
|
-
}
|
96
|
-
|
97
|
-
void test_refs_reflog__dont_write_bad(void)
|
98
|
-
{
|
99
|
-
// avoid writing an obviously wrong reflog
|
100
|
-
git_reference *ref;
|
101
|
-
git_oid oid;
|
102
|
-
git_signature *committer;
|
103
|
-
|
104
|
-
/* Create a new branch pointing at the HEAD */
|
105
|
-
git_oid_fromstr(&oid, current_master_tip);
|
106
|
-
cl_git_pass(git_reference_create_oid(&ref, g_repo, new_ref, &oid, 0));
|
107
|
-
git_reference_free(ref);
|
108
|
-
cl_git_pass(git_reference_lookup(&ref, g_repo, new_ref));
|
109
|
-
|
110
|
-
cl_git_pass(git_signature_now(&committer, "foo", "foo@bar"));
|
111
|
-
|
112
|
-
/* Write the reflog for the new branch */
|
113
|
-
cl_git_pass(git_reflog_write(ref, NULL, committer, NULL));
|
114
|
-
|
115
|
-
/* Try to update the reflog with wrong information:
|
116
|
-
* It's no new reference, so the ancestor OID cannot
|
117
|
-
* be NULL. */
|
118
|
-
cl_git_fail(git_reflog_write(ref, NULL, committer, NULL));
|
119
|
-
|
120
|
-
git_signature_free(committer);
|
121
|
-
|
122
|
-
git_reference_free(ref);
|
123
|
-
}
|
@@ -1,339 +0,0 @@
|
|
1
|
-
#include "clar_libgit2.h"
|
2
|
-
|
3
|
-
#include "repository.h"
|
4
|
-
#include "git2/reflog.h"
|
5
|
-
#include "reflog.h"
|
6
|
-
|
7
|
-
static const char *loose_tag_ref_name = "refs/tags/e90810b";
|
8
|
-
static const char *packed_head_name = "refs/heads/packed";
|
9
|
-
static const char *packed_test_head_name = "refs/heads/packed-test";
|
10
|
-
static const char *ref_one_name = "refs/heads/one/branch";
|
11
|
-
static const char *ref_one_name_new = "refs/heads/two/branch";
|
12
|
-
static const char *ref_two_name = "refs/heads/two";
|
13
|
-
static const char *ref_master_name = "refs/heads/master";
|
14
|
-
static const char *ref_two_name_new = "refs/heads/two/two";
|
15
|
-
|
16
|
-
static git_repository *g_repo;
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
void test_refs_rename__initialize(void)
|
21
|
-
{
|
22
|
-
g_repo = cl_git_sandbox_init("testrepo");
|
23
|
-
}
|
24
|
-
|
25
|
-
void test_refs_rename__cleanup(void)
|
26
|
-
{
|
27
|
-
cl_git_sandbox_cleanup();
|
28
|
-
}
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
void test_refs_rename__loose(void)
|
33
|
-
{
|
34
|
-
// rename a loose reference
|
35
|
-
git_reference *looked_up_ref, *another_looked_up_ref;
|
36
|
-
git_buf temp_path = GIT_BUF_INIT;
|
37
|
-
const char *new_name = "refs/tags/Nemo/knows/refs.kung-fu";
|
38
|
-
|
39
|
-
/* Ensure the ref doesn't exist on the file system */
|
40
|
-
cl_git_pass(git_buf_joinpath(&temp_path, g_repo->path_repository, new_name));
|
41
|
-
cl_assert(!git_path_exists(temp_path.ptr));
|
42
|
-
|
43
|
-
/* Retrieval of the reference to rename */
|
44
|
-
cl_git_pass(git_reference_lookup(&looked_up_ref, g_repo, loose_tag_ref_name));
|
45
|
-
|
46
|
-
/* ... which is indeed loose */
|
47
|
-
cl_assert(git_reference_is_packed(looked_up_ref) == 0);
|
48
|
-
|
49
|
-
/* Now that the reference is renamed... */
|
50
|
-
cl_git_pass(git_reference_rename(looked_up_ref, new_name, 0));
|
51
|
-
cl_assert_equal_s(looked_up_ref->name, new_name);
|
52
|
-
|
53
|
-
/* ...It can't be looked-up with the old name... */
|
54
|
-
cl_git_fail(git_reference_lookup(&another_looked_up_ref, g_repo, loose_tag_ref_name));
|
55
|
-
|
56
|
-
/* ...but the new name works ok... */
|
57
|
-
cl_git_pass(git_reference_lookup(&another_looked_up_ref, g_repo, new_name));
|
58
|
-
cl_assert_equal_s(another_looked_up_ref->name, new_name);
|
59
|
-
|
60
|
-
/* .. the ref is still loose... */
|
61
|
-
cl_assert(git_reference_is_packed(another_looked_up_ref) == 0);
|
62
|
-
cl_assert(git_reference_is_packed(looked_up_ref) == 0);
|
63
|
-
|
64
|
-
/* ...and the ref can be found in the file system */
|
65
|
-
cl_git_pass(git_buf_joinpath(&temp_path, g_repo->path_repository, new_name));
|
66
|
-
cl_assert(git_path_exists(temp_path.ptr));
|
67
|
-
|
68
|
-
git_reference_free(looked_up_ref);
|
69
|
-
git_reference_free(another_looked_up_ref);
|
70
|
-
git_buf_free(&temp_path);
|
71
|
-
}
|
72
|
-
|
73
|
-
void test_refs_rename__packed(void)
|
74
|
-
{
|
75
|
-
// rename a packed reference (should make it loose)
|
76
|
-
git_reference *looked_up_ref, *another_looked_up_ref;
|
77
|
-
git_buf temp_path = GIT_BUF_INIT;
|
78
|
-
const char *brand_new_name = "refs/heads/brand_new_name";
|
79
|
-
|
80
|
-
/* Ensure the ref doesn't exist on the file system */
|
81
|
-
cl_git_pass(git_buf_joinpath(&temp_path, g_repo->path_repository, packed_head_name));
|
82
|
-
cl_assert(!git_path_exists(temp_path.ptr));
|
83
|
-
|
84
|
-
/* The reference can however be looked-up... */
|
85
|
-
cl_git_pass(git_reference_lookup(&looked_up_ref, g_repo, packed_head_name));
|
86
|
-
|
87
|
-
/* .. and it's packed */
|
88
|
-
cl_assert(git_reference_is_packed(looked_up_ref) != 0);
|
89
|
-
|
90
|
-
/* Now that the reference is renamed... */
|
91
|
-
cl_git_pass(git_reference_rename(looked_up_ref, brand_new_name, 0));
|
92
|
-
cl_assert_equal_s(looked_up_ref->name, brand_new_name);
|
93
|
-
|
94
|
-
/* ...It can't be looked-up with the old name... */
|
95
|
-
cl_git_fail(git_reference_lookup(&another_looked_up_ref, g_repo, packed_head_name));
|
96
|
-
|
97
|
-
/* ...but the new name works ok... */
|
98
|
-
cl_git_pass(git_reference_lookup(&another_looked_up_ref, g_repo, brand_new_name));
|
99
|
-
cl_assert_equal_s(another_looked_up_ref->name, brand_new_name);
|
100
|
-
|
101
|
-
/* .. the ref is no longer packed... */
|
102
|
-
cl_assert(git_reference_is_packed(another_looked_up_ref) == 0);
|
103
|
-
cl_assert(git_reference_is_packed(looked_up_ref) == 0);
|
104
|
-
|
105
|
-
/* ...and the ref now happily lives in the file system */
|
106
|
-
cl_git_pass(git_buf_joinpath(&temp_path, g_repo->path_repository, brand_new_name));
|
107
|
-
cl_assert(git_path_exists(temp_path.ptr));
|
108
|
-
|
109
|
-
git_reference_free(looked_up_ref);
|
110
|
-
git_reference_free(another_looked_up_ref);
|
111
|
-
git_buf_free(&temp_path);
|
112
|
-
}
|
113
|
-
|
114
|
-
void test_refs_rename__packed_doesnt_pack_others(void)
|
115
|
-
{
|
116
|
-
// renaming a packed reference does not pack another reference which happens to be in both loose and pack state
|
117
|
-
git_reference *looked_up_ref, *another_looked_up_ref;
|
118
|
-
git_buf temp_path = GIT_BUF_INIT;
|
119
|
-
const char *brand_new_name = "refs/heads/brand_new_name";
|
120
|
-
|
121
|
-
/* Ensure the other reference exists on the file system */
|
122
|
-
cl_git_pass(git_buf_joinpath(&temp_path, g_repo->path_repository, packed_test_head_name));
|
123
|
-
cl_assert(git_path_exists(temp_path.ptr));
|
124
|
-
|
125
|
-
/* Lookup the other reference */
|
126
|
-
cl_git_pass(git_reference_lookup(&another_looked_up_ref, g_repo, packed_test_head_name));
|
127
|
-
|
128
|
-
/* Ensure it's loose */
|
129
|
-
cl_assert(git_reference_is_packed(another_looked_up_ref) == 0);
|
130
|
-
git_reference_free(another_looked_up_ref);
|
131
|
-
|
132
|
-
/* Lookup the reference to rename */
|
133
|
-
cl_git_pass(git_reference_lookup(&looked_up_ref, g_repo, packed_head_name));
|
134
|
-
|
135
|
-
/* Ensure it's packed */
|
136
|
-
cl_assert(git_reference_is_packed(looked_up_ref) != 0);
|
137
|
-
|
138
|
-
/* Now that the reference is renamed... */
|
139
|
-
cl_git_pass(git_reference_rename(looked_up_ref, brand_new_name, 0));
|
140
|
-
|
141
|
-
/* Lookup the other reference */
|
142
|
-
cl_git_pass(git_reference_lookup(&another_looked_up_ref, g_repo, packed_test_head_name));
|
143
|
-
|
144
|
-
/* Ensure it's loose */
|
145
|
-
cl_assert(git_reference_is_packed(another_looked_up_ref) == 0);
|
146
|
-
|
147
|
-
/* Ensure the other ref still exists on the file system */
|
148
|
-
cl_assert(git_path_exists(temp_path.ptr));
|
149
|
-
|
150
|
-
git_reference_free(looked_up_ref);
|
151
|
-
git_reference_free(another_looked_up_ref);
|
152
|
-
git_buf_free(&temp_path);
|
153
|
-
}
|
154
|
-
|
155
|
-
void test_refs_rename__name_collision(void)
|
156
|
-
{
|
157
|
-
// can not rename a reference with the name of an existing reference
|
158
|
-
git_reference *looked_up_ref;
|
159
|
-
|
160
|
-
/* An existing reference... */
|
161
|
-
cl_git_pass(git_reference_lookup(&looked_up_ref, g_repo, packed_head_name));
|
162
|
-
|
163
|
-
/* Can not be renamed to the name of another existing reference. */
|
164
|
-
cl_git_fail(git_reference_rename(looked_up_ref, packed_test_head_name, 0));
|
165
|
-
git_reference_free(looked_up_ref);
|
166
|
-
|
167
|
-
/* Failure to rename it hasn't corrupted its state */
|
168
|
-
cl_git_pass(git_reference_lookup(&looked_up_ref, g_repo, packed_head_name));
|
169
|
-
cl_assert_equal_s(looked_up_ref->name, packed_head_name);
|
170
|
-
|
171
|
-
git_reference_free(looked_up_ref);
|
172
|
-
}
|
173
|
-
|
174
|
-
void test_refs_rename__invalid_name(void)
|
175
|
-
{
|
176
|
-
// can not rename a reference with an invalid name
|
177
|
-
git_reference *looked_up_ref;
|
178
|
-
|
179
|
-
/* An existing oid reference... */
|
180
|
-
cl_git_pass(git_reference_lookup(&looked_up_ref, g_repo, packed_test_head_name));
|
181
|
-
|
182
|
-
/* Can not be renamed with an invalid name. */
|
183
|
-
cl_git_fail(git_reference_rename(looked_up_ref, "Hello! I'm a very invalid name.", 0));
|
184
|
-
|
185
|
-
/* Can not be renamed outside of the refs hierarchy. */
|
186
|
-
cl_git_fail(git_reference_rename(looked_up_ref, "i-will-sudo-you", 0));
|
187
|
-
|
188
|
-
/* Failure to rename it hasn't corrupted its state */
|
189
|
-
git_reference_free(looked_up_ref);
|
190
|
-
cl_git_pass(git_reference_lookup(&looked_up_ref, g_repo, packed_test_head_name));
|
191
|
-
cl_assert_equal_s(looked_up_ref->name, packed_test_head_name);
|
192
|
-
|
193
|
-
git_reference_free(looked_up_ref);
|
194
|
-
}
|
195
|
-
|
196
|
-
void test_refs_rename__force_loose_packed(void)
|
197
|
-
{
|
198
|
-
// can force-rename a packed reference with the name of an existing loose and packed reference
|
199
|
-
git_reference *looked_up_ref;
|
200
|
-
git_oid oid;
|
201
|
-
|
202
|
-
/* An existing reference... */
|
203
|
-
cl_git_pass(git_reference_lookup(&looked_up_ref, g_repo, packed_head_name));
|
204
|
-
git_oid_cpy(&oid, git_reference_oid(looked_up_ref));
|
205
|
-
|
206
|
-
/* Can be force-renamed to the name of another existing reference. */
|
207
|
-
cl_git_pass(git_reference_rename(looked_up_ref, packed_test_head_name, 1));
|
208
|
-
git_reference_free(looked_up_ref);
|
209
|
-
|
210
|
-
/* Check we actually renamed it */
|
211
|
-
cl_git_pass(git_reference_lookup(&looked_up_ref, g_repo, packed_test_head_name));
|
212
|
-
cl_assert_equal_s(looked_up_ref->name, packed_test_head_name);
|
213
|
-
cl_assert(!git_oid_cmp(&oid, git_reference_oid(looked_up_ref)));
|
214
|
-
git_reference_free(looked_up_ref);
|
215
|
-
|
216
|
-
/* And that the previous one doesn't exist any longer */
|
217
|
-
cl_git_fail(git_reference_lookup(&looked_up_ref, g_repo, packed_head_name));
|
218
|
-
}
|
219
|
-
|
220
|
-
void test_refs_rename__force_loose(void)
|
221
|
-
{
|
222
|
-
// can force-rename a loose reference with the name of an existing loose reference
|
223
|
-
git_reference *looked_up_ref;
|
224
|
-
git_oid oid;
|
225
|
-
|
226
|
-
/* An existing reference... */
|
227
|
-
cl_git_pass(git_reference_lookup(&looked_up_ref, g_repo, "refs/heads/br2"));
|
228
|
-
git_oid_cpy(&oid, git_reference_oid(looked_up_ref));
|
229
|
-
|
230
|
-
/* Can be force-renamed to the name of another existing reference. */
|
231
|
-
cl_git_pass(git_reference_rename(looked_up_ref, "refs/heads/test", 1));
|
232
|
-
git_reference_free(looked_up_ref);
|
233
|
-
|
234
|
-
/* Check we actually renamed it */
|
235
|
-
cl_git_pass(git_reference_lookup(&looked_up_ref, g_repo, "refs/heads/test"));
|
236
|
-
cl_assert_equal_s(looked_up_ref->name, "refs/heads/test");
|
237
|
-
cl_assert(!git_oid_cmp(&oid, git_reference_oid(looked_up_ref)));
|
238
|
-
git_reference_free(looked_up_ref);
|
239
|
-
|
240
|
-
/* And that the previous one doesn't exist any longer */
|
241
|
-
cl_git_fail(git_reference_lookup(&looked_up_ref, g_repo, "refs/heads/br2"));
|
242
|
-
|
243
|
-
git_reference_free(looked_up_ref);
|
244
|
-
}
|
245
|
-
|
246
|
-
|
247
|
-
void test_refs_rename__overwrite(void)
|
248
|
-
{
|
249
|
-
// can not overwrite name of existing reference
|
250
|
-
git_reference *ref, *ref_one, *ref_one_new, *ref_two;
|
251
|
-
git_oid id;
|
252
|
-
|
253
|
-
cl_git_pass(git_reference_lookup(&ref, g_repo, ref_master_name));
|
254
|
-
cl_assert(git_reference_type(ref) & GIT_REF_OID);
|
255
|
-
|
256
|
-
git_oid_cpy(&id, git_reference_oid(ref));
|
257
|
-
|
258
|
-
/* Create loose references */
|
259
|
-
cl_git_pass(git_reference_create_oid(&ref_one, g_repo, ref_one_name, &id, 0));
|
260
|
-
cl_git_pass(git_reference_create_oid(&ref_two, g_repo, ref_two_name, &id, 0));
|
261
|
-
|
262
|
-
/* Pack everything */
|
263
|
-
cl_git_pass(git_reference_packall(g_repo));
|
264
|
-
|
265
|
-
/* Attempt to create illegal reference */
|
266
|
-
cl_git_fail(git_reference_create_oid(&ref_one_new, g_repo, ref_one_name_new, &id, 0));
|
267
|
-
|
268
|
-
/* Illegal reference couldn't be created so this is supposed to fail */
|
269
|
-
cl_git_fail(git_reference_lookup(&ref_one_new, g_repo, ref_one_name_new));
|
270
|
-
|
271
|
-
git_reference_free(ref);
|
272
|
-
git_reference_free(ref_one);
|
273
|
-
git_reference_free(ref_one_new);
|
274
|
-
git_reference_free(ref_two);
|
275
|
-
}
|
276
|
-
|
277
|
-
|
278
|
-
void test_refs_rename__prefix(void)
|
279
|
-
{
|
280
|
-
// can be renamed to a new name prefixed with the old name
|
281
|
-
git_reference *ref, *ref_two, *looked_up_ref;
|
282
|
-
git_oid id;
|
283
|
-
|
284
|
-
cl_git_pass(git_reference_lookup(&ref, g_repo, ref_master_name));
|
285
|
-
cl_assert(git_reference_type(ref) & GIT_REF_OID);
|
286
|
-
|
287
|
-
git_oid_cpy(&id, git_reference_oid(ref));
|
288
|
-
|
289
|
-
/* Create loose references */
|
290
|
-
cl_git_pass(git_reference_create_oid(&ref_two, g_repo, ref_two_name, &id, 0));
|
291
|
-
|
292
|
-
/* An existing reference... */
|
293
|
-
cl_git_pass(git_reference_lookup(&looked_up_ref, g_repo, ref_two_name));
|
294
|
-
|
295
|
-
/* Can be rename to a new name starting with the old name. */
|
296
|
-
cl_git_pass(git_reference_rename(looked_up_ref, ref_two_name_new, 0));
|
297
|
-
git_reference_free(looked_up_ref);
|
298
|
-
|
299
|
-
/* Check we actually renamed it */
|
300
|
-
cl_git_pass(git_reference_lookup(&looked_up_ref, g_repo, ref_two_name_new));
|
301
|
-
cl_assert_equal_s(looked_up_ref->name, ref_two_name_new);
|
302
|
-
git_reference_free(looked_up_ref);
|
303
|
-
cl_git_fail(git_reference_lookup(&looked_up_ref, g_repo, ref_two_name));
|
304
|
-
|
305
|
-
git_reference_free(ref);
|
306
|
-
git_reference_free(ref_two);
|
307
|
-
git_reference_free(looked_up_ref);
|
308
|
-
}
|
309
|
-
|
310
|
-
void test_refs_rename__move_up(void)
|
311
|
-
{
|
312
|
-
// can move a reference to a upper reference hierarchy
|
313
|
-
git_reference *ref, *ref_two, *looked_up_ref;
|
314
|
-
git_oid id;
|
315
|
-
|
316
|
-
cl_git_pass(git_reference_lookup(&ref, g_repo, ref_master_name));
|
317
|
-
cl_assert(git_reference_type(ref) & GIT_REF_OID);
|
318
|
-
|
319
|
-
git_oid_cpy(&id, git_reference_oid(ref));
|
320
|
-
|
321
|
-
/* Create loose references */
|
322
|
-
cl_git_pass(git_reference_create_oid(&ref_two, g_repo, ref_two_name_new, &id, 0));
|
323
|
-
git_reference_free(ref_two);
|
324
|
-
|
325
|
-
/* An existing reference... */
|
326
|
-
cl_git_pass(git_reference_lookup(&looked_up_ref, g_repo, ref_two_name_new));
|
327
|
-
|
328
|
-
/* Can be renamed upward the reference tree. */
|
329
|
-
cl_git_pass(git_reference_rename(looked_up_ref, ref_two_name, 0));
|
330
|
-
git_reference_free(looked_up_ref);
|
331
|
-
|
332
|
-
/* Check we actually renamed it */
|
333
|
-
cl_git_pass(git_reference_lookup(&looked_up_ref, g_repo, ref_two_name));
|
334
|
-
cl_assert_equal_s(looked_up_ref->name, ref_two_name);
|
335
|
-
git_reference_free(looked_up_ref);
|
336
|
-
cl_git_fail(git_reference_lookup(&looked_up_ref, g_repo, ref_two_name_new));
|
337
|
-
git_reference_free(ref);
|
338
|
-
git_reference_free(looked_up_ref);
|
339
|
-
}
|