rugged 0.1.2 → 0.16.0b1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +25 -36
- data/Rakefile +20 -98
- data/ext/rugged/extconf.rb +44 -4
- data/ext/rugged/remote.c +215 -0
- data/ext/rugged/rugged.c +171 -0
- data/ext/rugged/rugged.h +126 -0
- data/ext/rugged/rugged_blob.c +99 -0
- data/ext/rugged/rugged_commit.c +224 -0
- data/ext/rugged/rugged_config.c +238 -0
- data/ext/rugged/rugged_index.c +440 -0
- data/ext/rugged/rugged_object.c +203 -0
- data/ext/rugged/rugged_reference.c +401 -0
- data/ext/rugged/rugged_repo.c +482 -0
- data/ext/rugged/rugged_revwalk.c +138 -0
- data/ext/rugged/rugged_signature.c +80 -0
- data/ext/rugged/rugged_tag.c +216 -0
- data/ext/rugged/rugged_tree.c +322 -0
- data/ext/rugged/vendor/libgit2-dist.tar.gz +0 -0
- data/ext/rugged/vendor/libgit2-dist/deps/http-parser/http_parser.c +1778 -0
- data/ext/rugged/vendor/libgit2-dist/deps/http-parser/http_parser.h +267 -0
- data/ext/rugged/vendor/libgit2-dist/deps/zlib/adler32.c +169 -0
- data/ext/rugged/vendor/libgit2-dist/deps/zlib/crc32.c +442 -0
- data/ext/rugged/vendor/libgit2-dist/deps/zlib/crc32.h +441 -0
- data/ext/rugged/vendor/libgit2-dist/deps/zlib/deflate.c +1834 -0
- data/ext/rugged/vendor/libgit2-dist/deps/zlib/deflate.h +342 -0
- data/ext/rugged/vendor/libgit2-dist/deps/zlib/inffast.c +340 -0
- data/ext/rugged/vendor/libgit2-dist/deps/zlib/inffast.h +11 -0
- data/ext/rugged/vendor/libgit2-dist/deps/zlib/inffixed.h +94 -0
- data/ext/rugged/vendor/libgit2-dist/deps/zlib/inflate.c +1480 -0
- data/ext/rugged/vendor/libgit2-dist/deps/zlib/inflate.h +122 -0
- data/ext/rugged/vendor/libgit2-dist/deps/zlib/inftrees.c +330 -0
- data/ext/rugged/vendor/libgit2-dist/deps/zlib/inftrees.h +62 -0
- data/ext/rugged/vendor/libgit2-dist/deps/zlib/trees.c +1244 -0
- data/ext/rugged/vendor/libgit2-dist/deps/zlib/trees.h +128 -0
- data/ext/rugged/vendor/libgit2-dist/deps/zlib/zconf.h +54 -0
- data/ext/rugged/vendor/libgit2-dist/deps/zlib/zlib.h +1613 -0
- data/ext/rugged/vendor/libgit2-dist/deps/zlib/zutil.c +318 -0
- data/ext/rugged/vendor/libgit2-dist/deps/zlib/zutil.h +274 -0
- data/ext/rugged/vendor/libgit2-dist/examples/general.c +451 -0
- data/ext/rugged/vendor/libgit2-dist/examples/network/common.h +14 -0
- data/ext/rugged/vendor/libgit2-dist/examples/network/fetch.c +97 -0
- data/ext/rugged/vendor/libgit2-dist/examples/network/git2.c +58 -0
- data/ext/rugged/vendor/libgit2-dist/examples/network/index-pack.c +47 -0
- data/ext/rugged/vendor/libgit2-dist/examples/network/ls-remote.c +76 -0
- data/ext/rugged/vendor/libgit2-dist/examples/showindex.c +43 -0
- data/ext/rugged/vendor/libgit2-dist/include/git2.h +44 -0
- data/ext/rugged/vendor/libgit2-dist/include/git2/blob.h +120 -0
- data/ext/rugged/vendor/libgit2-dist/include/git2/branch.h +15 -0
- data/ext/rugged/vendor/libgit2-dist/include/git2/commit.h +263 -0
- data/ext/rugged/vendor/libgit2-dist/include/git2/common.h +103 -0
- data/ext/rugged/vendor/libgit2-dist/include/git2/config.h +278 -0
- data/ext/rugged/vendor/libgit2-dist/include/git2/errors.h +144 -0
- data/ext/rugged/vendor/libgit2-dist/include/git2/index.h +306 -0
- data/ext/rugged/vendor/libgit2-dist/include/git2/indexer.h +76 -0
- data/ext/rugged/vendor/libgit2-dist/include/git2/inttypes.h +305 -0
- data/ext/rugged/vendor/libgit2-dist/include/git2/net.h +51 -0
- data/ext/rugged/vendor/libgit2-dist/include/git2/object.h +173 -0
- data/ext/rugged/vendor/libgit2-dist/include/git2/odb.h +331 -0
- data/ext/rugged/vendor/libgit2-dist/include/git2/odb_backend.h +100 -0
- data/ext/rugged/vendor/libgit2-dist/include/git2/oid.h +218 -0
- data/ext/rugged/vendor/libgit2-dist/include/git2/reflog.h +128 -0
- data/ext/rugged/vendor/libgit2-dist/include/git2/refs.h +309 -0
- data/ext/rugged/vendor/libgit2-dist/include/git2/refspec.h +60 -0
- data/ext/rugged/vendor/libgit2-dist/include/git2/remote.h +176 -0
- data/ext/rugged/vendor/libgit2-dist/include/git2/repository.h +290 -0
- data/ext/rugged/vendor/libgit2-dist/include/git2/revwalk.h +169 -0
- data/ext/rugged/vendor/libgit2-dist/include/git2/signature.h +65 -0
- data/ext/rugged/vendor/libgit2-dist/include/git2/status.h +63 -0
- data/ext/rugged/vendor/libgit2-dist/include/git2/stdint.h +247 -0
- data/ext/rugged/vendor/libgit2-dist/include/git2/tag.h +279 -0
- data/ext/rugged/vendor/libgit2-dist/include/git2/threads.h +48 -0
- data/ext/rugged/vendor/libgit2-dist/include/git2/tree.h +318 -0
- data/ext/rugged/vendor/libgit2-dist/include/git2/types.h +169 -0
- data/ext/rugged/vendor/libgit2-dist/include/git2/version.h +15 -0
- data/ext/rugged/vendor/libgit2-dist/include/git2/windows.h +59 -0
- data/ext/rugged/vendor/libgit2-dist/include/git2/zlib.h +40 -0
- data/ext/rugged/vendor/libgit2-dist/src/blob.c +135 -0
- data/ext/rugged/vendor/libgit2-dist/src/blob.h +23 -0
- data/ext/rugged/vendor/libgit2-dist/src/bswap.h +97 -0
- data/ext/rugged/vendor/libgit2-dist/src/buffer.c +113 -0
- data/ext/rugged/vendor/libgit2-dist/src/buffer.h +32 -0
- data/ext/rugged/vendor/libgit2-dist/src/cache.c +111 -0
- data/ext/rugged/vendor/libgit2-dist/src/cache.h +64 -0
- data/ext/rugged/vendor/libgit2-dist/src/cc-compat.h +67 -0
- data/ext/rugged/vendor/libgit2-dist/src/commit.c +299 -0
- data/ext/rugged/vendor/libgit2-dist/src/commit.h +34 -0
- data/ext/rugged/vendor/libgit2-dist/src/common.h +64 -0
- data/ext/rugged/vendor/libgit2-dist/src/config.c +418 -0
- data/ext/rugged/vendor/libgit2-dist/src/config.h +24 -0
- data/ext/rugged/vendor/libgit2-dist/src/config_file.c +1210 -0
- data/ext/rugged/vendor/libgit2-dist/src/delta-apply.c +115 -0
- data/ext/rugged/vendor/libgit2-dist/src/delta-apply.h +33 -0
- data/ext/rugged/vendor/libgit2-dist/src/dir.h +47 -0
- data/ext/rugged/vendor/libgit2-dist/src/errors.c +104 -0
- data/ext/rugged/vendor/libgit2-dist/src/fetch.c +172 -0
- data/ext/rugged/vendor/libgit2-dist/src/fetch.h +18 -0
- data/ext/rugged/vendor/libgit2-dist/src/filebuf.c +400 -0
- data/ext/rugged/vendor/libgit2-dist/src/filebuf.h +72 -0
- data/ext/rugged/vendor/libgit2-dist/src/fileops.c +358 -0
- data/ext/rugged/vendor/libgit2-dist/src/fileops.h +151 -0
- data/ext/rugged/vendor/libgit2-dist/src/global.c +134 -0
- data/ext/rugged/vendor/libgit2-dist/src/global.h +24 -0
- data/ext/rugged/vendor/libgit2-dist/src/hash.c +74 -0
- data/ext/rugged/vendor/libgit2-dist/src/hash.h +29 -0
- data/ext/rugged/vendor/libgit2-dist/src/hashtable.c +243 -0
- data/ext/rugged/vendor/libgit2-dist/src/hashtable.h +80 -0
- data/ext/rugged/vendor/libgit2-dist/src/index.c +918 -0
- data/ext/rugged/vendor/libgit2-dist/src/index.h +34 -0
- data/ext/rugged/vendor/libgit2-dist/src/indexer.c +401 -0
- data/ext/rugged/vendor/libgit2-dist/src/map.h +37 -0
- data/ext/rugged/vendor/libgit2-dist/src/mwindow.c +272 -0
- data/ext/rugged/vendor/libgit2-dist/src/mwindow.h +45 -0
- data/ext/rugged/vendor/libgit2-dist/src/netops.c +198 -0
- data/ext/rugged/vendor/libgit2-dist/src/netops.h +36 -0
- data/ext/rugged/vendor/libgit2-dist/src/object.c +295 -0
- data/ext/rugged/vendor/libgit2-dist/src/odb.c +672 -0
- data/ext/rugged/vendor/libgit2-dist/src/odb.h +43 -0
- data/ext/rugged/vendor/libgit2-dist/src/odb_loose.c +855 -0
- data/ext/rugged/vendor/libgit2-dist/src/odb_pack.c +485 -0
- data/ext/rugged/vendor/libgit2-dist/src/oid.c +388 -0
- data/ext/rugged/vendor/libgit2-dist/src/pack.c +788 -0
- data/ext/rugged/vendor/libgit2-dist/src/pack.h +99 -0
- data/ext/rugged/vendor/libgit2-dist/src/path.c +270 -0
- data/ext/rugged/vendor/libgit2-dist/src/path.h +84 -0
- data/ext/rugged/vendor/libgit2-dist/src/pkt.c +426 -0
- data/ext/rugged/vendor/libgit2-dist/src/pkt.h +77 -0
- data/ext/rugged/vendor/libgit2-dist/src/posix.c +94 -0
- data/ext/rugged/vendor/libgit2-dist/src/posix.h +69 -0
- data/ext/rugged/vendor/libgit2-dist/src/ppc/sha1.c +70 -0
- data/ext/rugged/vendor/libgit2-dist/src/ppc/sha1.h +26 -0
- data/ext/rugged/vendor/libgit2-dist/src/pqueue.c +141 -0
- data/ext/rugged/vendor/libgit2-dist/src/pqueue.h +81 -0
- data/ext/rugged/vendor/libgit2-dist/src/protocol.c +50 -0
- data/ext/rugged/vendor/libgit2-dist/src/protocol.h +23 -0
- data/ext/rugged/vendor/libgit2-dist/src/reflog.c +318 -0
- data/ext/rugged/vendor/libgit2-dist/src/reflog.h +34 -0
- data/ext/rugged/vendor/libgit2-dist/src/refs.c +1693 -0
- data/ext/rugged/vendor/libgit2-dist/src/refs.h +58 -0
- data/ext/rugged/vendor/libgit2-dist/src/refspec.c +95 -0
- data/ext/rugged/vendor/libgit2-dist/src/refspec.h +23 -0
- data/ext/rugged/vendor/libgit2-dist/src/remote.c +339 -0
- data/ext/rugged/vendor/libgit2-dist/src/remote.h +25 -0
- data/ext/rugged/vendor/libgit2-dist/src/repository.c +849 -0
- data/ext/rugged/vendor/libgit2-dist/src/repository.h +60 -0
- data/ext/rugged/vendor/libgit2-dist/src/revwalk.c +569 -0
- data/ext/rugged/vendor/libgit2-dist/src/sha1.c +280 -0
- data/ext/rugged/vendor/libgit2-dist/src/sha1.h +21 -0
- data/ext/rugged/vendor/libgit2-dist/src/sha1_lookup.c +177 -0
- data/ext/rugged/vendor/libgit2-dist/src/sha1_lookup.h +18 -0
- data/ext/rugged/vendor/libgit2-dist/src/signature.c +335 -0
- data/ext/rugged/vendor/libgit2-dist/src/signature.h +18 -0
- data/ext/rugged/vendor/libgit2-dist/src/status.c +696 -0
- data/ext/rugged/vendor/libgit2-dist/src/tag.c +446 -0
- data/ext/rugged/vendor/libgit2-dist/src/tag.h +28 -0
- data/ext/rugged/vendor/libgit2-dist/src/thread-utils.c +55 -0
- data/ext/rugged/vendor/libgit2-dist/src/thread-utils.h +108 -0
- data/ext/rugged/vendor/libgit2-dist/src/transport.c +85 -0
- data/ext/rugged/vendor/libgit2-dist/src/transport.h +110 -0
- data/ext/rugged/vendor/libgit2-dist/src/transports/git.c +502 -0
- data/ext/rugged/vendor/libgit2-dist/src/transports/http.c +756 -0
- data/ext/rugged/vendor/libgit2-dist/src/transports/local.c +235 -0
- data/ext/rugged/vendor/libgit2-dist/src/tree-cache.c +201 -0
- data/ext/rugged/vendor/libgit2-dist/src/tree-cache.h +31 -0
- data/ext/rugged/vendor/libgit2-dist/src/tree.c +758 -0
- data/ext/rugged/vendor/libgit2-dist/src/tree.h +37 -0
- data/ext/rugged/vendor/libgit2-dist/src/tsort.c +365 -0
- data/ext/rugged/vendor/libgit2-dist/src/unix/map.c +70 -0
- data/ext/rugged/vendor/libgit2-dist/src/unix/posix.h +25 -0
- data/ext/rugged/vendor/libgit2-dist/src/util.c +381 -0
- data/ext/rugged/vendor/libgit2-dist/src/util.h +137 -0
- data/ext/rugged/vendor/libgit2-dist/src/vector.c +174 -0
- data/ext/rugged/vendor/libgit2-dist/src/vector.h +45 -0
- data/ext/rugged/vendor/libgit2-dist/src/win32/dir.c +115 -0
- data/ext/rugged/vendor/libgit2-dist/src/win32/fnmatch.c +180 -0
- data/ext/rugged/vendor/libgit2-dist/src/win32/fnmatch.h +27 -0
- data/ext/rugged/vendor/libgit2-dist/src/win32/map.c +131 -0
- data/ext/rugged/vendor/libgit2-dist/src/win32/mingw-compat.h +24 -0
- data/ext/rugged/vendor/libgit2-dist/src/win32/msvc-compat.h +38 -0
- data/ext/rugged/vendor/libgit2-dist/src/win32/posix.h +53 -0
- data/ext/rugged/vendor/libgit2-dist/src/win32/posix_w32.c +404 -0
- data/ext/rugged/vendor/libgit2-dist/src/win32/pthread.c +65 -0
- data/ext/rugged/vendor/libgit2-dist/src/win32/pthread.h +40 -0
- data/ext/rugged/vendor/libgit2-dist/src/win32/utf-conv.c +88 -0
- data/ext/rugged/vendor/libgit2-dist/src/win32/utf-conv.h +17 -0
- data/ext/rugged/vendor/libgit2-dist/tests-clay/buf/basic.c +29 -0
- data/ext/rugged/vendor/libgit2-dist/tests-clay/clay.h +187 -0
- data/ext/rugged/vendor/libgit2-dist/tests-clay/clay_libgit2.h +28 -0
- data/ext/rugged/vendor/libgit2-dist/tests-clay/clay_main.c +1073 -0
- data/ext/rugged/vendor/libgit2-dist/tests-clay/config/add.c +37 -0
- data/ext/rugged/vendor/libgit2-dist/tests-clay/config/new.c +36 -0
- data/ext/rugged/vendor/libgit2-dist/tests-clay/config/read.c +209 -0
- data/ext/rugged/vendor/libgit2-dist/tests-clay/config/stress.c +39 -0
- data/ext/rugged/vendor/libgit2-dist/tests-clay/config/write.c +77 -0
- data/ext/rugged/vendor/libgit2-dist/tests-clay/core/dirent.c +222 -0
- data/ext/rugged/vendor/libgit2-dist/tests-clay/core/filebuf.c +106 -0
- data/ext/rugged/vendor/libgit2-dist/tests-clay/core/oid.c +18 -0
- data/ext/rugged/vendor/libgit2-dist/tests-clay/core/path.c +139 -0
- data/ext/rugged/vendor/libgit2-dist/tests-clay/core/rmdir.c +50 -0
- data/ext/rugged/vendor/libgit2-dist/tests-clay/core/string.c +28 -0
- data/ext/rugged/vendor/libgit2-dist/tests-clay/core/strtol.c +37 -0
- data/ext/rugged/vendor/libgit2-dist/tests-clay/core/vector.c +66 -0
- data/ext/rugged/vendor/libgit2-dist/tests-clay/index/rename.c +60 -0
- data/ext/rugged/vendor/libgit2-dist/tests-clay/network/remotes.c +50 -0
- data/ext/rugged/vendor/libgit2-dist/tests-clay/object/raw/chars.c +52 -0
- data/ext/rugged/vendor/libgit2-dist/tests-clay/object/raw/compare.c +124 -0
- data/ext/rugged/vendor/libgit2-dist/tests-clay/object/raw/convert.c +75 -0
- data/ext/rugged/vendor/libgit2-dist/tests-clay/object/raw/data.h +323 -0
- data/ext/rugged/vendor/libgit2-dist/tests-clay/object/raw/fromstr.c +30 -0
- data/ext/rugged/vendor/libgit2-dist/tests-clay/object/raw/hash.c +162 -0
- data/ext/rugged/vendor/libgit2-dist/tests-clay/object/raw/short.c +94 -0
- data/ext/rugged/vendor/libgit2-dist/tests-clay/object/raw/size.c +13 -0
- data/ext/rugged/vendor/libgit2-dist/tests-clay/object/raw/type2string.c +54 -0
- data/ext/rugged/vendor/libgit2-dist/tests-clay/object/tree/frompath.c +75 -0
- data/ext/rugged/vendor/libgit2-dist/tests-clay/odb/loose.c +84 -0
- data/ext/rugged/vendor/libgit2-dist/tests-clay/odb/loose_data.h +522 -0
- data/ext/rugged/vendor/libgit2-dist/tests-clay/odb/pack_data.h +151 -0
- data/ext/rugged/vendor/libgit2-dist/tests-clay/odb/packed.c +78 -0
- data/ext/rugged/vendor/libgit2-dist/tests-clay/odb/sorting.c +71 -0
- data/ext/rugged/vendor/libgit2-dist/tests-clay/repo/getters.c +68 -0
- data/ext/rugged/vendor/libgit2-dist/tests-clay/repo/init.c +104 -0
- data/ext/rugged/vendor/libgit2-dist/tests-clay/repo/open.c +54 -0
- data/ext/rugged/vendor/libgit2-dist/tests-clay/status/single.c +38 -0
- data/ext/rugged/vendor/libgit2-dist/tests-clay/status/status_data.h +48 -0
- data/ext/rugged/vendor/libgit2-dist/tests-clay/status/worktree.c +124 -0
- data/ext/rugged/vendor/libgit2-dist/tests/t00-core.c +628 -0
- data/ext/rugged/vendor/libgit2-dist/tests/t01-data.h +322 -0
- data/ext/rugged/vendor/libgit2-dist/tests/t01-rawobj.c +638 -0
- data/ext/rugged/vendor/libgit2-dist/tests/t03-data.h +344 -0
- data/ext/rugged/vendor/libgit2-dist/tests/t03-objwrite.c +255 -0
- data/ext/rugged/vendor/libgit2-dist/tests/t04-commit.c +788 -0
- data/ext/rugged/vendor/libgit2-dist/tests/t05-revwalk.c +140 -0
- data/ext/rugged/vendor/libgit2-dist/tests/t06-index.c +219 -0
- data/ext/rugged/vendor/libgit2-dist/tests/t07-hashtable.c +192 -0
- data/ext/rugged/vendor/libgit2-dist/tests/t08-tag.c +357 -0
- data/ext/rugged/vendor/libgit2-dist/tests/t09-tree.c +221 -0
- data/ext/rugged/vendor/libgit2-dist/tests/t10-refs.c +1294 -0
- data/ext/rugged/vendor/libgit2-dist/tests/t12-repo.c +174 -0
- data/ext/rugged/vendor/libgit2-dist/tests/t13-threads.c +41 -0
- data/ext/rugged/vendor/libgit2-dist/tests/t17-bufs.c +61 -0
- data/ext/rugged/vendor/libgit2-dist/tests/t18-status.c +448 -0
- data/ext/rugged/vendor/libgit2-dist/tests/test_helpers.c +310 -0
- data/ext/rugged/vendor/libgit2-dist/tests/test_helpers.h +83 -0
- data/ext/rugged/vendor/libgit2-dist/tests/test_lib.c +198 -0
- data/ext/rugged/vendor/libgit2-dist/tests/test_lib.h +54 -0
- data/ext/rugged/vendor/libgit2-dist/tests/test_main.c +89 -0
- data/lib/rugged.rb +4 -3
- data/lib/rugged/index.rb +0 -8
- data/lib/rugged/objects.rb +45 -0
- data/lib/rugged/repository.rb +29 -0
- data/lib/rugged/tree.rb +16 -6
- data/lib/rugged/version.rb +1 -1
- data/lib/rugged/walker.rb +5 -0
- data/test/blob_test.rb +18 -14
- data/test/commit_test.rb +28 -26
- data/test/coverage/HEAD.json +1 -0
- data/test/coverage/cover.rb +106 -0
- data/test/fixtures/testrepo.git/refs/heads/new_name +1 -0
- data/test/index_test.rb +101 -78
- data/test/lib_test.rb +4 -4
- data/test/object_test.rb +3 -3
- data/test/reference_test.rb +75 -0
- data/test/remote_test.rb +19 -0
- data/test/repo_pack_test.rb +4 -4
- data/test/repo_test.rb +44 -15
- data/test/tag_test.rb +7 -17
- data/test/test_helper.rb +24 -5
- data/test/tree_test.rb +30 -12
- data/test/walker_test.rb +40 -31
- metadata +273 -50
- data/lib/rugged/person.rb +0 -20
- data/lib/rugged/tree_entry.rb +0 -9
- data/test/fixtures/testrepo.git/objects/1d/83f106355e4309a293e42ad2a2c4b8bdbe77ae +0 -0
- data/test/fixtures/testrepo.git/objects/2f/3321418db5b2a841375b8b70880a8ab5a4148f +0 -0
- data/test/fixtures/testrepo.git/objects/36/9b00a7700cca3a506d79e301d6ad8bf735d9ee +0 -3
- data/test/fixtures/testrepo.git/objects/3d/b1b5ceace59ff65279757003763046fd4cbbe6 +0 -0
- data/test/fixtures/testrepo.git/objects/4c/d1604907792e2c43e03dcec1216f99d63e68c4 +0 -3
- data/test/fixtures/testrepo.git/objects/e0/f46d77041c149296549b01ed4a18b02c4b7400 +0 -0
@@ -0,0 +1,169 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright (C) 2009-2011 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
|
+
#ifndef INCLUDE_git_types_h__
|
8
|
+
#define INCLUDE_git_types_h__
|
9
|
+
|
10
|
+
#include "common.h"
|
11
|
+
|
12
|
+
/**
|
13
|
+
* @file git2/types.h
|
14
|
+
* @brief libgit2 base & compatibility types
|
15
|
+
* @ingroup Git
|
16
|
+
* @{
|
17
|
+
*/
|
18
|
+
GIT_BEGIN_DECL
|
19
|
+
|
20
|
+
/**
|
21
|
+
* Cross-platform compatibility types for off_t / time_t
|
22
|
+
*
|
23
|
+
* NOTE: This needs to be in a public header so that both the library
|
24
|
+
* implementation and client applications both agree on the same types.
|
25
|
+
* Otherwise we get undefined behavior.
|
26
|
+
*
|
27
|
+
* Use the "best" types that each platform provides. Currently we truncate
|
28
|
+
* these intermediate representations for compatibility with the git ABI, but
|
29
|
+
* if and when it changes to support 64 bit types, our code will naturally
|
30
|
+
* adapt.
|
31
|
+
* NOTE: These types should match those that are returned by our internal
|
32
|
+
* stat() functions, for all platforms.
|
33
|
+
*/
|
34
|
+
#include <sys/types.h>
|
35
|
+
|
36
|
+
#if defined(_MSC_VER)
|
37
|
+
|
38
|
+
typedef __int64 git_off_t;
|
39
|
+
typedef __time64_t git_time_t;
|
40
|
+
|
41
|
+
#elif defined(__MINGW32__)
|
42
|
+
|
43
|
+
typedef off64_t git_off_t;
|
44
|
+
typedef __time64_t git_time_t;
|
45
|
+
|
46
|
+
#elif defined(__HAIKU__)
|
47
|
+
|
48
|
+
typedef __haiku_std_int64 git_off_t;
|
49
|
+
typedef __haiku_std_int64 git_time_t;
|
50
|
+
|
51
|
+
#else /* POSIX */
|
52
|
+
|
53
|
+
/*
|
54
|
+
* Note: Can't use off_t since if a client program includes <sys/types.h>
|
55
|
+
* before us (directly or indirectly), they'll get 32 bit off_t in their client
|
56
|
+
* app, even though /we/ define _FILE_OFFSET_BITS=64.
|
57
|
+
*/
|
58
|
+
typedef int64_t git_off_t;
|
59
|
+
typedef int64_t git_time_t;
|
60
|
+
|
61
|
+
#endif
|
62
|
+
|
63
|
+
/** Basic type (loose or packed) of any Git object. */
|
64
|
+
typedef enum {
|
65
|
+
GIT_OBJ_ANY = -2, /**< Object can be any of the following */
|
66
|
+
GIT_OBJ_BAD = -1, /**< Object is invalid. */
|
67
|
+
GIT_OBJ__EXT1 = 0, /**< Reserved for future use. */
|
68
|
+
GIT_OBJ_COMMIT = 1, /**< A commit object. */
|
69
|
+
GIT_OBJ_TREE = 2, /**< A tree (directory listing) object. */
|
70
|
+
GIT_OBJ_BLOB = 3, /**< A file revision object. */
|
71
|
+
GIT_OBJ_TAG = 4, /**< An annotated tag object. */
|
72
|
+
GIT_OBJ__EXT2 = 5, /**< Reserved for future use. */
|
73
|
+
GIT_OBJ_OFS_DELTA = 6, /**< A delta, base is given by an offset. */
|
74
|
+
GIT_OBJ_REF_DELTA = 7, /**< A delta, base is given by object id. */
|
75
|
+
} git_otype;
|
76
|
+
|
77
|
+
/** An open object database handle. */
|
78
|
+
typedef struct git_odb git_odb;
|
79
|
+
|
80
|
+
/** A custom backend in an ODB */
|
81
|
+
typedef struct git_odb_backend git_odb_backend;
|
82
|
+
|
83
|
+
/** An object read from the ODB */
|
84
|
+
typedef struct git_odb_object git_odb_object;
|
85
|
+
|
86
|
+
/** A stream to read/write from the ODB */
|
87
|
+
typedef struct git_odb_stream git_odb_stream;
|
88
|
+
|
89
|
+
/**
|
90
|
+
* Representation of an existing git repository,
|
91
|
+
* including all its object contents
|
92
|
+
*/
|
93
|
+
typedef struct git_repository git_repository;
|
94
|
+
|
95
|
+
/** Representation of a generic object in a repository */
|
96
|
+
typedef struct git_object git_object;
|
97
|
+
|
98
|
+
/** Representation of an in-progress walk through the commits in a repo */
|
99
|
+
typedef struct git_revwalk git_revwalk;
|
100
|
+
|
101
|
+
/** Parsed representation of a tag object. */
|
102
|
+
typedef struct git_tag git_tag;
|
103
|
+
|
104
|
+
/** In-memory representation of a blob object. */
|
105
|
+
typedef struct git_blob git_blob;
|
106
|
+
|
107
|
+
/** Parsed representation of a commit object. */
|
108
|
+
typedef struct git_commit git_commit;
|
109
|
+
|
110
|
+
/** Representation of each one of the entries in a tree object. */
|
111
|
+
typedef struct git_tree_entry git_tree_entry;
|
112
|
+
|
113
|
+
/** Representation of a tree object. */
|
114
|
+
typedef struct git_tree git_tree;
|
115
|
+
|
116
|
+
/** Constructor for in-memory trees */
|
117
|
+
typedef struct git_treebuilder git_treebuilder;
|
118
|
+
|
119
|
+
/** Memory representation of an index file. */
|
120
|
+
typedef struct git_index git_index;
|
121
|
+
|
122
|
+
/** Memory representation of a set of config files */
|
123
|
+
typedef struct git_config git_config;
|
124
|
+
|
125
|
+
/** Interface to access a configuration file */
|
126
|
+
typedef struct git_config_file git_config_file;
|
127
|
+
|
128
|
+
/** Representation of a reference log entry */
|
129
|
+
typedef struct git_reflog_entry git_reflog_entry;
|
130
|
+
|
131
|
+
/** Representation of a reference log */
|
132
|
+
typedef struct git_reflog git_reflog;
|
133
|
+
|
134
|
+
/** Time in a signature */
|
135
|
+
typedef struct git_time {
|
136
|
+
git_time_t time; /** time in seconds from epoch */
|
137
|
+
int offset; /** timezone offset, in minutes */
|
138
|
+
} git_time;
|
139
|
+
|
140
|
+
/** An action signature (e.g. for committers, taggers, etc) */
|
141
|
+
typedef struct git_signature {
|
142
|
+
char *name; /** full name of the author */
|
143
|
+
char *email; /** email of the author */
|
144
|
+
git_time when; /** time when the action happened */
|
145
|
+
} git_signature;
|
146
|
+
|
147
|
+
/** In-memory representation of a reference. */
|
148
|
+
typedef struct git_reference git_reference;
|
149
|
+
|
150
|
+
/** Basic type of any Git reference. */
|
151
|
+
typedef enum {
|
152
|
+
GIT_REF_INVALID = 0, /** Invalid reference */
|
153
|
+
GIT_REF_OID = 1, /** A reference which points at an object id */
|
154
|
+
GIT_REF_SYMBOLIC = 2, /** A reference which points at another reference */
|
155
|
+
GIT_REF_PACKED = 4,
|
156
|
+
GIT_REF_HAS_PEEL = 8,
|
157
|
+
GIT_REF_LISTALL = GIT_REF_OID|GIT_REF_SYMBOLIC|GIT_REF_PACKED,
|
158
|
+
} git_rtype;
|
159
|
+
|
160
|
+
|
161
|
+
typedef struct git_refspec git_refspec;
|
162
|
+
typedef struct git_remote git_remote;
|
163
|
+
|
164
|
+
typedef struct git_remote_head git_remote_head;
|
165
|
+
|
166
|
+
/** @} */
|
167
|
+
GIT_END_DECL
|
168
|
+
|
169
|
+
#endif
|
@@ -0,0 +1,15 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright (C) 2009-2011 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
|
+
#ifndef INCLUDE_git_version_h__
|
8
|
+
#define INCLUDE_git_version_h__
|
9
|
+
|
10
|
+
#define LIBGIT2_VERSION "0.15.0"
|
11
|
+
#define LIBGIT2_VER_MAJOR 0
|
12
|
+
#define LIBGIT2_VER_MINOR 15
|
13
|
+
#define LIBGIT2_VER_REVISION 0
|
14
|
+
|
15
|
+
#endif
|
@@ -0,0 +1,59 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright (C) 2009-2011 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
|
+
#ifndef INCLUDE_git_windows_h__
|
8
|
+
#define INCLUDE_git_windows_h__
|
9
|
+
|
10
|
+
#include "common.h"
|
11
|
+
|
12
|
+
/**
|
13
|
+
* @file git2/windows.h
|
14
|
+
* @brief Windows-specific functions
|
15
|
+
* @ingroup Git
|
16
|
+
* @{
|
17
|
+
*/
|
18
|
+
GIT_BEGIN_DECL
|
19
|
+
|
20
|
+
/**
|
21
|
+
* Set the active codepage for Windows syscalls
|
22
|
+
*
|
23
|
+
* All syscalls performed by the library will assume
|
24
|
+
* this codepage when converting paths and strings
|
25
|
+
* to use by the Windows kernel.
|
26
|
+
*
|
27
|
+
* The default value of UTF-8 will work automatically
|
28
|
+
* with most Git repositories created on Unix systems.
|
29
|
+
*
|
30
|
+
* This settings needs only be changed when working
|
31
|
+
* with repositories that contain paths in specific,
|
32
|
+
* non-UTF codepages.
|
33
|
+
*
|
34
|
+
* A full list of all available codepage identifiers may
|
35
|
+
* be found at:
|
36
|
+
*
|
37
|
+
* http://msdn.microsoft.com/en-us/library/windows/desktop/dd317756(v=vs.85).aspx
|
38
|
+
*
|
39
|
+
* @param codepage numeric codepage identifier
|
40
|
+
*/
|
41
|
+
GIT_EXTERN(void) gitwin_set_codepage(unsigned int codepage);
|
42
|
+
|
43
|
+
/**
|
44
|
+
* Return the active codepage for Windows syscalls
|
45
|
+
*
|
46
|
+
* @return numeric codepage identifier
|
47
|
+
*/
|
48
|
+
GIT_EXTERN(unsigned int) gitwin_get_codepage(void);
|
49
|
+
|
50
|
+
/**
|
51
|
+
* Set the active Windows codepage to UTF-8 (this is
|
52
|
+
* the default value)
|
53
|
+
*/
|
54
|
+
GIT_EXTERN(void) gitwin_set_utf8(void);
|
55
|
+
|
56
|
+
/** @} */
|
57
|
+
GIT_END_DECL
|
58
|
+
#endif
|
59
|
+
|
@@ -0,0 +1,40 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright (C) 2009-2011 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
|
+
#ifndef INCLUDE_git_zlib_h__
|
8
|
+
#define INCLUDE_git_zlib_h__
|
9
|
+
|
10
|
+
#include <zlib.h>
|
11
|
+
|
12
|
+
/**
|
13
|
+
* @file git2/zlib.h
|
14
|
+
* @brief Git data compression routines
|
15
|
+
* @defgroup git_zlib Git data compression routines
|
16
|
+
* @ingroup Git
|
17
|
+
* @{
|
18
|
+
*/
|
19
|
+
GIT_BEGIN_DECL
|
20
|
+
|
21
|
+
#if defined(NO_DEFLATE_BOUND) || ZLIB_VERNUM < 0x1200
|
22
|
+
/**
|
23
|
+
* deflateBound returns an upper bound on the compressed size.
|
24
|
+
*
|
25
|
+
* This is a stub function used when zlib does not supply the
|
26
|
+
* deflateBound() implementation itself.
|
27
|
+
*
|
28
|
+
* @param stream the stream pointer.
|
29
|
+
* @param s total length of the source data (in bytes).
|
30
|
+
* @return maximum length of the compressed data.
|
31
|
+
*/
|
32
|
+
GIT_INLINE(size_t) deflateBound(z_streamp stream, size_t s)
|
33
|
+
{
|
34
|
+
return (s + ((s + 7) >> 3) + ((s + 63) >> 6) + 11);
|
35
|
+
}
|
36
|
+
#endif
|
37
|
+
|
38
|
+
/** @} */
|
39
|
+
GIT_END_DECL
|
40
|
+
#endif
|
@@ -0,0 +1,135 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright (C) 2009-2011 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/common.h"
|
9
|
+
#include "git2/object.h"
|
10
|
+
#include "git2/repository.h"
|
11
|
+
|
12
|
+
#include "common.h"
|
13
|
+
#include "blob.h"
|
14
|
+
|
15
|
+
const void *git_blob_rawcontent(git_blob *blob)
|
16
|
+
{
|
17
|
+
assert(blob);
|
18
|
+
return blob->odb_object->raw.data;
|
19
|
+
}
|
20
|
+
|
21
|
+
size_t git_blob_rawsize(git_blob *blob)
|
22
|
+
{
|
23
|
+
assert(blob);
|
24
|
+
return blob->odb_object->raw.len;
|
25
|
+
}
|
26
|
+
|
27
|
+
void git_blob__free(git_blob *blob)
|
28
|
+
{
|
29
|
+
git_odb_object_free(blob->odb_object);
|
30
|
+
git__free(blob);
|
31
|
+
}
|
32
|
+
|
33
|
+
int git_blob__parse(git_blob *blob, git_odb_object *odb_obj)
|
34
|
+
{
|
35
|
+
assert(blob);
|
36
|
+
git_cached_obj_incref((git_cached_obj *)odb_obj);
|
37
|
+
blob->odb_object = odb_obj;
|
38
|
+
return GIT_SUCCESS;
|
39
|
+
}
|
40
|
+
|
41
|
+
int git_blob_create_frombuffer(git_oid *oid, git_repository *repo, const void *buffer, size_t len)
|
42
|
+
{
|
43
|
+
int error;
|
44
|
+
git_odb *odb;
|
45
|
+
git_odb_stream *stream;
|
46
|
+
|
47
|
+
error = git_repository_odb__weakptr(&odb, repo);
|
48
|
+
if (error < GIT_SUCCESS)
|
49
|
+
return error;
|
50
|
+
|
51
|
+
if ((error = git_odb_open_wstream(&stream, odb, len, GIT_OBJ_BLOB)) < GIT_SUCCESS)
|
52
|
+
return git__rethrow(error, "Failed to create blob");
|
53
|
+
|
54
|
+
if ((error = stream->write(stream, buffer, len)) < GIT_SUCCESS) {
|
55
|
+
stream->free(stream);
|
56
|
+
return error;
|
57
|
+
}
|
58
|
+
|
59
|
+
error = stream->finalize_write(oid, stream);
|
60
|
+
stream->free(stream);
|
61
|
+
|
62
|
+
if (error < GIT_SUCCESS)
|
63
|
+
return git__rethrow(error, "Failed to create blob");
|
64
|
+
|
65
|
+
return GIT_SUCCESS;
|
66
|
+
}
|
67
|
+
|
68
|
+
int git_blob_create_fromfile(git_oid *oid, git_repository *repo, const char *path)
|
69
|
+
{
|
70
|
+
int error, islnk;
|
71
|
+
int fd = 0;
|
72
|
+
char full_path[GIT_PATH_MAX];
|
73
|
+
char buffer[2048];
|
74
|
+
git_off_t size;
|
75
|
+
git_odb_stream *stream;
|
76
|
+
struct stat st;
|
77
|
+
const char *workdir;
|
78
|
+
git_odb *odb;
|
79
|
+
|
80
|
+
workdir = git_repository_workdir(repo);
|
81
|
+
if (workdir == NULL)
|
82
|
+
return git__throw(GIT_ENOTFOUND, "Failed to create blob. (No working directory found)");
|
83
|
+
|
84
|
+
git_path_join(full_path, workdir, path);
|
85
|
+
|
86
|
+
error = p_lstat(full_path, &st);
|
87
|
+
if (error < 0) {
|
88
|
+
return git__throw(GIT_EOSERR, "Failed to stat blob. %s", strerror(errno));
|
89
|
+
}
|
90
|
+
|
91
|
+
islnk = S_ISLNK(st.st_mode);
|
92
|
+
size = st.st_size;
|
93
|
+
|
94
|
+
error = git_repository_odb__weakptr(&odb, repo);
|
95
|
+
if (error < GIT_SUCCESS)
|
96
|
+
return error;
|
97
|
+
|
98
|
+
if (!islnk) {
|
99
|
+
if ((fd = p_open(full_path, O_RDONLY)) < 0)
|
100
|
+
return git__throw(GIT_ENOTFOUND, "Failed to create blob. Could not open '%s'", full_path);
|
101
|
+
}
|
102
|
+
|
103
|
+
if ((error = git_odb_open_wstream(&stream, odb, (size_t)size, GIT_OBJ_BLOB)) < GIT_SUCCESS) {
|
104
|
+
if (!islnk)
|
105
|
+
p_close(fd);
|
106
|
+
return git__rethrow(error, "Failed to create blob");
|
107
|
+
}
|
108
|
+
|
109
|
+
while (size > 0) {
|
110
|
+
ssize_t read_len;
|
111
|
+
|
112
|
+
if (!islnk)
|
113
|
+
read_len = p_read(fd, buffer, sizeof(buffer));
|
114
|
+
else
|
115
|
+
read_len = p_readlink(full_path, buffer, sizeof(buffer));
|
116
|
+
|
117
|
+
if (read_len < 0) {
|
118
|
+
if (!islnk)
|
119
|
+
p_close(fd);
|
120
|
+
stream->free(stream);
|
121
|
+
return git__throw(GIT_EOSERR, "Failed to create blob. Can't read full file");
|
122
|
+
}
|
123
|
+
|
124
|
+
stream->write(stream, buffer, read_len);
|
125
|
+
size -= read_len;
|
126
|
+
}
|
127
|
+
|
128
|
+
error = stream->finalize_write(oid, stream);
|
129
|
+
stream->free(stream);
|
130
|
+
if (!islnk)
|
131
|
+
p_close(fd);
|
132
|
+
|
133
|
+
return error == GIT_SUCCESS ? GIT_SUCCESS : git__rethrow(error, "Failed to create blob");
|
134
|
+
}
|
135
|
+
|
@@ -0,0 +1,23 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright (C) 2009-2011 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
|
+
#ifndef INCLUDE_blob_h__
|
8
|
+
#define INCLUDE_blob_h__
|
9
|
+
|
10
|
+
#include "git2/blob.h"
|
11
|
+
#include "repository.h"
|
12
|
+
#include "odb.h"
|
13
|
+
#include "fileops.h"
|
14
|
+
|
15
|
+
struct git_blob {
|
16
|
+
git_object object;
|
17
|
+
git_odb_object *odb_object;
|
18
|
+
};
|
19
|
+
|
20
|
+
void git_blob__free(git_blob *blob);
|
21
|
+
int git_blob__parse(git_blob *blob, git_odb_object *obj);
|
22
|
+
|
23
|
+
#endif
|