rugged 1.3.2.3 → 1.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/ext/rugged/extconf.rb +1 -1
- data/ext/rugged/rugged_config.c +7 -2
- data/ext/rugged/rugged_remote.c +17 -0
- data/lib/rugged/version.rb +1 -1
- data/vendor/libgit2/CMakeLists.txt +103 -276
- data/vendor/libgit2/COPYING +36 -19
- data/vendor/libgit2/cmake/AddCFlagIfSupported.cmake +21 -21
- data/vendor/libgit2/cmake/DefaultCFlags.cmake +154 -0
- data/vendor/libgit2/cmake/EnableWarnings.cmake +13 -13
- data/vendor/libgit2/cmake/FindCoreFoundation.cmake +13 -13
- data/vendor/libgit2/cmake/FindGSSAPI.cmake +171 -287
- data/vendor/libgit2/cmake/FindGSSFramework.cmake +13 -13
- data/vendor/libgit2/cmake/{FindHTTP_Parser.cmake → FindHTTPParser.cmake} +17 -17
- data/vendor/libgit2/cmake/FindIconv.cmake +27 -27
- data/vendor/libgit2/cmake/FindLibSSH2.cmake +5 -5
- data/vendor/libgit2/cmake/FindPCRE.cmake +13 -13
- data/vendor/libgit2/cmake/FindPCRE2.cmake +12 -12
- data/vendor/libgit2/cmake/FindPkgLibraries.cmake +19 -19
- data/vendor/libgit2/cmake/FindSecurity.cmake +14 -14
- data/vendor/libgit2/cmake/FindStatNsec.cmake +12 -18
- data/vendor/libgit2/cmake/Findfutimens.cmake +8 -8
- data/vendor/libgit2/cmake/FindmbedTLS.cmake +63 -70
- data/vendor/libgit2/cmake/IdeSplitSources.cmake +18 -18
- data/vendor/libgit2/cmake/PkgBuildConfig.cmake +60 -60
- data/vendor/libgit2/cmake/SanitizeBool.cmake +20 -20
- data/vendor/libgit2/cmake/SelectGSSAPI.cmake +37 -37
- data/vendor/libgit2/cmake/SelectHTTPParser.cmake +19 -0
- data/vendor/libgit2/cmake/SelectHTTPSBackend.cmake +100 -100
- data/vendor/libgit2/cmake/SelectHashes.cmake +39 -49
- data/vendor/libgit2/cmake/SelectRegex.cmake +51 -0
- data/vendor/libgit2/cmake/SelectSSH.cmake +41 -0
- data/vendor/libgit2/cmake/SelectWinHTTP.cmake +17 -0
- data/vendor/libgit2/cmake/SelectZlib.cmake +34 -0
- data/vendor/libgit2/deps/chromium-zlib/CMakeLists.txt +6 -6
- data/vendor/libgit2/deps/ntlmclient/CMakeLists.txt +31 -31
- data/vendor/libgit2/deps/ntlmclient/crypt_openssl.c +1 -1
- data/vendor/libgit2/deps/ntlmclient/ntlm.c +4 -4
- data/vendor/libgit2/deps/ntlmclient/ntlm.h +4 -4
- data/vendor/libgit2/deps/ntlmclient/ntlmclient.h +2 -2
- data/vendor/libgit2/deps/pcre/CMakeLists.txt +88 -88
- data/vendor/libgit2/deps/winhttp/CMakeLists.txt +14 -16
- data/vendor/libgit2/deps/zlib/adler32.c +0 -7
- data/vendor/libgit2/deps/zlib/crc32.c +288 -975
- data/vendor/libgit2/deps/zlib/crc32.h +436 -9441
- data/vendor/libgit2/deps/zlib/deflate.c +31 -83
- data/vendor/libgit2/deps/zlib/deflate.h +15 -12
- data/vendor/libgit2/deps/zlib/gzguts.h +2 -3
- data/vendor/libgit2/deps/zlib/infback.c +1 -2
- data/vendor/libgit2/deps/zlib/inffast.c +14 -14
- data/vendor/libgit2/deps/zlib/inflate.c +8 -39
- data/vendor/libgit2/deps/zlib/inflate.h +2 -3
- data/vendor/libgit2/deps/zlib/inftrees.c +3 -3
- data/vendor/libgit2/deps/zlib/trees.c +48 -27
- data/vendor/libgit2/deps/zlib/zlib.h +100 -126
- data/vendor/libgit2/deps/zlib/zutil.c +2 -2
- data/vendor/libgit2/deps/zlib/zutil.h +9 -12
- data/vendor/libgit2/include/git2/apply.h +16 -2
- data/vendor/libgit2/include/git2/attr.h +11 -2
- data/vendor/libgit2/include/git2/blame.h +4 -1
- data/vendor/libgit2/include/git2/blob.h +14 -1
- data/vendor/libgit2/include/git2/branch.h +2 -0
- data/vendor/libgit2/include/git2/buffer.h +18 -78
- data/vendor/libgit2/include/git2/cert.h +2 -2
- data/vendor/libgit2/include/git2/checkout.h +5 -2
- data/vendor/libgit2/include/git2/clone.h +3 -3
- data/vendor/libgit2/include/git2/commit.h +2 -0
- data/vendor/libgit2/include/git2/common.h +5 -12
- data/vendor/libgit2/include/git2/config.h +19 -3
- data/vendor/libgit2/include/git2/credential.h +2 -1
- data/vendor/libgit2/include/git2/credential_helpers.h +1 -0
- data/vendor/libgit2/include/git2/deprecated.h +1 -1
- data/vendor/libgit2/include/git2/describe.h +7 -2
- data/vendor/libgit2/include/git2/diff.h +17 -9
- data/vendor/libgit2/include/git2/email.h +1 -1
- data/vendor/libgit2/include/git2/errors.h +1 -2
- data/vendor/libgit2/include/git2/filter.h +7 -2
- data/vendor/libgit2/include/git2/graph.h +1 -0
- data/vendor/libgit2/include/git2/ignore.h +1 -1
- data/vendor/libgit2/include/git2/index.h +11 -5
- data/vendor/libgit2/include/git2/indexer.h +19 -0
- data/vendor/libgit2/include/git2/merge.h +23 -3
- data/vendor/libgit2/include/git2/message.h +2 -0
- data/vendor/libgit2/include/git2/object.h +23 -0
- data/vendor/libgit2/include/git2/odb.h +37 -7
- data/vendor/libgit2/include/git2/odb_backend.h +1 -1
- data/vendor/libgit2/include/git2/pack.h +24 -8
- data/vendor/libgit2/include/git2/patch.h +8 -0
- data/vendor/libgit2/include/git2/pathspec.h +1 -1
- data/vendor/libgit2/include/git2/proxy.h +1 -1
- data/vendor/libgit2/include/git2/rebase.h +9 -1
- data/vendor/libgit2/include/git2/refdb.h +3 -0
- data/vendor/libgit2/include/git2/reflog.h +1 -1
- data/vendor/libgit2/include/git2/refs.h +2 -2
- data/vendor/libgit2/include/git2/remote.h +184 -37
- data/vendor/libgit2/include/git2/repository.h +14 -9
- data/vendor/libgit2/include/git2/reset.h +2 -2
- data/vendor/libgit2/include/git2/revparse.h +1 -1
- data/vendor/libgit2/include/git2/revwalk.h +4 -1
- data/vendor/libgit2/include/git2/signature.h +1 -1
- data/vendor/libgit2/include/git2/stash.h +3 -3
- data/vendor/libgit2/include/git2/status.h +9 -3
- data/vendor/libgit2/include/git2/submodule.h +7 -2
- data/vendor/libgit2/include/git2/sys/commit_graph.h +1 -1
- data/vendor/libgit2/include/git2/sys/odb_backend.h +2 -5
- data/vendor/libgit2/include/git2/sys/remote.h +31 -0
- data/vendor/libgit2/include/git2/sys/stream.h +1 -1
- data/vendor/libgit2/include/git2/sys/transport.h +25 -34
- data/vendor/libgit2/include/git2/tag.h +1 -0
- data/vendor/libgit2/include/git2/tree.h +4 -3
- data/vendor/libgit2/include/git2/types.h +7 -7
- data/vendor/libgit2/include/git2/version.h +3 -3
- data/vendor/libgit2/include/git2/worktree.h +12 -2
- data/vendor/libgit2/src/CMakeLists.txt +189 -315
- data/vendor/libgit2/src/annotated_commit.h +1 -1
- data/vendor/libgit2/src/apply.c +18 -18
- data/vendor/libgit2/src/apply.h +2 -2
- data/vendor/libgit2/src/attr.c +18 -18
- data/vendor/libgit2/src/attr_file.c +17 -17
- data/vendor/libgit2/src/attr_file.h +4 -4
- data/vendor/libgit2/src/attrcache.c +17 -12
- data/vendor/libgit2/src/blame_git.c +1 -1
- data/vendor/libgit2/src/blob.c +33 -26
- data/vendor/libgit2/src/blob.h +1 -1
- data/vendor/libgit2/src/branch.c +150 -109
- data/vendor/libgit2/src/branch.h +15 -3
- data/vendor/libgit2/src/buf.c +126 -0
- data/vendor/libgit2/src/buf.h +50 -0
- data/vendor/libgit2/src/cc-compat.h +1 -1
- data/vendor/libgit2/src/checkout.c +74 -68
- data/vendor/libgit2/src/cherrypick.c +10 -10
- data/vendor/libgit2/src/clone.c +66 -66
- data/vendor/libgit2/src/commit.c +128 -58
- data/vendor/libgit2/src/commit.h +24 -1
- data/vendor/libgit2/src/commit_graph.c +68 -53
- data/vendor/libgit2/src/commit_graph.h +10 -3
- data/vendor/libgit2/src/commit_list.c +2 -3
- data/vendor/libgit2/src/common.h +10 -3
- data/vendor/libgit2/src/config.c +99 -77
- data/vendor/libgit2/src/config.h +15 -2
- data/vendor/libgit2/src/config_file.c +103 -91
- data/vendor/libgit2/src/config_mem.c +9 -9
- data/vendor/libgit2/src/config_parse.c +27 -23
- data/vendor/libgit2/src/crlf.c +24 -21
- data/vendor/libgit2/src/date.c +10 -17
- data/vendor/libgit2/src/date.h +33 -0
- data/vendor/libgit2/src/describe.c +27 -19
- data/vendor/libgit2/src/diff.c +25 -8
- data/vendor/libgit2/src/diff.h +2 -4
- data/vendor/libgit2/src/diff_driver.c +34 -36
- data/vendor/libgit2/src/diff_driver.h +3 -3
- data/vendor/libgit2/src/diff_file.c +29 -20
- data/vendor/libgit2/src/diff_generate.c +30 -6
- data/vendor/libgit2/src/diff_generate.h +5 -3
- data/vendor/libgit2/src/diff_print.c +102 -95
- data/vendor/libgit2/src/diff_stats.c +40 -29
- data/vendor/libgit2/src/{message.h → diff_stats.h} +7 -6
- data/vendor/libgit2/src/diff_tform.c +9 -8
- data/vendor/libgit2/src/diff_xdiff.c +3 -8
- data/vendor/libgit2/src/email.c +54 -38
- data/vendor/libgit2/src/email.h +1 -1
- data/vendor/libgit2/src/errors.c +18 -18
- data/vendor/libgit2/src/features.h.in +6 -1
- data/vendor/libgit2/src/fetch.c +69 -24
- data/vendor/libgit2/src/fetch.h +1 -1
- data/vendor/libgit2/src/fetchhead.c +19 -19
- data/vendor/libgit2/src/filebuf.c +28 -28
- data/vendor/libgit2/src/filebuf.h +1 -1
- data/vendor/libgit2/src/filter.c +96 -52
- data/vendor/libgit2/src/filter.h +26 -5
- data/vendor/libgit2/src/fs_path.c +1912 -0
- data/vendor/libgit2/src/fs_path.h +752 -0
- data/vendor/libgit2/src/futils.c +91 -85
- data/vendor/libgit2/src/futils.h +26 -14
- data/vendor/libgit2/src/hash/sha1/collisiondetect.c +2 -2
- data/vendor/libgit2/src/hash/sha1/common_crypto.c +2 -2
- data/vendor/libgit2/src/hash/sha1/generic.c +2 -2
- data/vendor/libgit2/src/hash/sha1/mbedtls.c +2 -2
- data/vendor/libgit2/src/hash/sha1/openssl.c +2 -2
- data/vendor/libgit2/src/hash/sha1/sha1dc/sha1.c +1 -1
- data/vendor/libgit2/src/hash/sha1/win32.c +6 -6
- data/vendor/libgit2/src/hash/sha1.h +3 -1
- data/vendor/libgit2/src/hash.c +67 -35
- data/vendor/libgit2/src/hash.h +12 -12
- data/vendor/libgit2/src/ident.c +18 -18
- data/vendor/libgit2/src/ignore.c +35 -34
- data/vendor/libgit2/src/ignore.h +2 -2
- data/vendor/libgit2/src/index.c +79 -80
- data/vendor/libgit2/src/index.h +6 -3
- data/vendor/libgit2/src/indexer.c +75 -57
- data/vendor/libgit2/src/iterator.c +64 -56
- data/vendor/libgit2/src/iterator.h +5 -5
- data/vendor/libgit2/src/khash.h +1 -1
- data/vendor/libgit2/src/libgit2.c +22 -19
- data/vendor/libgit2/src/mailmap.c +38 -36
- data/vendor/libgit2/src/merge.c +27 -27
- data/vendor/libgit2/src/merge.h +1 -14
- data/vendor/libgit2/src/merge_driver.c +2 -2
- data/vendor/libgit2/src/merge_file.c +13 -3
- data/vendor/libgit2/src/message.c +21 -10
- data/vendor/libgit2/src/midx.c +83 -66
- data/vendor/libgit2/src/midx.h +3 -3
- data/vendor/libgit2/src/mwindow.c +1 -1
- data/vendor/libgit2/src/net.c +278 -68
- data/vendor/libgit2/src/net.h +10 -3
- data/vendor/libgit2/src/netops.c +1 -1
- data/vendor/libgit2/src/netops.h +1 -1
- data/vendor/libgit2/src/notes.c +20 -29
- data/vendor/libgit2/src/object.c +49 -9
- data/vendor/libgit2/src/object.h +1 -1
- data/vendor/libgit2/src/odb.c +35 -32
- data/vendor/libgit2/src/odb.h +1 -1
- data/vendor/libgit2/src/odb_loose.c +68 -68
- data/vendor/libgit2/src/odb_mempack.c +18 -5
- data/vendor/libgit2/src/odb_pack.c +43 -43
- data/vendor/libgit2/src/oid.c +11 -4
- data/vendor/libgit2/src/oid.h +15 -0
- data/vendor/libgit2/src/pack-objects.c +41 -26
- data/vendor/libgit2/src/pack-objects.h +11 -6
- data/vendor/libgit2/src/pack.c +10 -10
- data/vendor/libgit2/src/patch.c +3 -3
- data/vendor/libgit2/src/patch.h +1 -0
- data/vendor/libgit2/src/patch_generate.c +27 -11
- data/vendor/libgit2/src/patch_generate.h +5 -5
- data/vendor/libgit2/src/patch_parse.c +24 -24
- data/vendor/libgit2/src/path.c +76 -1951
- data/vendor/libgit2/src/path.h +34 -741
- data/vendor/libgit2/src/pathspec.c +6 -6
- data/vendor/libgit2/src/pathspec.h +2 -2
- data/vendor/libgit2/src/posix.c +3 -3
- data/vendor/libgit2/src/posix.h +1 -0
- data/vendor/libgit2/src/pqueue.h +1 -1
- data/vendor/libgit2/src/proxy.c +4 -1
- data/vendor/libgit2/src/proxy.h +1 -1
- data/vendor/libgit2/src/push.c +30 -35
- data/vendor/libgit2/src/push.h +4 -16
- data/vendor/libgit2/src/rand.c +226 -0
- data/vendor/libgit2/src/rand.h +37 -0
- data/vendor/libgit2/src/reader.c +8 -8
- data/vendor/libgit2/src/reader.h +2 -2
- data/vendor/libgit2/src/rebase.c +89 -88
- data/vendor/libgit2/src/refdb_fs.c +447 -173
- data/vendor/libgit2/src/refs.c +32 -32
- data/vendor/libgit2/src/refs.h +2 -2
- data/vendor/libgit2/src/refspec.c +32 -37
- data/vendor/libgit2/src/refspec.h +5 -2
- data/vendor/libgit2/src/regexp.c +1 -1
- data/vendor/libgit2/src/remote.c +713 -419
- data/vendor/libgit2/src/remote.h +15 -10
- data/vendor/libgit2/src/repository.c +350 -467
- data/vendor/libgit2/src/repository.h +11 -10
- data/vendor/libgit2/src/reset.c +8 -5
- data/vendor/libgit2/src/revert.c +10 -10
- data/vendor/libgit2/src/revparse.c +48 -35
- data/vendor/libgit2/src/revwalk.c +7 -7
- data/vendor/libgit2/src/signature.c +12 -6
- data/vendor/libgit2/src/signature.h +1 -1
- data/vendor/libgit2/src/sortedcache.c +1 -1
- data/vendor/libgit2/src/sortedcache.h +1 -1
- data/vendor/libgit2/src/stash.c +36 -37
- data/vendor/libgit2/src/status.c +4 -1
- data/vendor/libgit2/src/{buffer.c → str.c} +157 -151
- data/vendor/libgit2/src/str.h +357 -0
- data/vendor/libgit2/src/streams/mbedtls.c +8 -6
- data/vendor/libgit2/src/streams/openssl_dynamic.h +3 -3
- data/vendor/libgit2/src/submodule.c +171 -159
- data/vendor/libgit2/src/submodule.h +1 -1
- data/vendor/libgit2/src/sysdir.c +68 -52
- data/vendor/libgit2/src/sysdir.h +15 -10
- data/vendor/libgit2/src/tag.c +29 -27
- data/vendor/libgit2/src/thread.h +3 -3
- data/vendor/libgit2/src/threadstate.c +3 -3
- data/vendor/libgit2/src/threadstate.h +1 -1
- data/vendor/libgit2/src/trace.c +1 -14
- data/vendor/libgit2/src/trace.h +5 -22
- data/vendor/libgit2/src/trailer.c +1 -1
- data/vendor/libgit2/src/transaction.c +1 -1
- data/vendor/libgit2/src/transport.c +10 -10
- data/vendor/libgit2/src/transports/auth.c +7 -9
- data/vendor/libgit2/src/transports/auth.h +2 -3
- data/vendor/libgit2/src/transports/auth_negotiate.c +12 -13
- data/vendor/libgit2/src/transports/auth_ntlm.c +10 -10
- data/vendor/libgit2/src/transports/auth_ntlm.h +0 -1
- data/vendor/libgit2/src/transports/git.c +9 -11
- data/vendor/libgit2/src/transports/http.c +37 -17
- data/vendor/libgit2/src/transports/http.h +2 -3
- data/vendor/libgit2/src/transports/httpclient.c +65 -65
- data/vendor/libgit2/src/transports/local.c +124 -116
- data/vendor/libgit2/src/transports/smart.c +51 -139
- data/vendor/libgit2/src/transports/smart.h +25 -31
- data/vendor/libgit2/src/transports/smart_pkt.c +33 -33
- data/vendor/libgit2/src/transports/smart_protocol.c +57 -39
- data/vendor/libgit2/src/transports/ssh.c +47 -112
- data/vendor/libgit2/src/transports/winhttp.c +50 -56
- data/vendor/libgit2/src/tree-cache.c +5 -5
- data/vendor/libgit2/src/tree-cache.h +2 -2
- data/vendor/libgit2/src/tree.c +59 -48
- data/vendor/libgit2/src/tree.h +1 -1
- data/vendor/libgit2/src/unix/map.c +0 -2
- data/vendor/libgit2/src/unix/posix.h +1 -4
- data/vendor/libgit2/src/unix/realpath.c +0 -2
- data/vendor/libgit2/src/util.c +14 -14
- data/vendor/libgit2/src/util.h +2 -28
- data/vendor/libgit2/src/vector.h +1 -1
- data/vendor/libgit2/src/win32/findfile.c +172 -116
- data/vendor/libgit2/src/win32/findfile.h +7 -4
- data/vendor/libgit2/src/win32/path_w32.c +140 -9
- data/vendor/libgit2/src/win32/path_w32.h +2 -0
- data/vendor/libgit2/src/win32/posix.h +0 -1
- data/vendor/libgit2/src/win32/posix_w32.c +11 -27
- data/vendor/libgit2/src/win32/w32_buffer.c +2 -3
- data/vendor/libgit2/src/win32/w32_buffer.h +2 -3
- data/vendor/libgit2/src/win32/w32_leakcheck.c +1 -1
- data/vendor/libgit2/src/worktree.c +116 -94
- data/vendor/libgit2/src/worktree.h +1 -1
- data/vendor/libgit2/src/xdiff/git-xdiff.h +53 -0
- data/vendor/libgit2/src/xdiff/xdiff.h +15 -15
- data/vendor/libgit2/src/xdiff/xdiffi.c +134 -108
- data/vendor/libgit2/src/xdiff/xemit.c +23 -7
- data/vendor/libgit2/src/xdiff/xhistogram.c +87 -78
- data/vendor/libgit2/src/xdiff/xinclude.h +1 -12
- data/vendor/libgit2/src/xdiff/xmerge.c +104 -117
- data/vendor/libgit2/src/xdiff/xpatience.c +6 -17
- data/vendor/libgit2/src/xdiff/xprepare.c +15 -20
- data/vendor/libgit2/src/xdiff/xutils.c +18 -7
- data/vendor/libgit2/src/zstream.c +5 -5
- data/vendor/libgit2/src/zstream.h +4 -4
- metadata +25 -10
- data/vendor/libgit2/src/buffer.h +0 -374
data/vendor/libgit2/src/config.c
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
#include "git2/config.h"
|
|
11
11
|
#include "git2/sys/config.h"
|
|
12
12
|
|
|
13
|
+
#include "buf.h"
|
|
13
14
|
#include "config_backend.h"
|
|
14
15
|
#include "regexp.h"
|
|
15
16
|
#include "sysdir.h"
|
|
@@ -848,7 +849,40 @@ static int is_readonly(const git_config *cfg)
|
|
|
848
849
|
return 1;
|
|
849
850
|
}
|
|
850
851
|
|
|
851
|
-
int
|
|
852
|
+
static int git_config__parse_path(git_str *out, const char *value)
|
|
853
|
+
{
|
|
854
|
+
GIT_ASSERT_ARG(out);
|
|
855
|
+
GIT_ASSERT_ARG(value);
|
|
856
|
+
|
|
857
|
+
if (value[0] == '~') {
|
|
858
|
+
if (value[1] != '\0' && value[1] != '/') {
|
|
859
|
+
git_error_set(GIT_ERROR_CONFIG, "retrieving a homedir by name is not supported");
|
|
860
|
+
return -1;
|
|
861
|
+
}
|
|
862
|
+
|
|
863
|
+
return git_sysdir_expand_global_file(out, value[1] ? &value[2] : NULL);
|
|
864
|
+
}
|
|
865
|
+
|
|
866
|
+
return git_str_sets(out, value);
|
|
867
|
+
}
|
|
868
|
+
|
|
869
|
+
int git_config_parse_path(git_buf *out, const char *value)
|
|
870
|
+
{
|
|
871
|
+
GIT_BUF_WRAP_PRIVATE(out, git_config__parse_path, value);
|
|
872
|
+
}
|
|
873
|
+
|
|
874
|
+
int git_config_get_path(
|
|
875
|
+
git_buf *out,
|
|
876
|
+
const git_config *cfg,
|
|
877
|
+
const char *name)
|
|
878
|
+
{
|
|
879
|
+
GIT_BUF_WRAP_PRIVATE(out, git_config__get_path, cfg, name);
|
|
880
|
+
}
|
|
881
|
+
|
|
882
|
+
int git_config__get_path(
|
|
883
|
+
git_str *out,
|
|
884
|
+
const git_config *cfg,
|
|
885
|
+
const char *name)
|
|
852
886
|
{
|
|
853
887
|
git_config_entry *entry;
|
|
854
888
|
int error;
|
|
@@ -856,7 +890,7 @@ int git_config_get_path(git_buf *out, const git_config *cfg, const char *name)
|
|
|
856
890
|
if ((error = get_entry(&entry, cfg, name, true, GET_ALL_ERRORS)) < 0)
|
|
857
891
|
return error;
|
|
858
892
|
|
|
859
|
-
error =
|
|
893
|
+
error = git_config__parse_path(out, entry->value);
|
|
860
894
|
git_config_entry_free(entry);
|
|
861
895
|
|
|
862
896
|
return error;
|
|
@@ -883,19 +917,25 @@ int git_config_get_string(
|
|
|
883
917
|
|
|
884
918
|
int git_config_get_string_buf(
|
|
885
919
|
git_buf *out, const git_config *cfg, const char *name)
|
|
920
|
+
{
|
|
921
|
+
GIT_BUF_WRAP_PRIVATE(out, git_config__get_string_buf, cfg, name);
|
|
922
|
+
}
|
|
923
|
+
|
|
924
|
+
int git_config__get_string_buf(
|
|
925
|
+
git_str *out, const git_config *cfg, const char *name)
|
|
886
926
|
{
|
|
887
927
|
git_config_entry *entry;
|
|
888
928
|
int ret;
|
|
889
929
|
const char *str;
|
|
890
930
|
|
|
891
|
-
|
|
892
|
-
|
|
931
|
+
GIT_ASSERT_ARG(out);
|
|
932
|
+
GIT_ASSERT_ARG(cfg);
|
|
893
933
|
|
|
894
934
|
ret = get_entry(&entry, cfg, name, true, GET_ALL_ERRORS);
|
|
895
935
|
str = !ret ? (entry->value ? entry->value : "") : NULL;
|
|
896
936
|
|
|
897
937
|
if (str)
|
|
898
|
-
ret =
|
|
938
|
+
ret = git_str_puts(out, str);
|
|
899
939
|
|
|
900
940
|
git_config_entry_free(entry);
|
|
901
941
|
|
|
@@ -1087,108 +1127,112 @@ void git_config_iterator_free(git_config_iterator *iter)
|
|
|
1087
1127
|
|
|
1088
1128
|
int git_config_find_global(git_buf *path)
|
|
1089
1129
|
{
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
if ((error = git_buf_sanitize(path)) < 0)
|
|
1093
|
-
return error;
|
|
1130
|
+
GIT_BUF_WRAP_PRIVATE(path, git_sysdir_find_global_file, GIT_CONFIG_FILENAME_GLOBAL);
|
|
1131
|
+
}
|
|
1094
1132
|
|
|
1133
|
+
int git_config__find_global(git_str *path)
|
|
1134
|
+
{
|
|
1095
1135
|
return git_sysdir_find_global_file(path, GIT_CONFIG_FILENAME_GLOBAL);
|
|
1096
1136
|
}
|
|
1097
1137
|
|
|
1098
1138
|
int git_config_find_xdg(git_buf *path)
|
|
1099
1139
|
{
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
if ((error = git_buf_sanitize(path)) < 0)
|
|
1103
|
-
return error;
|
|
1140
|
+
GIT_BUF_WRAP_PRIVATE(path, git_sysdir_find_global_file, GIT_CONFIG_FILENAME_XDG);
|
|
1141
|
+
}
|
|
1104
1142
|
|
|
1143
|
+
int git_config__find_xdg(git_str *path)
|
|
1144
|
+
{
|
|
1105
1145
|
return git_sysdir_find_xdg_file(path, GIT_CONFIG_FILENAME_XDG);
|
|
1106
1146
|
}
|
|
1107
1147
|
|
|
1108
1148
|
int git_config_find_system(git_buf *path)
|
|
1109
1149
|
{
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
if ((error = git_buf_sanitize(path)) < 0)
|
|
1113
|
-
return error;
|
|
1150
|
+
GIT_BUF_WRAP_PRIVATE(path, git_sysdir_find_global_file, GIT_CONFIG_FILENAME_SYSTEM);
|
|
1151
|
+
}
|
|
1114
1152
|
|
|
1153
|
+
int git_config__find_system(git_str *path)
|
|
1154
|
+
{
|
|
1115
1155
|
return git_sysdir_find_system_file(path, GIT_CONFIG_FILENAME_SYSTEM);
|
|
1116
1156
|
}
|
|
1117
1157
|
|
|
1118
1158
|
int git_config_find_programdata(git_buf *path)
|
|
1119
1159
|
{
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1160
|
+
git_str str = GIT_STR_INIT;
|
|
1161
|
+
int error;
|
|
1162
|
+
|
|
1163
|
+
if ((error = git_buf_tostr(&str, path)) == 0 &&
|
|
1164
|
+
(error = git_config__find_programdata(&str)) == 0)
|
|
1165
|
+
error = git_buf_fromstr(path, &str);
|
|
1166
|
+
|
|
1167
|
+
git_str_dispose(&str);
|
|
1168
|
+
return error;
|
|
1169
|
+
}
|
|
1170
|
+
|
|
1171
|
+
int git_config__find_programdata(git_str *path)
|
|
1172
|
+
{
|
|
1124
1173
|
int ret;
|
|
1125
1174
|
|
|
1126
|
-
|
|
1127
|
-
(ret = git_sysdir_find_programdata_file(path,
|
|
1128
|
-
GIT_CONFIG_FILENAME_PROGRAMDATA)) < 0 ||
|
|
1129
|
-
(ret = git_path_owner_is(&is_safe, path->ptr, owner_level)) < 0)
|
|
1130
|
-
return ret;
|
|
1175
|
+
ret = git_sysdir_find_programdata_file(path, GIT_CONFIG_FILENAME_PROGRAMDATA);
|
|
1131
1176
|
|
|
1132
|
-
if (
|
|
1133
|
-
|
|
1134
|
-
return -1;
|
|
1135
|
-
}
|
|
1177
|
+
if (ret != GIT_OK)
|
|
1178
|
+
return ret;
|
|
1136
1179
|
|
|
1137
|
-
return
|
|
1180
|
+
return git_fs_path_validate_system_file_ownership(path->ptr);
|
|
1138
1181
|
}
|
|
1139
1182
|
|
|
1140
|
-
int git_config__global_location(
|
|
1183
|
+
int git_config__global_location(git_str *buf)
|
|
1141
1184
|
{
|
|
1142
|
-
const
|
|
1185
|
+
const git_str *paths;
|
|
1143
1186
|
const char *sep, *start;
|
|
1144
1187
|
|
|
1145
1188
|
if (git_sysdir_get(&paths, GIT_SYSDIR_GLOBAL) < 0)
|
|
1146
1189
|
return -1;
|
|
1147
1190
|
|
|
1148
1191
|
/* no paths, so give up */
|
|
1149
|
-
if (!paths || !
|
|
1192
|
+
if (!paths || !git_str_len(paths))
|
|
1150
1193
|
return -1;
|
|
1151
1194
|
|
|
1152
1195
|
/* find unescaped separator or end of string */
|
|
1153
|
-
for (sep = start =
|
|
1196
|
+
for (sep = start = git_str_cstr(paths); *sep; ++sep) {
|
|
1154
1197
|
if (*sep == GIT_PATH_LIST_SEPARATOR &&
|
|
1155
1198
|
(sep <= start || sep[-1] != '\\'))
|
|
1156
1199
|
break;
|
|
1157
1200
|
}
|
|
1158
1201
|
|
|
1159
|
-
if (
|
|
1202
|
+
if (git_str_set(buf, start, (size_t)(sep - start)) < 0)
|
|
1160
1203
|
return -1;
|
|
1161
1204
|
|
|
1162
|
-
return
|
|
1205
|
+
return git_str_joinpath(buf, buf->ptr, GIT_CONFIG_FILENAME_GLOBAL);
|
|
1163
1206
|
}
|
|
1164
1207
|
|
|
1165
1208
|
int git_config_open_default(git_config **out)
|
|
1166
1209
|
{
|
|
1167
1210
|
int error;
|
|
1168
1211
|
git_config *cfg = NULL;
|
|
1169
|
-
|
|
1212
|
+
git_str buf = GIT_STR_INIT;
|
|
1170
1213
|
|
|
1171
1214
|
if ((error = git_config_new(&cfg)) < 0)
|
|
1172
1215
|
return error;
|
|
1173
1216
|
|
|
1174
|
-
if (!
|
|
1217
|
+
if (!git_config__find_global(&buf) ||
|
|
1218
|
+
!git_config__global_location(&buf)) {
|
|
1175
1219
|
error = git_config_add_file_ondisk(cfg, buf.ptr,
|
|
1176
1220
|
GIT_CONFIG_LEVEL_GLOBAL, NULL, 0);
|
|
1177
1221
|
}
|
|
1178
1222
|
|
|
1179
|
-
if (!error && !
|
|
1223
|
+
if (!error && !git_config__find_xdg(&buf))
|
|
1180
1224
|
error = git_config_add_file_ondisk(cfg, buf.ptr,
|
|
1181
1225
|
GIT_CONFIG_LEVEL_XDG, NULL, 0);
|
|
1182
1226
|
|
|
1183
|
-
if (!error && !
|
|
1227
|
+
if (!error && !git_config__find_system(&buf))
|
|
1184
1228
|
error = git_config_add_file_ondisk(cfg, buf.ptr,
|
|
1185
1229
|
GIT_CONFIG_LEVEL_SYSTEM, NULL, 0);
|
|
1186
1230
|
|
|
1187
|
-
if (!error && !
|
|
1231
|
+
if (!error && !git_config__find_programdata(&buf))
|
|
1188
1232
|
error = git_config_add_file_ondisk(cfg, buf.ptr,
|
|
1189
1233
|
GIT_CONFIG_LEVEL_PROGRAMDATA, NULL, 0);
|
|
1190
1234
|
|
|
1191
|
-
|
|
1235
|
+
git_str_dispose(&buf);
|
|
1192
1236
|
|
|
1193
1237
|
if (error) {
|
|
1194
1238
|
git_config_free(cfg);
|
|
@@ -1382,28 +1426,6 @@ fail_parse:
|
|
|
1382
1426
|
return -1;
|
|
1383
1427
|
}
|
|
1384
1428
|
|
|
1385
|
-
int git_config_parse_path(git_buf *out, const char *value)
|
|
1386
|
-
{
|
|
1387
|
-
int error;
|
|
1388
|
-
|
|
1389
|
-
GIT_ASSERT_ARG(out);
|
|
1390
|
-
GIT_ASSERT_ARG(value);
|
|
1391
|
-
|
|
1392
|
-
if ((error = git_buf_sanitize(out)) < 0)
|
|
1393
|
-
return error;
|
|
1394
|
-
|
|
1395
|
-
if (value[0] == '~') {
|
|
1396
|
-
if (value[1] != '\0' && value[1] != '/') {
|
|
1397
|
-
git_error_set(GIT_ERROR_CONFIG, "retrieving a homedir by name is not supported");
|
|
1398
|
-
return -1;
|
|
1399
|
-
}
|
|
1400
|
-
|
|
1401
|
-
return git_sysdir_expand_global_file(out, value[1] ? &value[2] : NULL);
|
|
1402
|
-
}
|
|
1403
|
-
|
|
1404
|
-
return git_buf_sets(out, value);
|
|
1405
|
-
}
|
|
1406
|
-
|
|
1407
1429
|
static int normalize_section(char *start, char *end)
|
|
1408
1430
|
{
|
|
1409
1431
|
char *scan;
|
|
@@ -1466,7 +1488,7 @@ invalid:
|
|
|
1466
1488
|
|
|
1467
1489
|
struct rename_data {
|
|
1468
1490
|
git_config *config;
|
|
1469
|
-
|
|
1491
|
+
git_str *name;
|
|
1470
1492
|
size_t old_len;
|
|
1471
1493
|
};
|
|
1472
1494
|
|
|
@@ -1476,15 +1498,15 @@ static int rename_config_entries_cb(
|
|
|
1476
1498
|
{
|
|
1477
1499
|
int error = 0;
|
|
1478
1500
|
struct rename_data *data = (struct rename_data *)payload;
|
|
1479
|
-
size_t base_len =
|
|
1501
|
+
size_t base_len = git_str_len(data->name);
|
|
1480
1502
|
|
|
1481
1503
|
if (base_len > 0 &&
|
|
1482
|
-
!(error =
|
|
1504
|
+
!(error = git_str_puts(data->name, entry->name + data->old_len)))
|
|
1483
1505
|
{
|
|
1484
1506
|
error = git_config_set_string(
|
|
1485
|
-
data->config,
|
|
1507
|
+
data->config, git_str_cstr(data->name), entry->value);
|
|
1486
1508
|
|
|
1487
|
-
|
|
1509
|
+
git_str_truncate(data->name, base_len);
|
|
1488
1510
|
}
|
|
1489
1511
|
|
|
1490
1512
|
if (!error)
|
|
@@ -1499,13 +1521,13 @@ int git_config_rename_section(
|
|
|
1499
1521
|
const char *new_section_name)
|
|
1500
1522
|
{
|
|
1501
1523
|
git_config *config;
|
|
1502
|
-
|
|
1524
|
+
git_str pattern = GIT_STR_INIT, replace = GIT_STR_INIT;
|
|
1503
1525
|
int error = 0;
|
|
1504
1526
|
struct rename_data data;
|
|
1505
1527
|
|
|
1506
|
-
|
|
1528
|
+
git_str_puts_escape_regex(&pattern, old_section_name);
|
|
1507
1529
|
|
|
1508
|
-
if ((error =
|
|
1530
|
+
if ((error = git_str_puts(&pattern, "\\..+")) < 0)
|
|
1509
1531
|
goto cleanup;
|
|
1510
1532
|
|
|
1511
1533
|
if ((error = git_repository_config__weakptr(&config, repo)) < 0)
|
|
@@ -1515,7 +1537,7 @@ int git_config_rename_section(
|
|
|
1515
1537
|
data.name = &replace;
|
|
1516
1538
|
data.old_len = strlen(old_section_name) + 1;
|
|
1517
1539
|
|
|
1518
|
-
if ((error =
|
|
1540
|
+
if ((error = git_str_join(&replace, '.', new_section_name, "")) < 0)
|
|
1519
1541
|
goto cleanup;
|
|
1520
1542
|
|
|
1521
1543
|
if (new_section_name != NULL &&
|
|
@@ -1527,11 +1549,11 @@ int git_config_rename_section(
|
|
|
1527
1549
|
}
|
|
1528
1550
|
|
|
1529
1551
|
error = git_config_foreach_match(
|
|
1530
|
-
config,
|
|
1552
|
+
config, git_str_cstr(&pattern), rename_config_entries_cb, &data);
|
|
1531
1553
|
|
|
1532
1554
|
cleanup:
|
|
1533
|
-
|
|
1534
|
-
|
|
1555
|
+
git_str_dispose(&pattern);
|
|
1556
|
+
git_str_dispose(&replace);
|
|
1535
1557
|
|
|
1536
1558
|
return error;
|
|
1537
1559
|
}
|
data/vendor/libgit2/src/config.h
CHANGED
|
@@ -27,7 +27,12 @@ struct git_config {
|
|
|
27
27
|
git_vector backends;
|
|
28
28
|
};
|
|
29
29
|
|
|
30
|
-
extern int git_config__global_location(
|
|
30
|
+
extern int git_config__global_location(git_str *buf);
|
|
31
|
+
|
|
32
|
+
extern int git_config__find_global(git_str *path);
|
|
33
|
+
extern int git_config__find_xdg(git_str *path);
|
|
34
|
+
extern int git_config__find_system(git_str *path);
|
|
35
|
+
extern int git_config__find_programdata(git_str *path);
|
|
31
36
|
|
|
32
37
|
extern int git_config_rename_section(
|
|
33
38
|
git_repository *repo,
|
|
@@ -51,6 +56,14 @@ extern int git_config__update_entry(
|
|
|
51
56
|
bool overwrite_existing,
|
|
52
57
|
bool only_if_existing);
|
|
53
58
|
|
|
59
|
+
int git_config__get_path(
|
|
60
|
+
git_str *out,
|
|
61
|
+
const git_config *cfg,
|
|
62
|
+
const char *name);
|
|
63
|
+
|
|
64
|
+
int git_config__get_string_buf(
|
|
65
|
+
git_str *out, const git_config *cfg, const char *name);
|
|
66
|
+
|
|
54
67
|
/*
|
|
55
68
|
* Lookup functions that cannot fail. These functions look up a config
|
|
56
69
|
* value and return a fallback value if the value is missing or if any
|
|
@@ -83,7 +96,7 @@ int git_config_lookup_map_enum(git_configmap_t *type_out,
|
|
|
83
96
|
/**
|
|
84
97
|
* Unlock the backend with the highest priority
|
|
85
98
|
*
|
|
86
|
-
* Unlocking will allow other writers to
|
|
99
|
+
* Unlocking will allow other writers to update the configuration
|
|
87
100
|
* file. Optionally, any changes performed since the lock will be
|
|
88
101
|
* applied to the configuration.
|
|
89
102
|
*
|