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
@@ -83,6 +83,41 @@ extern int p_gettimeofday(struct timeval *tv, struct timezone *tz);
|
|
83
83
|
# include "unix/posix.h"
|
84
84
|
#endif
|
85
85
|
|
86
|
-
#
|
86
|
+
#ifdef NO_READDIR_R
|
87
|
+
# include <dirent.h>
|
88
|
+
GIT_INLINE(int) p_readdir_r(DIR *dirp, struct dirent *entry, struct dirent **result)
|
89
|
+
{
|
90
|
+
GIT_UNUSED(entry);
|
91
|
+
*result = readdir(dirp);
|
92
|
+
return 0;
|
93
|
+
}
|
94
|
+
#else /* NO_READDIR_R */
|
95
|
+
# define p_readdir_r(d,e,r) readdir_r(d,e,r)
|
96
|
+
#endif
|
97
|
+
|
98
|
+
#ifdef NO_ADDRINFO
|
99
|
+
# include <netdb.h>
|
100
|
+
struct addrinfo {
|
101
|
+
struct hostent *ai_hostent;
|
102
|
+
struct servent *ai_servent;
|
103
|
+
struct sockaddr_in ai_addr_in;
|
104
|
+
struct sockaddr *ai_addr;
|
105
|
+
size_t ai_addrlen;
|
106
|
+
int ai_family;
|
107
|
+
int ai_socktype;
|
108
|
+
int ai_protocol;
|
109
|
+
long ai_port;
|
110
|
+
struct addrinfo *ai_next;
|
111
|
+
};
|
112
|
+
|
113
|
+
extern int p_getaddrinfo(const char *host, const char *port,
|
114
|
+
struct addrinfo *hints, struct addrinfo **info);
|
115
|
+
extern void p_freeaddrinfo(struct addrinfo *info);
|
116
|
+
extern const char *p_gai_strerror(int ret);
|
117
|
+
#else
|
118
|
+
# define p_getaddrinfo(a, b, c, d) getaddrinfo(a, b, c, d)
|
119
|
+
# define p_freeaddrinfo(a) freeaddrinfo(a)
|
120
|
+
# define p_gai_strerror(c) gai_strerror(c)
|
121
|
+
#endif /* NO_ADDRINFO */
|
87
122
|
|
88
123
|
#endif
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,88 @@
|
|
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
|
+
#include "common.h"
|
8
|
+
#include "protocol.h"
|
9
|
+
#include "pkt.h"
|
10
|
+
#include "buffer.h"
|
11
|
+
|
12
|
+
int git_protocol_store_refs(git_transport *t, int flushes)
|
13
|
+
{
|
14
|
+
gitno_buffer *buf = &t->buffer;
|
15
|
+
git_vector *refs = &t->refs;
|
16
|
+
int error, flush = 0, recvd;
|
17
|
+
const char *line_end;
|
18
|
+
git_pkt *pkt;
|
19
|
+
|
20
|
+
do {
|
21
|
+
if (buf->offset > 0)
|
22
|
+
error = git_pkt_parse_line(&pkt, buf->data, &line_end, buf->offset);
|
23
|
+
else
|
24
|
+
error = GIT_EBUFS;
|
25
|
+
|
26
|
+
if (error < 0 && error != GIT_EBUFS)
|
27
|
+
return -1;
|
28
|
+
|
29
|
+
if (error == GIT_EBUFS) {
|
30
|
+
if ((recvd = gitno_recv(buf)) < 0)
|
31
|
+
return -1;
|
32
|
+
|
33
|
+
if (recvd == 0 && !flush) {
|
34
|
+
giterr_set(GITERR_NET, "Early EOF");
|
35
|
+
return -1;
|
36
|
+
}
|
37
|
+
|
38
|
+
continue;
|
39
|
+
}
|
40
|
+
|
41
|
+
gitno_consume(buf, line_end);
|
42
|
+
if (pkt->type == GIT_PKT_ERR) {
|
43
|
+
giterr_set(GITERR_NET, "Remote error: %s", ((git_pkt_err *)pkt)->error);
|
44
|
+
git__free(pkt);
|
45
|
+
return -1;
|
46
|
+
}
|
47
|
+
|
48
|
+
if (git_vector_insert(refs, pkt) < 0)
|
49
|
+
return -1;
|
50
|
+
|
51
|
+
if (pkt->type == GIT_PKT_FLUSH)
|
52
|
+
flush++;
|
53
|
+
} while (flush < flushes);
|
54
|
+
|
55
|
+
return flush;
|
56
|
+
}
|
57
|
+
|
58
|
+
int git_protocol_detect_caps(git_pkt_ref *pkt, git_transport_caps *caps)
|
59
|
+
{
|
60
|
+
const char *ptr;
|
61
|
+
|
62
|
+
/* No refs or capabilites, odd but not a problem */
|
63
|
+
if (pkt == NULL || pkt->capabilities == NULL)
|
64
|
+
return 0;
|
65
|
+
|
66
|
+
ptr = pkt->capabilities;
|
67
|
+
while (ptr != NULL && *ptr != '\0') {
|
68
|
+
if (*ptr == ' ')
|
69
|
+
ptr++;
|
70
|
+
|
71
|
+
if(!git__prefixcmp(ptr, GIT_CAP_OFS_DELTA)) {
|
72
|
+
caps->common = caps->ofs_delta = 1;
|
73
|
+
ptr += strlen(GIT_CAP_OFS_DELTA);
|
74
|
+
continue;
|
75
|
+
}
|
76
|
+
|
77
|
+
if(!git__prefixcmp(ptr, GIT_CAP_MULTI_ACK)) {
|
78
|
+
caps->common = caps->multi_ack = 1;
|
79
|
+
ptr += strlen(GIT_CAP_MULTI_ACK);
|
80
|
+
continue;
|
81
|
+
}
|
82
|
+
|
83
|
+
/* We don't know this capability, so skip it */
|
84
|
+
ptr = strchr(ptr, ' ');
|
85
|
+
}
|
86
|
+
|
87
|
+
return 0;
|
88
|
+
}
|
@@ -9,15 +9,9 @@
|
|
9
9
|
|
10
10
|
#include "transport.h"
|
11
11
|
#include "buffer.h"
|
12
|
+
#include "pkt.h"
|
12
13
|
|
13
|
-
|
14
|
-
|
15
|
-
git_vector *refs;
|
16
|
-
git_buf buf;
|
17
|
-
int error;
|
18
|
-
unsigned int flush :1;
|
19
|
-
} git_protocol;
|
20
|
-
|
21
|
-
int git_protocol_store_refs(git_protocol *p, const char *data, size_t len);
|
14
|
+
int git_protocol_store_refs(git_transport *t, int flushes);
|
15
|
+
int git_protocol_detect_caps(git_pkt_ref *pkt, git_transport_caps *caps);
|
22
16
|
|
23
17
|
#endif
|
@@ -0,0 +1,489 @@
|
|
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 "reflog.h"
|
9
|
+
#include "repository.h"
|
10
|
+
#include "filebuf.h"
|
11
|
+
#include "signature.h"
|
12
|
+
|
13
|
+
static int reflog_init(git_reflog **reflog, git_reference *ref)
|
14
|
+
{
|
15
|
+
git_reflog *log;
|
16
|
+
|
17
|
+
*reflog = NULL;
|
18
|
+
|
19
|
+
log = git__calloc(1, sizeof(git_reflog));
|
20
|
+
GITERR_CHECK_ALLOC(log);
|
21
|
+
|
22
|
+
log->ref_name = git__strdup(ref->name);
|
23
|
+
GITERR_CHECK_ALLOC(log->ref_name);
|
24
|
+
|
25
|
+
if (git_vector_init(&log->entries, 0, NULL) < 0) {
|
26
|
+
git__free(log->ref_name);
|
27
|
+
git__free(log);
|
28
|
+
return -1;
|
29
|
+
}
|
30
|
+
|
31
|
+
log->owner = git_reference_owner(ref);
|
32
|
+
*reflog = log;
|
33
|
+
|
34
|
+
return 0;
|
35
|
+
}
|
36
|
+
|
37
|
+
static int serialize_reflog_entry(
|
38
|
+
git_buf *buf,
|
39
|
+
const git_oid *oid_old,
|
40
|
+
const git_oid *oid_new,
|
41
|
+
const git_signature *committer,
|
42
|
+
const char *msg)
|
43
|
+
{
|
44
|
+
char raw_old[GIT_OID_HEXSZ+1];
|
45
|
+
char raw_new[GIT_OID_HEXSZ+1];
|
46
|
+
|
47
|
+
git_oid_tostr(raw_old, GIT_OID_HEXSZ+1, oid_old);
|
48
|
+
git_oid_tostr(raw_new, GIT_OID_HEXSZ+1, oid_new);
|
49
|
+
|
50
|
+
git_buf_clear(buf);
|
51
|
+
|
52
|
+
git_buf_puts(buf, raw_old);
|
53
|
+
git_buf_putc(buf, ' ');
|
54
|
+
git_buf_puts(buf, raw_new);
|
55
|
+
|
56
|
+
git_signature__writebuf(buf, " ", committer);
|
57
|
+
|
58
|
+
/* drop trailing LF */
|
59
|
+
git_buf_rtrim(buf);
|
60
|
+
|
61
|
+
if (msg) {
|
62
|
+
git_buf_putc(buf, '\t');
|
63
|
+
git_buf_puts(buf, msg);
|
64
|
+
}
|
65
|
+
|
66
|
+
git_buf_putc(buf, '\n');
|
67
|
+
|
68
|
+
return git_buf_oom(buf);
|
69
|
+
}
|
70
|
+
|
71
|
+
static int reflog_entry_new(git_reflog_entry **entry)
|
72
|
+
{
|
73
|
+
git_reflog_entry *e;
|
74
|
+
|
75
|
+
assert(entry);
|
76
|
+
|
77
|
+
e = git__malloc(sizeof(git_reflog_entry));
|
78
|
+
GITERR_CHECK_ALLOC(e);
|
79
|
+
|
80
|
+
memset(e, 0, sizeof(git_reflog_entry));
|
81
|
+
|
82
|
+
*entry = e;
|
83
|
+
|
84
|
+
return 0;
|
85
|
+
}
|
86
|
+
|
87
|
+
static void reflog_entry_free(git_reflog_entry *entry)
|
88
|
+
{
|
89
|
+
git_signature_free(entry->committer);
|
90
|
+
|
91
|
+
git__free(entry->msg);
|
92
|
+
git__free(entry);
|
93
|
+
}
|
94
|
+
|
95
|
+
static int reflog_parse(git_reflog *log, const char *buf, size_t buf_size)
|
96
|
+
{
|
97
|
+
const char *ptr;
|
98
|
+
git_reflog_entry *entry;
|
99
|
+
|
100
|
+
#define seek_forward(_increase) do { \
|
101
|
+
if (_increase >= buf_size) { \
|
102
|
+
giterr_set(GITERR_INVALID, "Ran out of data while parsing reflog"); \
|
103
|
+
goto fail; \
|
104
|
+
} \
|
105
|
+
buf += _increase; \
|
106
|
+
buf_size -= _increase; \
|
107
|
+
} while (0)
|
108
|
+
|
109
|
+
while (buf_size > GIT_REFLOG_SIZE_MIN) {
|
110
|
+
if (reflog_entry_new(&entry) < 0)
|
111
|
+
return -1;
|
112
|
+
|
113
|
+
entry->committer = git__malloc(sizeof(git_signature));
|
114
|
+
GITERR_CHECK_ALLOC(entry->committer);
|
115
|
+
|
116
|
+
if (git_oid_fromstrn(&entry->oid_old, buf, GIT_OID_HEXSZ) < 0)
|
117
|
+
goto fail;
|
118
|
+
seek_forward(GIT_OID_HEXSZ + 1);
|
119
|
+
|
120
|
+
if (git_oid_fromstrn(&entry->oid_cur, buf, GIT_OID_HEXSZ) < 0)
|
121
|
+
goto fail;
|
122
|
+
seek_forward(GIT_OID_HEXSZ + 1);
|
123
|
+
|
124
|
+
ptr = buf;
|
125
|
+
|
126
|
+
/* Seek forward to the end of the signature. */
|
127
|
+
while (*buf && *buf != '\t' && *buf != '\n')
|
128
|
+
seek_forward(1);
|
129
|
+
|
130
|
+
if (git_signature__parse(entry->committer, &ptr, buf + 1, NULL, *buf) < 0)
|
131
|
+
goto fail;
|
132
|
+
|
133
|
+
if (*buf == '\t') {
|
134
|
+
/* We got a message. Read everything till we reach LF. */
|
135
|
+
seek_forward(1);
|
136
|
+
ptr = buf;
|
137
|
+
|
138
|
+
while (*buf && *buf != '\n')
|
139
|
+
seek_forward(1);
|
140
|
+
|
141
|
+
entry->msg = git__strndup(ptr, buf - ptr);
|
142
|
+
GITERR_CHECK_ALLOC(entry->msg);
|
143
|
+
} else
|
144
|
+
entry->msg = NULL;
|
145
|
+
|
146
|
+
while (*buf && *buf == '\n' && buf_size > 1)
|
147
|
+
seek_forward(1);
|
148
|
+
|
149
|
+
if (git_vector_insert(&log->entries, entry) < 0)
|
150
|
+
goto fail;
|
151
|
+
}
|
152
|
+
|
153
|
+
return 0;
|
154
|
+
|
155
|
+
#undef seek_forward
|
156
|
+
|
157
|
+
fail:
|
158
|
+
if (entry)
|
159
|
+
reflog_entry_free(entry);
|
160
|
+
|
161
|
+
return -1;
|
162
|
+
}
|
163
|
+
|
164
|
+
void git_reflog_free(git_reflog *reflog)
|
165
|
+
{
|
166
|
+
unsigned int i;
|
167
|
+
git_reflog_entry *entry;
|
168
|
+
|
169
|
+
for (i=0; i < reflog->entries.length; i++) {
|
170
|
+
entry = git_vector_get(&reflog->entries, i);
|
171
|
+
|
172
|
+
reflog_entry_free(entry);
|
173
|
+
}
|
174
|
+
|
175
|
+
git_vector_free(&reflog->entries);
|
176
|
+
git__free(reflog->ref_name);
|
177
|
+
git__free(reflog);
|
178
|
+
}
|
179
|
+
|
180
|
+
static int retrieve_reflog_path(git_buf *path, git_reference *ref)
|
181
|
+
{
|
182
|
+
return git_buf_join_n(path, '/', 3,
|
183
|
+
git_reference_owner(ref)->path_repository, GIT_REFLOG_DIR, ref->name);
|
184
|
+
}
|
185
|
+
|
186
|
+
static int create_new_reflog_file(const char *filepath)
|
187
|
+
{
|
188
|
+
int fd;
|
189
|
+
|
190
|
+
if ((fd = p_open(filepath,
|
191
|
+
O_WRONLY | O_CREAT | O_TRUNC,
|
192
|
+
GIT_REFLOG_FILE_MODE)) < 0)
|
193
|
+
return -1;
|
194
|
+
|
195
|
+
return p_close(fd);
|
196
|
+
}
|
197
|
+
|
198
|
+
int git_reflog_read(git_reflog **reflog, git_reference *ref)
|
199
|
+
{
|
200
|
+
int error = -1;
|
201
|
+
git_buf log_path = GIT_BUF_INIT;
|
202
|
+
git_buf log_file = GIT_BUF_INIT;
|
203
|
+
git_reflog *log = NULL;
|
204
|
+
|
205
|
+
*reflog = NULL;
|
206
|
+
|
207
|
+
assert(reflog && ref);
|
208
|
+
|
209
|
+
if (reflog_init(&log, ref) < 0)
|
210
|
+
return -1;
|
211
|
+
|
212
|
+
if (retrieve_reflog_path(&log_path, ref) < 0)
|
213
|
+
goto cleanup;
|
214
|
+
|
215
|
+
error = git_futils_readbuffer(&log_file, git_buf_cstr(&log_path));
|
216
|
+
if (error < 0 && error != GIT_ENOTFOUND)
|
217
|
+
goto cleanup;
|
218
|
+
|
219
|
+
if ((error == GIT_ENOTFOUND) &&
|
220
|
+
((error = create_new_reflog_file(git_buf_cstr(&log_path))) < 0))
|
221
|
+
goto cleanup;
|
222
|
+
|
223
|
+
if ((error = reflog_parse(log,
|
224
|
+
git_buf_cstr(&log_file), git_buf_len(&log_file))) < 0)
|
225
|
+
goto cleanup;
|
226
|
+
|
227
|
+
*reflog = log;
|
228
|
+
goto success;
|
229
|
+
|
230
|
+
cleanup:
|
231
|
+
git_reflog_free(log);
|
232
|
+
|
233
|
+
success:
|
234
|
+
git_buf_free(&log_file);
|
235
|
+
git_buf_free(&log_path);
|
236
|
+
|
237
|
+
return error;
|
238
|
+
}
|
239
|
+
|
240
|
+
int git_reflog_write(git_reflog *reflog)
|
241
|
+
{
|
242
|
+
int error = -1;
|
243
|
+
unsigned int i;
|
244
|
+
git_reflog_entry *entry;
|
245
|
+
git_buf log_path = GIT_BUF_INIT;
|
246
|
+
git_buf log = GIT_BUF_INIT;
|
247
|
+
git_filebuf fbuf = GIT_FILEBUF_INIT;
|
248
|
+
|
249
|
+
assert(reflog);
|
250
|
+
|
251
|
+
|
252
|
+
if (git_buf_join_n(&log_path, '/', 3,
|
253
|
+
git_repository_path(reflog->owner), GIT_REFLOG_DIR, reflog->ref_name) < 0)
|
254
|
+
return -1;
|
255
|
+
|
256
|
+
if (!git_path_isfile(git_buf_cstr(&log_path))) {
|
257
|
+
giterr_set(GITERR_INVALID,
|
258
|
+
"Log file for reference '%s' doesn't exist.", reflog->ref_name);
|
259
|
+
goto cleanup;
|
260
|
+
}
|
261
|
+
|
262
|
+
if ((error = git_filebuf_open(&fbuf, git_buf_cstr(&log_path), 0)) < 0)
|
263
|
+
goto cleanup;
|
264
|
+
|
265
|
+
git_vector_foreach(&reflog->entries, i, entry) {
|
266
|
+
if (serialize_reflog_entry(&log, &(entry->oid_old), &(entry->oid_cur), entry->committer, entry->msg) < 0)
|
267
|
+
goto cleanup;
|
268
|
+
|
269
|
+
if ((error = git_filebuf_write(&fbuf, log.ptr, log.size)) < 0)
|
270
|
+
goto cleanup;
|
271
|
+
}
|
272
|
+
|
273
|
+
error = git_filebuf_commit(&fbuf, GIT_REFLOG_FILE_MODE);
|
274
|
+
goto success;
|
275
|
+
|
276
|
+
cleanup:
|
277
|
+
git_filebuf_cleanup(&fbuf);
|
278
|
+
|
279
|
+
success:
|
280
|
+
git_buf_free(&log);
|
281
|
+
git_buf_free(&log_path);
|
282
|
+
return error;
|
283
|
+
}
|
284
|
+
|
285
|
+
int git_reflog_append(git_reflog *reflog, const git_oid *new_oid,
|
286
|
+
const git_signature *committer, const char *msg)
|
287
|
+
{
|
288
|
+
int count;
|
289
|
+
git_reflog_entry *entry;
|
290
|
+
const char *newline;
|
291
|
+
|
292
|
+
assert(reflog && new_oid && committer);
|
293
|
+
|
294
|
+
if (reflog_entry_new(&entry) < 0)
|
295
|
+
return -1;
|
296
|
+
|
297
|
+
if ((entry->committer = git_signature_dup(committer)) == NULL)
|
298
|
+
goto cleanup;
|
299
|
+
|
300
|
+
if (msg != NULL) {
|
301
|
+
if ((entry->msg = git__strdup(msg)) == NULL)
|
302
|
+
goto cleanup;
|
303
|
+
|
304
|
+
newline = strchr(msg, '\n');
|
305
|
+
|
306
|
+
if (newline) {
|
307
|
+
if (newline[1] != '\0') {
|
308
|
+
giterr_set(GITERR_INVALID, "Reflog message cannot contain newline");
|
309
|
+
goto cleanup;
|
310
|
+
}
|
311
|
+
|
312
|
+
entry->msg[newline - msg] = '\0';
|
313
|
+
}
|
314
|
+
}
|
315
|
+
|
316
|
+
count = git_reflog_entrycount(reflog);
|
317
|
+
|
318
|
+
if (count == 0)
|
319
|
+
git_oid_fromstr(&entry->oid_old, GIT_OID_HEX_ZERO);
|
320
|
+
else {
|
321
|
+
const git_reflog_entry *previous;
|
322
|
+
|
323
|
+
previous = git_reflog_entry_byindex(reflog, count -1);
|
324
|
+
git_oid_cpy(&entry->oid_old, &previous->oid_cur);
|
325
|
+
}
|
326
|
+
|
327
|
+
git_oid_cpy(&entry->oid_cur, new_oid);
|
328
|
+
|
329
|
+
if (git_vector_insert(&reflog->entries, entry) < 0)
|
330
|
+
goto cleanup;
|
331
|
+
|
332
|
+
return 0;
|
333
|
+
|
334
|
+
cleanup:
|
335
|
+
reflog_entry_free(entry);
|
336
|
+
return -1;
|
337
|
+
}
|
338
|
+
|
339
|
+
int git_reflog_rename(git_reference *ref, const char *new_name)
|
340
|
+
{
|
341
|
+
int error = -1, fd;
|
342
|
+
git_buf old_path = GIT_BUF_INIT;
|
343
|
+
git_buf new_path = GIT_BUF_INIT;
|
344
|
+
git_buf temp_path = GIT_BUF_INIT;
|
345
|
+
|
346
|
+
assert(ref && new_name);
|
347
|
+
|
348
|
+
if (git_buf_joinpath(&temp_path, git_reference_owner(ref)->path_repository, GIT_REFLOG_DIR) < 0)
|
349
|
+
return -1;
|
350
|
+
|
351
|
+
if (git_buf_joinpath(&old_path, git_buf_cstr(&temp_path), ref->name) < 0)
|
352
|
+
goto cleanup;
|
353
|
+
|
354
|
+
if (git_buf_joinpath(&new_path, git_buf_cstr(&temp_path), new_name) < 0)
|
355
|
+
goto cleanup;
|
356
|
+
|
357
|
+
/*
|
358
|
+
* Move the reflog to a temporary place. This two-phase renaming is required
|
359
|
+
* in order to cope with funny renaming use cases when one tries to move a reference
|
360
|
+
* to a partially colliding namespace:
|
361
|
+
* - a/b -> a/b/c
|
362
|
+
* - a/b/c/d -> a/b/c
|
363
|
+
*/
|
364
|
+
if (git_buf_joinpath(&temp_path, git_buf_cstr(&temp_path), "temp_reflog") < 0)
|
365
|
+
goto cleanup;
|
366
|
+
|
367
|
+
if ((fd = git_futils_mktmp(&temp_path, git_buf_cstr(&temp_path))) < 0)
|
368
|
+
goto cleanup;
|
369
|
+
p_close(fd);
|
370
|
+
|
371
|
+
if (p_rename(git_buf_cstr(&old_path), git_buf_cstr(&temp_path)) < 0)
|
372
|
+
goto cleanup;
|
373
|
+
|
374
|
+
if (git_path_isdir(git_buf_cstr(&new_path)) &&
|
375
|
+
(git_futils_rmdir_r(git_buf_cstr(&new_path), GIT_DIRREMOVAL_ONLY_EMPTY_DIRS) < 0))
|
376
|
+
goto cleanup;
|
377
|
+
|
378
|
+
if (git_futils_mkpath2file(git_buf_cstr(&new_path), GIT_REFLOG_DIR_MODE) < 0)
|
379
|
+
goto cleanup;
|
380
|
+
|
381
|
+
error = p_rename(git_buf_cstr(&temp_path), git_buf_cstr(&new_path));
|
382
|
+
|
383
|
+
cleanup:
|
384
|
+
git_buf_free(&temp_path);
|
385
|
+
git_buf_free(&old_path);
|
386
|
+
git_buf_free(&new_path);
|
387
|
+
|
388
|
+
return error;
|
389
|
+
}
|
390
|
+
|
391
|
+
int git_reflog_delete(git_reference *ref)
|
392
|
+
{
|
393
|
+
int error;
|
394
|
+
git_buf path = GIT_BUF_INIT;
|
395
|
+
|
396
|
+
error = retrieve_reflog_path(&path, ref);
|
397
|
+
|
398
|
+
if (!error && git_path_exists(path.ptr))
|
399
|
+
error = p_unlink(path.ptr);
|
400
|
+
|
401
|
+
git_buf_free(&path);
|
402
|
+
|
403
|
+
return error;
|
404
|
+
}
|
405
|
+
|
406
|
+
unsigned int git_reflog_entrycount(git_reflog *reflog)
|
407
|
+
{
|
408
|
+
assert(reflog);
|
409
|
+
return (unsigned int)reflog->entries.length;
|
410
|
+
}
|
411
|
+
|
412
|
+
const git_reflog_entry * git_reflog_entry_byindex(git_reflog *reflog, size_t idx)
|
413
|
+
{
|
414
|
+
assert(reflog);
|
415
|
+
return git_vector_get(&reflog->entries, idx);
|
416
|
+
}
|
417
|
+
|
418
|
+
const git_oid * git_reflog_entry_oidold(const git_reflog_entry *entry)
|
419
|
+
{
|
420
|
+
assert(entry);
|
421
|
+
return &entry->oid_old;
|
422
|
+
}
|
423
|
+
|
424
|
+
const git_oid * git_reflog_entry_oidnew(const git_reflog_entry *entry)
|
425
|
+
{
|
426
|
+
assert(entry);
|
427
|
+
return &entry->oid_cur;
|
428
|
+
}
|
429
|
+
|
430
|
+
git_signature * git_reflog_entry_committer(const git_reflog_entry *entry)
|
431
|
+
{
|
432
|
+
assert(entry);
|
433
|
+
return entry->committer;
|
434
|
+
}
|
435
|
+
|
436
|
+
char * git_reflog_entry_msg(const git_reflog_entry *entry)
|
437
|
+
{
|
438
|
+
assert(entry);
|
439
|
+
return entry->msg;
|
440
|
+
}
|
441
|
+
|
442
|
+
int git_reflog_drop(
|
443
|
+
git_reflog *reflog,
|
444
|
+
unsigned int idx,
|
445
|
+
int rewrite_previous_entry)
|
446
|
+
{
|
447
|
+
unsigned int entrycount;
|
448
|
+
git_reflog_entry *entry, *previous;
|
449
|
+
|
450
|
+
assert(reflog);
|
451
|
+
|
452
|
+
entrycount = git_reflog_entrycount(reflog);
|
453
|
+
|
454
|
+
if (idx >= entrycount)
|
455
|
+
return GIT_ENOTFOUND;
|
456
|
+
|
457
|
+
entry = git_vector_get(&reflog->entries, idx);
|
458
|
+
reflog_entry_free(entry);
|
459
|
+
|
460
|
+
if (git_vector_remove(&reflog->entries, idx) < 0)
|
461
|
+
return -1;
|
462
|
+
|
463
|
+
if (!rewrite_previous_entry)
|
464
|
+
return 0;
|
465
|
+
|
466
|
+
/* No need to rewrite anything when removing the first entry */
|
467
|
+
if (idx == 0)
|
468
|
+
return 0;
|
469
|
+
|
470
|
+
/* There are no more entries in the log */
|
471
|
+
if (entrycount == 1)
|
472
|
+
return 0;
|
473
|
+
|
474
|
+
entry = (git_reflog_entry *)git_reflog_entry_byindex(reflog, idx - 1);
|
475
|
+
|
476
|
+
/* If the last entry has just been removed... */
|
477
|
+
if (idx == entrycount - 1) {
|
478
|
+
/* ...clear the oid_old member of the "new" last entry */
|
479
|
+
if (git_oid_fromstr(&entry->oid_old, GIT_OID_HEX_ZERO) < 0)
|
480
|
+
return -1;
|
481
|
+
|
482
|
+
return 0;
|
483
|
+
}
|
484
|
+
|
485
|
+
previous = (git_reflog_entry *)git_reflog_entry_byindex(reflog, idx);
|
486
|
+
git_oid_cpy(&entry->oid_old, &previous->oid_cur);
|
487
|
+
|
488
|
+
return 0;
|
489
|
+
}
|