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,477 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* Copyright (C) 2009-2012 the libgit2 contributors
|
3
|
-
*
|
4
|
-
* This file is part of libgit2, distributed under the GNU GPL v2 with
|
5
|
-
* a Linking Exception. For full terms see the included COPYING file.
|
6
|
-
*/
|
7
|
-
|
8
|
-
#include "git2/net.h"
|
9
|
-
#include "git2/common.h"
|
10
|
-
#include "git2/types.h"
|
11
|
-
#include "git2/errors.h"
|
12
|
-
#include "git2/net.h"
|
13
|
-
#include "git2/revwalk.h"
|
14
|
-
|
15
|
-
#include "vector.h"
|
16
|
-
#include "transport.h"
|
17
|
-
#include "pkt.h"
|
18
|
-
#include "common.h"
|
19
|
-
#include "netops.h"
|
20
|
-
#include "filebuf.h"
|
21
|
-
#include "repository.h"
|
22
|
-
#include "fetch.h"
|
23
|
-
#include "protocol.h"
|
24
|
-
|
25
|
-
typedef struct {
|
26
|
-
git_transport parent;
|
27
|
-
git_protocol proto;
|
28
|
-
git_vector refs;
|
29
|
-
git_remote_head **heads;
|
30
|
-
git_transport_caps caps;
|
31
|
-
char buff[1024];
|
32
|
-
gitno_buffer buf;
|
33
|
-
#ifdef GIT_WIN32
|
34
|
-
WSADATA wsd;
|
35
|
-
#endif
|
36
|
-
} transport_git;
|
37
|
-
|
38
|
-
/*
|
39
|
-
* Create a git procol request.
|
40
|
-
*
|
41
|
-
* For example: 0035git-upload-pack /libgit2/libgit2\0host=github.com\0
|
42
|
-
*/
|
43
|
-
static int gen_proto(git_buf *request, const char *cmd, const char *url)
|
44
|
-
{
|
45
|
-
char *delim, *repo;
|
46
|
-
char default_command[] = "git-upload-pack";
|
47
|
-
char host[] = "host=";
|
48
|
-
size_t len;
|
49
|
-
|
50
|
-
delim = strchr(url, '/');
|
51
|
-
if (delim == NULL) {
|
52
|
-
giterr_set(GITERR_NET, "Malformed URL");
|
53
|
-
return -1;
|
54
|
-
}
|
55
|
-
|
56
|
-
repo = delim;
|
57
|
-
|
58
|
-
delim = strchr(url, ':');
|
59
|
-
if (delim == NULL)
|
60
|
-
delim = strchr(url, '/');
|
61
|
-
|
62
|
-
if (cmd == NULL)
|
63
|
-
cmd = default_command;
|
64
|
-
|
65
|
-
len = 4 + strlen(cmd) + 1 + strlen(repo) + 1 + strlen(host) + (delim - url) + 1;
|
66
|
-
|
67
|
-
git_buf_grow(request, len);
|
68
|
-
git_buf_printf(request, "%04x%s %s%c%s",
|
69
|
-
(unsigned int)(len & 0x0FFFF), cmd, repo, 0, host);
|
70
|
-
git_buf_put(request, url, delim - url);
|
71
|
-
git_buf_putc(request, '\0');
|
72
|
-
|
73
|
-
if (git_buf_oom(request))
|
74
|
-
return -1;
|
75
|
-
|
76
|
-
return 0;
|
77
|
-
}
|
78
|
-
|
79
|
-
static int send_request(git_transport *t, const char *cmd, const char *url)
|
80
|
-
{
|
81
|
-
int error;
|
82
|
-
git_buf request = GIT_BUF_INIT;
|
83
|
-
|
84
|
-
error = gen_proto(&request, cmd, url);
|
85
|
-
if (error < 0)
|
86
|
-
goto cleanup;
|
87
|
-
|
88
|
-
error = gitno_send(t, request.ptr, request.size, 0);
|
89
|
-
|
90
|
-
cleanup:
|
91
|
-
git_buf_free(&request);
|
92
|
-
return error;
|
93
|
-
}
|
94
|
-
|
95
|
-
/*
|
96
|
-
* Parse the URL and connect to a server, storing the socket in
|
97
|
-
* out. For convenience this also takes care of asking for the remote
|
98
|
-
* refs
|
99
|
-
*/
|
100
|
-
static int do_connect(transport_git *t, const char *url)
|
101
|
-
{
|
102
|
-
char *host, *port;
|
103
|
-
const char prefix[] = "git://";
|
104
|
-
|
105
|
-
if (!git__prefixcmp(url, prefix))
|
106
|
-
url += strlen(prefix);
|
107
|
-
|
108
|
-
if (gitno_extract_host_and_port(&host, &port, url, GIT_DEFAULT_PORT) < 0)
|
109
|
-
return -1;
|
110
|
-
|
111
|
-
if (gitno_connect((git_transport *)t, host, port) < 0)
|
112
|
-
goto on_error;
|
113
|
-
|
114
|
-
if (send_request((git_transport *)t, NULL, url) < 0)
|
115
|
-
goto on_error;
|
116
|
-
|
117
|
-
git__free(host);
|
118
|
-
git__free(port);
|
119
|
-
|
120
|
-
return 0;
|
121
|
-
|
122
|
-
on_error:
|
123
|
-
git__free(host);
|
124
|
-
git__free(port);
|
125
|
-
gitno_close(t->parent.socket);
|
126
|
-
return -1;
|
127
|
-
}
|
128
|
-
|
129
|
-
/*
|
130
|
-
* Read from the socket and store the references in the vector
|
131
|
-
*/
|
132
|
-
static int store_refs(transport_git *t)
|
133
|
-
{
|
134
|
-
gitno_buffer *buf = &t->buf;
|
135
|
-
int ret = 0;
|
136
|
-
|
137
|
-
while (1) {
|
138
|
-
if ((ret = gitno_recv(buf)) < 0)
|
139
|
-
return -1;
|
140
|
-
if (ret == 0) /* Orderly shutdown, so exit */
|
141
|
-
return 0;
|
142
|
-
|
143
|
-
ret = git_protocol_store_refs(&t->proto, buf->data, buf->offset);
|
144
|
-
if (ret == GIT_EBUFS) {
|
145
|
-
gitno_consume_n(buf, buf->len);
|
146
|
-
continue;
|
147
|
-
}
|
148
|
-
|
149
|
-
if (ret < 0)
|
150
|
-
return ret;
|
151
|
-
|
152
|
-
gitno_consume_n(buf, buf->offset);
|
153
|
-
|
154
|
-
if (t->proto.flush) { /* No more refs */
|
155
|
-
t->proto.flush = 0;
|
156
|
-
return 0;
|
157
|
-
}
|
158
|
-
}
|
159
|
-
}
|
160
|
-
|
161
|
-
static int detect_caps(transport_git *t)
|
162
|
-
{
|
163
|
-
git_vector *refs = &t->refs;
|
164
|
-
git_pkt_ref *pkt;
|
165
|
-
git_transport_caps *caps = &t->caps;
|
166
|
-
const char *ptr;
|
167
|
-
|
168
|
-
pkt = git_vector_get(refs, 0);
|
169
|
-
/* No refs or capabilites, odd but not a problem */
|
170
|
-
if (pkt == NULL || pkt->capabilities == NULL)
|
171
|
-
return 0;
|
172
|
-
|
173
|
-
ptr = pkt->capabilities;
|
174
|
-
while (ptr != NULL && *ptr != '\0') {
|
175
|
-
if (*ptr == ' ')
|
176
|
-
ptr++;
|
177
|
-
|
178
|
-
if(!git__prefixcmp(ptr, GIT_CAP_OFS_DELTA)) {
|
179
|
-
caps->common = caps->ofs_delta = 1;
|
180
|
-
ptr += strlen(GIT_CAP_OFS_DELTA);
|
181
|
-
continue;
|
182
|
-
}
|
183
|
-
|
184
|
-
/* We don't know this capability, so skip it */
|
185
|
-
ptr = strchr(ptr, ' ');
|
186
|
-
}
|
187
|
-
|
188
|
-
return 0;
|
189
|
-
}
|
190
|
-
|
191
|
-
/*
|
192
|
-
* Since this is a network connection, we need to parse and store the
|
193
|
-
* pkt-lines at this stage and keep them there.
|
194
|
-
*/
|
195
|
-
static int git_connect(git_transport *transport, int direction)
|
196
|
-
{
|
197
|
-
transport_git *t = (transport_git *) transport;
|
198
|
-
|
199
|
-
if (direction == GIT_DIR_PUSH) {
|
200
|
-
giterr_set(GITERR_NET, "Pushing over git:// is not supported");
|
201
|
-
return -1;
|
202
|
-
}
|
203
|
-
|
204
|
-
t->parent.direction = direction;
|
205
|
-
if (git_vector_init(&t->refs, 16, NULL) < 0)
|
206
|
-
return -1;
|
207
|
-
|
208
|
-
/* Connect and ask for the refs */
|
209
|
-
if (do_connect(t, transport->url) < 0)
|
210
|
-
goto cleanup;
|
211
|
-
|
212
|
-
gitno_buffer_setup(transport, &t->buf, t->buff, sizeof(t->buff));
|
213
|
-
|
214
|
-
t->parent.connected = 1;
|
215
|
-
if (store_refs(t) < 0)
|
216
|
-
goto cleanup;
|
217
|
-
|
218
|
-
if (detect_caps(t) < 0)
|
219
|
-
goto cleanup;
|
220
|
-
|
221
|
-
return 0;
|
222
|
-
cleanup:
|
223
|
-
git_vector_free(&t->refs);
|
224
|
-
return -1;
|
225
|
-
}
|
226
|
-
|
227
|
-
static int git_ls(git_transport *transport, git_headlist_cb list_cb, void *opaque)
|
228
|
-
{
|
229
|
-
transport_git *t = (transport_git *) transport;
|
230
|
-
git_vector *refs = &t->refs;
|
231
|
-
unsigned int i;
|
232
|
-
git_pkt *p = NULL;
|
233
|
-
|
234
|
-
git_vector_foreach(refs, i, p) {
|
235
|
-
git_pkt_ref *pkt = NULL;
|
236
|
-
|
237
|
-
if (p->type != GIT_PKT_REF)
|
238
|
-
continue;
|
239
|
-
|
240
|
-
pkt = (git_pkt_ref *)p;
|
241
|
-
|
242
|
-
if (list_cb(&pkt->head, opaque) < 0) {
|
243
|
-
giterr_set(GITERR_NET, "User callback returned error");
|
244
|
-
return -1;
|
245
|
-
}
|
246
|
-
}
|
247
|
-
|
248
|
-
return 0;
|
249
|
-
}
|
250
|
-
|
251
|
-
/* Wait until we get an ack from the */
|
252
|
-
static int recv_pkt(gitno_buffer *buf)
|
253
|
-
{
|
254
|
-
const char *ptr = buf->data, *line_end;
|
255
|
-
git_pkt *pkt;
|
256
|
-
int pkt_type, error;
|
257
|
-
|
258
|
-
do {
|
259
|
-
/* Wait for max. 1 second */
|
260
|
-
if ((error = gitno_select_in(buf, 1, 0)) < 0) {
|
261
|
-
return -1;
|
262
|
-
} else if (error == 0) {
|
263
|
-
/*
|
264
|
-
* Some servers don't respond immediately, so if this
|
265
|
-
* happens, we keep sending information until it
|
266
|
-
* answers. Pretend we received a NAK to convince higher
|
267
|
-
* layers to do so.
|
268
|
-
*/
|
269
|
-
return GIT_PKT_NAK;
|
270
|
-
}
|
271
|
-
|
272
|
-
if ((error = gitno_recv(buf)) < 0)
|
273
|
-
return -1;
|
274
|
-
|
275
|
-
error = git_pkt_parse_line(&pkt, ptr, &line_end, buf->offset);
|
276
|
-
if (error == GIT_EBUFS)
|
277
|
-
continue;
|
278
|
-
if (error < 0)
|
279
|
-
return -1;
|
280
|
-
} while (error);
|
281
|
-
|
282
|
-
gitno_consume(buf, line_end);
|
283
|
-
pkt_type = pkt->type;
|
284
|
-
git__free(pkt);
|
285
|
-
|
286
|
-
return pkt_type;
|
287
|
-
}
|
288
|
-
|
289
|
-
static int git_negotiate_fetch(git_transport *transport, git_repository *repo, const git_vector *wants)
|
290
|
-
{
|
291
|
-
transport_git *t = (transport_git *) transport;
|
292
|
-
git_revwalk *walk;
|
293
|
-
git_oid oid;
|
294
|
-
int error;
|
295
|
-
unsigned int i;
|
296
|
-
git_buf data = GIT_BUF_INIT;
|
297
|
-
gitno_buffer *buf = &t->buf;
|
298
|
-
|
299
|
-
if (git_pkt_buffer_wants(wants, &t->caps, &data) < 0)
|
300
|
-
return -1;
|
301
|
-
|
302
|
-
if (git_fetch_setup_walk(&walk, repo) < 0)
|
303
|
-
goto on_error;
|
304
|
-
|
305
|
-
if (gitno_send(transport, data.ptr, data.size, 0) < 0)
|
306
|
-
goto on_error;
|
307
|
-
|
308
|
-
git_buf_clear(&data);
|
309
|
-
/*
|
310
|
-
* We don't support any kind of ACK extensions, so the negotiation
|
311
|
-
* boils down to sending what we have and listening for an ACK
|
312
|
-
* every once in a while.
|
313
|
-
*/
|
314
|
-
i = 0;
|
315
|
-
while ((error = git_revwalk_next(&oid, walk)) == 0) {
|
316
|
-
git_pkt_buffer_have(&oid, &data);
|
317
|
-
i++;
|
318
|
-
if (i % 20 == 0) {
|
319
|
-
int pkt_type;
|
320
|
-
|
321
|
-
git_pkt_buffer_flush(&data);
|
322
|
-
if (git_buf_oom(&data))
|
323
|
-
goto on_error;
|
324
|
-
|
325
|
-
if (gitno_send(transport, data.ptr, data.size, 0) < 0)
|
326
|
-
goto on_error;
|
327
|
-
|
328
|
-
pkt_type = recv_pkt(buf);
|
329
|
-
|
330
|
-
if (pkt_type == GIT_PKT_ACK) {
|
331
|
-
break;
|
332
|
-
} else if (pkt_type == GIT_PKT_NAK) {
|
333
|
-
continue;
|
334
|
-
} else {
|
335
|
-
giterr_set(GITERR_NET, "Unexpected pkt type");
|
336
|
-
goto on_error;
|
337
|
-
}
|
338
|
-
|
339
|
-
}
|
340
|
-
}
|
341
|
-
if (error < 0 && error != GIT_REVWALKOVER)
|
342
|
-
goto on_error;
|
343
|
-
|
344
|
-
/* Tell the other end that we're done negotiating */
|
345
|
-
git_buf_clear(&data);
|
346
|
-
git_pkt_buffer_flush(&data);
|
347
|
-
git_pkt_buffer_done(&data);
|
348
|
-
if (gitno_send(transport, data.ptr, data.size, 0) < 0)
|
349
|
-
goto on_error;
|
350
|
-
|
351
|
-
git_buf_free(&data);
|
352
|
-
git_revwalk_free(walk);
|
353
|
-
return 0;
|
354
|
-
|
355
|
-
on_error:
|
356
|
-
git_buf_free(&data);
|
357
|
-
git_revwalk_free(walk);
|
358
|
-
return -1;
|
359
|
-
}
|
360
|
-
|
361
|
-
static int git_download_pack(git_transport *transport, git_repository *repo, git_off_t *bytes, git_indexer_stats *stats)
|
362
|
-
{
|
363
|
-
transport_git *t = (transport_git *) transport;
|
364
|
-
int error = 0, read_bytes;
|
365
|
-
gitno_buffer *buf = &t->buf;
|
366
|
-
git_pkt *pkt;
|
367
|
-
const char *line_end, *ptr;
|
368
|
-
|
369
|
-
/*
|
370
|
-
* For now, we ignore everything and wait for the pack
|
371
|
-
*/
|
372
|
-
do {
|
373
|
-
ptr = buf->data;
|
374
|
-
/* Whilst we're searching for the pack */
|
375
|
-
while (1) {
|
376
|
-
if (buf->offset == 0) {
|
377
|
-
break;
|
378
|
-
}
|
379
|
-
|
380
|
-
error = git_pkt_parse_line(&pkt, ptr, &line_end, buf->offset);
|
381
|
-
if (error == GIT_EBUFS)
|
382
|
-
break;
|
383
|
-
|
384
|
-
if (error < 0)
|
385
|
-
return error;
|
386
|
-
|
387
|
-
if (pkt->type == GIT_PKT_PACK) {
|
388
|
-
git__free(pkt);
|
389
|
-
return git_fetch__download_pack(buf->data, buf->offset, transport, repo, bytes, stats);
|
390
|
-
}
|
391
|
-
|
392
|
-
/* For now we don't care about anything */
|
393
|
-
git__free(pkt);
|
394
|
-
gitno_consume(buf, line_end);
|
395
|
-
}
|
396
|
-
|
397
|
-
read_bytes = gitno_recv(buf);
|
398
|
-
} while (read_bytes);
|
399
|
-
|
400
|
-
return read_bytes;
|
401
|
-
}
|
402
|
-
|
403
|
-
static int git_close(git_transport *t)
|
404
|
-
{
|
405
|
-
git_buf buf = GIT_BUF_INIT;
|
406
|
-
|
407
|
-
if (git_pkt_buffer_flush(&buf) < 0)
|
408
|
-
return -1;
|
409
|
-
/* Can't do anything if there's an error, so don't bother checking */
|
410
|
-
gitno_send(t, buf.ptr, buf.size, 0);
|
411
|
-
|
412
|
-
if (gitno_close(t->socket) < 0) {
|
413
|
-
giterr_set(GITERR_NET, "Failed to close socket");
|
414
|
-
return -1;
|
415
|
-
}
|
416
|
-
|
417
|
-
t->connected = 0;
|
418
|
-
|
419
|
-
#ifdef GIT_WIN32
|
420
|
-
WSACleanup();
|
421
|
-
#endif
|
422
|
-
|
423
|
-
return 0;
|
424
|
-
}
|
425
|
-
|
426
|
-
static void git_free(git_transport *transport)
|
427
|
-
{
|
428
|
-
transport_git *t = (transport_git *) transport;
|
429
|
-
git_vector *refs = &t->refs;
|
430
|
-
unsigned int i;
|
431
|
-
|
432
|
-
for (i = 0; i < refs->length; ++i) {
|
433
|
-
git_pkt *p = git_vector_get(refs, i);
|
434
|
-
git_pkt_free(p);
|
435
|
-
}
|
436
|
-
|
437
|
-
git_vector_free(refs);
|
438
|
-
git__free(t->heads);
|
439
|
-
git_buf_free(&t->proto.buf);
|
440
|
-
git__free(t->parent.url);
|
441
|
-
git__free(t);
|
442
|
-
}
|
443
|
-
|
444
|
-
int git_transport_git(git_transport **out)
|
445
|
-
{
|
446
|
-
transport_git *t;
|
447
|
-
#ifdef GIT_WIN32
|
448
|
-
int ret;
|
449
|
-
#endif
|
450
|
-
|
451
|
-
t = git__malloc(sizeof(transport_git));
|
452
|
-
GITERR_CHECK_ALLOC(t);
|
453
|
-
|
454
|
-
memset(t, 0x0, sizeof(transport_git));
|
455
|
-
|
456
|
-
t->parent.connect = git_connect;
|
457
|
-
t->parent.ls = git_ls;
|
458
|
-
t->parent.negotiate_fetch = git_negotiate_fetch;
|
459
|
-
t->parent.download_pack = git_download_pack;
|
460
|
-
t->parent.close = git_close;
|
461
|
-
t->parent.free = git_free;
|
462
|
-
t->proto.refs = &t->refs;
|
463
|
-
t->proto.transport = (git_transport *) t;
|
464
|
-
|
465
|
-
*out = (git_transport *) t;
|
466
|
-
|
467
|
-
#ifdef GIT_WIN32
|
468
|
-
ret = WSAStartup(MAKEWORD(2,2), &t->wsd);
|
469
|
-
if (ret != 0) {
|
470
|
-
git_free(*out);
|
471
|
-
giterr_set(GITERR_NET, "Winsock init failed");
|
472
|
-
return -1;
|
473
|
-
}
|
474
|
-
#endif
|
475
|
-
|
476
|
-
return 0;
|
477
|
-
}
|