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.
|
@@ -11,6 +11,7 @@
|
|
11
11
|
#include "types.h"
|
12
12
|
#include "indexer.h"
|
13
13
|
#include "checkout.h"
|
14
|
+
#include "remote.h"
|
14
15
|
|
15
16
|
|
16
17
|
/**
|
@@ -23,39 +24,83 @@
|
|
23
24
|
GIT_BEGIN_DECL
|
24
25
|
|
25
26
|
/**
|
26
|
-
* Clone
|
27
|
-
* HEAD.
|
27
|
+
* Clone options structure
|
28
28
|
*
|
29
|
-
*
|
30
|
-
*
|
31
|
-
*
|
32
|
-
*
|
33
|
-
*
|
34
|
-
*
|
35
|
-
*
|
36
|
-
*
|
37
|
-
*
|
29
|
+
* Use zeros to indicate default settings. It's easiest to use the
|
30
|
+
* `GIT_CLONE_OPTIONS_INIT` macro:
|
31
|
+
*
|
32
|
+
* git_clone_options opts = GIT_CLONE_OPTIONS_INIT;
|
33
|
+
*
|
34
|
+
* - `checkout_opts` is options for the checkout step. To disable checkout,
|
35
|
+
* set the `checkout_strategy` to GIT_CHECKOUT_DEFAULT.
|
36
|
+
* - `bare` should be set to zero to create a standard repo, non-zero for
|
37
|
+
* a bare repo
|
38
|
+
* - `fetch_progress_cb` is optional callback for fetch progress. Be aware that
|
39
|
+
* this is called inline with network and indexing operations, so performance
|
40
|
+
* may be affected.
|
41
|
+
* - `fetch_progress_payload` is payload for fetch_progress_cb
|
42
|
+
*
|
43
|
+
* ** "origin" remote options: **
|
44
|
+
* - `remote_name` is the name given to the "origin" remote. The default is
|
45
|
+
* "origin".
|
46
|
+
* - `pushurl` is a URL to be used for pushing. NULL means use the fetch url.
|
47
|
+
* - `fetch_spec` is the fetch specification to be used for fetching. NULL
|
48
|
+
* results in the same behavior as GIT_REMOTE_DEFAULT_FETCH.
|
49
|
+
* - `push_spec` is the fetch specification to be used for pushing. NULL means
|
50
|
+
* use the same spec as for fetching.
|
51
|
+
* - `cred_acquire_cb` is a callback to be used if credentials are required
|
52
|
+
* during the initial fetch.
|
53
|
+
* - `cred_acquire_payload` is the payload for the above callback.
|
54
|
+
* - `transport` is a custom transport to be used for the initial fetch. NULL
|
55
|
+
* means use the transport autodetected from the URL.
|
56
|
+
* - `remote_callbacks` may be used to specify custom progress callbacks for
|
57
|
+
* the origin remote before the fetch is initiated.
|
58
|
+
* - `remote_autotag` may be used to specify the autotag setting before the
|
59
|
+
* initial fetch. The default is GIT_REMOTE_DOWNLOAD_TAGS_ALL.
|
60
|
+
* - `checkout_branch` gives the name of the branch to checkout. NULL means
|
61
|
+
* use the remote's HEAD.
|
38
62
|
*/
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
63
|
+
|
64
|
+
typedef struct git_clone_options {
|
65
|
+
unsigned int version;
|
66
|
+
|
67
|
+
git_checkout_opts checkout_opts;
|
68
|
+
int bare;
|
69
|
+
git_transfer_progress_callback fetch_progress_cb;
|
70
|
+
void *fetch_progress_payload;
|
71
|
+
|
72
|
+
const char *remote_name;
|
73
|
+
const char *pushurl;
|
74
|
+
const char *fetch_spec;
|
75
|
+
const char *push_spec;
|
76
|
+
git_cred_acquire_cb cred_acquire_cb;
|
77
|
+
void *cred_acquire_payload;
|
78
|
+
git_transport *transport;
|
79
|
+
git_remote_callbacks *remote_callbacks;
|
80
|
+
git_remote_autotag_option_t remote_autotag;
|
81
|
+
const char* checkout_branch;
|
82
|
+
} git_clone_options;
|
83
|
+
|
84
|
+
#define GIT_CLONE_OPTIONS_VERSION 1
|
85
|
+
#define GIT_CLONE_OPTIONS_INIT {GIT_CLONE_OPTIONS_VERSION, {GIT_CHECKOUT_OPTS_VERSION, GIT_CHECKOUT_SAFE_CREATE}}
|
45
86
|
|
46
87
|
/**
|
47
|
-
*
|
88
|
+
* Clone a remote repository, and checkout the branch pointed to by the remote
|
89
|
+
* HEAD.
|
48
90
|
*
|
49
91
|
* @param out pointer that will receive the resulting repository object
|
50
|
-
* @param
|
51
|
-
* @param
|
52
|
-
* @param
|
53
|
-
*
|
92
|
+
* @param url the remote repository to clone
|
93
|
+
* @param local_path local directory to clone to
|
94
|
+
* @param options configuration options for the clone. If NULL, the function
|
95
|
+
* works as though GIT_OPTIONS_INIT were passed.
|
96
|
+
* @return 0 on success, GIT_ERROR otherwise (use giterr_last for information
|
97
|
+
* about the error)
|
54
98
|
*/
|
55
|
-
GIT_EXTERN(int)
|
56
|
-
|
57
|
-
|
58
|
-
|
99
|
+
GIT_EXTERN(int) git_clone(
|
100
|
+
git_repository **out,
|
101
|
+
const char *url,
|
102
|
+
const char *local_path,
|
103
|
+
const git_clone_options *options);
|
59
104
|
|
60
105
|
/** @} */
|
61
106
|
GIT_END_DECL
|
@@ -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.
|
@@ -76,7 +76,10 @@ GIT_INLINE(void) git_commit_free(git_commit *commit)
|
|
76
76
|
* @param commit a previously loaded commit.
|
77
77
|
* @return object identity for the commit.
|
78
78
|
*/
|
79
|
-
|
79
|
+
GIT_INLINE(const git_oid *) git_commit_id(const git_commit *commit)
|
80
|
+
{
|
81
|
+
return git_object_id((const git_object *)commit);
|
82
|
+
}
|
80
83
|
|
81
84
|
/**
|
82
85
|
* Get the encoding for the message of a commit,
|
@@ -88,7 +91,7 @@ GIT_EXTERN(const git_oid *) git_commit_id(git_commit *commit);
|
|
88
91
|
* @param commit a previously loaded commit.
|
89
92
|
* @return NULL, or the encoding
|
90
93
|
*/
|
91
|
-
GIT_EXTERN(const char *) git_commit_message_encoding(git_commit *commit);
|
94
|
+
GIT_EXTERN(const char *) git_commit_message_encoding(const git_commit *commit);
|
92
95
|
|
93
96
|
/**
|
94
97
|
* Get the full message of a commit.
|
@@ -96,7 +99,7 @@ GIT_EXTERN(const char *) git_commit_message_encoding(git_commit *commit);
|
|
96
99
|
* @param commit a previously loaded commit.
|
97
100
|
* @return the message of a commit
|
98
101
|
*/
|
99
|
-
GIT_EXTERN(const char *) git_commit_message(git_commit *commit);
|
102
|
+
GIT_EXTERN(const char *) git_commit_message(const git_commit *commit);
|
100
103
|
|
101
104
|
/**
|
102
105
|
* Get the commit time (i.e. committer time) of a commit.
|
@@ -104,7 +107,7 @@ GIT_EXTERN(const char *) git_commit_message(git_commit *commit);
|
|
104
107
|
* @param commit a previously loaded commit.
|
105
108
|
* @return the time of a commit
|
106
109
|
*/
|
107
|
-
GIT_EXTERN(git_time_t) git_commit_time(git_commit *commit);
|
110
|
+
GIT_EXTERN(git_time_t) git_commit_time(const git_commit *commit);
|
108
111
|
|
109
112
|
/**
|
110
113
|
* Get the commit timezone offset (i.e. committer's preferred timezone) of a commit.
|
@@ -112,7 +115,7 @@ GIT_EXTERN(git_time_t) git_commit_time(git_commit *commit);
|
|
112
115
|
* @param commit a previously loaded commit.
|
113
116
|
* @return positive or negative timezone offset, in minutes from UTC
|
114
117
|
*/
|
115
|
-
GIT_EXTERN(int) git_commit_time_offset(git_commit *commit);
|
118
|
+
GIT_EXTERN(int) git_commit_time_offset(const git_commit *commit);
|
116
119
|
|
117
120
|
/**
|
118
121
|
* Get the committer of a commit.
|
@@ -120,7 +123,7 @@ GIT_EXTERN(int) git_commit_time_offset(git_commit *commit);
|
|
120
123
|
* @param commit a previously loaded commit.
|
121
124
|
* @return the committer of a commit
|
122
125
|
*/
|
123
|
-
GIT_EXTERN(const git_signature *) git_commit_committer(git_commit *commit);
|
126
|
+
GIT_EXTERN(const git_signature *) git_commit_committer(const git_commit *commit);
|
124
127
|
|
125
128
|
/**
|
126
129
|
* Get the author of a commit.
|
@@ -128,7 +131,7 @@ GIT_EXTERN(const git_signature *) git_commit_committer(git_commit *commit);
|
|
128
131
|
* @param commit a previously loaded commit.
|
129
132
|
* @return the author of a commit
|
130
133
|
*/
|
131
|
-
GIT_EXTERN(const git_signature *) git_commit_author(git_commit *commit);
|
134
|
+
GIT_EXTERN(const git_signature *) git_commit_author(const git_commit *commit);
|
132
135
|
|
133
136
|
/**
|
134
137
|
* Get the tree pointed to by a commit.
|
@@ -137,7 +140,7 @@ GIT_EXTERN(const git_signature *) git_commit_author(git_commit *commit);
|
|
137
140
|
* @param commit a previously loaded commit.
|
138
141
|
* @return 0 or an error code
|
139
142
|
*/
|
140
|
-
GIT_EXTERN(int) git_commit_tree(git_tree **tree_out, git_commit *commit);
|
143
|
+
GIT_EXTERN(int) git_commit_tree(git_tree **tree_out, const git_commit *commit);
|
141
144
|
|
142
145
|
/**
|
143
146
|
* Get the id of the tree pointed to by a commit. This differs from
|
@@ -147,7 +150,7 @@ GIT_EXTERN(int) git_commit_tree(git_tree **tree_out, git_commit *commit);
|
|
147
150
|
* @param commit a previously loaded commit.
|
148
151
|
* @return the id of tree pointed to by commit.
|
149
152
|
*/
|
150
|
-
GIT_EXTERN(const git_oid *)
|
153
|
+
GIT_EXTERN(const git_oid *) git_commit_tree_id(const git_commit *commit);
|
151
154
|
|
152
155
|
/**
|
153
156
|
* Get the number of parents of this commit
|
@@ -155,17 +158,17 @@ GIT_EXTERN(const git_oid *) git_commit_tree_oid(git_commit *commit);
|
|
155
158
|
* @param commit a previously loaded commit.
|
156
159
|
* @return integer of count of parents
|
157
160
|
*/
|
158
|
-
GIT_EXTERN(unsigned int) git_commit_parentcount(git_commit *commit);
|
161
|
+
GIT_EXTERN(unsigned int) git_commit_parentcount(const git_commit *commit);
|
159
162
|
|
160
163
|
/**
|
161
164
|
* Get the specified parent of the commit.
|
162
165
|
*
|
163
|
-
* @param
|
166
|
+
* @param out Pointer where to store the parent commit
|
164
167
|
* @param commit a previously loaded commit.
|
165
168
|
* @param n the position of the parent (from 0 to `parentcount`)
|
166
169
|
* @return 0 or an error code
|
167
170
|
*/
|
168
|
-
GIT_EXTERN(int) git_commit_parent(git_commit **
|
171
|
+
GIT_EXTERN(int) git_commit_parent(git_commit **out, git_commit *commit, unsigned int n);
|
169
172
|
|
170
173
|
/**
|
171
174
|
* Get the oid of a specified parent for a commit. This is different from
|
@@ -176,7 +179,7 @@ GIT_EXTERN(int) git_commit_parent(git_commit **parent, git_commit *commit, unsig
|
|
176
179
|
* @param n the position of the parent (from 0 to `parentcount`)
|
177
180
|
* @return the id of the parent, NULL on error.
|
178
181
|
*/
|
179
|
-
GIT_EXTERN(const git_oid *)
|
182
|
+
GIT_EXTERN(const git_oid *) git_commit_parent_id(git_commit *commit, unsigned int n);
|
180
183
|
|
181
184
|
/**
|
182
185
|
* Get the commit object that is the <n>th generation ancestor
|
@@ -204,7 +207,7 @@ GIT_EXTERN(int) git_commit_nth_gen_ancestor(
|
|
204
207
|
* The message will not be cleaned up. This can be achieved
|
205
208
|
* through `git_message_prettify()`.
|
206
209
|
*
|
207
|
-
* @param
|
210
|
+
* @param id Pointer where to store the OID of the
|
208
211
|
* newly created commit
|
209
212
|
*
|
210
213
|
* @param repo Repository where to store the commit
|
@@ -245,7 +248,7 @@ GIT_EXTERN(int) git_commit_nth_gen_ancestor(
|
|
245
248
|
* the given reference will be updated to point to it
|
246
249
|
*/
|
247
250
|
GIT_EXTERN(int) git_commit_create(
|
248
|
-
git_oid *
|
251
|
+
git_oid *id,
|
249
252
|
git_repository *repo,
|
250
253
|
const char *update_ref,
|
251
254
|
const git_signature *author,
|
@@ -273,7 +276,7 @@ GIT_EXTERN(int) git_commit_create(
|
|
273
276
|
* @see git_commit_create
|
274
277
|
*/
|
275
278
|
GIT_EXTERN(int) git_commit_create_v(
|
276
|
-
git_oid *
|
279
|
+
git_oid *id,
|
277
280
|
git_repository *repo,
|
278
281
|
const char *update_ref,
|
279
282
|
const git_signature *author,
|
@@ -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.
|
@@ -85,6 +85,11 @@ GIT_BEGIN_DECL
|
|
85
85
|
*/
|
86
86
|
#define GIT_PATH_MAX 4096
|
87
87
|
|
88
|
+
/**
|
89
|
+
* The string representation of the null object ID.
|
90
|
+
*/
|
91
|
+
#define GIT_OID_HEX_ZERO "0000000000000000000000000000000000000000"
|
92
|
+
|
88
93
|
/**
|
89
94
|
* Return the version of the libgit2 library
|
90
95
|
* being currently used.
|
@@ -118,6 +123,67 @@ enum {
|
|
118
123
|
*/
|
119
124
|
GIT_EXTERN(int) git_libgit2_capabilities(void);
|
120
125
|
|
126
|
+
|
127
|
+
enum {
|
128
|
+
GIT_OPT_GET_MWINDOW_SIZE,
|
129
|
+
GIT_OPT_SET_MWINDOW_SIZE,
|
130
|
+
GIT_OPT_GET_MWINDOW_MAPPED_LIMIT,
|
131
|
+
GIT_OPT_SET_MWINDOW_MAPPED_LIMIT,
|
132
|
+
GIT_OPT_GET_SEARCH_PATH,
|
133
|
+
GIT_OPT_SET_SEARCH_PATH,
|
134
|
+
GIT_OPT_GET_ODB_CACHE_SIZE,
|
135
|
+
GIT_OPT_SET_ODB_CACHE_SIZE,
|
136
|
+
};
|
137
|
+
|
138
|
+
/**
|
139
|
+
* Set or query a library global option
|
140
|
+
*
|
141
|
+
* Available options:
|
142
|
+
*
|
143
|
+
* opts(GIT_OPT_GET_MWINDOW_SIZE, size_t *):
|
144
|
+
* Get the maximum mmap window size
|
145
|
+
*
|
146
|
+
* opts(GIT_OPT_SET_MWINDOW_SIZE, size_t):
|
147
|
+
* Set the maximum mmap window size
|
148
|
+
*
|
149
|
+
* opts(GIT_OPT_GET_MWINDOW_MAPPED_LIMIT, size_t *):
|
150
|
+
* Get the maximum memory that will be mapped in total by the library
|
151
|
+
*
|
152
|
+
* opts(GIT_OPT_SET_MWINDOW_MAPPED_LIMIT, size_t):
|
153
|
+
* Set the maximum amount of memory that can be mapped at any time
|
154
|
+
* by the library
|
155
|
+
*
|
156
|
+
* opts(GIT_OPT_GET_SEARCH_PATH, int level, char *out, size_t len)
|
157
|
+
* Get the search path for a given level of config data. "level" must
|
158
|
+
* be one of GIT_CONFIG_LEVEL_SYSTEM, GIT_CONFIG_LEVEL_GLOBAL, or
|
159
|
+
* GIT_CONFIG_LEVEL_XDG. The search path is written to the `out`
|
160
|
+
* buffer up to size `len`. Returns GIT_EBUFS if buffer is too small.
|
161
|
+
*
|
162
|
+
* opts(GIT_OPT_SET_SEARCH_PATH, int level, const char *path)
|
163
|
+
* Set the search path for a level of config data. The search path
|
164
|
+
* applied to shared attributes and ignore files, too.
|
165
|
+
* - `path` lists directories delimited by GIT_PATH_LIST_SEPARATOR.
|
166
|
+
* Pass NULL to reset to the default (generally based on environment
|
167
|
+
* variables). Use magic path `$PATH` to include the old value
|
168
|
+
* of the path (if you want to prepend or append, for instance).
|
169
|
+
* - `level` must be GIT_CONFIG_LEVEL_SYSTEM, GIT_CONFIG_LEVEL_GLOBAL,
|
170
|
+
* or GIT_CONFIG_LEVEL_XDG.
|
171
|
+
*
|
172
|
+
* opts(GIT_OPT_GET_ODB_CACHE_SIZE):
|
173
|
+
* Get the size of the libgit2 odb cache.
|
174
|
+
*
|
175
|
+
* opts(GIT_OPT_SET_ODB_CACHE_SIZE):
|
176
|
+
* Set the size of the of the libgit2 odb cache. This needs
|
177
|
+
* to be done before git_repository_open is called, since
|
178
|
+
* git_repository_open initializes the odb layer. Defaults
|
179
|
+
* to 128.
|
180
|
+
*
|
181
|
+
* @param option Option key
|
182
|
+
* @param ... value to set the option
|
183
|
+
* @return 0 on success, <0 on failure
|
184
|
+
*/
|
185
|
+
GIT_EXTERN(int) git_libgit2_opts(int option, ...);
|
186
|
+
|
121
187
|
/** @} */
|
122
188
|
GIT_END_DECL
|
123
189
|
|
@@ -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.
|
@@ -41,23 +41,30 @@ typedef struct {
|
|
41
41
|
unsigned int level;
|
42
42
|
} git_config_entry;
|
43
43
|
|
44
|
+
typedef int (*git_config_foreach_cb)(const git_config_entry *, void *);
|
45
|
+
|
46
|
+
|
44
47
|
/**
|
45
48
|
* Generic backend that implements the interface to
|
46
49
|
* access a configuration file
|
47
50
|
*/
|
48
|
-
struct
|
51
|
+
struct git_config_backend {
|
52
|
+
unsigned int version;
|
49
53
|
struct git_config *cfg;
|
50
54
|
|
51
55
|
/* Open means open the file/database and parse if necessary */
|
52
|
-
int (*open)(struct
|
53
|
-
int (*get)(struct
|
54
|
-
int (*get_multivar)(struct
|
55
|
-
int (*set)(struct
|
56
|
-
int (*set_multivar)(
|
57
|
-
int (*del)(struct
|
58
|
-
int (*foreach)(struct
|
59
|
-
|
56
|
+
int (*open)(struct git_config_backend *, unsigned int level);
|
57
|
+
int (*get)(const struct git_config_backend *, const char *key, const git_config_entry **entry);
|
58
|
+
int (*get_multivar)(struct git_config_backend *, const char *key, const char *regexp, git_config_foreach_cb callback, void *payload);
|
59
|
+
int (*set)(struct git_config_backend *, const char *key, const char *value);
|
60
|
+
int (*set_multivar)(git_config_backend *cfg, const char *name, const char *regexp, const char *value);
|
61
|
+
int (*del)(struct git_config_backend *, const char *key);
|
62
|
+
int (*foreach)(struct git_config_backend *, const char *, git_config_foreach_cb callback, void *payload);
|
63
|
+
int (*refresh)(struct git_config_backend *);
|
64
|
+
void (*free)(struct git_config_backend *);
|
60
65
|
};
|
66
|
+
#define GIT_CONFIG_BACKEND_VERSION 1
|
67
|
+
#define GIT_CONFIG_BACKEND_INIT {GIT_CONFIG_BACKEND_VERSION}
|
61
68
|
|
62
69
|
typedef enum {
|
63
70
|
GIT_CVAR_FALSE = 0,
|
@@ -86,11 +93,11 @@ typedef struct {
|
|
86
93
|
* This method will not guess the path to the xdg compatible
|
87
94
|
* config file (.config/git/config).
|
88
95
|
*
|
89
|
-
* @param
|
90
|
-
* @
|
91
|
-
*
|
96
|
+
* @param out Buffer to store the path in
|
97
|
+
* @param length size of the buffer in bytes
|
98
|
+
* @return 0 if a global configuration file has been found. Its path will be stored in `buffer`.
|
92
99
|
*/
|
93
|
-
GIT_EXTERN(int) git_config_find_global(char *
|
100
|
+
GIT_EXTERN(int) git_config_find_global(char *out, size_t length);
|
94
101
|
|
95
102
|
/**
|
96
103
|
* Locate the path to the global xdg compatible configuration file
|
@@ -103,11 +110,12 @@ GIT_EXTERN(int) git_config_find_global(char *global_config_path, size_t length);
|
|
103
110
|
* may be used on any `git_config` call to load the
|
104
111
|
* xdg compatible configuration file.
|
105
112
|
*
|
106
|
-
* @param
|
113
|
+
* @param out Buffer to store the path in
|
114
|
+
* @param length size of the buffer in bytes
|
107
115
|
* @return 0 if a xdg compatible configuration file has been
|
108
116
|
* found. Its path will be stored in `buffer`.
|
109
117
|
*/
|
110
|
-
GIT_EXTERN(int) git_config_find_xdg(char *
|
118
|
+
GIT_EXTERN(int) git_config_find_xdg(char *out, size_t length);
|
111
119
|
|
112
120
|
/**
|
113
121
|
* Locate the path to the system configuration file
|
@@ -115,11 +123,12 @@ GIT_EXTERN(int) git_config_find_xdg(char *xdg_config_path, size_t length);
|
|
115
123
|
* If /etc/gitconfig doesn't exist, it will look for
|
116
124
|
* %PROGRAMFILES%\Git\etc\gitconfig.
|
117
125
|
|
118
|
-
* @param
|
126
|
+
* @param global_config_path Buffer to store the path in
|
127
|
+
* @param length size of the buffer in bytes
|
119
128
|
* @return 0 if a system configuration file has been
|
120
129
|
* found. Its path will be stored in `buffer`.
|
121
130
|
*/
|
122
|
-
GIT_EXTERN(int) git_config_find_system(char *
|
131
|
+
GIT_EXTERN(int) git_config_find_system(char *out, size_t length);
|
123
132
|
|
124
133
|
/**
|
125
134
|
* Open the global, XDG and system configuration files
|
@@ -133,19 +142,6 @@ GIT_EXTERN(int) git_config_find_system(char *system_config_path, size_t length);
|
|
133
142
|
*/
|
134
143
|
GIT_EXTERN(int) git_config_open_default(git_config **out);
|
135
144
|
|
136
|
-
/**
|
137
|
-
* Create a configuration file backend for ondisk files
|
138
|
-
*
|
139
|
-
* These are the normal `.gitconfig` files that Core Git
|
140
|
-
* processes. Note that you first have to add this file to a
|
141
|
-
* configuration object before you can query it for configuration
|
142
|
-
* variables.
|
143
|
-
*
|
144
|
-
* @param out the new backend
|
145
|
-
* @param path where the config file is located
|
146
|
-
*/
|
147
|
-
GIT_EXTERN(int) git_config_file__ondisk(struct git_config_file **out, const char *path);
|
148
|
-
|
149
145
|
/**
|
150
146
|
* Allocate a new configuration object
|
151
147
|
*
|
@@ -175,9 +171,9 @@ GIT_EXTERN(int) git_config_new(git_config **out);
|
|
175
171
|
* @return 0 on success, GIT_EEXISTS when adding more than one file
|
176
172
|
* for a given priority level (and force_replace set to 0), or error code
|
177
173
|
*/
|
178
|
-
GIT_EXTERN(int)
|
174
|
+
GIT_EXTERN(int) git_config_add_backend(
|
179
175
|
git_config *cfg,
|
180
|
-
|
176
|
+
git_config_backend *file,
|
181
177
|
unsigned int level,
|
182
178
|
int force);
|
183
179
|
|
@@ -201,7 +197,8 @@ GIT_EXTERN(int) git_config_add_file(
|
|
201
197
|
* @param force if a config file already exists for the given
|
202
198
|
* priority level, replace it
|
203
199
|
* @return 0 on success, GIT_EEXISTS when adding more than one file
|
204
|
-
* for a given priority level (and force_replace set to 0),
|
200
|
+
* for a given priority level (and force_replace set to 0),
|
201
|
+
* GIT_ENOTFOUND when the file doesn't exist or error code
|
205
202
|
*/
|
206
203
|
GIT_EXTERN(int) git_config_add_file_ondisk(
|
207
204
|
git_config *cfg,
|
@@ -209,7 +206,6 @@ GIT_EXTERN(int) git_config_add_file_ondisk(
|
|
209
206
|
unsigned int level,
|
210
207
|
int force);
|
211
208
|
|
212
|
-
|
213
209
|
/**
|
214
210
|
* Create a new config instance containing a single on-disk file
|
215
211
|
*
|
@@ -218,11 +214,12 @@ GIT_EXTERN(int) git_config_add_file_ondisk(
|
|
218
214
|
* - git_config_new
|
219
215
|
* - git_config_add_file_ondisk
|
220
216
|
*
|
221
|
-
* @param
|
217
|
+
* @param out The configuration instance to create
|
222
218
|
* @param path Path to the on-disk file to open
|
223
|
-
* @return 0
|
219
|
+
* @return 0 on success, GIT_ENOTFOUND when the file doesn't exist
|
220
|
+
* or an error code
|
224
221
|
*/
|
225
|
-
GIT_EXTERN(int) git_config_open_ondisk(git_config **
|
222
|
+
GIT_EXTERN(int) git_config_open_ondisk(git_config **out, const char *path);
|
226
223
|
|
227
224
|
/**
|
228
225
|
* Build a single-level focused config object from a multi-level one.
|
@@ -234,14 +231,30 @@ GIT_EXTERN(int) git_config_open_ondisk(git_config **cfg, const char *path);
|
|
234
231
|
* will return different config instances, but containing the same config_file
|
235
232
|
* instance.
|
236
233
|
*
|
234
|
+
* @param out The configuration instance to create
|
235
|
+
* @param parent Multi-level config to search for the given level
|
236
|
+
* @param level Configuration level to search for
|
237
237
|
* @return 0, GIT_ENOTFOUND if the passed level cannot be found in the
|
238
238
|
* multi-level parent config, or an error code
|
239
239
|
*/
|
240
240
|
GIT_EXTERN(int) git_config_open_level(
|
241
|
-
git_config **
|
242
|
-
git_config *
|
241
|
+
git_config **out,
|
242
|
+
const git_config *parent,
|
243
243
|
unsigned int level);
|
244
244
|
|
245
|
+
/**
|
246
|
+
* Reload changed config files
|
247
|
+
*
|
248
|
+
* A config file may be changed on disk out from under the in-memory
|
249
|
+
* config object. This function causes us to look for files that have
|
250
|
+
* been modified since we last loaded them and refresh the config with
|
251
|
+
* the latest information.
|
252
|
+
*
|
253
|
+
* @param cfg The configuration to refresh
|
254
|
+
* @return 0 or an error code
|
255
|
+
*/
|
256
|
+
GIT_EXTERN(int) git_config_refresh(git_config *cfg);
|
257
|
+
|
245
258
|
/**
|
246
259
|
* Free the configuration and its associated memory and files
|
247
260
|
*
|
@@ -260,7 +273,10 @@ GIT_EXTERN(void) git_config_free(git_config *cfg);
|
|
260
273
|
* @param name the variable's name
|
261
274
|
* @return 0 or an error code
|
262
275
|
*/
|
263
|
-
GIT_EXTERN(int)
|
276
|
+
GIT_EXTERN(int) git_config_get_entry(
|
277
|
+
const git_config_entry **out,
|
278
|
+
const git_config *cfg,
|
279
|
+
const char *name);
|
264
280
|
|
265
281
|
/**
|
266
282
|
* Get the value of an integer config variable.
|
@@ -274,21 +290,21 @@ GIT_EXTERN(int) git_config_get_config_entry(const git_config_entry **out, git_co
|
|
274
290
|
* @param name the variable's name
|
275
291
|
* @return 0 or an error code
|
276
292
|
*/
|
277
|
-
GIT_EXTERN(int) git_config_get_int32(int32_t *out, git_config *cfg, const char *name);
|
293
|
+
GIT_EXTERN(int) git_config_get_int32(int32_t *out, const git_config *cfg, const char *name);
|
278
294
|
|
279
295
|
/**
|
280
296
|
* Get the value of a long integer config variable.
|
281
297
|
*
|
282
298
|
* All config files will be looked into, in the order of their
|
283
299
|
* defined level. A higher level means a higher priority. The
|
284
|
-
* first
|
300
|
+
* first occurrence of the variable will be returned here.
|
285
301
|
*
|
286
302
|
* @param out pointer to the variable where the value should be stored
|
287
303
|
* @param cfg where to look for the variable
|
288
304
|
* @param name the variable's name
|
289
305
|
* @return 0 or an error code
|
290
306
|
*/
|
291
|
-
GIT_EXTERN(int) git_config_get_int64(int64_t *out, git_config *cfg, const char *name);
|
307
|
+
GIT_EXTERN(int) git_config_get_int64(int64_t *out, const git_config *cfg, const char *name);
|
292
308
|
|
293
309
|
/**
|
294
310
|
* Get the value of a boolean config variable.
|
@@ -298,14 +314,14 @@ GIT_EXTERN(int) git_config_get_int64(int64_t *out, git_config *cfg, const char *
|
|
298
314
|
*
|
299
315
|
* All config files will be looked into, in the order of their
|
300
316
|
* defined level. A higher level means a higher priority. The
|
301
|
-
* first
|
317
|
+
* first occurrence of the variable will be returned here.
|
302
318
|
*
|
303
319
|
* @param out pointer to the variable where the value should be stored
|
304
320
|
* @param cfg where to look for the variable
|
305
321
|
* @param name the variable's name
|
306
322
|
* @return 0 or an error code
|
307
323
|
*/
|
308
|
-
GIT_EXTERN(int) git_config_get_bool(int *out, git_config *cfg, const char *name);
|
324
|
+
GIT_EXTERN(int) git_config_get_bool(int *out, const git_config *cfg, const char *name);
|
309
325
|
|
310
326
|
/**
|
311
327
|
* Get the value of a string config variable.
|
@@ -315,14 +331,14 @@ GIT_EXTERN(int) git_config_get_bool(int *out, git_config *cfg, const char *name)
|
|
315
331
|
*
|
316
332
|
* All config files will be looked into, in the order of their
|
317
333
|
* defined level. A higher level means a higher priority. The
|
318
|
-
* first
|
334
|
+
* first occurrence of the variable will be returned here.
|
319
335
|
*
|
320
336
|
* @param out pointer to the variable's value
|
321
337
|
* @param cfg where to look for the variable
|
322
338
|
* @param name the variable's name
|
323
339
|
* @return 0 or an error code
|
324
340
|
*/
|
325
|
-
GIT_EXTERN(int) git_config_get_string(const char **out, git_config *cfg, const char *name);
|
341
|
+
GIT_EXTERN(int) git_config_get_string(const char **out, const git_config *cfg, const char *name);
|
326
342
|
|
327
343
|
/**
|
328
344
|
* Get each value of a multivar.
|
@@ -336,7 +352,7 @@ GIT_EXTERN(int) git_config_get_string(const char **out, git_config *cfg, const c
|
|
336
352
|
* @param fn the function to be called on each value of the variable
|
337
353
|
* @param data opaque pointer to pass to the callback
|
338
354
|
*/
|
339
|
-
GIT_EXTERN(int) git_config_get_multivar(git_config *cfg, const char *name, const char *regexp,
|
355
|
+
GIT_EXTERN(int) git_config_get_multivar(const git_config *cfg, const char *name, const char *regexp, git_config_foreach_cb callback, void *payload);
|
340
356
|
|
341
357
|
/**
|
342
358
|
* Set the value of an integer config variable in the config file
|
@@ -402,7 +418,7 @@ GIT_EXTERN(int) git_config_set_multivar(git_config *cfg, const char *name, const
|
|
402
418
|
* @param cfg the configuration
|
403
419
|
* @param name the variable to delete
|
404
420
|
*/
|
405
|
-
GIT_EXTERN(int)
|
421
|
+
GIT_EXTERN(int) git_config_delete_entry(git_config *cfg, const char *name);
|
406
422
|
|
407
423
|
/**
|
408
424
|
* Perform an operation on each config variable.
|
@@ -418,8 +434,8 @@ GIT_EXTERN(int) git_config_delete(git_config *cfg, const char *name);
|
|
418
434
|
* @return 0 on success, GIT_EUSER on non-zero callback, or error code
|
419
435
|
*/
|
420
436
|
GIT_EXTERN(int) git_config_foreach(
|
421
|
-
git_config *cfg,
|
422
|
-
|
437
|
+
const git_config *cfg,
|
438
|
+
git_config_foreach_cb callback,
|
423
439
|
void *payload);
|
424
440
|
|
425
441
|
/**
|
@@ -436,9 +452,9 @@ GIT_EXTERN(int) git_config_foreach(
|
|
436
452
|
* @return 0 or the return value of the callback which didn't return 0
|
437
453
|
*/
|
438
454
|
GIT_EXTERN(int) git_config_foreach_match(
|
439
|
-
git_config *cfg,
|
455
|
+
const git_config *cfg,
|
440
456
|
const char *regexp,
|
441
|
-
|
457
|
+
git_config_foreach_cb callback,
|
442
458
|
void *payload);
|
443
459
|
|
444
460
|
/**
|
@@ -475,7 +491,12 @@ GIT_EXTERN(int) git_config_foreach_match(
|
|
475
491
|
* @param map_n number of mapping objects in `maps`
|
476
492
|
* @return 0 on success, error code otherwise
|
477
493
|
*/
|
478
|
-
GIT_EXTERN(int) git_config_get_mapped(
|
494
|
+
GIT_EXTERN(int) git_config_get_mapped(
|
495
|
+
int *out,
|
496
|
+
const git_config *cfg,
|
497
|
+
const char *name,
|
498
|
+
const git_cvar_map *maps,
|
499
|
+
size_t map_n);
|
479
500
|
|
480
501
|
/**
|
481
502
|
* Maps a string value to an integer constant
|
@@ -487,7 +508,7 @@ GIT_EXTERN(int) git_config_get_mapped(int *out, git_config *cfg, const char *nam
|
|
487
508
|
*/
|
488
509
|
GIT_EXTERN(int) git_config_lookup_map_value(
|
489
510
|
int *out,
|
490
|
-
git_cvar_map *maps,
|
511
|
+
const git_cvar_map *maps,
|
491
512
|
size_t map_n,
|
492
513
|
const char *value);
|
493
514
|
|
@@ -504,7 +525,7 @@ GIT_EXTERN(int) git_config_lookup_map_value(
|
|
504
525
|
GIT_EXTERN(int) git_config_parse_bool(int *out, const char *value);
|
505
526
|
|
506
527
|
/**
|
507
|
-
* Parse a string value as an
|
528
|
+
* Parse a string value as an int32.
|
508
529
|
*
|
509
530
|
* An optional value suffix of 'k', 'm', or 'g' will
|
510
531
|
* cause the value to be multiplied by 1024, 1048576,
|
@@ -513,10 +534,10 @@ GIT_EXTERN(int) git_config_parse_bool(int *out, const char *value);
|
|
513
534
|
* @param out place to store the result of the parsing
|
514
535
|
* @param value value to parse
|
515
536
|
*/
|
516
|
-
GIT_EXTERN(int)
|
537
|
+
GIT_EXTERN(int) git_config_parse_int32(int32_t *out, const char *value);
|
517
538
|
|
518
539
|
/**
|
519
|
-
* Parse a string value as an
|
540
|
+
* Parse a string value as an int64.
|
520
541
|
*
|
521
542
|
* An optional value suffix of 'k', 'm', or 'g' will
|
522
543
|
* cause the value to be multiplied by 1024, 1048576,
|
@@ -525,7 +546,7 @@ GIT_EXTERN(int) git_config_parse_int64(int64_t *out, const char *value);
|
|
525
546
|
* @param out place to store the result of the parsing
|
526
547
|
* @param value value to parse
|
527
548
|
*/
|
528
|
-
GIT_EXTERN(int)
|
549
|
+
GIT_EXTERN(int) git_config_parse_int64(int64_t *out, const char *value);
|
529
550
|
|
530
551
|
|
531
552
|
/** @} */
|