rugged 0.27.9 → 0.27.10
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 +1 -0
- data/vendor/libgit2/CMakeLists.txt +98 -54
- data/vendor/libgit2/COPYING +28 -0
- data/vendor/libgit2/cmake/Modules/AddCFlagIfSupported.cmake +15 -1
- data/vendor/libgit2/cmake/Modules/EnableWarnings.cmake +9 -8
- data/vendor/libgit2/cmake/Modules/FindCoreFoundation.cmake +2 -2
- data/vendor/libgit2/cmake/Modules/FindGSSAPI.cmake +1 -1
- data/vendor/libgit2/cmake/Modules/FindGSSFramework.cmake +28 -0
- data/vendor/libgit2/cmake/Modules/FindPCRE.cmake +38 -0
- data/vendor/libgit2/cmake/Modules/FindPCRE2.cmake +37 -0
- data/vendor/libgit2/cmake/Modules/FindSecurity.cmake +2 -2
- data/vendor/libgit2/cmake/Modules/FindStatNsec.cmake +6 -0
- data/vendor/libgit2/cmake/Modules/FindmbedTLS.cmake +93 -0
- data/vendor/libgit2/cmake/Modules/PkgBuildConfig.cmake +110 -0
- data/vendor/libgit2/cmake/Modules/SelectGSSAPI.cmake +53 -0
- data/vendor/libgit2/cmake/Modules/SelectHTTPSBackend.cmake +124 -0
- data/vendor/libgit2/cmake/Modules/SelectHashes.cmake +66 -0
- data/vendor/libgit2/deps/http-parser/CMakeLists.txt +2 -0
- data/vendor/libgit2/deps/http-parser/{LICENSE-MIT → COPYING} +0 -0
- data/vendor/libgit2/deps/http-parser/http_parser.c +11 -6
- data/vendor/libgit2/deps/ntlmclient/CMakeLists.txt +21 -0
- data/vendor/libgit2/deps/ntlmclient/compat.h +33 -0
- data/vendor/libgit2/deps/ntlmclient/crypt.h +64 -0
- data/vendor/libgit2/deps/ntlmclient/crypt_commoncrypto.c +120 -0
- data/vendor/libgit2/deps/ntlmclient/crypt_commoncrypto.h +18 -0
- data/vendor/libgit2/deps/ntlmclient/crypt_mbedtls.c +145 -0
- data/vendor/libgit2/deps/ntlmclient/crypt_mbedtls.h +18 -0
- data/vendor/libgit2/deps/ntlmclient/crypt_openssl.c +130 -0
- data/vendor/libgit2/deps/ntlmclient/crypt_openssl.h +21 -0
- data/vendor/libgit2/deps/ntlmclient/ntlm.c +1420 -0
- data/vendor/libgit2/deps/ntlmclient/ntlm.h +174 -0
- data/vendor/libgit2/deps/ntlmclient/ntlmclient.h +320 -0
- data/vendor/libgit2/deps/ntlmclient/unicode.h +36 -0
- data/vendor/libgit2/deps/ntlmclient/unicode_builtin.c +445 -0
- data/vendor/libgit2/deps/ntlmclient/unicode_iconv.c +201 -0
- data/vendor/libgit2/deps/ntlmclient/utf8.h +1257 -0
- data/vendor/libgit2/deps/ntlmclient/util.c +21 -0
- data/vendor/libgit2/deps/ntlmclient/util.h +14 -0
- data/vendor/libgit2/deps/pcre/CMakeLists.txt +140 -0
- data/vendor/libgit2/deps/pcre/COPYING +5 -0
- data/vendor/libgit2/deps/pcre/cmake/COPYING-CMAKE-SCRIPTS +22 -0
- data/vendor/libgit2/deps/pcre/cmake/FindEditline.cmake +17 -0
- data/vendor/libgit2/deps/pcre/cmake/FindPackageHandleStandardArgs.cmake +58 -0
- data/vendor/libgit2/deps/pcre/cmake/FindReadline.cmake +29 -0
- data/vendor/libgit2/deps/pcre/config.h.in +57 -0
- data/vendor/libgit2/deps/pcre/pcre.h +641 -0
- data/vendor/libgit2/deps/pcre/pcre_byte_order.c +319 -0
- data/vendor/libgit2/deps/pcre/pcre_chartables.c +198 -0
- data/vendor/libgit2/deps/pcre/pcre_compile.c +9800 -0
- data/vendor/libgit2/deps/pcre/pcre_config.c +190 -0
- data/vendor/libgit2/deps/pcre/pcre_dfa_exec.c +3676 -0
- data/vendor/libgit2/deps/pcre/pcre_exec.c +7173 -0
- data/vendor/libgit2/deps/pcre/pcre_fullinfo.c +245 -0
- data/vendor/libgit2/deps/pcre/pcre_get.c +669 -0
- data/vendor/libgit2/deps/pcre/pcre_globals.c +86 -0
- data/vendor/libgit2/deps/pcre/pcre_internal.h +2787 -0
- data/vendor/libgit2/deps/pcre/pcre_jit_compile.c +11913 -0
- data/vendor/libgit2/deps/pcre/pcre_maketables.c +156 -0
- data/vendor/libgit2/deps/pcre/pcre_newline.c +210 -0
- data/vendor/libgit2/deps/pcre/pcre_ord2utf8.c +94 -0
- data/vendor/libgit2/deps/pcre/pcre_printint.c +834 -0
- data/vendor/libgit2/deps/pcre/pcre_refcount.c +92 -0
- data/vendor/libgit2/deps/pcre/pcre_string_utils.c +211 -0
- data/vendor/libgit2/deps/pcre/pcre_study.c +1686 -0
- data/vendor/libgit2/deps/pcre/pcre_tables.c +727 -0
- data/vendor/libgit2/deps/pcre/pcre_ucd.c +3644 -0
- data/vendor/libgit2/deps/pcre/pcre_valid_utf8.c +301 -0
- data/vendor/libgit2/deps/pcre/pcre_version.c +98 -0
- data/vendor/libgit2/deps/pcre/pcre_xclass.c +268 -0
- data/vendor/libgit2/deps/pcre/pcreposix.c +421 -0
- data/vendor/libgit2/deps/pcre/pcreposix.h +117 -0
- data/vendor/libgit2/deps/pcre/ucp.h +224 -0
- data/vendor/libgit2/deps/winhttp/COPYING.GPL +993 -0
- data/vendor/libgit2/deps/winhttp/COPYING.LGPL +502 -0
- data/vendor/libgit2/deps/zlib/CMakeLists.txt +1 -0
- data/vendor/libgit2/deps/zlib/COPYING +27 -0
- data/vendor/libgit2/deps/zlib/adler32.c +0 -7
- data/vendor/libgit2/deps/zlib/crc32.c +0 -7
- data/vendor/libgit2/include/git2.h +5 -0
- data/vendor/libgit2/include/git2/annotated_commit.h +9 -0
- data/vendor/libgit2/include/git2/apply.h +149 -0
- data/vendor/libgit2/include/git2/attr.h +38 -20
- data/vendor/libgit2/include/git2/blame.h +42 -25
- data/vendor/libgit2/include/git2/blob.h +45 -13
- data/vendor/libgit2/include/git2/branch.h +1 -1
- data/vendor/libgit2/include/git2/buffer.h +22 -16
- data/vendor/libgit2/include/git2/cert.h +135 -0
- data/vendor/libgit2/include/git2/checkout.h +65 -32
- data/vendor/libgit2/include/git2/cherrypick.h +9 -7
- data/vendor/libgit2/include/git2/clone.h +12 -10
- data/vendor/libgit2/include/git2/commit.h +53 -3
- data/vendor/libgit2/include/git2/common.h +60 -8
- data/vendor/libgit2/include/git2/config.h +30 -19
- data/vendor/libgit2/include/git2/cred.h +308 -0
- data/vendor/libgit2/include/git2/deprecated.h +493 -0
- data/vendor/libgit2/include/git2/describe.h +32 -9
- data/vendor/libgit2/include/git2/diff.h +208 -156
- data/vendor/libgit2/include/git2/errors.h +54 -46
- data/vendor/libgit2/include/git2/filter.h +8 -0
- data/vendor/libgit2/include/git2/ignore.h +2 -2
- data/vendor/libgit2/include/git2/index.h +74 -52
- data/vendor/libgit2/include/git2/indexer.h +76 -6
- data/vendor/libgit2/include/git2/mailmap.h +115 -0
- data/vendor/libgit2/include/git2/merge.h +35 -18
- data/vendor/libgit2/include/git2/net.h +0 -5
- data/vendor/libgit2/include/git2/notes.h +1 -1
- data/vendor/libgit2/include/git2/object.h +17 -29
- data/vendor/libgit2/include/git2/odb.h +12 -11
- data/vendor/libgit2/include/git2/odb_backend.h +10 -9
- data/vendor/libgit2/include/git2/oid.h +2 -2
- data/vendor/libgit2/include/git2/pack.h +14 -3
- data/vendor/libgit2/include/git2/proxy.h +14 -8
- data/vendor/libgit2/include/git2/rebase.h +53 -6
- data/vendor/libgit2/include/git2/refs.h +33 -15
- data/vendor/libgit2/include/git2/refspec.h +17 -0
- data/vendor/libgit2/include/git2/remote.h +123 -24
- data/vendor/libgit2/include/git2/repository.h +76 -39
- data/vendor/libgit2/include/git2/revert.h +6 -4
- data/vendor/libgit2/include/git2/revwalk.h +7 -7
- data/vendor/libgit2/include/git2/signature.h +2 -2
- data/vendor/libgit2/include/git2/stash.h +15 -12
- data/vendor/libgit2/include/git2/status.h +33 -20
- data/vendor/libgit2/include/git2/submodule.h +30 -12
- data/vendor/libgit2/include/git2/sys/alloc.h +101 -0
- data/vendor/libgit2/include/git2/sys/commit.h +1 -1
- data/vendor/libgit2/include/git2/sys/config.h +13 -13
- data/vendor/libgit2/include/git2/sys/cred.h +90 -0
- data/vendor/libgit2/include/git2/sys/filter.h +6 -6
- data/vendor/libgit2/include/git2/sys/index.h +3 -0
- data/vendor/libgit2/include/git2/sys/mempack.h +35 -35
- data/vendor/libgit2/include/git2/sys/merge.h +9 -4
- data/vendor/libgit2/include/git2/sys/odb_backend.h +66 -22
- data/vendor/libgit2/include/git2/sys/path.h +64 -0
- data/vendor/libgit2/include/git2/sys/refdb_backend.h +76 -40
- data/vendor/libgit2/include/git2/sys/repository.h +5 -1
- data/vendor/libgit2/include/git2/sys/stream.h +92 -12
- data/vendor/libgit2/include/git2/sys/transport.h +129 -83
- data/vendor/libgit2/include/git2/tag.h +13 -4
- data/vendor/libgit2/include/git2/trace.h +2 -2
- data/vendor/libgit2/include/git2/transaction.h +1 -0
- data/vendor/libgit2/include/git2/transport.h +11 -311
- data/vendor/libgit2/include/git2/tree.h +4 -4
- data/vendor/libgit2/include/git2/types.h +33 -111
- data/vendor/libgit2/include/git2/version.h +4 -4
- data/vendor/libgit2/include/git2/worktree.h +48 -13
- data/vendor/libgit2/src/CMakeLists.txt +96 -164
- data/vendor/libgit2/src/alloc.c +43 -0
- data/vendor/libgit2/src/alloc.h +40 -0
- data/vendor/libgit2/src/allocators/stdalloc.c +119 -0
- data/vendor/libgit2/src/{streams/curl.h → allocators/stdalloc.h} +5 -5
- data/vendor/libgit2/src/allocators/win32_crtdbg.c +118 -0
- data/vendor/libgit2/src/{transports/cred.h → allocators/win32_crtdbg.h} +5 -4
- data/vendor/libgit2/src/annotated_commit.c +15 -8
- data/vendor/libgit2/src/apply.c +537 -31
- data/vendor/libgit2/src/apply.h +3 -1
- data/vendor/libgit2/src/array.h +2 -2
- data/vendor/libgit2/src/attr.c +81 -75
- data/vendor/libgit2/src/attr_file.c +207 -121
- data/vendor/libgit2/src/attr_file.h +9 -9
- data/vendor/libgit2/src/attrcache.c +51 -53
- data/vendor/libgit2/src/attrcache.h +2 -1
- data/vendor/libgit2/src/blame.c +47 -20
- data/vendor/libgit2/src/blame.h +2 -1
- data/vendor/libgit2/src/blame_git.c +37 -20
- data/vendor/libgit2/src/blob.c +128 -42
- data/vendor/libgit2/src/blob.h +19 -2
- data/vendor/libgit2/src/branch.c +67 -43
- data/vendor/libgit2/src/buf_text.c +7 -6
- data/vendor/libgit2/src/buffer.c +69 -57
- data/vendor/libgit2/src/buffer.h +1 -1
- data/vendor/libgit2/src/cache.c +38 -45
- data/vendor/libgit2/src/cache.h +3 -3
- data/vendor/libgit2/src/cc-compat.h +20 -3
- data/vendor/libgit2/src/checkout.c +109 -90
- data/vendor/libgit2/src/cherrypick.c +15 -9
- data/vendor/libgit2/src/clone.c +49 -27
- data/vendor/libgit2/src/clone.h +4 -0
- data/vendor/libgit2/src/commit.c +117 -49
- data/vendor/libgit2/src/commit.h +7 -0
- data/vendor/libgit2/src/commit_list.c +30 -78
- data/vendor/libgit2/src/commit_list.h +2 -2
- data/vendor/libgit2/src/common.h +27 -91
- data/vendor/libgit2/src/config.c +194 -176
- data/vendor/libgit2/src/config.h +8 -20
- data/vendor/libgit2/src/config_backend.h +96 -0
- data/vendor/libgit2/src/config_cache.c +41 -35
- data/vendor/libgit2/src/config_entries.c +229 -0
- data/vendor/libgit2/src/config_entries.h +24 -0
- data/vendor/libgit2/src/config_file.c +439 -753
- data/vendor/libgit2/src/config_mem.c +220 -0
- data/vendor/libgit2/src/config_parse.c +114 -63
- data/vendor/libgit2/src/config_parse.h +17 -16
- data/vendor/libgit2/src/config_snapshot.c +206 -0
- data/vendor/libgit2/src/crlf.c +219 -190
- data/vendor/libgit2/src/delta.c +25 -18
- data/vendor/libgit2/src/describe.c +42 -41
- data/vendor/libgit2/src/diff.c +53 -68
- data/vendor/libgit2/src/diff.h +2 -1
- data/vendor/libgit2/src/diff_driver.c +47 -49
- data/vendor/libgit2/src/diff_file.c +19 -17
- data/vendor/libgit2/src/diff_file.h +1 -1
- data/vendor/libgit2/src/diff_generate.c +162 -106
- data/vendor/libgit2/src/diff_generate.h +3 -3
- data/vendor/libgit2/src/diff_parse.c +4 -4
- data/vendor/libgit2/src/diff_print.c +42 -30
- data/vendor/libgit2/src/diff_stats.c +22 -7
- data/vendor/libgit2/src/diff_tform.c +16 -16
- data/vendor/libgit2/src/diff_xdiff.c +15 -3
- data/vendor/libgit2/src/errors.c +51 -39
- data/vendor/libgit2/src/errors.h +81 -0
- data/vendor/libgit2/src/features.h.in +11 -3
- data/vendor/libgit2/src/fetch.c +10 -5
- data/vendor/libgit2/src/fetchhead.c +17 -17
- data/vendor/libgit2/src/filebuf.c +32 -36
- data/vendor/libgit2/src/filebuf.h +2 -2
- data/vendor/libgit2/src/filter.c +46 -38
- data/vendor/libgit2/src/filter.h +0 -10
- data/vendor/libgit2/src/{fileops.c → futils.c} +80 -73
- data/vendor/libgit2/src/{fileops.h → futils.h} +6 -6
- data/vendor/libgit2/src/global.c +48 -63
- data/vendor/libgit2/src/global.h +0 -2
- data/vendor/libgit2/src/hash.c +61 -0
- data/vendor/libgit2/src/hash.h +20 -19
- data/vendor/libgit2/src/hash/sha1.h +38 -0
- data/vendor/libgit2/src/hash/sha1/collisiondetect.c +48 -0
- data/vendor/libgit2/src/hash/sha1/collisiondetect.h +19 -0
- data/vendor/libgit2/src/hash/{hash_common_crypto.h → sha1/common_crypto.c} +17 -17
- data/vendor/libgit2/src/hash/sha1/common_crypto.h +19 -0
- data/vendor/libgit2/src/hash/{hash_generic.c → sha1/generic.c} +22 -10
- data/vendor/libgit2/src/hash/{hash_generic.h → sha1/generic.h} +4 -10
- data/vendor/libgit2/src/hash/sha1/mbedtls.c +46 -0
- data/vendor/libgit2/src/hash/sha1/mbedtls.h +19 -0
- data/vendor/libgit2/src/hash/sha1/openssl.c +59 -0
- data/vendor/libgit2/src/hash/sha1/openssl.h +19 -0
- data/vendor/libgit2/src/hash/{sha1dc → sha1/sha1dc}/sha1.c +14 -3
- data/vendor/libgit2/src/hash/{sha1dc → sha1/sha1dc}/sha1.h +0 -0
- data/vendor/libgit2/src/hash/{sha1dc → sha1/sha1dc}/ubc_check.c +0 -0
- data/vendor/libgit2/src/hash/{sha1dc → sha1/sha1dc}/ubc_check.h +0 -0
- data/vendor/libgit2/src/hash/{hash_win32.c → sha1/win32.c} +47 -37
- data/vendor/libgit2/src/hash/{hash_win32.h → sha1/win32.h} +6 -19
- data/vendor/libgit2/src/hashsig.c +5 -5
- data/vendor/libgit2/src/idxmap.c +107 -61
- data/vendor/libgit2/src/idxmap.h +153 -31
- data/vendor/libgit2/src/ignore.c +43 -47
- data/vendor/libgit2/src/index.c +337 -232
- data/vendor/libgit2/src/index.h +17 -1
- data/vendor/libgit2/src/indexer.c +346 -175
- data/vendor/libgit2/src/integer.h +71 -26
- data/vendor/libgit2/src/iterator.c +142 -70
- data/vendor/libgit2/src/iterator.h +15 -0
- data/vendor/libgit2/src/khash.h +3 -1
- data/vendor/libgit2/src/mailmap.c +485 -0
- data/vendor/libgit2/src/mailmap.h +35 -0
- data/vendor/libgit2/src/map.h +1 -1
- data/vendor/libgit2/src/merge.c +144 -100
- data/vendor/libgit2/src/merge_driver.c +11 -11
- data/vendor/libgit2/src/merge_file.c +2 -2
- data/vendor/libgit2/src/mwindow.c +24 -29
- data/vendor/libgit2/src/mwindow.h +4 -4
- data/vendor/libgit2/src/net.c +184 -0
- data/vendor/libgit2/src/net.h +36 -0
- data/vendor/libgit2/src/netops.c +55 -156
- data/vendor/libgit2/src/netops.h +3 -23
- data/vendor/libgit2/src/notes.c +16 -11
- data/vendor/libgit2/src/object.c +120 -69
- data/vendor/libgit2/src/object.h +22 -9
- data/vendor/libgit2/src/object_api.c +8 -8
- data/vendor/libgit2/src/odb.c +116 -93
- data/vendor/libgit2/src/odb.h +8 -7
- data/vendor/libgit2/src/odb_loose.c +62 -55
- data/vendor/libgit2/src/odb_mempack.c +21 -34
- data/vendor/libgit2/src/odb_pack.c +18 -14
- data/vendor/libgit2/src/offmap.c +53 -35
- data/vendor/libgit2/src/offmap.h +108 -21
- data/vendor/libgit2/src/oid.c +12 -7
- data/vendor/libgit2/src/oidmap.c +49 -47
- data/vendor/libgit2/src/oidmap.h +101 -24
- data/vendor/libgit2/src/pack-objects.c +88 -87
- data/vendor/libgit2/src/pack-objects.h +2 -8
- data/vendor/libgit2/src/pack.c +99 -101
- data/vendor/libgit2/src/pack.h +17 -19
- data/vendor/libgit2/src/parse.c +10 -0
- data/vendor/libgit2/src/parse.h +3 -3
- data/vendor/libgit2/src/patch.c +4 -4
- data/vendor/libgit2/src/patch_generate.c +20 -20
- data/vendor/libgit2/src/patch_parse.c +151 -63
- data/vendor/libgit2/src/path.c +169 -125
- data/vendor/libgit2/src/path.h +3 -71
- data/vendor/libgit2/src/pathspec.c +19 -19
- data/vendor/libgit2/src/pool.c +26 -22
- data/vendor/libgit2/src/pool.h +7 -7
- data/vendor/libgit2/src/posix.c +10 -10
- data/vendor/libgit2/src/posix.h +12 -1
- data/vendor/libgit2/src/proxy.c +8 -3
- data/vendor/libgit2/src/push.c +37 -31
- data/vendor/libgit2/src/push.h +2 -1
- data/vendor/libgit2/src/reader.c +265 -0
- data/vendor/libgit2/src/reader.h +107 -0
- data/vendor/libgit2/src/rebase.c +115 -59
- data/vendor/libgit2/src/refdb.c +15 -3
- data/vendor/libgit2/src/refdb_fs.c +381 -254
- data/vendor/libgit2/src/reflog.c +13 -15
- data/vendor/libgit2/src/refs.c +118 -88
- data/vendor/libgit2/src/refs.h +5 -3
- data/vendor/libgit2/src/refspec.c +56 -37
- data/vendor/libgit2/src/refspec.h +1 -1
- data/vendor/libgit2/src/regexp.c +221 -0
- data/vendor/libgit2/src/regexp.h +97 -0
- data/vendor/libgit2/src/remote.c +266 -215
- data/vendor/libgit2/src/remote.h +11 -2
- data/vendor/libgit2/src/repository.c +280 -225
- data/vendor/libgit2/src/repository.h +52 -40
- data/vendor/libgit2/src/reset.c +8 -8
- data/vendor/libgit2/src/revert.c +14 -9
- data/vendor/libgit2/src/revparse.c +47 -48
- data/vendor/libgit2/src/revwalk.c +120 -57
- data/vendor/libgit2/src/revwalk.h +22 -1
- data/vendor/libgit2/src/settings.c +47 -10
- data/vendor/libgit2/src/signature.c +11 -11
- data/vendor/libgit2/src/sortedcache.c +22 -36
- data/vendor/libgit2/src/sortedcache.h +1 -1
- data/vendor/libgit2/src/stash.c +125 -99
- data/vendor/libgit2/src/status.c +28 -22
- data/vendor/libgit2/src/stream.h +17 -2
- data/vendor/libgit2/src/streams/mbedtls.c +483 -0
- data/vendor/libgit2/src/streams/mbedtls.h +23 -0
- data/vendor/libgit2/src/streams/openssl.c +224 -114
- data/vendor/libgit2/src/streams/openssl.h +4 -108
- data/vendor/libgit2/src/streams/registry.c +118 -0
- data/vendor/libgit2/src/streams/registry.h +19 -0
- data/vendor/libgit2/src/streams/socket.c +55 -30
- data/vendor/libgit2/src/streams/stransport.c +57 -32
- data/vendor/libgit2/src/streams/stransport.h +5 -0
- data/vendor/libgit2/src/streams/tls.c +50 -19
- data/vendor/libgit2/src/streams/tls.h +12 -4
- data/vendor/libgit2/src/strmap.c +47 -74
- data/vendor/libgit2/src/strmap.h +108 -33
- data/vendor/libgit2/src/submodule.c +272 -216
- data/vendor/libgit2/src/submodule.h +1 -1
- data/vendor/libgit2/src/sysdir.c +29 -19
- data/vendor/libgit2/src/tag.c +41 -28
- data/vendor/libgit2/src/tag.h +2 -1
- data/vendor/libgit2/src/trace.c +2 -2
- data/vendor/libgit2/src/trace.h +3 -3
- data/vendor/libgit2/src/trailer.c +52 -38
- data/vendor/libgit2/src/transaction.c +30 -29
- data/vendor/libgit2/src/transport.c +5 -5
- data/vendor/libgit2/src/transports/auth.c +15 -11
- data/vendor/libgit2/src/transports/auth.h +10 -3
- data/vendor/libgit2/src/transports/auth_negotiate.c +33 -18
- data/vendor/libgit2/src/transports/auth_negotiate.h +2 -2
- data/vendor/libgit2/src/transports/auth_ntlm.c +223 -0
- data/vendor/libgit2/src/transports/auth_ntlm.h +35 -0
- data/vendor/libgit2/src/transports/cred.c +24 -24
- data/vendor/libgit2/src/transports/git.c +26 -31
- data/vendor/libgit2/src/transports/http.c +881 -348
- data/vendor/libgit2/src/transports/http.h +2 -0
- data/vendor/libgit2/src/transports/local.c +35 -35
- data/vendor/libgit2/src/transports/smart.c +70 -47
- data/vendor/libgit2/src/transports/smart.h +3 -4
- data/vendor/libgit2/src/transports/smart_pkt.c +43 -40
- data/vendor/libgit2/src/transports/smart_protocol.c +96 -116
- data/vendor/libgit2/src/transports/ssh.c +77 -66
- data/vendor/libgit2/src/transports/winhttp.c +318 -314
- data/vendor/libgit2/src/tree-cache.c +19 -12
- data/vendor/libgit2/src/tree.c +103 -142
- data/vendor/libgit2/src/tree.h +1 -12
- data/vendor/libgit2/src/unix/map.c +3 -3
- data/vendor/libgit2/src/unix/posix.h +1 -11
- data/vendor/libgit2/src/userdiff.h +3 -1
- data/vendor/libgit2/src/util.c +70 -56
- data/vendor/libgit2/src/util.h +28 -156
- data/vendor/libgit2/src/vector.c +4 -4
- data/vendor/libgit2/src/wildmatch.c +320 -0
- data/vendor/libgit2/src/wildmatch.h +23 -0
- data/vendor/libgit2/src/win32/dir.c +3 -3
- data/vendor/libgit2/src/win32/findfile.c +3 -3
- data/vendor/libgit2/src/win32/map.c +9 -11
- data/vendor/libgit2/src/win32/msvc-compat.h +6 -0
- data/vendor/libgit2/src/win32/path_w32.c +113 -9
- data/vendor/libgit2/src/win32/path_w32.h +18 -29
- data/vendor/libgit2/src/win32/posix.h +1 -4
- data/vendor/libgit2/src/win32/posix_w32.c +70 -45
- data/vendor/libgit2/src/win32/precompiled.h +0 -2
- data/vendor/libgit2/src/win32/thread.c +5 -10
- data/vendor/libgit2/src/win32/w32_buffer.c +9 -5
- data/vendor/libgit2/src/win32/w32_common.h +39 -0
- data/vendor/libgit2/src/win32/w32_crtdbg_stacktrace.c +3 -2
- data/vendor/libgit2/src/win32/w32_crtdbg_stacktrace.h +26 -75
- data/vendor/libgit2/src/win32/w32_stack.c +6 -11
- data/vendor/libgit2/src/win32/w32_stack.h +3 -3
- data/vendor/libgit2/src/win32/w32_util.c +27 -64
- data/vendor/libgit2/src/win32/w32_util.h +5 -49
- data/vendor/libgit2/src/worktree.c +95 -60
- data/vendor/libgit2/src/worktree.h +2 -0
- data/vendor/libgit2/src/xdiff/xdiffi.c +7 -5
- data/vendor/libgit2/src/xdiff/xhistogram.c +1 -1
- data/vendor/libgit2/src/xdiff/xmerge.c +27 -15
- data/vendor/libgit2/src/xdiff/xpatience.c +3 -0
- data/vendor/libgit2/src/zstream.c +4 -4
- metadata +122 -33
- data/vendor/libgit2/deps/regex/CMakeLists.txt +0 -2
- data/vendor/libgit2/deps/regex/config.h +0 -7
- data/vendor/libgit2/deps/regex/regcomp.c +0 -3857
- data/vendor/libgit2/deps/regex/regex.c +0 -92
- data/vendor/libgit2/deps/regex/regex.h +0 -582
- data/vendor/libgit2/deps/regex/regex_internal.c +0 -1744
- data/vendor/libgit2/deps/regex/regex_internal.h +0 -819
- data/vendor/libgit2/deps/regex/regexec.c +0 -4369
- data/vendor/libgit2/include/git2/inttypes.h +0 -309
- data/vendor/libgit2/include/git2/sys/time.h +0 -31
- data/vendor/libgit2/libgit2.pc.in +0 -13
- data/vendor/libgit2/src/config_file.h +0 -73
- data/vendor/libgit2/src/fnmatch.c +0 -248
- data/vendor/libgit2/src/fnmatch.h +0 -48
- data/vendor/libgit2/src/hash/hash_collisiondetect.h +0 -47
- data/vendor/libgit2/src/hash/hash_openssl.h +0 -59
- data/vendor/libgit2/src/streams/curl.c +0 -385
data/vendor/libgit2/src/blob.h
CHANGED
@@ -12,15 +12,32 @@
|
|
12
12
|
#include "git2/blob.h"
|
13
13
|
#include "repository.h"
|
14
14
|
#include "odb.h"
|
15
|
-
#include "
|
15
|
+
#include "futils.h"
|
16
16
|
|
17
17
|
struct git_blob {
|
18
18
|
git_object object;
|
19
|
-
|
19
|
+
|
20
|
+
union {
|
21
|
+
git_odb_object *odb;
|
22
|
+
struct {
|
23
|
+
const char *data;
|
24
|
+
git_object_size_t size;
|
25
|
+
} raw;
|
26
|
+
} data;
|
27
|
+
unsigned int raw:1;
|
20
28
|
};
|
21
29
|
|
30
|
+
#define GIT_ERROR_CHECK_BLOBSIZE(n) \
|
31
|
+
do { \
|
32
|
+
if (!git__is_sizet(n)) { \
|
33
|
+
git_error_set(GIT_ERROR_NOMEMORY, "blob contents too large to fit in memory"); \
|
34
|
+
return -1; \
|
35
|
+
} \
|
36
|
+
} while(0)
|
37
|
+
|
22
38
|
void git_blob__free(void *blob);
|
23
39
|
int git_blob__parse(void *blob, git_odb_object *obj);
|
40
|
+
int git_blob__parse_raw(void *blob, const char *data, size_t size);
|
24
41
|
int git_blob__getbuf(git_buf *buffer, git_blob *blob);
|
25
42
|
|
26
43
|
extern int git_blob__create_from_paths(
|
data/vendor/libgit2/src/branch.c
CHANGED
@@ -22,7 +22,7 @@ static int retrieve_branch_reference(
|
|
22
22
|
git_reference **branch_reference_out,
|
23
23
|
git_repository *repo,
|
24
24
|
const char *branch_name,
|
25
|
-
|
25
|
+
bool is_remote)
|
26
26
|
{
|
27
27
|
git_reference *branch = NULL;
|
28
28
|
int error = 0;
|
@@ -34,20 +34,20 @@ static int retrieve_branch_reference(
|
|
34
34
|
if ((error = git_buf_joinpath(&ref_name, prefix, branch_name)) < 0)
|
35
35
|
/* OOM */;
|
36
36
|
else if ((error = git_reference_lookup(&branch, repo, ref_name.ptr)) < 0)
|
37
|
-
|
38
|
-
|
37
|
+
git_error_set(
|
38
|
+
GIT_ERROR_REFERENCE, "cannot locate %s branch '%s'",
|
39
39
|
is_remote ? "remote-tracking" : "local", branch_name);
|
40
40
|
|
41
41
|
*branch_reference_out = branch; /* will be NULL on error */
|
42
42
|
|
43
|
-
|
43
|
+
git_buf_dispose(&ref_name);
|
44
44
|
return error;
|
45
45
|
}
|
46
46
|
|
47
47
|
static int not_a_local_branch(const char *reference_name)
|
48
48
|
{
|
49
|
-
|
50
|
-
|
49
|
+
git_error_set(
|
50
|
+
GIT_ERROR_INVALID,
|
51
51
|
"reference '%s' is not a local branch.", reference_name);
|
52
52
|
return -1;
|
53
53
|
}
|
@@ -71,7 +71,7 @@ static int create_branch(
|
|
71
71
|
assert(git_object_owner((const git_object *)commit) == repository);
|
72
72
|
|
73
73
|
if (!git__strcmp(branch_name, "HEAD")) {
|
74
|
-
|
74
|
+
git_error_set(GIT_ERROR_REFERENCE, "'HEAD' is not a valid branch name");
|
75
75
|
error = -1;
|
76
76
|
goto cleanup;
|
77
77
|
}
|
@@ -88,7 +88,7 @@ static int create_branch(
|
|
88
88
|
}
|
89
89
|
|
90
90
|
if (is_unmovable_head && force) {
|
91
|
-
|
91
|
+
git_error_set(GIT_ERROR_REFERENCE, "cannot force update branch '%s' as it is "
|
92
92
|
"the current HEAD of the repository.", branch_name);
|
93
93
|
error = -1;
|
94
94
|
goto cleanup;
|
@@ -108,8 +108,8 @@ static int create_branch(
|
|
108
108
|
*ref_out = branch;
|
109
109
|
|
110
110
|
cleanup:
|
111
|
-
|
112
|
-
|
111
|
+
git_buf_dispose(&canonical_branch_name);
|
112
|
+
git_buf_dispose(&log_message);
|
113
113
|
return error;
|
114
114
|
}
|
115
115
|
|
@@ -141,7 +141,7 @@ static int branch_equals(git_repository *repo, const char *path, void *payload)
|
|
141
141
|
int equal = 0;
|
142
142
|
|
143
143
|
if (git_reference__read_head(&head, repo, path) < 0 ||
|
144
|
-
git_reference_type(head) !=
|
144
|
+
git_reference_type(head) != GIT_REFERENCE_SYMBOLIC)
|
145
145
|
goto done;
|
146
146
|
|
147
147
|
equal = !git__strcmp(head->target.symbolic, branch->name);
|
@@ -153,10 +153,20 @@ done:
|
|
153
153
|
|
154
154
|
int git_branch_is_checked_out(const git_reference *branch)
|
155
155
|
{
|
156
|
-
|
156
|
+
git_repository *repo;
|
157
|
+
int flags = 0;
|
158
|
+
|
159
|
+
assert(branch);
|
157
160
|
|
158
|
-
|
159
|
-
|
161
|
+
if (!git_reference_is_branch(branch))
|
162
|
+
return 0;
|
163
|
+
|
164
|
+
repo = git_reference_owner(branch);
|
165
|
+
|
166
|
+
if (git_repository_is_bare(repo))
|
167
|
+
flags |= GIT_REPOSITORY_FOREACH_HEAD_SKIP_REPO;
|
168
|
+
|
169
|
+
return git_repository_foreach_head(repo, branch_equals, flags, (void *) branch) == 1;
|
160
170
|
}
|
161
171
|
|
162
172
|
int git_branch_delete(git_reference *branch)
|
@@ -168,7 +178,7 @@ int git_branch_delete(git_reference *branch)
|
|
168
178
|
assert(branch);
|
169
179
|
|
170
180
|
if (!git_reference_is_branch(branch) && !git_reference_is_remote(branch)) {
|
171
|
-
|
181
|
+
git_error_set(GIT_ERROR_INVALID, "reference '%s' is not a valid branch.",
|
172
182
|
git_reference_name(branch));
|
173
183
|
return GIT_ENOTFOUND;
|
174
184
|
}
|
@@ -177,13 +187,13 @@ int git_branch_delete(git_reference *branch)
|
|
177
187
|
return is_head;
|
178
188
|
|
179
189
|
if (is_head) {
|
180
|
-
|
190
|
+
git_error_set(GIT_ERROR_REFERENCE, "cannot delete branch '%s' as it is "
|
181
191
|
"the current HEAD of the repository.", git_reference_name(branch));
|
182
192
|
return -1;
|
183
193
|
}
|
184
194
|
|
185
195
|
if (git_reference_is_branch(branch) && git_branch_is_checked_out(branch)) {
|
186
|
-
|
196
|
+
git_error_set(GIT_ERROR_REFERENCE, "Cannot delete branch '%s' as it is "
|
187
197
|
"the current HEAD of a linked repository.", git_reference_name(branch));
|
188
198
|
return -1;
|
189
199
|
}
|
@@ -199,7 +209,7 @@ int git_branch_delete(git_reference *branch)
|
|
199
209
|
error = git_reference_delete(branch);
|
200
210
|
|
201
211
|
on_error:
|
202
|
-
|
212
|
+
git_buf_dispose(&config_section);
|
203
213
|
return error;
|
204
214
|
}
|
205
215
|
|
@@ -243,7 +253,7 @@ int git_branch_iterator_new(
|
|
243
253
|
branch_iter *iter;
|
244
254
|
|
245
255
|
iter = git__calloc(1, sizeof(branch_iter));
|
246
|
-
|
256
|
+
GIT_ERROR_CHECK_ALLOC(iter);
|
247
257
|
|
248
258
|
iter->flags = list_flags;
|
249
259
|
|
@@ -310,10 +320,10 @@ int git_branch_move(
|
|
310
320
|
git_buf_cstr(&new_config_section));
|
311
321
|
|
312
322
|
done:
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
323
|
+
git_buf_dispose(&new_reference_name);
|
324
|
+
git_buf_dispose(&old_config_section);
|
325
|
+
git_buf_dispose(&new_config_section);
|
326
|
+
git_buf_dispose(&log_message);
|
317
327
|
|
318
328
|
return error;
|
319
329
|
}
|
@@ -324,9 +334,23 @@ int git_branch_lookup(
|
|
324
334
|
const char *branch_name,
|
325
335
|
git_branch_t branch_type)
|
326
336
|
{
|
337
|
+
int error = -1;
|
327
338
|
assert(ref_out && repo && branch_name);
|
328
339
|
|
329
|
-
|
340
|
+
switch (branch_type) {
|
341
|
+
case GIT_BRANCH_LOCAL:
|
342
|
+
case GIT_BRANCH_REMOTE:
|
343
|
+
error = retrieve_branch_reference(ref_out, repo, branch_name, branch_type == GIT_BRANCH_REMOTE);
|
344
|
+
break;
|
345
|
+
case GIT_BRANCH_ALL:
|
346
|
+
error = retrieve_branch_reference(ref_out, repo, branch_name, false);
|
347
|
+
if (error == GIT_ENOTFOUND)
|
348
|
+
error = retrieve_branch_reference(ref_out, repo, branch_name, true);
|
349
|
+
break;
|
350
|
+
default:
|
351
|
+
assert(false);
|
352
|
+
}
|
353
|
+
return error;
|
330
354
|
}
|
331
355
|
|
332
356
|
int git_branch_name(
|
@@ -344,7 +368,7 @@ int git_branch_name(
|
|
344
368
|
} else if (git_reference_is_remote(ref)) {
|
345
369
|
branch_name += strlen(GIT_REFS_REMOTES_DIR);
|
346
370
|
} else {
|
347
|
-
|
371
|
+
git_error_set(GIT_ERROR_INVALID,
|
348
372
|
"reference '%s' is neither a local nor a remote branch.", ref->name);
|
349
373
|
return -1;
|
350
374
|
}
|
@@ -366,7 +390,7 @@ static int retrieve_upstream_configuration(
|
|
366
390
|
return -1;
|
367
391
|
|
368
392
|
error = git_config_get_string_buf(out, config, git_buf_cstr(&buf));
|
369
|
-
|
393
|
+
git_buf_dispose(&buf);
|
370
394
|
return error;
|
371
395
|
}
|
372
396
|
|
@@ -402,7 +426,7 @@ int git_branch_upstream_name(
|
|
402
426
|
goto cleanup;
|
403
427
|
|
404
428
|
if (git_buf_len(&remote_name) == 0 || git_buf_len(&merge_name) == 0) {
|
405
|
-
|
429
|
+
git_error_set(GIT_ERROR_REFERENCE,
|
406
430
|
"branch '%s' does not have an upstream", refname);
|
407
431
|
error = GIT_ENOTFOUND;
|
408
432
|
goto cleanup;
|
@@ -429,9 +453,9 @@ int git_branch_upstream_name(
|
|
429
453
|
cleanup:
|
430
454
|
git_config_free(config);
|
431
455
|
git_remote_free(remote);
|
432
|
-
|
433
|
-
|
434
|
-
|
456
|
+
git_buf_dispose(&remote_name);
|
457
|
+
git_buf_dispose(&merge_name);
|
458
|
+
git_buf_dispose(&buf);
|
435
459
|
return error;
|
436
460
|
}
|
437
461
|
|
@@ -452,7 +476,7 @@ int git_branch_upstream_remote(git_buf *buf, git_repository *repo, const char *r
|
|
452
476
|
return error;
|
453
477
|
|
454
478
|
if (git_buf_len(buf) == 0) {
|
455
|
-
|
479
|
+
git_error_set(GIT_ERROR_REFERENCE, "branch '%s' does not have an upstream remote", refname);
|
456
480
|
error = GIT_ENOTFOUND;
|
457
481
|
git_buf_clear(buf);
|
458
482
|
}
|
@@ -475,7 +499,7 @@ int git_branch_remote_name(git_buf *buf, git_repository *repo, const char *refna
|
|
475
499
|
|
476
500
|
/* Verify that this is a remote branch */
|
477
501
|
if (!git_reference__is_remote(refname)) {
|
478
|
-
|
502
|
+
git_error_set(GIT_ERROR_INVALID, "reference '%s' is not a remote branch.",
|
479
503
|
refname);
|
480
504
|
error = GIT_ERROR;
|
481
505
|
goto cleanup;
|
@@ -501,7 +525,7 @@ int git_branch_remote_name(git_buf *buf, git_repository *repo, const char *refna
|
|
501
525
|
} else {
|
502
526
|
git_remote_free(remote);
|
503
527
|
|
504
|
-
|
528
|
+
git_error_set(GIT_ERROR_REFERENCE,
|
505
529
|
"reference '%s' is ambiguous", refname);
|
506
530
|
error = GIT_EAMBIGUOUS;
|
507
531
|
goto cleanup;
|
@@ -515,14 +539,14 @@ int git_branch_remote_name(git_buf *buf, git_repository *repo, const char *refna
|
|
515
539
|
git_buf_clear(buf);
|
516
540
|
error = git_buf_puts(buf, remote_name);
|
517
541
|
} else {
|
518
|
-
|
542
|
+
git_error_set(GIT_ERROR_REFERENCE,
|
519
543
|
"could not determine remote for '%s'", refname);
|
520
544
|
error = GIT_ENOTFOUND;
|
521
545
|
}
|
522
546
|
|
523
547
|
cleanup:
|
524
548
|
if (error < 0)
|
525
|
-
|
549
|
+
git_buf_dispose(buf);
|
526
550
|
|
527
551
|
git_strarray_free(&remote_list);
|
528
552
|
return error;
|
@@ -544,7 +568,7 @@ int git_branch_upstream(
|
|
544
568
|
git_reference_owner(branch),
|
545
569
|
git_buf_cstr(&tracking_name));
|
546
570
|
|
547
|
-
|
571
|
+
git_buf_dispose(&tracking_name);
|
548
572
|
return error;
|
549
573
|
}
|
550
574
|
|
@@ -565,11 +589,11 @@ static int unset_upstream(git_config *config, const char *shortname)
|
|
565
589
|
if (git_config_delete_entry(config, git_buf_cstr(&buf)) < 0)
|
566
590
|
goto on_error;
|
567
591
|
|
568
|
-
|
592
|
+
git_buf_dispose(&buf);
|
569
593
|
return 0;
|
570
594
|
|
571
595
|
on_error:
|
572
|
-
|
596
|
+
git_buf_dispose(&buf);
|
573
597
|
return -1;
|
574
598
|
}
|
575
599
|
|
@@ -604,7 +628,7 @@ int git_branch_set_upstream(git_reference *branch, const char *upstream_name)
|
|
604
628
|
else if (git_branch_lookup(&upstream, repo, upstream_name, GIT_BRANCH_REMOTE) == 0)
|
605
629
|
local = 0;
|
606
630
|
else {
|
607
|
-
|
631
|
+
git_error_set(GIT_ERROR_REFERENCE,
|
608
632
|
"cannot set upstream for branch '%s'", shortname);
|
609
633
|
return GIT_ENOTFOUND;
|
610
634
|
}
|
@@ -655,15 +679,15 @@ int git_branch_set_upstream(git_reference *branch, const char *upstream_name)
|
|
655
679
|
goto on_error;
|
656
680
|
|
657
681
|
git_reference_free(upstream);
|
658
|
-
|
659
|
-
|
682
|
+
git_buf_dispose(&key);
|
683
|
+
git_buf_dispose(&value);
|
660
684
|
|
661
685
|
return 0;
|
662
686
|
|
663
687
|
on_error:
|
664
688
|
git_reference_free(upstream);
|
665
|
-
|
666
|
-
|
689
|
+
git_buf_dispose(&key);
|
690
|
+
git_buf_dispose(&value);
|
667
691
|
git_remote_free(remote);
|
668
692
|
|
669
693
|
return -1;
|
@@ -29,7 +29,7 @@ int git_buf_text_puts_escaped(
|
|
29
29
|
scan += count;
|
30
30
|
}
|
31
31
|
|
32
|
-
|
32
|
+
GIT_ERROR_CHECK_ALLOC_ADD(&alloclen, total, 1);
|
33
33
|
if (git_buf_grow_by(buf, alloclen) < 0)
|
34
34
|
return -1;
|
35
35
|
|
@@ -75,7 +75,7 @@ int git_buf_text_crlf_to_lf(git_buf *tgt, const git_buf *src)
|
|
75
75
|
return git_buf_set(tgt, src->ptr, src->size);
|
76
76
|
|
77
77
|
/* reduce reallocs while in the loop */
|
78
|
-
|
78
|
+
GIT_ERROR_CHECK_ALLOC_ADD(&new_size, src->size, 1);
|
79
79
|
if (git_buf_grow(tgt, new_size) < 0)
|
80
80
|
return -1;
|
81
81
|
|
@@ -122,8 +122,8 @@ int git_buf_text_lf_to_crlf(git_buf *tgt, const git_buf *src)
|
|
122
122
|
return git_buf_set(tgt, src->ptr, src->size);
|
123
123
|
|
124
124
|
/* attempt to reduce reallocs while in the loop */
|
125
|
-
|
126
|
-
|
125
|
+
GIT_ERROR_CHECK_ALLOC_ADD(&alloclen, src->size, src->size >> 4);
|
126
|
+
GIT_ERROR_CHECK_ALLOC_ADD(&alloclen, alloclen, 1);
|
127
127
|
if (git_buf_grow(tgt, alloclen) < 0)
|
128
128
|
return -1;
|
129
129
|
tgt->size = 0;
|
@@ -135,7 +135,7 @@ int git_buf_text_lf_to_crlf(git_buf *tgt, const git_buf *src)
|
|
135
135
|
if (copylen && next[-1] == '\r')
|
136
136
|
copylen--;
|
137
137
|
|
138
|
-
|
138
|
+
GIT_ERROR_CHECK_ALLOC_ADD(&alloclen, copylen, 3);
|
139
139
|
if (git_buf_grow_by(tgt, alloclen) < 0)
|
140
140
|
return -1;
|
141
141
|
|
@@ -310,6 +310,7 @@ bool git_buf_text_gather_stats(
|
|
310
310
|
}
|
311
311
|
}
|
312
312
|
|
313
|
-
|
313
|
+
/* Treat files with a bare CR as binary */
|
314
|
+
return (stats->cr != stats->crlf || stats->nul > 0 ||
|
314
315
|
((stats->printable >> 7) < stats->nonprintable));
|
315
316
|
}
|
data/vendor/libgit2/src/buffer.c
CHANGED
@@ -18,7 +18,8 @@ char git_buf__initbuf[1];
|
|
18
18
|
char git_buf__oom[1];
|
19
19
|
|
20
20
|
#define ENSURE_SIZE(b, d) \
|
21
|
-
if ((
|
21
|
+
if ((b)->ptr == git_buf__oom || \
|
22
|
+
((d) > (b)->asize && git_buf_grow((b), (d)) < 0))\
|
22
23
|
return -1;
|
23
24
|
|
24
25
|
|
@@ -43,7 +44,7 @@ int git_buf_try_grow(
|
|
43
44
|
return -1;
|
44
45
|
|
45
46
|
if (buf->asize == 0 && buf->size != 0) {
|
46
|
-
|
47
|
+
git_error_set(GIT_ERROR_INVALID, "cannot grow a borrowed buffer");
|
47
48
|
return GIT_EINVALID;
|
48
49
|
}
|
49
50
|
|
@@ -58,22 +59,28 @@ int git_buf_try_grow(
|
|
58
59
|
new_ptr = NULL;
|
59
60
|
} else {
|
60
61
|
new_size = buf->asize;
|
62
|
+
/*
|
63
|
+
* Grow the allocated buffer by 1.5 to allow
|
64
|
+
* re-use of memory holes resulting from the
|
65
|
+
* realloc. If this is still too small, then just
|
66
|
+
* use the target size.
|
67
|
+
*/
|
68
|
+
if ((new_size = (new_size << 1) - (new_size >> 1)) < target_size)
|
69
|
+
new_size = target_size;
|
61
70
|
new_ptr = buf->ptr;
|
62
71
|
}
|
63
72
|
|
64
|
-
/* grow the buffer size by 1.5, until it's big enough
|
65
|
-
* to fit our target size */
|
66
|
-
while (new_size < target_size)
|
67
|
-
new_size = (new_size << 1) - (new_size >> 1);
|
68
|
-
|
69
73
|
/* round allocation up to multiple of 8 */
|
70
74
|
new_size = (new_size + 7) & ~7;
|
71
75
|
|
72
76
|
if (new_size < buf->size) {
|
73
|
-
if (mark_oom)
|
77
|
+
if (mark_oom) {
|
78
|
+
if (buf->ptr && buf->ptr != git_buf__initbuf)
|
79
|
+
git__free(buf->ptr);
|
74
80
|
buf->ptr = git_buf__oom;
|
81
|
+
}
|
75
82
|
|
76
|
-
|
83
|
+
git_error_set_oom();
|
77
84
|
return -1;
|
78
85
|
}
|
79
86
|
|
@@ -116,7 +123,7 @@ int git_buf_grow_by(git_buf *buffer, size_t additional_size)
|
|
116
123
|
return git_buf_try_grow(buffer, newsize, true);
|
117
124
|
}
|
118
125
|
|
119
|
-
void
|
126
|
+
void git_buf_dispose(git_buf *buf)
|
120
127
|
{
|
121
128
|
if (!buf) return;
|
122
129
|
|
@@ -126,6 +133,11 @@ void git_buf_free(git_buf *buf)
|
|
126
133
|
git_buf_init(buf, 0);
|
127
134
|
}
|
128
135
|
|
136
|
+
void git_buf_free(git_buf *buf)
|
137
|
+
{
|
138
|
+
git_buf_dispose(buf);
|
139
|
+
}
|
140
|
+
|
129
141
|
void git_buf_sanitize(git_buf *buf)
|
130
142
|
{
|
131
143
|
if (buf->ptr == NULL) {
|
@@ -156,7 +168,7 @@ int git_buf_set(git_buf *buf, const void *data, size_t len)
|
|
156
168
|
git_buf_clear(buf);
|
157
169
|
} else {
|
158
170
|
if (data != buf->ptr) {
|
159
|
-
|
171
|
+
GIT_ERROR_CHECK_ALLOC_ADD(&alloclen, len, 1);
|
160
172
|
ENSURE_SIZE(buf, alloclen);
|
161
173
|
memmove(buf->ptr, data, len);
|
162
174
|
}
|
@@ -187,7 +199,7 @@ int git_buf_sets(git_buf *buf, const char *string)
|
|
187
199
|
int git_buf_putc(git_buf *buf, char c)
|
188
200
|
{
|
189
201
|
size_t new_size;
|
190
|
-
|
202
|
+
GIT_ERROR_CHECK_ALLOC_ADD(&new_size, buf->size, 2);
|
191
203
|
ENSURE_SIZE(buf, new_size);
|
192
204
|
buf->ptr[buf->size++] = c;
|
193
205
|
buf->ptr[buf->size] = '\0';
|
@@ -197,8 +209,8 @@ int git_buf_putc(git_buf *buf, char c)
|
|
197
209
|
int git_buf_putcn(git_buf *buf, char c, size_t len)
|
198
210
|
{
|
199
211
|
size_t new_size;
|
200
|
-
|
201
|
-
|
212
|
+
GIT_ERROR_CHECK_ALLOC_ADD(&new_size, buf->size, len);
|
213
|
+
GIT_ERROR_CHECK_ALLOC_ADD(&new_size, new_size, 1);
|
202
214
|
ENSURE_SIZE(buf, new_size);
|
203
215
|
memset(buf->ptr + buf->size, c, len);
|
204
216
|
buf->size += len;
|
@@ -213,8 +225,8 @@ int git_buf_put(git_buf *buf, const char *data, size_t len)
|
|
213
225
|
|
214
226
|
assert(data);
|
215
227
|
|
216
|
-
|
217
|
-
|
228
|
+
GIT_ERROR_CHECK_ALLOC_ADD(&new_size, buf->size, len);
|
229
|
+
GIT_ERROR_CHECK_ALLOC_ADD(&new_size, new_size, 1);
|
218
230
|
ENSURE_SIZE(buf, new_size);
|
219
231
|
memmove(buf->ptr + buf->size, data, len);
|
220
232
|
buf->size += len;
|
@@ -239,9 +251,9 @@ int git_buf_encode_base64(git_buf *buf, const char *data, size_t len)
|
|
239
251
|
const uint8_t *read = (const uint8_t *)data;
|
240
252
|
size_t blocks = (len / 3) + !!extra, alloclen;
|
241
253
|
|
242
|
-
|
243
|
-
|
244
|
-
|
254
|
+
GIT_ERROR_CHECK_ALLOC_ADD(&blocks, blocks, 1);
|
255
|
+
GIT_ERROR_CHECK_ALLOC_MULTIPLY(&alloclen, blocks, 4);
|
256
|
+
GIT_ERROR_CHECK_ALLOC_ADD(&alloclen, alloclen, buf->size);
|
245
257
|
|
246
258
|
ENSURE_SIZE(buf, alloclen);
|
247
259
|
write = (uint8_t *)&buf->ptr[buf->size];
|
@@ -301,13 +313,13 @@ int git_buf_decode_base64(git_buf *buf, const char *base64, size_t len)
|
|
301
313
|
size_t orig_size = buf->size, new_size;
|
302
314
|
|
303
315
|
if (len % 4) {
|
304
|
-
|
316
|
+
git_error_set(GIT_ERROR_INVALID, "invalid base64 input");
|
305
317
|
return -1;
|
306
318
|
}
|
307
319
|
|
308
320
|
assert(len % 4 == 0);
|
309
|
-
|
310
|
-
|
321
|
+
GIT_ERROR_CHECK_ALLOC_ADD(&new_size, (len / 4 * 3), buf->size);
|
322
|
+
GIT_ERROR_CHECK_ALLOC_ADD(&new_size, new_size, 1);
|
311
323
|
ENSURE_SIZE(buf, new_size);
|
312
324
|
|
313
325
|
for (i = 0; i < len; i += 4) {
|
@@ -318,7 +330,7 @@ int git_buf_decode_base64(git_buf *buf, const char *base64, size_t len)
|
|
318
330
|
buf->size = orig_size;
|
319
331
|
buf->ptr[buf->size] = '\0';
|
320
332
|
|
321
|
-
|
333
|
+
git_error_set(GIT_ERROR_INVALID, "invalid base64 input");
|
322
334
|
return -1;
|
323
335
|
}
|
324
336
|
|
@@ -338,9 +350,9 @@ int git_buf_encode_base85(git_buf *buf, const char *data, size_t len)
|
|
338
350
|
{
|
339
351
|
size_t blocks = (len / 4) + !!(len % 4), alloclen;
|
340
352
|
|
341
|
-
|
342
|
-
|
343
|
-
|
353
|
+
GIT_ERROR_CHECK_ALLOC_MULTIPLY(&alloclen, blocks, 5);
|
354
|
+
GIT_ERROR_CHECK_ALLOC_ADD(&alloclen, alloclen, buf->size);
|
355
|
+
GIT_ERROR_CHECK_ALLOC_ADD(&alloclen, alloclen, 1);
|
344
356
|
|
345
357
|
ENSURE_SIZE(buf, alloclen);
|
346
358
|
|
@@ -403,12 +415,12 @@ int git_buf_decode_base85(
|
|
403
415
|
|
404
416
|
if (base85_len % 5 ||
|
405
417
|
output_len > base85_len * 4 / 5) {
|
406
|
-
|
418
|
+
git_error_set(GIT_ERROR_INVALID, "invalid base85 input");
|
407
419
|
return -1;
|
408
420
|
}
|
409
421
|
|
410
|
-
|
411
|
-
|
422
|
+
GIT_ERROR_CHECK_ALLOC_ADD(&new_size, output_len, buf->size);
|
423
|
+
GIT_ERROR_CHECK_ALLOC_ADD(&new_size, new_size, 1);
|
412
424
|
ENSURE_SIZE(buf, new_size);
|
413
425
|
|
414
426
|
while (output_len) {
|
@@ -435,7 +447,7 @@ int git_buf_decode_base85(
|
|
435
447
|
|
436
448
|
acc += de;
|
437
449
|
|
438
|
-
cnt = (output_len < 4) ? output_len : 4;
|
450
|
+
cnt = (output_len < 4) ? (int)output_len : 4;
|
439
451
|
output_len -= cnt;
|
440
452
|
do {
|
441
453
|
acc = (acc << 8) | (acc >> 24);
|
@@ -451,7 +463,7 @@ on_error:
|
|
451
463
|
buf->size = orig_size;
|
452
464
|
buf->ptr[buf->size] = '\0';
|
453
465
|
|
454
|
-
|
466
|
+
git_error_set(GIT_ERROR_INVALID, "invalid base85 input");
|
455
467
|
return -1;
|
456
468
|
}
|
457
469
|
|
@@ -464,8 +476,8 @@ int git_buf_decode_percent(
|
|
464
476
|
{
|
465
477
|
size_t str_pos, new_size;
|
466
478
|
|
467
|
-
|
468
|
-
|
479
|
+
GIT_ERROR_CHECK_ALLOC_ADD(&new_size, buf->size, str_len);
|
480
|
+
GIT_ERROR_CHECK_ALLOC_ADD(&new_size, new_size, 1);
|
469
481
|
ENSURE_SIZE(buf, new_size);
|
470
482
|
|
471
483
|
for (str_pos = 0; str_pos < str_len; buf->size++, str_pos++) {
|
@@ -490,8 +502,8 @@ int git_buf_vprintf(git_buf *buf, const char *format, va_list ap)
|
|
490
502
|
size_t expected_size, new_size;
|
491
503
|
int len;
|
492
504
|
|
493
|
-
|
494
|
-
|
505
|
+
GIT_ERROR_CHECK_ALLOC_MULTIPLY(&expected_size, strlen(format), 2);
|
506
|
+
GIT_ERROR_CHECK_ALLOC_ADD(&expected_size, expected_size, buf->size);
|
495
507
|
ENSURE_SIZE(buf, expected_size);
|
496
508
|
|
497
509
|
while (1) {
|
@@ -517,8 +529,8 @@ int git_buf_vprintf(git_buf *buf, const char *format, va_list ap)
|
|
517
529
|
break;
|
518
530
|
}
|
519
531
|
|
520
|
-
|
521
|
-
|
532
|
+
GIT_ERROR_CHECK_ALLOC_ADD(&new_size, buf->size, len);
|
533
|
+
GIT_ERROR_CHECK_ALLOC_ADD(&new_size, new_size, 1);
|
522
534
|
ENSURE_SIZE(buf, new_size);
|
523
535
|
}
|
524
536
|
|
@@ -610,7 +622,7 @@ char *git_buf_detach(git_buf *buf)
|
|
610
622
|
|
611
623
|
int git_buf_attach(git_buf *buf, char *ptr, size_t asize)
|
612
624
|
{
|
613
|
-
|
625
|
+
git_buf_dispose(buf);
|
614
626
|
|
615
627
|
if (ptr) {
|
616
628
|
buf->ptr = ptr;
|
@@ -628,7 +640,7 @@ int git_buf_attach(git_buf *buf, char *ptr, size_t asize)
|
|
628
640
|
void git_buf_attach_notowned(git_buf *buf, const char *ptr, size_t size)
|
629
641
|
{
|
630
642
|
if (git_buf_is_allocated(buf))
|
631
|
-
|
643
|
+
git_buf_dispose(buf);
|
632
644
|
|
633
645
|
if (!size) {
|
634
646
|
git_buf_init(buf, 0);
|
@@ -662,10 +674,10 @@ int git_buf_join_n(git_buf *buf, char separator, int nbuf, ...)
|
|
662
674
|
|
663
675
|
segment_len = strlen(segment);
|
664
676
|
|
665
|
-
|
677
|
+
GIT_ERROR_CHECK_ALLOC_ADD(&total_size, total_size, segment_len);
|
666
678
|
|
667
679
|
if (segment_len == 0 || segment[segment_len - 1] != separator)
|
668
|
-
|
680
|
+
GIT_ERROR_CHECK_ALLOC_ADD(&total_size, total_size, 1);
|
669
681
|
}
|
670
682
|
va_end(ap);
|
671
683
|
|
@@ -673,7 +685,7 @@ int git_buf_join_n(git_buf *buf, char separator, int nbuf, ...)
|
|
673
685
|
if (total_size == 0)
|
674
686
|
return 0;
|
675
687
|
|
676
|
-
|
688
|
+
GIT_ERROR_CHECK_ALLOC_ADD(&total_size, total_size, 1);
|
677
689
|
if (git_buf_grow_by(buf, total_size) < 0)
|
678
690
|
return -1;
|
679
691
|
|
@@ -753,9 +765,9 @@ int git_buf_join(
|
|
753
765
|
if (str_a >= buf->ptr && str_a < buf->ptr + buf->size)
|
754
766
|
offset_a = str_a - buf->ptr;
|
755
767
|
|
756
|
-
|
757
|
-
|
758
|
-
|
768
|
+
GIT_ERROR_CHECK_ALLOC_ADD(&alloc_len, strlen_a, strlen_b);
|
769
|
+
GIT_ERROR_CHECK_ALLOC_ADD(&alloc_len, alloc_len, need_sep);
|
770
|
+
GIT_ERROR_CHECK_ALLOC_ADD(&alloc_len, alloc_len, 1);
|
759
771
|
ENSURE_SIZE(buf, alloc_len);
|
760
772
|
|
761
773
|
/* fix up internal pointers */
|
@@ -805,11 +817,11 @@ int git_buf_join3(
|
|
805
817
|
sep_b = (str_b[len_b - 1] != separator);
|
806
818
|
}
|
807
819
|
|
808
|
-
|
809
|
-
|
810
|
-
|
811
|
-
|
812
|
-
|
820
|
+
GIT_ERROR_CHECK_ALLOC_ADD(&len_total, len_a, sep_a);
|
821
|
+
GIT_ERROR_CHECK_ALLOC_ADD(&len_total, len_total, len_b);
|
822
|
+
GIT_ERROR_CHECK_ALLOC_ADD(&len_total, len_total, sep_b);
|
823
|
+
GIT_ERROR_CHECK_ALLOC_ADD(&len_total, len_total, len_c);
|
824
|
+
GIT_ERROR_CHECK_ALLOC_ADD(&len_total, len_total, 1);
|
813
825
|
ENSURE_SIZE(buf, len_total);
|
814
826
|
|
815
827
|
tgt = buf->ptr;
|
@@ -872,8 +884,8 @@ int git_buf_splice(
|
|
872
884
|
/* Ported from git.git
|
873
885
|
* https://github.com/git/git/blob/16eed7c/strbuf.c#L159-176
|
874
886
|
*/
|
875
|
-
|
876
|
-
|
887
|
+
GIT_ERROR_CHECK_ALLOC_ADD(&new_size, (buf->size - nb_to_remove), nb_to_insert);
|
888
|
+
GIT_ERROR_CHECK_ALLOC_ADD(&alloc_size, new_size, 1);
|
877
889
|
ENSURE_SIZE(buf, alloc_size);
|
878
890
|
|
879
891
|
memmove(splice_loc + nb_to_insert,
|
@@ -949,7 +961,7 @@ int git_buf_quote(git_buf *buf)
|
|
949
961
|
git_buf_swap("ed, buf);
|
950
962
|
|
951
963
|
done:
|
952
|
-
|
964
|
+
git_buf_dispose("ed);
|
953
965
|
return error;
|
954
966
|
}
|
955
967
|
|
@@ -990,14 +1002,14 @@ int git_buf_unquote(git_buf *buf)
|
|
990
1002
|
/* \xyz digits convert to the char*/
|
991
1003
|
case '0': case '1': case '2': case '3':
|
992
1004
|
if (j == buf->size-3) {
|
993
|
-
|
1005
|
+
git_error_set(GIT_ERROR_INVALID,
|
994
1006
|
"truncated quoted character \\%c", ch);
|
995
1007
|
return -1;
|
996
1008
|
}
|
997
1009
|
|
998
1010
|
if (buf->ptr[j+1] < '0' || buf->ptr[j+1] > '7' ||
|
999
1011
|
buf->ptr[j+2] < '0' || buf->ptr[j+2] > '7') {
|
1000
|
-
|
1012
|
+
git_error_set(GIT_ERROR_INVALID,
|
1001
1013
|
"truncated quoted character \\%c%c%c",
|
1002
1014
|
buf->ptr[j], buf->ptr[j+1], buf->ptr[j+2]);
|
1003
1015
|
return -1;
|
@@ -1010,7 +1022,7 @@ int git_buf_unquote(git_buf *buf)
|
|
1010
1022
|
break;
|
1011
1023
|
|
1012
1024
|
default:
|
1013
|
-
|
1025
|
+
git_error_set(GIT_ERROR_INVALID, "invalid quoted character \\%c", ch);
|
1014
1026
|
return -1;
|
1015
1027
|
}
|
1016
1028
|
}
|
@@ -1024,6 +1036,6 @@ int git_buf_unquote(git_buf *buf)
|
|
1024
1036
|
return 0;
|
1025
1037
|
|
1026
1038
|
invalid:
|
1027
|
-
|
1039
|
+
git_error_set(GIT_ERROR_INVALID, "invalid quoted line");
|
1028
1040
|
return -1;
|
1029
1041
|
}
|