rugged 0.17.0.b7 → 0.18.0.b1
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +1 -1
- data/README.md +88 -32
- data/ext/rugged/extconf.rb +4 -2
- data/ext/rugged/rugged.c +72 -10
- data/ext/rugged/rugged.h +14 -10
- data/ext/rugged/rugged_blob.c +8 -10
- data/ext/rugged/rugged_branch.c +11 -14
- data/ext/rugged/rugged_commit.c +31 -24
- data/ext/rugged/rugged_config.c +2 -2
- data/ext/rugged/rugged_index.c +133 -198
- data/ext/rugged/rugged_note.c +372 -0
- data/ext/rugged/rugged_object.c +50 -22
- data/ext/rugged/rugged_reference.c +122 -130
- data/ext/rugged/rugged_remote.c +72 -29
- data/ext/rugged/rugged_repo.c +402 -20
- data/ext/rugged/rugged_revwalk.c +7 -3
- data/ext/rugged/rugged_settings.c +110 -0
- data/ext/rugged/rugged_signature.c +23 -7
- data/ext/rugged/rugged_tag.c +32 -16
- data/ext/rugged/rugged_tree.c +44 -15
- data/lib/rugged.rb +1 -0
- data/lib/rugged/index.rb +8 -0
- data/lib/rugged/remote.rb +13 -0
- data/lib/rugged/repository.rb +3 -3
- data/lib/rugged/version.rb +1 -1
- data/test/blob_test.rb +13 -15
- data/test/branch_test.rb +32 -67
- data/test/commit_test.rb +50 -12
- data/test/config_test.rb +12 -11
- data/test/coverage/HEAD.json +1 -1
- data/test/coverage/cover.rb +40 -21
- data/test/errors_test.rb +34 -0
- data/test/fixtures/alternate/objects/14/6ae76773c91e3b1d00cf7a338ec55ae58297e2 +0 -0
- data/test/fixtures/alternate/objects/14/9c32d47e99d0a3572ff1e70a2e0051bbf347a9 +0 -0
- data/test/fixtures/alternate/objects/14/fb3108588f9421bf764041e5e3ac305eb6277f +0 -0
- data/test/fixtures/testrepo.git/logs/refs/notes/commits +1 -0
- data/test/fixtures/testrepo.git/objects/44/1034f860c1d5d90e4188d11ae0d325176869a8 +1 -0
- data/test/fixtures/testrepo.git/objects/60/d415052a33de2150bf68757f6461df4f563ae4 +0 -0
- data/test/fixtures/testrepo.git/objects/68/8a8f4ef7496901d15322972f96e212a9e466cc +1 -0
- data/test/fixtures/testrepo.git/objects/94/eca2de348d5f672faf56b0decafa5937e3235e +0 -0
- data/test/fixtures/testrepo.git/objects/9b/7384fe1676186192842f5d3e129457b62db9e3 +0 -0
- data/test/fixtures/testrepo.git/objects/b7/4713326bc972cc15751ed504dca6f6f3b91f7a +3 -0
- data/test/fixtures/testrepo.git/refs/notes/commits +1 -0
- data/test/index_test.rb +65 -69
- data/test/lib_test.rb +76 -11
- data/test/note_test.rb +158 -0
- data/test/object_test.rb +8 -11
- data/test/reference_test.rb +77 -85
- data/test/remote_test.rb +86 -8
- data/test/repo_pack_test.rb +9 -7
- data/test/repo_reset_test.rb +80 -0
- data/test/repo_test.rb +176 -53
- data/test/tag_test.rb +44 -7
- data/test/test_helper.rb +63 -35
- data/test/tree_test.rb +34 -13
- data/test/walker_test.rb +14 -14
- data/vendor/libgit2/Makefile.embed +1 -1
- data/vendor/libgit2/deps/http-parser/http_parser.c +974 -578
- data/vendor/libgit2/deps/http-parser/http_parser.h +106 -70
- data/vendor/libgit2/deps/regex/regcomp.c +7 -6
- data/vendor/libgit2/deps/regex/regex_internal.c +1 -1
- data/vendor/libgit2/deps/regex/regex_internal.h +12 -3
- data/vendor/libgit2/deps/regex/regexec.c +5 -5
- data/vendor/libgit2/include/git2.h +5 -1
- data/vendor/libgit2/include/git2/attr.h +4 -2
- data/vendor/libgit2/include/git2/blob.h +39 -12
- data/vendor/libgit2/include/git2/branch.h +123 -35
- data/vendor/libgit2/include/git2/checkout.h +206 -48
- data/vendor/libgit2/include/git2/clone.h +72 -27
- data/vendor/libgit2/include/git2/commit.h +20 -17
- data/vendor/libgit2/include/git2/common.h +67 -1
- data/vendor/libgit2/include/git2/config.h +81 -60
- data/vendor/libgit2/include/git2/cred_helpers.h +53 -0
- data/vendor/libgit2/include/git2/diff.h +459 -150
- data/vendor/libgit2/include/git2/errors.h +9 -1
- data/vendor/libgit2/include/git2/graph.h +41 -0
- data/vendor/libgit2/include/git2/ignore.h +7 -6
- data/vendor/libgit2/include/git2/index.h +323 -97
- data/vendor/libgit2/include/git2/indexer.h +27 -59
- data/vendor/libgit2/include/git2/inttypes.h +4 -0
- data/vendor/libgit2/include/git2/merge.h +13 -3
- data/vendor/libgit2/include/git2/message.h +14 -8
- data/vendor/libgit2/include/git2/net.h +9 -7
- data/vendor/libgit2/include/git2/notes.h +88 -29
- data/vendor/libgit2/include/git2/object.h +16 -6
- data/vendor/libgit2/include/git2/odb.h +80 -17
- data/vendor/libgit2/include/git2/odb_backend.h +47 -11
- data/vendor/libgit2/include/git2/oid.h +26 -17
- data/vendor/libgit2/include/git2/pack.h +62 -8
- data/vendor/libgit2/include/git2/push.h +131 -0
- data/vendor/libgit2/include/git2/refdb.h +103 -0
- data/vendor/libgit2/include/git2/refdb_backend.h +109 -0
- data/vendor/libgit2/include/git2/reflog.h +30 -21
- data/vendor/libgit2/include/git2/refs.h +215 -193
- data/vendor/libgit2/include/git2/refspec.h +22 -2
- data/vendor/libgit2/include/git2/remote.h +158 -37
- data/vendor/libgit2/include/git2/repository.h +150 -31
- data/vendor/libgit2/include/git2/reset.h +43 -9
- data/vendor/libgit2/include/git2/revparse.h +48 -4
- data/vendor/libgit2/include/git2/revwalk.h +25 -10
- data/vendor/libgit2/include/git2/signature.h +20 -12
- data/vendor/libgit2/include/git2/stash.h +121 -0
- data/vendor/libgit2/include/git2/status.h +122 -53
- data/vendor/libgit2/include/git2/strarray.h +17 -11
- data/vendor/libgit2/include/git2/submodule.h +42 -7
- data/vendor/libgit2/include/git2/tag.h +72 -59
- data/vendor/libgit2/include/git2/threads.h +4 -2
- data/vendor/libgit2/include/git2/trace.h +68 -0
- data/vendor/libgit2/include/git2/transport.h +328 -0
- data/vendor/libgit2/include/git2/tree.h +149 -120
- data/vendor/libgit2/include/git2/types.h +13 -12
- data/vendor/libgit2/include/git2/version.h +3 -3
- data/vendor/libgit2/src/amiga/map.c +2 -2
- data/vendor/libgit2/src/attr.c +58 -48
- data/vendor/libgit2/src/attr.h +4 -18
- data/vendor/libgit2/src/attr_file.c +30 -6
- data/vendor/libgit2/src/attr_file.h +6 -8
- data/vendor/libgit2/src/attrcache.h +24 -0
- data/vendor/libgit2/src/blob.c +30 -7
- data/vendor/libgit2/src/blob.h +1 -1
- data/vendor/libgit2/src/branch.c +361 -68
- data/vendor/libgit2/src/branch.h +17 -0
- data/vendor/libgit2/src/bswap.h +1 -1
- data/vendor/libgit2/src/buf_text.c +291 -0
- data/vendor/libgit2/src/buf_text.h +122 -0
- data/vendor/libgit2/src/buffer.c +27 -101
- data/vendor/libgit2/src/buffer.h +54 -39
- data/vendor/libgit2/src/cache.c +15 -6
- data/vendor/libgit2/src/cache.h +1 -1
- data/vendor/libgit2/src/cc-compat.h +3 -1
- data/vendor/libgit2/src/checkout.c +1165 -222
- data/vendor/libgit2/src/checkout.h +24 -0
- data/vendor/libgit2/src/clone.c +171 -86
- data/vendor/libgit2/src/commit.c +44 -45
- data/vendor/libgit2/src/commit.h +3 -3
- data/vendor/libgit2/src/commit_list.c +194 -0
- data/vendor/libgit2/src/commit_list.h +49 -0
- data/vendor/libgit2/src/common.h +44 -10
- data/vendor/libgit2/src/compress.c +1 -1
- data/vendor/libgit2/src/compress.h +1 -1
- data/vendor/libgit2/src/config.c +211 -124
- data/vendor/libgit2/src/config.h +23 -4
- data/vendor/libgit2/src/config_cache.c +2 -2
- data/vendor/libgit2/src/config_file.c +129 -53
- data/vendor/libgit2/src/config_file.h +10 -8
- data/vendor/libgit2/src/crlf.c +66 -67
- data/vendor/libgit2/src/date.c +12 -12
- data/vendor/libgit2/src/delta-apply.c +14 -1
- data/vendor/libgit2/src/delta-apply.h +18 -1
- data/vendor/libgit2/src/delta.c +40 -107
- data/vendor/libgit2/src/delta.h +19 -17
- data/vendor/libgit2/src/diff.c +347 -496
- data/vendor/libgit2/src/diff.h +27 -1
- data/vendor/libgit2/src/diff_output.c +564 -249
- data/vendor/libgit2/src/diff_output.h +15 -8
- data/vendor/libgit2/src/diff_tform.c +687 -0
- data/vendor/libgit2/src/errors.c +27 -36
- data/vendor/libgit2/src/fetch.c +13 -351
- data/vendor/libgit2/src/fetch.h +13 -3
- data/vendor/libgit2/src/fetchhead.c +295 -0
- data/vendor/libgit2/src/fetchhead.h +34 -0
- data/vendor/libgit2/src/filebuf.c +42 -15
- data/vendor/libgit2/src/filebuf.h +4 -2
- data/vendor/libgit2/src/fileops.c +466 -113
- data/vendor/libgit2/src/fileops.h +154 -28
- data/vendor/libgit2/src/filter.c +3 -75
- data/vendor/libgit2/src/filter.h +1 -29
- data/vendor/libgit2/src/fnmatch.c +1 -1
- data/vendor/libgit2/src/fnmatch.h +1 -1
- data/vendor/libgit2/src/global.c +54 -10
- data/vendor/libgit2/src/global.h +10 -1
- data/vendor/libgit2/src/graph.c +178 -0
- data/vendor/libgit2/src/hash.c +25 -52
- data/vendor/libgit2/src/hash.h +21 -9
- data/vendor/libgit2/src/{sha1/sha1.c → hash/hash_generic.c} +20 -12
- data/vendor/libgit2/src/hash/hash_generic.h +24 -0
- data/vendor/libgit2/src/hash/hash_openssl.h +45 -0
- data/vendor/libgit2/src/hash/hash_win32.c +291 -0
- data/vendor/libgit2/src/hash/hash_win32.h +140 -0
- data/vendor/libgit2/src/hashsig.c +368 -0
- data/vendor/libgit2/src/hashsig.h +72 -0
- data/vendor/libgit2/src/ignore.c +22 -15
- data/vendor/libgit2/src/ignore.h +6 -1
- data/vendor/libgit2/src/index.c +770 -171
- data/vendor/libgit2/src/index.h +13 -5
- data/vendor/libgit2/src/indexer.c +286 -431
- data/vendor/libgit2/src/iterator.c +854 -466
- data/vendor/libgit2/src/iterator.h +134 -109
- data/vendor/libgit2/src/map.h +1 -1
- data/vendor/libgit2/src/merge.c +296 -0
- data/vendor/libgit2/src/merge.h +22 -0
- data/vendor/libgit2/src/message.c +1 -1
- data/vendor/libgit2/src/message.h +1 -1
- data/vendor/libgit2/src/mwindow.c +35 -30
- data/vendor/libgit2/src/mwindow.h +2 -2
- data/vendor/libgit2/src/netops.c +162 -98
- data/vendor/libgit2/src/netops.h +50 -15
- data/vendor/libgit2/src/notes.c +109 -58
- data/vendor/libgit2/src/notes.h +2 -1
- data/vendor/libgit2/src/object.c +46 -57
- data/vendor/libgit2/src/object.h +1 -8
- data/vendor/libgit2/src/odb.c +151 -40
- data/vendor/libgit2/src/odb.h +5 -1
- data/vendor/libgit2/src/odb_loose.c +4 -5
- data/vendor/libgit2/src/odb_pack.c +122 -80
- data/vendor/libgit2/src/offmap.h +65 -0
- data/vendor/libgit2/src/oid.c +12 -4
- data/vendor/libgit2/src/oidmap.h +1 -1
- data/vendor/libgit2/src/pack-objects.c +88 -61
- data/vendor/libgit2/src/pack-objects.h +8 -8
- data/vendor/libgit2/src/pack.c +293 -28
- data/vendor/libgit2/src/pack.h +49 -4
- data/vendor/libgit2/src/path.c +103 -14
- data/vendor/libgit2/src/path.h +23 -7
- data/vendor/libgit2/src/pathspec.c +168 -0
- data/vendor/libgit2/src/pathspec.h +40 -0
- data/vendor/libgit2/src/pool.c +29 -4
- data/vendor/libgit2/src/pool.h +8 -1
- data/vendor/libgit2/src/posix.c +26 -27
- data/vendor/libgit2/src/posix.h +2 -3
- data/vendor/libgit2/src/pqueue.c +23 -1
- data/vendor/libgit2/src/pqueue.h +23 -1
- data/vendor/libgit2/src/push.c +653 -0
- data/vendor/libgit2/src/push.h +51 -0
- data/vendor/libgit2/src/refdb.c +185 -0
- data/vendor/libgit2/src/refdb.h +46 -0
- data/vendor/libgit2/src/refdb_fs.c +1024 -0
- data/vendor/libgit2/src/refdb_fs.h +15 -0
- data/vendor/libgit2/src/reflog.c +77 -45
- data/vendor/libgit2/src/reflog.h +1 -3
- data/vendor/libgit2/src/refs.c +366 -1326
- data/vendor/libgit2/src/refs.h +22 -13
- data/vendor/libgit2/src/refspec.c +46 -7
- data/vendor/libgit2/src/refspec.h +11 -1
- data/vendor/libgit2/src/remote.c +758 -120
- data/vendor/libgit2/src/remote.h +10 -5
- data/vendor/libgit2/src/repo_template.h +6 -6
- data/vendor/libgit2/src/repository.c +315 -96
- data/vendor/libgit2/src/repository.h +5 -3
- data/vendor/libgit2/src/reset.c +99 -81
- data/vendor/libgit2/src/revparse.c +157 -84
- data/vendor/libgit2/src/revwalk.c +68 -470
- data/vendor/libgit2/src/revwalk.h +44 -0
- data/vendor/libgit2/src/sha1_lookup.c +1 -1
- data/vendor/libgit2/src/sha1_lookup.h +1 -1
- data/vendor/libgit2/src/signature.c +68 -200
- data/vendor/libgit2/src/signature.h +1 -1
- data/vendor/libgit2/src/stash.c +663 -0
- data/vendor/libgit2/src/status.c +101 -79
- data/vendor/libgit2/src/strmap.h +1 -1
- data/vendor/libgit2/src/submodule.c +67 -51
- data/vendor/libgit2/src/submodule.h +1 -1
- data/vendor/libgit2/src/tag.c +35 -29
- data/vendor/libgit2/src/tag.h +1 -1
- data/vendor/libgit2/src/thread-utils.c +1 -1
- data/vendor/libgit2/src/thread-utils.h +2 -2
- data/vendor/libgit2/src/trace.c +39 -0
- data/vendor/libgit2/src/trace.h +56 -0
- data/vendor/libgit2/src/transport.c +81 -34
- data/vendor/libgit2/src/transports/cred.c +60 -0
- data/vendor/libgit2/src/transports/cred_helpers.c +49 -0
- data/vendor/libgit2/src/transports/git.c +234 -127
- data/vendor/libgit2/src/transports/http.c +761 -433
- data/vendor/libgit2/src/transports/local.c +460 -64
- data/vendor/libgit2/src/transports/smart.c +345 -0
- data/vendor/libgit2/src/transports/smart.h +179 -0
- data/vendor/libgit2/src/{pkt.c → transports/smart_pkt.c} +131 -12
- data/vendor/libgit2/src/transports/smart_protocol.c +856 -0
- data/vendor/libgit2/src/transports/winhttp.c +1136 -0
- data/vendor/libgit2/src/tree-cache.c +2 -2
- data/vendor/libgit2/src/tree-cache.h +1 -1
- data/vendor/libgit2/src/tree.c +239 -166
- data/vendor/libgit2/src/tree.h +11 -2
- data/vendor/libgit2/src/tsort.c +39 -23
- data/vendor/libgit2/src/unix/map.c +1 -1
- data/vendor/libgit2/src/unix/posix.h +12 -2
- data/vendor/libgit2/src/unix/realpath.c +30 -0
- data/vendor/libgit2/src/util.c +250 -13
- data/vendor/libgit2/src/util.h +71 -14
- data/vendor/libgit2/src/vector.c +123 -60
- data/vendor/libgit2/src/vector.h +24 -22
- data/vendor/libgit2/src/win32/dir.c +1 -1
- data/vendor/libgit2/src/win32/dir.h +1 -1
- data/vendor/libgit2/src/win32/error.c +77 -0
- data/vendor/libgit2/src/win32/error.h +13 -0
- data/vendor/libgit2/src/win32/findfile.c +143 -54
- data/vendor/libgit2/src/win32/findfile.h +10 -6
- data/vendor/libgit2/src/win32/map.c +1 -1
- data/vendor/libgit2/src/win32/mingw-compat.h +1 -1
- data/vendor/libgit2/src/win32/msvc-compat.h +10 -1
- data/vendor/libgit2/src/win32/posix.h +10 -1
- data/vendor/libgit2/src/win32/posix_w32.c +132 -63
- data/vendor/libgit2/src/win32/precompiled.c +1 -1
- data/vendor/libgit2/src/win32/pthread.c +1 -1
- data/vendor/libgit2/src/win32/pthread.h +1 -1
- data/vendor/libgit2/src/win32/utf-conv.c +5 -5
- data/vendor/libgit2/src/win32/utf-conv.h +3 -3
- data/vendor/libgit2/src/win32/version.h +20 -0
- metadata +308 -252
- data/test/fixtures/testrepo.git/objects/4b/825dc642cb6eb9a060e54bf8d69288fbee4904 +0 -0
- data/test/fixtures/testrepo.git/objects/7f/043268ea43ce18e3540acaabf9e090c91965b0 +0 -0
- data/test/fixtures/testrepo.git/objects/a3/e05719b428a2d0ed7a55c4ce53dcc5768c6d5e +0 -0
- data/test/index_test.rb~ +0 -218
- data/vendor/libgit2/src/pkt.h +0 -91
- data/vendor/libgit2/src/ppc/sha1.c +0 -70
- data/vendor/libgit2/src/ppc/sha1.h +0 -26
- data/vendor/libgit2/src/protocol.c +0 -110
- data/vendor/libgit2/src/protocol.h +0 -21
- data/vendor/libgit2/src/sha1.h +0 -33
- data/vendor/libgit2/src/transport.h +0 -148
@@ -1,5 +1,5 @@
|
|
1
1
|
/*
|
2
|
-
* Copyright (C)
|
2
|
+
* Copyright (C) the libgit2 contributors. All rights reserved.
|
3
3
|
*
|
4
4
|
* This file is part of libgit2, distributed under the GNU GPL v2 with
|
5
5
|
* a Linking Exception. For full terms see the included COPYING file.
|
@@ -13,7 +13,33 @@
|
|
13
13
|
/**
|
14
14
|
* @file git2/pack.h
|
15
15
|
* @brief Git pack management routines
|
16
|
-
*
|
16
|
+
*
|
17
|
+
* Packing objects
|
18
|
+
* ---------------
|
19
|
+
*
|
20
|
+
* Creation of packfiles requires two steps:
|
21
|
+
*
|
22
|
+
* - First, insert all the objects you want to put into the packfile
|
23
|
+
* using `git_packbuilder_insert` and `git_packbuilder_insert_tree`.
|
24
|
+
* It's important to add the objects in recency order ("in the order
|
25
|
+
* that they are 'reachable' from head").
|
26
|
+
*
|
27
|
+
* "ANY order will give you a working pack, ... [but it is] the thing
|
28
|
+
* that gives packs good locality. It keeps the objects close to the
|
29
|
+
* head (whether they are old or new, but they are _reachable_ from the
|
30
|
+
* head) at the head of the pack. So packs actually have absolutely
|
31
|
+
* _wonderful_ IO patterns." - Linus Torvalds
|
32
|
+
* git.git/Documentation/technical/pack-heuristics.txt
|
33
|
+
*
|
34
|
+
* - Second, use `git_packbuilder_write` or `git_packbuilder_foreach` to
|
35
|
+
* write the resulting packfile.
|
36
|
+
*
|
37
|
+
* libgit2 will take care of the delta ordering and generation.
|
38
|
+
* `git_packbuilder_set_threads` can be used to adjust the number of
|
39
|
+
* threads used for the process.
|
40
|
+
*
|
41
|
+
* See tests-clar/pack/packbuilder.c for an example.
|
42
|
+
*
|
17
43
|
* @ingroup Git
|
18
44
|
* @{
|
19
45
|
*/
|
@@ -38,8 +64,9 @@ GIT_EXTERN(int) git_packbuilder_new(git_packbuilder **out, git_repository *repo)
|
|
38
64
|
*
|
39
65
|
* @param pb The packbuilder
|
40
66
|
* @param n Number of threads to spawn
|
67
|
+
* @return number of actual threads to be used
|
41
68
|
*/
|
42
|
-
GIT_EXTERN(
|
69
|
+
GIT_EXTERN(unsigned int) git_packbuilder_set_threads(git_packbuilder *pb, unsigned int n);
|
43
70
|
|
44
71
|
/**
|
45
72
|
* Insert a single object
|
@@ -48,12 +75,12 @@ GIT_EXTERN(void) git_packbuilder_set_threads(git_packbuilder *pb, unsigned int n
|
|
48
75
|
* commits followed by trees and blobs.
|
49
76
|
*
|
50
77
|
* @param pb The packbuilder
|
51
|
-
* @param
|
52
|
-
* @param
|
78
|
+
* @param id The oid of the commit
|
79
|
+
* @param name The name; might be NULL
|
53
80
|
*
|
54
81
|
* @return 0 or an error code
|
55
82
|
*/
|
56
|
-
GIT_EXTERN(int) git_packbuilder_insert(git_packbuilder *pb, const git_oid *
|
83
|
+
GIT_EXTERN(int) git_packbuilder_insert(git_packbuilder *pb, const git_oid *id, const char *name);
|
57
84
|
|
58
85
|
/**
|
59
86
|
* Insert a root tree object
|
@@ -61,11 +88,11 @@ GIT_EXTERN(int) git_packbuilder_insert(git_packbuilder *pb, const git_oid *oid,
|
|
61
88
|
* This will add the tree as well as all referenced trees and blobs.
|
62
89
|
*
|
63
90
|
* @param pb The packbuilder
|
64
|
-
* @param
|
91
|
+
* @param id The oid of the root tree
|
65
92
|
*
|
66
93
|
* @return 0 or an error code
|
67
94
|
*/
|
68
|
-
GIT_EXTERN(int) git_packbuilder_insert_tree(git_packbuilder *pb, const git_oid *
|
95
|
+
GIT_EXTERN(int) git_packbuilder_insert_tree(git_packbuilder *pb, const git_oid *id);
|
69
96
|
|
70
97
|
/**
|
71
98
|
* Write the new pack and the corresponding index to path
|
@@ -77,6 +104,33 @@ GIT_EXTERN(int) git_packbuilder_insert_tree(git_packbuilder *pb, const git_oid *
|
|
77
104
|
*/
|
78
105
|
GIT_EXTERN(int) git_packbuilder_write(git_packbuilder *pb, const char *file);
|
79
106
|
|
107
|
+
typedef int (*git_packbuilder_foreach_cb)(void *buf, size_t size, void *payload);
|
108
|
+
/**
|
109
|
+
* Create the new pack and pass each object to the callback
|
110
|
+
*
|
111
|
+
* @param pb the packbuilder
|
112
|
+
* @param cb the callback to call with each packed object's buffer
|
113
|
+
* @param payload the callback's data
|
114
|
+
* @return 0 or an error code
|
115
|
+
*/
|
116
|
+
GIT_EXTERN(int) git_packbuilder_foreach(git_packbuilder *pb, git_packbuilder_foreach_cb cb, void *payload);
|
117
|
+
|
118
|
+
/**
|
119
|
+
* Get the total number of objects the packbuilder will write out
|
120
|
+
*
|
121
|
+
* @param pb the packbuilder
|
122
|
+
* @return
|
123
|
+
*/
|
124
|
+
GIT_EXTERN(uint32_t) git_packbuilder_object_count(git_packbuilder *pb);
|
125
|
+
|
126
|
+
/**
|
127
|
+
* Get the number of objects the packbuilder has already written out
|
128
|
+
*
|
129
|
+
* @param pb the packbuilder
|
130
|
+
* @return
|
131
|
+
*/
|
132
|
+
GIT_EXTERN(uint32_t) git_packbuilder_written(git_packbuilder *pb);
|
133
|
+
|
80
134
|
/**
|
81
135
|
* Free the packbuilder and all associated data
|
82
136
|
*
|
@@ -0,0 +1,131 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright (C) the libgit2 contributors. All rights reserved.
|
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_push_h__
|
8
|
+
#define INCLUDE_git_push_h__
|
9
|
+
|
10
|
+
#include "common.h"
|
11
|
+
|
12
|
+
/**
|
13
|
+
* @file git2/push.h
|
14
|
+
* @brief Git push management functions
|
15
|
+
* @defgroup git_push push management functions
|
16
|
+
* @ingroup Git
|
17
|
+
* @{
|
18
|
+
*/
|
19
|
+
GIT_BEGIN_DECL
|
20
|
+
|
21
|
+
/**
|
22
|
+
* Controls the behavior of a git_push object.
|
23
|
+
*/
|
24
|
+
typedef struct {
|
25
|
+
unsigned int version;
|
26
|
+
|
27
|
+
/**
|
28
|
+
* If the transport being used to push to the remote requires the creation
|
29
|
+
* of a pack file, this controls the number of worker threads used by
|
30
|
+
* the packbuilder when creating that pack file to be sent to the remote.
|
31
|
+
*
|
32
|
+
* If set to 0, the packbuilder will auto-detect the number of threads
|
33
|
+
* to create. The default value is 1.
|
34
|
+
*/
|
35
|
+
unsigned int pb_parallelism;
|
36
|
+
} git_push_options;
|
37
|
+
|
38
|
+
#define GIT_PUSH_OPTIONS_VERSION 1
|
39
|
+
#define GIT_PUSH_OPTIONS_INIT { GIT_PUSH_OPTIONS_VERSION }
|
40
|
+
|
41
|
+
/**
|
42
|
+
* Create a new push object
|
43
|
+
*
|
44
|
+
* @param out New push object
|
45
|
+
* @param remote Remote instance
|
46
|
+
*
|
47
|
+
* @return 0 or an error code
|
48
|
+
*/
|
49
|
+
GIT_EXTERN(int) git_push_new(git_push **out, git_remote *remote);
|
50
|
+
|
51
|
+
/**
|
52
|
+
* Set options on a push object
|
53
|
+
*
|
54
|
+
* @param push The push object
|
55
|
+
* @param opts The options to set on the push object
|
56
|
+
*
|
57
|
+
* @return 0 or an error code
|
58
|
+
*/
|
59
|
+
GIT_EXTERN(int) git_push_set_options(
|
60
|
+
git_push *push,
|
61
|
+
const git_push_options *opts);
|
62
|
+
|
63
|
+
/**
|
64
|
+
* Add a refspec to be pushed
|
65
|
+
*
|
66
|
+
* @param push The push object
|
67
|
+
* @param refspec Refspec string
|
68
|
+
*
|
69
|
+
* @return 0 or an error code
|
70
|
+
*/
|
71
|
+
GIT_EXTERN(int) git_push_add_refspec(git_push *push, const char *refspec);
|
72
|
+
|
73
|
+
/**
|
74
|
+
* Update remote tips after a push
|
75
|
+
*
|
76
|
+
* @param push The push object
|
77
|
+
*
|
78
|
+
* @return 0 or an error code
|
79
|
+
*/
|
80
|
+
GIT_EXTERN(int) git_push_update_tips(git_push *push);
|
81
|
+
|
82
|
+
/**
|
83
|
+
* Actually push all given refspecs
|
84
|
+
*
|
85
|
+
* Note: To check if the push was successful (i.e. all remote references
|
86
|
+
* have been updated as requested), you need to call both
|
87
|
+
* `git_push_unpack_ok` and `git_push_status_foreach`. The remote
|
88
|
+
* repository might have refused to update some or all of the references.
|
89
|
+
*
|
90
|
+
* @param push The push object
|
91
|
+
*
|
92
|
+
* @return 0 or an error code
|
93
|
+
*/
|
94
|
+
GIT_EXTERN(int) git_push_finish(git_push *push);
|
95
|
+
|
96
|
+
/**
|
97
|
+
* Check if remote side successfully unpacked
|
98
|
+
*
|
99
|
+
* @param push The push object
|
100
|
+
*
|
101
|
+
* @return true if equal, false otherwise
|
102
|
+
*/
|
103
|
+
GIT_EXTERN(int) git_push_unpack_ok(git_push *push);
|
104
|
+
|
105
|
+
/**
|
106
|
+
* Call callback `cb' on each status
|
107
|
+
*
|
108
|
+
* For each of the updated references, we receive a status report in the
|
109
|
+
* form of `ok refs/heads/master` or `ng refs/heads/master <msg>`.
|
110
|
+
* `msg != NULL` means the reference has not been updated for the given
|
111
|
+
* reason.
|
112
|
+
*
|
113
|
+
* @param push The push object
|
114
|
+
* @param cb The callback to call on each object
|
115
|
+
*
|
116
|
+
* @return 0 on success, GIT_EUSER on non-zero callback, or error code
|
117
|
+
*/
|
118
|
+
GIT_EXTERN(int) git_push_status_foreach(git_push *push,
|
119
|
+
int (*cb)(const char *ref, const char *msg, void *data),
|
120
|
+
void *data);
|
121
|
+
|
122
|
+
/**
|
123
|
+
* Free the given push object
|
124
|
+
*
|
125
|
+
* @param push The push object
|
126
|
+
*/
|
127
|
+
GIT_EXTERN(void) git_push_free(git_push *push);
|
128
|
+
|
129
|
+
/** @} */
|
130
|
+
GIT_END_DECL
|
131
|
+
#endif
|
@@ -0,0 +1,103 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright (C) the libgit2 contributors. All rights reserved.
|
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_refdb_h__
|
8
|
+
#define INCLUDE_git_refdb_h__
|
9
|
+
|
10
|
+
#include "common.h"
|
11
|
+
#include "types.h"
|
12
|
+
#include "oid.h"
|
13
|
+
#include "refs.h"
|
14
|
+
|
15
|
+
/**
|
16
|
+
* @file git2/refdb.h
|
17
|
+
* @brief Git custom refs backend functions
|
18
|
+
* @defgroup git_refdb Git custom refs backend API
|
19
|
+
* @ingroup Git
|
20
|
+
* @{
|
21
|
+
*/
|
22
|
+
GIT_BEGIN_DECL
|
23
|
+
|
24
|
+
/**
|
25
|
+
* Create a new reference. Either an oid or a symbolic target must be
|
26
|
+
* specified.
|
27
|
+
*
|
28
|
+
* @param refdb the reference database to associate with this reference
|
29
|
+
* @param name the reference name
|
30
|
+
* @param oid the object id for a direct reference
|
31
|
+
* @param symbolic the target for a symbolic reference
|
32
|
+
* @return the created git_reference or NULL on error
|
33
|
+
*/
|
34
|
+
GIT_EXTERN(git_reference *) git_reference__alloc(
|
35
|
+
git_refdb *refdb,
|
36
|
+
const char *name,
|
37
|
+
const git_oid *oid,
|
38
|
+
const git_oid *peel);
|
39
|
+
|
40
|
+
GIT_EXTERN(git_reference *) git_reference__alloc_symbolic(
|
41
|
+
git_refdb *refdb,
|
42
|
+
const char *name,
|
43
|
+
const char *target);
|
44
|
+
|
45
|
+
/**
|
46
|
+
* Create a new reference database with no backends.
|
47
|
+
*
|
48
|
+
* Before the Ref DB can be used for read/writing, a custom database
|
49
|
+
* backend must be manually set using `git_refdb_set_backend()`
|
50
|
+
*
|
51
|
+
* @param out location to store the database pointer, if opened.
|
52
|
+
* Set to NULL if the open failed.
|
53
|
+
* @param repo the repository
|
54
|
+
* @return 0 or an error code
|
55
|
+
*/
|
56
|
+
GIT_EXTERN(int) git_refdb_new(git_refdb **out, git_repository *repo);
|
57
|
+
|
58
|
+
/**
|
59
|
+
* Create a new reference database and automatically add
|
60
|
+
* the default backends:
|
61
|
+
*
|
62
|
+
* - git_refdb_dir: read and write loose and packed refs
|
63
|
+
* from disk, assuming the repository dir as the folder
|
64
|
+
*
|
65
|
+
* @param out location to store the database pointer, if opened.
|
66
|
+
* Set to NULL if the open failed.
|
67
|
+
* @param repo the repository
|
68
|
+
* @return 0 or an error code
|
69
|
+
*/
|
70
|
+
GIT_EXTERN(int) git_refdb_open(git_refdb **out, git_repository *repo);
|
71
|
+
|
72
|
+
/**
|
73
|
+
* Suggests that the given refdb compress or optimize its references.
|
74
|
+
* This mechanism is implementation specific. For on-disk reference
|
75
|
+
* databases, for example, this may pack all loose references.
|
76
|
+
*/
|
77
|
+
GIT_EXTERN(int) git_refdb_compress(git_refdb *refdb);
|
78
|
+
|
79
|
+
/**
|
80
|
+
* Close an open reference database.
|
81
|
+
*
|
82
|
+
* @param refdb reference database pointer or NULL
|
83
|
+
*/
|
84
|
+
GIT_EXTERN(void) git_refdb_free(git_refdb *refdb);
|
85
|
+
|
86
|
+
/**
|
87
|
+
* Sets the custom backend to an existing reference DB
|
88
|
+
*
|
89
|
+
* Read <refdb_backends.h> for more information.
|
90
|
+
*
|
91
|
+
* @param refdb database to add the backend to
|
92
|
+
* @param backend pointer to a git_refdb_backend instance
|
93
|
+
* @param priority Value for ordering the backends queue
|
94
|
+
* @return 0 on success; error code otherwise
|
95
|
+
*/
|
96
|
+
GIT_EXTERN(int) git_refdb_set_backend(
|
97
|
+
git_refdb *refdb,
|
98
|
+
git_refdb_backend *backend);
|
99
|
+
|
100
|
+
/** @} */
|
101
|
+
GIT_END_DECL
|
102
|
+
|
103
|
+
#endif
|
@@ -0,0 +1,109 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright (C) the libgit2 contributors. All rights reserved.
|
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_refdb_backend_h__
|
8
|
+
#define INCLUDE_git_refdb_backend_h__
|
9
|
+
|
10
|
+
#include "common.h"
|
11
|
+
#include "types.h"
|
12
|
+
#include "oid.h"
|
13
|
+
|
14
|
+
/**
|
15
|
+
* @file git2/refdb_backend.h
|
16
|
+
* @brief Git custom refs backend functions
|
17
|
+
* @defgroup git_refdb_backend Git custom refs backend API
|
18
|
+
* @ingroup Git
|
19
|
+
* @{
|
20
|
+
*/
|
21
|
+
GIT_BEGIN_DECL
|
22
|
+
|
23
|
+
/** An instance for a custom backend */
|
24
|
+
struct git_refdb_backend {
|
25
|
+
unsigned int version;
|
26
|
+
|
27
|
+
/**
|
28
|
+
* Queries the refdb backend to determine if the given ref_name
|
29
|
+
* exists. A refdb implementation must provide this function.
|
30
|
+
*/
|
31
|
+
int (*exists)(
|
32
|
+
int *exists,
|
33
|
+
struct git_refdb_backend *backend,
|
34
|
+
const char *ref_name);
|
35
|
+
|
36
|
+
/**
|
37
|
+
* Queries the refdb backend for a given reference. A refdb
|
38
|
+
* implementation must provide this function.
|
39
|
+
*/
|
40
|
+
int (*lookup)(
|
41
|
+
git_reference **out,
|
42
|
+
struct git_refdb_backend *backend,
|
43
|
+
const char *ref_name);
|
44
|
+
|
45
|
+
/**
|
46
|
+
* Enumerates each reference in the refdb. A refdb implementation must
|
47
|
+
* provide this function.
|
48
|
+
*/
|
49
|
+
int (*foreach)(
|
50
|
+
struct git_refdb_backend *backend,
|
51
|
+
unsigned int list_flags,
|
52
|
+
git_reference_foreach_cb callback,
|
53
|
+
void *payload);
|
54
|
+
|
55
|
+
/**
|
56
|
+
* Enumerates each reference in the refdb that matches the given
|
57
|
+
* glob string. A refdb implementation may provide this function;
|
58
|
+
* if it is not provided, foreach will be used and the results filtered
|
59
|
+
* against the glob.
|
60
|
+
*/
|
61
|
+
int (*foreach_glob)(
|
62
|
+
struct git_refdb_backend *backend,
|
63
|
+
const char *glob,
|
64
|
+
unsigned int list_flags,
|
65
|
+
git_reference_foreach_cb callback,
|
66
|
+
void *payload);
|
67
|
+
|
68
|
+
/**
|
69
|
+
* Writes the given reference to the refdb. A refdb implementation
|
70
|
+
* must provide this function.
|
71
|
+
*/
|
72
|
+
int (*write)(struct git_refdb_backend *backend, const git_reference *ref);
|
73
|
+
|
74
|
+
/**
|
75
|
+
* Deletes the given reference from the refdb. A refdb implementation
|
76
|
+
* must provide this function.
|
77
|
+
*/
|
78
|
+
int (*delete)(struct git_refdb_backend *backend, const git_reference *ref);
|
79
|
+
|
80
|
+
/**
|
81
|
+
* Suggests that the given refdb compress or optimize its references.
|
82
|
+
* This mechanism is implementation specific. (For on-disk reference
|
83
|
+
* databases, this may pack all loose references.) A refdb
|
84
|
+
* implementation may provide this function; if it is not provided,
|
85
|
+
* nothing will be done.
|
86
|
+
*/
|
87
|
+
int (*compress)(struct git_refdb_backend *backend);
|
88
|
+
|
89
|
+
/**
|
90
|
+
* Frees any resources held by the refdb. A refdb implementation may
|
91
|
+
* provide this function; if it is not provided, nothing will be done.
|
92
|
+
*/
|
93
|
+
void (*free)(struct git_refdb_backend *backend);
|
94
|
+
};
|
95
|
+
|
96
|
+
#define GIT_ODB_BACKEND_VERSION 1
|
97
|
+
#define GIT_ODB_BACKEND_INIT {GIT_ODB_BACKEND_VERSION}
|
98
|
+
|
99
|
+
/**
|
100
|
+
* Constructors for default refdb backends.
|
101
|
+
*/
|
102
|
+
GIT_EXTERN(int) git_refdb_backend_fs(
|
103
|
+
struct git_refdb_backend **backend_out,
|
104
|
+
git_repository *repo,
|
105
|
+
git_refdb *refdb);
|
106
|
+
|
107
|
+
GIT_END_DECL
|
108
|
+
|
109
|
+
#endif
|