rugged 0.28.4 → 0.28.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rugged/version.rb +1 -1
- data/vendor/libgit2/AUTHORS +0 -1
- data/vendor/libgit2/CMakeLists.txt +16 -36
- data/vendor/libgit2/COPYING +0 -28
- data/vendor/libgit2/cmake/Modules/EnableWarnings.cmake +1 -5
- data/vendor/libgit2/cmake/Modules/FindCoreFoundation.cmake +2 -2
- data/vendor/libgit2/cmake/Modules/FindGSSAPI.cmake +1 -1
- data/vendor/libgit2/cmake/Modules/FindSecurity.cmake +2 -2
- data/vendor/libgit2/cmake/Modules/FindStatNsec.cmake +0 -6
- data/vendor/libgit2/deps/http-parser/http_parser.c +6 -11
- data/vendor/libgit2/deps/regex/CMakeLists.txt +2 -0
- data/vendor/libgit2/deps/regex/COPYING +502 -0
- data/vendor/libgit2/deps/regex/config.h +7 -0
- data/vendor/libgit2/deps/regex/regcomp.c +3857 -0
- data/vendor/libgit2/deps/regex/regex.c +92 -0
- data/vendor/libgit2/deps/regex/regex.h +582 -0
- data/vendor/libgit2/deps/regex/regex_internal.c +1744 -0
- data/vendor/libgit2/deps/regex/regex_internal.h +819 -0
- data/vendor/libgit2/deps/regex/regexec.c +4369 -0
- data/vendor/libgit2/deps/zlib/adler32.c +7 -0
- data/vendor/libgit2/deps/zlib/crc32.c +7 -0
- data/vendor/libgit2/include/git2.h +0 -2
- data/vendor/libgit2/include/git2/apply.h +2 -22
- data/vendor/libgit2/include/git2/attr.h +12 -19
- data/vendor/libgit2/include/git2/blame.h +2 -2
- data/vendor/libgit2/include/git2/blob.h +12 -44
- data/vendor/libgit2/include/git2/buffer.h +14 -20
- data/vendor/libgit2/include/git2/checkout.h +14 -46
- data/vendor/libgit2/include/git2/cherrypick.h +3 -3
- data/vendor/libgit2/include/git2/clone.h +2 -2
- data/vendor/libgit2/include/git2/commit.h +1 -23
- data/vendor/libgit2/include/git2/common.h +5 -7
- data/vendor/libgit2/include/git2/config.h +12 -12
- data/vendor/libgit2/include/git2/deprecated.h +3 -243
- data/vendor/libgit2/include/git2/describe.h +4 -4
- data/vendor/libgit2/include/git2/diff.h +14 -16
- data/vendor/libgit2/include/git2/filter.h +0 -8
- data/vendor/libgit2/include/git2/index.h +1 -2
- data/vendor/libgit2/include/git2/indexer.h +4 -48
- data/vendor/libgit2/include/git2/inttypes.h +309 -0
- data/vendor/libgit2/include/git2/merge.h +10 -6
- data/vendor/libgit2/include/git2/net.h +5 -0
- data/vendor/libgit2/include/git2/object.h +14 -2
- data/vendor/libgit2/include/git2/odb.h +2 -3
- data/vendor/libgit2/include/git2/odb_backend.h +4 -5
- data/vendor/libgit2/include/git2/oid.h +1 -1
- data/vendor/libgit2/include/git2/pack.h +1 -12
- data/vendor/libgit2/include/git2/proxy.h +3 -5
- data/vendor/libgit2/include/git2/rebase.h +2 -46
- data/vendor/libgit2/include/git2/refs.h +0 -19
- data/vendor/libgit2/include/git2/remote.h +12 -35
- data/vendor/libgit2/include/git2/repository.h +2 -24
- data/vendor/libgit2/include/git2/revert.h +1 -1
- data/vendor/libgit2/include/git2/stash.h +3 -3
- data/vendor/libgit2/include/git2/status.h +16 -25
- data/vendor/libgit2/include/git2/submodule.h +3 -20
- data/vendor/libgit2/include/git2/sys/alloc.h +9 -9
- data/vendor/libgit2/include/git2/sys/odb_backend.h +4 -48
- data/vendor/libgit2/include/git2/sys/refdb_backend.h +21 -57
- data/vendor/libgit2/include/git2/sys/repository.h +1 -5
- data/vendor/libgit2/include/git2/sys/time.h +31 -0
- data/vendor/libgit2/include/git2/sys/transport.h +2 -2
- data/vendor/libgit2/include/git2/tag.h +2 -11
- data/vendor/libgit2/include/git2/trace.h +2 -2
- data/vendor/libgit2/include/git2/transport.h +340 -11
- data/vendor/libgit2/include/git2/tree.h +1 -1
- data/vendor/libgit2/include/git2/types.h +89 -4
- data/vendor/libgit2/include/git2/version.h +2 -2
- data/vendor/libgit2/include/git2/worktree.h +5 -5
- data/vendor/libgit2/libgit2.pc.in +13 -0
- data/vendor/libgit2/src/CMakeLists.txt +222 -88
- data/vendor/libgit2/src/alloc.c +14 -2
- data/vendor/libgit2/src/apply.c +30 -60
- data/vendor/libgit2/src/attr.c +64 -70
- data/vendor/libgit2/src/attr_file.c +96 -189
- data/vendor/libgit2/src/attr_file.h +9 -9
- data/vendor/libgit2/src/attrcache.c +46 -44
- data/vendor/libgit2/src/attrcache.h +1 -2
- data/vendor/libgit2/src/blame.c +5 -17
- data/vendor/libgit2/src/blame.h +1 -1
- data/vendor/libgit2/src/blame_git.c +7 -21
- data/vendor/libgit2/src/blob.c +17 -81
- data/vendor/libgit2/src/blob.h +2 -2
- data/vendor/libgit2/src/branch.c +5 -29
- data/vendor/libgit2/src/buffer.c +7 -14
- data/vendor/libgit2/src/cache.c +33 -26
- data/vendor/libgit2/src/cache.h +1 -1
- data/vendor/libgit2/src/cc-compat.h +0 -5
- data/vendor/libgit2/src/checkout.c +16 -26
- data/vendor/libgit2/src/cherrypick.c +3 -9
- data/vendor/libgit2/src/clone.c +7 -29
- data/vendor/libgit2/src/clone.h +0 -4
- data/vendor/libgit2/src/commit.c +21 -69
- data/vendor/libgit2/src/commit.h +0 -6
- data/vendor/libgit2/src/commit_list.c +76 -28
- data/vendor/libgit2/src/commit_list.h +2 -2
- data/vendor/libgit2/src/common.h +75 -3
- data/vendor/libgit2/src/config.c +40 -31
- data/vendor/libgit2/src/config.h +6 -7
- data/vendor/libgit2/src/config_backend.h +0 -12
- data/vendor/libgit2/src/config_cache.c +39 -39
- data/vendor/libgit2/src/config_entries.c +99 -69
- data/vendor/libgit2/src/config_entries.h +0 -1
- data/vendor/libgit2/src/config_file.c +380 -337
- data/vendor/libgit2/src/config_mem.c +16 -12
- data/vendor/libgit2/src/config_parse.c +29 -49
- data/vendor/libgit2/src/config_parse.h +12 -13
- data/vendor/libgit2/src/crlf.c +14 -14
- data/vendor/libgit2/src/describe.c +20 -21
- data/vendor/libgit2/src/diff.c +58 -43
- data/vendor/libgit2/src/diff.h +1 -2
- data/vendor/libgit2/src/diff_driver.c +38 -37
- data/vendor/libgit2/src/diff_file.c +7 -9
- data/vendor/libgit2/src/diff_file.h +1 -1
- data/vendor/libgit2/src/diff_generate.c +85 -135
- data/vendor/libgit2/src/diff_generate.h +2 -2
- data/vendor/libgit2/src/diff_parse.c +1 -1
- data/vendor/libgit2/src/diff_print.c +13 -25
- data/vendor/libgit2/src/diff_stats.c +1 -1
- data/vendor/libgit2/src/diff_tform.c +4 -4
- data/vendor/libgit2/src/errors.c +22 -12
- data/vendor/libgit2/src/features.h.in +2 -9
- data/vendor/libgit2/src/fetch.c +2 -7
- data/vendor/libgit2/src/fetchhead.c +1 -1
- data/vendor/libgit2/src/filebuf.c +10 -6
- data/vendor/libgit2/src/filebuf.h +2 -2
- data/vendor/libgit2/src/{futils.c → fileops.c} +17 -21
- data/vendor/libgit2/src/{futils.h → fileops.h} +5 -5
- data/vendor/libgit2/src/filter.c +8 -16
- data/vendor/libgit2/src/fnmatch.c +248 -0
- data/vendor/libgit2/src/fnmatch.h +48 -0
- data/vendor/libgit2/src/global.c +40 -12
- data/vendor/libgit2/src/global.h +2 -0
- data/vendor/libgit2/src/hash.c +0 -61
- data/vendor/libgit2/src/hash.h +21 -19
- data/vendor/libgit2/src/hash/{sha1/collisiondetect.c → hash_collisiondetect.h} +17 -14
- data/vendor/libgit2/src/hash/{sha1/common_crypto.c → hash_common_crypto.h} +19 -15
- data/vendor/libgit2/src/hash/{sha1/generic.c → hash_generic.c} +10 -22
- data/vendor/libgit2/src/hash/{sha1/generic.h → hash_generic.h} +14 -4
- data/vendor/libgit2/src/hash/{sha1/mbedtls.c → hash_mbedtls.c} +7 -15
- data/vendor/libgit2/src/hash/{sha1/mbedtls.h → hash_mbedtls.h} +11 -6
- data/vendor/libgit2/src/hash/{sha1/openssl.c → hash_openssl.h} +18 -14
- data/vendor/libgit2/src/hash/{sha1/win32.c → hash_win32.c} +24 -34
- data/vendor/libgit2/src/hash/{sha1/win32.h → hash_win32.h} +19 -6
- data/vendor/libgit2/src/hash/{sha1/sha1dc → sha1dc}/sha1.c +3 -14
- data/vendor/libgit2/src/hash/{sha1/sha1dc → sha1dc}/sha1.h +0 -0
- data/vendor/libgit2/src/hash/{sha1/sha1dc → sha1dc}/ubc_check.c +0 -0
- data/vendor/libgit2/src/hash/{sha1/sha1dc → sha1dc}/ubc_check.h +0 -0
- data/vendor/libgit2/src/hashsig.c +1 -1
- data/vendor/libgit2/src/idxmap.c +65 -91
- data/vendor/libgit2/src/idxmap.h +15 -151
- data/vendor/libgit2/src/ignore.c +38 -32
- data/vendor/libgit2/src/index.c +43 -66
- data/vendor/libgit2/src/index.h +1 -1
- data/vendor/libgit2/src/indexer.c +70 -69
- data/vendor/libgit2/src/integer.h +4 -39
- data/vendor/libgit2/src/iterator.c +22 -27
- data/vendor/libgit2/src/map.h +1 -1
- data/vendor/libgit2/src/merge.c +44 -58
- data/vendor/libgit2/src/merge_driver.c +4 -4
- data/vendor/libgit2/src/merge_file.c +1 -1
- data/vendor/libgit2/src/mwindow.c +23 -18
- data/vendor/libgit2/src/mwindow.h +4 -4
- data/vendor/libgit2/src/netops.c +165 -55
- data/vendor/libgit2/src/netops.h +25 -3
- data/vendor/libgit2/src/notes.c +2 -2
- data/vendor/libgit2/src/object.c +2 -2
- data/vendor/libgit2/src/object.h +0 -2
- data/vendor/libgit2/src/odb.c +23 -41
- data/vendor/libgit2/src/odb.h +2 -3
- data/vendor/libgit2/src/odb_loose.c +10 -17
- data/vendor/libgit2/src/odb_mempack.c +23 -10
- data/vendor/libgit2/src/odb_pack.c +4 -4
- data/vendor/libgit2/src/offmap.c +55 -43
- data/vendor/libgit2/src/offmap.h +24 -102
- data/vendor/libgit2/src/oid.c +1 -6
- data/vendor/libgit2/src/oidmap.c +57 -39
- data/vendor/libgit2/src/oidmap.h +19 -99
- data/vendor/libgit2/src/pack-objects.c +32 -25
- data/vendor/libgit2/src/pack-objects.h +1 -1
- data/vendor/libgit2/src/pack.c +47 -45
- data/vendor/libgit2/src/pack.h +14 -12
- data/vendor/libgit2/src/parse.c +0 -10
- data/vendor/libgit2/src/parse.h +3 -3
- data/vendor/libgit2/src/patch.c +1 -1
- data/vendor/libgit2/src/patch_generate.c +2 -2
- data/vendor/libgit2/src/patch_parse.c +31 -124
- data/vendor/libgit2/src/path.c +6 -43
- data/vendor/libgit2/src/path.h +0 -2
- data/vendor/libgit2/src/pathspec.c +13 -13
- data/vendor/libgit2/src/pool.c +22 -26
- data/vendor/libgit2/src/pool.h +7 -7
- data/vendor/libgit2/src/posix.c +7 -7
- data/vendor/libgit2/src/posix.h +1 -12
- data/vendor/libgit2/src/proxy.c +2 -7
- data/vendor/libgit2/src/push.c +5 -10
- data/vendor/libgit2/src/reader.c +2 -2
- data/vendor/libgit2/src/rebase.c +7 -66
- data/vendor/libgit2/src/refdb.c +0 -12
- data/vendor/libgit2/src/refdb_fs.c +165 -214
- data/vendor/libgit2/src/reflog.c +13 -11
- data/vendor/libgit2/src/refs.c +18 -24
- data/vendor/libgit2/src/refspec.c +16 -9
- data/vendor/libgit2/src/remote.c +52 -50
- data/vendor/libgit2/src/remote.h +2 -2
- data/vendor/libgit2/src/repository.c +100 -115
- data/vendor/libgit2/src/repository.h +40 -49
- data/vendor/libgit2/src/revert.c +3 -8
- data/vendor/libgit2/src/revparse.c +19 -18
- data/vendor/libgit2/src/revwalk.c +30 -63
- data/vendor/libgit2/src/revwalk.h +0 -20
- data/vendor/libgit2/src/settings.c +0 -5
- data/vendor/libgit2/src/sortedcache.c +26 -12
- data/vendor/libgit2/src/sortedcache.h +1 -1
- data/vendor/libgit2/src/stash.c +65 -45
- data/vendor/libgit2/src/status.c +9 -15
- data/vendor/libgit2/src/{allocators/stdalloc.c → stdalloc.c} +4 -3
- data/vendor/libgit2/src/{allocators/stdalloc.h → stdalloc.h} +4 -4
- data/vendor/libgit2/src/streams/openssl.c +0 -20
- data/vendor/libgit2/src/streams/socket.c +2 -2
- data/vendor/libgit2/src/strmap.c +84 -37
- data/vendor/libgit2/src/strmap.h +33 -105
- data/vendor/libgit2/src/submodule.c +70 -102
- data/vendor/libgit2/src/submodule.h +1 -1
- data/vendor/libgit2/src/sysdir.c +1 -11
- data/vendor/libgit2/src/tag.c +2 -10
- data/vendor/libgit2/src/trace.c +1 -1
- data/vendor/libgit2/src/trace.h +2 -2
- data/vendor/libgit2/src/trailer.c +32 -46
- data/vendor/libgit2/src/transaction.c +9 -10
- data/vendor/libgit2/src/transports/auth.c +9 -10
- data/vendor/libgit2/src/transports/auth.h +4 -11
- data/vendor/libgit2/src/transports/auth_negotiate.c +9 -23
- data/vendor/libgit2/src/transports/auth_negotiate.h +2 -2
- data/vendor/libgit2/src/transports/cred.c +6 -6
- data/vendor/libgit2/src/{allocators/win32_crtdbg.h → transports/cred.h} +4 -5
- data/vendor/libgit2/src/transports/git.c +16 -11
- data/vendor/libgit2/src/transports/http.c +276 -419
- data/vendor/libgit2/src/transports/http.h +1 -1
- data/vendor/libgit2/src/transports/local.c +9 -9
- data/vendor/libgit2/src/transports/smart.c +17 -17
- data/vendor/libgit2/src/transports/smart.h +2 -2
- data/vendor/libgit2/src/transports/smart_protocol.c +60 -36
- data/vendor/libgit2/src/transports/ssh.c +36 -46
- data/vendor/libgit2/src/transports/winhttp.c +207 -231
- data/vendor/libgit2/src/tree-cache.c +7 -14
- data/vendor/libgit2/src/tree.c +24 -10
- data/vendor/libgit2/src/unix/map.c +1 -1
- data/vendor/libgit2/src/unix/posix.h +11 -1
- data/vendor/libgit2/src/userdiff.h +1 -3
- data/vendor/libgit2/src/util.c +53 -51
- data/vendor/libgit2/src/util.h +21 -16
- data/vendor/libgit2/src/win32/map.c +5 -3
- data/vendor/libgit2/src/win32/path_w32.c +2 -12
- data/vendor/libgit2/src/win32/path_w32.h +29 -0
- data/vendor/libgit2/src/win32/posix.h +4 -1
- data/vendor/libgit2/src/win32/posix_w32.c +5 -40
- data/vendor/libgit2/src/win32/precompiled.h +2 -0
- data/vendor/libgit2/src/win32/thread.c +10 -5
- data/vendor/libgit2/src/win32/w32_buffer.c +3 -7
- data/vendor/libgit2/src/win32/w32_crtdbg_stacktrace.c +93 -0
- data/vendor/libgit2/src/win32/w32_crtdbg_stacktrace.h +2 -0
- data/vendor/libgit2/src/win32/w32_stack.c +9 -4
- data/vendor/libgit2/src/win32/w32_stack.h +3 -3
- data/vendor/libgit2/src/win32/w32_util.c +0 -31
- data/vendor/libgit2/src/win32/w32_util.h +32 -6
- data/vendor/libgit2/src/worktree.c +22 -36
- data/vendor/libgit2/src/xdiff/xdiffi.c +1 -1
- data/vendor/libgit2/src/xdiff/xmerge.c +0 -12
- data/vendor/libgit2/src/xdiff/xpatience.c +0 -3
- metadata +34 -98
- data/vendor/libgit2/cmake/Modules/FindGSSFramework.cmake +0 -28
- data/vendor/libgit2/cmake/Modules/FindPCRE.cmake +0 -38
- data/vendor/libgit2/cmake/Modules/FindPCRE2.cmake +0 -37
- data/vendor/libgit2/cmake/Modules/PkgBuildConfig.cmake +0 -110
- data/vendor/libgit2/cmake/Modules/SelectGSSAPI.cmake +0 -53
- data/vendor/libgit2/cmake/Modules/SelectHTTPSBackend.cmake +0 -124
- data/vendor/libgit2/cmake/Modules/SelectHashes.cmake +0 -66
- data/vendor/libgit2/deps/ntlmclient/CMakeLists.txt +0 -21
- data/vendor/libgit2/deps/ntlmclient/compat.h +0 -33
- data/vendor/libgit2/deps/ntlmclient/crypt.h +0 -64
- data/vendor/libgit2/deps/ntlmclient/crypt_commoncrypto.c +0 -120
- data/vendor/libgit2/deps/ntlmclient/crypt_commoncrypto.h +0 -18
- data/vendor/libgit2/deps/ntlmclient/crypt_mbedtls.c +0 -145
- data/vendor/libgit2/deps/ntlmclient/crypt_mbedtls.h +0 -18
- data/vendor/libgit2/deps/ntlmclient/crypt_openssl.c +0 -130
- data/vendor/libgit2/deps/ntlmclient/crypt_openssl.h +0 -21
- data/vendor/libgit2/deps/ntlmclient/ntlm.c +0 -1420
- data/vendor/libgit2/deps/ntlmclient/ntlm.h +0 -174
- data/vendor/libgit2/deps/ntlmclient/ntlmclient.h +0 -320
- data/vendor/libgit2/deps/ntlmclient/unicode.h +0 -36
- data/vendor/libgit2/deps/ntlmclient/unicode_builtin.c +0 -445
- data/vendor/libgit2/deps/ntlmclient/unicode_iconv.c +0 -201
- data/vendor/libgit2/deps/ntlmclient/utf8.h +0 -1257
- data/vendor/libgit2/deps/ntlmclient/util.c +0 -21
- data/vendor/libgit2/deps/ntlmclient/util.h +0 -14
- data/vendor/libgit2/deps/pcre/CMakeLists.txt +0 -140
- data/vendor/libgit2/deps/pcre/COPYING +0 -5
- data/vendor/libgit2/deps/pcre/cmake/COPYING-CMAKE-SCRIPTS +0 -22
- data/vendor/libgit2/deps/pcre/cmake/FindEditline.cmake +0 -17
- data/vendor/libgit2/deps/pcre/cmake/FindPackageHandleStandardArgs.cmake +0 -58
- data/vendor/libgit2/deps/pcre/cmake/FindReadline.cmake +0 -29
- data/vendor/libgit2/deps/pcre/config.h.in +0 -57
- data/vendor/libgit2/deps/pcre/pcre.h +0 -641
- data/vendor/libgit2/deps/pcre/pcre_byte_order.c +0 -319
- data/vendor/libgit2/deps/pcre/pcre_chartables.c +0 -198
- data/vendor/libgit2/deps/pcre/pcre_compile.c +0 -9800
- data/vendor/libgit2/deps/pcre/pcre_config.c +0 -190
- data/vendor/libgit2/deps/pcre/pcre_dfa_exec.c +0 -3676
- data/vendor/libgit2/deps/pcre/pcre_exec.c +0 -7173
- data/vendor/libgit2/deps/pcre/pcre_fullinfo.c +0 -245
- data/vendor/libgit2/deps/pcre/pcre_get.c +0 -669
- data/vendor/libgit2/deps/pcre/pcre_globals.c +0 -86
- data/vendor/libgit2/deps/pcre/pcre_internal.h +0 -2787
- data/vendor/libgit2/deps/pcre/pcre_jit_compile.c +0 -11913
- data/vendor/libgit2/deps/pcre/pcre_maketables.c +0 -156
- data/vendor/libgit2/deps/pcre/pcre_newline.c +0 -210
- data/vendor/libgit2/deps/pcre/pcre_ord2utf8.c +0 -94
- data/vendor/libgit2/deps/pcre/pcre_printint.c +0 -834
- data/vendor/libgit2/deps/pcre/pcre_refcount.c +0 -92
- data/vendor/libgit2/deps/pcre/pcre_string_utils.c +0 -211
- data/vendor/libgit2/deps/pcre/pcre_study.c +0 -1686
- data/vendor/libgit2/deps/pcre/pcre_tables.c +0 -727
- data/vendor/libgit2/deps/pcre/pcre_ucd.c +0 -3644
- data/vendor/libgit2/deps/pcre/pcre_valid_utf8.c +0 -301
- data/vendor/libgit2/deps/pcre/pcre_version.c +0 -98
- data/vendor/libgit2/deps/pcre/pcre_xclass.c +0 -268
- data/vendor/libgit2/deps/pcre/pcreposix.c +0 -421
- data/vendor/libgit2/deps/pcre/pcreposix.h +0 -117
- data/vendor/libgit2/deps/pcre/ucp.h +0 -224
- data/vendor/libgit2/include/git2/cert.h +0 -135
- data/vendor/libgit2/include/git2/cred.h +0 -308
- data/vendor/libgit2/include/git2/sys/cred.h +0 -90
- data/vendor/libgit2/src/allocators/win32_crtdbg.c +0 -118
- data/vendor/libgit2/src/config_snapshot.c +0 -206
- data/vendor/libgit2/src/errors.h +0 -81
- data/vendor/libgit2/src/hash/sha1.h +0 -38
- data/vendor/libgit2/src/hash/sha1/collisiondetect.h +0 -19
- data/vendor/libgit2/src/hash/sha1/common_crypto.h +0 -19
- data/vendor/libgit2/src/hash/sha1/openssl.h +0 -19
- data/vendor/libgit2/src/net.c +0 -184
- data/vendor/libgit2/src/net.h +0 -36
- data/vendor/libgit2/src/regexp.c +0 -221
- data/vendor/libgit2/src/regexp.h +0 -97
- data/vendor/libgit2/src/transports/auth_ntlm.c +0 -223
- data/vendor/libgit2/src/transports/auth_ntlm.h +0 -35
- data/vendor/libgit2/src/wildmatch.c +0 -320
- data/vendor/libgit2/src/wildmatch.h +0 -23
- data/vendor/libgit2/src/win32/w32_common.h +0 -39
data/vendor/libgit2/src/config.c
CHANGED
@@ -7,15 +7,13 @@
|
|
7
7
|
|
8
8
|
#include "config.h"
|
9
9
|
|
10
|
+
#include "sysdir.h"
|
10
11
|
#include "git2/config.h"
|
11
12
|
#include "git2/sys/config.h"
|
12
|
-
|
13
|
+
#include "vector.h"
|
13
14
|
#include "buf_text.h"
|
14
15
|
#include "config_backend.h"
|
15
|
-
#include "regexp.h"
|
16
|
-
#include "sysdir.h"
|
17
16
|
#include "transaction.h"
|
18
|
-
#include "vector.h"
|
19
17
|
#if GIT_WIN32
|
20
18
|
# include <windows.h>
|
21
19
|
#endif
|
@@ -347,7 +345,7 @@ typedef struct {
|
|
347
345
|
git_config_iterator parent;
|
348
346
|
git_config_iterator *current;
|
349
347
|
const git_config *cfg;
|
350
|
-
|
348
|
+
regex_t regex;
|
351
349
|
size_t i;
|
352
350
|
} all_iter;
|
353
351
|
|
@@ -425,7 +423,7 @@ static int all_iter_glob_next(git_config_entry **entry, git_config_iterator *_it
|
|
425
423
|
*/
|
426
424
|
while ((error = all_iter_next(entry, _iter)) == 0) {
|
427
425
|
/* skip non-matching keys if regexp was provided */
|
428
|
-
if (
|
426
|
+
if (regexec(&iter->regex, (*entry)->name, 0, NULL, 0) != 0)
|
429
427
|
continue;
|
430
428
|
|
431
429
|
/* and simply return if we like the entry's name */
|
@@ -449,7 +447,7 @@ static void all_iter_glob_free(git_config_iterator *_iter)
|
|
449
447
|
{
|
450
448
|
all_iter *iter = (all_iter *) _iter;
|
451
449
|
|
452
|
-
|
450
|
+
regfree(&iter->regex);
|
453
451
|
all_iter_free(_iter);
|
454
452
|
}
|
455
453
|
|
@@ -482,7 +480,8 @@ int git_config_iterator_glob_new(git_config_iterator **out, const git_config *cf
|
|
482
480
|
iter = git__calloc(1, sizeof(all_iter));
|
483
481
|
GIT_ERROR_CHECK_ALLOC(iter);
|
484
482
|
|
485
|
-
if ((result =
|
483
|
+
if ((result = p_regcomp(&iter->regex, regexp, REG_EXTENDED)) != 0) {
|
484
|
+
git_error_set_regex(&iter->regex, result);
|
486
485
|
git__free(iter);
|
487
486
|
return -1;
|
488
487
|
}
|
@@ -511,13 +510,18 @@ int git_config_backend_foreach_match(
|
|
511
510
|
{
|
512
511
|
git_config_entry *entry;
|
513
512
|
git_config_iterator* iter;
|
514
|
-
|
513
|
+
regex_t regex;
|
515
514
|
int error = 0;
|
516
515
|
|
517
516
|
assert(backend && cb);
|
518
517
|
|
519
|
-
if (regexp
|
520
|
-
|
518
|
+
if (regexp != NULL) {
|
519
|
+
if ((error = p_regcomp(®ex, regexp, REG_EXTENDED)) != 0) {
|
520
|
+
git_error_set_regex(®ex, error);
|
521
|
+
regfree(®ex);
|
522
|
+
return -1;
|
523
|
+
}
|
524
|
+
}
|
521
525
|
|
522
526
|
if ((error = backend->iterator(&iter, backend)) < 0) {
|
523
527
|
iter = NULL;
|
@@ -526,7 +530,7 @@ int git_config_backend_foreach_match(
|
|
526
530
|
|
527
531
|
while (!(iter->next(&entry, iter) < 0)) {
|
528
532
|
/* skip non-matching keys if regexp was provided */
|
529
|
-
if (regexp &&
|
533
|
+
if (regexp && regexec(®ex, entry->name, 0, NULL, 0) != 0)
|
530
534
|
continue;
|
531
535
|
|
532
536
|
/* abort iterator on non-zero return value */
|
@@ -537,7 +541,7 @@ int git_config_backend_foreach_match(
|
|
537
541
|
}
|
538
542
|
|
539
543
|
if (regexp != NULL)
|
540
|
-
|
544
|
+
regfree(®ex);
|
541
545
|
|
542
546
|
iter->free(iter);
|
543
547
|
|
@@ -657,7 +661,7 @@ int git_config_set_string(git_config *cfg, const char *name, const char *value)
|
|
657
661
|
error = backend->set(backend, name, value);
|
658
662
|
|
659
663
|
if (!error && GIT_REFCOUNT_OWNER(cfg) != NULL)
|
660
|
-
|
664
|
+
git_repository__cvar_cache_clear(GIT_REFCOUNT_OWNER(cfg));
|
661
665
|
|
662
666
|
return error;
|
663
667
|
}
|
@@ -773,7 +777,7 @@ int git_config_get_mapped(
|
|
773
777
|
int *out,
|
774
778
|
const git_config *cfg,
|
775
779
|
const char *name,
|
776
|
-
const
|
780
|
+
const git_cvar_map *maps,
|
777
781
|
size_t map_n)
|
778
782
|
{
|
779
783
|
git_config_entry *entry;
|
@@ -977,7 +981,7 @@ typedef struct {
|
|
977
981
|
git_config_iterator parent;
|
978
982
|
git_config_iterator *iter;
|
979
983
|
char *name;
|
980
|
-
|
984
|
+
regex_t regex;
|
981
985
|
int have_regex;
|
982
986
|
} multivar_iter;
|
983
987
|
|
@@ -993,7 +997,7 @@ static int multivar_iter_next(git_config_entry **entry, git_config_iterator *_it
|
|
993
997
|
if (!iter->have_regex)
|
994
998
|
return 0;
|
995
999
|
|
996
|
-
if (
|
1000
|
+
if (regexec(&iter->regex, (*entry)->value, 0, NULL, 0) == 0)
|
997
1001
|
return 0;
|
998
1002
|
}
|
999
1003
|
|
@@ -1008,7 +1012,7 @@ void multivar_iter_free(git_config_iterator *_iter)
|
|
1008
1012
|
|
1009
1013
|
git__free(iter->name);
|
1010
1014
|
if (iter->have_regex)
|
1011
|
-
|
1015
|
+
regfree(&iter->regex);
|
1012
1016
|
git__free(iter);
|
1013
1017
|
}
|
1014
1018
|
|
@@ -1028,8 +1032,13 @@ int git_config_multivar_iterator_new(git_config_iterator **out, const git_config
|
|
1028
1032
|
goto on_error;
|
1029
1033
|
|
1030
1034
|
if (regexp != NULL) {
|
1031
|
-
|
1035
|
+
error = p_regcomp(&iter->regex, regexp, REG_EXTENDED);
|
1036
|
+
if (error != 0) {
|
1037
|
+
git_error_set_regex(&iter->regex, error);
|
1038
|
+
error = -1;
|
1039
|
+
regfree(&iter->regex);
|
1032
1040
|
goto on_error;
|
1041
|
+
}
|
1033
1042
|
|
1034
1043
|
iter->have_regex = 1;
|
1035
1044
|
}
|
@@ -1221,7 +1230,7 @@ int git_config_unlock(git_config *cfg, int commit)
|
|
1221
1230
|
|
1222
1231
|
int git_config_lookup_map_value(
|
1223
1232
|
int *out,
|
1224
|
-
const
|
1233
|
+
const git_cvar_map *maps,
|
1225
1234
|
size_t map_n,
|
1226
1235
|
const char *value)
|
1227
1236
|
{
|
@@ -1231,27 +1240,27 @@ int git_config_lookup_map_value(
|
|
1231
1240
|
goto fail_parse;
|
1232
1241
|
|
1233
1242
|
for (i = 0; i < map_n; ++i) {
|
1234
|
-
const
|
1243
|
+
const git_cvar_map *m = maps + i;
|
1235
1244
|
|
1236
|
-
switch (m->
|
1237
|
-
case
|
1238
|
-
case
|
1245
|
+
switch (m->cvar_type) {
|
1246
|
+
case GIT_CVAR_FALSE:
|
1247
|
+
case GIT_CVAR_TRUE: {
|
1239
1248
|
int bool_val;
|
1240
1249
|
|
1241
1250
|
if (git__parse_bool(&bool_val, value) == 0 &&
|
1242
|
-
bool_val == (int)m->
|
1251
|
+
bool_val == (int)m->cvar_type) {
|
1243
1252
|
*out = m->map_value;
|
1244
1253
|
return 0;
|
1245
1254
|
}
|
1246
1255
|
break;
|
1247
1256
|
}
|
1248
1257
|
|
1249
|
-
case
|
1258
|
+
case GIT_CVAR_INT32:
|
1250
1259
|
if (git_config_parse_int32(out, value) == 0)
|
1251
1260
|
return 0;
|
1252
1261
|
break;
|
1253
1262
|
|
1254
|
-
case
|
1263
|
+
case GIT_CVAR_STRING:
|
1255
1264
|
if (strcasecmp(value, m->str_match) == 0) {
|
1256
1265
|
*out = m->map_value;
|
1257
1266
|
return 0;
|
@@ -1265,18 +1274,18 @@ fail_parse:
|
|
1265
1274
|
return -1;
|
1266
1275
|
}
|
1267
1276
|
|
1268
|
-
int git_config_lookup_map_enum(
|
1269
|
-
const
|
1277
|
+
int git_config_lookup_map_enum(git_cvar_t *type_out, const char **str_out,
|
1278
|
+
const git_cvar_map *maps, size_t map_n, int enum_val)
|
1270
1279
|
{
|
1271
1280
|
size_t i;
|
1272
1281
|
|
1273
1282
|
for (i = 0; i < map_n; i++) {
|
1274
|
-
const
|
1283
|
+
const git_cvar_map *m = &maps[i];
|
1275
1284
|
|
1276
1285
|
if (m->map_value != enum_val)
|
1277
1286
|
continue;
|
1278
1287
|
|
1279
|
-
*type_out = m->
|
1288
|
+
*type_out = m->cvar_type;
|
1280
1289
|
*str_out = m->str_match;
|
1281
1290
|
return 0;
|
1282
1291
|
}
|
data/vendor/libgit2/src/config.h
CHANGED
@@ -66,19 +66,18 @@ extern int git_config__get_bool_force(
|
|
66
66
|
extern int git_config__get_int_force(
|
67
67
|
const git_config *cfg, const char *key, int fallback_value);
|
68
68
|
|
69
|
-
/* API for repository
|
70
|
-
* uses
|
69
|
+
/* API for repository cvar-style lookups from config - not cached, but
|
70
|
+
* uses cvar value maps and fallbacks
|
71
71
|
*/
|
72
|
-
extern int
|
73
|
-
int *out, git_config *config,
|
72
|
+
extern int git_config__cvar(
|
73
|
+
int *out, git_config *config, git_cvar_cached cvar);
|
74
74
|
|
75
75
|
/**
|
76
76
|
* The opposite of git_config_lookup_map_value, we take an enum value
|
77
77
|
* and map it to the string or bool value on the config.
|
78
78
|
*/
|
79
|
-
int git_config_lookup_map_enum(
|
80
|
-
|
81
|
-
size_t map_n, int enum_val);
|
79
|
+
int git_config_lookup_map_enum(git_cvar_t *type_out, const char **str_out,
|
80
|
+
const git_cvar_map *maps, size_t map_n, int enum_val);
|
82
81
|
|
83
82
|
/**
|
84
83
|
* Unlock the backend with the highest priority
|
@@ -25,18 +25,6 @@
|
|
25
25
|
*/
|
26
26
|
extern int git_config_backend_from_file(git_config_backend **out, const char *path);
|
27
27
|
|
28
|
-
/**
|
29
|
-
* Create a readonly configuration file backend from another backend
|
30
|
-
*
|
31
|
-
* This copies the complete contents of the source backend to the
|
32
|
-
* new backend. The new backend will be completely read-only and
|
33
|
-
* cannot be modified.
|
34
|
-
*
|
35
|
-
* @param out the new snapshotted backend
|
36
|
-
* @param source the backend to copy
|
37
|
-
*/
|
38
|
-
extern int git_config_backend_snapshot(git_config_backend **out, git_config_backend *source);
|
39
|
-
|
40
28
|
/**
|
41
29
|
* Create an in-memory configuration file backend
|
42
30
|
*
|
@@ -7,7 +7,7 @@
|
|
7
7
|
|
8
8
|
#include "common.h"
|
9
9
|
|
10
|
-
#include "
|
10
|
+
#include "fileops.h"
|
11
11
|
#include "repository.h"
|
12
12
|
#include "config.h"
|
13
13
|
#include "git2/config.h"
|
@@ -15,8 +15,8 @@
|
|
15
15
|
#include "filter.h"
|
16
16
|
|
17
17
|
struct map_data {
|
18
|
-
const char *
|
19
|
-
|
18
|
+
const char *cvar_name;
|
19
|
+
git_cvar_map *maps;
|
20
20
|
size_t map_count;
|
21
21
|
int default_value;
|
22
22
|
};
|
@@ -29,11 +29,11 @@ struct map_data {
|
|
29
29
|
* value is native. See gitattributes(5) for more information on
|
30
30
|
* end-of-line conversion.
|
31
31
|
*/
|
32
|
-
static
|
33
|
-
{
|
34
|
-
{
|
35
|
-
{
|
36
|
-
{
|
32
|
+
static git_cvar_map _cvar_map_eol[] = {
|
33
|
+
{GIT_CVAR_FALSE, NULL, GIT_EOL_UNSET},
|
34
|
+
{GIT_CVAR_STRING, "lf", GIT_EOL_LF},
|
35
|
+
{GIT_CVAR_STRING, "crlf", GIT_EOL_CRLF},
|
36
|
+
{GIT_CVAR_STRING, "native", GIT_EOL_NATIVE}
|
37
37
|
};
|
38
38
|
|
39
39
|
/*
|
@@ -46,55 +46,55 @@ static git_configmap _configmap_eol[] = {
|
|
46
46
|
* does not have normalized line endings. This variable can be set to input,
|
47
47
|
* in which case no output conversion is performed.
|
48
48
|
*/
|
49
|
-
static
|
50
|
-
{
|
51
|
-
{
|
52
|
-
{
|
49
|
+
static git_cvar_map _cvar_map_autocrlf[] = {
|
50
|
+
{GIT_CVAR_FALSE, NULL, GIT_AUTO_CRLF_FALSE},
|
51
|
+
{GIT_CVAR_TRUE, NULL, GIT_AUTO_CRLF_TRUE},
|
52
|
+
{GIT_CVAR_STRING, "input", GIT_AUTO_CRLF_INPUT}
|
53
53
|
};
|
54
54
|
|
55
|
-
static
|
56
|
-
{
|
57
|
-
{
|
58
|
-
{
|
55
|
+
static git_cvar_map _cvar_map_safecrlf[] = {
|
56
|
+
{GIT_CVAR_FALSE, NULL, GIT_SAFE_CRLF_FALSE},
|
57
|
+
{GIT_CVAR_TRUE, NULL, GIT_SAFE_CRLF_FAIL},
|
58
|
+
{GIT_CVAR_STRING, "warn", GIT_SAFE_CRLF_WARN}
|
59
59
|
};
|
60
60
|
|
61
|
-
static
|
62
|
-
{
|
63
|
-
{
|
64
|
-
{
|
61
|
+
static git_cvar_map _cvar_map_logallrefupdates[] = {
|
62
|
+
{GIT_CVAR_FALSE, NULL, GIT_LOGALLREFUPDATES_FALSE},
|
63
|
+
{GIT_CVAR_TRUE, NULL, GIT_LOGALLREFUPDATES_TRUE},
|
64
|
+
{GIT_CVAR_STRING, "always", GIT_LOGALLREFUPDATES_ALWAYS},
|
65
65
|
};
|
66
66
|
|
67
67
|
/*
|
68
68
|
* Generic map for integer values
|
69
69
|
*/
|
70
|
-
static
|
71
|
-
{
|
70
|
+
static git_cvar_map _cvar_map_int[] = {
|
71
|
+
{GIT_CVAR_INT32, NULL, 0},
|
72
72
|
};
|
73
73
|
|
74
|
-
static struct map_data
|
75
|
-
{"core.autocrlf",
|
76
|
-
{"core.eol",
|
74
|
+
static struct map_data _cvar_maps[] = {
|
75
|
+
{"core.autocrlf", _cvar_map_autocrlf, ARRAY_SIZE(_cvar_map_autocrlf), GIT_AUTO_CRLF_DEFAULT},
|
76
|
+
{"core.eol", _cvar_map_eol, ARRAY_SIZE(_cvar_map_eol), GIT_EOL_DEFAULT},
|
77
77
|
{"core.symlinks", NULL, 0, GIT_SYMLINKS_DEFAULT },
|
78
78
|
{"core.ignorecase", NULL, 0, GIT_IGNORECASE_DEFAULT },
|
79
79
|
{"core.filemode", NULL, 0, GIT_FILEMODE_DEFAULT },
|
80
80
|
{"core.ignorestat", NULL, 0, GIT_IGNORESTAT_DEFAULT },
|
81
81
|
{"core.trustctime", NULL, 0, GIT_TRUSTCTIME_DEFAULT },
|
82
|
-
{"core.abbrev",
|
82
|
+
{"core.abbrev", _cvar_map_int, 1, GIT_ABBREV_DEFAULT },
|
83
83
|
{"core.precomposeunicode", NULL, 0, GIT_PRECOMPOSE_DEFAULT },
|
84
|
-
{"core.safecrlf",
|
85
|
-
{"core.logallrefupdates",
|
84
|
+
{"core.safecrlf", _cvar_map_safecrlf, ARRAY_SIZE(_cvar_map_safecrlf), GIT_SAFE_CRLF_DEFAULT},
|
85
|
+
{"core.logallrefupdates", _cvar_map_logallrefupdates, ARRAY_SIZE(_cvar_map_logallrefupdates), GIT_LOGALLREFUPDATES_DEFAULT},
|
86
86
|
{"core.protecthfs", NULL, 0, GIT_PROTECTHFS_DEFAULT },
|
87
87
|
{"core.protectntfs", NULL, 0, GIT_PROTECTNTFS_DEFAULT },
|
88
88
|
{"core.fsyncobjectfiles", NULL, 0, GIT_FSYNCOBJECTFILES_DEFAULT },
|
89
89
|
};
|
90
90
|
|
91
|
-
int
|
91
|
+
int git_config__cvar(int *out, git_config *config, git_cvar_cached cvar)
|
92
92
|
{
|
93
93
|
int error = 0;
|
94
|
-
struct map_data *data = &
|
94
|
+
struct map_data *data = &_cvar_maps[(int)cvar];
|
95
95
|
git_config_entry *entry;
|
96
96
|
|
97
|
-
if ((error = git_config__lookup_entry(&entry, config, data->
|
97
|
+
if ((error = git_config__lookup_entry(&entry, config, data->cvar_name, false)) < 0)
|
98
98
|
return error;
|
99
99
|
|
100
100
|
if (!entry)
|
@@ -109,29 +109,29 @@ int git_config__configmap_lookup(int *out, git_config *config, git_configmap_ite
|
|
109
109
|
return error;
|
110
110
|
}
|
111
111
|
|
112
|
-
int
|
112
|
+
int git_repository__cvar(int *out, git_repository *repo, git_cvar_cached cvar)
|
113
113
|
{
|
114
|
-
*out = repo->
|
114
|
+
*out = repo->cvar_cache[(int)cvar];
|
115
115
|
|
116
|
-
if (*out ==
|
116
|
+
if (*out == GIT_CVAR_NOT_CACHED) {
|
117
117
|
int error;
|
118
118
|
git_config *config;
|
119
119
|
|
120
120
|
if ((error = git_repository_config__weakptr(&config, repo)) < 0 ||
|
121
|
-
(error =
|
121
|
+
(error = git_config__cvar(out, config, cvar)) < 0)
|
122
122
|
return error;
|
123
123
|
|
124
|
-
repo->
|
124
|
+
repo->cvar_cache[(int)cvar] = *out;
|
125
125
|
}
|
126
126
|
|
127
127
|
return 0;
|
128
128
|
}
|
129
129
|
|
130
|
-
void
|
130
|
+
void git_repository__cvar_cache_clear(git_repository *repo)
|
131
131
|
{
|
132
132
|
int i;
|
133
133
|
|
134
|
-
for (i = 0; i <
|
135
|
-
repo->
|
134
|
+
for (i = 0; i < GIT_CVAR_CACHE_MAX; ++i)
|
135
|
+
repo->cvar_cache[i] = GIT_CVAR_NOT_CACHED;
|
136
136
|
}
|
137
137
|
|
@@ -11,7 +11,6 @@ typedef struct config_entry_list {
|
|
11
11
|
struct config_entry_list *next;
|
12
12
|
struct config_entry_list *last;
|
13
13
|
git_config_entry *entry;
|
14
|
-
bool first;
|
15
14
|
} config_entry_list;
|
16
15
|
|
17
16
|
typedef struct config_entries_iterator {
|
@@ -26,6 +25,31 @@ struct git_config_entries {
|
|
26
25
|
config_entry_list *list;
|
27
26
|
};
|
28
27
|
|
28
|
+
static void config_entry_list_free(config_entry_list *list)
|
29
|
+
{
|
30
|
+
config_entry_list *next;
|
31
|
+
|
32
|
+
while (list != NULL) {
|
33
|
+
next = list->next;
|
34
|
+
|
35
|
+
git__free((char*) list->entry->name);
|
36
|
+
git__free((char *) list->entry->value);
|
37
|
+
git__free(list->entry);
|
38
|
+
git__free(list);
|
39
|
+
|
40
|
+
list = next;
|
41
|
+
};
|
42
|
+
}
|
43
|
+
|
44
|
+
static void config_entry_list_append(config_entry_list **list, config_entry_list *entry)
|
45
|
+
{
|
46
|
+
if (*list)
|
47
|
+
(*list)->last->next = entry;
|
48
|
+
else
|
49
|
+
*list = entry;
|
50
|
+
(*list)->last = entry;
|
51
|
+
}
|
52
|
+
|
29
53
|
int git_config_entries_new(git_config_entries **out)
|
30
54
|
{
|
31
55
|
git_config_entries *entries;
|
@@ -35,7 +59,7 @@ int git_config_entries_new(git_config_entries **out)
|
|
35
59
|
GIT_ERROR_CHECK_ALLOC(entries);
|
36
60
|
GIT_REFCOUNT_INC(entries);
|
37
61
|
|
38
|
-
if ((error =
|
62
|
+
if ((error = git_strmap_alloc(&entries->map)) < 0)
|
39
63
|
git__free(entries);
|
40
64
|
else
|
41
65
|
*out = entries;
|
@@ -43,36 +67,6 @@ int git_config_entries_new(git_config_entries **out)
|
|
43
67
|
return error;
|
44
68
|
}
|
45
69
|
|
46
|
-
int git_config_entries_dup_entry(git_config_entries *entries, const git_config_entry *entry)
|
47
|
-
{
|
48
|
-
git_config_entry *duplicated;
|
49
|
-
int error;
|
50
|
-
|
51
|
-
duplicated = git__calloc(1, sizeof(git_config_entry));
|
52
|
-
GIT_ERROR_CHECK_ALLOC(duplicated);
|
53
|
-
|
54
|
-
duplicated->name = git__strdup(entry->name);
|
55
|
-
GIT_ERROR_CHECK_ALLOC(duplicated->name);
|
56
|
-
|
57
|
-
if (entry->value) {
|
58
|
-
duplicated->value = git__strdup(entry->value);
|
59
|
-
GIT_ERROR_CHECK_ALLOC(duplicated->value);
|
60
|
-
}
|
61
|
-
duplicated->level = entry->level;
|
62
|
-
duplicated->include_depth = entry->include_depth;
|
63
|
-
|
64
|
-
if ((error = git_config_entries_append(entries, duplicated)) < 0)
|
65
|
-
goto out;
|
66
|
-
|
67
|
-
out:
|
68
|
-
if (error && duplicated) {
|
69
|
-
git__free((char *) duplicated->name);
|
70
|
-
git__free((char *) duplicated->value);
|
71
|
-
git__free(duplicated);
|
72
|
-
}
|
73
|
-
return error;
|
74
|
-
}
|
75
|
-
|
76
70
|
int git_config_entries_dup(git_config_entries **out, git_config_entries *entries)
|
77
71
|
{
|
78
72
|
git_config_entries *result = NULL;
|
@@ -82,9 +76,22 @@ int git_config_entries_dup(git_config_entries **out, git_config_entries *entries
|
|
82
76
|
if ((error = git_config_entries_new(&result)) < 0)
|
83
77
|
goto out;
|
84
78
|
|
85
|
-
for (head = entries->list; head; head = head->next)
|
86
|
-
|
79
|
+
for (head = entries->list; head; head = head->next) {
|
80
|
+
git_config_entry *dup;
|
81
|
+
|
82
|
+
dup = git__calloc(1, sizeof(git_config_entry));
|
83
|
+
dup->name = git__strdup(head->entry->name);
|
84
|
+
GIT_ERROR_CHECK_ALLOC(dup->name);
|
85
|
+
if (head->entry->value) {
|
86
|
+
dup->value = git__strdup(head->entry->value);
|
87
|
+
GIT_ERROR_CHECK_ALLOC(dup->value);
|
88
|
+
}
|
89
|
+
dup->level = head->entry->level;
|
90
|
+
dup->include_depth = head->entry->include_depth;
|
91
|
+
|
92
|
+
if ((error = git_config_entries_append(result, dup)) < 0)
|
87
93
|
goto out;
|
94
|
+
}
|
88
95
|
|
89
96
|
*out = result;
|
90
97
|
result = NULL;
|
@@ -103,15 +110,12 @@ static void config_entries_free(git_config_entries *entries)
|
|
103
110
|
{
|
104
111
|
config_entry_list *list = NULL, *next;
|
105
112
|
|
113
|
+
git_strmap_foreach_value(entries->map, list, config_entry_list_free(list));
|
106
114
|
git_strmap_free(entries->map);
|
107
115
|
|
108
116
|
list = entries->list;
|
109
117
|
while (list != NULL) {
|
110
118
|
next = list->next;
|
111
|
-
if (list->first)
|
112
|
-
git__free((char *) list->entry->name);
|
113
|
-
git__free((char *) list->entry->value);
|
114
|
-
git__free(list->entry);
|
115
119
|
git__free(list);
|
116
120
|
list = next;
|
117
121
|
}
|
@@ -127,33 +131,55 @@ void git_config_entries_free(git_config_entries *entries)
|
|
127
131
|
|
128
132
|
int git_config_entries_append(git_config_entries *entries, git_config_entry *entry)
|
129
133
|
{
|
130
|
-
config_entry_list *existing, *
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
134
|
+
config_entry_list *existing, *var;
|
135
|
+
int error = 0;
|
136
|
+
size_t pos;
|
137
|
+
|
138
|
+
var = git__calloc(1, sizeof(config_entry_list));
|
139
|
+
GIT_ERROR_CHECK_ALLOC(var);
|
140
|
+
var->entry = entry;
|
141
|
+
|
142
|
+
pos = git_strmap_lookup_index(entries->map, entry->name);
|
143
|
+
if (!git_strmap_valid_index(entries->map, pos)) {
|
144
|
+
/*
|
145
|
+
* We only ever inspect `last` from the first config
|
146
|
+
* entry in a multivar. In case where this new entry is
|
147
|
+
* the first one in the entry map, it will also be the
|
148
|
+
* last one at the time of adding it, which is
|
149
|
+
* why we set `last` here to itself. Otherwise we
|
150
|
+
* do not have to set `last` and leave it set to
|
151
|
+
* `NULL`.
|
152
|
+
*/
|
153
|
+
var->last = var;
|
154
|
+
|
155
|
+
git_strmap_insert(entries->map, entry->name, var, &error);
|
156
|
+
|
157
|
+
if (error > 0)
|
158
|
+
error = 0;
|
145
159
|
} else {
|
146
|
-
|
160
|
+
existing = git_strmap_value_at(entries->map, pos);
|
161
|
+
config_entry_list_append(&existing, var);
|
147
162
|
}
|
148
163
|
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
entries->list->last = head;
|
164
|
+
var = git__calloc(1, sizeof(config_entry_list));
|
165
|
+
GIT_ERROR_CHECK_ALLOC(var);
|
166
|
+
var->entry = entry;
|
167
|
+
config_entry_list_append(&entries->list, var);
|
154
168
|
|
155
|
-
|
156
|
-
|
169
|
+
return error;
|
170
|
+
}
|
171
|
+
|
172
|
+
int config_entry_get(config_entry_list **out, git_config_entries *entries, const char *key)
|
173
|
+
{
|
174
|
+
size_t pos;
|
175
|
+
|
176
|
+
pos = git_strmap_lookup_index(entries->map, key);
|
177
|
+
|
178
|
+
/* no error message; the config system will write one */
|
179
|
+
if (!git_strmap_valid_index(entries->map, pos))
|
180
|
+
return GIT_ENOTFOUND;
|
181
|
+
|
182
|
+
*out = git_strmap_value_at(entries->map, pos);
|
157
183
|
|
158
184
|
return 0;
|
159
185
|
}
|
@@ -161,20 +187,24 @@ int git_config_entries_append(git_config_entries *entries, git_config_entry *ent
|
|
161
187
|
int git_config_entries_get(git_config_entry **out, git_config_entries *entries, const char *key)
|
162
188
|
{
|
163
189
|
config_entry_list *entry;
|
164
|
-
|
165
|
-
|
166
|
-
|
190
|
+
int error;
|
191
|
+
|
192
|
+
if ((error = config_entry_get(&entry, entries, key)) < 0)
|
193
|
+
return error;
|
194
|
+
*out = entry->last->entry;
|
195
|
+
|
167
196
|
return 0;
|
168
197
|
}
|
169
198
|
|
170
199
|
int git_config_entries_get_unique(git_config_entry **out, git_config_entries *entries, const char *key)
|
171
200
|
{
|
172
201
|
config_entry_list *entry;
|
202
|
+
int error;
|
173
203
|
|
174
|
-
if ((
|
175
|
-
return
|
204
|
+
if ((error = config_entry_get(&entry, entries, key)) < 0)
|
205
|
+
return error;
|
176
206
|
|
177
|
-
if (
|
207
|
+
if (entry->next != NULL) {
|
178
208
|
git_error_set(GIT_ERROR_CONFIG, "entry is not unique due to being a multivar");
|
179
209
|
return -1;
|
180
210
|
}
|
@@ -189,14 +219,14 @@ int git_config_entries_get_unique(git_config_entry **out, git_config_entries *en
|
|
189
219
|
return 0;
|
190
220
|
}
|
191
221
|
|
192
|
-
|
222
|
+
void config_iterator_free(git_config_iterator *iter)
|
193
223
|
{
|
194
224
|
config_entries_iterator *it = (config_entries_iterator *) iter;
|
195
225
|
git_config_entries_free(it->entries);
|
196
226
|
git__free(it);
|
197
227
|
}
|
198
228
|
|
199
|
-
|
229
|
+
int config_iterator_next(
|
200
230
|
git_config_entry **entry,
|
201
231
|
git_config_iterator *iter)
|
202
232
|
{
|