rugged 1.3.1 → 1.9.0
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/README.md +34 -2
- data/ext/rugged/extconf.rb +6 -3
- data/ext/rugged/rugged.c +16 -0
- data/ext/rugged/rugged.h +4 -0
- data/ext/rugged/rugged_allocator.c +0 -54
- data/ext/rugged/rugged_blame.c +2 -0
- data/ext/rugged/rugged_blob.c +3 -0
- data/ext/rugged/rugged_commit.c +1 -0
- data/ext/rugged/rugged_config.c +9 -2
- data/ext/rugged/rugged_diff.c +1 -0
- data/ext/rugged/rugged_index.c +2 -0
- data/ext/rugged/rugged_patch.c +1 -0
- data/ext/rugged/rugged_rebase.c +1 -0
- data/ext/rugged/rugged_reference.c +1 -0
- data/ext/rugged/rugged_remote.c +28 -10
- data/ext/rugged/rugged_repo.c +7 -9
- data/ext/rugged/rugged_revwalk.c +5 -1
- data/ext/rugged/rugged_settings.c +5 -0
- data/ext/rugged/rugged_submodule.c +1 -0
- data/ext/rugged/rugged_tag.c +1 -0
- data/ext/rugged/rugged_tree.c +4 -0
- data/lib/rugged/index.rb +1 -1
- data/lib/rugged/tree.rb +5 -1
- data/lib/rugged/version.rb +1 -1
- data/vendor/libgit2/AUTHORS +1 -0
- data/vendor/libgit2/CMakeLists.txt +141 -289
- data/vendor/libgit2/COPYING +301 -20
- data/vendor/libgit2/cmake/AddCFlagIfSupported.cmake +21 -21
- data/vendor/libgit2/cmake/AddClarTest.cmake +7 -0
- data/vendor/libgit2/cmake/CheckPrototypeDefinitionSafe.cmake +16 -0
- data/vendor/libgit2/cmake/DefaultCFlags.cmake +154 -0
- data/vendor/libgit2/cmake/EnableWarnings.cmake +13 -13
- data/vendor/libgit2/cmake/ExperimentalFeatures.cmake +23 -0
- 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 +17 -17
- data/vendor/libgit2/cmake/FindIntlIconv.cmake +51 -0
- data/vendor/libgit2/cmake/FindLLHTTP.cmake +39 -0
- data/vendor/libgit2/cmake/FindLibSSH2.cmake +5 -5
- data/vendor/libgit2/cmake/FindPCRE.cmake +12 -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 +34 -0
- data/vendor/libgit2/cmake/SelectHTTPSBackend.cmake +129 -101
- data/vendor/libgit2/cmake/SelectHashes.cmake +113 -54
- data/vendor/libgit2/cmake/SelectRegex.cmake +56 -0
- data/vendor/libgit2/cmake/SelectSSH.cmake +46 -0
- data/vendor/libgit2/cmake/SelectXdiff.cmake +9 -0
- data/vendor/libgit2/cmake/SelectZlib.cmake +38 -0
- data/vendor/libgit2/deps/chromium-zlib/CMakeLists.txt +6 -6
- data/vendor/libgit2/deps/llhttp/CMakeLists.txt +8 -0
- data/vendor/libgit2/deps/llhttp/LICENSE-MIT +22 -0
- data/vendor/libgit2/deps/llhttp/api.c +510 -0
- data/vendor/libgit2/deps/llhttp/http.c +170 -0
- data/vendor/libgit2/deps/llhttp/llhttp.c +10168 -0
- data/vendor/libgit2/deps/llhttp/llhttp.h +897 -0
- data/vendor/libgit2/deps/ntlmclient/CMakeLists.txt +33 -31
- data/vendor/libgit2/deps/ntlmclient/crypt_builtin_md4.c +311 -0
- data/vendor/libgit2/deps/ntlmclient/crypt_commoncrypto.c +2 -1
- data/vendor/libgit2/deps/ntlmclient/crypt_mbedtls.c +0 -20
- data/vendor/libgit2/deps/ntlmclient/crypt_openssl.c +7 -5
- data/vendor/libgit2/deps/ntlmclient/ntlm.c +25 -25
- data/vendor/libgit2/deps/ntlmclient/ntlm.h +4 -4
- data/vendor/libgit2/deps/ntlmclient/ntlmclient.h +2 -2
- data/vendor/libgit2/deps/ntlmclient/unicode_builtin.c +5 -4
- data/vendor/libgit2/deps/ntlmclient/unicode_iconv.c +2 -1
- data/vendor/libgit2/deps/ntlmclient/utf8.h +1176 -721
- data/vendor/libgit2/deps/ntlmclient/util.h +11 -0
- data/vendor/libgit2/deps/pcre/CMakeLists.txt +89 -88
- data/vendor/libgit2/deps/pcre/LICENCE +5 -5
- data/vendor/libgit2/deps/pcre/pcre.h +2 -2
- data/vendor/libgit2/deps/pcre/pcre_compile.c +6 -3
- data/vendor/libgit2/deps/pcre/pcre_exec.c +2 -2
- data/vendor/libgit2/deps/winhttp/CMakeLists.txt +14 -16
- data/vendor/libgit2/deps/xdiff/CMakeLists.txt +28 -0
- data/vendor/libgit2/deps/xdiff/git-xdiff.h +56 -0
- data/vendor/libgit2/{src → deps}/xdiff/xdiff.h +15 -15
- data/vendor/libgit2/{src → deps}/xdiff/xdiffi.c +152 -125
- data/vendor/libgit2/{src → deps}/xdiff/xdiffi.h +2 -4
- data/vendor/libgit2/{src → deps}/xdiff/xemit.c +26 -10
- data/vendor/libgit2/{src → deps}/xdiff/xhistogram.c +92 -94
- data/vendor/libgit2/{src → deps}/xdiff/xinclude.h +1 -12
- data/vendor/libgit2/{src → deps}/xdiff/xmacros.h +18 -1
- data/vendor/libgit2/{src → deps}/xdiff/xmerge.c +126 -137
- data/vendor/libgit2/{src → deps}/xdiff/xpatience.c +26 -46
- data/vendor/libgit2/{src → deps}/xdiff/xprepare.c +24 -46
- data/vendor/libgit2/{src → deps}/xdiff/xutils.c +36 -8
- data/vendor/libgit2/{src → deps}/xdiff/xutils.h +2 -1
- data/vendor/libgit2/deps/zlib/CMakeLists.txt +6 -1
- data/vendor/libgit2/deps/zlib/LICENSE +22 -0
- data/vendor/libgit2/deps/zlib/adler32.c +7 -22
- data/vendor/libgit2/deps/zlib/crc32.c +931 -317
- data/vendor/libgit2/deps/zlib/crc32.h +9441 -436
- data/vendor/libgit2/deps/zlib/deflate.c +428 -453
- data/vendor/libgit2/deps/zlib/deflate.h +51 -23
- data/vendor/libgit2/deps/zlib/gzguts.h +15 -19
- data/vendor/libgit2/deps/zlib/infback.c +19 -31
- data/vendor/libgit2/deps/zlib/inffast.c +15 -18
- data/vendor/libgit2/deps/zlib/inffast.h +1 -1
- data/vendor/libgit2/deps/zlib/inflate.c +75 -110
- data/vendor/libgit2/deps/zlib/inflate.h +3 -2
- data/vendor/libgit2/deps/zlib/inftrees.c +6 -11
- data/vendor/libgit2/deps/zlib/inftrees.h +6 -6
- data/vendor/libgit2/deps/zlib/trees.c +294 -380
- data/vendor/libgit2/deps/zlib/zconf.h +23 -14
- data/vendor/libgit2/deps/zlib/zlib.h +310 -284
- data/vendor/libgit2/deps/zlib/zutil.c +20 -46
- data/vendor/libgit2/deps/zlib/zutil.h +24 -41
- data/vendor/libgit2/include/git2/annotated_commit.h +12 -5
- data/vendor/libgit2/include/git2/apply.h +43 -8
- data/vendor/libgit2/include/git2/attr.h +28 -6
- data/vendor/libgit2/include/git2/blame.h +137 -29
- data/vendor/libgit2/include/git2/blob.h +85 -29
- data/vendor/libgit2/include/git2/branch.h +25 -16
- data/vendor/libgit2/include/git2/buffer.h +24 -82
- data/vendor/libgit2/include/git2/cert.h +4 -3
- data/vendor/libgit2/include/git2/checkout.h +88 -34
- data/vendor/libgit2/include/git2/cherrypick.h +10 -3
- data/vendor/libgit2/include/git2/clone.h +28 -12
- data/vendor/libgit2/include/git2/commit.h +134 -3
- data/vendor/libgit2/include/git2/common.h +172 -59
- data/vendor/libgit2/include/git2/config.h +118 -32
- data/vendor/libgit2/include/git2/credential.h +32 -3
- data/vendor/libgit2/include/git2/credential_helpers.h +2 -0
- data/vendor/libgit2/include/git2/deprecated.h +141 -3
- data/vendor/libgit2/include/git2/describe.h +20 -3
- data/vendor/libgit2/include/git2/diff.h +95 -19
- data/vendor/libgit2/include/git2/email.h +10 -30
- data/vendor/libgit2/include/git2/errors.h +51 -61
- data/vendor/libgit2/include/git2/experimental.h +20 -0
- data/vendor/libgit2/include/git2/filter.h +21 -9
- data/vendor/libgit2/include/git2/global.h +8 -1
- data/vendor/libgit2/include/git2/graph.h +4 -2
- data/vendor/libgit2/include/git2/ignore.h +11 -1
- data/vendor/libgit2/include/git2/index.h +111 -11
- data/vendor/libgit2/include/git2/indexer.h +67 -2
- data/vendor/libgit2/include/git2/mailmap.h +7 -1
- data/vendor/libgit2/include/git2/merge.h +70 -5
- data/vendor/libgit2/include/git2/message.h +4 -2
- data/vendor/libgit2/include/git2/net.h +3 -1
- data/vendor/libgit2/include/git2/notes.h +9 -6
- data/vendor/libgit2/include/git2/object.h +57 -7
- data/vendor/libgit2/include/git2/odb.h +156 -33
- data/vendor/libgit2/include/git2/odb_backend.h +132 -16
- data/vendor/libgit2/include/git2/oid.h +116 -17
- data/vendor/libgit2/include/git2/oidarray.h +7 -1
- data/vendor/libgit2/include/git2/pack.h +37 -9
- data/vendor/libgit2/include/git2/patch.h +10 -3
- data/vendor/libgit2/include/git2/pathspec.h +10 -1
- data/vendor/libgit2/include/git2/proxy.h +11 -1
- data/vendor/libgit2/include/git2/rebase.h +18 -7
- data/vendor/libgit2/include/git2/refdb.h +5 -2
- data/vendor/libgit2/include/git2/reflog.h +4 -3
- data/vendor/libgit2/include/git2/refs.h +11 -8
- data/vendor/libgit2/include/git2/refspec.h +14 -4
- data/vendor/libgit2/include/git2/remote.h +295 -54
- data/vendor/libgit2/include/git2/repository.h +95 -25
- data/vendor/libgit2/include/git2/reset.h +18 -5
- data/vendor/libgit2/include/git2/revert.h +9 -4
- data/vendor/libgit2/include/git2/revparse.h +4 -4
- data/vendor/libgit2/include/git2/revwalk.h +7 -3
- data/vendor/libgit2/include/git2/signature.h +47 -2
- data/vendor/libgit2/include/git2/stash.h +78 -10
- data/vendor/libgit2/include/git2/status.h +24 -11
- data/vendor/libgit2/include/git2/stdint.h +87 -85
- data/vendor/libgit2/include/git2/strarray.h +2 -16
- data/vendor/libgit2/include/git2/submodule.h +27 -11
- data/vendor/libgit2/include/git2/sys/alloc.h +12 -34
- data/vendor/libgit2/include/git2/sys/commit.h +77 -3
- data/vendor/libgit2/include/git2/sys/commit_graph.h +110 -59
- data/vendor/libgit2/include/git2/sys/config.h +80 -4
- data/vendor/libgit2/include/git2/sys/credential.h +4 -3
- data/vendor/libgit2/include/git2/sys/diff.h +21 -1
- data/vendor/libgit2/include/git2/sys/email.h +7 -0
- data/vendor/libgit2/include/git2/sys/errors.h +76 -0
- data/vendor/libgit2/include/git2/sys/filter.h +66 -3
- data/vendor/libgit2/include/git2/sys/hashsig.h +11 -0
- data/vendor/libgit2/include/git2/sys/index.h +3 -2
- data/vendor/libgit2/include/git2/sys/mempack.h +32 -2
- data/vendor/libgit2/include/git2/sys/merge.h +55 -7
- data/vendor/libgit2/include/git2/sys/midx.h +47 -4
- data/vendor/libgit2/include/git2/sys/odb_backend.h +10 -9
- data/vendor/libgit2/include/git2/sys/openssl.h +8 -1
- data/vendor/libgit2/include/git2/sys/path.h +12 -1
- data/vendor/libgit2/include/git2/sys/refdb_backend.h +40 -36
- data/vendor/libgit2/include/git2/sys/refs.h +3 -2
- data/vendor/libgit2/include/git2/sys/remote.h +53 -0
- data/vendor/libgit2/include/git2/sys/repository.h +63 -3
- data/vendor/libgit2/include/git2/sys/stream.h +26 -3
- data/vendor/libgit2/include/git2/sys/transport.h +87 -41
- data/vendor/libgit2/include/git2/tag.h +4 -1
- data/vendor/libgit2/include/git2/trace.h +9 -3
- data/vendor/libgit2/include/git2/transaction.h +3 -2
- data/vendor/libgit2/include/git2/transport.h +11 -3
- data/vendor/libgit2/include/git2/tree.h +20 -8
- data/vendor/libgit2/include/git2/types.h +26 -10
- data/vendor/libgit2/include/git2/version.h +63 -6
- data/vendor/libgit2/include/git2/worktree.h +30 -8
- data/vendor/libgit2/include/git2.h +1 -0
- data/vendor/libgit2/src/CMakeLists.txt +203 -420
- data/vendor/libgit2/src/README.md +12 -0
- data/vendor/libgit2/src/cli/CMakeLists.txt +56 -0
- data/vendor/libgit2/src/cli/README.md +26 -0
- data/vendor/libgit2/src/{branch.h → cli/cmd.c} +10 -8
- data/vendor/libgit2/src/cli/cmd.h +37 -0
- data/vendor/libgit2/src/cli/cmd_blame.c +287 -0
- data/vendor/libgit2/src/cli/cmd_cat_file.c +202 -0
- data/vendor/libgit2/src/cli/cmd_clone.c +190 -0
- data/vendor/libgit2/src/cli/cmd_config.c +241 -0
- data/vendor/libgit2/src/cli/cmd_hash_object.c +152 -0
- data/vendor/libgit2/src/cli/cmd_help.c +85 -0
- data/vendor/libgit2/src/cli/cmd_index_pack.c +114 -0
- data/vendor/libgit2/src/cli/cmd_init.c +102 -0
- data/vendor/libgit2/src/cli/common.c +168 -0
- data/vendor/libgit2/src/cli/common.h +63 -0
- data/vendor/libgit2/src/cli/error.h +51 -0
- data/vendor/libgit2/src/cli/main.c +134 -0
- data/vendor/libgit2/src/cli/opt.c +695 -0
- data/vendor/libgit2/src/cli/opt.h +367 -0
- data/vendor/libgit2/src/cli/opt_usage.c +263 -0
- data/vendor/libgit2/src/cli/opt_usage.h +40 -0
- data/vendor/libgit2/src/cli/progress.c +395 -0
- data/vendor/libgit2/src/cli/progress.h +129 -0
- data/vendor/libgit2/src/cli/sighandler.h +20 -0
- data/vendor/libgit2/src/cli/unix/sighandler.c +37 -0
- data/vendor/libgit2/src/cli/win32/precompiled.h +3 -0
- data/vendor/libgit2/src/cli/win32/sighandler.c +37 -0
- data/vendor/libgit2/src/libgit2/CMakeLists.txt +140 -0
- data/vendor/libgit2/src/{annotated_commit.c → libgit2/annotated_commit.c} +2 -2
- data/vendor/libgit2/src/{annotated_commit.h → libgit2/annotated_commit.h} +2 -2
- data/vendor/libgit2/src/{apply.c → libgit2/apply.c} +32 -34
- data/vendor/libgit2/src/{apply.h → libgit2/apply.h} +2 -2
- data/vendor/libgit2/src/{attr.c → libgit2/attr.c} +48 -31
- data/vendor/libgit2/src/{attr_file.c → libgit2/attr_file.c} +25 -20
- data/vendor/libgit2/src/{attr_file.h → libgit2/attr_file.h} +6 -4
- data/vendor/libgit2/src/{attrcache.c → libgit2/attrcache.c} +87 -46
- data/vendor/libgit2/src/{attrcache.h → libgit2/attrcache.h} +5 -9
- data/vendor/libgit2/src/{blame.c → libgit2/blame.c} +152 -57
- data/vendor/libgit2/src/{blame.h → libgit2/blame.h} +1 -0
- data/vendor/libgit2/src/{blame_git.c → libgit2/blame_git.c} +1 -2
- data/vendor/libgit2/src/{blob.c → libgit2/blob.c} +38 -29
- data/vendor/libgit2/src/{blob.h → libgit2/blob.h} +3 -3
- data/vendor/libgit2/src/{branch.c → libgit2/branch.c} +164 -118
- data/vendor/libgit2/src/libgit2/branch.h +31 -0
- data/vendor/libgit2/src/libgit2/buf.c +126 -0
- data/vendor/libgit2/src/libgit2/buf.h +50 -0
- data/vendor/libgit2/src/{cache.c → libgit2/cache.c} +22 -17
- data/vendor/libgit2/src/{cache.h → libgit2/cache.h} +7 -9
- data/vendor/libgit2/src/{checkout.c → libgit2/checkout.c} +107 -91
- data/vendor/libgit2/src/{checkout.h → libgit2/checkout.h} +0 -2
- data/vendor/libgit2/src/{cherrypick.c → libgit2/cherrypick.c} +14 -15
- data/vendor/libgit2/src/{clone.c → libgit2/clone.c} +254 -203
- data/vendor/libgit2/src/{clone.h → libgit2/clone.h} +4 -1
- data/vendor/libgit2/src/{commit.c → libgit2/commit.c} +296 -77
- data/vendor/libgit2/src/libgit2/commit.h +87 -0
- data/vendor/libgit2/src/{commit_graph.c → libgit2/commit_graph.c} +246 -135
- data/vendor/libgit2/src/{commit_graph.h → libgit2/commit_graph.h} +33 -8
- data/vendor/libgit2/src/{commit_list.c → libgit2/commit_list.c} +17 -7
- data/vendor/libgit2/src/{commit_list.h → libgit2/commit_list.h} +1 -0
- data/vendor/libgit2/src/libgit2/common.h +55 -0
- data/vendor/libgit2/src/{config.c → libgit2/config.c} +490 -360
- data/vendor/libgit2/src/libgit2/config.cmake.in +3 -0
- data/vendor/libgit2/src/{config.h → libgit2/config.h} +24 -6
- data/vendor/libgit2/src/{config_backend.h → libgit2/config_backend.h} +8 -10
- data/vendor/libgit2/src/{config_cache.c → libgit2/config_cache.c} +4 -5
- data/vendor/libgit2/src/{config_file.c → libgit2/config_file.c} +212 -183
- data/vendor/libgit2/src/libgit2/config_list.c +285 -0
- data/vendor/libgit2/src/libgit2/config_list.h +32 -0
- data/vendor/libgit2/src/libgit2/config_mem.c +374 -0
- data/vendor/libgit2/src/{config_parse.c → libgit2/config_parse.c} +37 -32
- data/vendor/libgit2/src/{config_snapshot.c → libgit2/config_snapshot.c} +24 -31
- data/vendor/libgit2/src/{crlf.c → libgit2/crlf.c} +24 -21
- data/vendor/libgit2/src/{describe.c → libgit2/describe.c} +62 -51
- data/vendor/libgit2/src/{diff.c → libgit2/diff.c} +44 -14
- data/vendor/libgit2/src/{diff.h → libgit2/diff.h} +8 -10
- data/vendor/libgit2/src/{diff_driver.c → libgit2/diff_driver.c} +46 -55
- data/vendor/libgit2/src/{diff_driver.h → libgit2/diff_driver.h} +5 -5
- data/vendor/libgit2/src/{diff_file.c → libgit2/diff_file.c} +45 -27
- data/vendor/libgit2/src/{diff_generate.c → libgit2/diff_generate.c} +70 -20
- data/vendor/libgit2/src/{diff_generate.h → libgit2/diff_generate.h} +5 -3
- data/vendor/libgit2/src/{diff_parse.c → libgit2/diff_parse.c} +22 -6
- data/vendor/libgit2/src/{diff_print.c → libgit2/diff_print.c} +192 -105
- data/vendor/libgit2/src/{diff_stats.c → libgit2/diff_stats.c} +40 -29
- data/vendor/libgit2/src/libgit2/diff_stats.h +18 -0
- data/vendor/libgit2/src/{diff_tform.c → libgit2/diff_tform.c} +49 -16
- data/vendor/libgit2/src/{diff_xdiff.c → libgit2/diff_xdiff.c} +4 -8
- data/vendor/libgit2/src/{diff_xdiff.h → libgit2/diff_xdiff.h} +1 -1
- data/vendor/libgit2/src/{email.c → libgit2/email.c} +58 -40
- data/vendor/libgit2/src/{email.h → libgit2/email.h} +1 -1
- data/vendor/libgit2/src/{transports/ssh.h → libgit2/experimental.h.in} +3 -4
- data/vendor/libgit2/src/{fetch.c → libgit2/fetch.c} +105 -30
- data/vendor/libgit2/src/{fetch.h → libgit2/fetch.h} +1 -3
- data/vendor/libgit2/src/{fetchhead.c → libgit2/fetchhead.c} +30 -28
- data/vendor/libgit2/src/{filter.c → libgit2/filter.c} +132 -58
- data/vendor/libgit2/src/{filter.h → libgit2/filter.h} +26 -5
- data/vendor/libgit2/src/{win32 → libgit2}/git2.rc +3 -3
- data/vendor/libgit2/src/libgit2/grafts.c +270 -0
- data/vendor/libgit2/src/libgit2/grafts.h +35 -0
- data/vendor/libgit2/src/{graph.c → libgit2/graph.c} +1 -1
- data/vendor/libgit2/src/libgit2/hashmap_oid.h +30 -0
- data/vendor/libgit2/src/{ident.c → libgit2/ident.c} +20 -20
- data/vendor/libgit2/src/{ignore.c → libgit2/ignore.c} +44 -39
- data/vendor/libgit2/src/{ignore.h → libgit2/ignore.h} +2 -2
- data/vendor/libgit2/src/{index.c → libgit2/index.c} +460 -276
- data/vendor/libgit2/src/{index.h → libgit2/index.h} +21 -5
- data/vendor/libgit2/src/libgit2/index_map.c +95 -0
- data/vendor/libgit2/src/libgit2/index_map.h +28 -0
- data/vendor/libgit2/src/{indexer.c → libgit2/indexer.c} +208 -124
- data/vendor/libgit2/src/{iterator.c → libgit2/iterator.c} +102 -71
- data/vendor/libgit2/src/{iterator.h → libgit2/iterator.h} +8 -5
- data/vendor/libgit2/src/libgit2/libgit2.c +268 -0
- data/vendor/libgit2/src/{mailmap.c → libgit2/mailmap.c} +39 -37
- data/vendor/libgit2/src/{merge.c → libgit2/merge.c} +83 -73
- data/vendor/libgit2/src/{merge.h → libgit2/merge.h} +1 -14
- data/vendor/libgit2/src/{merge_driver.c → libgit2/merge_driver.c} +4 -4
- data/vendor/libgit2/src/{merge_file.c → libgit2/merge_file.c} +13 -5
- data/vendor/libgit2/src/{message.c → libgit2/message.c} +21 -10
- data/vendor/libgit2/src/{midx.c → libgit2/midx.c} +174 -112
- data/vendor/libgit2/src/{midx.h → libgit2/midx.h} +17 -6
- data/vendor/libgit2/src/{mwindow.c → libgit2/mwindow.c} +53 -57
- data/vendor/libgit2/src/{mwindow.h → libgit2/mwindow.h} +9 -2
- data/vendor/libgit2/src/{notes.c → libgit2/notes.c} +29 -37
- data/vendor/libgit2/src/{object.c → libgit2/object.c} +166 -35
- data/vendor/libgit2/src/{object.h → libgit2/object.h} +17 -2
- data/vendor/libgit2/src/{odb.c → libgit2/odb.c} +261 -88
- data/vendor/libgit2/src/{odb.h → libgit2/odb.h} +44 -5
- data/vendor/libgit2/src/{odb_loose.c → libgit2/odb_loose.c} +192 -134
- data/vendor/libgit2/src/{odb_mempack.c → libgit2/odb_mempack.c} +67 -22
- data/vendor/libgit2/src/{odb_pack.c → libgit2/odb_pack.c} +162 -89
- data/vendor/libgit2/src/{oid.c → libgit2/oid.c} +171 -92
- data/vendor/libgit2/src/libgit2/oid.h +284 -0
- data/vendor/libgit2/src/libgit2/oidarray.c +89 -0
- data/vendor/libgit2/src/{oidarray.h → libgit2/oidarray.h} +5 -1
- data/vendor/libgit2/src/{pack-objects.c → libgit2/pack-objects.c} +126 -66
- data/vendor/libgit2/src/{pack-objects.h → libgit2/pack-objects.h} +28 -12
- data/vendor/libgit2/src/{pack.c → libgit2/pack.c} +146 -111
- data/vendor/libgit2/src/{pack.h → libgit2/pack.h} +45 -25
- data/vendor/libgit2/src/{parse.c → libgit2/parse.c} +8 -4
- data/vendor/libgit2/src/{parse.h → libgit2/parse.h} +1 -1
- data/vendor/libgit2/src/{patch.c → libgit2/patch.c} +3 -3
- data/vendor/libgit2/src/{patch.h → libgit2/patch.h} +8 -1
- data/vendor/libgit2/src/{patch_generate.c → libgit2/patch_generate.c} +51 -16
- data/vendor/libgit2/src/{patch_generate.h → libgit2/patch_generate.h} +5 -5
- data/vendor/libgit2/src/{patch_parse.c → libgit2/patch_parse.c} +42 -34
- data/vendor/libgit2/src/libgit2/path.c +375 -0
- data/vendor/libgit2/src/libgit2/path.h +68 -0
- data/vendor/libgit2/src/{pathspec.c → libgit2/pathspec.c} +7 -7
- data/vendor/libgit2/src/{pathspec.h → libgit2/pathspec.h} +2 -2
- data/vendor/libgit2/src/{proxy.c → libgit2/proxy.c} +4 -1
- data/vendor/libgit2/src/{proxy.h → libgit2/proxy.h} +1 -1
- data/vendor/libgit2/src/{push.c → libgit2/push.c} +116 -60
- data/vendor/libgit2/src/{push.h → libgit2/push.h} +5 -16
- data/vendor/libgit2/src/{reader.c → libgit2/reader.c} +9 -9
- data/vendor/libgit2/src/{reader.h → libgit2/reader.h} +2 -2
- data/vendor/libgit2/src/{rebase.c → libgit2/rebase.c} +147 -147
- data/vendor/libgit2/src/{refdb_fs.c → libgit2/refdb_fs.c} +639 -254
- data/vendor/libgit2/src/{reflog.c → libgit2/reflog.c} +8 -7
- data/vendor/libgit2/src/{reflog.h → libgit2/reflog.h} +3 -2
- data/vendor/libgit2/src/{refs.c → libgit2/refs.c} +67 -39
- data/vendor/libgit2/src/{refs.h → libgit2/refs.h} +8 -3
- data/vendor/libgit2/src/{refspec.c → libgit2/refspec.c} +60 -38
- data/vendor/libgit2/src/{refspec.h → libgit2/refspec.h} +13 -2
- data/vendor/libgit2/src/{remote.c → libgit2/remote.c} +821 -454
- data/vendor/libgit2/src/libgit2/remote.h +101 -0
- data/vendor/libgit2/src/{repository.c → libgit2/repository.c} +1377 -594
- data/vendor/libgit2/src/{repository.h → libgit2/repository.h} +43 -12
- data/vendor/libgit2/src/{reset.c → libgit2/reset.c} +8 -5
- data/vendor/libgit2/src/{revert.c → libgit2/revert.c} +18 -22
- data/vendor/libgit2/src/{revparse.c → libgit2/revparse.c} +76 -44
- data/vendor/libgit2/src/{revwalk.c → libgit2/revwalk.c} +48 -19
- data/vendor/libgit2/src/{revwalk.h → libgit2/revwalk.h} +3 -3
- data/vendor/libgit2/src/{libgit2.c → libgit2/settings.c} +162 -95
- data/vendor/libgit2/src/{settings.h → libgit2/settings.h} +6 -2
- data/vendor/libgit2/src/{signature.c → libgit2/signature.c} +144 -21
- data/vendor/libgit2/src/{signature.h → libgit2/signature.h} +1 -2
- data/vendor/libgit2/src/{stash.c → libgit2/stash.c} +243 -68
- data/vendor/libgit2/src/{status.c → libgit2/status.c} +5 -2
- data/vendor/libgit2/src/{strarray.c → libgit2/strarray.c} +1 -0
- data/vendor/libgit2/src/libgit2/strarray.h +25 -0
- data/vendor/libgit2/src/{streams → libgit2/streams}/mbedtls.c +62 -67
- data/vendor/libgit2/src/{streams → libgit2/streams}/openssl.c +41 -24
- data/vendor/libgit2/src/{streams → libgit2/streams}/openssl.h +2 -0
- data/vendor/libgit2/src/{streams → libgit2/streams}/openssl_dynamic.c +11 -3
- data/vendor/libgit2/src/{streams → libgit2/streams}/openssl_dynamic.h +6 -3
- data/vendor/libgit2/src/libgit2/streams/schannel.c +715 -0
- data/vendor/libgit2/src/libgit2/streams/schannel.h +28 -0
- data/vendor/libgit2/src/libgit2/streams/socket.c +428 -0
- data/vendor/libgit2/src/{streams → libgit2/streams}/socket.h +3 -1
- data/vendor/libgit2/src/{streams → libgit2/streams}/stransport.c +79 -19
- data/vendor/libgit2/src/{streams → libgit2/streams}/tls.c +5 -0
- data/vendor/libgit2/src/{submodule.c → libgit2/submodule.c} +279 -220
- data/vendor/libgit2/src/{submodule.h → libgit2/submodule.h} +10 -11
- data/vendor/libgit2/src/libgit2/sysdir.c +650 -0
- data/vendor/libgit2/src/{sysdir.h → libgit2/sysdir.h} +55 -18
- data/vendor/libgit2/src/{tag.c → libgit2/tag.c} +74 -43
- data/vendor/libgit2/src/{tag.h → libgit2/tag.h} +2 -2
- data/vendor/libgit2/src/{trace.c → libgit2/trace.c} +1 -14
- data/vendor/libgit2/src/{trace.h → libgit2/trace.h} +5 -22
- data/vendor/libgit2/src/{trailer.c → libgit2/trailer.c} +7 -7
- data/vendor/libgit2/src/{transaction.c → libgit2/transaction.c} +27 -21
- data/vendor/libgit2/src/{transaction.h → libgit2/transaction.h} +4 -1
- data/vendor/libgit2/src/{transport.c → libgit2/transport.c} +14 -11
- data/vendor/libgit2/src/{transports → libgit2/transports}/auth.c +7 -9
- data/vendor/libgit2/src/{transports → libgit2/transports}/auth.h +3 -5
- data/vendor/libgit2/src/{transports/auth_negotiate.c → libgit2/transports/auth_gssapi.c} +44 -45
- data/vendor/libgit2/src/{transports → libgit2/transports}/auth_negotiate.h +1 -1
- data/vendor/libgit2/src/{transports → libgit2/transports}/auth_ntlm.h +1 -2
- data/vendor/libgit2/src/{transports/auth_ntlm.c → libgit2/transports/auth_ntlmclient.c} +22 -22
- data/vendor/libgit2/src/libgit2/transports/auth_sspi.c +341 -0
- data/vendor/libgit2/src/{transports → libgit2/transports}/credential.c +1 -1
- data/vendor/libgit2/src/{transports → libgit2/transports}/git.c +16 -19
- data/vendor/libgit2/src/{transports → libgit2/transports}/http.c +49 -24
- data/vendor/libgit2/src/{transports → libgit2/transports}/http.h +0 -11
- data/vendor/libgit2/src/{transports → libgit2/transports}/httpclient.c +188 -134
- data/vendor/libgit2/src/{transports → libgit2/transports}/httpclient.h +10 -0
- data/vendor/libgit2/src/libgit2/transports/httpparser.c +128 -0
- data/vendor/libgit2/src/libgit2/transports/httpparser.h +99 -0
- data/vendor/libgit2/src/{transports → libgit2/transports}/local.c +159 -127
- data/vendor/libgit2/src/{transports → libgit2/transports}/smart.c +142 -165
- data/vendor/libgit2/src/{transports → libgit2/transports}/smart.h +56 -36
- data/vendor/libgit2/src/{transports → libgit2/transports}/smart_pkt.c +307 -74
- data/vendor/libgit2/src/{transports → libgit2/transports}/smart_protocol.c +297 -97
- data/vendor/libgit2/src/libgit2/transports/ssh.c +85 -0
- data/vendor/libgit2/src/libgit2/transports/ssh_exec.c +347 -0
- data/vendor/libgit2/src/libgit2/transports/ssh_exec.h +26 -0
- data/vendor/libgit2/src/{transports/ssh.c → libgit2/transports/ssh_libssh2.c} +414 -268
- data/vendor/libgit2/src/libgit2/transports/ssh_libssh2.h +28 -0
- data/vendor/libgit2/src/{transports → libgit2/transports}/winhttp.c +101 -75
- data/vendor/libgit2/src/{tree-cache.c → libgit2/tree-cache.c} +30 -20
- data/vendor/libgit2/src/{tree-cache.h → libgit2/tree-cache.h} +7 -5
- data/vendor/libgit2/src/{tree.c → libgit2/tree.c} +128 -110
- data/vendor/libgit2/src/{tree.h → libgit2/tree.h} +7 -6
- data/vendor/libgit2/src/{worktree.c → libgit2/worktree.c} +160 -121
- data/vendor/libgit2/src/{worktree.h → libgit2/worktree.h} +1 -1
- data/vendor/libgit2/src/util/CMakeLists.txt +77 -0
- data/vendor/libgit2/src/{alloc.c → util/alloc.c} +69 -7
- data/vendor/libgit2/src/util/alloc.h +65 -0
- data/vendor/libgit2/src/util/allocators/debugalloc.c +73 -0
- data/vendor/libgit2/src/util/allocators/debugalloc.h +17 -0
- data/vendor/libgit2/src/util/allocators/failalloc.c +32 -0
- data/vendor/libgit2/src/util/allocators/failalloc.h +17 -0
- data/vendor/libgit2/src/util/allocators/stdalloc.c +37 -0
- data/vendor/libgit2/src/{allocators → util/allocators}/stdalloc.h +1 -1
- data/vendor/libgit2/src/util/allocators/win32_leakcheck.c +50 -0
- data/vendor/libgit2/src/{allocators → util/allocators}/win32_leakcheck.h +1 -1
- data/vendor/libgit2/src/{array.h → util/array.h} +25 -19
- data/vendor/libgit2/src/{assert_safe.h → util/assert_safe.h} +16 -0
- data/vendor/libgit2/src/{cc-compat.h → util/cc-compat.h} +5 -1
- data/vendor/libgit2/src/util/ctype_compat.h +70 -0
- data/vendor/libgit2/src/{date.c → util/date.c} +35 -33
- data/vendor/libgit2/src/util/date.h +45 -0
- data/vendor/libgit2/src/util/errors.c +401 -0
- data/vendor/libgit2/src/{errors.h → util/errors.h} +22 -19
- data/vendor/libgit2/src/{filebuf.c → util/filebuf.c} +35 -30
- data/vendor/libgit2/src/{filebuf.h → util/filebuf.h} +21 -8
- data/vendor/libgit2/src/{path.c → util/fs_path.c} +591 -615
- data/vendor/libgit2/src/{path.h → util/fs_path.h} +257 -181
- data/vendor/libgit2/src/{futils.c → util/futils.c} +144 -95
- data/vendor/libgit2/src/{futils.h → util/futils.h} +40 -18
- data/vendor/libgit2/src/{features.h.in → util/git2_features.h.in} +33 -2
- data/vendor/libgit2/src/{common.h → util/git2_util.h} +26 -59
- data/vendor/libgit2/src/util/hash/builtin.c +53 -0
- data/vendor/libgit2/src/{hash/sha1/openssl.h → util/hash/builtin.h} +6 -6
- data/vendor/libgit2/src/{hash/sha1 → util/hash}/collisiondetect.c +3 -3
- data/vendor/libgit2/src/{hash/sha1 → util/hash}/collisiondetect.h +3 -3
- data/vendor/libgit2/src/util/hash/common_crypto.c +112 -0
- data/vendor/libgit2/src/{hash/sha1 → util/hash}/common_crypto.h +11 -3
- data/vendor/libgit2/src/util/hash/mbedtls.c +92 -0
- data/vendor/libgit2/src/{hash/sha1 → util/hash}/mbedtls.h +14 -4
- data/vendor/libgit2/src/util/hash/openssl.c +347 -0
- data/vendor/libgit2/src/util/hash/openssl.h +61 -0
- data/vendor/libgit2/src/util/hash/rfc6234/sha.h +243 -0
- data/vendor/libgit2/src/util/hash/rfc6234/sha224-256.c +601 -0
- data/vendor/libgit2/src/util/hash/sha.h +73 -0
- data/vendor/libgit2/src/{hash/sha1 → util/hash}/sha1dc/sha1.c +1 -1
- data/vendor/libgit2/src/util/hash/win32.c +549 -0
- data/vendor/libgit2/src/util/hash/win32.h +60 -0
- data/vendor/libgit2/src/util/hash.c +158 -0
- data/vendor/libgit2/src/util/hash.h +61 -0
- data/vendor/libgit2/src/util/hashmap.h +424 -0
- data/vendor/libgit2/src/util/hashmap_str.h +43 -0
- data/vendor/libgit2/src/{integer.h → util/integer.h} +3 -1
- data/vendor/libgit2/src/{map.h → util/map.h} +1 -1
- data/vendor/libgit2/src/util/net.c +1160 -0
- data/vendor/libgit2/src/{net.h → util/net.h} +45 -4
- data/vendor/libgit2/src/{pool.c → util/pool.c} +1 -1
- data/vendor/libgit2/src/{pool.h → util/pool.h} +6 -1
- data/vendor/libgit2/src/{posix.c → util/posix.c} +57 -3
- data/vendor/libgit2/src/{posix.h → util/posix.h} +26 -1
- data/vendor/libgit2/src/{pqueue.h → util/pqueue.h} +3 -3
- data/vendor/libgit2/src/util/process.h +222 -0
- data/vendor/libgit2/src/util/rand.c +230 -0
- data/vendor/libgit2/src/util/rand.h +37 -0
- data/vendor/libgit2/src/{regexp.c → util/regexp.c} +5 -5
- data/vendor/libgit2/src/{regexp.h → util/regexp.h} +1 -1
- data/vendor/libgit2/src/{runtime.c → util/runtime.c} +1 -1
- data/vendor/libgit2/src/{runtime.h → util/runtime.h} +1 -1
- data/vendor/libgit2/src/{sortedcache.c → util/sortedcache.c} +15 -14
- data/vendor/libgit2/src/{sortedcache.h → util/sortedcache.h} +5 -5
- data/vendor/libgit2/src/util/staticstr.h +66 -0
- data/vendor/libgit2/src/{buffer.c → util/str.c} +159 -153
- data/vendor/libgit2/src/util/str.h +357 -0
- data/vendor/libgit2/src/util/strlist.c +108 -0
- data/vendor/libgit2/src/util/strlist.h +36 -0
- data/vendor/libgit2/src/{thread.c → util/thread.c} +1 -1
- data/vendor/libgit2/src/{thread.h → util/thread.h} +23 -22
- data/vendor/libgit2/src/{tsort.c → util/tsort.c} +1 -1
- data/vendor/libgit2/src/{unix → util/unix}/map.c +1 -3
- data/vendor/libgit2/src/{unix → util/unix}/posix.h +1 -6
- data/vendor/libgit2/src/util/unix/process.c +629 -0
- data/vendor/libgit2/src/{unix → util/unix}/realpath.c +24 -8
- data/vendor/libgit2/src/{utf8.c → util/utf8.c} +1 -1
- data/vendor/libgit2/src/{utf8.h → util/utf8.h} +1 -1
- data/vendor/libgit2/src/{util.c → util/util.c} +24 -19
- data/vendor/libgit2/src/{util.h → util/util.h} +30 -81
- data/vendor/libgit2/src/{varint.h → util/varint.h} +1 -1
- data/vendor/libgit2/src/{vector.c → util/vector.c} +3 -3
- data/vendor/libgit2/src/{vector.h → util/vector.h} +4 -4
- data/vendor/libgit2/src/{wildmatch.h → util/wildmatch.h} +1 -1
- data/vendor/libgit2/src/{win32 → util/win32}/dir.h +1 -1
- data/vendor/libgit2/src/{win32 → util/win32}/error.c +1 -1
- data/vendor/libgit2/src/{win32 → util/win32}/error.h +1 -1
- data/vendor/libgit2/src/{win32 → util/win32}/map.c +1 -1
- data/vendor/libgit2/src/{win32 → util/win32}/path_w32.c +148 -17
- data/vendor/libgit2/src/{win32 → util/win32}/path_w32.h +3 -1
- data/vendor/libgit2/src/{win32 → util/win32}/posix.h +1 -2
- data/vendor/libgit2/src/{win32 → util/win32}/posix_w32.c +42 -35
- data/vendor/libgit2/src/util/win32/precompiled.c +1 -0
- data/vendor/libgit2/src/{win32 → util/win32}/precompiled.h +1 -1
- data/vendor/libgit2/src/util/win32/process.c +506 -0
- data/vendor/libgit2/src/{win32 → util/win32}/thread.h +1 -1
- data/vendor/libgit2/src/util/win32/utf-conv.c +144 -0
- data/vendor/libgit2/src/util/win32/utf-conv.h +127 -0
- data/vendor/libgit2/src/{win32 → util/win32}/w32_buffer.c +2 -3
- data/vendor/libgit2/src/{win32 → util/win32}/w32_buffer.h +3 -4
- data/vendor/libgit2/src/{win32 → util/win32}/w32_leakcheck.c +1 -1
- data/vendor/libgit2/src/{win32 → util/win32}/w32_leakcheck.h +1 -1
- data/vendor/libgit2/src/{win32 → util/win32}/w32_util.c +1 -1
- data/vendor/libgit2/src/{win32 → util/win32}/w32_util.h +1 -1
- data/vendor/libgit2/src/{zstream.c → util/zstream.c} +5 -5
- data/vendor/libgit2/src/{zstream.h → util/zstream.h} +5 -5
- metadata +431 -362
- data/vendor/libgit2/cmake/FindIconv.cmake +0 -45
- data/vendor/libgit2/deps/http-parser/CMakeLists.txt +0 -6
- data/vendor/libgit2/deps/http-parser/COPYING +0 -23
- data/vendor/libgit2/deps/http-parser/http_parser.c +0 -2182
- data/vendor/libgit2/deps/http-parser/http_parser.h +0 -305
- data/vendor/libgit2/deps/zlib/COPYING +0 -27
- data/vendor/libgit2/include/git2/sys/reflog.h +0 -21
- data/vendor/libgit2/src/alloc.h +0 -40
- data/vendor/libgit2/src/allocators/failalloc.c +0 -92
- data/vendor/libgit2/src/allocators/failalloc.h +0 -23
- data/vendor/libgit2/src/allocators/stdalloc.c +0 -150
- data/vendor/libgit2/src/allocators/win32_leakcheck.c +0 -118
- data/vendor/libgit2/src/buffer.h +0 -374
- data/vendor/libgit2/src/commit.h +0 -46
- data/vendor/libgit2/src/config_entries.c +0 -237
- data/vendor/libgit2/src/config_entries.h +0 -24
- data/vendor/libgit2/src/config_mem.c +0 -220
- data/vendor/libgit2/src/errors.c +0 -238
- data/vendor/libgit2/src/hash/sha1/common_crypto.c +0 -57
- data/vendor/libgit2/src/hash/sha1/generic.c +0 -300
- data/vendor/libgit2/src/hash/sha1/generic.h +0 -19
- data/vendor/libgit2/src/hash/sha1/mbedtls.c +0 -46
- data/vendor/libgit2/src/hash/sha1/openssl.c +0 -59
- data/vendor/libgit2/src/hash/sha1/win32.c +0 -333
- data/vendor/libgit2/src/hash/sha1/win32.h +0 -128
- data/vendor/libgit2/src/hash/sha1.h +0 -38
- data/vendor/libgit2/src/hash.c +0 -110
- data/vendor/libgit2/src/hash.h +0 -46
- data/vendor/libgit2/src/idxmap.c +0 -157
- data/vendor/libgit2/src/idxmap.h +0 -177
- data/vendor/libgit2/src/khash.h +0 -615
- data/vendor/libgit2/src/libgit2.h +0 -15
- data/vendor/libgit2/src/message.h +0 -17
- data/vendor/libgit2/src/net.c +0 -540
- data/vendor/libgit2/src/netops.c +0 -125
- data/vendor/libgit2/src/netops.h +0 -68
- data/vendor/libgit2/src/offmap.c +0 -101
- data/vendor/libgit2/src/offmap.h +0 -133
- data/vendor/libgit2/src/oid.h +0 -51
- data/vendor/libgit2/src/oidarray.c +0 -43
- data/vendor/libgit2/src/oidmap.c +0 -107
- data/vendor/libgit2/src/oidmap.h +0 -128
- data/vendor/libgit2/src/remote.h +0 -55
- data/vendor/libgit2/src/streams/socket.c +0 -239
- data/vendor/libgit2/src/strmap.c +0 -100
- data/vendor/libgit2/src/strmap.h +0 -131
- data/vendor/libgit2/src/sysdir.c +0 -347
- data/vendor/libgit2/src/threadstate.c +0 -84
- data/vendor/libgit2/src/threadstate.h +0 -24
- data/vendor/libgit2/src/win32/findfile.c +0 -230
- data/vendor/libgit2/src/win32/findfile.h +0 -19
- data/vendor/libgit2/src/win32/utf-conv.c +0 -146
- data/vendor/libgit2/src/win32/utf-conv.h +0 -60
- /data/vendor/libgit2/{src → deps}/xdiff/xemit.h +0 -0
- /data/vendor/libgit2/{src → deps}/xdiff/xprepare.h +0 -0
- /data/vendor/libgit2/{src → deps}/xdiff/xtypes.h +0 -0
- /data/vendor/libgit2/src/{win32 → cli/win32}/precompiled.c +0 -0
- /data/vendor/libgit2/src/{attr.h → libgit2/attr.h} +0 -0
- /data/vendor/libgit2/src/{blame_git.h → libgit2/blame_git.h} +0 -0
- /data/vendor/libgit2/src/{config_parse.h → libgit2/config_parse.h} +0 -0
- /data/vendor/libgit2/src/{delta.c → libgit2/delta.c} +0 -0
- /data/vendor/libgit2/src/{delta.h → libgit2/delta.h} +0 -0
- /data/vendor/libgit2/src/{diff_file.h → libgit2/diff_file.h} +0 -0
- /data/vendor/libgit2/src/{diff_parse.h → libgit2/diff_parse.h} +0 -0
- /data/vendor/libgit2/src/{diff_tform.h → libgit2/diff_tform.h} +0 -0
- /data/vendor/libgit2/src/{fetchhead.h → libgit2/fetchhead.h} +0 -0
- /data/vendor/libgit2/src/{hashsig.c → libgit2/hashsig.c} +0 -0
- /data/vendor/libgit2/src/{indexer.h → libgit2/indexer.h} +0 -0
- /data/vendor/libgit2/src/{mailmap.h → libgit2/mailmap.h} +0 -0
- /data/vendor/libgit2/src/{merge_driver.h → libgit2/merge_driver.h} +0 -0
- /data/vendor/libgit2/src/{notes.h → libgit2/notes.h} +0 -0
- /data/vendor/libgit2/src/{object_api.c → libgit2/object_api.c} +0 -0
- /data/vendor/libgit2/src/{patch_parse.h → libgit2/patch_parse.h} +0 -0
- /data/vendor/libgit2/src/{refdb.c → libgit2/refdb.c} +0 -0
- /data/vendor/libgit2/src/{refdb.h → libgit2/refdb.h} +0 -0
- /data/vendor/libgit2/src/{repo_template.h → libgit2/repo_template.h} +0 -0
- /data/vendor/libgit2/src/{status.h → libgit2/status.h} +0 -0
- /data/vendor/libgit2/src/{stream.h → libgit2/stream.h} +0 -0
- /data/vendor/libgit2/src/{streams → libgit2/streams}/mbedtls.h +0 -0
- /data/vendor/libgit2/src/{streams → libgit2/streams}/openssl_legacy.c +0 -0
- /data/vendor/libgit2/src/{streams → libgit2/streams}/openssl_legacy.h +0 -0
- /data/vendor/libgit2/src/{streams → libgit2/streams}/registry.c +0 -0
- /data/vendor/libgit2/src/{streams → libgit2/streams}/registry.h +0 -0
- /data/vendor/libgit2/src/{streams → libgit2/streams}/stransport.h +0 -0
- /data/vendor/libgit2/src/{streams → libgit2/streams}/tls.h +0 -0
- /data/vendor/libgit2/src/{transports → libgit2/transports}/credential_helpers.c +0 -0
- /data/vendor/libgit2/src/{userdiff.h → libgit2/userdiff.h} +0 -0
- /data/vendor/libgit2/src/{bitvec.h → util/bitvec.h} +0 -0
- /data/vendor/libgit2/src/{hash/sha1 → util/hash}/sha1dc/sha1.h +0 -0
- /data/vendor/libgit2/src/{hash/sha1 → util/hash}/sha1dc/ubc_check.c +0 -0
- /data/vendor/libgit2/src/{hash/sha1 → util/hash}/sha1dc/ubc_check.h +0 -0
- /data/vendor/libgit2/src/{pqueue.c → util/pqueue.c} +0 -0
- /data/vendor/libgit2/src/{strnlen.h → util/strnlen.h} +0 -0
- /data/vendor/libgit2/src/{unix → util/unix}/pthread.h +0 -0
- /data/vendor/libgit2/src/{varint.c → util/varint.c} +0 -0
- /data/vendor/libgit2/src/{wildmatch.c → util/wildmatch.c} +0 -0
- /data/vendor/libgit2/src/{win32 → util/win32}/dir.c +0 -0
- /data/vendor/libgit2/src/{win32 → util/win32}/mingw-compat.h +0 -0
- /data/vendor/libgit2/src/{win32 → util/win32}/msvc-compat.h +0 -0
- /data/vendor/libgit2/src/{win32 → util/win32}/reparse.h +0 -0
- /data/vendor/libgit2/src/{win32 → util/win32}/thread.c +0 -0
- /data/vendor/libgit2/src/{win32 → util/win32}/version.h +0 -0
- /data/vendor/libgit2/src/{win32 → util/win32}/w32_common.h +0 -0
- /data/vendor/libgit2/src/{win32 → util/win32}/win32-compat.h +0 -0
@@ -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"
|
@@ -21,83 +22,112 @@
|
|
21
22
|
|
22
23
|
#include <ctype.h>
|
23
24
|
|
25
|
+
/*
|
26
|
+
* A refcounted instance of a config_backend that can be shared across
|
27
|
+
* a configuration instance, any snapshots, and individual configuration
|
28
|
+
* levels (from `git_config_open_level`).
|
29
|
+
*/
|
30
|
+
typedef struct {
|
31
|
+
git_refcount rc;
|
32
|
+
git_config_backend *backend;
|
33
|
+
} backend_instance;
|
34
|
+
|
35
|
+
/*
|
36
|
+
* An entry in the readers or writers vector in the configuration.
|
37
|
+
* This is kept separate from the refcounted instance so that different
|
38
|
+
* views of the configuration can have different notions of levels or
|
39
|
+
* write orders.
|
40
|
+
*
|
41
|
+
* (eg, a standard configuration has a priority ordering of writers, a
|
42
|
+
* snapshot has *no* writers, and an individual level has a single
|
43
|
+
* writer.)
|
44
|
+
*/
|
45
|
+
typedef struct {
|
46
|
+
backend_instance *instance;
|
47
|
+
git_config_level_t level;
|
48
|
+
int write_order;
|
49
|
+
} backend_entry;
|
50
|
+
|
24
51
|
void git_config_entry_free(git_config_entry *entry)
|
25
52
|
{
|
53
|
+
git_config_backend_entry *be;
|
54
|
+
|
26
55
|
if (!entry)
|
27
56
|
return;
|
28
57
|
|
29
|
-
|
58
|
+
be = (git_config_backend_entry *)entry;
|
59
|
+
be->free(be);
|
30
60
|
}
|
31
61
|
|
32
|
-
|
33
|
-
git_refcount rc;
|
34
|
-
|
35
|
-
git_config_backend *backend;
|
36
|
-
git_config_level_t level;
|
37
|
-
} backend_internal;
|
38
|
-
|
39
|
-
static void backend_internal_free(backend_internal *internal)
|
62
|
+
static void backend_instance_free(backend_instance *instance)
|
40
63
|
{
|
41
64
|
git_config_backend *backend;
|
42
65
|
|
43
|
-
backend =
|
66
|
+
backend = instance->backend;
|
44
67
|
backend->free(backend);
|
45
|
-
git__free(
|
68
|
+
git__free(instance);
|
46
69
|
}
|
47
70
|
|
48
|
-
static void config_free(git_config *
|
71
|
+
static void config_free(git_config *config)
|
49
72
|
{
|
50
73
|
size_t i;
|
51
|
-
|
74
|
+
backend_entry *entry;
|
52
75
|
|
53
|
-
|
54
|
-
|
55
|
-
|
76
|
+
git_vector_foreach(&config->readers, i, entry) {
|
77
|
+
GIT_REFCOUNT_DEC(entry->instance, backend_instance_free);
|
78
|
+
git__free(entry);
|
56
79
|
}
|
57
80
|
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
git__free(cfg);
|
81
|
+
git_vector_dispose(&config->readers);
|
82
|
+
git_vector_dispose(&config->writers);
|
83
|
+
git__free(config);
|
62
84
|
}
|
63
85
|
|
64
|
-
void git_config_free(git_config *
|
86
|
+
void git_config_free(git_config *config)
|
65
87
|
{
|
66
|
-
if (
|
88
|
+
if (config == NULL)
|
67
89
|
return;
|
68
90
|
|
69
|
-
GIT_REFCOUNT_DEC(
|
91
|
+
GIT_REFCOUNT_DEC(config, config_free);
|
70
92
|
}
|
71
93
|
|
72
|
-
static int
|
94
|
+
static int reader_cmp(const void *_a, const void *_b)
|
73
95
|
{
|
74
|
-
const
|
75
|
-
const
|
96
|
+
const backend_entry *a = _a;
|
97
|
+
const backend_entry *b = _b;
|
76
98
|
|
77
|
-
return
|
99
|
+
return b->level - a->level;
|
78
100
|
}
|
79
101
|
|
80
|
-
int
|
102
|
+
static int writer_cmp(const void *_a, const void *_b)
|
81
103
|
{
|
82
|
-
|
104
|
+
const backend_entry *a = _a;
|
105
|
+
const backend_entry *b = _b;
|
83
106
|
|
84
|
-
|
85
|
-
|
107
|
+
return b->write_order - a->write_order;
|
108
|
+
}
|
109
|
+
|
110
|
+
int git_config_new(git_config **out)
|
111
|
+
{
|
112
|
+
git_config *config;
|
86
113
|
|
87
|
-
|
114
|
+
config = git__calloc(1, sizeof(git_config));
|
115
|
+
GIT_ERROR_CHECK_ALLOC(config);
|
88
116
|
|
89
|
-
if (git_vector_init(&
|
90
|
-
|
117
|
+
if (git_vector_init(&config->readers, 8, reader_cmp) < 0 ||
|
118
|
+
git_vector_init(&config->writers, 8, writer_cmp) < 0) {
|
119
|
+
config_free(config);
|
91
120
|
return -1;
|
92
121
|
}
|
93
122
|
|
94
|
-
|
95
|
-
|
123
|
+
GIT_REFCOUNT_INC(config);
|
124
|
+
|
125
|
+
*out = config;
|
96
126
|
return 0;
|
97
127
|
}
|
98
128
|
|
99
129
|
int git_config_add_file_ondisk(
|
100
|
-
git_config *
|
130
|
+
git_config *config,
|
101
131
|
const char *path,
|
102
132
|
git_config_level_t level,
|
103
133
|
const git_repository *repo,
|
@@ -107,7 +137,7 @@ int git_config_add_file_ondisk(
|
|
107
137
|
struct stat st;
|
108
138
|
int res;
|
109
139
|
|
110
|
-
GIT_ASSERT_ARG(
|
140
|
+
GIT_ASSERT_ARG(config);
|
111
141
|
GIT_ASSERT_ARG(path);
|
112
142
|
|
113
143
|
res = p_stat(path, &st);
|
@@ -119,7 +149,7 @@ int git_config_add_file_ondisk(
|
|
119
149
|
if (git_config_backend_from_file(&file, path) < 0)
|
120
150
|
return -1;
|
121
151
|
|
122
|
-
if ((res = git_config_add_backend(
|
152
|
+
if ((res = git_config_add_backend(config, file, level, repo, force)) < 0) {
|
123
153
|
/*
|
124
154
|
* free manually; the file is not owned by the config
|
125
155
|
* instance yet and will not be freed on cleanup
|
@@ -153,7 +183,7 @@ int git_config_snapshot(git_config **out, git_config *in)
|
|
153
183
|
{
|
154
184
|
int error = 0;
|
155
185
|
size_t i;
|
156
|
-
|
186
|
+
backend_entry *entry;
|
157
187
|
git_config *config;
|
158
188
|
|
159
189
|
*out = NULL;
|
@@ -161,18 +191,20 @@ int git_config_snapshot(git_config **out, git_config *in)
|
|
161
191
|
if (git_config_new(&config) < 0)
|
162
192
|
return -1;
|
163
193
|
|
164
|
-
git_vector_foreach(&in->
|
194
|
+
git_vector_foreach(&in->readers, i, entry) {
|
165
195
|
git_config_backend *b;
|
166
196
|
|
167
|
-
if ((error =
|
197
|
+
if ((error = entry->instance->backend->snapshot(&b, entry->instance->backend)) < 0)
|
168
198
|
break;
|
169
199
|
|
170
|
-
if ((error = git_config_add_backend(config, b,
|
200
|
+
if ((error = git_config_add_backend(config, b, entry->level, NULL, 0)) < 0) {
|
171
201
|
b->free(b);
|
172
202
|
break;
|
173
203
|
}
|
174
204
|
}
|
175
205
|
|
206
|
+
git_config_set_writeorder(config, NULL, 0);
|
207
|
+
|
176
208
|
if (error < 0)
|
177
209
|
git_config_free(config);
|
178
210
|
else
|
@@ -182,141 +214,162 @@ int git_config_snapshot(git_config **out, git_config *in)
|
|
182
214
|
}
|
183
215
|
|
184
216
|
static int find_backend_by_level(
|
185
|
-
|
186
|
-
const git_config *
|
217
|
+
backend_instance **out,
|
218
|
+
const git_config *config,
|
187
219
|
git_config_level_t level)
|
188
220
|
{
|
189
|
-
|
190
|
-
backend_internal *internal;
|
221
|
+
backend_entry *entry, *found = NULL;
|
191
222
|
size_t i;
|
192
223
|
|
193
|
-
/*
|
194
|
-
*
|
195
|
-
*
|
196
|
-
*
|
224
|
+
/*
|
225
|
+
* when passing GIT_CONFIG_HIGHEST_LEVEL, the idea is to get the
|
226
|
+
* config backend which has the highest level. As config backends
|
227
|
+
* are stored in a vector sorted by decreasing order of level,
|
228
|
+
* getting the backend at position 0 will do the job.
|
197
229
|
*/
|
198
230
|
if (level == GIT_CONFIG_HIGHEST_LEVEL) {
|
199
|
-
|
231
|
+
found = git_vector_get(&config->readers, 0);
|
200
232
|
} else {
|
201
|
-
git_vector_foreach(&
|
202
|
-
if (
|
203
|
-
|
233
|
+
git_vector_foreach(&config->readers, i, entry) {
|
234
|
+
if (entry->level == level) {
|
235
|
+
found = entry;
|
236
|
+
break;
|
237
|
+
}
|
204
238
|
}
|
205
239
|
}
|
206
240
|
|
207
|
-
if (
|
241
|
+
if (!found) {
|
208
242
|
git_error_set(GIT_ERROR_CONFIG,
|
209
|
-
"no configuration exists for the given level '%
|
243
|
+
"no configuration exists for the given level '%d'", level);
|
210
244
|
return GIT_ENOTFOUND;
|
211
245
|
}
|
212
246
|
|
213
|
-
*out =
|
214
|
-
|
247
|
+
*out = found->instance;
|
215
248
|
return 0;
|
216
249
|
}
|
217
250
|
|
218
|
-
static int duplicate_level(void **
|
251
|
+
static int duplicate_level(void **_old, void *_new)
|
219
252
|
{
|
220
|
-
|
253
|
+
backend_entry **old = (backend_entry **)_old;
|
221
254
|
|
222
|
-
GIT_UNUSED(
|
255
|
+
GIT_UNUSED(_new);
|
223
256
|
|
224
|
-
git_error_set(GIT_ERROR_CONFIG, "
|
257
|
+
git_error_set(GIT_ERROR_CONFIG, "configuration at level %d already exists", (*old)->level);
|
225
258
|
return GIT_EEXISTS;
|
226
259
|
}
|
227
260
|
|
228
261
|
static void try_remove_existing_backend(
|
229
|
-
git_config *
|
262
|
+
git_config *config,
|
230
263
|
git_config_level_t level)
|
231
264
|
{
|
232
|
-
|
233
|
-
backend_internal *internal;
|
265
|
+
backend_entry *entry, *found = NULL;
|
234
266
|
size_t i;
|
235
267
|
|
236
|
-
git_vector_foreach(&
|
237
|
-
if (
|
238
|
-
|
268
|
+
git_vector_foreach(&config->readers, i, entry) {
|
269
|
+
if (entry->level == level) {
|
270
|
+
git_vector_remove(&config->readers, i);
|
271
|
+
found = entry;
|
272
|
+
break;
|
273
|
+
}
|
239
274
|
}
|
240
275
|
|
241
|
-
if (
|
276
|
+
if (!found)
|
242
277
|
return;
|
243
278
|
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
279
|
+
git_vector_foreach(&config->writers, i, entry) {
|
280
|
+
if (entry->level == level) {
|
281
|
+
git_vector_remove(&config->writers, i);
|
282
|
+
break;
|
283
|
+
}
|
284
|
+
}
|
248
285
|
|
249
|
-
GIT_REFCOUNT_DEC(
|
286
|
+
GIT_REFCOUNT_DEC(found->instance, backend_instance_free);
|
287
|
+
git__free(found);
|
250
288
|
}
|
251
289
|
|
252
|
-
static int
|
253
|
-
git_config *
|
254
|
-
|
290
|
+
static int git_config__add_instance(
|
291
|
+
git_config *config,
|
292
|
+
backend_instance *instance,
|
255
293
|
git_config_level_t level,
|
256
294
|
int force)
|
257
295
|
{
|
296
|
+
backend_entry *entry;
|
258
297
|
int result;
|
259
298
|
|
260
299
|
/* delete existing config backend for level if it exists */
|
261
300
|
if (force)
|
262
|
-
try_remove_existing_backend(
|
301
|
+
try_remove_existing_backend(config, level);
|
263
302
|
|
264
|
-
|
265
|
-
|
266
|
-
return result;
|
303
|
+
entry = git__malloc(sizeof(backend_entry));
|
304
|
+
GIT_ERROR_CHECK_ALLOC(entry);
|
267
305
|
|
268
|
-
|
269
|
-
|
306
|
+
entry->instance = instance;
|
307
|
+
entry->level = level;
|
308
|
+
entry->write_order = level;
|
270
309
|
|
271
|
-
|
310
|
+
if ((result = git_vector_insert_sorted(&config->readers,
|
311
|
+
entry, &duplicate_level)) < 0 ||
|
312
|
+
(result = git_vector_insert_sorted(&config->writers,
|
313
|
+
entry, NULL)) < 0) {
|
314
|
+
git__free(entry);
|
315
|
+
return result;
|
316
|
+
}
|
317
|
+
|
318
|
+
GIT_REFCOUNT_INC(entry->instance);
|
272
319
|
|
273
320
|
return 0;
|
274
321
|
}
|
275
322
|
|
276
|
-
int git_config_open_global(git_config **
|
323
|
+
int git_config_open_global(git_config **out, git_config *config)
|
277
324
|
{
|
278
|
-
|
325
|
+
int error;
|
326
|
+
|
327
|
+
error = git_config_open_level(out, config, GIT_CONFIG_LEVEL_XDG);
|
328
|
+
|
329
|
+
if (error == 0)
|
279
330
|
return 0;
|
331
|
+
else if (error != GIT_ENOTFOUND)
|
332
|
+
return error;
|
280
333
|
|
281
|
-
return git_config_open_level(
|
334
|
+
return git_config_open_level(out, config, GIT_CONFIG_LEVEL_GLOBAL);
|
282
335
|
}
|
283
336
|
|
284
337
|
int git_config_open_level(
|
285
|
-
git_config **
|
286
|
-
const git_config *
|
338
|
+
git_config **out,
|
339
|
+
const git_config *parent,
|
287
340
|
git_config_level_t level)
|
288
341
|
{
|
289
|
-
git_config *
|
290
|
-
|
342
|
+
git_config *config;
|
343
|
+
backend_instance *instance;
|
291
344
|
int res;
|
292
345
|
|
293
|
-
if ((res = find_backend_by_level(&
|
346
|
+
if ((res = find_backend_by_level(&instance, parent, level)) < 0)
|
294
347
|
return res;
|
295
348
|
|
296
|
-
if ((res = git_config_new(&
|
349
|
+
if ((res = git_config_new(&config)) < 0)
|
297
350
|
return res;
|
298
351
|
|
299
|
-
if ((res =
|
300
|
-
git_config_free(
|
352
|
+
if ((res = git_config__add_instance(config, instance, level, true)) < 0) {
|
353
|
+
git_config_free(config);
|
301
354
|
return res;
|
302
355
|
}
|
303
356
|
|
304
|
-
*
|
357
|
+
*out = config;
|
305
358
|
|
306
359
|
return 0;
|
307
360
|
}
|
308
361
|
|
309
362
|
int git_config_add_backend(
|
310
|
-
git_config *
|
363
|
+
git_config *config,
|
311
364
|
git_config_backend *backend,
|
312
365
|
git_config_level_t level,
|
313
366
|
const git_repository *repo,
|
314
367
|
int force)
|
315
368
|
{
|
316
|
-
|
369
|
+
backend_instance *instance;
|
317
370
|
int result;
|
318
371
|
|
319
|
-
GIT_ASSERT_ARG(
|
372
|
+
GIT_ASSERT_ARG(config);
|
320
373
|
GIT_ASSERT_ARG(backend);
|
321
374
|
|
322
375
|
GIT_ERROR_CHECK_VERSION(backend, GIT_CONFIG_BACKEND_VERSION, "git_config_backend");
|
@@ -324,22 +377,50 @@ int git_config_add_backend(
|
|
324
377
|
if ((result = backend->open(backend, level, repo)) < 0)
|
325
378
|
return result;
|
326
379
|
|
327
|
-
|
328
|
-
GIT_ERROR_CHECK_ALLOC(
|
329
|
-
|
330
|
-
memset(internal, 0x0, sizeof(backend_internal));
|
380
|
+
instance = git__calloc(1, sizeof(backend_instance));
|
381
|
+
GIT_ERROR_CHECK_ALLOC(instance);
|
331
382
|
|
332
|
-
|
333
|
-
|
383
|
+
instance->backend = backend;
|
384
|
+
instance->backend->cfg = config;
|
334
385
|
|
335
|
-
if ((result =
|
336
|
-
git__free(
|
386
|
+
if ((result = git_config__add_instance(config, instance, level, force)) < 0) {
|
387
|
+
git__free(instance);
|
337
388
|
return result;
|
338
389
|
}
|
339
390
|
|
340
391
|
return 0;
|
341
392
|
}
|
342
393
|
|
394
|
+
int git_config_set_writeorder(
|
395
|
+
git_config *config,
|
396
|
+
git_config_level_t *levels,
|
397
|
+
size_t len)
|
398
|
+
{
|
399
|
+
backend_entry *entry;
|
400
|
+
size_t i, j;
|
401
|
+
|
402
|
+
GIT_ASSERT(len < INT_MAX);
|
403
|
+
|
404
|
+
git_vector_foreach(&config->readers, i, entry) {
|
405
|
+
bool found = false;
|
406
|
+
|
407
|
+
for (j = 0; j < len; j++) {
|
408
|
+
if (levels[j] == entry->level) {
|
409
|
+
entry->write_order = (int)j;
|
410
|
+
found = true;
|
411
|
+
break;
|
412
|
+
}
|
413
|
+
}
|
414
|
+
|
415
|
+
if (!found)
|
416
|
+
entry->write_order = -1;
|
417
|
+
}
|
418
|
+
|
419
|
+
git_vector_sort(&config->writers);
|
420
|
+
|
421
|
+
return 0;
|
422
|
+
}
|
423
|
+
|
343
424
|
/*
|
344
425
|
* Loop over all the variables
|
345
426
|
*/
|
@@ -347,37 +428,24 @@ int git_config_add_backend(
|
|
347
428
|
typedef struct {
|
348
429
|
git_config_iterator parent;
|
349
430
|
git_config_iterator *current;
|
350
|
-
const git_config *
|
431
|
+
const git_config *config;
|
351
432
|
git_regexp regex;
|
352
433
|
size_t i;
|
353
434
|
} all_iter;
|
354
435
|
|
355
|
-
static int
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
for (; i > 0; --i) {
|
360
|
-
internal = git_vector_get(&cfg->backends, i - 1);
|
361
|
-
if (!internal || !internal->backend)
|
362
|
-
continue;
|
363
|
-
|
364
|
-
*out = i;
|
365
|
-
return 0;
|
366
|
-
}
|
367
|
-
|
368
|
-
return -1;
|
369
|
-
}
|
370
|
-
|
371
|
-
static int all_iter_next(git_config_entry **entry, git_config_iterator *_iter)
|
436
|
+
static int all_iter_next(
|
437
|
+
git_config_backend_entry **out,
|
438
|
+
git_config_iterator *_iter)
|
372
439
|
{
|
373
440
|
all_iter *iter = (all_iter *) _iter;
|
374
|
-
|
441
|
+
backend_entry *entry;
|
375
442
|
git_config_backend *backend;
|
376
|
-
|
443
|
+
git_config_backend_entry *be;
|
377
444
|
int error = 0;
|
378
445
|
|
379
446
|
if (iter->current != NULL &&
|
380
|
-
(error = iter->current->next(
|
447
|
+
(error = iter->current->next(&be, iter->current)) == 0) {
|
448
|
+
*out = be;
|
381
449
|
return 0;
|
382
450
|
}
|
383
451
|
|
@@ -385,25 +453,32 @@ static int all_iter_next(git_config_entry **entry, git_config_iterator *_iter)
|
|
385
453
|
return error;
|
386
454
|
|
387
455
|
do {
|
388
|
-
if (
|
456
|
+
if (iter->i == 0)
|
389
457
|
return GIT_ITEROVER;
|
390
458
|
|
391
|
-
|
392
|
-
|
393
|
-
|
459
|
+
entry = git_vector_get(&iter->config->readers, iter->i - 1);
|
460
|
+
GIT_ASSERT(entry && entry->instance && entry->instance->backend);
|
461
|
+
|
462
|
+
backend = entry->instance->backend;
|
463
|
+
iter->i--;
|
394
464
|
|
395
465
|
if (iter->current)
|
396
466
|
iter->current->free(iter->current);
|
397
467
|
|
398
468
|
iter->current = NULL;
|
399
469
|
error = backend->iterator(&iter->current, backend);
|
470
|
+
|
400
471
|
if (error == GIT_ENOTFOUND)
|
401
472
|
continue;
|
402
473
|
|
403
474
|
if (error < 0)
|
404
475
|
return error;
|
405
476
|
|
406
|
-
error = iter->current->next(
|
477
|
+
if ((error = iter->current->next(&be, iter->current)) == 0) {
|
478
|
+
*out = be;
|
479
|
+
return 0;
|
480
|
+
}
|
481
|
+
|
407
482
|
/* If this backend is empty, then keep going */
|
408
483
|
if (error == GIT_ITEROVER)
|
409
484
|
continue;
|
@@ -415,18 +490,20 @@ static int all_iter_next(git_config_entry **entry, git_config_iterator *_iter)
|
|
415
490
|
return GIT_ITEROVER;
|
416
491
|
}
|
417
492
|
|
418
|
-
static int all_iter_glob_next(
|
493
|
+
static int all_iter_glob_next(
|
494
|
+
git_config_backend_entry **entry,
|
495
|
+
git_config_iterator *_iter)
|
419
496
|
{
|
420
497
|
int error;
|
421
498
|
all_iter *iter = (all_iter *) _iter;
|
422
499
|
|
423
500
|
/*
|
424
501
|
* We use the "normal" function to grab the next one across
|
425
|
-
*
|
502
|
+
* readers and then apply the regex
|
426
503
|
*/
|
427
504
|
while ((error = all_iter_next(entry, _iter)) == 0) {
|
428
505
|
/* skip non-matching keys if regexp was provided */
|
429
|
-
if (git_regexp_match(&iter->regex, (*entry)->name) != 0)
|
506
|
+
if (git_regexp_match(&iter->regex, (*entry)->entry.name) != 0)
|
430
507
|
continue;
|
431
508
|
|
432
509
|
/* and simply return if we like the entry's name */
|
@@ -454,7 +531,7 @@ static void all_iter_glob_free(git_config_iterator *_iter)
|
|
454
531
|
all_iter_free(_iter);
|
455
532
|
}
|
456
533
|
|
457
|
-
int git_config_iterator_new(git_config_iterator **out, const git_config *
|
534
|
+
int git_config_iterator_new(git_config_iterator **out, const git_config *config)
|
458
535
|
{
|
459
536
|
all_iter *iter;
|
460
537
|
|
@@ -464,21 +541,21 @@ int git_config_iterator_new(git_config_iterator **out, const git_config *cfg)
|
|
464
541
|
iter->parent.free = all_iter_free;
|
465
542
|
iter->parent.next = all_iter_next;
|
466
543
|
|
467
|
-
iter->i =
|
468
|
-
iter->
|
544
|
+
iter->i = config->readers.length;
|
545
|
+
iter->config = config;
|
469
546
|
|
470
547
|
*out = (git_config_iterator *) iter;
|
471
548
|
|
472
549
|
return 0;
|
473
550
|
}
|
474
551
|
|
475
|
-
int git_config_iterator_glob_new(git_config_iterator **out, const git_config *
|
552
|
+
int git_config_iterator_glob_new(git_config_iterator **out, const git_config *config, const char *regexp)
|
476
553
|
{
|
477
554
|
all_iter *iter;
|
478
555
|
int result;
|
479
556
|
|
480
557
|
if (regexp == NULL)
|
481
|
-
return git_config_iterator_new(out,
|
558
|
+
return git_config_iterator_new(out, config);
|
482
559
|
|
483
560
|
iter = git__calloc(1, sizeof(all_iter));
|
484
561
|
GIT_ERROR_CHECK_ALLOC(iter);
|
@@ -490,8 +567,8 @@ int git_config_iterator_glob_new(git_config_iterator **out, const git_config *cf
|
|
490
567
|
|
491
568
|
iter->parent.next = all_iter_glob_next;
|
492
569
|
iter->parent.free = all_iter_glob_free;
|
493
|
-
iter->i =
|
494
|
-
iter->
|
570
|
+
iter->i = config->readers.length;
|
571
|
+
iter->config = config;
|
495
572
|
|
496
573
|
*out = (git_config_iterator *) iter;
|
497
574
|
|
@@ -499,9 +576,9 @@ int git_config_iterator_glob_new(git_config_iterator **out, const git_config *cf
|
|
499
576
|
}
|
500
577
|
|
501
578
|
int git_config_foreach(
|
502
|
-
const git_config *
|
579
|
+
const git_config *config, git_config_foreach_cb cb, void *payload)
|
503
580
|
{
|
504
|
-
return git_config_foreach_match(
|
581
|
+
return git_config_foreach_match(config, NULL, cb, payload);
|
505
582
|
}
|
506
583
|
|
507
584
|
int git_config_backend_foreach_match(
|
@@ -510,7 +587,7 @@ int git_config_backend_foreach_match(
|
|
510
587
|
git_config_foreach_cb cb,
|
511
588
|
void *payload)
|
512
589
|
{
|
513
|
-
|
590
|
+
git_config_backend_entry *entry;
|
514
591
|
git_config_iterator *iter;
|
515
592
|
git_regexp regex;
|
516
593
|
int error = 0;
|
@@ -528,11 +605,11 @@ int git_config_backend_foreach_match(
|
|
528
605
|
|
529
606
|
while (!(iter->next(&entry, iter) < 0)) {
|
530
607
|
/* skip non-matching keys if regexp was provided */
|
531
|
-
if (regexp && git_regexp_match(®ex, entry->name) != 0)
|
608
|
+
if (regexp && git_regexp_match(®ex, entry->entry.name) != 0)
|
532
609
|
continue;
|
533
610
|
|
534
611
|
/* abort iterator on non-zero return value */
|
535
|
-
if ((error = cb(entry, payload)) != 0) {
|
612
|
+
if ((error = cb(&entry->entry, payload)) != 0) {
|
536
613
|
git_error_set_after_callback(error);
|
537
614
|
break;
|
538
615
|
}
|
@@ -547,7 +624,7 @@ int git_config_backend_foreach_match(
|
|
547
624
|
}
|
548
625
|
|
549
626
|
int git_config_foreach_match(
|
550
|
-
const git_config *
|
627
|
+
const git_config *config,
|
551
628
|
const char *regexp,
|
552
629
|
git_config_foreach_cb cb,
|
553
630
|
void *payload)
|
@@ -556,7 +633,7 @@ int git_config_foreach_match(
|
|
556
633
|
git_config_iterator *iter;
|
557
634
|
git_config_entry *entry;
|
558
635
|
|
559
|
-
if ((error = git_config_iterator_glob_new(&iter,
|
636
|
+
if ((error = git_config_iterator_glob_new(&iter, config, regexp)) < 0)
|
560
637
|
return error;
|
561
638
|
|
562
639
|
while (!(error = git_config_next(&entry, iter))) {
|
@@ -578,72 +655,59 @@ int git_config_foreach_match(
|
|
578
655
|
* Setters
|
579
656
|
**************/
|
580
657
|
|
581
|
-
|
582
|
-
|
583
|
-
|
584
|
-
} backend_use;
|
585
|
-
|
586
|
-
static const char *uses[] = {
|
587
|
-
"set",
|
588
|
-
"delete"
|
589
|
-
};
|
590
|
-
|
591
|
-
static int get_backend_for_use(git_config_backend **out,
|
592
|
-
git_config *cfg, const char *name, backend_use use)
|
593
|
-
{
|
658
|
+
static backend_instance *get_writer_instance(git_config *config)
|
659
|
+
{
|
660
|
+
backend_entry *entry;
|
594
661
|
size_t i;
|
595
|
-
backend_internal *backend;
|
596
662
|
|
597
|
-
|
663
|
+
git_vector_foreach(&config->writers, i, entry) {
|
664
|
+
if (entry->instance->backend->readonly)
|
665
|
+
continue;
|
598
666
|
|
599
|
-
|
600
|
-
|
601
|
-
"cannot %s value for '%s' when no config backends exist",
|
602
|
-
uses[use], name);
|
603
|
-
return GIT_ENOTFOUND;
|
604
|
-
}
|
667
|
+
if (entry->write_order < 0)
|
668
|
+
continue;
|
605
669
|
|
606
|
-
|
607
|
-
if (!backend->backend->readonly) {
|
608
|
-
*out = backend->backend;
|
609
|
-
return 0;
|
610
|
-
}
|
670
|
+
return entry->instance;
|
611
671
|
}
|
612
672
|
|
613
|
-
|
614
|
-
|
615
|
-
|
616
|
-
|
673
|
+
return NULL;
|
674
|
+
}
|
675
|
+
|
676
|
+
static git_config_backend *get_writer(git_config *config)
|
677
|
+
{
|
678
|
+
backend_instance *instance = get_writer_instance(config);
|
679
|
+
|
680
|
+
return instance ? instance->backend : NULL;
|
617
681
|
}
|
618
682
|
|
619
|
-
int git_config_delete_entry(git_config *
|
683
|
+
int git_config_delete_entry(git_config *config, const char *name)
|
620
684
|
{
|
621
685
|
git_config_backend *backend;
|
622
686
|
|
623
|
-
if (
|
624
|
-
return
|
687
|
+
if ((backend = get_writer(config)) == NULL)
|
688
|
+
return GIT_EREADONLY;
|
625
689
|
|
626
690
|
return backend->del(backend, name);
|
627
691
|
}
|
628
692
|
|
629
|
-
int git_config_set_int64(git_config *
|
693
|
+
int git_config_set_int64(git_config *config, const char *name, int64_t value)
|
630
694
|
{
|
631
695
|
char str_value[32]; /* All numbers should fit in here */
|
632
696
|
p_snprintf(str_value, sizeof(str_value), "%" PRId64, value);
|
633
|
-
return git_config_set_string(
|
697
|
+
return git_config_set_string(config, name, str_value);
|
634
698
|
}
|
635
699
|
|
636
|
-
int git_config_set_int32(git_config *
|
700
|
+
int git_config_set_int32(git_config *config, const char *name, int32_t value)
|
637
701
|
{
|
638
|
-
return git_config_set_int64(
|
702
|
+
return git_config_set_int64(config, name, (int64_t)value);
|
639
703
|
}
|
640
704
|
|
641
|
-
int git_config_set_bool(git_config *
|
705
|
+
int git_config_set_bool(git_config *config, const char *name, int value)
|
642
706
|
{
|
643
|
-
return git_config_set_string(
|
707
|
+
return git_config_set_string(config, name, value ? "true" : "false");
|
644
708
|
}
|
645
709
|
|
646
|
-
int git_config_set_string(git_config *
|
710
|
+
int git_config_set_string(git_config *config, const char *name, const char *value)
|
647
711
|
{
|
648
712
|
int error;
|
649
713
|
git_config_backend *backend;
|
@@ -653,13 +717,15 @@ int git_config_set_string(git_config *cfg, const char *name, const char *value)
|
|
653
717
|
return -1;
|
654
718
|
}
|
655
719
|
|
656
|
-
if (
|
657
|
-
|
720
|
+
if ((backend = get_writer(config)) == NULL) {
|
721
|
+
git_error_set(GIT_ERROR_CONFIG, "cannot set '%s': the configuration is read-only", name);
|
722
|
+
return GIT_EREADONLY;
|
723
|
+
}
|
658
724
|
|
659
725
|
error = backend->set(backend, name, value);
|
660
726
|
|
661
|
-
if (!error && GIT_REFCOUNT_OWNER(
|
662
|
-
git_repository__configmap_lookup_cache_clear(GIT_REFCOUNT_OWNER(
|
727
|
+
if (!error && GIT_REFCOUNT_OWNER(config) != NULL)
|
728
|
+
git_repository__configmap_lookup_cache_clear(GIT_REFCOUNT_OWNER(config));
|
663
729
|
|
664
730
|
return error;
|
665
731
|
}
|
@@ -713,16 +779,18 @@ enum {
|
|
713
779
|
|
714
780
|
static int get_entry(
|
715
781
|
git_config_entry **out,
|
716
|
-
const git_config *
|
782
|
+
const git_config *config,
|
717
783
|
const char *name,
|
718
784
|
bool normalize_name,
|
719
785
|
int want_errors)
|
720
786
|
{
|
787
|
+
backend_entry *entry;
|
788
|
+
git_config_backend *backend;
|
789
|
+
git_config_backend_entry *be;
|
721
790
|
int res = GIT_ENOTFOUND;
|
722
791
|
const char *key = name;
|
723
792
|
char *normalized = NULL;
|
724
793
|
size_t i;
|
725
|
-
backend_internal *internal;
|
726
794
|
|
727
795
|
*out = NULL;
|
728
796
|
|
@@ -733,21 +801,24 @@ static int get_entry(
|
|
733
801
|
}
|
734
802
|
|
735
803
|
res = GIT_ENOTFOUND;
|
736
|
-
git_vector_foreach(&
|
737
|
-
|
738
|
-
|
804
|
+
git_vector_foreach(&config->readers, i, entry) {
|
805
|
+
GIT_ASSERT(entry->instance && entry->instance->backend);
|
806
|
+
|
807
|
+
backend = entry->instance->backend;
|
808
|
+
res = backend->get(backend, key, &be);
|
739
809
|
|
740
|
-
|
741
|
-
|
810
|
+
if (res != GIT_ENOTFOUND) {
|
811
|
+
*out = &be->entry;
|
742
812
|
break;
|
813
|
+
}
|
743
814
|
}
|
744
815
|
|
745
816
|
git__free(normalized);
|
746
817
|
|
747
818
|
cleanup:
|
748
|
-
if (res == GIT_ENOTFOUND)
|
819
|
+
if (res == GIT_ENOTFOUND) {
|
749
820
|
res = (want_errors > GET_ALL_ERRORS) ? 0 : config_error_notfound(name);
|
750
|
-
else if (res && (want_errors == GET_NO_ERRORS)) {
|
821
|
+
} else if (res && (want_errors == GET_NO_ERRORS)) {
|
751
822
|
git_error_clear();
|
752
823
|
res = 0;
|
753
824
|
}
|
@@ -756,24 +827,24 @@ cleanup:
|
|
756
827
|
}
|
757
828
|
|
758
829
|
int git_config_get_entry(
|
759
|
-
git_config_entry **out, const git_config *
|
830
|
+
git_config_entry **out, const git_config *config, const char *name)
|
760
831
|
{
|
761
|
-
return get_entry(out,
|
832
|
+
return get_entry(out, config, name, true, GET_ALL_ERRORS);
|
762
833
|
}
|
763
834
|
|
764
835
|
int git_config__lookup_entry(
|
765
836
|
git_config_entry **out,
|
766
|
-
const git_config *
|
837
|
+
const git_config *config,
|
767
838
|
const char *key,
|
768
839
|
bool no_errors)
|
769
840
|
{
|
770
841
|
return get_entry(
|
771
|
-
out,
|
842
|
+
out, config, key, false, no_errors ? GET_NO_ERRORS : GET_NO_MISSING);
|
772
843
|
}
|
773
844
|
|
774
845
|
int git_config_get_mapped(
|
775
846
|
int *out,
|
776
|
-
const git_config *
|
847
|
+
const git_config *config,
|
777
848
|
const char *name,
|
778
849
|
const git_configmap *maps,
|
779
850
|
size_t map_n)
|
@@ -781,7 +852,7 @@ int git_config_get_mapped(
|
|
781
852
|
git_config_entry *entry;
|
782
853
|
int ret;
|
783
854
|
|
784
|
-
if ((ret = get_entry(&entry,
|
855
|
+
if ((ret = get_entry(&entry, config, name, true, GET_ALL_ERRORS)) < 0)
|
785
856
|
return ret;
|
786
857
|
|
787
858
|
ret = git_config_lookup_map_value(out, maps, map_n, entry->value);
|
@@ -790,12 +861,12 @@ int git_config_get_mapped(
|
|
790
861
|
return ret;
|
791
862
|
}
|
792
863
|
|
793
|
-
int git_config_get_int64(int64_t *out, const git_config *
|
864
|
+
int git_config_get_int64(int64_t *out, const git_config *config, const char *name)
|
794
865
|
{
|
795
866
|
git_config_entry *entry;
|
796
867
|
int ret;
|
797
868
|
|
798
|
-
if ((ret = get_entry(&entry,
|
869
|
+
if ((ret = get_entry(&entry, config, name, true, GET_ALL_ERRORS)) < 0)
|
799
870
|
return ret;
|
800
871
|
|
801
872
|
ret = git_config_parse_int64(out, entry->value);
|
@@ -804,12 +875,12 @@ int git_config_get_int64(int64_t *out, const git_config *cfg, const char *name)
|
|
804
875
|
return ret;
|
805
876
|
}
|
806
877
|
|
807
|
-
int git_config_get_int32(int32_t *out, const git_config *
|
878
|
+
int git_config_get_int32(int32_t *out, const git_config *config, const char *name)
|
808
879
|
{
|
809
880
|
git_config_entry *entry;
|
810
881
|
int ret;
|
811
882
|
|
812
|
-
if ((ret = get_entry(&entry,
|
883
|
+
if ((ret = get_entry(&entry, config, name, true, GET_ALL_ERRORS)) < 0)
|
813
884
|
return ret;
|
814
885
|
|
815
886
|
ret = git_config_parse_int32(out, entry->value);
|
@@ -818,12 +889,12 @@ int git_config_get_int32(int32_t *out, const git_config *cfg, const char *name)
|
|
818
889
|
return ret;
|
819
890
|
}
|
820
891
|
|
821
|
-
int git_config_get_bool(int *out, const git_config *
|
892
|
+
int git_config_get_bool(int *out, const git_config *config, const char *name)
|
822
893
|
{
|
823
894
|
git_config_entry *entry;
|
824
895
|
int ret;
|
825
896
|
|
826
|
-
if ((ret = get_entry(&entry,
|
897
|
+
if ((ret = get_entry(&entry, config, name, true, GET_ALL_ERRORS)) < 0)
|
827
898
|
return ret;
|
828
899
|
|
829
900
|
ret = git_config_parse_bool(out, entry->value);
|
@@ -832,48 +903,80 @@ int git_config_get_bool(int *out, const git_config *cfg, const char *name)
|
|
832
903
|
return ret;
|
833
904
|
}
|
834
905
|
|
835
|
-
static int is_readonly(const git_config *
|
906
|
+
static int is_readonly(const git_config *config)
|
836
907
|
{
|
908
|
+
backend_entry *entry;
|
837
909
|
size_t i;
|
838
|
-
backend_internal *internal;
|
839
910
|
|
840
|
-
git_vector_foreach(&
|
841
|
-
|
842
|
-
continue;
|
911
|
+
git_vector_foreach(&config->writers, i, entry) {
|
912
|
+
GIT_ASSERT(entry->instance && entry->instance->backend);
|
843
913
|
|
844
|
-
if (!
|
914
|
+
if (!entry->instance->backend->readonly)
|
845
915
|
return 0;
|
846
916
|
}
|
847
917
|
|
848
918
|
return 1;
|
849
919
|
}
|
850
920
|
|
851
|
-
int
|
921
|
+
static int git_config__parse_path(git_str *out, const char *value)
|
922
|
+
{
|
923
|
+
GIT_ASSERT_ARG(out);
|
924
|
+
GIT_ASSERT_ARG(value);
|
925
|
+
|
926
|
+
if (value[0] == '~') {
|
927
|
+
if (value[1] != '\0' && value[1] != '/') {
|
928
|
+
git_error_set(GIT_ERROR_CONFIG, "retrieving a homedir by name is not supported");
|
929
|
+
return -1;
|
930
|
+
}
|
931
|
+
|
932
|
+
return git_sysdir_expand_homedir_file(out, value[1] ? &value[2] : NULL);
|
933
|
+
}
|
934
|
+
|
935
|
+
return git_str_sets(out, value);
|
936
|
+
}
|
937
|
+
|
938
|
+
int git_config_parse_path(git_buf *out, const char *value)
|
939
|
+
{
|
940
|
+
GIT_BUF_WRAP_PRIVATE(out, git_config__parse_path, value);
|
941
|
+
}
|
942
|
+
|
943
|
+
int git_config_get_path(
|
944
|
+
git_buf *out,
|
945
|
+
const git_config *config,
|
946
|
+
const char *name)
|
947
|
+
{
|
948
|
+
GIT_BUF_WRAP_PRIVATE(out, git_config__get_path, config, name);
|
949
|
+
}
|
950
|
+
|
951
|
+
int git_config__get_path(
|
952
|
+
git_str *out,
|
953
|
+
const git_config *config,
|
954
|
+
const char *name)
|
852
955
|
{
|
853
956
|
git_config_entry *entry;
|
854
957
|
int error;
|
855
958
|
|
856
|
-
if ((error = get_entry(&entry,
|
959
|
+
if ((error = get_entry(&entry, config, name, true, GET_ALL_ERRORS)) < 0)
|
857
960
|
return error;
|
858
961
|
|
859
|
-
error =
|
962
|
+
error = git_config__parse_path(out, entry->value);
|
860
963
|
git_config_entry_free(entry);
|
861
964
|
|
862
965
|
return error;
|
863
966
|
}
|
864
967
|
|
865
968
|
int git_config_get_string(
|
866
|
-
const char **out, const git_config *
|
969
|
+
const char **out, const git_config *config, const char *name)
|
867
970
|
{
|
868
971
|
git_config_entry *entry;
|
869
972
|
int ret;
|
870
973
|
|
871
|
-
if (!is_readonly(
|
974
|
+
if (!is_readonly(config)) {
|
872
975
|
git_error_set(GIT_ERROR_CONFIG, "get_string called on a live config object");
|
873
976
|
return -1;
|
874
977
|
}
|
875
978
|
|
876
|
-
ret = get_entry(&entry,
|
979
|
+
ret = get_entry(&entry, config, name, true, GET_ALL_ERRORS);
|
877
980
|
*out = !ret ? (entry->value ? entry->value : "") : NULL;
|
878
981
|
|
879
982
|
git_config_entry_free(entry);
|
@@ -882,20 +985,26 @@ int git_config_get_string(
|
|
882
985
|
}
|
883
986
|
|
884
987
|
int git_config_get_string_buf(
|
885
|
-
git_buf *out, const git_config *
|
988
|
+
git_buf *out, const git_config *config, const char *name)
|
989
|
+
{
|
990
|
+
GIT_BUF_WRAP_PRIVATE(out, git_config__get_string_buf, config, name);
|
991
|
+
}
|
992
|
+
|
993
|
+
int git_config__get_string_buf(
|
994
|
+
git_str *out, const git_config *config, const char *name)
|
886
995
|
{
|
887
996
|
git_config_entry *entry;
|
888
997
|
int ret;
|
889
998
|
const char *str;
|
890
999
|
|
891
|
-
|
892
|
-
|
1000
|
+
GIT_ASSERT_ARG(out);
|
1001
|
+
GIT_ASSERT_ARG(config);
|
893
1002
|
|
894
|
-
ret = get_entry(&entry,
|
1003
|
+
ret = get_entry(&entry, config, name, true, GET_ALL_ERRORS);
|
895
1004
|
str = !ret ? (entry->value ? entry->value : "") : NULL;
|
896
1005
|
|
897
1006
|
if (str)
|
898
|
-
ret =
|
1007
|
+
ret = git_str_puts(out, str);
|
899
1008
|
|
900
1009
|
git_config_entry_free(entry);
|
901
1010
|
|
@@ -903,12 +1012,12 @@ int git_config_get_string_buf(
|
|
903
1012
|
}
|
904
1013
|
|
905
1014
|
char *git_config__get_string_force(
|
906
|
-
const git_config *
|
1015
|
+
const git_config *config, const char *key, const char *fallback_value)
|
907
1016
|
{
|
908
1017
|
git_config_entry *entry;
|
909
1018
|
char *ret;
|
910
1019
|
|
911
|
-
get_entry(&entry,
|
1020
|
+
get_entry(&entry, config, key, false, GET_NO_ERRORS);
|
912
1021
|
ret = (entry && entry->value) ? git__strdup(entry->value) : fallback_value ? git__strdup(fallback_value) : NULL;
|
913
1022
|
git_config_entry_free(entry);
|
914
1023
|
|
@@ -916,12 +1025,12 @@ char *git_config__get_string_force(
|
|
916
1025
|
}
|
917
1026
|
|
918
1027
|
int git_config__get_bool_force(
|
919
|
-
const git_config *
|
1028
|
+
const git_config *config, const char *key, int fallback_value)
|
920
1029
|
{
|
921
1030
|
int val = fallback_value;
|
922
1031
|
git_config_entry *entry;
|
923
1032
|
|
924
|
-
get_entry(&entry,
|
1033
|
+
get_entry(&entry, config, key, false, GET_NO_ERRORS);
|
925
1034
|
|
926
1035
|
if (entry && git_config_parse_bool(&val, entry->value) < 0)
|
927
1036
|
git_error_clear();
|
@@ -931,12 +1040,12 @@ int git_config__get_bool_force(
|
|
931
1040
|
}
|
932
1041
|
|
933
1042
|
int git_config__get_int_force(
|
934
|
-
const git_config *
|
1043
|
+
const git_config *config, const char *key, int fallback_value)
|
935
1044
|
{
|
936
1045
|
int32_t val = (int32_t)fallback_value;
|
937
1046
|
git_config_entry *entry;
|
938
1047
|
|
939
|
-
get_entry(&entry,
|
1048
|
+
get_entry(&entry, config, key, false, GET_NO_ERRORS);
|
940
1049
|
|
941
1050
|
if (entry && git_config_parse_int32(&val, entry->value) < 0)
|
942
1051
|
git_error_clear();
|
@@ -946,21 +1055,21 @@ int git_config__get_int_force(
|
|
946
1055
|
}
|
947
1056
|
|
948
1057
|
int git_config_get_multivar_foreach(
|
949
|
-
const git_config *
|
1058
|
+
const git_config *config, const char *name, const char *regexp,
|
950
1059
|
git_config_foreach_cb cb, void *payload)
|
951
1060
|
{
|
952
1061
|
int err, found;
|
953
1062
|
git_config_iterator *iter;
|
954
|
-
|
1063
|
+
git_config_backend_entry *be;
|
955
1064
|
|
956
|
-
if ((err = git_config_multivar_iterator_new(&iter,
|
1065
|
+
if ((err = git_config_multivar_iterator_new(&iter, config, name, regexp)) < 0)
|
957
1066
|
return err;
|
958
1067
|
|
959
1068
|
found = 0;
|
960
|
-
while ((err = iter->next(&
|
1069
|
+
while ((err = iter->next(&be, iter)) == 0) {
|
961
1070
|
found = 1;
|
962
1071
|
|
963
|
-
if ((err = cb(entry, payload)) != 0) {
|
1072
|
+
if ((err = cb(&be->entry, payload)) != 0) {
|
964
1073
|
git_error_set_after_callback(err);
|
965
1074
|
break;
|
966
1075
|
}
|
@@ -984,19 +1093,21 @@ typedef struct {
|
|
984
1093
|
int have_regex;
|
985
1094
|
} multivar_iter;
|
986
1095
|
|
987
|
-
static int multivar_iter_next(
|
1096
|
+
static int multivar_iter_next(
|
1097
|
+
git_config_backend_entry **entry,
|
1098
|
+
git_config_iterator *_iter)
|
988
1099
|
{
|
989
1100
|
multivar_iter *iter = (multivar_iter *) _iter;
|
990
1101
|
int error = 0;
|
991
1102
|
|
992
1103
|
while ((error = iter->iter->next(entry, iter->iter)) == 0) {
|
993
|
-
if (git__strcmp(iter->name, (*entry)->name))
|
1104
|
+
if (git__strcmp(iter->name, (*entry)->entry.name))
|
994
1105
|
continue;
|
995
1106
|
|
996
1107
|
if (!iter->have_regex)
|
997
1108
|
return 0;
|
998
1109
|
|
999
|
-
if (git_regexp_match(&iter->regex, (*entry)->value) == 0)
|
1110
|
+
if (git_regexp_match(&iter->regex, (*entry)->entry.value) == 0)
|
1000
1111
|
return 0;
|
1001
1112
|
}
|
1002
1113
|
|
@@ -1015,13 +1126,13 @@ static void multivar_iter_free(git_config_iterator *_iter)
|
|
1015
1126
|
git__free(iter);
|
1016
1127
|
}
|
1017
1128
|
|
1018
|
-
int git_config_multivar_iterator_new(git_config_iterator **out, const git_config *
|
1129
|
+
int git_config_multivar_iterator_new(git_config_iterator **out, const git_config *config, const char *name, const char *regexp)
|
1019
1130
|
{
|
1020
1131
|
multivar_iter *iter = NULL;
|
1021
1132
|
git_config_iterator *inner = NULL;
|
1022
1133
|
int error;
|
1023
1134
|
|
1024
|
-
if ((error = git_config_iterator_new(&inner,
|
1135
|
+
if ((error = git_config_iterator_new(&inner, config)) < 0)
|
1025
1136
|
return error;
|
1026
1137
|
|
1027
1138
|
iter = git__calloc(1, sizeof(multivar_iter));
|
@@ -1052,29 +1163,38 @@ on_error:
|
|
1052
1163
|
return error;
|
1053
1164
|
}
|
1054
1165
|
|
1055
|
-
int git_config_set_multivar(git_config *
|
1166
|
+
int git_config_set_multivar(git_config *config, const char *name, const char *regexp, const char *value)
|
1056
1167
|
{
|
1057
1168
|
git_config_backend *backend;
|
1058
1169
|
|
1059
|
-
if (
|
1060
|
-
|
1170
|
+
if ((backend = get_writer(config)) == NULL) {
|
1171
|
+
git_error_set(GIT_ERROR_CONFIG, "cannot set '%s': the configuration is read-only", name);
|
1172
|
+
return GIT_EREADONLY;
|
1173
|
+
}
|
1061
1174
|
|
1062
1175
|
return backend->set_multivar(backend, name, regexp, value);
|
1063
1176
|
}
|
1064
1177
|
|
1065
|
-
int git_config_delete_multivar(git_config *
|
1178
|
+
int git_config_delete_multivar(git_config *config, const char *name, const char *regexp)
|
1066
1179
|
{
|
1067
1180
|
git_config_backend *backend;
|
1068
1181
|
|
1069
|
-
if (
|
1070
|
-
return
|
1182
|
+
if ((backend = get_writer(config)) == NULL)
|
1183
|
+
return GIT_EREADONLY;
|
1071
1184
|
|
1072
1185
|
return backend->del_multivar(backend, name, regexp);
|
1073
1186
|
}
|
1074
1187
|
|
1075
1188
|
int git_config_next(git_config_entry **entry, git_config_iterator *iter)
|
1076
1189
|
{
|
1077
|
-
|
1190
|
+
git_config_backend_entry *be;
|
1191
|
+
int error;
|
1192
|
+
|
1193
|
+
if ((error = iter->next(&be, iter)) != 0)
|
1194
|
+
return error;
|
1195
|
+
|
1196
|
+
*entry = &be->entry;
|
1197
|
+
return 0;
|
1078
1198
|
}
|
1079
1199
|
|
1080
1200
|
void git_config_iterator_free(git_config_iterator *iter)
|
@@ -1087,149 +1207,168 @@ void git_config_iterator_free(git_config_iterator *iter)
|
|
1087
1207
|
|
1088
1208
|
int git_config_find_global(git_buf *path)
|
1089
1209
|
{
|
1090
|
-
|
1091
|
-
|
1092
|
-
if ((error = git_buf_sanitize(path)) < 0)
|
1093
|
-
return error;
|
1210
|
+
GIT_BUF_WRAP_PRIVATE(path, git_sysdir_find_global_file, GIT_CONFIG_FILENAME_GLOBAL);
|
1211
|
+
}
|
1094
1212
|
|
1213
|
+
int git_config__find_global(git_str *path)
|
1214
|
+
{
|
1095
1215
|
return git_sysdir_find_global_file(path, GIT_CONFIG_FILENAME_GLOBAL);
|
1096
1216
|
}
|
1097
1217
|
|
1098
1218
|
int git_config_find_xdg(git_buf *path)
|
1099
1219
|
{
|
1100
|
-
|
1101
|
-
|
1102
|
-
if ((error = git_buf_sanitize(path)) < 0)
|
1103
|
-
return error;
|
1220
|
+
GIT_BUF_WRAP_PRIVATE(path, git_sysdir_find_xdg_file, GIT_CONFIG_FILENAME_XDG);
|
1221
|
+
}
|
1104
1222
|
|
1223
|
+
int git_config__find_xdg(git_str *path)
|
1224
|
+
{
|
1105
1225
|
return git_sysdir_find_xdg_file(path, GIT_CONFIG_FILENAME_XDG);
|
1106
1226
|
}
|
1107
1227
|
|
1108
1228
|
int git_config_find_system(git_buf *path)
|
1109
1229
|
{
|
1110
|
-
|
1111
|
-
|
1112
|
-
if ((error = git_buf_sanitize(path)) < 0)
|
1113
|
-
return error;
|
1230
|
+
GIT_BUF_WRAP_PRIVATE(path, git_sysdir_find_system_file, GIT_CONFIG_FILENAME_SYSTEM);
|
1231
|
+
}
|
1114
1232
|
|
1233
|
+
int git_config__find_system(git_str *path)
|
1234
|
+
{
|
1115
1235
|
return git_sysdir_find_system_file(path, GIT_CONFIG_FILENAME_SYSTEM);
|
1116
1236
|
}
|
1117
1237
|
|
1118
1238
|
int git_config_find_programdata(git_buf *path)
|
1119
1239
|
{
|
1120
|
-
|
1240
|
+
git_str str = GIT_STR_INIT;
|
1241
|
+
int error;
|
1121
1242
|
|
1122
|
-
if ((
|
1123
|
-
|
1243
|
+
if ((error = git_buf_tostr(&str, path)) == 0 &&
|
1244
|
+
(error = git_config__find_programdata(&str)) == 0)
|
1245
|
+
error = git_buf_fromstr(path, &str);
|
1124
1246
|
|
1125
|
-
|
1126
|
-
|
1127
|
-
|
1128
|
-
|
1247
|
+
git_str_dispose(&str);
|
1248
|
+
return error;
|
1249
|
+
}
|
1250
|
+
|
1251
|
+
int git_config__find_programdata(git_str *path)
|
1252
|
+
{
|
1253
|
+
git_fs_path_owner_t owner_level =
|
1254
|
+
GIT_FS_PATH_OWNER_CURRENT_USER |
|
1255
|
+
GIT_FS_PATH_OWNER_ADMINISTRATOR;
|
1256
|
+
bool is_safe;
|
1257
|
+
int error;
|
1258
|
+
|
1259
|
+
if ((error = git_sysdir_find_programdata_file(path, GIT_CONFIG_FILENAME_PROGRAMDATA)) < 0)
|
1260
|
+
return error;
|
1261
|
+
|
1262
|
+
if (git_fs_path_owner_is(&is_safe, path->ptr, owner_level) < 0)
|
1263
|
+
return -1;
|
1264
|
+
|
1265
|
+
if (!is_safe) {
|
1266
|
+
git_error_set(GIT_ERROR_CONFIG, "programdata path has invalid ownership");
|
1267
|
+
return -1;
|
1268
|
+
}
|
1129
1269
|
|
1130
|
-
return
|
1270
|
+
return 0;
|
1131
1271
|
}
|
1132
1272
|
|
1133
|
-
int git_config__global_location(
|
1273
|
+
int git_config__global_location(git_str *buf)
|
1134
1274
|
{
|
1135
|
-
const
|
1275
|
+
const git_str *paths;
|
1136
1276
|
const char *sep, *start;
|
1137
1277
|
|
1138
1278
|
if (git_sysdir_get(&paths, GIT_SYSDIR_GLOBAL) < 0)
|
1139
1279
|
return -1;
|
1140
1280
|
|
1141
1281
|
/* no paths, so give up */
|
1142
|
-
if (!paths || !
|
1282
|
+
if (!paths || !git_str_len(paths))
|
1143
1283
|
return -1;
|
1144
1284
|
|
1145
1285
|
/* find unescaped separator or end of string */
|
1146
|
-
for (sep = start =
|
1286
|
+
for (sep = start = git_str_cstr(paths); *sep; ++sep) {
|
1147
1287
|
if (*sep == GIT_PATH_LIST_SEPARATOR &&
|
1148
1288
|
(sep <= start || sep[-1] != '\\'))
|
1149
1289
|
break;
|
1150
1290
|
}
|
1151
1291
|
|
1152
|
-
if (
|
1292
|
+
if (git_str_set(buf, start, (size_t)(sep - start)) < 0)
|
1153
1293
|
return -1;
|
1154
1294
|
|
1155
|
-
return
|
1295
|
+
return git_str_joinpath(buf, buf->ptr, GIT_CONFIG_FILENAME_GLOBAL);
|
1156
1296
|
}
|
1157
1297
|
|
1158
1298
|
int git_config_open_default(git_config **out)
|
1159
1299
|
{
|
1160
1300
|
int error;
|
1161
|
-
git_config *
|
1162
|
-
|
1301
|
+
git_config *config = NULL;
|
1302
|
+
git_str buf = GIT_STR_INIT;
|
1163
1303
|
|
1164
|
-
if ((error = git_config_new(&
|
1304
|
+
if ((error = git_config_new(&config)) < 0)
|
1165
1305
|
return error;
|
1166
1306
|
|
1167
|
-
if (!
|
1168
|
-
|
1307
|
+
if (!git_config__find_global(&buf) ||
|
1308
|
+
!git_config__global_location(&buf)) {
|
1309
|
+
error = git_config_add_file_ondisk(config, buf.ptr,
|
1169
1310
|
GIT_CONFIG_LEVEL_GLOBAL, NULL, 0);
|
1170
1311
|
}
|
1171
1312
|
|
1172
|
-
if (!error && !
|
1173
|
-
error = git_config_add_file_ondisk(
|
1313
|
+
if (!error && !git_config__find_xdg(&buf))
|
1314
|
+
error = git_config_add_file_ondisk(config, buf.ptr,
|
1174
1315
|
GIT_CONFIG_LEVEL_XDG, NULL, 0);
|
1175
1316
|
|
1176
|
-
if (!error && !
|
1177
|
-
error = git_config_add_file_ondisk(
|
1317
|
+
if (!error && !git_config__find_system(&buf))
|
1318
|
+
error = git_config_add_file_ondisk(config, buf.ptr,
|
1178
1319
|
GIT_CONFIG_LEVEL_SYSTEM, NULL, 0);
|
1179
1320
|
|
1180
|
-
if (!error && !
|
1181
|
-
error = git_config_add_file_ondisk(
|
1321
|
+
if (!error && !git_config__find_programdata(&buf))
|
1322
|
+
error = git_config_add_file_ondisk(config, buf.ptr,
|
1182
1323
|
GIT_CONFIG_LEVEL_PROGRAMDATA, NULL, 0);
|
1183
1324
|
|
1184
|
-
|
1325
|
+
git_str_dispose(&buf);
|
1185
1326
|
|
1186
1327
|
if (error) {
|
1187
|
-
git_config_free(
|
1188
|
-
|
1328
|
+
git_config_free(config);
|
1329
|
+
config = NULL;
|
1189
1330
|
}
|
1190
1331
|
|
1191
|
-
*out =
|
1332
|
+
*out = config;
|
1192
1333
|
|
1193
1334
|
return error;
|
1194
1335
|
}
|
1195
1336
|
|
1196
|
-
int git_config_lock(git_transaction **out, git_config *
|
1337
|
+
int git_config_lock(git_transaction **out, git_config *config)
|
1197
1338
|
{
|
1339
|
+
backend_instance *instance;
|
1198
1340
|
int error;
|
1199
|
-
git_config_backend *backend;
|
1200
|
-
backend_internal *internal;
|
1201
1341
|
|
1202
|
-
GIT_ASSERT_ARG(
|
1342
|
+
GIT_ASSERT_ARG(config);
|
1203
1343
|
|
1204
|
-
|
1205
|
-
|
1206
|
-
|
1207
|
-
return -1;
|
1344
|
+
if ((instance = get_writer_instance(config)) == NULL) {
|
1345
|
+
git_error_set(GIT_ERROR_CONFIG, "cannot lock: the configuration is read-only");
|
1346
|
+
return GIT_EREADONLY;
|
1208
1347
|
}
|
1209
|
-
backend = internal->backend;
|
1210
1348
|
|
1211
|
-
if ((error = backend->lock(backend)) < 0
|
1349
|
+
if ((error = instance->backend->lock(instance->backend)) < 0 ||
|
1350
|
+
(error = git_transaction_config_new(out, config, instance)) < 0)
|
1212
1351
|
return error;
|
1213
1352
|
|
1214
|
-
|
1353
|
+
GIT_REFCOUNT_INC(instance);
|
1354
|
+
return 0;
|
1215
1355
|
}
|
1216
1356
|
|
1217
|
-
int git_config_unlock(
|
1357
|
+
int git_config_unlock(
|
1358
|
+
git_config *config,
|
1359
|
+
void *data,
|
1360
|
+
int commit)
|
1218
1361
|
{
|
1219
|
-
|
1220
|
-
|
1221
|
-
|
1222
|
-
GIT_ASSERT_ARG(cfg);
|
1362
|
+
backend_instance *instance = data;
|
1363
|
+
int error;
|
1223
1364
|
|
1224
|
-
|
1225
|
-
|
1226
|
-
git_error_set(GIT_ERROR_CONFIG, "cannot lock; the config has no backends");
|
1227
|
-
return -1;
|
1228
|
-
}
|
1365
|
+
GIT_ASSERT_ARG(config && data);
|
1366
|
+
GIT_UNUSED(config);
|
1229
1367
|
|
1230
|
-
|
1368
|
+
error = instance->backend->unlock(instance->backend, commit);
|
1369
|
+
GIT_REFCOUNT_DEC(instance, backend_instance_free);
|
1231
1370
|
|
1232
|
-
return
|
1371
|
+
return error;
|
1233
1372
|
}
|
1234
1373
|
|
1235
1374
|
/***********
|
@@ -1375,28 +1514,6 @@ fail_parse:
|
|
1375
1514
|
return -1;
|
1376
1515
|
}
|
1377
1516
|
|
1378
|
-
int git_config_parse_path(git_buf *out, const char *value)
|
1379
|
-
{
|
1380
|
-
int error;
|
1381
|
-
|
1382
|
-
GIT_ASSERT_ARG(out);
|
1383
|
-
GIT_ASSERT_ARG(value);
|
1384
|
-
|
1385
|
-
if ((error = git_buf_sanitize(out)) < 0)
|
1386
|
-
return error;
|
1387
|
-
|
1388
|
-
if (value[0] == '~') {
|
1389
|
-
if (value[1] != '\0' && value[1] != '/') {
|
1390
|
-
git_error_set(GIT_ERROR_CONFIG, "retrieving a homedir by name is not supported");
|
1391
|
-
return -1;
|
1392
|
-
}
|
1393
|
-
|
1394
|
-
return git_sysdir_expand_global_file(out, value[1] ? &value[2] : NULL);
|
1395
|
-
}
|
1396
|
-
|
1397
|
-
return git_buf_sets(out, value);
|
1398
|
-
}
|
1399
|
-
|
1400
1517
|
static int normalize_section(char *start, char *end)
|
1401
1518
|
{
|
1402
1519
|
char *scan;
|
@@ -1408,7 +1525,7 @@ static int normalize_section(char *start, char *end)
|
|
1408
1525
|
for (scan = start; *scan; ++scan) {
|
1409
1526
|
if (end && scan >= end)
|
1410
1527
|
break;
|
1411
|
-
if (
|
1528
|
+
if (git__isalnum(*scan))
|
1412
1529
|
*scan = (char)git__tolower(*scan);
|
1413
1530
|
else if (*scan != '-' || scan == start)
|
1414
1531
|
return GIT_EINVALIDSPEC;
|
@@ -1459,7 +1576,7 @@ invalid:
|
|
1459
1576
|
|
1460
1577
|
struct rename_data {
|
1461
1578
|
git_config *config;
|
1462
|
-
|
1579
|
+
git_str *name;
|
1463
1580
|
size_t old_len;
|
1464
1581
|
};
|
1465
1582
|
|
@@ -1469,20 +1586,33 @@ static int rename_config_entries_cb(
|
|
1469
1586
|
{
|
1470
1587
|
int error = 0;
|
1471
1588
|
struct rename_data *data = (struct rename_data *)payload;
|
1472
|
-
size_t base_len =
|
1589
|
+
size_t base_len = git_str_len(data->name);
|
1590
|
+
git_str value = GIT_STR_INIT;
|
1591
|
+
|
1592
|
+
if (base_len > 0) {
|
1593
|
+
if ((error = git_str_puts(data->name,
|
1594
|
+
entry->name + data->old_len)) < 0 ||
|
1595
|
+
(error = git_config_set_multivar(
|
1596
|
+
data->config, git_str_cstr(data->name), "^$",
|
1597
|
+
entry->value)) < 0)
|
1598
|
+
goto cleanup;
|
1599
|
+
}
|
1473
1600
|
|
1474
|
-
|
1475
|
-
|
1476
|
-
|
1477
|
-
error = git_config_set_string(
|
1478
|
-
data->config, git_buf_cstr(data->name), entry->value);
|
1601
|
+
git_str_putc(&value, '^');
|
1602
|
+
git_str_puts_escape_regex(&value, entry->value);
|
1603
|
+
git_str_putc(&value, '$');
|
1479
1604
|
|
1480
|
-
|
1605
|
+
if (git_str_oom(&value)) {
|
1606
|
+
error = -1;
|
1607
|
+
goto cleanup;
|
1481
1608
|
}
|
1482
1609
|
|
1483
|
-
|
1484
|
-
|
1610
|
+
error = git_config_delete_multivar(
|
1611
|
+
data->config, entry->name, git_str_cstr(&value));
|
1485
1612
|
|
1613
|
+
cleanup:
|
1614
|
+
git_str_truncate(data->name, base_len);
|
1615
|
+
git_str_dispose(&value);
|
1486
1616
|
return error;
|
1487
1617
|
}
|
1488
1618
|
|
@@ -1492,13 +1622,13 @@ int git_config_rename_section(
|
|
1492
1622
|
const char *new_section_name)
|
1493
1623
|
{
|
1494
1624
|
git_config *config;
|
1495
|
-
|
1625
|
+
git_str pattern = GIT_STR_INIT, replace = GIT_STR_INIT;
|
1496
1626
|
int error = 0;
|
1497
1627
|
struct rename_data data;
|
1498
1628
|
|
1499
|
-
|
1629
|
+
git_str_puts_escape_regex(&pattern, old_section_name);
|
1500
1630
|
|
1501
|
-
if ((error =
|
1631
|
+
if ((error = git_str_puts(&pattern, "\\..+")) < 0)
|
1502
1632
|
goto cleanup;
|
1503
1633
|
|
1504
1634
|
if ((error = git_repository_config__weakptr(&config, repo)) < 0)
|
@@ -1508,7 +1638,7 @@ int git_config_rename_section(
|
|
1508
1638
|
data.name = &replace;
|
1509
1639
|
data.old_len = strlen(old_section_name) + 1;
|
1510
1640
|
|
1511
|
-
if ((error =
|
1641
|
+
if ((error = git_str_join(&replace, '.', new_section_name, "")) < 0)
|
1512
1642
|
goto cleanup;
|
1513
1643
|
|
1514
1644
|
if (new_section_name != NULL &&
|
@@ -1520,11 +1650,11 @@ int git_config_rename_section(
|
|
1520
1650
|
}
|
1521
1651
|
|
1522
1652
|
error = git_config_foreach_match(
|
1523
|
-
config,
|
1653
|
+
config, git_str_cstr(&pattern), rename_config_entries_cb, &data);
|
1524
1654
|
|
1525
1655
|
cleanup:
|
1526
|
-
|
1527
|
-
|
1656
|
+
git_str_dispose(&pattern);
|
1657
|
+
git_str_dispose(&replace);
|
1528
1658
|
|
1529
1659
|
return error;
|
1530
1660
|
}
|