rugged 1.1.1 → 1.4.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +1 -0
- data/README.md +1 -1
- data/ext/rugged/extconf.rb +2 -2
- data/ext/rugged/rugged.c +7 -4
- data/ext/rugged/rugged_config.c +7 -2
- data/ext/rugged/rugged_object.c +1 -1
- data/ext/rugged/rugged_remote.c +17 -0
- data/ext/rugged/rugged_repo.c +3 -3
- data/lib/rugged/repository.rb +2 -2
- data/lib/rugged/version.rb +1 -1
- data/vendor/libgit2/CMakeLists.txt +103 -271
- data/vendor/libgit2/COPYING +149 -24
- data/vendor/libgit2/cmake/AddCFlagIfSupported.cmake +21 -21
- data/vendor/libgit2/cmake/DefaultCFlags.cmake +154 -0
- data/vendor/libgit2/cmake/EnableWarnings.cmake +13 -13
- data/vendor/libgit2/cmake/FindCoreFoundation.cmake +13 -13
- data/vendor/libgit2/cmake/FindGSSAPI.cmake +171 -287
- data/vendor/libgit2/cmake/FindGSSFramework.cmake +13 -13
- data/vendor/libgit2/cmake/{FindHTTP_Parser.cmake → FindHTTPParser.cmake} +17 -17
- data/vendor/libgit2/cmake/FindIconv.cmake +27 -27
- data/vendor/libgit2/cmake/FindLibSSH2.cmake +13 -0
- data/vendor/libgit2/cmake/FindPCRE.cmake +13 -13
- data/vendor/libgit2/cmake/FindPCRE2.cmake +12 -12
- data/vendor/libgit2/cmake/FindPkgLibraries.cmake +19 -19
- data/vendor/libgit2/cmake/FindSecurity.cmake +14 -14
- data/vendor/libgit2/cmake/FindStatNsec.cmake +12 -18
- data/vendor/libgit2/cmake/Findfutimens.cmake +14 -0
- data/vendor/libgit2/cmake/FindmbedTLS.cmake +63 -70
- data/vendor/libgit2/cmake/IdeSplitSources.cmake +18 -18
- data/vendor/libgit2/cmake/PkgBuildConfig.cmake +60 -60
- data/vendor/libgit2/cmake/SanitizeBool.cmake +20 -20
- data/vendor/libgit2/cmake/SelectGSSAPI.cmake +37 -37
- data/vendor/libgit2/cmake/SelectHTTPParser.cmake +19 -0
- data/vendor/libgit2/cmake/SelectHTTPSBackend.cmake +100 -96
- data/vendor/libgit2/cmake/SelectHashes.cmake +39 -48
- data/vendor/libgit2/cmake/SelectRegex.cmake +51 -0
- data/vendor/libgit2/cmake/SelectSSH.cmake +41 -0
- data/vendor/libgit2/cmake/SelectWinHTTP.cmake +17 -0
- data/vendor/libgit2/cmake/SelectZlib.cmake +34 -0
- data/vendor/libgit2/deps/chromium-zlib/CMakeLists.txt +101 -0
- data/vendor/libgit2/deps/ntlmclient/CMakeLists.txt +32 -20
- data/vendor/libgit2/deps/ntlmclient/crypt.h +14 -9
- data/vendor/libgit2/deps/ntlmclient/crypt_commoncrypto.c +20 -20
- data/vendor/libgit2/deps/ntlmclient/crypt_commoncrypto.h +3 -3
- data/vendor/libgit2/deps/ntlmclient/crypt_mbedtls.c +37 -36
- data/vendor/libgit2/deps/ntlmclient/crypt_mbedtls.h +4 -3
- data/vendor/libgit2/deps/ntlmclient/crypt_openssl.c +178 -51
- data/vendor/libgit2/deps/ntlmclient/crypt_openssl.h +74 -5
- data/vendor/libgit2/deps/ntlmclient/ntlm.c +154 -122
- data/vendor/libgit2/deps/ntlmclient/ntlm.h +17 -13
- data/vendor/libgit2/deps/ntlmclient/ntlmclient.h +17 -4
- data/vendor/libgit2/deps/ntlmclient/unicode.h +10 -4
- data/vendor/libgit2/deps/ntlmclient/unicode_builtin.c +16 -27
- data/vendor/libgit2/deps/ntlmclient/unicode_builtin.h +20 -0
- data/vendor/libgit2/deps/ntlmclient/unicode_iconv.c +28 -52
- data/vendor/libgit2/deps/ntlmclient/unicode_iconv.h +22 -0
- data/vendor/libgit2/deps/pcre/CMakeLists.txt +88 -88
- data/vendor/libgit2/deps/winhttp/CMakeLists.txt +14 -16
- data/vendor/libgit2/include/git2/apply.h +16 -2
- data/vendor/libgit2/include/git2/attr.h +106 -2
- data/vendor/libgit2/include/git2/blame.h +97 -43
- data/vendor/libgit2/include/git2/blob.h +33 -2
- data/vendor/libgit2/include/git2/branch.h +27 -0
- data/vendor/libgit2/include/git2/buffer.h +18 -78
- data/vendor/libgit2/include/git2/cert.h +43 -6
- data/vendor/libgit2/include/git2/checkout.h +32 -13
- data/vendor/libgit2/include/git2/clone.h +4 -4
- data/vendor/libgit2/include/git2/commit.h +37 -19
- data/vendor/libgit2/include/git2/common.h +46 -5
- data/vendor/libgit2/include/git2/config.h +19 -3
- data/vendor/libgit2/include/git2/credential.h +2 -1
- data/vendor/libgit2/include/git2/credential_helpers.h +1 -0
- data/vendor/libgit2/include/git2/deprecated.h +326 -6
- data/vendor/libgit2/include/git2/describe.h +7 -2
- data/vendor/libgit2/include/git2/diff.h +50 -121
- data/vendor/libgit2/include/git2/email.h +127 -0
- data/vendor/libgit2/include/git2/errors.h +7 -6
- data/vendor/libgit2/include/git2/filter.h +69 -18
- data/vendor/libgit2/include/git2/graph.h +21 -2
- data/vendor/libgit2/include/git2/ignore.h +1 -1
- data/vendor/libgit2/include/git2/index.h +13 -7
- data/vendor/libgit2/include/git2/indexer.h +19 -0
- data/vendor/libgit2/include/git2/merge.h +23 -3
- data/vendor/libgit2/include/git2/message.h +2 -0
- data/vendor/libgit2/include/git2/notes.h +2 -2
- data/vendor/libgit2/include/git2/object.h +23 -0
- data/vendor/libgit2/include/git2/odb.h +65 -6
- data/vendor/libgit2/include/git2/odb_backend.h +1 -1
- data/vendor/libgit2/include/git2/oidarray.h +5 -8
- data/vendor/libgit2/include/git2/pack.h +24 -8
- data/vendor/libgit2/include/git2/patch.h +16 -0
- data/vendor/libgit2/include/git2/pathspec.h +1 -1
- data/vendor/libgit2/include/git2/proxy.h +1 -1
- data/vendor/libgit2/include/git2/rebase.h +34 -2
- data/vendor/libgit2/include/git2/refdb.h +3 -0
- data/vendor/libgit2/include/git2/reflog.h +1 -1
- data/vendor/libgit2/include/git2/refs.h +8 -4
- data/vendor/libgit2/include/git2/remote.h +246 -46
- data/vendor/libgit2/include/git2/repository.h +25 -18
- data/vendor/libgit2/include/git2/reset.h +2 -2
- data/vendor/libgit2/include/git2/revparse.h +5 -5
- data/vendor/libgit2/include/git2/revwalk.h +4 -1
- data/vendor/libgit2/include/git2/signature.h +1 -1
- data/vendor/libgit2/include/git2/stash.h +4 -4
- data/vendor/libgit2/include/git2/status.h +124 -62
- data/vendor/libgit2/include/git2/stdint.h +3 -3
- data/vendor/libgit2/include/git2/submodule.h +16 -2
- data/vendor/libgit2/include/git2/sys/commit_graph.h +174 -0
- data/vendor/libgit2/include/git2/sys/email.h +45 -0
- data/vendor/libgit2/include/git2/sys/filter.h +49 -28
- data/vendor/libgit2/include/git2/sys/midx.h +74 -0
- data/vendor/libgit2/include/git2/sys/odb_backend.h +9 -5
- data/vendor/libgit2/include/git2/sys/remote.h +31 -0
- data/vendor/libgit2/include/git2/sys/stream.h +1 -1
- data/vendor/libgit2/include/git2/sys/transport.h +26 -34
- data/vendor/libgit2/include/git2/tag.h +13 -0
- data/vendor/libgit2/include/git2/tree.h +4 -17
- data/vendor/libgit2/include/git2/types.h +16 -7
- data/vendor/libgit2/include/git2/version.h +4 -4
- data/vendor/libgit2/include/git2/worktree.h +13 -2
- data/vendor/libgit2/include/git2.h +1 -0
- data/vendor/libgit2/src/CMakeLists.txt +192 -290
- data/vendor/libgit2/src/alloc.c +21 -8
- data/vendor/libgit2/src/allocators/failalloc.c +92 -0
- data/vendor/libgit2/src/allocators/failalloc.h +23 -0
- data/vendor/libgit2/src/allocators/stdalloc.c +41 -10
- data/vendor/libgit2/src/allocators/win32_leakcheck.c +118 -0
- data/vendor/libgit2/src/allocators/{win32_crtdbg.h → win32_leakcheck.h} +3 -3
- data/vendor/libgit2/src/annotated_commit.c +21 -9
- data/vendor/libgit2/src/annotated_commit.h +1 -1
- data/vendor/libgit2/src/apply.c +34 -25
- data/vendor/libgit2/src/apply.h +2 -2
- data/vendor/libgit2/src/array.h +11 -11
- data/vendor/libgit2/src/attr.c +204 -82
- data/vendor/libgit2/src/attr_file.c +105 -52
- data/vendor/libgit2/src/attr_file.h +36 -15
- data/vendor/libgit2/src/attrcache.c +55 -45
- data/vendor/libgit2/src/attrcache.h +4 -5
- data/vendor/libgit2/src/blame.c +15 -9
- data/vendor/libgit2/src/blame_git.c +2 -2
- data/vendor/libgit2/src/blob.c +76 -52
- data/vendor/libgit2/src/blob.h +1 -1
- data/vendor/libgit2/src/branch.c +203 -110
- data/vendor/libgit2/src/branch.h +15 -3
- data/vendor/libgit2/src/buf.c +126 -0
- data/vendor/libgit2/src/buf.h +50 -0
- data/vendor/libgit2/src/cache.c +2 -2
- data/vendor/libgit2/src/cache.h +7 -7
- data/vendor/libgit2/src/cc-compat.h +11 -9
- data/vendor/libgit2/src/checkout.c +118 -91
- data/vendor/libgit2/src/cherrypick.c +16 -12
- data/vendor/libgit2/src/clone.c +97 -103
- data/vendor/libgit2/src/commit.c +167 -84
- data/vendor/libgit2/src/commit.h +24 -1
- data/vendor/libgit2/src/commit_graph.c +1224 -0
- data/vendor/libgit2/src/commit_graph.h +169 -0
- data/vendor/libgit2/src/commit_list.c +48 -3
- data/vendor/libgit2/src/commit_list.h +2 -0
- data/vendor/libgit2/src/common.h +35 -5
- data/vendor/libgit2/src/config.c +119 -64
- data/vendor/libgit2/src/config.h +15 -2
- data/vendor/libgit2/src/config_cache.c +5 -3
- data/vendor/libgit2/src/config_file.c +120 -100
- data/vendor/libgit2/src/config_mem.c +9 -9
- data/vendor/libgit2/src/config_parse.c +29 -27
- data/vendor/libgit2/src/crlf.c +36 -23
- data/vendor/libgit2/src/date.c +13 -19
- data/vendor/libgit2/src/date.h +33 -0
- data/vendor/libgit2/src/delta.c +1 -1
- data/vendor/libgit2/src/describe.c +32 -21
- data/vendor/libgit2/src/diff.c +71 -183
- data/vendor/libgit2/src/diff.h +2 -4
- data/vendor/libgit2/src/diff_driver.c +53 -51
- data/vendor/libgit2/src/diff_driver.h +3 -3
- data/vendor/libgit2/src/diff_file.c +31 -26
- data/vendor/libgit2/src/diff_generate.c +76 -23
- data/vendor/libgit2/src/diff_generate.h +5 -3
- data/vendor/libgit2/src/diff_print.c +120 -95
- data/vendor/libgit2/src/diff_stats.c +47 -34
- data/vendor/libgit2/src/{message.h → diff_stats.h} +7 -6
- data/vendor/libgit2/src/diff_tform.c +18 -16
- data/vendor/libgit2/src/diff_xdiff.c +7 -10
- data/vendor/libgit2/src/diff_xdiff.h +1 -1
- data/vendor/libgit2/src/email.c +315 -0
- data/vendor/libgit2/src/email.h +25 -0
- data/vendor/libgit2/src/errors.c +37 -32
- data/vendor/libgit2/src/features.h.in +11 -2
- data/vendor/libgit2/src/fetch.c +77 -26
- data/vendor/libgit2/src/fetch.h +1 -1
- data/vendor/libgit2/src/fetchhead.c +27 -23
- data/vendor/libgit2/src/filebuf.c +36 -34
- data/vendor/libgit2/src/filebuf.h +1 -1
- data/vendor/libgit2/src/filter.c +278 -132
- data/vendor/libgit2/src/filter.h +46 -6
- data/vendor/libgit2/src/fs_path.c +2071 -0
- data/vendor/libgit2/src/fs_path.h +772 -0
- data/vendor/libgit2/src/futils.c +96 -90
- data/vendor/libgit2/src/futils.h +27 -15
- data/vendor/libgit2/src/graph.c +64 -9
- data/vendor/libgit2/src/hash/sha1/collisiondetect.c +5 -5
- data/vendor/libgit2/src/hash/sha1/common_crypto.c +5 -5
- data/vendor/libgit2/src/hash/sha1/generic.c +2 -2
- data/vendor/libgit2/src/hash/sha1/generic.h +1 -1
- data/vendor/libgit2/src/hash/sha1/mbedtls.c +13 -13
- data/vendor/libgit2/src/hash/sha1/openssl.c +5 -5
- data/vendor/libgit2/src/hash/sha1/sha1dc/sha1.c +9 -11
- data/vendor/libgit2/src/hash/sha1/win32.c +21 -17
- data/vendor/libgit2/src/hash/sha1.h +3 -1
- data/vendor/libgit2/src/hash.c +71 -36
- data/vendor/libgit2/src/hash.h +13 -13
- data/vendor/libgit2/src/hashsig.c +23 -10
- data/vendor/libgit2/src/ident.c +30 -20
- data/vendor/libgit2/src/ignore.c +63 -46
- data/vendor/libgit2/src/ignore.h +2 -2
- data/vendor/libgit2/src/index.c +184 -149
- data/vendor/libgit2/src/index.h +7 -4
- data/vendor/libgit2/src/indexer.c +143 -89
- data/vendor/libgit2/src/integer.h +64 -2
- data/vendor/libgit2/src/iterator.c +93 -73
- data/vendor/libgit2/src/iterator.h +6 -6
- data/vendor/libgit2/src/khash.h +3 -12
- data/vendor/libgit2/src/{settings.c → libgit2.c} +165 -56
- data/vendor/libgit2/src/libgit2.h +15 -0
- data/vendor/libgit2/src/mailmap.c +60 -45
- data/vendor/libgit2/src/map.h +3 -3
- data/vendor/libgit2/src/merge.c +104 -61
- data/vendor/libgit2/src/merge.h +3 -15
- data/vendor/libgit2/src/merge_driver.c +21 -15
- data/vendor/libgit2/src/merge_file.c +24 -6
- data/vendor/libgit2/src/message.c +21 -8
- data/vendor/libgit2/src/midx.c +501 -18
- data/vendor/libgit2/src/midx.h +29 -2
- data/vendor/libgit2/src/mwindow.c +103 -59
- data/vendor/libgit2/src/mwindow.h +3 -3
- data/vendor/libgit2/src/net.c +405 -71
- data/vendor/libgit2/src/net.h +26 -5
- data/vendor/libgit2/src/netops.c +7 -5
- data/vendor/libgit2/src/netops.h +3 -3
- data/vendor/libgit2/src/notes.c +40 -49
- data/vendor/libgit2/src/object.c +68 -20
- data/vendor/libgit2/src/object.h +1 -1
- data/vendor/libgit2/src/odb.c +320 -80
- data/vendor/libgit2/src/odb.h +17 -3
- data/vendor/libgit2/src/odb_loose.c +96 -86
- data/vendor/libgit2/src/odb_mempack.c +19 -6
- data/vendor/libgit2/src/odb_pack.c +402 -125
- data/vendor/libgit2/src/oid.c +16 -8
- data/vendor/libgit2/src/oid.h +15 -0
- data/vendor/libgit2/src/oidarray.c +10 -1
- data/vendor/libgit2/src/pack-objects.c +90 -69
- data/vendor/libgit2/src/pack-objects.h +11 -6
- data/vendor/libgit2/src/pack.c +337 -127
- data/vendor/libgit2/src/pack.h +25 -7
- data/vendor/libgit2/src/patch.c +17 -10
- data/vendor/libgit2/src/patch.h +1 -0
- data/vendor/libgit2/src/patch_generate.c +29 -13
- data/vendor/libgit2/src/patch_generate.h +5 -5
- data/vendor/libgit2/src/patch_parse.c +26 -25
- data/vendor/libgit2/src/path.c +86 -1768
- data/vendor/libgit2/src/path.h +39 -635
- data/vendor/libgit2/src/pathspec.c +12 -12
- data/vendor/libgit2/src/pathspec.h +2 -2
- data/vendor/libgit2/src/pool.c +13 -7
- data/vendor/libgit2/src/posix.c +14 -6
- data/vendor/libgit2/src/posix.h +1 -0
- data/vendor/libgit2/src/pqueue.h +1 -1
- data/vendor/libgit2/src/proxy.c +4 -1
- data/vendor/libgit2/src/proxy.h +1 -1
- data/vendor/libgit2/src/push.c +30 -35
- data/vendor/libgit2/src/push.h +4 -16
- data/vendor/libgit2/src/rand.c +226 -0
- data/vendor/libgit2/src/rand.h +37 -0
- data/vendor/libgit2/src/reader.c +18 -14
- data/vendor/libgit2/src/reader.h +2 -2
- data/vendor/libgit2/src/rebase.c +177 -132
- data/vendor/libgit2/src/refdb.c +30 -13
- data/vendor/libgit2/src/refdb_fs.c +548 -222
- data/vendor/libgit2/src/reflog.c +19 -14
- data/vendor/libgit2/src/refs.c +107 -72
- data/vendor/libgit2/src/refs.h +2 -2
- data/vendor/libgit2/src/refspec.c +53 -38
- data/vendor/libgit2/src/refspec.h +5 -2
- data/vendor/libgit2/src/regexp.c +1 -1
- data/vendor/libgit2/src/remote.c +960 -486
- data/vendor/libgit2/src/remote.h +16 -10
- data/vendor/libgit2/src/repository.c +702 -422
- data/vendor/libgit2/src/repository.h +26 -8
- data/vendor/libgit2/src/reset.c +16 -12
- data/vendor/libgit2/src/revert.c +16 -12
- data/vendor/libgit2/src/revparse.c +66 -48
- data/vendor/libgit2/src/revwalk.c +39 -22
- data/vendor/libgit2/src/runtime.c +162 -0
- data/vendor/libgit2/src/runtime.h +62 -0
- data/vendor/libgit2/src/settings.h +11 -0
- data/vendor/libgit2/src/signature.c +18 -11
- data/vendor/libgit2/src/signature.h +1 -1
- data/vendor/libgit2/src/sortedcache.c +1 -1
- data/vendor/libgit2/src/sortedcache.h +10 -8
- data/vendor/libgit2/src/stash.c +39 -38
- data/vendor/libgit2/src/status.c +11 -5
- data/vendor/libgit2/src/{buffer.c → str.c} +459 -136
- data/vendor/libgit2/src/str.h +357 -0
- data/vendor/libgit2/src/strarray.c +2 -1
- data/vendor/libgit2/src/streams/mbedtls.c +22 -23
- data/vendor/libgit2/src/streams/mbedtls.h +1 -1
- data/vendor/libgit2/src/streams/openssl.c +101 -201
- data/vendor/libgit2/src/streams/openssl.h +9 -1
- data/vendor/libgit2/src/streams/openssl_dynamic.c +309 -0
- data/vendor/libgit2/src/streams/openssl_dynamic.h +348 -0
- data/vendor/libgit2/src/streams/openssl_legacy.c +203 -0
- data/vendor/libgit2/src/streams/openssl_legacy.h +63 -0
- data/vendor/libgit2/src/streams/registry.c +5 -6
- data/vendor/libgit2/src/streams/socket.c +6 -2
- data/vendor/libgit2/src/streams/stransport.c +6 -3
- data/vendor/libgit2/src/streams/tls.c +5 -3
- data/vendor/libgit2/src/submodule.c +290 -212
- data/vendor/libgit2/src/submodule.h +10 -10
- data/vendor/libgit2/src/sysdir.c +70 -56
- data/vendor/libgit2/src/sysdir.h +15 -10
- data/vendor/libgit2/src/tag.c +72 -34
- data/vendor/libgit2/src/thread.c +140 -0
- data/vendor/libgit2/src/thread.h +479 -0
- data/vendor/libgit2/src/threadstate.c +84 -0
- data/vendor/libgit2/src/threadstate.h +24 -0
- data/vendor/libgit2/src/trace.c +3 -16
- data/vendor/libgit2/src/trace.h +17 -30
- data/vendor/libgit2/src/trailer.c +2 -2
- data/vendor/libgit2/src/transaction.c +20 -9
- data/vendor/libgit2/src/transport.c +13 -13
- data/vendor/libgit2/src/transports/auth.c +8 -10
- data/vendor/libgit2/src/transports/auth.h +2 -3
- data/vendor/libgit2/src/transports/auth_negotiate.c +23 -17
- data/vendor/libgit2/src/transports/auth_ntlm.c +20 -16
- data/vendor/libgit2/src/transports/auth_ntlm.h +0 -1
- data/vendor/libgit2/src/transports/credential.c +15 -7
- data/vendor/libgit2/src/transports/git.c +10 -14
- data/vendor/libgit2/src/transports/http.c +56 -34
- data/vendor/libgit2/src/transports/http.h +3 -3
- data/vendor/libgit2/src/transports/httpclient.c +106 -79
- data/vendor/libgit2/src/transports/httpclient.h +1 -1
- data/vendor/libgit2/src/transports/local.c +127 -119
- data/vendor/libgit2/src/transports/smart.c +61 -144
- data/vendor/libgit2/src/transports/smart.h +26 -32
- data/vendor/libgit2/src/transports/smart_pkt.c +33 -33
- data/vendor/libgit2/src/transports/smart_protocol.c +68 -44
- data/vendor/libgit2/src/transports/ssh.c +100 -131
- data/vendor/libgit2/src/transports/winhttp.c +86 -82
- data/vendor/libgit2/src/tree-cache.c +5 -5
- data/vendor/libgit2/src/tree-cache.h +2 -2
- data/vendor/libgit2/src/tree.c +150 -116
- data/vendor/libgit2/src/tree.h +1 -0
- data/vendor/libgit2/src/tsort.c +0 -2
- data/vendor/libgit2/src/unix/map.c +3 -3
- data/vendor/libgit2/src/unix/posix.h +1 -4
- data/vendor/libgit2/src/unix/pthread.h +2 -1
- data/vendor/libgit2/src/unix/realpath.c +0 -2
- data/vendor/libgit2/src/utf8.c +150 -0
- data/vendor/libgit2/src/utf8.h +52 -0
- data/vendor/libgit2/src/util.c +68 -144
- data/vendor/libgit2/src/util.h +36 -68
- data/vendor/libgit2/src/vector.c +23 -19
- data/vendor/libgit2/src/vector.h +5 -3
- data/vendor/libgit2/src/win32/findfile.c +172 -114
- data/vendor/libgit2/src/win32/findfile.h +7 -4
- data/vendor/libgit2/src/win32/map.c +1 -1
- data/vendor/libgit2/src/win32/msvc-compat.h +9 -1
- data/vendor/libgit2/src/win32/path_w32.c +162 -33
- data/vendor/libgit2/src/win32/path_w32.h +2 -1
- data/vendor/libgit2/src/win32/posix.h +6 -7
- data/vendor/libgit2/src/win32/posix_w32.c +26 -33
- data/vendor/libgit2/src/win32/precompiled.h +0 -1
- data/vendor/libgit2/src/win32/reparse.h +4 -4
- data/vendor/libgit2/src/win32/thread.c +24 -15
- data/vendor/libgit2/src/win32/thread.h +1 -1
- data/vendor/libgit2/src/win32/w32_buffer.c +5 -6
- data/vendor/libgit2/src/win32/w32_buffer.h +2 -3
- data/vendor/libgit2/src/win32/w32_common.h +18 -9
- data/vendor/libgit2/src/win32/{w32_crtdbg_stacktrace.c → w32_leakcheck.c} +269 -33
- data/vendor/libgit2/src/win32/w32_leakcheck.h +222 -0
- data/vendor/libgit2/src/win32/w32_util.h +6 -6
- data/vendor/libgit2/src/worktree.c +138 -105
- data/vendor/libgit2/src/worktree.h +1 -1
- data/vendor/libgit2/src/xdiff/git-xdiff.h +53 -0
- data/vendor/libgit2/src/xdiff/xdiff.h +15 -15
- data/vendor/libgit2/src/xdiff/xdiffi.c +134 -108
- data/vendor/libgit2/src/xdiff/xemit.c +23 -7
- data/vendor/libgit2/src/xdiff/xhistogram.c +87 -78
- data/vendor/libgit2/src/xdiff/xinclude.h +1 -12
- data/vendor/libgit2/src/xdiff/xmerge.c +104 -117
- data/vendor/libgit2/src/xdiff/xpatience.c +6 -17
- data/vendor/libgit2/src/xdiff/xprepare.c +15 -20
- data/vendor/libgit2/src/xdiff/xutils.c +18 -7
- data/vendor/libgit2/src/zstream.c +6 -6
- data/vendor/libgit2/src/zstream.h +4 -4
- metadata +60 -24
- data/vendor/libgit2/src/allocators/win32_crtdbg.c +0 -118
- data/vendor/libgit2/src/buf_text.c +0 -316
- data/vendor/libgit2/src/buf_text.h +0 -122
- data/vendor/libgit2/src/buffer.h +0 -222
- data/vendor/libgit2/src/global.c +0 -363
- data/vendor/libgit2/src/global.h +0 -41
- data/vendor/libgit2/src/thread-utils.c +0 -58
- data/vendor/libgit2/src/thread-utils.h +0 -369
- data/vendor/libgit2/src/win32/w32_crtdbg_stacktrace.h +0 -127
- data/vendor/libgit2/src/win32/w32_stack.c +0 -188
- data/vendor/libgit2/src/win32/w32_stack.h +0 -140
data/vendor/libgit2/src/filter.c
CHANGED
@@ -7,24 +7,26 @@
|
|
7
7
|
|
8
8
|
#include "filter.h"
|
9
9
|
|
10
|
+
#include "buf.h"
|
10
11
|
#include "common.h"
|
11
12
|
#include "futils.h"
|
12
13
|
#include "hash.h"
|
13
14
|
#include "repository.h"
|
14
|
-
#include "
|
15
|
+
#include "runtime.h"
|
15
16
|
#include "git2/sys/filter.h"
|
16
17
|
#include "git2/config.h"
|
17
18
|
#include "blob.h"
|
18
19
|
#include "attr_file.h"
|
19
20
|
#include "array.h"
|
21
|
+
#include "path.h"
|
20
22
|
|
21
23
|
struct git_filter_source {
|
22
|
-
git_repository
|
23
|
-
const char
|
24
|
-
git_oid
|
25
|
-
uint16_t
|
26
|
-
git_filter_mode_t
|
27
|
-
|
24
|
+
git_repository *repo;
|
25
|
+
const char *path;
|
26
|
+
git_oid oid; /* zero if unknown (which is likely) */
|
27
|
+
uint16_t filemode; /* zero if unknown */
|
28
|
+
git_filter_mode_t mode;
|
29
|
+
git_filter_options options;
|
28
30
|
};
|
29
31
|
|
30
32
|
typedef struct {
|
@@ -36,7 +38,7 @@ typedef struct {
|
|
36
38
|
struct git_filter_list {
|
37
39
|
git_array_t(git_filter_entry) filters;
|
38
40
|
git_filter_source source;
|
39
|
-
|
41
|
+
git_str *temp_buf;
|
40
42
|
char path[GIT_FLEX_ARRAY];
|
41
43
|
};
|
42
44
|
|
@@ -68,7 +70,7 @@ static void git_filter_global_shutdown(void);
|
|
68
70
|
|
69
71
|
|
70
72
|
static int filter_def_scan_attrs(
|
71
|
-
|
73
|
+
git_str *attrs, size_t *nattr, size_t *nmatch, const char *attr_str)
|
72
74
|
{
|
73
75
|
const char *start, *scan = attr_str;
|
74
76
|
int has_eq;
|
@@ -92,9 +94,9 @@ static int filter_def_scan_attrs(
|
|
92
94
|
(*nmatch)++;
|
93
95
|
|
94
96
|
if (has_eq)
|
95
|
-
|
96
|
-
|
97
|
-
|
97
|
+
git_str_putc(attrs, '=');
|
98
|
+
git_str_put(attrs, start, scan - start);
|
99
|
+
git_str_putc(attrs, '\0');
|
98
100
|
}
|
99
101
|
}
|
100
102
|
|
@@ -152,7 +154,7 @@ static int filter_registry_insert(
|
|
152
154
|
{
|
153
155
|
git_filter_def *fdef;
|
154
156
|
size_t nattr = 0, nmatch = 0, alloc_len;
|
155
|
-
|
157
|
+
git_str attrs = GIT_STR_INIT;
|
156
158
|
|
157
159
|
if (filter_def_scan_attrs(&attrs, &nattr, &nmatch, filter->attributes) < 0)
|
158
160
|
return -1;
|
@@ -171,7 +173,7 @@ static int filter_registry_insert(
|
|
171
173
|
fdef->priority = priority;
|
172
174
|
fdef->nattrs = nattr;
|
173
175
|
fdef->nmatches = nmatch;
|
174
|
-
fdef->attrdata =
|
176
|
+
fdef->attrdata = git_str_detach(&attrs);
|
175
177
|
|
176
178
|
filter_def_set_attrs(fdef);
|
177
179
|
|
@@ -206,7 +208,8 @@ int git_filter_global_init(void)
|
|
206
208
|
GIT_FILTER_IDENT, ident, GIT_FILTER_IDENT_PRIORITY) < 0)
|
207
209
|
error = -1;
|
208
210
|
|
209
|
-
|
211
|
+
if (!error)
|
212
|
+
error = git_runtime_shutdown_register(git_filter_global_shutdown);
|
210
213
|
|
211
214
|
done:
|
212
215
|
if (error) {
|
@@ -266,7 +269,8 @@ int git_filter_register(
|
|
266
269
|
{
|
267
270
|
int error;
|
268
271
|
|
269
|
-
|
272
|
+
GIT_ASSERT_ARG(name);
|
273
|
+
GIT_ASSERT_ARG(filter);
|
270
274
|
|
271
275
|
if (git_rwlock_wrlock(&filter_registry.lock) < 0) {
|
272
276
|
git_error_set(GIT_ERROR_OS, "failed to lock filter registry");
|
@@ -293,7 +297,7 @@ int git_filter_unregister(const char *name)
|
|
293
297
|
git_filter_def *fdef;
|
294
298
|
int error = 0;
|
295
299
|
|
296
|
-
|
300
|
+
GIT_ASSERT_ARG(name);
|
297
301
|
|
298
302
|
/* cannot unregister default filters */
|
299
303
|
if (!strcmp(GIT_FILTER_CRLF, name) || !strcmp(GIT_FILTER_IDENT, name)) {
|
@@ -395,7 +399,7 @@ git_filter_mode_t git_filter_source_mode(const git_filter_source *src)
|
|
395
399
|
|
396
400
|
uint32_t git_filter_source_flags(const git_filter_source *src)
|
397
401
|
{
|
398
|
-
return src->flags;
|
402
|
+
return src->options.flags;
|
399
403
|
}
|
400
404
|
|
401
405
|
static int filter_list_new(
|
@@ -415,7 +419,8 @@ static int filter_list_new(
|
|
415
419
|
fl->source.repo = src->repo;
|
416
420
|
fl->source.path = fl->path;
|
417
421
|
fl->source.mode = src->mode;
|
418
|
-
|
422
|
+
|
423
|
+
memcpy(&fl->source.options, &src->options, sizeof(git_filter_options));
|
419
424
|
|
420
425
|
*out = fl;
|
421
426
|
return 0;
|
@@ -424,25 +429,36 @@ static int filter_list_new(
|
|
424
429
|
static int filter_list_check_attributes(
|
425
430
|
const char ***out,
|
426
431
|
git_repository *repo,
|
427
|
-
|
432
|
+
git_filter_session *filter_session,
|
428
433
|
git_filter_def *fdef,
|
429
434
|
const git_filter_source *src)
|
430
435
|
{
|
431
436
|
const char **strs = git__calloc(fdef->nattrs, sizeof(const char *));
|
432
|
-
|
437
|
+
git_attr_options attr_opts = GIT_ATTR_OPTIONS_INIT;
|
433
438
|
size_t i;
|
434
439
|
int error;
|
435
440
|
|
436
441
|
GIT_ERROR_CHECK_ALLOC(strs);
|
437
442
|
|
438
|
-
if ((src->flags & GIT_FILTER_NO_SYSTEM_ATTRIBUTES) != 0)
|
439
|
-
flags |= GIT_ATTR_CHECK_NO_SYSTEM;
|
443
|
+
if ((src->options.flags & GIT_FILTER_NO_SYSTEM_ATTRIBUTES) != 0)
|
444
|
+
attr_opts.flags |= GIT_ATTR_CHECK_NO_SYSTEM;
|
445
|
+
|
446
|
+
if ((src->options.flags & GIT_FILTER_ATTRIBUTES_FROM_HEAD) != 0)
|
447
|
+
attr_opts.flags |= GIT_ATTR_CHECK_INCLUDE_HEAD;
|
448
|
+
|
449
|
+
if ((src->options.flags & GIT_FILTER_ATTRIBUTES_FROM_COMMIT) != 0) {
|
450
|
+
attr_opts.flags |= GIT_ATTR_CHECK_INCLUDE_COMMIT;
|
440
451
|
|
441
|
-
|
442
|
-
|
452
|
+
#ifndef GIT_DEPRECATE_HARD
|
453
|
+
if (src->options.commit_id)
|
454
|
+
git_oid_cpy(&attr_opts.attr_commit_id, src->options.commit_id);
|
455
|
+
else
|
456
|
+
#endif
|
457
|
+
git_oid_cpy(&attr_opts.attr_commit_id, &src->options.attr_commit_id);
|
458
|
+
}
|
443
459
|
|
444
460
|
error = git_attr_get_many_with_session(
|
445
|
-
strs, repo, attr_session,
|
461
|
+
strs, repo, filter_session->attr_session, &attr_opts, src->path, fdef->nattrs, fdef->attrs);
|
446
462
|
|
447
463
|
/* if no values were found but no matches are needed, it's okay! */
|
448
464
|
if (error == GIT_ENOTFOUND && !fdef->nmatches) {
|
@@ -487,17 +503,17 @@ int git_filter_list_new(
|
|
487
503
|
src.repo = repo;
|
488
504
|
src.path = NULL;
|
489
505
|
src.mode = mode;
|
490
|
-
src.flags = flags;
|
506
|
+
src.options.flags = flags;
|
491
507
|
return filter_list_new(out, &src);
|
492
508
|
}
|
493
509
|
|
494
|
-
int
|
510
|
+
int git_filter_list__load(
|
495
511
|
git_filter_list **filters,
|
496
512
|
git_repository *repo,
|
497
513
|
git_blob *blob, /* can be NULL */
|
498
514
|
const char *path,
|
499
515
|
git_filter_mode_t mode,
|
500
|
-
|
516
|
+
git_filter_session *filter_session)
|
501
517
|
{
|
502
518
|
int error = 0;
|
503
519
|
git_filter_list *fl = NULL;
|
@@ -514,7 +530,8 @@ int git_filter_list__load_ext(
|
|
514
530
|
src.repo = repo;
|
515
531
|
src.path = path;
|
516
532
|
src.mode = mode;
|
517
|
-
|
533
|
+
|
534
|
+
memcpy(&src.options, &filter_session->options, sizeof(git_filter_options));
|
518
535
|
|
519
536
|
if (blob)
|
520
537
|
git_oid_cpy(&src.oid, git_blob_id(blob));
|
@@ -528,7 +545,8 @@ int git_filter_list__load_ext(
|
|
528
545
|
|
529
546
|
if (fdef->nattrs > 0) {
|
530
547
|
error = filter_list_check_attributes(
|
531
|
-
&values, repo,
|
548
|
+
&values, repo,
|
549
|
+
filter_session, fdef, &src);
|
532
550
|
|
533
551
|
if (error == GIT_ENOTFOUND) {
|
534
552
|
error = 0;
|
@@ -555,7 +573,7 @@ int git_filter_list__load_ext(
|
|
555
573
|
if ((error = filter_list_new(&fl, &src)) < 0)
|
556
574
|
break;
|
557
575
|
|
558
|
-
fl->temp_buf =
|
576
|
+
fl->temp_buf = filter_session->temp_buf;
|
559
577
|
}
|
560
578
|
|
561
579
|
fe = git_array_alloc(fl->filters);
|
@@ -579,6 +597,23 @@ int git_filter_list__load_ext(
|
|
579
597
|
return error;
|
580
598
|
}
|
581
599
|
|
600
|
+
int git_filter_list_load_ext(
|
601
|
+
git_filter_list **filters,
|
602
|
+
git_repository *repo,
|
603
|
+
git_blob *blob, /* can be NULL */
|
604
|
+
const char *path,
|
605
|
+
git_filter_mode_t mode,
|
606
|
+
git_filter_options *opts)
|
607
|
+
{
|
608
|
+
git_filter_session filter_session = GIT_FILTER_SESSION_INIT;
|
609
|
+
|
610
|
+
if (opts)
|
611
|
+
memcpy(&filter_session.options, opts, sizeof(git_filter_options));
|
612
|
+
|
613
|
+
return git_filter_list__load(
|
614
|
+
filters, repo, blob, path, mode, &filter_session);
|
615
|
+
}
|
616
|
+
|
582
617
|
int git_filter_list_load(
|
583
618
|
git_filter_list **filters,
|
584
619
|
git_repository *repo,
|
@@ -587,12 +622,12 @@ int git_filter_list_load(
|
|
587
622
|
git_filter_mode_t mode,
|
588
623
|
uint32_t flags)
|
589
624
|
{
|
590
|
-
|
625
|
+
git_filter_session filter_session = GIT_FILTER_SESSION_INIT;
|
591
626
|
|
592
|
-
|
627
|
+
filter_session.options.flags = flags;
|
593
628
|
|
594
|
-
return
|
595
|
-
filters, repo, blob, path, mode, &
|
629
|
+
return git_filter_list__load(
|
630
|
+
filters, repo, blob, path, mode, &filter_session);
|
596
631
|
}
|
597
632
|
|
598
633
|
void git_filter_list_free(git_filter_list *fl)
|
@@ -618,7 +653,7 @@ int git_filter_list_contains(
|
|
618
653
|
{
|
619
654
|
size_t i;
|
620
655
|
|
621
|
-
|
656
|
+
GIT_ASSERT_ARG(name);
|
622
657
|
|
623
658
|
if (!fl)
|
624
659
|
return 0;
|
@@ -639,7 +674,8 @@ int git_filter_list_push(
|
|
639
674
|
git_filter_def *fdef = NULL;
|
640
675
|
git_filter_entry *fe;
|
641
676
|
|
642
|
-
|
677
|
+
GIT_ASSERT_ARG(fl);
|
678
|
+
GIT_ASSERT_ARG(filter);
|
643
679
|
|
644
680
|
if (git_rwlock_rdlock(&filter_registry.lock) < 0) {
|
645
681
|
git_error_set(GIT_ERROR_OS, "failed to lock filter registry");
|
@@ -676,7 +712,7 @@ size_t git_filter_list_length(const git_filter_list *fl)
|
|
676
712
|
|
677
713
|
struct buf_stream {
|
678
714
|
git_writestream parent;
|
679
|
-
|
715
|
+
git_str *target;
|
680
716
|
bool complete;
|
681
717
|
};
|
682
718
|
|
@@ -684,19 +720,18 @@ static int buf_stream_write(
|
|
684
720
|
git_writestream *s, const char *buffer, size_t len)
|
685
721
|
{
|
686
722
|
struct buf_stream *buf_stream = (struct buf_stream *)s;
|
687
|
-
|
688
|
-
|
689
|
-
assert(buf_stream->complete == 0);
|
723
|
+
GIT_ASSERT_ARG(buf_stream);
|
724
|
+
GIT_ASSERT(buf_stream->complete == 0);
|
690
725
|
|
691
|
-
return
|
726
|
+
return git_str_put(buf_stream->target, buffer, len);
|
692
727
|
}
|
693
728
|
|
694
729
|
static int buf_stream_close(git_writestream *s)
|
695
730
|
{
|
696
731
|
struct buf_stream *buf_stream = (struct buf_stream *)s;
|
697
|
-
|
732
|
+
GIT_ASSERT_ARG(buf_stream);
|
698
733
|
|
699
|
-
|
734
|
+
GIT_ASSERT(buf_stream->complete == 0);
|
700
735
|
buf_stream->complete = 1;
|
701
736
|
|
702
737
|
return 0;
|
@@ -707,7 +742,7 @@ static void buf_stream_free(git_writestream *s)
|
|
707
742
|
GIT_UNUSED(s);
|
708
743
|
}
|
709
744
|
|
710
|
-
static void buf_stream_init(struct buf_stream *writer,
|
745
|
+
static void buf_stream_init(struct buf_stream *writer, git_str *target)
|
711
746
|
{
|
712
747
|
memset(writer, 0, sizeof(struct buf_stream));
|
713
748
|
|
@@ -716,30 +751,56 @@ static void buf_stream_init(struct buf_stream *writer, git_buf *target)
|
|
716
751
|
writer->parent.free = buf_stream_free;
|
717
752
|
writer->target = target;
|
718
753
|
|
719
|
-
|
754
|
+
git_str_clear(target);
|
720
755
|
}
|
721
756
|
|
722
|
-
int
|
723
|
-
git_buf *
|
757
|
+
int git_filter_list_apply_to_buffer(
|
758
|
+
git_buf *out,
|
759
|
+
git_filter_list *filters,
|
760
|
+
const char *in,
|
761
|
+
size_t in_len)
|
762
|
+
{
|
763
|
+
GIT_BUF_WRAP_PRIVATE(out, git_filter_list__apply_to_buffer, filters, in, in_len);
|
764
|
+
}
|
765
|
+
|
766
|
+
int git_filter_list__apply_to_buffer(
|
767
|
+
git_str *out,
|
768
|
+
git_filter_list *filters,
|
769
|
+
const char *in,
|
770
|
+
size_t in_len)
|
724
771
|
{
|
725
772
|
struct buf_stream writer;
|
726
773
|
int error;
|
727
774
|
|
728
|
-
|
729
|
-
|
775
|
+
buf_stream_init(&writer, out);
|
776
|
+
|
777
|
+
if ((error = git_filter_list_stream_buffer(filters,
|
778
|
+
in, in_len, &writer.parent)) < 0)
|
779
|
+
return error;
|
730
780
|
|
731
|
-
|
732
|
-
|
781
|
+
GIT_ASSERT(writer.complete);
|
782
|
+
return error;
|
783
|
+
}
|
784
|
+
|
785
|
+
int git_filter_list__convert_buf(
|
786
|
+
git_str *out,
|
787
|
+
git_filter_list *filters,
|
788
|
+
git_str *in)
|
789
|
+
{
|
790
|
+
int error;
|
791
|
+
|
792
|
+
if (!filters || git_filter_list_length(filters) == 0) {
|
793
|
+
git_str_swap(out, in);
|
794
|
+
git_str_dispose(in);
|
733
795
|
return 0;
|
734
796
|
}
|
735
797
|
|
736
|
-
|
798
|
+
error = git_filter_list__apply_to_buffer(out, filters,
|
799
|
+
in->ptr, in->size);
|
737
800
|
|
738
|
-
if (
|
739
|
-
|
740
|
-
return error;
|
801
|
+
if (!error)
|
802
|
+
git_str_dispose(in);
|
741
803
|
|
742
|
-
assert(writer.complete);
|
743
804
|
return error;
|
744
805
|
}
|
745
806
|
|
@@ -748,6 +809,15 @@ int git_filter_list_apply_to_file(
|
|
748
809
|
git_filter_list *filters,
|
749
810
|
git_repository *repo,
|
750
811
|
const char *path)
|
812
|
+
{
|
813
|
+
GIT_BUF_WRAP_PRIVATE(out, git_filter_list__apply_to_file, filters, repo, path);
|
814
|
+
}
|
815
|
+
|
816
|
+
int git_filter_list__apply_to_file(
|
817
|
+
git_str *out,
|
818
|
+
git_filter_list *filters,
|
819
|
+
git_repository *repo,
|
820
|
+
const char *path)
|
751
821
|
{
|
752
822
|
struct buf_stream writer;
|
753
823
|
int error;
|
@@ -758,11 +828,11 @@ int git_filter_list_apply_to_file(
|
|
758
828
|
filters, repo, path, &writer.parent)) < 0)
|
759
829
|
return error;
|
760
830
|
|
761
|
-
|
831
|
+
GIT_ASSERT(writer.complete);
|
762
832
|
return error;
|
763
833
|
}
|
764
834
|
|
765
|
-
static int buf_from_blob(
|
835
|
+
static int buf_from_blob(git_str *out, git_blob *blob)
|
766
836
|
{
|
767
837
|
git_object_size_t rawsize = git_blob_rawsize(blob);
|
768
838
|
|
@@ -771,7 +841,7 @@ static int buf_from_blob(git_buf *out, git_blob *blob)
|
|
771
841
|
return -1;
|
772
842
|
}
|
773
843
|
|
774
|
-
|
844
|
+
git_str_attach_notowned(out, git_blob_rawcontent(blob), (size_t)rawsize);
|
775
845
|
return 0;
|
776
846
|
}
|
777
847
|
|
@@ -779,6 +849,14 @@ int git_filter_list_apply_to_blob(
|
|
779
849
|
git_buf *out,
|
780
850
|
git_filter_list *filters,
|
781
851
|
git_blob *blob)
|
852
|
+
{
|
853
|
+
GIT_BUF_WRAP_PRIVATE(out, git_filter_list__apply_to_blob, filters, blob);
|
854
|
+
}
|
855
|
+
|
856
|
+
int git_filter_list__apply_to_blob(
|
857
|
+
git_str *out,
|
858
|
+
git_filter_list *filters,
|
859
|
+
git_blob *blob)
|
782
860
|
{
|
783
861
|
struct buf_stream writer;
|
784
862
|
int error;
|
@@ -789,103 +867,164 @@ int git_filter_list_apply_to_blob(
|
|
789
867
|
filters, blob, &writer.parent)) < 0)
|
790
868
|
return error;
|
791
869
|
|
792
|
-
|
870
|
+
GIT_ASSERT(writer.complete);
|
793
871
|
return error;
|
794
872
|
}
|
795
873
|
|
796
|
-
struct
|
874
|
+
struct buffered_stream {
|
797
875
|
git_writestream parent;
|
798
876
|
git_filter *filter;
|
877
|
+
int (*write_fn)(git_filter *, void **, git_str *, const git_str *, const git_filter_source *);
|
878
|
+
int (*legacy_write_fn)(git_filter *, void **, git_buf *, const git_buf *, const git_filter_source *);
|
799
879
|
const git_filter_source *source;
|
800
880
|
void **payload;
|
801
|
-
|
802
|
-
|
803
|
-
|
881
|
+
git_str input;
|
882
|
+
git_str temp_buf;
|
883
|
+
git_str *output;
|
804
884
|
git_writestream *target;
|
805
885
|
};
|
806
886
|
|
807
|
-
static int
|
887
|
+
static int buffered_stream_write(
|
808
888
|
git_writestream *s, const char *buffer, size_t len)
|
809
889
|
{
|
810
|
-
struct
|
811
|
-
|
890
|
+
struct buffered_stream *buffered_stream = (struct buffered_stream *)s;
|
891
|
+
GIT_ASSERT_ARG(buffered_stream);
|
812
892
|
|
813
|
-
return
|
893
|
+
return git_str_put(&buffered_stream->input, buffer, len);
|
814
894
|
}
|
815
895
|
|
816
|
-
static int
|
896
|
+
static int buffered_stream_close(git_writestream *s)
|
817
897
|
{
|
818
|
-
struct
|
819
|
-
|
898
|
+
struct buffered_stream *buffered_stream = (struct buffered_stream *)s;
|
899
|
+
git_str *writebuf;
|
820
900
|
git_error_state error_state = {0};
|
821
901
|
int error;
|
822
902
|
|
823
|
-
|
903
|
+
GIT_ASSERT_ARG(buffered_stream);
|
824
904
|
|
825
|
-
error =
|
826
|
-
|
827
|
-
|
828
|
-
|
829
|
-
&
|
830
|
-
|
905
|
+
error = buffered_stream->write_fn(
|
906
|
+
buffered_stream->filter,
|
907
|
+
buffered_stream->payload,
|
908
|
+
buffered_stream->output,
|
909
|
+
&buffered_stream->input,
|
910
|
+
buffered_stream->source);
|
831
911
|
|
832
912
|
if (error == GIT_PASSTHROUGH) {
|
833
|
-
writebuf = &
|
913
|
+
writebuf = &buffered_stream->input;
|
834
914
|
} else if (error == 0) {
|
835
|
-
|
836
|
-
writebuf = proxy_stream->output;
|
915
|
+
writebuf = buffered_stream->output;
|
837
916
|
} else {
|
838
917
|
/* close stream before erroring out taking care
|
839
918
|
* to preserve the original error */
|
840
919
|
git_error_state_capture(&error_state, error);
|
841
|
-
|
920
|
+
buffered_stream->target->close(buffered_stream->target);
|
842
921
|
git_error_state_restore(&error_state);
|
843
922
|
return error;
|
844
923
|
}
|
845
924
|
|
846
|
-
if ((error =
|
847
|
-
|
848
|
-
error =
|
925
|
+
if ((error = buffered_stream->target->write(
|
926
|
+
buffered_stream->target, writebuf->ptr, writebuf->size)) == 0)
|
927
|
+
error = buffered_stream->target->close(buffered_stream->target);
|
849
928
|
|
850
929
|
return error;
|
851
930
|
}
|
852
931
|
|
853
|
-
static void
|
932
|
+
static void buffered_stream_free(git_writestream *s)
|
933
|
+
{
|
934
|
+
struct buffered_stream *buffered_stream = (struct buffered_stream *)s;
|
935
|
+
|
936
|
+
if (buffered_stream) {
|
937
|
+
git_str_dispose(&buffered_stream->input);
|
938
|
+
git_str_dispose(&buffered_stream->temp_buf);
|
939
|
+
git__free(buffered_stream);
|
940
|
+
}
|
941
|
+
}
|
942
|
+
|
943
|
+
int git_filter_buffered_stream_new(
|
944
|
+
git_writestream **out,
|
945
|
+
git_filter *filter,
|
946
|
+
int (*write_fn)(git_filter *, void **, git_str *, const git_str *, const git_filter_source *),
|
947
|
+
git_str *temp_buf,
|
948
|
+
void **payload,
|
949
|
+
const git_filter_source *source,
|
950
|
+
git_writestream *target)
|
854
951
|
{
|
855
|
-
struct
|
856
|
-
|
952
|
+
struct buffered_stream *buffered_stream = git__calloc(1, sizeof(struct buffered_stream));
|
953
|
+
GIT_ERROR_CHECK_ALLOC(buffered_stream);
|
954
|
+
|
955
|
+
buffered_stream->parent.write = buffered_stream_write;
|
956
|
+
buffered_stream->parent.close = buffered_stream_close;
|
957
|
+
buffered_stream->parent.free = buffered_stream_free;
|
958
|
+
buffered_stream->filter = filter;
|
959
|
+
buffered_stream->write_fn = write_fn;
|
960
|
+
buffered_stream->output = temp_buf ? temp_buf : &buffered_stream->temp_buf;
|
961
|
+
buffered_stream->payload = payload;
|
962
|
+
buffered_stream->source = source;
|
963
|
+
buffered_stream->target = target;
|
964
|
+
|
965
|
+
if (temp_buf)
|
966
|
+
git_str_clear(temp_buf);
|
857
967
|
|
858
|
-
|
859
|
-
|
860
|
-
git__free(proxy_stream);
|
968
|
+
*out = (git_writestream *)buffered_stream;
|
969
|
+
return 0;
|
861
970
|
}
|
862
971
|
|
863
|
-
|
972
|
+
#ifndef GIT_DEPRECATE_HARD
|
973
|
+
static int buffered_legacy_stream_new(
|
864
974
|
git_writestream **out,
|
865
975
|
git_filter *filter,
|
866
|
-
git_buf *
|
976
|
+
int (*legacy_write_fn)(git_filter *, void **, git_buf *, const git_buf *, const git_filter_source *),
|
977
|
+
git_str *temp_buf,
|
867
978
|
void **payload,
|
868
979
|
const git_filter_source *source,
|
869
980
|
git_writestream *target)
|
870
981
|
{
|
871
|
-
struct
|
872
|
-
GIT_ERROR_CHECK_ALLOC(
|
873
|
-
|
874
|
-
|
875
|
-
|
876
|
-
|
877
|
-
|
878
|
-
|
879
|
-
|
880
|
-
|
881
|
-
|
982
|
+
struct buffered_stream *buffered_stream = git__calloc(1, sizeof(struct buffered_stream));
|
983
|
+
GIT_ERROR_CHECK_ALLOC(buffered_stream);
|
984
|
+
|
985
|
+
buffered_stream->parent.write = buffered_stream_write;
|
986
|
+
buffered_stream->parent.close = buffered_stream_close;
|
987
|
+
buffered_stream->parent.free = buffered_stream_free;
|
988
|
+
buffered_stream->filter = filter;
|
989
|
+
buffered_stream->legacy_write_fn = legacy_write_fn;
|
990
|
+
buffered_stream->output = temp_buf ? temp_buf : &buffered_stream->temp_buf;
|
991
|
+
buffered_stream->payload = payload;
|
992
|
+
buffered_stream->source = source;
|
993
|
+
buffered_stream->target = target;
|
882
994
|
|
883
995
|
if (temp_buf)
|
884
|
-
|
996
|
+
git_str_clear(temp_buf);
|
885
997
|
|
886
|
-
*out = (git_writestream *)
|
998
|
+
*out = (git_writestream *)buffered_stream;
|
887
999
|
return 0;
|
888
1000
|
}
|
1001
|
+
#endif
|
1002
|
+
|
1003
|
+
static int setup_stream(
|
1004
|
+
git_writestream **out,
|
1005
|
+
git_filter_entry *fe,
|
1006
|
+
git_filter_list *filters,
|
1007
|
+
git_writestream *last_stream)
|
1008
|
+
{
|
1009
|
+
#ifndef GIT_DEPRECATE_HARD
|
1010
|
+
GIT_ASSERT(fe->filter->stream || fe->filter->apply);
|
1011
|
+
|
1012
|
+
/*
|
1013
|
+
* If necessary, create a stream that proxies the traditional
|
1014
|
+
* application.
|
1015
|
+
*/
|
1016
|
+
if (!fe->filter->stream) {
|
1017
|
+
/* Create a stream that proxies the one-shot apply */
|
1018
|
+
return buffered_legacy_stream_new(out,
|
1019
|
+
fe->filter, fe->filter->apply, filters->temp_buf,
|
1020
|
+
&fe->payload, &filters->source, last_stream);
|
1021
|
+
}
|
1022
|
+
#endif
|
1023
|
+
|
1024
|
+
GIT_ASSERT(fe->filter->stream);
|
1025
|
+
return fe->filter->stream(out, fe->filter,
|
1026
|
+
&fe->payload, &filters->source, last_stream);
|
1027
|
+
}
|
889
1028
|
|
890
1029
|
static int stream_list_init(
|
891
1030
|
git_writestream **out,
|
@@ -908,22 +1047,11 @@ static int stream_list_init(
|
|
908
1047
|
for (i = 0; i < git_array_size(filters->filters); ++i) {
|
909
1048
|
size_t filter_idx = (filters->source.mode == GIT_FILTER_TO_WORKTREE) ?
|
910
1049
|
git_array_size(filters->filters) - 1 - i : i;
|
1050
|
+
|
911
1051
|
git_filter_entry *fe = git_array_get(filters->filters, filter_idx);
|
912
1052
|
git_writestream *filter_stream;
|
913
1053
|
|
914
|
-
|
915
|
-
|
916
|
-
/* If necessary, create a stream that proxies the traditional
|
917
|
-
* application.
|
918
|
-
*/
|
919
|
-
if (fe->filter->stream)
|
920
|
-
error = fe->filter->stream(&filter_stream, fe->filter,
|
921
|
-
&fe->payload, &filters->source, last_stream);
|
922
|
-
else
|
923
|
-
/* Create a stream that proxies the one-shot apply */
|
924
|
-
error = proxy_stream_init(&filter_stream, fe->filter,
|
925
|
-
filters->temp_buf, &fe->payload, &filters->source,
|
926
|
-
last_stream);
|
1054
|
+
error = setup_stream(&filter_stream, fe, filters, last_stream);
|
927
1055
|
|
928
1056
|
if (error < 0)
|
929
1057
|
goto out;
|
@@ -958,7 +1086,7 @@ int git_filter_list_stream_file(
|
|
958
1086
|
git_writestream *target)
|
959
1087
|
{
|
960
1088
|
char buf[FILTERIO_BUFSIZE];
|
961
|
-
|
1089
|
+
git_str abspath = GIT_STR_INIT;
|
962
1090
|
const char *base = repo ? git_repository_workdir(repo) : NULL;
|
963
1091
|
git_vector filter_streams = GIT_VECTOR_INIT;
|
964
1092
|
git_writestream *stream_start;
|
@@ -967,8 +1095,10 @@ int git_filter_list_stream_file(
|
|
967
1095
|
|
968
1096
|
if ((error = stream_list_init(
|
969
1097
|
&stream_start, &filter_streams, filters, target)) < 0 ||
|
970
|
-
|
1098
|
+
(error = git_fs_path_join_unrooted(&abspath, path, base, NULL)) < 0 ||
|
1099
|
+
(error = git_path_validate_str_length(repo, &abspath)) < 0)
|
971
1100
|
goto done;
|
1101
|
+
|
972
1102
|
initialized = 1;
|
973
1103
|
|
974
1104
|
if ((fd = git_futils_open_ro(abspath.ptr)) < 0) {
|
@@ -991,27 +1121,25 @@ done:
|
|
991
1121
|
if (fd >= 0)
|
992
1122
|
p_close(fd);
|
993
1123
|
filter_streams_free(&filter_streams);
|
994
|
-
|
1124
|
+
git_str_dispose(&abspath);
|
995
1125
|
return error;
|
996
1126
|
}
|
997
1127
|
|
998
|
-
int
|
1128
|
+
int git_filter_list_stream_buffer(
|
999
1129
|
git_filter_list *filters,
|
1000
|
-
|
1130
|
+
const char *buffer,
|
1131
|
+
size_t len,
|
1001
1132
|
git_writestream *target)
|
1002
1133
|
{
|
1003
1134
|
git_vector filter_streams = GIT_VECTOR_INIT;
|
1004
1135
|
git_writestream *stream_start;
|
1005
1136
|
int error, initialized = 0;
|
1006
1137
|
|
1007
|
-
git_buf_sanitize(data);
|
1008
|
-
|
1009
1138
|
if ((error = stream_list_init(&stream_start, &filter_streams, filters, target)) < 0)
|
1010
1139
|
goto out;
|
1011
1140
|
initialized = 1;
|
1012
1141
|
|
1013
|
-
if ((error = stream_start->write(
|
1014
|
-
stream_start, data->ptr, data->size)) < 0)
|
1142
|
+
if ((error = stream_start->write(stream_start, buffer, len)) < 0)
|
1015
1143
|
goto out;
|
1016
1144
|
|
1017
1145
|
out:
|
@@ -1027,7 +1155,7 @@ int git_filter_list_stream_blob(
|
|
1027
1155
|
git_blob *blob,
|
1028
1156
|
git_writestream *target)
|
1029
1157
|
{
|
1030
|
-
|
1158
|
+
git_str in = GIT_STR_INIT;
|
1031
1159
|
|
1032
1160
|
if (buf_from_blob(&in, blob) < 0)
|
1033
1161
|
return -1;
|
@@ -1035,7 +1163,7 @@ int git_filter_list_stream_blob(
|
|
1035
1163
|
if (filters)
|
1036
1164
|
git_oid_cpy(&filters->source.oid, git_blob_id(blob));
|
1037
1165
|
|
1038
|
-
return
|
1166
|
+
return git_filter_list_stream_buffer(filters, in.ptr, in.size, target);
|
1039
1167
|
}
|
1040
1168
|
|
1041
1169
|
int git_filter_init(git_filter *filter, unsigned int version)
|
@@ -1043,3 +1171,21 @@ int git_filter_init(git_filter *filter, unsigned int version)
|
|
1043
1171
|
GIT_INIT_STRUCTURE_FROM_TEMPLATE(filter, version, git_filter, GIT_FILTER_INIT);
|
1044
1172
|
return 0;
|
1045
1173
|
}
|
1174
|
+
|
1175
|
+
#ifndef GIT_DEPRECATE_HARD
|
1176
|
+
|
1177
|
+
int git_filter_list_stream_data(
|
1178
|
+
git_filter_list *filters,
|
1179
|
+
git_buf *data,
|
1180
|
+
git_writestream *target)
|
1181
|
+
{
|
1182
|
+
return git_filter_list_stream_buffer(filters, data->ptr, data->size, target);
|
1183
|
+
}
|
1184
|
+
|
1185
|
+
int git_filter_list_apply_to_data(
|
1186
|
+
git_buf *tgt, git_filter_list *filters, git_buf *src)
|
1187
|
+
{
|
1188
|
+
return git_filter_list_apply_to_buffer(tgt, filters, src->ptr, src->size);
|
1189
|
+
}
|
1190
|
+
|
1191
|
+
#endif
|