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
@@ -12,6 +12,7 @@
|
|
12
12
|
#include "config.h"
|
13
13
|
#include "sysdir.h"
|
14
14
|
#include "ignore.h"
|
15
|
+
#include "path.h"
|
15
16
|
|
16
17
|
GIT_INLINE(int) attr_cache_lock(git_attr_cache *cache)
|
17
18
|
{
|
@@ -38,15 +39,17 @@ GIT_INLINE(git_attr_file_entry *) attr_cache_lookup_entry(
|
|
38
39
|
|
39
40
|
int git_attr_cache__alloc_file_entry(
|
40
41
|
git_attr_file_entry **out,
|
42
|
+
git_repository *repo,
|
41
43
|
const char *base,
|
42
44
|
const char *path,
|
43
45
|
git_pool *pool)
|
44
46
|
{
|
47
|
+
git_str fullpath_str = GIT_STR_INIT;
|
45
48
|
size_t baselen = 0, pathlen = strlen(path);
|
46
49
|
size_t cachesize = sizeof(git_attr_file_entry) + pathlen + 1;
|
47
50
|
git_attr_file_entry *ce;
|
48
51
|
|
49
|
-
if (base != NULL &&
|
52
|
+
if (base != NULL && git_fs_path_root(path) < 0) {
|
50
53
|
baselen = strlen(base);
|
51
54
|
cachesize += baselen;
|
52
55
|
|
@@ -65,6 +68,12 @@ int git_attr_cache__alloc_file_entry(
|
|
65
68
|
}
|
66
69
|
memcpy(&ce->fullpath[baselen], path, pathlen);
|
67
70
|
|
71
|
+
fullpath_str.ptr = ce->fullpath;
|
72
|
+
fullpath_str.size = pathlen + baselen;
|
73
|
+
|
74
|
+
if (git_path_validate_str_length(repo, &fullpath_str) < 0)
|
75
|
+
return -1;
|
76
|
+
|
68
77
|
ce->path = &ce->fullpath[baselen];
|
69
78
|
*out = ce;
|
70
79
|
|
@@ -79,8 +88,8 @@ static int attr_cache_make_entry(
|
|
79
88
|
git_attr_file_entry *entry = NULL;
|
80
89
|
int error;
|
81
90
|
|
82
|
-
if ((error = git_attr_cache__alloc_file_entry(&entry,
|
83
|
-
|
91
|
+
if ((error = git_attr_cache__alloc_file_entry(&entry, repo,
|
92
|
+
git_repository_workdir(repo), path, &cache->pool)) < 0)
|
84
93
|
return error;
|
85
94
|
|
86
95
|
if ((error = git_strmap_set(cache->files, entry->path, entry)) < 0)
|
@@ -108,7 +117,7 @@ static int attr_cache_upsert(git_attr_cache *cache, git_attr_file *file)
|
|
108
117
|
* Replace the existing value if another thread has
|
109
118
|
* created it in the meantime.
|
110
119
|
*/
|
111
|
-
old =
|
120
|
+
old = git_atomic_swap(entry->file[file->source.type], file);
|
112
121
|
|
113
122
|
if (old) {
|
114
123
|
GIT_REFCOUNT_OWN(old, NULL);
|
@@ -123,7 +132,7 @@ static int attr_cache_remove(git_attr_cache *cache, git_attr_file *file)
|
|
123
132
|
{
|
124
133
|
int error = 0;
|
125
134
|
git_attr_file_entry *entry;
|
126
|
-
git_attr_file *
|
135
|
+
git_attr_file *oldfile = NULL;
|
127
136
|
|
128
137
|
if (!file)
|
129
138
|
return 0;
|
@@ -132,13 +141,13 @@ static int attr_cache_remove(git_attr_cache *cache, git_attr_file *file)
|
|
132
141
|
return error;
|
133
142
|
|
134
143
|
if ((entry = attr_cache_lookup_entry(cache, file->entry->path)) != NULL)
|
135
|
-
|
144
|
+
oldfile = git_atomic_compare_and_swap(&entry->file[file->source.type], file, NULL);
|
136
145
|
|
137
146
|
attr_cache_unlock(cache);
|
138
147
|
|
139
|
-
if (
|
140
|
-
GIT_REFCOUNT_OWN(
|
141
|
-
git_attr_file__free(
|
148
|
+
if (oldfile == file) {
|
149
|
+
GIT_REFCOUNT_OWN(file, NULL);
|
150
|
+
git_attr_file__free(file);
|
142
151
|
}
|
143
152
|
|
144
153
|
return error;
|
@@ -154,40 +163,42 @@ static int attr_cache_lookup(
|
|
154
163
|
git_attr_file_entry **out_entry,
|
155
164
|
git_repository *repo,
|
156
165
|
git_attr_session *attr_session,
|
157
|
-
git_attr_file_source source
|
158
|
-
const char *base,
|
159
|
-
const char *filename)
|
166
|
+
git_attr_file_source *source)
|
160
167
|
{
|
161
168
|
int error = 0;
|
162
|
-
|
163
|
-
const char *wd = git_repository_workdir(repo)
|
169
|
+
git_str path = GIT_STR_INIT;
|
170
|
+
const char *wd = git_repository_workdir(repo);
|
171
|
+
const char *filename;
|
164
172
|
git_attr_cache *cache = git_repository_attr_cache(repo);
|
165
173
|
git_attr_file_entry *entry = NULL;
|
166
174
|
git_attr_file *file = NULL;
|
167
175
|
|
168
176
|
/* join base and path as needed */
|
169
|
-
if (base != NULL &&
|
170
|
-
|
177
|
+
if (source->base != NULL && git_fs_path_root(source->filename) < 0) {
|
178
|
+
git_str *p = attr_session ? &attr_session->tmp : &path;
|
171
179
|
|
172
|
-
if (
|
180
|
+
if (git_str_joinpath(p, source->base, source->filename) < 0 ||
|
181
|
+
git_path_validate_str_length(repo, p) < 0)
|
173
182
|
return -1;
|
174
183
|
|
175
184
|
filename = p->ptr;
|
185
|
+
} else {
|
186
|
+
filename = source->filename;
|
176
187
|
}
|
177
188
|
|
178
|
-
|
179
|
-
|
180
|
-
relfile += strlen(wd);
|
189
|
+
if (wd && !git__prefixcmp(filename, wd))
|
190
|
+
filename += strlen(wd);
|
181
191
|
|
182
192
|
/* check cache for existing entry */
|
183
193
|
if ((error = attr_cache_lock(cache)) < 0)
|
184
194
|
goto cleanup;
|
185
195
|
|
186
|
-
entry = attr_cache_lookup_entry(cache,
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
196
|
+
entry = attr_cache_lookup_entry(cache, filename);
|
197
|
+
|
198
|
+
if (!entry) {
|
199
|
+
error = attr_cache_make_entry(&entry, repo, filename);
|
200
|
+
} else if (entry->file[source->type] != NULL) {
|
201
|
+
file = entry->file[source->type];
|
191
202
|
GIT_REFCOUNT_INC(file);
|
192
203
|
}
|
193
204
|
|
@@ -197,7 +208,7 @@ cleanup:
|
|
197
208
|
*out_file = file;
|
198
209
|
*out_entry = entry;
|
199
210
|
|
200
|
-
|
211
|
+
git_str_dispose(&path);
|
201
212
|
return error;
|
202
213
|
}
|
203
214
|
|
@@ -205,9 +216,7 @@ int git_attr_cache__get(
|
|
205
216
|
git_attr_file **out,
|
206
217
|
git_repository *repo,
|
207
218
|
git_attr_session *attr_session,
|
208
|
-
git_attr_file_source source,
|
209
|
-
const char *base,
|
210
|
-
const char *filename,
|
219
|
+
git_attr_file_source *source,
|
211
220
|
git_attr_file_parser parser,
|
212
221
|
bool allow_macros)
|
213
222
|
{
|
@@ -216,19 +225,21 @@ int git_attr_cache__get(
|
|
216
225
|
git_attr_file_entry *entry = NULL;
|
217
226
|
git_attr_file *file = NULL, *updated = NULL;
|
218
227
|
|
219
|
-
if ((error = attr_cache_lookup(
|
220
|
-
&file, &entry, repo, attr_session, source, base, filename)) < 0)
|
228
|
+
if ((error = attr_cache_lookup(&file, &entry, repo, attr_session, source)) < 0)
|
221
229
|
return error;
|
222
230
|
|
223
231
|
/* load file if we don't have one or if existing one is out of date */
|
224
|
-
if (!file ||
|
225
|
-
|
232
|
+
if (!file ||
|
233
|
+
(error = git_attr_file__out_of_date(repo, attr_session, file, source)) > 0)
|
234
|
+
error = git_attr_file__load(&updated, repo, attr_session,
|
235
|
+
entry, source, parser,
|
236
|
+
allow_macros);
|
226
237
|
|
227
238
|
/* if we loaded the file, insert into and/or update cache */
|
228
239
|
if (updated) {
|
229
|
-
if ((error = attr_cache_upsert(cache, updated)) < 0)
|
240
|
+
if ((error = attr_cache_upsert(cache, updated)) < 0) {
|
230
241
|
git_attr_file__free(updated);
|
231
|
-
else {
|
242
|
+
} else {
|
232
243
|
git_attr_file__free(file); /* offset incref from lookup */
|
233
244
|
file = updated;
|
234
245
|
}
|
@@ -255,7 +266,7 @@ int git_attr_cache__get(
|
|
255
266
|
|
256
267
|
bool git_attr_cache__is_cached(
|
257
268
|
git_repository *repo,
|
258
|
-
|
269
|
+
git_attr_file_source_t source_type,
|
259
270
|
const char *filename)
|
260
271
|
{
|
261
272
|
git_attr_cache *cache = git_repository_attr_cache(repo);
|
@@ -268,14 +279,14 @@ bool git_attr_cache__is_cached(
|
|
268
279
|
if ((entry = git_strmap_get(files, filename)) == NULL)
|
269
280
|
return false;
|
270
281
|
|
271
|
-
return entry && (entry->file[
|
282
|
+
return entry && (entry->file[source_type] != NULL);
|
272
283
|
}
|
273
284
|
|
274
285
|
|
275
286
|
static int attr_cache__lookup_path(
|
276
287
|
char **out, git_config *cfg, const char *key, const char *fallback)
|
277
288
|
{
|
278
|
-
|
289
|
+
git_str buf = GIT_STR_INIT;
|
279
290
|
int error;
|
280
291
|
git_config_entry *entry = NULL;
|
281
292
|
|
@@ -290,17 +301,17 @@ static int attr_cache__lookup_path(
|
|
290
301
|
/* expand leading ~/ as needed */
|
291
302
|
if (cfgval && cfgval[0] == '~' && cfgval[1] == '/') {
|
292
303
|
if (! (error = git_sysdir_expand_global_file(&buf, &cfgval[2])))
|
293
|
-
*out =
|
304
|
+
*out = git_str_detach(&buf);
|
294
305
|
} else if (cfgval) {
|
295
306
|
*out = git__strdup(cfgval);
|
296
307
|
}
|
297
308
|
}
|
298
309
|
else if (!git_sysdir_find_xdg_file(&buf, fallback)) {
|
299
|
-
*out =
|
310
|
+
*out = git_str_detach(&buf);
|
300
311
|
}
|
301
312
|
|
302
313
|
git_config_entry_free(entry);
|
303
|
-
|
314
|
+
git_str_dispose(&buf);
|
304
315
|
|
305
316
|
return error;
|
306
317
|
}
|
@@ -321,7 +332,7 @@ static void attr_cache__free(git_attr_cache *cache)
|
|
321
332
|
|
322
333
|
git_strmap_foreach_value(cache->files, entry, {
|
323
334
|
for (i = 0; i < GIT_ATTR_FILE_NUM_SOURCES; ++i) {
|
324
|
-
if ((file =
|
335
|
+
if ((file = git_atomic_swap(entry->file[i], NULL)) != NULL) {
|
325
336
|
GIT_REFCOUNT_OWN(file, NULL);
|
326
337
|
git_attr_file__free(file);
|
327
338
|
}
|
@@ -395,8 +406,7 @@ int git_attr_cache__init(git_repository *repo)
|
|
395
406
|
(ret = git_pool_init(&cache->pool, 1)) < 0)
|
396
407
|
goto cancel;
|
397
408
|
|
398
|
-
|
399
|
-
if (cache)
|
409
|
+
if (git_atomic_compare_and_swap(&repo->attrcache, NULL, cache) != NULL)
|
400
410
|
goto cancel; /* raced with another thread, free this but no error */
|
401
411
|
|
402
412
|
git_config_free(cfg);
|
@@ -417,7 +427,7 @@ int git_attr_cache_flush(git_repository *repo)
|
|
417
427
|
/* this could be done less expensively, but for now, we'll just free
|
418
428
|
* the entire attrcache and let the next use reinitialize it...
|
419
429
|
*/
|
420
|
-
if (repo && (cache =
|
430
|
+
if (repo && (cache = git_atomic_swap(repo->attrcache, NULL)) != NULL)
|
421
431
|
attr_cache__free(cache);
|
422
432
|
|
423
433
|
return 0;
|
@@ -31,19 +31,18 @@ extern int git_attr_cache__get(
|
|
31
31
|
git_attr_file **file,
|
32
32
|
git_repository *repo,
|
33
33
|
git_attr_session *attr_session,
|
34
|
-
git_attr_file_source source,
|
35
|
-
const char *base,
|
36
|
-
const char *filename,
|
34
|
+
git_attr_file_source *source,
|
37
35
|
git_attr_file_parser parser,
|
38
36
|
bool allow_macros);
|
39
37
|
|
40
38
|
extern bool git_attr_cache__is_cached(
|
41
39
|
git_repository *repo,
|
42
|
-
|
43
|
-
const char *
|
40
|
+
git_attr_file_source_t source_type,
|
41
|
+
const char *filename);
|
44
42
|
|
45
43
|
extern int git_attr_cache__alloc_file_entry(
|
46
44
|
git_attr_file_entry **out,
|
45
|
+
git_repository *repo,
|
47
46
|
const char *base,
|
48
47
|
const char *path,
|
49
48
|
git_pool *pool);
|
data/vendor/libgit2/src/blame.c
CHANGED
@@ -59,7 +59,7 @@ static bool hunk_starts_at_or_after_line(git_blame_hunk *hunk, size_t line)
|
|
59
59
|
return line <= hunk->final_start_line_number;
|
60
60
|
}
|
61
61
|
|
62
|
-
static git_blame_hunk*
|
62
|
+
static git_blame_hunk *new_hunk(
|
63
63
|
size_t start,
|
64
64
|
size_t lines,
|
65
65
|
size_t orig_start,
|
@@ -84,7 +84,7 @@ static void free_hunk(git_blame_hunk *hunk)
|
|
84
84
|
git__free(hunk);
|
85
85
|
}
|
86
86
|
|
87
|
-
static git_blame_hunk*
|
87
|
+
static git_blame_hunk *dup_hunk(git_blame_hunk *hunk)
|
88
88
|
{
|
89
89
|
git_blame_hunk *newhunk = new_hunk(
|
90
90
|
hunk->final_start_line_number,
|
@@ -122,7 +122,7 @@ static void shift_hunks_by(git_vector *v, size_t start_line, int shift_by)
|
|
122
122
|
}
|
123
123
|
}
|
124
124
|
|
125
|
-
git_blame*
|
125
|
+
git_blame *git_blame__alloc(
|
126
126
|
git_repository *repo,
|
127
127
|
git_blame_options opts,
|
128
128
|
const char *path)
|
@@ -176,20 +176,21 @@ void git_blame_free(git_blame *blame)
|
|
176
176
|
|
177
177
|
uint32_t git_blame_get_hunk_count(git_blame *blame)
|
178
178
|
{
|
179
|
-
|
179
|
+
GIT_ASSERT_ARG(blame);
|
180
180
|
return (uint32_t)blame->hunks.length;
|
181
181
|
}
|
182
182
|
|
183
183
|
const git_blame_hunk *git_blame_get_hunk_byindex(git_blame *blame, uint32_t index)
|
184
184
|
{
|
185
|
-
|
185
|
+
GIT_ASSERT_ARG_WITH_RETVAL(blame, NULL);
|
186
186
|
return (git_blame_hunk*)git_vector_get(&blame->hunks, index);
|
187
187
|
}
|
188
188
|
|
189
189
|
const git_blame_hunk *git_blame_get_hunk_byline(git_blame *blame, size_t lineno)
|
190
190
|
{
|
191
191
|
size_t i, new_lineno = lineno;
|
192
|
-
|
192
|
+
|
193
|
+
GIT_ASSERT_ARG_WITH_RETVAL(blame, NULL);
|
193
194
|
|
194
195
|
if (!git_vector_bsearch2(&i, &blame->hunks, hunk_byfinalline_search_cmp, &new_lineno)) {
|
195
196
|
return git_blame_get_hunk_byindex(blame, (uint32_t)i);
|
@@ -298,7 +299,7 @@ static int index_blob_lines(git_blame *blame)
|
|
298
299
|
return blame->num_lines;
|
299
300
|
}
|
300
301
|
|
301
|
-
static git_blame_hunk*
|
302
|
+
static git_blame_hunk *hunk_from_entry(git_blame__entry *e, git_blame *blame)
|
302
303
|
{
|
303
304
|
git_blame_hunk *h = new_hunk(
|
304
305
|
e->lno+1, e->num_lines, e->s_lno+1, e->suspect->path);
|
@@ -393,7 +394,10 @@ int git_blame_file(
|
|
393
394
|
git_blame_options normOptions = GIT_BLAME_OPTIONS_INIT;
|
394
395
|
git_blame *blame = NULL;
|
395
396
|
|
396
|
-
|
397
|
+
GIT_ASSERT_ARG(out);
|
398
|
+
GIT_ASSERT_ARG(repo);
|
399
|
+
GIT_ASSERT_ARG(path);
|
400
|
+
|
397
401
|
if ((error = normalize_options(&normOptions, options, repo)) < 0)
|
398
402
|
goto on_error;
|
399
403
|
|
@@ -514,7 +518,9 @@ int git_blame_buffer(
|
|
514
518
|
|
515
519
|
diffopts.context_lines = 0;
|
516
520
|
|
517
|
-
|
521
|
+
GIT_ASSERT_ARG(out);
|
522
|
+
GIT_ASSERT_ARG(reference);
|
523
|
+
GIT_ASSERT_ARG(buffer && buffer_len);
|
518
524
|
|
519
525
|
blame = git_blame__alloc(reference->repository, reference->options, reference->path);
|
520
526
|
GIT_ERROR_CHECK_ALLOC(blame);
|
@@ -393,7 +393,7 @@ static void fill_origin_blob(git_blame__origin *o, mmfile_t *file)
|
|
393
393
|
memset(file, 0, sizeof(*file));
|
394
394
|
if (o->blob) {
|
395
395
|
file->ptr = (char*)git_blob_rawcontent(o->blob);
|
396
|
-
file->size = (
|
396
|
+
file->size = (long)git_blob_rawsize(o->blob);
|
397
397
|
}
|
398
398
|
}
|
399
399
|
|
@@ -429,7 +429,7 @@ static int paths_on_dup(void **old, void *new)
|
|
429
429
|
return -1;
|
430
430
|
}
|
431
431
|
|
432
|
-
static git_blame__origin*
|
432
|
+
static git_blame__origin *find_origin(
|
433
433
|
git_blame *blame,
|
434
434
|
git_commit *parent,
|
435
435
|
git_blame__origin *origin)
|
data/vendor/libgit2/src/blob.c
CHANGED
@@ -12,13 +12,14 @@
|
|
12
12
|
#include "git2/repository.h"
|
13
13
|
#include "git2/odb_backend.h"
|
14
14
|
|
15
|
+
#include "buf.h"
|
15
16
|
#include "filebuf.h"
|
16
17
|
#include "filter.h"
|
17
|
-
#include "buf_text.h"
|
18
18
|
|
19
19
|
const void *git_blob_rawcontent(const git_blob *blob)
|
20
20
|
{
|
21
|
-
|
21
|
+
GIT_ASSERT_ARG_WITH_RETVAL(blob, NULL);
|
22
|
+
|
22
23
|
if (blob->raw)
|
23
24
|
return blob->data.raw.data;
|
24
25
|
else
|
@@ -27,19 +28,20 @@ const void *git_blob_rawcontent(const git_blob *blob)
|
|
27
28
|
|
28
29
|
git_object_size_t git_blob_rawsize(const git_blob *blob)
|
29
30
|
{
|
30
|
-
|
31
|
+
GIT_ASSERT_ARG(blob);
|
32
|
+
|
31
33
|
if (blob->raw)
|
32
34
|
return blob->data.raw.size;
|
33
35
|
else
|
34
36
|
return (git_object_size_t)git_odb_object_size(blob->data.odb);
|
35
37
|
}
|
36
38
|
|
37
|
-
int git_blob__getbuf(
|
39
|
+
int git_blob__getbuf(git_str *buffer, git_blob *blob)
|
38
40
|
{
|
39
41
|
git_object_size_t size = git_blob_rawsize(blob);
|
40
42
|
|
41
43
|
GIT_ERROR_CHECK_BLOBSIZE(size);
|
42
|
-
return
|
44
|
+
return git_str_set(buffer, git_blob_rawcontent(blob), (size_t)size);
|
43
45
|
}
|
44
46
|
|
45
47
|
void git_blob__free(void *_blob)
|
@@ -53,7 +55,9 @@ void git_blob__free(void *_blob)
|
|
53
55
|
int git_blob__parse_raw(void *_blob, const char *data, size_t size)
|
54
56
|
{
|
55
57
|
git_blob *blob = (git_blob *) _blob;
|
56
|
-
|
58
|
+
|
59
|
+
GIT_ASSERT_ARG(blob);
|
60
|
+
|
57
61
|
blob->raw = 1;
|
58
62
|
blob->data.raw.data = data;
|
59
63
|
blob->data.raw.size = size;
|
@@ -63,7 +67,9 @@ int git_blob__parse_raw(void *_blob, const char *data, size_t size)
|
|
63
67
|
int git_blob__parse(void *_blob, git_odb_object *odb_obj)
|
64
68
|
{
|
65
69
|
git_blob *blob = (git_blob *) _blob;
|
66
|
-
|
70
|
+
|
71
|
+
GIT_ASSERT_ARG(blob);
|
72
|
+
|
67
73
|
git_cached_obj_incref((git_cached_obj *)odb_obj);
|
68
74
|
blob->raw = 0;
|
69
75
|
blob->data.odb = odb_obj;
|
@@ -77,7 +83,8 @@ int git_blob_create_from_buffer(
|
|
77
83
|
git_odb *odb;
|
78
84
|
git_odb_stream *stream;
|
79
85
|
|
80
|
-
|
86
|
+
GIT_ASSERT_ARG(id);
|
87
|
+
GIT_ASSERT_ARG(repo);
|
81
88
|
|
82
89
|
if ((error = git_repository_odb__weakptr(&odb, repo)) < 0 ||
|
83
90
|
(error = git_odb_open_wstream(&stream, odb, len, GIT_OBJECT_BLOB)) < 0)
|
@@ -132,12 +139,13 @@ static int write_file_filtered(
|
|
132
139
|
git_object_size_t *size,
|
133
140
|
git_odb *odb,
|
134
141
|
const char *full_path,
|
135
|
-
git_filter_list *fl
|
142
|
+
git_filter_list *fl,
|
143
|
+
git_repository* repo)
|
136
144
|
{
|
137
145
|
int error;
|
138
|
-
|
146
|
+
git_str tgt = GIT_STR_INIT;
|
139
147
|
|
140
|
-
error =
|
148
|
+
error = git_filter_list__apply_to_file(&tgt, fl, repo, full_path);
|
141
149
|
|
142
150
|
/* Write the file to disk if it was properly filtered */
|
143
151
|
if (!error) {
|
@@ -146,7 +154,7 @@ static int write_file_filtered(
|
|
146
154
|
error = git_odb_write(id, odb, tgt.ptr, tgt.size, GIT_OBJECT_BLOB);
|
147
155
|
}
|
148
156
|
|
149
|
-
|
157
|
+
git_str_dispose(&tgt);
|
150
158
|
return error;
|
151
159
|
}
|
152
160
|
|
@@ -186,22 +194,18 @@ int git_blob__create_from_paths(
|
|
186
194
|
git_odb *odb = NULL;
|
187
195
|
git_object_size_t size;
|
188
196
|
mode_t mode;
|
189
|
-
|
197
|
+
git_str path = GIT_STR_INIT;
|
190
198
|
|
191
|
-
|
199
|
+
GIT_ASSERT_ARG(hint_path || !try_load_filters);
|
192
200
|
|
193
201
|
if (!content_path) {
|
194
|
-
if (
|
195
|
-
return GIT_EBAREREPO;
|
196
|
-
|
197
|
-
if (git_buf_joinpath(
|
198
|
-
&path, git_repository_workdir(repo), hint_path) < 0)
|
202
|
+
if (git_repository_workdir_path(&path, repo, hint_path) < 0)
|
199
203
|
return -1;
|
200
204
|
|
201
205
|
content_path = path.ptr;
|
202
206
|
}
|
203
207
|
|
204
|
-
if ((error =
|
208
|
+
if ((error = git_fs_path_lstat(content_path, &st)) < 0 ||
|
205
209
|
(error = git_repository_odb(&odb, repo)) < 0)
|
206
210
|
goto done;
|
207
211
|
|
@@ -236,7 +240,7 @@ int git_blob__create_from_paths(
|
|
236
240
|
error = write_file_stream(id, odb, content_path, size);
|
237
241
|
else {
|
238
242
|
/* We need to apply one or more filters */
|
239
|
-
error = write_file_filtered(id, &size, odb, content_path, fl);
|
243
|
+
error = write_file_filtered(id, &size, odb, content_path, fl, repo);
|
240
244
|
|
241
245
|
git_filter_list_free(fl);
|
242
246
|
}
|
@@ -258,7 +262,7 @@ int git_blob__create_from_paths(
|
|
258
262
|
|
259
263
|
done:
|
260
264
|
git_odb_free(odb);
|
261
|
-
|
265
|
+
git_str_dispose(&path);
|
262
266
|
|
263
267
|
return error;
|
264
268
|
}
|
@@ -273,24 +277,23 @@ int git_blob_create_from_disk(
|
|
273
277
|
git_oid *id, git_repository *repo, const char *path)
|
274
278
|
{
|
275
279
|
int error;
|
276
|
-
|
277
|
-
const char *workdir, *hintpath;
|
280
|
+
git_str full_path = GIT_STR_INIT;
|
281
|
+
const char *workdir, *hintpath = NULL;
|
278
282
|
|
279
|
-
if ((error =
|
280
|
-
|
283
|
+
if ((error = git_fs_path_prettify(&full_path, path, NULL)) < 0) {
|
284
|
+
git_str_dispose(&full_path);
|
281
285
|
return error;
|
282
286
|
}
|
283
287
|
|
284
|
-
hintpath = git_buf_cstr(&full_path);
|
285
288
|
workdir = git_repository_workdir(repo);
|
286
289
|
|
287
|
-
if (workdir && !git__prefixcmp(
|
288
|
-
hintpath
|
290
|
+
if (workdir && !git__prefixcmp(full_path.ptr, workdir))
|
291
|
+
hintpath = full_path.ptr + strlen(workdir);
|
289
292
|
|
290
293
|
error = git_blob__create_from_paths(
|
291
|
-
id, NULL, repo,
|
294
|
+
id, NULL, repo, git_str_cstr(&full_path), hintpath, 0, !!hintpath);
|
292
295
|
|
293
|
-
|
296
|
+
git_str_dispose(&full_path);
|
294
297
|
return error;
|
295
298
|
}
|
296
299
|
|
@@ -328,10 +331,11 @@ static int blob_writestream_write(git_writestream *_stream, const char *buffer,
|
|
328
331
|
int git_blob_create_from_stream(git_writestream **out, git_repository *repo, const char *hintpath)
|
329
332
|
{
|
330
333
|
int error;
|
331
|
-
|
334
|
+
git_str path = GIT_STR_INIT;
|
332
335
|
blob_writestream *stream;
|
333
336
|
|
334
|
-
|
337
|
+
GIT_ASSERT_ARG(out);
|
338
|
+
GIT_ASSERT_ARG(repo);
|
335
339
|
|
336
340
|
stream = git__calloc(1, sizeof(blob_writestream));
|
337
341
|
GIT_ERROR_CHECK_ALLOC(stream);
|
@@ -346,11 +350,11 @@ int git_blob_create_from_stream(git_writestream **out, git_repository *repo, con
|
|
346
350
|
stream->parent.close = blob_writestream_close;
|
347
351
|
stream->parent.free = blob_writestream_free;
|
348
352
|
|
349
|
-
if ((error =
|
350
|
-
|| (error =
|
353
|
+
if ((error = git_repository__item_path(&path, repo, GIT_REPOSITORY_ITEM_OBJECTS)) < 0
|
354
|
+
|| (error = git_str_joinpath(&path, path.ptr, "streamed")) < 0)
|
351
355
|
goto cleanup;
|
352
356
|
|
353
|
-
if ((error = git_filebuf_open_withsize(&stream->fbuf,
|
357
|
+
if ((error = git_filebuf_open_withsize(&stream->fbuf, git_str_cstr(&path), GIT_FILEBUF_TEMPORARY,
|
354
358
|
0666, 2 * 1024 * 1024)) < 0)
|
355
359
|
goto cleanup;
|
356
360
|
|
@@ -360,7 +364,7 @@ cleanup:
|
|
360
364
|
if (error < 0)
|
361
365
|
blob_writestream_free((git_writestream *) stream);
|
362
366
|
|
363
|
-
|
367
|
+
git_str_dispose(&path);
|
364
368
|
return error;
|
365
369
|
}
|
366
370
|
|
@@ -388,16 +392,25 @@ cleanup:
|
|
388
392
|
|
389
393
|
int git_blob_is_binary(const git_blob *blob)
|
390
394
|
{
|
391
|
-
|
395
|
+
git_str content = GIT_STR_INIT;
|
392
396
|
git_object_size_t size;
|
393
397
|
|
394
|
-
|
398
|
+
GIT_ASSERT_ARG(blob);
|
395
399
|
|
396
400
|
size = git_blob_rawsize(blob);
|
397
401
|
|
398
|
-
|
402
|
+
git_str_attach_notowned(&content, git_blob_rawcontent(blob),
|
399
403
|
(size_t)min(size, GIT_FILTER_BYTES_TO_CHECK_NUL));
|
400
|
-
return
|
404
|
+
return git_str_is_binary(&content);
|
405
|
+
}
|
406
|
+
|
407
|
+
int git_blob_data_is_binary(const char *str, size_t len)
|
408
|
+
{
|
409
|
+
git_str content = GIT_STR_INIT;
|
410
|
+
|
411
|
+
git_str_attach_notowned(&content, str, len);
|
412
|
+
|
413
|
+
return git_str_is_binary(&content);
|
401
414
|
}
|
402
415
|
|
403
416
|
int git_blob_filter_options_init(
|
@@ -415,14 +428,14 @@ int git_blob_filter(
|
|
415
428
|
const char *path,
|
416
429
|
git_blob_filter_options *given_opts)
|
417
430
|
{
|
418
|
-
int error = 0;
|
419
|
-
git_filter_list *fl = NULL;
|
420
431
|
git_blob_filter_options opts = GIT_BLOB_FILTER_OPTIONS_INIT;
|
421
|
-
|
422
|
-
|
423
|
-
|
432
|
+
git_filter_options filter_opts = GIT_FILTER_OPTIONS_INIT;
|
433
|
+
git_filter_list *fl = NULL;
|
434
|
+
int error = 0;
|
424
435
|
|
425
|
-
|
436
|
+
GIT_ASSERT_ARG(blob);
|
437
|
+
GIT_ASSERT_ARG(path);
|
438
|
+
GIT_ASSERT_ARG(out);
|
426
439
|
|
427
440
|
GIT_ERROR_CHECK_VERSION(
|
428
441
|
given_opts, GIT_BLOB_FILTER_OPTIONS_VERSION, "git_blob_filter_options");
|
@@ -435,14 +448,25 @@ int git_blob_filter(
|
|
435
448
|
return 0;
|
436
449
|
|
437
450
|
if ((opts.flags & GIT_BLOB_FILTER_NO_SYSTEM_ATTRIBUTES) != 0)
|
438
|
-
flags |= GIT_FILTER_NO_SYSTEM_ATTRIBUTES;
|
451
|
+
filter_opts.flags |= GIT_FILTER_NO_SYSTEM_ATTRIBUTES;
|
439
452
|
|
440
|
-
if ((opts.flags &
|
441
|
-
flags |= GIT_FILTER_ATTRIBUTES_FROM_HEAD;
|
453
|
+
if ((opts.flags & GIT_BLOB_FILTER_ATTRIBUTES_FROM_HEAD) != 0)
|
454
|
+
filter_opts.flags |= GIT_FILTER_ATTRIBUTES_FROM_HEAD;
|
455
|
+
|
456
|
+
if ((opts.flags & GIT_BLOB_FILTER_ATTRIBUTES_FROM_COMMIT) != 0) {
|
457
|
+
filter_opts.flags |= GIT_FILTER_ATTRIBUTES_FROM_COMMIT;
|
458
|
+
|
459
|
+
#ifndef GIT_DEPRECATE_HARD
|
460
|
+
if (opts.commit_id)
|
461
|
+
git_oid_cpy(&filter_opts.attr_commit_id, opts.commit_id);
|
462
|
+
else
|
463
|
+
#endif
|
464
|
+
git_oid_cpy(&filter_opts.attr_commit_id, &opts.attr_commit_id);
|
465
|
+
}
|
442
466
|
|
443
|
-
if (!(error =
|
467
|
+
if (!(error = git_filter_list_load_ext(
|
444
468
|
&fl, git_blob_owner(blob), blob, path,
|
445
|
-
GIT_FILTER_TO_WORKTREE,
|
469
|
+
GIT_FILTER_TO_WORKTREE, &filter_opts))) {
|
446
470
|
|
447
471
|
error = git_filter_list_apply_to_blob(out, fl, blob);
|
448
472
|
|
data/vendor/libgit2/src/blob.h
CHANGED
@@ -38,7 +38,7 @@ struct git_blob {
|
|
38
38
|
void git_blob__free(void *blob);
|
39
39
|
int git_blob__parse(void *blob, git_odb_object *obj);
|
40
40
|
int git_blob__parse_raw(void *blob, const char *data, size_t size);
|
41
|
-
int git_blob__getbuf(
|
41
|
+
int git_blob__getbuf(git_str *buffer, git_blob *blob);
|
42
42
|
|
43
43
|
extern int git_blob__create_from_paths(
|
44
44
|
git_oid *out_oid,
|