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/graph.c
CHANGED
@@ -43,7 +43,7 @@ static int mark_parents(git_revwalk *walk, git_commit_list_node *one,
|
|
43
43
|
return 0;
|
44
44
|
}
|
45
45
|
|
46
|
-
if (git_pqueue_init(&list, 0, 2,
|
46
|
+
if (git_pqueue_init(&list, 0, 2, git_commit_list_generation_cmp) < 0)
|
47
47
|
return -1;
|
48
48
|
|
49
49
|
if (git_commit_list_parse(walk, one) < 0)
|
@@ -176,19 +176,74 @@ on_error:
|
|
176
176
|
|
177
177
|
int git_graph_descendant_of(git_repository *repo, const git_oid *commit, const git_oid *ancestor)
|
178
178
|
{
|
179
|
-
git_oid merge_base;
|
180
|
-
int error;
|
181
|
-
|
182
179
|
if (git_oid_equal(commit, ancestor))
|
183
180
|
return 0;
|
184
181
|
|
185
|
-
|
186
|
-
|
187
|
-
|
182
|
+
return git_graph_reachable_from_any(repo, ancestor, commit, 1);
|
183
|
+
}
|
184
|
+
|
185
|
+
int git_graph_reachable_from_any(
|
186
|
+
git_repository *repo,
|
187
|
+
const git_oid *commit_id,
|
188
|
+
const git_oid descendant_array[],
|
189
|
+
size_t length)
|
190
|
+
{
|
191
|
+
git_revwalk *walk = NULL;
|
192
|
+
git_vector list;
|
193
|
+
git_commit_list *result = NULL;
|
194
|
+
git_commit_list_node *commit;
|
195
|
+
size_t i;
|
196
|
+
uint32_t minimum_generation = 0xffffffff;
|
197
|
+
int error = 0;
|
198
|
+
|
199
|
+
if (!length)
|
188
200
|
return 0;
|
189
201
|
|
190
|
-
|
202
|
+
for (i = 0; i < length; ++i) {
|
203
|
+
if (git_oid_equal(commit_id, &descendant_array[i]))
|
204
|
+
return 1;
|
205
|
+
}
|
206
|
+
|
207
|
+
if ((error = git_vector_init(&list, length + 1, NULL)) < 0)
|
191
208
|
return error;
|
192
209
|
|
193
|
-
|
210
|
+
if ((error = git_revwalk_new(&walk, repo)) < 0)
|
211
|
+
goto done;
|
212
|
+
|
213
|
+
for (i = 0; i < length; i++) {
|
214
|
+
commit = git_revwalk__commit_lookup(walk, &descendant_array[i]);
|
215
|
+
if (commit == NULL) {
|
216
|
+
error = -1;
|
217
|
+
goto done;
|
218
|
+
}
|
219
|
+
|
220
|
+
git_vector_insert(&list, commit);
|
221
|
+
if (minimum_generation > commit->generation)
|
222
|
+
minimum_generation = commit->generation;
|
223
|
+
}
|
224
|
+
|
225
|
+
commit = git_revwalk__commit_lookup(walk, commit_id);
|
226
|
+
if (commit == NULL) {
|
227
|
+
error = -1;
|
228
|
+
goto done;
|
229
|
+
}
|
230
|
+
|
231
|
+
if (minimum_generation > commit->generation)
|
232
|
+
minimum_generation = commit->generation;
|
233
|
+
|
234
|
+
if ((error = git_merge__bases_many(&result, walk, commit, &list, minimum_generation)) < 0)
|
235
|
+
goto done;
|
236
|
+
|
237
|
+
if (result) {
|
238
|
+
error = git_oid_equal(commit_id, &result->item->oid);
|
239
|
+
} else {
|
240
|
+
/* No merge-base found, it's not a descendant */
|
241
|
+
error = 0;
|
242
|
+
}
|
243
|
+
|
244
|
+
done:
|
245
|
+
git_commit_list_free(&result);
|
246
|
+
git_vector_free(&list);
|
247
|
+
git_revwalk_free(walk);
|
248
|
+
return error;
|
194
249
|
}
|
@@ -24,22 +24,22 @@ void git_hash_sha1_ctx_cleanup(git_hash_sha1_ctx *ctx)
|
|
24
24
|
|
25
25
|
int git_hash_sha1_init(git_hash_sha1_ctx *ctx)
|
26
26
|
{
|
27
|
-
|
27
|
+
GIT_ASSERT_ARG(ctx);
|
28
28
|
SHA1DCInit(&ctx->c);
|
29
29
|
return 0;
|
30
30
|
}
|
31
31
|
|
32
32
|
int git_hash_sha1_update(git_hash_sha1_ctx *ctx, const void *data, size_t len)
|
33
33
|
{
|
34
|
-
|
34
|
+
GIT_ASSERT_ARG(ctx);
|
35
35
|
SHA1DCUpdate(&ctx->c, data, len);
|
36
36
|
return 0;
|
37
37
|
}
|
38
38
|
|
39
|
-
int git_hash_sha1_final(
|
39
|
+
int git_hash_sha1_final(unsigned char *out, git_hash_sha1_ctx *ctx)
|
40
40
|
{
|
41
|
-
|
42
|
-
if (SHA1DCFinal(out
|
41
|
+
GIT_ASSERT_ARG(ctx);
|
42
|
+
if (SHA1DCFinal(out, &ctx->c)) {
|
43
43
|
git_error_set(GIT_ERROR_SHA1, "SHA1 collision attack detected");
|
44
44
|
return -1;
|
45
45
|
}
|
@@ -26,7 +26,7 @@ void git_hash_sha1_ctx_cleanup(git_hash_sha1_ctx *ctx)
|
|
26
26
|
|
27
27
|
int git_hash_sha1_init(git_hash_sha1_ctx *ctx)
|
28
28
|
{
|
29
|
-
|
29
|
+
GIT_ASSERT_ARG(ctx);
|
30
30
|
CC_SHA1_Init(&ctx->c);
|
31
31
|
return 0;
|
32
32
|
}
|
@@ -35,7 +35,7 @@ int git_hash_sha1_update(git_hash_sha1_ctx *ctx, const void *_data, size_t len)
|
|
35
35
|
{
|
36
36
|
const unsigned char *data = _data;
|
37
37
|
|
38
|
-
|
38
|
+
GIT_ASSERT_ARG(ctx);
|
39
39
|
|
40
40
|
while (len > 0) {
|
41
41
|
CC_LONG chunk = (len > CC_LONG_MAX) ? CC_LONG_MAX : (CC_LONG)len;
|
@@ -49,9 +49,9 @@ int git_hash_sha1_update(git_hash_sha1_ctx *ctx, const void *_data, size_t len)
|
|
49
49
|
return 0;
|
50
50
|
}
|
51
51
|
|
52
|
-
int git_hash_sha1_final(
|
52
|
+
int git_hash_sha1_final(unsigned char *out, git_hash_sha1_ctx *ctx)
|
53
53
|
{
|
54
|
-
|
55
|
-
CC_SHA1_Final(out
|
54
|
+
GIT_ASSERT_ARG(ctx);
|
55
|
+
CC_SHA1_Final(out, &ctx->c);
|
56
56
|
return 0;
|
57
57
|
}
|
@@ -278,7 +278,7 @@ int git_hash_sha1_update(git_hash_sha1_ctx *ctx, const void *data, size_t len)
|
|
278
278
|
return 0;
|
279
279
|
}
|
280
280
|
|
281
|
-
int git_hash_sha1_final(
|
281
|
+
int git_hash_sha1_final(unsigned char *out, git_hash_sha1_ctx *ctx)
|
282
282
|
{
|
283
283
|
static const unsigned char pad[64] = { 0x80 };
|
284
284
|
unsigned int padlen[2];
|
@@ -294,7 +294,7 @@ int git_hash_sha1_final(git_oid *out, git_hash_sha1_ctx *ctx)
|
|
294
294
|
|
295
295
|
/* Output hash */
|
296
296
|
for (i = 0; i < 5; i++)
|
297
|
-
put_be32(out
|
297
|
+
put_be32(out + i*4, ctx->H[i]);
|
298
298
|
|
299
299
|
return 0;
|
300
300
|
}
|
@@ -19,28 +19,28 @@ int git_hash_sha1_ctx_init(git_hash_sha1_ctx *ctx)
|
|
19
19
|
|
20
20
|
void git_hash_sha1_ctx_cleanup(git_hash_sha1_ctx *ctx)
|
21
21
|
{
|
22
|
-
|
23
|
-
|
22
|
+
if (ctx)
|
23
|
+
mbedtls_sha1_free(&ctx->c);
|
24
24
|
}
|
25
25
|
|
26
26
|
int git_hash_sha1_init(git_hash_sha1_ctx *ctx)
|
27
27
|
{
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
28
|
+
GIT_ASSERT_ARG(ctx);
|
29
|
+
mbedtls_sha1_init(&ctx->c);
|
30
|
+
mbedtls_sha1_starts(&ctx->c);
|
31
|
+
return 0;
|
32
32
|
}
|
33
33
|
|
34
34
|
int git_hash_sha1_update(git_hash_sha1_ctx *ctx, const void *data, size_t len)
|
35
35
|
{
|
36
|
-
|
37
|
-
|
38
|
-
|
36
|
+
GIT_ASSERT_ARG(ctx);
|
37
|
+
mbedtls_sha1_update(&ctx->c, data, len);
|
38
|
+
return 0;
|
39
39
|
}
|
40
40
|
|
41
|
-
int git_hash_sha1_final(
|
41
|
+
int git_hash_sha1_final(unsigned char *out, git_hash_sha1_ctx *ctx)
|
42
42
|
{
|
43
|
-
|
44
|
-
|
45
|
-
|
43
|
+
GIT_ASSERT_ARG(ctx);
|
44
|
+
mbedtls_sha1_finish(&ctx->c, out);
|
45
|
+
return 0;
|
46
46
|
}
|
@@ -24,7 +24,7 @@ void git_hash_sha1_ctx_cleanup(git_hash_sha1_ctx *ctx)
|
|
24
24
|
|
25
25
|
int git_hash_sha1_init(git_hash_sha1_ctx *ctx)
|
26
26
|
{
|
27
|
-
|
27
|
+
GIT_ASSERT_ARG(ctx);
|
28
28
|
|
29
29
|
if (SHA1_Init(&ctx->c) != 1) {
|
30
30
|
git_error_set(GIT_ERROR_SHA1, "hash_openssl: failed to initialize hash context");
|
@@ -36,7 +36,7 @@ int git_hash_sha1_init(git_hash_sha1_ctx *ctx)
|
|
36
36
|
|
37
37
|
int git_hash_sha1_update(git_hash_sha1_ctx *ctx, const void *data, size_t len)
|
38
38
|
{
|
39
|
-
|
39
|
+
GIT_ASSERT_ARG(ctx);
|
40
40
|
|
41
41
|
if (SHA1_Update(&ctx->c, data, len) != 1) {
|
42
42
|
git_error_set(GIT_ERROR_SHA1, "hash_openssl: failed to update hash");
|
@@ -46,11 +46,11 @@ int git_hash_sha1_update(git_hash_sha1_ctx *ctx, const void *data, size_t len)
|
|
46
46
|
return 0;
|
47
47
|
}
|
48
48
|
|
49
|
-
int git_hash_sha1_final(
|
49
|
+
int git_hash_sha1_final(unsigned char *out, git_hash_sha1_ctx *ctx)
|
50
50
|
{
|
51
|
-
|
51
|
+
GIT_ASSERT_ARG(ctx);
|
52
52
|
|
53
|
-
if (SHA1_Final(out
|
53
|
+
if (SHA1_Final(out, &ctx->c) != 1) {
|
54
54
|
git_error_set(GIT_ERROR_SHA1, "hash_openssl: failed to finalize hash");
|
55
55
|
return -1;
|
56
56
|
}
|
@@ -10,10 +10,8 @@
|
|
10
10
|
#include <memory.h>
|
11
11
|
#include <stdio.h>
|
12
12
|
#include <stdlib.h>
|
13
|
-
#ifdef __unix__
|
14
13
|
#include <sys/types.h> /* make sure macros like _BIG_ENDIAN visible */
|
15
14
|
#endif
|
16
|
-
#endif
|
17
15
|
|
18
16
|
#ifdef SHA1DC_CUSTOM_INCLUDE_SHA1_C
|
19
17
|
#include SHA1DC_CUSTOM_INCLUDE_SHA1_C
|
@@ -72,7 +70,7 @@
|
|
72
70
|
/* Not under GCC-alike or glibc */
|
73
71
|
#elif defined(_BYTE_ORDER) && defined(_BIG_ENDIAN) && defined(_LITTLE_ENDIAN)
|
74
72
|
/*
|
75
|
-
* *BSD and newlib (
|
73
|
+
* *BSD and newlib (embedded linux, cygwin, etc).
|
76
74
|
* the defined(_BIG_ENDIAN) && defined(_LITTLE_ENDIAN) part prevents
|
77
75
|
* this condition from matching with Solaris/sparc.
|
78
76
|
* (Solaris defines only one endian macro)
|
@@ -1712,7 +1710,7 @@ static void sha1_recompression_step(uint32_t step, uint32_t ihvin[5], uint32_t i
|
|
1712
1710
|
|
1713
1711
|
|
1714
1712
|
|
1715
|
-
static void sha1_process(SHA1_CTX*
|
1713
|
+
static void sha1_process(SHA1_CTX *ctx, const uint32_t block[16])
|
1716
1714
|
{
|
1717
1715
|
unsigned i, j;
|
1718
1716
|
uint32_t ubc_dv_mask[DVMASKSIZE] = { 0xFFFFFFFF };
|
@@ -1764,7 +1762,7 @@ static void sha1_process(SHA1_CTX* ctx, const uint32_t block[16])
|
|
1764
1762
|
}
|
1765
1763
|
}
|
1766
1764
|
|
1767
|
-
void SHA1DCInit(SHA1_CTX*
|
1765
|
+
void SHA1DCInit(SHA1_CTX *ctx)
|
1768
1766
|
{
|
1769
1767
|
ctx->total = 0;
|
1770
1768
|
ctx->ihv[0] = 0x67452301;
|
@@ -1780,7 +1778,7 @@ void SHA1DCInit(SHA1_CTX* ctx)
|
|
1780
1778
|
ctx->callback = NULL;
|
1781
1779
|
}
|
1782
1780
|
|
1783
|
-
void SHA1DCSetSafeHash(SHA1_CTX*
|
1781
|
+
void SHA1DCSetSafeHash(SHA1_CTX *ctx, int safehash)
|
1784
1782
|
{
|
1785
1783
|
if (safehash)
|
1786
1784
|
ctx->safe_hash = 1;
|
@@ -1789,7 +1787,7 @@ void SHA1DCSetSafeHash(SHA1_CTX* ctx, int safehash)
|
|
1789
1787
|
}
|
1790
1788
|
|
1791
1789
|
|
1792
|
-
void SHA1DCSetUseUBC(SHA1_CTX*
|
1790
|
+
void SHA1DCSetUseUBC(SHA1_CTX *ctx, int ubc_check)
|
1793
1791
|
{
|
1794
1792
|
if (ubc_check)
|
1795
1793
|
ctx->ubc_check = 1;
|
@@ -1797,7 +1795,7 @@ void SHA1DCSetUseUBC(SHA1_CTX* ctx, int ubc_check)
|
|
1797
1795
|
ctx->ubc_check = 0;
|
1798
1796
|
}
|
1799
1797
|
|
1800
|
-
void SHA1DCSetUseDetectColl(SHA1_CTX*
|
1798
|
+
void SHA1DCSetUseDetectColl(SHA1_CTX *ctx, int detect_coll)
|
1801
1799
|
{
|
1802
1800
|
if (detect_coll)
|
1803
1801
|
ctx->detect_coll = 1;
|
@@ -1805,7 +1803,7 @@ void SHA1DCSetUseDetectColl(SHA1_CTX* ctx, int detect_coll)
|
|
1805
1803
|
ctx->detect_coll = 0;
|
1806
1804
|
}
|
1807
1805
|
|
1808
|
-
void SHA1DCSetDetectReducedRoundCollision(SHA1_CTX*
|
1806
|
+
void SHA1DCSetDetectReducedRoundCollision(SHA1_CTX *ctx, int reduced_round_coll)
|
1809
1807
|
{
|
1810
1808
|
if (reduced_round_coll)
|
1811
1809
|
ctx->reduced_round_coll = 1;
|
@@ -1813,12 +1811,12 @@ void SHA1DCSetDetectReducedRoundCollision(SHA1_CTX* ctx, int reduced_round_coll)
|
|
1813
1811
|
ctx->reduced_round_coll = 0;
|
1814
1812
|
}
|
1815
1813
|
|
1816
|
-
void SHA1DCSetCallback(SHA1_CTX*
|
1814
|
+
void SHA1DCSetCallback(SHA1_CTX *ctx, collision_block_callback callback)
|
1817
1815
|
{
|
1818
1816
|
ctx->callback = callback;
|
1819
1817
|
}
|
1820
1818
|
|
1821
|
-
void SHA1DCUpdate(SHA1_CTX*
|
1819
|
+
void SHA1DCUpdate(SHA1_CTX *ctx, const char *buf, size_t len)
|
1822
1820
|
{
|
1823
1821
|
unsigned left, fill;
|
1824
1822
|
|
@@ -7,7 +7,7 @@
|
|
7
7
|
|
8
8
|
#include "win32.h"
|
9
9
|
|
10
|
-
#include "
|
10
|
+
#include "runtime.h"
|
11
11
|
|
12
12
|
#include <wincrypt.h>
|
13
13
|
#include <strsafe.h>
|
@@ -129,7 +129,8 @@ int git_hash_sha1_global_init(void)
|
|
129
129
|
if ((error = hash_cng_prov_init()) < 0)
|
130
130
|
error = hash_cryptoapi_prov_init();
|
131
131
|
|
132
|
-
|
132
|
+
if (!error)
|
133
|
+
error = git_runtime_shutdown_register(sha1_shutdown);
|
133
134
|
|
134
135
|
return error;
|
135
136
|
}
|
@@ -163,7 +164,7 @@ GIT_INLINE(int) hash_cryptoapi_update(git_hash_sha1_ctx *ctx, const void *_data,
|
|
163
164
|
{
|
164
165
|
const BYTE *data = (BYTE *)_data;
|
165
166
|
|
166
|
-
|
167
|
+
GIT_ASSERT(ctx->ctx.cryptoapi.valid);
|
167
168
|
|
168
169
|
while (len > 0) {
|
169
170
|
DWORD chunk = (len > MAXDWORD) ? MAXDWORD : (DWORD)len;
|
@@ -180,14 +181,14 @@ GIT_INLINE(int) hash_cryptoapi_update(git_hash_sha1_ctx *ctx, const void *_data,
|
|
180
181
|
return 0;
|
181
182
|
}
|
182
183
|
|
183
|
-
GIT_INLINE(int) hash_cryptoapi_final(
|
184
|
+
GIT_INLINE(int) hash_cryptoapi_final(unsigned char *out, git_hash_sha1_ctx *ctx)
|
184
185
|
{
|
185
|
-
DWORD len =
|
186
|
+
DWORD len = GIT_HASH_SHA1_SIZE;
|
186
187
|
int error = 0;
|
187
188
|
|
188
|
-
|
189
|
+
GIT_ASSERT(ctx->ctx.cryptoapi.valid);
|
189
190
|
|
190
|
-
if (!CryptGetHashParam(ctx->ctx.cryptoapi.hash_handle, HP_HASHVAL, out
|
191
|
+
if (!CryptGetHashParam(ctx->ctx.cryptoapi.hash_handle, HP_HASHVAL, out, &len, 0)) {
|
191
192
|
git_error_set(GIT_ERROR_OS, "legacy hash data could not be finished");
|
192
193
|
error = -1;
|
193
194
|
}
|
@@ -261,9 +262,9 @@ GIT_INLINE(int) hash_cng_update(git_hash_sha1_ctx *ctx, const void *_data, size_
|
|
261
262
|
return 0;
|
262
263
|
}
|
263
264
|
|
264
|
-
GIT_INLINE(int) hash_cng_final(
|
265
|
+
GIT_INLINE(int) hash_cng_final(unsigned char *out, git_hash_sha1_ctx *ctx)
|
265
266
|
{
|
266
|
-
if (ctx->prov->prov.cng.finish_hash(ctx->ctx.cng.hash_handle, out
|
267
|
+
if (ctx->prov->prov.cng.finish_hash(ctx->ctx.cng.hash_handle, out, GIT_HASH_SHA1_SIZE, 0) < 0) {
|
267
268
|
git_error_set(GIT_ERROR_OS, "hash could not be finished");
|
268
269
|
return -1;
|
269
270
|
}
|
@@ -285,7 +286,7 @@ int git_hash_sha1_ctx_init(git_hash_sha1_ctx *ctx)
|
|
285
286
|
{
|
286
287
|
int error = 0;
|
287
288
|
|
288
|
-
|
289
|
+
GIT_ASSERT_ARG(ctx);
|
289
290
|
|
290
291
|
/*
|
291
292
|
* When compiled with GIT_THREADS, the global hash_prov data is
|
@@ -302,27 +303,30 @@ int git_hash_sha1_ctx_init(git_hash_sha1_ctx *ctx)
|
|
302
303
|
|
303
304
|
int git_hash_sha1_init(git_hash_sha1_ctx *ctx)
|
304
305
|
{
|
305
|
-
|
306
|
+
GIT_ASSERT_ARG(ctx);
|
307
|
+
GIT_ASSERT_ARG(ctx->type);
|
306
308
|
return (ctx->type == CNG) ? hash_cng_init(ctx) : hash_cryptoapi_init(ctx);
|
307
309
|
}
|
308
310
|
|
309
311
|
int git_hash_sha1_update(git_hash_sha1_ctx *ctx, const void *data, size_t len)
|
310
312
|
{
|
311
|
-
|
313
|
+
GIT_ASSERT_ARG(ctx);
|
314
|
+
GIT_ASSERT_ARG(ctx->type);
|
312
315
|
return (ctx->type == CNG) ? hash_cng_update(ctx, data, len) : hash_cryptoapi_update(ctx, data, len);
|
313
316
|
}
|
314
317
|
|
315
|
-
int git_hash_sha1_final(
|
318
|
+
int git_hash_sha1_final(unsigned char *out, git_hash_sha1_ctx *ctx)
|
316
319
|
{
|
317
|
-
|
320
|
+
GIT_ASSERT_ARG(ctx);
|
321
|
+
GIT_ASSERT_ARG(ctx->type);
|
318
322
|
return (ctx->type == CNG) ? hash_cng_final(out, ctx) : hash_cryptoapi_final(out, ctx);
|
319
323
|
}
|
320
324
|
|
321
325
|
void git_hash_sha1_ctx_cleanup(git_hash_sha1_ctx *ctx)
|
322
326
|
{
|
323
|
-
|
324
|
-
|
325
|
-
if (ctx->type == CNG)
|
327
|
+
if (!ctx)
|
328
|
+
return;
|
329
|
+
else if (ctx->type == CNG)
|
326
330
|
hash_ctx_cng_cleanup(ctx);
|
327
331
|
else if(ctx->type == CRYPTOAPI)
|
328
332
|
hash_ctx_cryptoapi_cleanup(ctx);
|
@@ -26,6 +26,8 @@ typedef struct git_hash_sha1_ctx git_hash_sha1_ctx;
|
|
26
26
|
# include "sha1/generic.h"
|
27
27
|
#endif
|
28
28
|
|
29
|
+
#define GIT_HASH_SHA1_SIZE 20
|
30
|
+
|
29
31
|
int git_hash_sha1_global_init(void);
|
30
32
|
|
31
33
|
int git_hash_sha1_ctx_init(git_hash_sha1_ctx *ctx);
|
@@ -33,6 +35,6 @@ void git_hash_sha1_ctx_cleanup(git_hash_sha1_ctx *ctx);
|
|
33
35
|
|
34
36
|
int git_hash_sha1_init(git_hash_sha1_ctx *c);
|
35
37
|
int git_hash_sha1_update(git_hash_sha1_ctx *c, const void *data, size_t len);
|
36
|
-
int git_hash_sha1_final(
|
38
|
+
int git_hash_sha1_final(unsigned char *out, git_hash_sha1_ctx *c);
|
37
39
|
|
38
40
|
#endif
|
data/vendor/libgit2/src/hash.c
CHANGED
@@ -12,85 +12,104 @@ int git_hash_global_init(void)
|
|
12
12
|
return git_hash_sha1_global_init();
|
13
13
|
}
|
14
14
|
|
15
|
-
int git_hash_ctx_init(git_hash_ctx *ctx)
|
15
|
+
int git_hash_ctx_init(git_hash_ctx *ctx, git_hash_algorithm_t algorithm)
|
16
16
|
{
|
17
17
|
int error;
|
18
18
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
19
|
+
switch (algorithm) {
|
20
|
+
case GIT_HASH_ALGORITHM_SHA1:
|
21
|
+
error = git_hash_sha1_ctx_init(&ctx->ctx.sha1);
|
22
|
+
break;
|
23
|
+
default:
|
24
|
+
git_error_set(GIT_ERROR_INTERNAL, "unknown hash algorithm");
|
25
|
+
error = -1;
|
26
|
+
}
|
23
27
|
|
24
|
-
|
28
|
+
ctx->algorithm = algorithm;
|
29
|
+
return error;
|
25
30
|
}
|
26
31
|
|
27
32
|
void git_hash_ctx_cleanup(git_hash_ctx *ctx)
|
28
33
|
{
|
29
|
-
switch (ctx->
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
34
|
+
switch (ctx->algorithm) {
|
35
|
+
case GIT_HASH_ALGORITHM_SHA1:
|
36
|
+
git_hash_sha1_ctx_cleanup(&ctx->ctx.sha1);
|
37
|
+
return;
|
38
|
+
default:
|
39
|
+
/* unreachable */ ;
|
35
40
|
}
|
36
41
|
}
|
37
42
|
|
38
43
|
int git_hash_init(git_hash_ctx *ctx)
|
39
44
|
{
|
40
|
-
switch (ctx->
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
return -1;
|
45
|
+
switch (ctx->algorithm) {
|
46
|
+
case GIT_HASH_ALGORITHM_SHA1:
|
47
|
+
return git_hash_sha1_init(&ctx->ctx.sha1);
|
48
|
+
default:
|
49
|
+
/* unreachable */ ;
|
46
50
|
}
|
51
|
+
|
52
|
+
git_error_set(GIT_ERROR_INTERNAL, "unknown hash algorithm");
|
53
|
+
return -1;
|
47
54
|
}
|
48
55
|
|
49
56
|
int git_hash_update(git_hash_ctx *ctx, const void *data, size_t len)
|
50
57
|
{
|
51
|
-
switch (ctx->
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
return -1;
|
58
|
+
switch (ctx->algorithm) {
|
59
|
+
case GIT_HASH_ALGORITHM_SHA1:
|
60
|
+
return git_hash_sha1_update(&ctx->ctx.sha1, data, len);
|
61
|
+
default:
|
62
|
+
/* unreachable */ ;
|
57
63
|
}
|
64
|
+
|
65
|
+
git_error_set(GIT_ERROR_INTERNAL, "unknown hash algorithm");
|
66
|
+
return -1;
|
58
67
|
}
|
59
68
|
|
60
|
-
int git_hash_final(
|
69
|
+
int git_hash_final(unsigned char *out, git_hash_ctx *ctx)
|
61
70
|
{
|
62
|
-
switch (ctx->
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
return -1;
|
71
|
+
switch (ctx->algorithm) {
|
72
|
+
case GIT_HASH_ALGORITHM_SHA1:
|
73
|
+
return git_hash_sha1_final(out, &ctx->ctx.sha1);
|
74
|
+
default:
|
75
|
+
/* unreachable */ ;
|
68
76
|
}
|
77
|
+
|
78
|
+
git_error_set(GIT_ERROR_INTERNAL, "unknown hash algorithm");
|
79
|
+
return -1;
|
69
80
|
}
|
70
81
|
|
71
|
-
int git_hash_buf(
|
82
|
+
int git_hash_buf(
|
83
|
+
unsigned char *out,
|
84
|
+
const void *data,
|
85
|
+
size_t len,
|
86
|
+
git_hash_algorithm_t algorithm)
|
72
87
|
{
|
73
88
|
git_hash_ctx ctx;
|
74
89
|
int error = 0;
|
75
90
|
|
76
|
-
if (git_hash_ctx_init(&ctx) < 0)
|
91
|
+
if (git_hash_ctx_init(&ctx, algorithm) < 0)
|
77
92
|
return -1;
|
78
93
|
|
79
94
|
if ((error = git_hash_update(&ctx, data, len)) >= 0)
|
80
95
|
error = git_hash_final(out, &ctx);
|
81
96
|
|
82
97
|
git_hash_ctx_cleanup(&ctx);
|
83
|
-
|
98
|
+
|
84
99
|
return error;
|
85
100
|
}
|
86
101
|
|
87
|
-
int git_hash_vec(
|
102
|
+
int git_hash_vec(
|
103
|
+
unsigned char *out,
|
104
|
+
git_str_vec *vec,
|
105
|
+
size_t n,
|
106
|
+
git_hash_algorithm_t algorithm)
|
88
107
|
{
|
89
108
|
git_hash_ctx ctx;
|
90
109
|
size_t i;
|
91
110
|
int error = 0;
|
92
111
|
|
93
|
-
if (git_hash_ctx_init(&ctx) < 0)
|
112
|
+
if (git_hash_ctx_init(&ctx, algorithm) < 0)
|
94
113
|
return -1;
|
95
114
|
|
96
115
|
for (i = 0; i < n; i++) {
|
@@ -105,3 +124,19 @@ done:
|
|
105
124
|
|
106
125
|
return error;
|
107
126
|
}
|
127
|
+
|
128
|
+
int git_hash_fmt(char *out, unsigned char *hash, size_t hash_len)
|
129
|
+
{
|
130
|
+
static char hex[] = "0123456789abcdef";
|
131
|
+
char *str = out;
|
132
|
+
size_t i;
|
133
|
+
|
134
|
+
for (i = 0; i < hash_len; i++) {
|
135
|
+
*str++ = hex[hash[i] >> 4];
|
136
|
+
*str++ = hex[hash[i] & 0x0f];
|
137
|
+
}
|
138
|
+
|
139
|
+
*str++ = '\0';
|
140
|
+
|
141
|
+
return 0;
|
142
|
+
}
|
data/vendor/libgit2/src/hash.h
CHANGED
@@ -10,37 +10,37 @@
|
|
10
10
|
|
11
11
|
#include "common.h"
|
12
12
|
|
13
|
-
#include "
|
13
|
+
#include "hash/sha1.h"
|
14
14
|
|
15
15
|
typedef struct {
|
16
16
|
void *data;
|
17
17
|
size_t len;
|
18
|
-
}
|
18
|
+
} git_str_vec;
|
19
19
|
|
20
20
|
typedef enum {
|
21
|
-
|
22
|
-
|
23
|
-
}
|
24
|
-
|
25
|
-
#include "hash/sha1.h"
|
21
|
+
GIT_HASH_ALGORITHM_NONE = 0,
|
22
|
+
GIT_HASH_ALGORITHM_SHA1
|
23
|
+
} git_hash_algorithm_t;
|
26
24
|
|
27
25
|
typedef struct git_hash_ctx {
|
28
26
|
union {
|
29
27
|
git_hash_sha1_ctx sha1;
|
30
|
-
};
|
31
|
-
|
28
|
+
} ctx;
|
29
|
+
git_hash_algorithm_t algorithm;
|
32
30
|
} git_hash_ctx;
|
33
31
|
|
34
32
|
int git_hash_global_init(void);
|
35
33
|
|
36
|
-
int git_hash_ctx_init(git_hash_ctx *ctx);
|
34
|
+
int git_hash_ctx_init(git_hash_ctx *ctx, git_hash_algorithm_t algorithm);
|
37
35
|
void git_hash_ctx_cleanup(git_hash_ctx *ctx);
|
38
36
|
|
39
37
|
int git_hash_init(git_hash_ctx *c);
|
40
38
|
int git_hash_update(git_hash_ctx *c, const void *data, size_t len);
|
41
|
-
int git_hash_final(
|
39
|
+
int git_hash_final(unsigned char *out, git_hash_ctx *c);
|
40
|
+
|
41
|
+
int git_hash_buf(unsigned char *out, const void *data, size_t len, git_hash_algorithm_t algorithm);
|
42
|
+
int git_hash_vec(unsigned char *out, git_str_vec *vec, size_t n, git_hash_algorithm_t algorithm);
|
42
43
|
|
43
|
-
int
|
44
|
-
int git_hash_vec(git_oid *out, git_buf_vec *vec, size_t n);
|
44
|
+
int git_hash_fmt(char *out, unsigned char *hash, size_t hash_len);
|
45
45
|
|
46
46
|
#endif
|