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,61 +0,0 @@
|
|
1
|
-
#include "clar_libgit2.h"
|
2
|
-
|
3
|
-
#include "filebuf.h"
|
4
|
-
#include "fileops.h"
|
5
|
-
#include "posix.h"
|
6
|
-
|
7
|
-
void test_config_stress__initialize(void)
|
8
|
-
{
|
9
|
-
git_filebuf file = GIT_FILEBUF_INIT;
|
10
|
-
|
11
|
-
cl_git_pass(git_filebuf_open(&file, "git-test-config", 0));
|
12
|
-
|
13
|
-
git_filebuf_printf(&file, "[color]\n\tui = auto\n");
|
14
|
-
git_filebuf_printf(&file, "[core]\n\teditor = \n");
|
15
|
-
|
16
|
-
cl_git_pass(git_filebuf_commit(&file, 0666));
|
17
|
-
}
|
18
|
-
|
19
|
-
void test_config_stress__cleanup(void)
|
20
|
-
{
|
21
|
-
p_unlink("git-test-config");
|
22
|
-
}
|
23
|
-
|
24
|
-
void test_config_stress__dont_break_on_invalid_input(void)
|
25
|
-
{
|
26
|
-
const char *editor, *color;
|
27
|
-
struct git_config_file *file;
|
28
|
-
git_config *config;
|
29
|
-
|
30
|
-
cl_assert(git_path_exists("git-test-config"));
|
31
|
-
cl_git_pass(git_config_file__ondisk(&file, "git-test-config"));
|
32
|
-
cl_git_pass(git_config_new(&config));
|
33
|
-
cl_git_pass(git_config_add_file(config, file, 0));
|
34
|
-
|
35
|
-
cl_git_pass(git_config_get_string(&color, config, "color.ui"));
|
36
|
-
cl_git_pass(git_config_get_string(&editor, config, "core.editor"));
|
37
|
-
|
38
|
-
git_config_free(config);
|
39
|
-
}
|
40
|
-
|
41
|
-
void test_config_stress__comments(void)
|
42
|
-
{
|
43
|
-
struct git_config_file *file;
|
44
|
-
git_config *config;
|
45
|
-
const char *str;
|
46
|
-
|
47
|
-
cl_git_pass(git_config_file__ondisk(&file, cl_fixture("config/config12")));
|
48
|
-
cl_git_pass(git_config_new(&config));
|
49
|
-
cl_git_pass(git_config_add_file(config, file, 0));
|
50
|
-
|
51
|
-
cl_git_pass(git_config_get_string(&str, config, "some.section.other"));
|
52
|
-
cl_assert(!strcmp(str, "hello! \" ; ; ; "));
|
53
|
-
|
54
|
-
cl_git_pass(git_config_get_string(&str, config, "some.section.multi"));
|
55
|
-
cl_assert(!strcmp(str, "hi, this is a ; multiline comment # with ;\n special chars and other stuff !@#"));
|
56
|
-
|
57
|
-
cl_git_pass(git_config_get_string(&str, config, "some.section.back"));
|
58
|
-
cl_assert(!strcmp(str, "this is \ba phrase"));
|
59
|
-
|
60
|
-
git_config_free(config);
|
61
|
-
}
|
@@ -1,92 +0,0 @@
|
|
1
|
-
#include "clar_libgit2.h"
|
2
|
-
|
3
|
-
void test_config_write__initialize(void)
|
4
|
-
{
|
5
|
-
cl_fixture_sandbox("config/config9");
|
6
|
-
}
|
7
|
-
|
8
|
-
void test_config_write__cleanup(void)
|
9
|
-
{
|
10
|
-
cl_fixture_cleanup("config9");
|
11
|
-
}
|
12
|
-
|
13
|
-
void test_config_write__replace_value(void)
|
14
|
-
{
|
15
|
-
git_config *cfg;
|
16
|
-
int i;
|
17
|
-
int64_t l, expected = +9223372036854775803;
|
18
|
-
|
19
|
-
/* By freeing the config, we make sure we flush the values */
|
20
|
-
cl_git_pass(git_config_open_ondisk(&cfg, "config9"));
|
21
|
-
cl_git_pass(git_config_set_int32(cfg, "core.dummy", 5));
|
22
|
-
git_config_free(cfg);
|
23
|
-
|
24
|
-
cl_git_pass(git_config_open_ondisk(&cfg, "config9"));
|
25
|
-
cl_git_pass(git_config_get_int32(&i, cfg, "core.dummy"));
|
26
|
-
cl_assert(i == 5);
|
27
|
-
git_config_free(cfg);
|
28
|
-
|
29
|
-
cl_git_pass(git_config_open_ondisk(&cfg, "config9"));
|
30
|
-
cl_git_pass(git_config_set_int32(cfg, "core.dummy", 1));
|
31
|
-
git_config_free(cfg);
|
32
|
-
|
33
|
-
cl_git_pass(git_config_open_ondisk(&cfg, "config9"));
|
34
|
-
cl_git_pass(git_config_set_int64(cfg, "core.verylong", expected));
|
35
|
-
git_config_free(cfg);
|
36
|
-
|
37
|
-
cl_git_pass(git_config_open_ondisk(&cfg, "config9"));
|
38
|
-
cl_git_pass(git_config_get_int64(&l, cfg, "core.verylong"));
|
39
|
-
cl_assert(l == expected);
|
40
|
-
git_config_free(cfg);
|
41
|
-
|
42
|
-
cl_git_pass(git_config_open_ondisk(&cfg, "config9"));
|
43
|
-
cl_must_fail(git_config_get_int32(&i, cfg, "core.verylong"));
|
44
|
-
git_config_free(cfg);
|
45
|
-
|
46
|
-
cl_git_pass(git_config_open_ondisk(&cfg, "config9"));
|
47
|
-
cl_git_pass(git_config_set_int64(cfg, "core.verylong", 1));
|
48
|
-
git_config_free(cfg);
|
49
|
-
}
|
50
|
-
|
51
|
-
void test_config_write__delete_value(void)
|
52
|
-
{
|
53
|
-
git_config *cfg;
|
54
|
-
int32_t i;
|
55
|
-
|
56
|
-
cl_git_pass(git_config_open_ondisk(&cfg, "config9"));
|
57
|
-
cl_git_pass(git_config_set_int32(cfg, "core.dummy", 5));
|
58
|
-
git_config_free(cfg);
|
59
|
-
|
60
|
-
cl_git_pass(git_config_open_ondisk(&cfg, "config9"));
|
61
|
-
cl_git_pass(git_config_delete(cfg, "core.dummy"));
|
62
|
-
git_config_free(cfg);
|
63
|
-
|
64
|
-
cl_git_pass(git_config_open_ondisk(&cfg, "config9"));
|
65
|
-
cl_assert(git_config_get_int32(&i, cfg, "core.dummy") == GIT_ENOTFOUND);
|
66
|
-
cl_git_pass(git_config_set_int32(cfg, "core.dummy", 1));
|
67
|
-
git_config_free(cfg);
|
68
|
-
}
|
69
|
-
|
70
|
-
void test_config_write__write_subsection(void)
|
71
|
-
{
|
72
|
-
git_config *cfg;
|
73
|
-
const char *str;
|
74
|
-
|
75
|
-
cl_git_pass(git_config_open_ondisk(&cfg, "config9"));
|
76
|
-
cl_git_pass(git_config_set_string(cfg, "my.own.var", "works"));
|
77
|
-
git_config_free(cfg);
|
78
|
-
|
79
|
-
cl_git_pass(git_config_open_ondisk(&cfg, "config9"));
|
80
|
-
cl_git_pass(git_config_get_string(&str, cfg, "my.own.var"));
|
81
|
-
cl_git_pass(strcmp(str, "works"));
|
82
|
-
git_config_free(cfg);
|
83
|
-
}
|
84
|
-
|
85
|
-
void test_config_write__delete_inexistent(void)
|
86
|
-
{
|
87
|
-
git_config *cfg;
|
88
|
-
|
89
|
-
cl_git_pass(git_config_open_ondisk(&cfg, "config9"));
|
90
|
-
cl_assert(git_config_delete(cfg, "core.imaginary") == GIT_ENOTFOUND);
|
91
|
-
git_config_free(cfg);
|
92
|
-
}
|
@@ -1,613 +0,0 @@
|
|
1
|
-
#include "clar_libgit2.h"
|
2
|
-
#include "buffer.h"
|
3
|
-
|
4
|
-
#define TESTSTR "Have you seen that? Have you seeeen that??"
|
5
|
-
const char *test_string = TESTSTR;
|
6
|
-
const char *test_string_x2 = TESTSTR TESTSTR;
|
7
|
-
|
8
|
-
#define TESTSTR_4096 REP1024("1234")
|
9
|
-
#define TESTSTR_8192 REP1024("12341234")
|
10
|
-
const char *test_4096 = TESTSTR_4096;
|
11
|
-
const char *test_8192 = TESTSTR_8192;
|
12
|
-
|
13
|
-
/* test basic data concatenation */
|
14
|
-
void test_core_buffer__0(void)
|
15
|
-
{
|
16
|
-
git_buf buf = GIT_BUF_INIT;
|
17
|
-
|
18
|
-
cl_assert(buf.size == 0);
|
19
|
-
|
20
|
-
git_buf_puts(&buf, test_string);
|
21
|
-
cl_assert(git_buf_oom(&buf) == 0);
|
22
|
-
cl_assert_equal_s(test_string, git_buf_cstr(&buf));
|
23
|
-
|
24
|
-
git_buf_puts(&buf, test_string);
|
25
|
-
cl_assert(git_buf_oom(&buf) == 0);
|
26
|
-
cl_assert_equal_s(test_string_x2, git_buf_cstr(&buf));
|
27
|
-
|
28
|
-
git_buf_free(&buf);
|
29
|
-
}
|
30
|
-
|
31
|
-
/* test git_buf_printf */
|
32
|
-
void test_core_buffer__1(void)
|
33
|
-
{
|
34
|
-
git_buf buf = GIT_BUF_INIT;
|
35
|
-
|
36
|
-
git_buf_printf(&buf, "%s %s %d ", "shoop", "da", 23);
|
37
|
-
cl_assert(git_buf_oom(&buf) == 0);
|
38
|
-
cl_assert_equal_s("shoop da 23 ", git_buf_cstr(&buf));
|
39
|
-
|
40
|
-
git_buf_printf(&buf, "%s %d", "woop", 42);
|
41
|
-
cl_assert(git_buf_oom(&buf) == 0);
|
42
|
-
cl_assert_equal_s("shoop da 23 woop 42", git_buf_cstr(&buf));
|
43
|
-
|
44
|
-
git_buf_free(&buf);
|
45
|
-
}
|
46
|
-
|
47
|
-
/* more thorough test of concatenation options */
|
48
|
-
void test_core_buffer__2(void)
|
49
|
-
{
|
50
|
-
git_buf buf = GIT_BUF_INIT;
|
51
|
-
int i;
|
52
|
-
char data[128];
|
53
|
-
|
54
|
-
cl_assert(buf.size == 0);
|
55
|
-
|
56
|
-
/* this must be safe to do */
|
57
|
-
git_buf_free(&buf);
|
58
|
-
cl_assert(buf.size == 0);
|
59
|
-
cl_assert(buf.asize == 0);
|
60
|
-
|
61
|
-
/* empty buffer should be empty string */
|
62
|
-
cl_assert_equal_s("", git_buf_cstr(&buf));
|
63
|
-
cl_assert(buf.size == 0);
|
64
|
-
/* cl_assert(buf.asize == 0); -- should not assume what git_buf does */
|
65
|
-
|
66
|
-
/* free should set us back to the beginning */
|
67
|
-
git_buf_free(&buf);
|
68
|
-
cl_assert(buf.size == 0);
|
69
|
-
cl_assert(buf.asize == 0);
|
70
|
-
|
71
|
-
/* add letter */
|
72
|
-
git_buf_putc(&buf, '+');
|
73
|
-
cl_assert(git_buf_oom(&buf) == 0);
|
74
|
-
cl_assert_equal_s("+", git_buf_cstr(&buf));
|
75
|
-
|
76
|
-
/* add letter again */
|
77
|
-
git_buf_putc(&buf, '+');
|
78
|
-
cl_assert(git_buf_oom(&buf) == 0);
|
79
|
-
cl_assert_equal_s("++", git_buf_cstr(&buf));
|
80
|
-
|
81
|
-
/* let's try that a few times */
|
82
|
-
for (i = 0; i < 16; ++i) {
|
83
|
-
git_buf_putc(&buf, '+');
|
84
|
-
cl_assert(git_buf_oom(&buf) == 0);
|
85
|
-
}
|
86
|
-
cl_assert_equal_s("++++++++++++++++++", git_buf_cstr(&buf));
|
87
|
-
|
88
|
-
git_buf_free(&buf);
|
89
|
-
|
90
|
-
/* add data */
|
91
|
-
git_buf_put(&buf, "xo", 2);
|
92
|
-
cl_assert(git_buf_oom(&buf) == 0);
|
93
|
-
cl_assert_equal_s("xo", git_buf_cstr(&buf));
|
94
|
-
|
95
|
-
/* add letter again */
|
96
|
-
git_buf_put(&buf, "xo", 2);
|
97
|
-
cl_assert(git_buf_oom(&buf) == 0);
|
98
|
-
cl_assert_equal_s("xoxo", git_buf_cstr(&buf));
|
99
|
-
|
100
|
-
/* let's try that a few times */
|
101
|
-
for (i = 0; i < 16; ++i) {
|
102
|
-
git_buf_put(&buf, "xo", 2);
|
103
|
-
cl_assert(git_buf_oom(&buf) == 0);
|
104
|
-
}
|
105
|
-
cl_assert_equal_s("xoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxo",
|
106
|
-
git_buf_cstr(&buf));
|
107
|
-
|
108
|
-
git_buf_free(&buf);
|
109
|
-
|
110
|
-
/* set to string */
|
111
|
-
git_buf_sets(&buf, test_string);
|
112
|
-
cl_assert(git_buf_oom(&buf) == 0);
|
113
|
-
cl_assert_equal_s(test_string, git_buf_cstr(&buf));
|
114
|
-
|
115
|
-
/* append string */
|
116
|
-
git_buf_puts(&buf, test_string);
|
117
|
-
cl_assert(git_buf_oom(&buf) == 0);
|
118
|
-
cl_assert_equal_s(test_string_x2, git_buf_cstr(&buf));
|
119
|
-
|
120
|
-
/* set to string again (should overwrite - not append) */
|
121
|
-
git_buf_sets(&buf, test_string);
|
122
|
-
cl_assert(git_buf_oom(&buf) == 0);
|
123
|
-
cl_assert_equal_s(test_string, git_buf_cstr(&buf));
|
124
|
-
|
125
|
-
/* test clear */
|
126
|
-
git_buf_clear(&buf);
|
127
|
-
cl_assert_equal_s("", git_buf_cstr(&buf));
|
128
|
-
|
129
|
-
git_buf_free(&buf);
|
130
|
-
|
131
|
-
/* test extracting data into buffer */
|
132
|
-
git_buf_puts(&buf, REP4("0123456789"));
|
133
|
-
cl_assert(git_buf_oom(&buf) == 0);
|
134
|
-
|
135
|
-
git_buf_copy_cstr(data, sizeof(data), &buf);
|
136
|
-
cl_assert_equal_s(REP4("0123456789"), data);
|
137
|
-
git_buf_copy_cstr(data, 11, &buf);
|
138
|
-
cl_assert_equal_s("0123456789", data);
|
139
|
-
git_buf_copy_cstr(data, 3, &buf);
|
140
|
-
cl_assert_equal_s("01", data);
|
141
|
-
git_buf_copy_cstr(data, 1, &buf);
|
142
|
-
cl_assert_equal_s("", data);
|
143
|
-
|
144
|
-
git_buf_copy_cstr(data, sizeof(data), &buf);
|
145
|
-
cl_assert_equal_s(REP4("0123456789"), data);
|
146
|
-
|
147
|
-
git_buf_sets(&buf, REP256("x"));
|
148
|
-
git_buf_copy_cstr(data, sizeof(data), &buf);
|
149
|
-
/* since sizeof(data) == 128, only 127 bytes should be copied */
|
150
|
-
cl_assert_equal_s(REP4(REP16("x")) REP16("x") REP16("x")
|
151
|
-
REP16("x") "xxxxxxxxxxxxxxx", data);
|
152
|
-
|
153
|
-
git_buf_free(&buf);
|
154
|
-
|
155
|
-
git_buf_copy_cstr(data, sizeof(data), &buf);
|
156
|
-
cl_assert_equal_s("", data);
|
157
|
-
}
|
158
|
-
|
159
|
-
/* let's do some tests with larger buffers to push our limits */
|
160
|
-
void test_core_buffer__3(void)
|
161
|
-
{
|
162
|
-
git_buf buf = GIT_BUF_INIT;
|
163
|
-
|
164
|
-
/* set to string */
|
165
|
-
git_buf_set(&buf, test_4096, 4096);
|
166
|
-
cl_assert(git_buf_oom(&buf) == 0);
|
167
|
-
cl_assert_equal_s(test_4096, git_buf_cstr(&buf));
|
168
|
-
|
169
|
-
/* append string */
|
170
|
-
git_buf_puts(&buf, test_4096);
|
171
|
-
cl_assert(git_buf_oom(&buf) == 0);
|
172
|
-
cl_assert_equal_s(test_8192, git_buf_cstr(&buf));
|
173
|
-
|
174
|
-
/* set to string again (should overwrite - not append) */
|
175
|
-
git_buf_set(&buf, test_4096, 4096);
|
176
|
-
cl_assert(git_buf_oom(&buf) == 0);
|
177
|
-
cl_assert_equal_s(test_4096, git_buf_cstr(&buf));
|
178
|
-
|
179
|
-
git_buf_free(&buf);
|
180
|
-
}
|
181
|
-
|
182
|
-
/* let's try some producer/consumer tests */
|
183
|
-
void test_core_buffer__4(void)
|
184
|
-
{
|
185
|
-
git_buf buf = GIT_BUF_INIT;
|
186
|
-
int i;
|
187
|
-
|
188
|
-
for (i = 0; i < 10; ++i) {
|
189
|
-
git_buf_puts(&buf, "1234"); /* add 4 */
|
190
|
-
cl_assert(git_buf_oom(&buf) == 0);
|
191
|
-
git_buf_consume(&buf, buf.ptr + 2); /* eat the first two */
|
192
|
-
cl_assert(strlen(git_buf_cstr(&buf)) == (size_t)((i + 1) * 2));
|
193
|
-
}
|
194
|
-
/* we have appended 1234 10x and removed the first 20 letters */
|
195
|
-
cl_assert_equal_s("12341234123412341234", git_buf_cstr(&buf));
|
196
|
-
|
197
|
-
git_buf_consume(&buf, NULL);
|
198
|
-
cl_assert_equal_s("12341234123412341234", git_buf_cstr(&buf));
|
199
|
-
|
200
|
-
git_buf_consume(&buf, "invalid pointer");
|
201
|
-
cl_assert_equal_s("12341234123412341234", git_buf_cstr(&buf));
|
202
|
-
|
203
|
-
git_buf_consume(&buf, buf.ptr);
|
204
|
-
cl_assert_equal_s("12341234123412341234", git_buf_cstr(&buf));
|
205
|
-
|
206
|
-
git_buf_consume(&buf, buf.ptr + 1);
|
207
|
-
cl_assert_equal_s("2341234123412341234", git_buf_cstr(&buf));
|
208
|
-
|
209
|
-
git_buf_consume(&buf, buf.ptr + buf.size);
|
210
|
-
cl_assert_equal_s("", git_buf_cstr(&buf));
|
211
|
-
|
212
|
-
git_buf_free(&buf);
|
213
|
-
}
|
214
|
-
|
215
|
-
|
216
|
-
static void
|
217
|
-
check_buf_append(
|
218
|
-
const char* data_a,
|
219
|
-
const char* data_b,
|
220
|
-
const char* expected_data,
|
221
|
-
size_t expected_size,
|
222
|
-
size_t expected_asize)
|
223
|
-
{
|
224
|
-
git_buf tgt = GIT_BUF_INIT;
|
225
|
-
|
226
|
-
git_buf_sets(&tgt, data_a);
|
227
|
-
cl_assert(git_buf_oom(&tgt) == 0);
|
228
|
-
git_buf_puts(&tgt, data_b);
|
229
|
-
cl_assert(git_buf_oom(&tgt) == 0);
|
230
|
-
cl_assert_equal_s(expected_data, git_buf_cstr(&tgt));
|
231
|
-
cl_assert(tgt.size == expected_size);
|
232
|
-
if (expected_asize > 0)
|
233
|
-
cl_assert(tgt.asize == expected_asize);
|
234
|
-
|
235
|
-
git_buf_free(&tgt);
|
236
|
-
}
|
237
|
-
|
238
|
-
static void
|
239
|
-
check_buf_append_abc(
|
240
|
-
const char* buf_a,
|
241
|
-
const char* buf_b,
|
242
|
-
const char* buf_c,
|
243
|
-
const char* expected_ab,
|
244
|
-
const char* expected_abc,
|
245
|
-
const char* expected_abca,
|
246
|
-
const char* expected_abcab,
|
247
|
-
const char* expected_abcabc)
|
248
|
-
{
|
249
|
-
git_buf buf = GIT_BUF_INIT;
|
250
|
-
|
251
|
-
git_buf_sets(&buf, buf_a);
|
252
|
-
cl_assert(git_buf_oom(&buf) == 0);
|
253
|
-
cl_assert_equal_s(buf_a, git_buf_cstr(&buf));
|
254
|
-
|
255
|
-
git_buf_puts(&buf, buf_b);
|
256
|
-
cl_assert(git_buf_oom(&buf) == 0);
|
257
|
-
cl_assert_equal_s(expected_ab, git_buf_cstr(&buf));
|
258
|
-
|
259
|
-
git_buf_puts(&buf, buf_c);
|
260
|
-
cl_assert(git_buf_oom(&buf) == 0);
|
261
|
-
cl_assert_equal_s(expected_abc, git_buf_cstr(&buf));
|
262
|
-
|
263
|
-
git_buf_puts(&buf, buf_a);
|
264
|
-
cl_assert(git_buf_oom(&buf) == 0);
|
265
|
-
cl_assert_equal_s(expected_abca, git_buf_cstr(&buf));
|
266
|
-
|
267
|
-
git_buf_puts(&buf, buf_b);
|
268
|
-
cl_assert(git_buf_oom(&buf) == 0);
|
269
|
-
cl_assert_equal_s(expected_abcab, git_buf_cstr(&buf));
|
270
|
-
|
271
|
-
git_buf_puts(&buf, buf_c);
|
272
|
-
cl_assert(git_buf_oom(&buf) == 0);
|
273
|
-
cl_assert_equal_s(expected_abcabc, git_buf_cstr(&buf));
|
274
|
-
|
275
|
-
git_buf_free(&buf);
|
276
|
-
}
|
277
|
-
|
278
|
-
/* more variations on append tests */
|
279
|
-
void test_core_buffer__5(void)
|
280
|
-
{
|
281
|
-
check_buf_append("", "", "", 0, 8);
|
282
|
-
check_buf_append("a", "", "a", 1, 8);
|
283
|
-
check_buf_append("", "a", "a", 1, 8);
|
284
|
-
check_buf_append("", "a", "a", 1, 8);
|
285
|
-
check_buf_append("a", "", "a", 1, 8);
|
286
|
-
check_buf_append("a", "b", "ab", 2, 8);
|
287
|
-
check_buf_append("", "abcdefgh", "abcdefgh", 8, 16);
|
288
|
-
check_buf_append("abcdefgh", "", "abcdefgh", 8, 16);
|
289
|
-
|
290
|
-
/* buffer with starting asize will grow to:
|
291
|
-
* 1 -> 2, 2 -> 3, 3 -> 5, 4 -> 6, 5 -> 8, 6 -> 9,
|
292
|
-
* 7 -> 11, 8 -> 12, 9 -> 14, 10 -> 15, 11 -> 17, 12 -> 18,
|
293
|
-
* 13 -> 20, 14 -> 21, 15 -> 23, 16 -> 24, 17 -> 26, 18 -> 27,
|
294
|
-
* 19 -> 29, 20 -> 30, 21 -> 32, 22 -> 33, 23 -> 35, 24 -> 36,
|
295
|
-
* ...
|
296
|
-
* follow sequence until value > target size,
|
297
|
-
* then round up to nearest multiple of 8.
|
298
|
-
*/
|
299
|
-
|
300
|
-
check_buf_append("abcdefgh", "/", "abcdefgh/", 9, 16);
|
301
|
-
check_buf_append("abcdefgh", "ijklmno", "abcdefghijklmno", 15, 16);
|
302
|
-
check_buf_append("abcdefgh", "ijklmnop", "abcdefghijklmnop", 16, 24);
|
303
|
-
check_buf_append("0123456789", "0123456789",
|
304
|
-
"01234567890123456789", 20, 24);
|
305
|
-
check_buf_append(REP16("x"), REP16("o"),
|
306
|
-
REP16("x") REP16("o"), 32, 40);
|
307
|
-
|
308
|
-
check_buf_append(test_4096, "", test_4096, 4096, 4104);
|
309
|
-
check_buf_append(test_4096, test_4096, test_8192, 8192, 9240);
|
310
|
-
|
311
|
-
/* check sequences of appends */
|
312
|
-
check_buf_append_abc("a", "b", "c",
|
313
|
-
"ab", "abc", "abca", "abcab", "abcabc");
|
314
|
-
check_buf_append_abc("a1", "b2", "c3",
|
315
|
-
"a1b2", "a1b2c3", "a1b2c3a1",
|
316
|
-
"a1b2c3a1b2", "a1b2c3a1b2c3");
|
317
|
-
check_buf_append_abc("a1/", "b2/", "c3/",
|
318
|
-
"a1/b2/", "a1/b2/c3/", "a1/b2/c3/a1/",
|
319
|
-
"a1/b2/c3/a1/b2/", "a1/b2/c3/a1/b2/c3/");
|
320
|
-
}
|
321
|
-
|
322
|
-
/* test swap */
|
323
|
-
void test_core_buffer__6(void)
|
324
|
-
{
|
325
|
-
git_buf a = GIT_BUF_INIT;
|
326
|
-
git_buf b = GIT_BUF_INIT;
|
327
|
-
|
328
|
-
git_buf_sets(&a, "foo");
|
329
|
-
cl_assert(git_buf_oom(&a) == 0);
|
330
|
-
git_buf_sets(&b, "bar");
|
331
|
-
cl_assert(git_buf_oom(&b) == 0);
|
332
|
-
|
333
|
-
cl_assert_equal_s("foo", git_buf_cstr(&a));
|
334
|
-
cl_assert_equal_s("bar", git_buf_cstr(&b));
|
335
|
-
|
336
|
-
git_buf_swap(&a, &b);
|
337
|
-
|
338
|
-
cl_assert_equal_s("bar", git_buf_cstr(&a));
|
339
|
-
cl_assert_equal_s("foo", git_buf_cstr(&b));
|
340
|
-
|
341
|
-
git_buf_free(&a);
|
342
|
-
git_buf_free(&b);
|
343
|
-
}
|
344
|
-
|
345
|
-
|
346
|
-
/* test detach/attach data */
|
347
|
-
void test_core_buffer__7(void)
|
348
|
-
{
|
349
|
-
const char *fun = "This is fun";
|
350
|
-
git_buf a = GIT_BUF_INIT;
|
351
|
-
char *b = NULL;
|
352
|
-
|
353
|
-
git_buf_sets(&a, "foo");
|
354
|
-
cl_assert(git_buf_oom(&a) == 0);
|
355
|
-
cl_assert_equal_s("foo", git_buf_cstr(&a));
|
356
|
-
|
357
|
-
b = git_buf_detach(&a);
|
358
|
-
|
359
|
-
cl_assert_equal_s("foo", b);
|
360
|
-
cl_assert_equal_s("", a.ptr);
|
361
|
-
git__free(b);
|
362
|
-
|
363
|
-
b = git_buf_detach(&a);
|
364
|
-
|
365
|
-
cl_assert_equal_s(NULL, b);
|
366
|
-
cl_assert_equal_s("", a.ptr);
|
367
|
-
|
368
|
-
git_buf_free(&a);
|
369
|
-
|
370
|
-
b = git__strdup(fun);
|
371
|
-
git_buf_attach(&a, b, 0);
|
372
|
-
|
373
|
-
cl_assert_equal_s(fun, a.ptr);
|
374
|
-
cl_assert(a.size == strlen(fun));
|
375
|
-
cl_assert(a.asize == strlen(fun) + 1);
|
376
|
-
|
377
|
-
git_buf_free(&a);
|
378
|
-
|
379
|
-
b = git__strdup(fun);
|
380
|
-
git_buf_attach(&a, b, strlen(fun) + 1);
|
381
|
-
|
382
|
-
cl_assert_equal_s(fun, a.ptr);
|
383
|
-
cl_assert(a.size == strlen(fun));
|
384
|
-
cl_assert(a.asize == strlen(fun) + 1);
|
385
|
-
|
386
|
-
git_buf_free(&a);
|
387
|
-
}
|
388
|
-
|
389
|
-
|
390
|
-
static void
|
391
|
-
check_joinbuf_2(
|
392
|
-
const char *a,
|
393
|
-
const char *b,
|
394
|
-
const char *expected)
|
395
|
-
{
|
396
|
-
char sep = '/';
|
397
|
-
git_buf buf = GIT_BUF_INIT;
|
398
|
-
|
399
|
-
git_buf_join(&buf, sep, a, b);
|
400
|
-
cl_assert(git_buf_oom(&buf) == 0);
|
401
|
-
cl_assert_equal_s(expected, git_buf_cstr(&buf));
|
402
|
-
git_buf_free(&buf);
|
403
|
-
}
|
404
|
-
|
405
|
-
static void
|
406
|
-
check_joinbuf_n_2(
|
407
|
-
const char *a,
|
408
|
-
const char *b,
|
409
|
-
const char *expected)
|
410
|
-
{
|
411
|
-
char sep = '/';
|
412
|
-
git_buf buf = GIT_BUF_INIT;
|
413
|
-
|
414
|
-
git_buf_sets(&buf, a);
|
415
|
-
cl_assert(git_buf_oom(&buf) == 0);
|
416
|
-
|
417
|
-
git_buf_join_n(&buf, sep, 1, b);
|
418
|
-
cl_assert(git_buf_oom(&buf) == 0);
|
419
|
-
cl_assert_equal_s(expected, git_buf_cstr(&buf));
|
420
|
-
|
421
|
-
git_buf_free(&buf);
|
422
|
-
}
|
423
|
-
|
424
|
-
static void
|
425
|
-
check_joinbuf_n_4(
|
426
|
-
const char *a,
|
427
|
-
const char *b,
|
428
|
-
const char *c,
|
429
|
-
const char *d,
|
430
|
-
const char *expected)
|
431
|
-
{
|
432
|
-
char sep = ';';
|
433
|
-
git_buf buf = GIT_BUF_INIT;
|
434
|
-
git_buf_join_n(&buf, sep, 4, a, b, c, d);
|
435
|
-
cl_assert(git_buf_oom(&buf) == 0);
|
436
|
-
cl_assert_equal_s(expected, git_buf_cstr(&buf));
|
437
|
-
git_buf_free(&buf);
|
438
|
-
}
|
439
|
-
|
440
|
-
/* test join */
|
441
|
-
void test_core_buffer__8(void)
|
442
|
-
{
|
443
|
-
git_buf a = GIT_BUF_INIT;
|
444
|
-
|
445
|
-
git_buf_join_n(&a, '/', 1, "foo");
|
446
|
-
cl_assert(git_buf_oom(&a) == 0);
|
447
|
-
cl_assert_equal_s("foo", git_buf_cstr(&a));
|
448
|
-
|
449
|
-
git_buf_join_n(&a, '/', 1, "bar");
|
450
|
-
cl_assert(git_buf_oom(&a) == 0);
|
451
|
-
cl_assert_equal_s("foo/bar", git_buf_cstr(&a));
|
452
|
-
|
453
|
-
git_buf_join_n(&a, '/', 1, "baz");
|
454
|
-
cl_assert(git_buf_oom(&a) == 0);
|
455
|
-
cl_assert_equal_s("foo/bar/baz", git_buf_cstr(&a));
|
456
|
-
|
457
|
-
git_buf_free(&a);
|
458
|
-
|
459
|
-
check_joinbuf_2("", "", "");
|
460
|
-
check_joinbuf_2("", "a", "a");
|
461
|
-
check_joinbuf_2("", "/a", "/a");
|
462
|
-
check_joinbuf_2("a", "", "a/");
|
463
|
-
check_joinbuf_2("a", "/", "a/");
|
464
|
-
check_joinbuf_2("a", "b", "a/b");
|
465
|
-
check_joinbuf_2("/", "a", "/a");
|
466
|
-
check_joinbuf_2("/", "", "/");
|
467
|
-
check_joinbuf_2("/a", "/b", "/a/b");
|
468
|
-
check_joinbuf_2("/a", "/b/", "/a/b/");
|
469
|
-
check_joinbuf_2("/a/", "b/", "/a/b/");
|
470
|
-
check_joinbuf_2("/a/", "/b/", "/a/b/");
|
471
|
-
check_joinbuf_2("/a/", "//b/", "/a/b/");
|
472
|
-
check_joinbuf_2("/abcd", "/defg", "/abcd/defg");
|
473
|
-
check_joinbuf_2("/abcd", "/defg/", "/abcd/defg/");
|
474
|
-
check_joinbuf_2("/abcd/", "defg/", "/abcd/defg/");
|
475
|
-
check_joinbuf_2("/abcd/", "/defg/", "/abcd/defg/");
|
476
|
-
|
477
|
-
check_joinbuf_n_2("", "", "");
|
478
|
-
check_joinbuf_n_2("", "a", "a");
|
479
|
-
check_joinbuf_n_2("", "/a", "/a");
|
480
|
-
check_joinbuf_n_2("a", "", "a/");
|
481
|
-
check_joinbuf_n_2("a", "/", "a/");
|
482
|
-
check_joinbuf_n_2("a", "b", "a/b");
|
483
|
-
check_joinbuf_n_2("/", "a", "/a");
|
484
|
-
check_joinbuf_n_2("/", "", "/");
|
485
|
-
check_joinbuf_n_2("/a", "/b", "/a/b");
|
486
|
-
check_joinbuf_n_2("/a", "/b/", "/a/b/");
|
487
|
-
check_joinbuf_n_2("/a/", "b/", "/a/b/");
|
488
|
-
check_joinbuf_n_2("/a/", "/b/", "/a/b/");
|
489
|
-
check_joinbuf_n_2("/abcd", "/defg", "/abcd/defg");
|
490
|
-
check_joinbuf_n_2("/abcd", "/defg/", "/abcd/defg/");
|
491
|
-
check_joinbuf_n_2("/abcd/", "defg/", "/abcd/defg/");
|
492
|
-
check_joinbuf_n_2("/abcd/", "/defg/", "/abcd/defg/");
|
493
|
-
|
494
|
-
check_joinbuf_n_4("", "", "", "", "");
|
495
|
-
check_joinbuf_n_4("", "a", "", "", "a;");
|
496
|
-
check_joinbuf_n_4("a", "", "", "", "a;");
|
497
|
-
check_joinbuf_n_4("", "", "", "a", "a");
|
498
|
-
check_joinbuf_n_4("a", "b", "", ";c;d;", "a;b;c;d;");
|
499
|
-
check_joinbuf_n_4("a", "b", "", ";c;d", "a;b;c;d");
|
500
|
-
check_joinbuf_n_4("abcd", "efgh", "ijkl", "mnop", "abcd;efgh;ijkl;mnop");
|
501
|
-
check_joinbuf_n_4("abcd;", "efgh;", "ijkl;", "mnop;", "abcd;efgh;ijkl;mnop;");
|
502
|
-
check_joinbuf_n_4(";abcd;", ";efgh;", ";ijkl;", ";mnop;", ";abcd;efgh;ijkl;mnop;");
|
503
|
-
}
|
504
|
-
|
505
|
-
void test_core_buffer__9(void)
|
506
|
-
{
|
507
|
-
git_buf buf = GIT_BUF_INIT;
|
508
|
-
|
509
|
-
/* just some exhaustive tests of various separator placement */
|
510
|
-
char *a[] = { "", "-", "a-", "-a", "-a-" };
|
511
|
-
char *b[] = { "", "-", "b-", "-b", "-b-" };
|
512
|
-
char sep[] = { 0, '-', '/' };
|
513
|
-
char *expect_null[] = { "", "-", "a-", "-a", "-a-",
|
514
|
-
"-", "--", "a--", "-a-", "-a--",
|
515
|
-
"b-", "-b-", "a-b-", "-ab-", "-a-b-",
|
516
|
-
"-b", "--b", "a--b", "-a-b", "-a--b",
|
517
|
-
"-b-", "--b-", "a--b-", "-a-b-", "-a--b-" };
|
518
|
-
char *expect_dash[] = { "", "-", "a-", "-a-", "-a-",
|
519
|
-
"-", "-", "a-", "-a-", "-a-",
|
520
|
-
"b-", "-b-", "a-b-", "-a-b-", "-a-b-",
|
521
|
-
"-b", "-b", "a-b", "-a-b", "-a-b",
|
522
|
-
"-b-", "-b-", "a-b-", "-a-b-", "-a-b-" };
|
523
|
-
char *expect_slas[] = { "", "-/", "a-/", "-a/", "-a-/",
|
524
|
-
"-", "-/-", "a-/-", "-a/-", "-a-/-",
|
525
|
-
"b-", "-/b-", "a-/b-", "-a/b-", "-a-/b-",
|
526
|
-
"-b", "-/-b", "a-/-b", "-a/-b", "-a-/-b",
|
527
|
-
"-b-", "-/-b-", "a-/-b-", "-a/-b-", "-a-/-b-" };
|
528
|
-
char **expect_values[] = { expect_null, expect_dash, expect_slas };
|
529
|
-
char separator, **expect;
|
530
|
-
unsigned int s, i, j;
|
531
|
-
|
532
|
-
for (s = 0; s < sizeof(sep) / sizeof(char); ++s) {
|
533
|
-
separator = sep[s];
|
534
|
-
expect = expect_values[s];
|
535
|
-
|
536
|
-
for (j = 0; j < sizeof(b) / sizeof(char*); ++j) {
|
537
|
-
for (i = 0; i < sizeof(a) / sizeof(char*); ++i) {
|
538
|
-
git_buf_join(&buf, separator, a[i], b[j]);
|
539
|
-
cl_assert_equal_s(*expect, buf.ptr);
|
540
|
-
expect++;
|
541
|
-
}
|
542
|
-
}
|
543
|
-
}
|
544
|
-
|
545
|
-
git_buf_free(&buf);
|
546
|
-
}
|
547
|
-
|
548
|
-
void test_core_buffer__10(void)
|
549
|
-
{
|
550
|
-
git_buf a = GIT_BUF_INIT;
|
551
|
-
|
552
|
-
cl_git_pass(git_buf_join_n(&a, '/', 1, "test"));
|
553
|
-
cl_assert_equal_s(a.ptr, "test");
|
554
|
-
cl_git_pass(git_buf_join_n(&a, '/', 1, "string"));
|
555
|
-
cl_assert_equal_s(a.ptr, "test/string");
|
556
|
-
git_buf_clear(&a);
|
557
|
-
cl_git_pass(git_buf_join_n(&a, '/', 3, "test", "string", "join"));
|
558
|
-
cl_assert_equal_s(a.ptr, "test/string/join");
|
559
|
-
cl_git_pass(git_buf_join_n(&a, '/', 2, a.ptr, "more"));
|
560
|
-
cl_assert_equal_s(a.ptr, "test/string/join/test/string/join/more");
|
561
|
-
|
562
|
-
git_buf_free(&a);
|
563
|
-
}
|
564
|
-
|
565
|
-
void test_core_buffer__11(void)
|
566
|
-
{
|
567
|
-
git_buf a = GIT_BUF_INIT;
|
568
|
-
git_strarray t;
|
569
|
-
char *t1[] = { "nothing", "in", "common" };
|
570
|
-
char *t2[] = { "something", "something else", "some other" };
|
571
|
-
char *t3[] = { "something", "some fun", "no fun" };
|
572
|
-
char *t4[] = { "happy", "happier", "happiest" };
|
573
|
-
char *t5[] = { "happiest", "happier", "happy" };
|
574
|
-
char *t6[] = { "no", "nope", "" };
|
575
|
-
char *t7[] = { "", "doesn't matter" };
|
576
|
-
|
577
|
-
t.strings = t1;
|
578
|
-
t.count = 3;
|
579
|
-
cl_git_pass(git_buf_common_prefix(&a, &t));
|
580
|
-
cl_assert_equal_s(a.ptr, "");
|
581
|
-
|
582
|
-
t.strings = t2;
|
583
|
-
t.count = 3;
|
584
|
-
cl_git_pass(git_buf_common_prefix(&a, &t));
|
585
|
-
cl_assert_equal_s(a.ptr, "some");
|
586
|
-
|
587
|
-
t.strings = t3;
|
588
|
-
t.count = 3;
|
589
|
-
cl_git_pass(git_buf_common_prefix(&a, &t));
|
590
|
-
cl_assert_equal_s(a.ptr, "");
|
591
|
-
|
592
|
-
t.strings = t4;
|
593
|
-
t.count = 3;
|
594
|
-
cl_git_pass(git_buf_common_prefix(&a, &t));
|
595
|
-
cl_assert_equal_s(a.ptr, "happ");
|
596
|
-
|
597
|
-
t.strings = t5;
|
598
|
-
t.count = 3;
|
599
|
-
cl_git_pass(git_buf_common_prefix(&a, &t));
|
600
|
-
cl_assert_equal_s(a.ptr, "happ");
|
601
|
-
|
602
|
-
t.strings = t6;
|
603
|
-
t.count = 3;
|
604
|
-
cl_git_pass(git_buf_common_prefix(&a, &t));
|
605
|
-
cl_assert_equal_s(a.ptr, "");
|
606
|
-
|
607
|
-
t.strings = t7;
|
608
|
-
t.count = 3;
|
609
|
-
cl_git_pass(git_buf_common_prefix(&a, &t));
|
610
|
-
cl_assert_equal_s(a.ptr, "");
|
611
|
-
|
612
|
-
git_buf_free(&a);
|
613
|
-
}
|