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,279 @@
|
|
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_tag_h__
|
8
|
+
#define INCLUDE_git_tag_h__
|
9
|
+
|
10
|
+
#include "common.h"
|
11
|
+
#include "types.h"
|
12
|
+
#include "oid.h"
|
13
|
+
#include "object.h"
|
14
|
+
|
15
|
+
/**
|
16
|
+
* @file git2/tag.h
|
17
|
+
* @brief Git tag parsing routines
|
18
|
+
* @defgroup git_tag Git tag management
|
19
|
+
* @ingroup Git
|
20
|
+
* @{
|
21
|
+
*/
|
22
|
+
GIT_BEGIN_DECL
|
23
|
+
|
24
|
+
/**
|
25
|
+
* Lookup a tag object from the repository.
|
26
|
+
*
|
27
|
+
* @param tag pointer to the looked up tag
|
28
|
+
* @param repo the repo to use when locating the tag.
|
29
|
+
* @param id identity of the tag to locate.
|
30
|
+
* @return GIT_SUCCESS or an error code
|
31
|
+
*/
|
32
|
+
GIT_INLINE(int) git_tag_lookup(git_tag **tag, git_repository *repo, const git_oid *id)
|
33
|
+
{
|
34
|
+
return git_object_lookup((git_object **)tag, repo, id, (git_otype)GIT_OBJ_TAG);
|
35
|
+
}
|
36
|
+
|
37
|
+
/**
|
38
|
+
* Lookup a tag object from the repository,
|
39
|
+
* given a prefix of its identifier (short id).
|
40
|
+
*
|
41
|
+
* @see git_object_lookup_prefix
|
42
|
+
*
|
43
|
+
* @param tag pointer to the looked up tag
|
44
|
+
* @param repo the repo to use when locating the tag.
|
45
|
+
* @param id identity of the tag to locate.
|
46
|
+
* @param len the length of the short identifier
|
47
|
+
* @return GIT_SUCCESS or an error code
|
48
|
+
*/
|
49
|
+
GIT_INLINE(int) git_tag_lookup_prefix(git_tag **tag, git_repository *repo, const git_oid *id, unsigned int len)
|
50
|
+
{
|
51
|
+
return git_object_lookup_prefix((git_object **)tag, repo, id, len, (git_otype)GIT_OBJ_TAG);
|
52
|
+
}
|
53
|
+
|
54
|
+
/**
|
55
|
+
* Close an open tag
|
56
|
+
*
|
57
|
+
* This is a wrapper around git_object_free()
|
58
|
+
*
|
59
|
+
* IMPORTANT:
|
60
|
+
* It *is* necessary to call this method when you stop
|
61
|
+
* using a tag. Failure to do so will cause a memory leak.
|
62
|
+
*
|
63
|
+
* @param tag the tag to close
|
64
|
+
*/
|
65
|
+
|
66
|
+
GIT_INLINE(void) git_tag_free(git_tag *tag)
|
67
|
+
{
|
68
|
+
git_object_free((git_object *) tag);
|
69
|
+
}
|
70
|
+
|
71
|
+
|
72
|
+
/**
|
73
|
+
* Get the id of a tag.
|
74
|
+
*
|
75
|
+
* @param tag a previously loaded tag.
|
76
|
+
* @return object identity for the tag.
|
77
|
+
*/
|
78
|
+
GIT_EXTERN(const git_oid *) git_tag_id(git_tag *tag);
|
79
|
+
|
80
|
+
/**
|
81
|
+
* Get the tagged object of a tag
|
82
|
+
*
|
83
|
+
* This method performs a repository lookup for the
|
84
|
+
* given object and returns it
|
85
|
+
*
|
86
|
+
* @param target pointer where to store the target
|
87
|
+
* @param tag a previously loaded tag.
|
88
|
+
* @return GIT_SUCCESS or an error code
|
89
|
+
*/
|
90
|
+
GIT_EXTERN(int) git_tag_target(git_object **target, git_tag *tag);
|
91
|
+
|
92
|
+
/**
|
93
|
+
* Get the OID of the tagged object of a tag
|
94
|
+
*
|
95
|
+
* @param tag a previously loaded tag.
|
96
|
+
* @return pointer to the OID
|
97
|
+
*/
|
98
|
+
GIT_EXTERN(const git_oid *) git_tag_target_oid(git_tag *tag);
|
99
|
+
|
100
|
+
/**
|
101
|
+
* Get the type of a tag's tagged object
|
102
|
+
*
|
103
|
+
* @param tag a previously loaded tag.
|
104
|
+
* @return type of the tagged object
|
105
|
+
*/
|
106
|
+
GIT_EXTERN(git_otype) git_tag_type(git_tag *tag);
|
107
|
+
|
108
|
+
/**
|
109
|
+
* Get the name of a tag
|
110
|
+
*
|
111
|
+
* @param tag a previously loaded tag.
|
112
|
+
* @return name of the tag
|
113
|
+
*/
|
114
|
+
GIT_EXTERN(const char *) git_tag_name(git_tag *tag);
|
115
|
+
|
116
|
+
/**
|
117
|
+
* Get the tagger (author) of a tag
|
118
|
+
*
|
119
|
+
* @param tag a previously loaded tag.
|
120
|
+
* @return reference to the tag's author
|
121
|
+
*/
|
122
|
+
GIT_EXTERN(const git_signature *) git_tag_tagger(git_tag *tag);
|
123
|
+
|
124
|
+
/**
|
125
|
+
* Get the message of a tag
|
126
|
+
*
|
127
|
+
* @param tag a previously loaded tag.
|
128
|
+
* @return message of the tag
|
129
|
+
*/
|
130
|
+
GIT_EXTERN(const char *) git_tag_message(git_tag *tag);
|
131
|
+
|
132
|
+
|
133
|
+
/**
|
134
|
+
* Create a new tag in the repository from an object
|
135
|
+
*
|
136
|
+
* A new reference will also be created pointing to
|
137
|
+
* this tag object. If `force` is true and a reference
|
138
|
+
* already exists with the given name, it'll be replaced.
|
139
|
+
*
|
140
|
+
* @param oid Pointer where to store the OID of the
|
141
|
+
* newly created tag. If the tag already exists, this parameter
|
142
|
+
* will be the oid of the existing tag, and the function will
|
143
|
+
* return a GIT_EEXISTS error code.
|
144
|
+
*
|
145
|
+
* @param repo Repository where to store the tag
|
146
|
+
*
|
147
|
+
* @param tag_name Name for the tag; this name is validated
|
148
|
+
* for consistency. It should also not conflict with an
|
149
|
+
* already existing tag name
|
150
|
+
*
|
151
|
+
* @param target Object to which this tag points. This object
|
152
|
+
* must belong to the given `repo`.
|
153
|
+
*
|
154
|
+
* @param tagger Signature of the tagger for this tag, and
|
155
|
+
* of the tagging time
|
156
|
+
*
|
157
|
+
* @param message Full message for this tag
|
158
|
+
*
|
159
|
+
* @param force Overwrite existing references
|
160
|
+
*
|
161
|
+
* @return GIT_SUCCESS or an error code
|
162
|
+
* A tag object is written to the ODB, and a proper reference
|
163
|
+
* is written in the /refs/tags folder, pointing to it
|
164
|
+
*/
|
165
|
+
GIT_EXTERN(int) git_tag_create(
|
166
|
+
git_oid *oid,
|
167
|
+
git_repository *repo,
|
168
|
+
const char *tag_name,
|
169
|
+
const git_object *target,
|
170
|
+
const git_signature *tagger,
|
171
|
+
const char *message,
|
172
|
+
int force);
|
173
|
+
|
174
|
+
/**
|
175
|
+
* Create a new tag in the repository from a buffer
|
176
|
+
*
|
177
|
+
* @param oid Pointer where to store the OID of the newly created tag
|
178
|
+
* @param repo Repository where to store the tag
|
179
|
+
* @param buffer Raw tag data
|
180
|
+
* @param force Overwrite existing tags
|
181
|
+
* @return 0 on sucess; error code otherwise
|
182
|
+
*/
|
183
|
+
GIT_EXTERN(int) git_tag_create_frombuffer(
|
184
|
+
git_oid *oid,
|
185
|
+
git_repository *repo,
|
186
|
+
const char *buffer,
|
187
|
+
int force);
|
188
|
+
|
189
|
+
/**
|
190
|
+
* Create a new lightweight tag pointing at a target object
|
191
|
+
*
|
192
|
+
* A new direct reference will be created pointing to
|
193
|
+
* this target object. If `force` is true and a reference
|
194
|
+
* already exists with the given name, it'll be replaced.
|
195
|
+
*
|
196
|
+
* @param oid Pointer where to store the OID of the provided
|
197
|
+
* target object. If the tag already exists, this parameter
|
198
|
+
* will be filled with the oid of the existing pointed object
|
199
|
+
* and the function will return a GIT_EEXISTS error code.
|
200
|
+
*
|
201
|
+
* @param repo Repository where to store the lightweight tag
|
202
|
+
*
|
203
|
+
* @param tag_name Name for the tag; this name is validated
|
204
|
+
* for consistency. It should also not conflict with an
|
205
|
+
* already existing tag name
|
206
|
+
*
|
207
|
+
* @param target Object to which this tag points. This object
|
208
|
+
* must belong to the given `repo`.
|
209
|
+
*
|
210
|
+
* @param force Overwrite existing references
|
211
|
+
*
|
212
|
+
* @return GIT_SUCCESS or an error code
|
213
|
+
* A proper reference is written in the /refs/tags folder,
|
214
|
+
* pointing to the provided target object
|
215
|
+
*/
|
216
|
+
GIT_EXTERN(int) git_tag_create_lightweight(
|
217
|
+
git_oid *oid,
|
218
|
+
git_repository *repo,
|
219
|
+
const char *tag_name,
|
220
|
+
const git_object *target,
|
221
|
+
int force);
|
222
|
+
|
223
|
+
/**
|
224
|
+
* Delete an existing tag reference.
|
225
|
+
*
|
226
|
+
* @param repo Repository where lives the tag
|
227
|
+
*
|
228
|
+
* @param tag_name Name of the tag to be deleted;
|
229
|
+
* this name is validated for consistency.
|
230
|
+
*
|
231
|
+
* @return GIT_SUCCESS or an error code
|
232
|
+
*/
|
233
|
+
GIT_EXTERN(int) git_tag_delete(
|
234
|
+
git_repository *repo,
|
235
|
+
const char *tag_name);
|
236
|
+
|
237
|
+
/**
|
238
|
+
* Fill a list with all the tags in the Repository
|
239
|
+
*
|
240
|
+
* The string array will be filled with the names of the
|
241
|
+
* matching tags; these values are owned by the user and
|
242
|
+
* should be free'd manually when no longer needed, using
|
243
|
+
* `git_strarray_free`.
|
244
|
+
*
|
245
|
+
* @param tag_names Pointer to a git_strarray structure where
|
246
|
+
* the tag names will be stored
|
247
|
+
* @param repo Repository where to find the tags
|
248
|
+
* @return GIT_SUCCESS or an error code
|
249
|
+
*/
|
250
|
+
GIT_EXTERN(int) git_tag_list(
|
251
|
+
git_strarray *tag_names,
|
252
|
+
git_repository *repo);
|
253
|
+
|
254
|
+
/**
|
255
|
+
* Fill a list with all the tags in the Repository
|
256
|
+
* which name match a defined pattern
|
257
|
+
*
|
258
|
+
* If an empty pattern is provided, all the tags
|
259
|
+
* will be returned.
|
260
|
+
*
|
261
|
+
* The string array will be filled with the names of the
|
262
|
+
* matching tags; these values are owned by the user and
|
263
|
+
* should be free'd manually when no longer needed, using
|
264
|
+
* `git_strarray_free`.
|
265
|
+
*
|
266
|
+
* @param tag_names Pointer to a git_strarray structure where
|
267
|
+
* the tag names will be stored
|
268
|
+
* @param pattern Standard fnmatch pattern
|
269
|
+
* @param repo Repository where to find the tags
|
270
|
+
* @return GIT_SUCCESS or an error code
|
271
|
+
*/
|
272
|
+
GIT_EXTERN(int) git_tag_list_match(
|
273
|
+
git_strarray *tag_names,
|
274
|
+
const char *pattern,
|
275
|
+
git_repository *repo);
|
276
|
+
|
277
|
+
/** @} */
|
278
|
+
GIT_END_DECL
|
279
|
+
#endif
|
@@ -0,0 +1,48 @@
|
|
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_threads_h__
|
8
|
+
#define INCLUDE_git_threads_h__
|
9
|
+
|
10
|
+
#include "common.h"
|
11
|
+
|
12
|
+
/**
|
13
|
+
* @file git2/threads.h
|
14
|
+
* @brief Library level thread functions
|
15
|
+
* @defgroup git_thread Threading functions
|
16
|
+
* @ingroup Git
|
17
|
+
* @{
|
18
|
+
*/
|
19
|
+
GIT_BEGIN_DECL
|
20
|
+
|
21
|
+
/**
|
22
|
+
* Init the threading system.
|
23
|
+
*
|
24
|
+
* If libgit2 has been built with GIT_THREADS
|
25
|
+
* on, this function must be called once before
|
26
|
+
* any other library functions.
|
27
|
+
*
|
28
|
+
* If libgit2 has been built without GIT_THREADS
|
29
|
+
* support, this function is a no-op.
|
30
|
+
*/
|
31
|
+
GIT_EXTERN(void) git_threads_init(void);
|
32
|
+
|
33
|
+
/**
|
34
|
+
* Shutdown the threading system.
|
35
|
+
*
|
36
|
+
* If libgit2 has been built with GIT_THREADS
|
37
|
+
* on, this function must be called before shutting
|
38
|
+
* down the library.
|
39
|
+
*
|
40
|
+
* If libgit2 has been built without GIT_THREADS
|
41
|
+
* support, this function is a no-op.
|
42
|
+
*/
|
43
|
+
GIT_EXTERN(void) git_threads_shutdown(void);
|
44
|
+
|
45
|
+
/** @} */
|
46
|
+
GIT_END_DECL
|
47
|
+
#endif
|
48
|
+
|
@@ -0,0 +1,318 @@
|
|
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_tree_h__
|
8
|
+
#define INCLUDE_git_tree_h__
|
9
|
+
|
10
|
+
#include "common.h"
|
11
|
+
#include "types.h"
|
12
|
+
#include "oid.h"
|
13
|
+
#include "object.h"
|
14
|
+
|
15
|
+
/**
|
16
|
+
* @file git2/tree.h
|
17
|
+
* @brief Git tree parsing, loading routines
|
18
|
+
* @defgroup git_tree Git tree parsing, loading routines
|
19
|
+
* @ingroup Git
|
20
|
+
* @{
|
21
|
+
*/
|
22
|
+
GIT_BEGIN_DECL
|
23
|
+
|
24
|
+
/**
|
25
|
+
* Lookup a tree object from the repository.
|
26
|
+
*
|
27
|
+
* @param tree pointer to the looked up tree
|
28
|
+
* @param repo the repo to use when locating the tree.
|
29
|
+
* @param id identity of the tree to locate.
|
30
|
+
* @return GIT_SUCCESS or an error code
|
31
|
+
*/
|
32
|
+
GIT_INLINE(int) git_tree_lookup(git_tree **tree, git_repository *repo, const git_oid *id)
|
33
|
+
{
|
34
|
+
return git_object_lookup((git_object **)tree, repo, id, GIT_OBJ_TREE);
|
35
|
+
}
|
36
|
+
|
37
|
+
/**
|
38
|
+
* Lookup a tree object from the repository,
|
39
|
+
* given a prefix of its identifier (short id).
|
40
|
+
*
|
41
|
+
* @see git_object_lookup_prefix
|
42
|
+
*
|
43
|
+
* @param tree pointer to the looked up tree
|
44
|
+
* @param repo the repo to use when locating the tree.
|
45
|
+
* @param id identity of the tree to locate.
|
46
|
+
* @param len the length of the short identifier
|
47
|
+
* @return GIT_SUCCESS or an error code
|
48
|
+
*/
|
49
|
+
GIT_INLINE(int) git_tree_lookup_prefix(git_tree **tree, git_repository *repo, const git_oid *id, unsigned int len)
|
50
|
+
{
|
51
|
+
return git_object_lookup_prefix((git_object **)tree, repo, id, len, GIT_OBJ_TREE);
|
52
|
+
}
|
53
|
+
|
54
|
+
/**
|
55
|
+
* Close an open tree
|
56
|
+
*
|
57
|
+
* This is a wrapper around git_object_free()
|
58
|
+
*
|
59
|
+
* IMPORTANT:
|
60
|
+
* It *is* necessary to call this method when you stop
|
61
|
+
* using a tree. Failure to do so will cause a memory leak.
|
62
|
+
*
|
63
|
+
* @param tree the tree to close
|
64
|
+
*/
|
65
|
+
|
66
|
+
GIT_INLINE(void) git_tree_free(git_tree *tree)
|
67
|
+
{
|
68
|
+
git_object_free((git_object *) tree);
|
69
|
+
}
|
70
|
+
|
71
|
+
|
72
|
+
/**
|
73
|
+
* Get the id of a tree.
|
74
|
+
*
|
75
|
+
* @param tree a previously loaded tree.
|
76
|
+
* @return object identity for the tree.
|
77
|
+
*/
|
78
|
+
GIT_EXTERN(const git_oid *) git_tree_id(git_tree *tree);
|
79
|
+
|
80
|
+
/**
|
81
|
+
* Get the number of entries listed in a tree
|
82
|
+
*
|
83
|
+
* @param tree a previously loaded tree.
|
84
|
+
* @return the number of entries in the tree
|
85
|
+
*/
|
86
|
+
GIT_EXTERN(unsigned int) git_tree_entrycount(git_tree *tree);
|
87
|
+
|
88
|
+
/**
|
89
|
+
* Lookup a tree entry by its filename
|
90
|
+
*
|
91
|
+
* @param tree a previously loaded tree.
|
92
|
+
* @param filename the filename of the desired entry
|
93
|
+
* @return the tree entry; NULL if not found
|
94
|
+
*/
|
95
|
+
GIT_EXTERN(const git_tree_entry *) git_tree_entry_byname(git_tree *tree, const char *filename);
|
96
|
+
|
97
|
+
/**
|
98
|
+
* Lookup a tree entry by its position in the tree
|
99
|
+
*
|
100
|
+
* @param tree a previously loaded tree.
|
101
|
+
* @param idx the position in the entry list
|
102
|
+
* @return the tree entry; NULL if not found
|
103
|
+
*/
|
104
|
+
GIT_EXTERN(const git_tree_entry *) git_tree_entry_byindex(git_tree *tree, unsigned int idx);
|
105
|
+
|
106
|
+
/**
|
107
|
+
* Get the UNIX file attributes of a tree entry
|
108
|
+
*
|
109
|
+
* @param entry a tree entry
|
110
|
+
* @return attributes as an integer
|
111
|
+
*/
|
112
|
+
GIT_EXTERN(unsigned int) git_tree_entry_attributes(const git_tree_entry *entry);
|
113
|
+
|
114
|
+
/**
|
115
|
+
* Get the filename of a tree entry
|
116
|
+
*
|
117
|
+
* @param entry a tree entry
|
118
|
+
* @return the name of the file
|
119
|
+
*/
|
120
|
+
GIT_EXTERN(const char *) git_tree_entry_name(const git_tree_entry *entry);
|
121
|
+
|
122
|
+
/**
|
123
|
+
* Get the id of the object pointed by the entry
|
124
|
+
*
|
125
|
+
* @param entry a tree entry
|
126
|
+
* @return the oid of the object
|
127
|
+
*/
|
128
|
+
GIT_EXTERN(const git_oid *) git_tree_entry_id(const git_tree_entry *entry);
|
129
|
+
|
130
|
+
/**
|
131
|
+
* Get the type of the object pointed by the entry
|
132
|
+
*
|
133
|
+
* @param entry a tree entry
|
134
|
+
* @return the type of the pointed object
|
135
|
+
*/
|
136
|
+
GIT_EXTERN(git_otype) git_tree_entry_type(const git_tree_entry *entry);
|
137
|
+
|
138
|
+
/**
|
139
|
+
* Convert a tree entry to the git_object it points too.
|
140
|
+
*
|
141
|
+
* @param object pointer to the converted object
|
142
|
+
* @param repo repository where to lookup the pointed object
|
143
|
+
* @param entry a tree entry
|
144
|
+
* @return GIT_SUCCESS or an error code
|
145
|
+
*/
|
146
|
+
GIT_EXTERN(int) git_tree_entry_2object(git_object **object_out, git_repository *repo, const git_tree_entry *entry);
|
147
|
+
|
148
|
+
/**
|
149
|
+
* Write a tree to the ODB from the index file
|
150
|
+
*
|
151
|
+
* This method will scan the index and write a representation
|
152
|
+
* of its current state back to disk; it recursively creates
|
153
|
+
* tree objects for each of the subtrees stored in the index,
|
154
|
+
* but only returns the OID of the root tree. This is the OID
|
155
|
+
* that can be used e.g. to create a commit.
|
156
|
+
*
|
157
|
+
* The index instance cannot be bare, and needs to be associated
|
158
|
+
* to an existing repository.
|
159
|
+
*
|
160
|
+
* @param oid Pointer where to store the written tree
|
161
|
+
* @param index Index to write
|
162
|
+
* @return GIT_SUCCESS or an error code
|
163
|
+
*/
|
164
|
+
GIT_EXTERN(int) git_tree_create_fromindex(git_oid *oid, git_index *index);
|
165
|
+
|
166
|
+
/**
|
167
|
+
* Create a new tree builder.
|
168
|
+
*
|
169
|
+
* The tree builder can be used to create or modify
|
170
|
+
* trees in memory and write them as tree objects to the
|
171
|
+
* database.
|
172
|
+
*
|
173
|
+
* If the `source` parameter is not NULL, the tree builder
|
174
|
+
* will be initialized with the entries of the given tree.
|
175
|
+
*
|
176
|
+
* If the `source` parameter is NULL, the tree builder will
|
177
|
+
* have no entries and will have to be filled manually.
|
178
|
+
*
|
179
|
+
* @param builder_p Pointer where to store the tree builder
|
180
|
+
* @param source Source tree to initialize the builder (optional)
|
181
|
+
* @return 0 on sucess; error code otherwise
|
182
|
+
*/
|
183
|
+
GIT_EXTERN(int) git_treebuilder_create(git_treebuilder **builder_p, const git_tree *source);
|
184
|
+
|
185
|
+
/**
|
186
|
+
* Clear all the entires in the builder
|
187
|
+
*
|
188
|
+
* @param bld Builder to clear
|
189
|
+
*/
|
190
|
+
GIT_EXTERN(void) git_treebuilder_clear(git_treebuilder *bld);
|
191
|
+
|
192
|
+
/**
|
193
|
+
* Free a tree builder
|
194
|
+
*
|
195
|
+
* This will clear all the entries and free to builder.
|
196
|
+
* Failing to free the builder after you're done using it
|
197
|
+
* will result in a memory leak
|
198
|
+
*
|
199
|
+
* @param bld Builder to free
|
200
|
+
*/
|
201
|
+
GIT_EXTERN(void) git_treebuilder_free(git_treebuilder *bld);
|
202
|
+
|
203
|
+
/**
|
204
|
+
* Get an entry from the builder from its filename
|
205
|
+
*
|
206
|
+
* The returned entry is owned by the builder and should
|
207
|
+
* not be freed manually.
|
208
|
+
*
|
209
|
+
* @param bld Tree builder
|
210
|
+
* @param filename Name of the entry
|
211
|
+
* @return pointer to the entry; NULL if not found
|
212
|
+
*/
|
213
|
+
GIT_EXTERN(const git_tree_entry *) git_treebuilder_get(git_treebuilder *bld, const char *filename);
|
214
|
+
|
215
|
+
/**
|
216
|
+
* Add or update an entry to the builder
|
217
|
+
*
|
218
|
+
* Insert a new entry for `filename` in the builder with the
|
219
|
+
* given attributes.
|
220
|
+
*
|
221
|
+
* if an entry named `filename` already exists, its attributes
|
222
|
+
* will be updated with the given ones.
|
223
|
+
*
|
224
|
+
* The optional pointer `entry_out` can be used to retrieve a
|
225
|
+
* pointer to the newly created/updated entry.
|
226
|
+
*
|
227
|
+
* @param entry_out Pointer to store the entry (optional)
|
228
|
+
* @param bld Tree builder
|
229
|
+
* @param filename Filename of the entry
|
230
|
+
* @param id SHA1 oid of the entry
|
231
|
+
* @param attributes Folder attributes of the entry
|
232
|
+
* @return GIT_SUCCESS or an error code
|
233
|
+
*/
|
234
|
+
GIT_EXTERN(int) git_treebuilder_insert(git_tree_entry **entry_out, git_treebuilder *bld, const char *filename, const git_oid *id, unsigned int attributes);
|
235
|
+
|
236
|
+
/**
|
237
|
+
* Remove an entry from the builder by its filename
|
238
|
+
*
|
239
|
+
* @param bld Tree builder
|
240
|
+
* @param filename Filename of the entry to remove
|
241
|
+
*/
|
242
|
+
GIT_EXTERN(int) git_treebuilder_remove(git_treebuilder *bld, const char *filename);
|
243
|
+
|
244
|
+
/**
|
245
|
+
* Filter the entries in the tree
|
246
|
+
*
|
247
|
+
* The `filter` callback will be called for each entry
|
248
|
+
* in the tree with a pointer to the entry and the
|
249
|
+
* provided `payload`: if the callback returns 1, the
|
250
|
+
* entry will be filtered (removed from the builder).
|
251
|
+
*
|
252
|
+
* @param bld Tree builder
|
253
|
+
* @param filter Callback to filter entries
|
254
|
+
*/
|
255
|
+
GIT_EXTERN(void) git_treebuilder_filter(git_treebuilder *bld, int (*filter)(const git_tree_entry *, void *), void *payload);
|
256
|
+
|
257
|
+
/**
|
258
|
+
* Write the contents of the tree builder as a tree object
|
259
|
+
*
|
260
|
+
* The tree builder will be written to the given `repo`, and
|
261
|
+
* it's identifying SHA1 hash will be stored in the `oid`
|
262
|
+
* pointer.
|
263
|
+
*
|
264
|
+
* @param oid Pointer where to store the written OID
|
265
|
+
* @param repo Repository where to store the object
|
266
|
+
* @param bld Tree builder to write
|
267
|
+
* @return GIT_SUCCESS or an error code
|
268
|
+
*/
|
269
|
+
GIT_EXTERN(int) git_treebuilder_write(git_oid *oid, git_repository *repo, git_treebuilder *bld);
|
270
|
+
|
271
|
+
/**
|
272
|
+
* Retrieve a subtree contained in a tree, given its
|
273
|
+
* relative path.
|
274
|
+
*
|
275
|
+
* The returned tree is owned by the repository and
|
276
|
+
* should be closed with the `git_object_free` method.
|
277
|
+
*
|
278
|
+
* @param subtree Pointer where to store the subtree
|
279
|
+
* @param root A previously loaded tree which will be the root of the relative path
|
280
|
+
* @param subtree_path Path to the contained subtree
|
281
|
+
* @return GIT_SUCCESS on success; GIT_ENOTFOUND if the path does not lead to a
|
282
|
+
* subtree, GIT_EINVALIDPATH or an error code
|
283
|
+
*/
|
284
|
+
GIT_EXTERN(int) git_tree_get_subtree(git_tree **subtree, git_tree *root, const char *subtree_path);
|
285
|
+
|
286
|
+
/** Callback for the tree traversal method */
|
287
|
+
typedef int (*git_treewalk_cb)(const char *root, git_tree_entry *entry, void *payload);
|
288
|
+
|
289
|
+
/** Tree traversal modes */
|
290
|
+
enum git_treewalk_mode {
|
291
|
+
GIT_TREEWALK_PRE = 0, /* Pre-order */
|
292
|
+
GIT_TREEWALK_POST = 1, /* Post-order */
|
293
|
+
};
|
294
|
+
|
295
|
+
/**
|
296
|
+
* Traverse the entries in a tree and its subtrees in
|
297
|
+
* post or pre order
|
298
|
+
*
|
299
|
+
* The entries will be traversed in the specified order,
|
300
|
+
* children subtrees will be automatically loaded as required,
|
301
|
+
* and the `callback` will be called once per entry with
|
302
|
+
* the current (relative) root for the entry and the entry
|
303
|
+
* data itself.
|
304
|
+
*
|
305
|
+
* If the callback returns a negative value, the passed entry
|
306
|
+
* will be skiped on the traversal.
|
307
|
+
*
|
308
|
+
* @param tree The tree to walk
|
309
|
+
* @param callback Function to call on each tree entry
|
310
|
+
* @param mode Traversal mode (pre or post-order)
|
311
|
+
* @param payload Opaque pointer to be passed on each callback
|
312
|
+
* @return GIT_SUCCESS or an error code
|
313
|
+
*/
|
314
|
+
GIT_EXTERN(int) git_tree_walk(git_tree *tree, git_treewalk_cb callback, int mode, void *payload);
|
315
|
+
|
316
|
+
/** @} */
|
317
|
+
GIT_END_DECL
|
318
|
+
#endif
|