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/index.h
CHANGED
@@ -27,13 +27,13 @@ struct git_index {
|
|
27
27
|
|
28
28
|
char *index_file_path;
|
29
29
|
git_futils_filestamp stamp;
|
30
|
-
|
30
|
+
unsigned char checksum[GIT_HASH_SHA1_SIZE];
|
31
31
|
|
32
32
|
git_vector entries;
|
33
33
|
git_idxmap *entries_map;
|
34
34
|
|
35
35
|
git_vector deleted; /* deleted entries if readers > 0 */
|
36
|
-
|
36
|
+
git_atomic32 readers; /* number of active iterators */
|
37
37
|
|
38
38
|
unsigned int on_disk:1;
|
39
39
|
unsigned int ignore_case:1;
|
@@ -133,10 +133,13 @@ extern unsigned int git_index__create_mode(unsigned int mode);
|
|
133
133
|
|
134
134
|
GIT_INLINE(const git_futils_filestamp *) git_index__filestamp(git_index *index)
|
135
135
|
{
|
136
|
-
|
136
|
+
return &index->stamp;
|
137
137
|
}
|
138
138
|
|
139
|
-
|
139
|
+
GIT_INLINE(unsigned char *) git_index__checksum(git_index *index)
|
140
|
+
{
|
141
|
+
return index->checksum;
|
142
|
+
}
|
140
143
|
|
141
144
|
/* Copy the current entries vector *and* increment the index refcount.
|
142
145
|
* Call `git_index__release_snapshot` when done.
|
@@ -24,8 +24,6 @@
|
|
24
24
|
#include "zstream.h"
|
25
25
|
#include "object.h"
|
26
26
|
|
27
|
-
extern git_mutex git__mwindow_mutex;
|
28
|
-
|
29
27
|
size_t git_indexer__max_objects = UINT32_MAX;
|
30
28
|
|
31
29
|
#define UINT31_MAX (0x7FFFFFFF)
|
@@ -50,14 +48,15 @@ struct git_indexer {
|
|
50
48
|
off64_t off;
|
51
49
|
off64_t entry_start;
|
52
50
|
git_object_t entry_type;
|
53
|
-
|
51
|
+
git_str entry_data;
|
54
52
|
git_packfile_stream stream;
|
55
53
|
size_t nr_objects;
|
56
54
|
git_vector objects;
|
57
55
|
git_vector deltas;
|
58
56
|
unsigned int fanout[256];
|
59
57
|
git_hash_ctx hash_ctx;
|
60
|
-
|
58
|
+
unsigned char checksum[GIT_HASH_SHA1_SIZE];
|
59
|
+
char name[(GIT_HASH_SHA1_SIZE * 2) + 1];
|
61
60
|
git_indexer_progress_cb progress_cb;
|
62
61
|
void *progress_payload;
|
63
62
|
char objbuf[8*1024];
|
@@ -78,9 +77,16 @@ struct delta_info {
|
|
78
77
|
off64_t delta_off;
|
79
78
|
};
|
80
79
|
|
80
|
+
#ifndef GIT_DEPRECATE_HARD
|
81
81
|
const git_oid *git_indexer_hash(const git_indexer *idx)
|
82
82
|
{
|
83
|
-
return
|
83
|
+
return (git_oid *)idx->checksum;
|
84
|
+
}
|
85
|
+
#endif
|
86
|
+
|
87
|
+
const char *git_indexer_name(const git_indexer *idx)
|
88
|
+
{
|
89
|
+
return idx->name;
|
84
90
|
}
|
85
91
|
|
86
92
|
static int parse_header(struct git_pack_header *hdr, struct git_pack_file *pack)
|
@@ -139,7 +145,7 @@ int git_indexer_new(
|
|
139
145
|
{
|
140
146
|
git_indexer_options opts = GIT_INDEXER_OPTIONS_INIT;
|
141
147
|
git_indexer *idx;
|
142
|
-
|
148
|
+
git_str path = GIT_STR_INIT, tmp_path = GIT_STR_INIT;
|
143
149
|
static const char suff[] = "/pack";
|
144
150
|
int error, fd = -1;
|
145
151
|
|
@@ -152,10 +158,10 @@ int git_indexer_new(
|
|
152
158
|
idx->progress_cb = opts.progress_cb;
|
153
159
|
idx->progress_payload = opts.progress_cb_payload;
|
154
160
|
idx->mode = mode ? mode : GIT_PACK_FILE_MODE;
|
155
|
-
|
161
|
+
git_str_init(&idx->entry_data, 0);
|
156
162
|
|
157
|
-
if ((error = git_hash_ctx_init(&idx->hash_ctx)) < 0 ||
|
158
|
-
(error = git_hash_ctx_init(&idx->trailer)) < 0 ||
|
163
|
+
if ((error = git_hash_ctx_init(&idx->hash_ctx, GIT_HASH_ALGORITHM_SHA1)) < 0 ||
|
164
|
+
(error = git_hash_ctx_init(&idx->trailer, GIT_HASH_ALGORITHM_SHA1)) < 0 ||
|
159
165
|
(error = git_oidmap_new(&idx->expected_oids)) < 0)
|
160
166
|
goto cleanup;
|
161
167
|
|
@@ -164,17 +170,17 @@ int git_indexer_new(
|
|
164
170
|
if (git_repository__fsync_gitdir)
|
165
171
|
idx->do_fsync = 1;
|
166
172
|
|
167
|
-
error =
|
173
|
+
error = git_str_joinpath(&path, prefix, suff);
|
168
174
|
if (error < 0)
|
169
175
|
goto cleanup;
|
170
176
|
|
171
|
-
fd = git_futils_mktmp(&tmp_path,
|
172
|
-
|
177
|
+
fd = git_futils_mktmp(&tmp_path, git_str_cstr(&path), idx->mode);
|
178
|
+
git_str_dispose(&path);
|
173
179
|
if (fd < 0)
|
174
180
|
goto cleanup;
|
175
181
|
|
176
|
-
error = git_packfile_alloc(&idx->pack,
|
177
|
-
|
182
|
+
error = git_packfile_alloc(&idx->pack, git_str_cstr(&tmp_path));
|
183
|
+
git_str_dispose(&tmp_path);
|
178
184
|
|
179
185
|
if (error < 0)
|
180
186
|
goto cleanup;
|
@@ -190,14 +196,14 @@ cleanup:
|
|
190
196
|
if (fd != -1)
|
191
197
|
p_close(fd);
|
192
198
|
|
193
|
-
if (
|
194
|
-
p_unlink(
|
199
|
+
if (git_str_len(&tmp_path) > 0)
|
200
|
+
p_unlink(git_str_cstr(&tmp_path));
|
195
201
|
|
196
202
|
if (idx->pack != NULL)
|
197
203
|
p_unlink(idx->pack->pack_name);
|
198
204
|
|
199
|
-
|
200
|
-
|
205
|
+
git_str_dispose(&path);
|
206
|
+
git_str_dispose(&tmp_path);
|
201
207
|
git__free(idx);
|
202
208
|
return -1;
|
203
209
|
}
|
@@ -239,14 +245,15 @@ static int hash_object_stream(git_indexer*idx, git_packfile_stream *stream)
|
|
239
245
|
{
|
240
246
|
ssize_t read;
|
241
247
|
|
242
|
-
|
248
|
+
GIT_ASSERT_ARG(idx);
|
249
|
+
GIT_ASSERT_ARG(stream);
|
243
250
|
|
244
251
|
do {
|
245
252
|
if ((read = git_packfile_stream_read(stream, idx->objbuf, sizeof(idx->objbuf))) < 0)
|
246
253
|
break;
|
247
254
|
|
248
255
|
if (idx->do_verify)
|
249
|
-
|
256
|
+
git_str_put(&idx->entry_data, idx->objbuf, read);
|
250
257
|
|
251
258
|
git_hash_update(&idx->hash_ctx, idx->objbuf, read);
|
252
259
|
} while (read > 0);
|
@@ -262,7 +269,7 @@ static int advance_delta_offset(git_indexer *idx, git_object_t type)
|
|
262
269
|
{
|
263
270
|
git_mwindow *w = NULL;
|
264
271
|
|
265
|
-
|
272
|
+
GIT_ASSERT_ARG(type == GIT_OBJECT_REF_DELTA || type == GIT_OBJECT_OFS_DELTA);
|
266
273
|
|
267
274
|
if (type == GIT_OBJECT_REF_DELTA) {
|
268
275
|
idx->off += GIT_OID_RAWSZ;
|
@@ -282,7 +289,7 @@ static int read_object_stream(git_indexer *idx, git_packfile_stream *stream)
|
|
282
289
|
{
|
283
290
|
ssize_t read;
|
284
291
|
|
285
|
-
|
292
|
+
GIT_ASSERT_ARG(stream);
|
286
293
|
|
287
294
|
do {
|
288
295
|
read = git_packfile_stream_read(stream, idx->objbuf, sizeof(idx->objbuf));
|
@@ -341,7 +348,7 @@ static int check_object_connectivity(git_indexer *idx, const git_rawobj *obj)
|
|
341
348
|
{
|
342
349
|
git_object *object;
|
343
350
|
git_oid *expected;
|
344
|
-
int error;
|
351
|
+
int error = 0;
|
345
352
|
|
346
353
|
if (obj->type != GIT_OBJECT_BLOB &&
|
347
354
|
obj->type != GIT_OBJECT_TREE &&
|
@@ -349,8 +356,14 @@ static int check_object_connectivity(git_indexer *idx, const git_rawobj *obj)
|
|
349
356
|
obj->type != GIT_OBJECT_TAG)
|
350
357
|
return 0;
|
351
358
|
|
352
|
-
if (
|
359
|
+
if (git_object__from_raw(&object, obj->data, obj->len, obj->type) < 0) {
|
360
|
+
/*
|
361
|
+
* parse_raw returns EINVALID on invalid data; downgrade
|
362
|
+
* that to a normal -1 error code.
|
363
|
+
*/
|
364
|
+
error = -1;
|
353
365
|
goto out;
|
366
|
+
}
|
354
367
|
|
355
368
|
if ((expected = git_oidmap_get(idx->expected_oids, &object->cached.oid)) != NULL) {
|
356
369
|
git_oidmap_delete(idx->expected_oids, &object->cached.oid);
|
@@ -427,7 +440,7 @@ static int store_object(git_indexer *idx)
|
|
427
440
|
pentry = git__calloc(1, sizeof(struct git_pack_entry));
|
428
441
|
GIT_ERROR_CHECK_ALLOC(pentry);
|
429
442
|
|
430
|
-
if (git_hash_final(
|
443
|
+
if (git_hash_final(oid.id, &idx->hash_ctx)) {
|
431
444
|
git__free(pentry);
|
432
445
|
goto on_error;
|
433
446
|
}
|
@@ -602,9 +615,10 @@ static void hash_partially(git_indexer *idx, const uint8_t *data, size_t size)
|
|
602
615
|
idx->inbuf_len += size - to_expell;
|
603
616
|
}
|
604
617
|
|
618
|
+
#if defined(NO_MMAP) || !defined(GIT_WIN32)
|
619
|
+
|
605
620
|
static int write_at(git_indexer *idx, const void *data, off64_t offset, size_t size)
|
606
621
|
{
|
607
|
-
#ifdef NO_MMAP
|
608
622
|
size_t remaining_size = size;
|
609
623
|
const char *ptr = (const char *)data;
|
610
624
|
|
@@ -620,7 +634,31 @@ static int write_at(git_indexer *idx, const void *data, off64_t offset, size_t s
|
|
620
634
|
offset += nb;
|
621
635
|
remaining_size -= nb;
|
622
636
|
}
|
637
|
+
|
638
|
+
return 0;
|
639
|
+
}
|
640
|
+
|
641
|
+
static int append_to_pack(git_indexer *idx, const void *data, size_t size)
|
642
|
+
{
|
643
|
+
if (write_at(idx, data, idx->pack->mwf.size, size) < 0) {
|
644
|
+
git_error_set(GIT_ERROR_OS, "cannot extend packfile '%s'", idx->pack->pack_name);
|
645
|
+
return -1;
|
646
|
+
}
|
647
|
+
|
648
|
+
return 0;
|
649
|
+
}
|
650
|
+
|
623
651
|
#else
|
652
|
+
|
653
|
+
/*
|
654
|
+
* Windows may keep different views to a networked file for the mmap- and
|
655
|
+
* open-accessed versions of a file, so any writes done through
|
656
|
+
* `write(2)`/`pwrite(2)` may not be reflected on the data that `mmap(2)` is
|
657
|
+
* able to read.
|
658
|
+
*/
|
659
|
+
|
660
|
+
static int write_at(git_indexer *idx, const void *data, off64_t offset, size_t size)
|
661
|
+
{
|
624
662
|
git_file fd = idx->pack->mwf.fd;
|
625
663
|
size_t mmap_alignment;
|
626
664
|
size_t page_offset;
|
@@ -629,7 +667,8 @@ static int write_at(git_indexer *idx, const void *data, off64_t offset, size_t s
|
|
629
667
|
git_map map;
|
630
668
|
int error;
|
631
669
|
|
632
|
-
|
670
|
+
GIT_ASSERT_ARG(data);
|
671
|
+
GIT_ASSERT_ARG(size);
|
633
672
|
|
634
673
|
if ((error = git__mmap_alignment(&mmap_alignment)) < 0)
|
635
674
|
return error;
|
@@ -644,7 +683,6 @@ static int write_at(git_indexer *idx, const void *data, off64_t offset, size_t s
|
|
644
683
|
map_data = (unsigned char *)map.data;
|
645
684
|
memcpy(map_data + page_offset, data, size);
|
646
685
|
p_munmap(&map);
|
647
|
-
#endif
|
648
686
|
|
649
687
|
return 0;
|
650
688
|
}
|
@@ -680,6 +718,8 @@ static int append_to_pack(git_indexer *idx, const void *data, size_t size)
|
|
680
718
|
return write_at(idx, data, idx->pack->mwf.size, size);
|
681
719
|
}
|
682
720
|
|
721
|
+
#endif
|
722
|
+
|
683
723
|
static int read_stream_object(git_indexer *idx, git_indexer_progress *stats)
|
684
724
|
{
|
685
725
|
git_packfile_stream *stream = &idx->stream;
|
@@ -693,7 +733,7 @@ static int read_stream_object(git_indexer *idx, git_indexer_progress *stats)
|
|
693
733
|
return GIT_EBUFS;
|
694
734
|
|
695
735
|
if (!idx->have_stream) {
|
696
|
-
error = git_packfile_unpack_header(&entry_size, &type,
|
736
|
+
error = git_packfile_unpack_header(&entry_size, &type, idx->pack, &w, &idx->off);
|
697
737
|
if (error == GIT_EBUFS) {
|
698
738
|
idx->off = entry_start;
|
699
739
|
return error;
|
@@ -704,7 +744,7 @@ static int read_stream_object(git_indexer *idx, git_indexer_progress *stats)
|
|
704
744
|
git_mwindow_close(&w);
|
705
745
|
idx->entry_start = entry_start;
|
706
746
|
git_hash_init(&idx->hash_ctx);
|
707
|
-
|
747
|
+
git_str_clear(&idx->entry_data);
|
708
748
|
|
709
749
|
if (type == GIT_OBJECT_REF_DELTA || type == GIT_OBJECT_OFS_DELTA) {
|
710
750
|
error = advance_delta_offset(idx, type);
|
@@ -775,7 +815,9 @@ int git_indexer_append(git_indexer *idx, const void *data, size_t size, git_inde
|
|
775
815
|
struct git_pack_header *hdr = &idx->hdr;
|
776
816
|
git_mwindow_file *mwf = &idx->pack->mwf;
|
777
817
|
|
778
|
-
|
818
|
+
GIT_ASSERT_ARG(idx);
|
819
|
+
GIT_ASSERT_ARG(data);
|
820
|
+
GIT_ASSERT_ARG(stats);
|
779
821
|
|
780
822
|
if ((error = append_to_pack(idx, data, size)) < 0)
|
781
823
|
return error;
|
@@ -829,7 +871,8 @@ int git_indexer_append(git_indexer *idx, const void *data, size_t size, git_inde
|
|
829
871
|
/* Now that we have data in the pack, let's try to parse it */
|
830
872
|
|
831
873
|
/* As the file grows any windows we try to use will be out of date */
|
832
|
-
git_mwindow_free_all(mwf)
|
874
|
+
if ((error = git_mwindow_free_all(mwf)) < 0)
|
875
|
+
goto on_error;
|
833
876
|
|
834
877
|
while (stats->indexed_objects < idx->nr_objects) {
|
835
878
|
if ((error = read_stream_object(idx, stats)) != 0) {
|
@@ -847,7 +890,7 @@ on_error:
|
|
847
890
|
return error;
|
848
891
|
}
|
849
892
|
|
850
|
-
static int index_path(
|
893
|
+
static int index_path(git_str *path, git_indexer *idx, const char *suffix)
|
851
894
|
{
|
852
895
|
const char prefix[] = "pack-";
|
853
896
|
size_t slash = (size_t)path->size;
|
@@ -856,48 +899,50 @@ static int index_path(git_buf *path, git_indexer *idx, const char *suffix)
|
|
856
899
|
while (slash > 0 && path->ptr[slash - 1] != '/')
|
857
900
|
slash--;
|
858
901
|
|
859
|
-
if (
|
902
|
+
if (git_str_grow(path, slash + 1 + strlen(prefix) +
|
860
903
|
GIT_OID_HEXSZ + strlen(suffix) + 1) < 0)
|
861
904
|
return -1;
|
862
905
|
|
863
|
-
|
864
|
-
|
865
|
-
|
866
|
-
path
|
867
|
-
git_buf_puts(path, suffix);
|
906
|
+
git_str_truncate(path, slash);
|
907
|
+
git_str_puts(path, prefix);
|
908
|
+
git_str_puts(path, idx->name);
|
909
|
+
git_str_puts(path, suffix);
|
868
910
|
|
869
|
-
return
|
911
|
+
return git_str_oom(path) ? -1 : 0;
|
870
912
|
}
|
871
913
|
|
872
914
|
/**
|
873
915
|
* Rewind the packfile by the trailer, as we might need to fix the
|
874
916
|
* packfile by injecting objects at the tail and must overwrite it.
|
875
917
|
*/
|
876
|
-
static
|
918
|
+
static int seek_back_trailer(git_indexer *idx)
|
877
919
|
{
|
878
920
|
idx->pack->mwf.size -= GIT_OID_RAWSZ;
|
879
|
-
git_mwindow_free_all(&idx->pack->mwf);
|
921
|
+
return git_mwindow_free_all(&idx->pack->mwf);
|
880
922
|
}
|
881
923
|
|
882
924
|
static int inject_object(git_indexer *idx, git_oid *id)
|
883
925
|
{
|
884
|
-
git_odb_object *obj;
|
885
|
-
struct entry *entry;
|
926
|
+
git_odb_object *obj = NULL;
|
927
|
+
struct entry *entry = NULL;
|
886
928
|
struct git_pack_entry *pentry = NULL;
|
887
|
-
|
929
|
+
unsigned char empty_checksum[GIT_HASH_SHA1_SIZE] = {0};
|
888
930
|
unsigned char hdr[64];
|
889
|
-
|
931
|
+
git_str buf = GIT_STR_INIT;
|
890
932
|
off64_t entry_start;
|
891
933
|
const void *data;
|
892
934
|
size_t len, hdr_len;
|
935
|
+
size_t checksum_size = GIT_HASH_SHA1_SIZE;
|
893
936
|
int error;
|
894
937
|
|
895
|
-
seek_back_trailer(idx)
|
938
|
+
if ((error = seek_back_trailer(idx)) < 0)
|
939
|
+
goto cleanup;
|
940
|
+
|
896
941
|
entry_start = idx->pack->mwf.size;
|
897
942
|
|
898
|
-
if (git_odb_read(&obj, idx->odb, id) < 0) {
|
943
|
+
if ((error = git_odb_read(&obj, idx->odb, id)) < 0) {
|
899
944
|
git_error_set(GIT_ERROR_INDEXER, "missing delta bases");
|
900
|
-
|
945
|
+
goto cleanup;
|
901
946
|
}
|
902
947
|
|
903
948
|
data = git_odb_object_data(obj);
|
@@ -909,8 +954,8 @@ static int inject_object(git_indexer *idx, git_oid *id)
|
|
909
954
|
entry->crc = crc32(0L, Z_NULL, 0);
|
910
955
|
|
911
956
|
/* Write out the object header */
|
912
|
-
|
913
|
-
|
957
|
+
if ((error = git_packfile__object_header(&hdr_len, hdr, len, git_odb_object_type(obj))) < 0 ||
|
958
|
+
(error = append_to_pack(idx, hdr, hdr_len)) < 0)
|
914
959
|
goto cleanup;
|
915
960
|
|
916
961
|
idx->pack->mwf.size += hdr_len;
|
@@ -925,11 +970,11 @@ static int inject_object(git_indexer *idx, git_oid *id)
|
|
925
970
|
|
926
971
|
idx->pack->mwf.size += buf.size;
|
927
972
|
entry->crc = htonl(crc32(entry->crc, (unsigned char *)buf.ptr, (uInt)buf.size));
|
928
|
-
|
973
|
+
git_str_dispose(&buf);
|
929
974
|
|
930
975
|
/* Write a fake trailer so the pack functions play ball */
|
931
976
|
|
932
|
-
if ((error = append_to_pack(idx,
|
977
|
+
if ((error = append_to_pack(idx, empty_checksum, checksum_size)) < 0)
|
933
978
|
goto cleanup;
|
934
979
|
|
935
980
|
idx->pack->mwf.size += GIT_OID_RAWSZ;
|
@@ -966,7 +1011,7 @@ static int fix_thin_pack(git_indexer *idx, git_indexer_progress *stats)
|
|
966
1011
|
unsigned int left = 0;
|
967
1012
|
git_oid base;
|
968
1013
|
|
969
|
-
|
1014
|
+
GIT_ASSERT(git_vector_length(&idx->deltas) > 0);
|
970
1015
|
|
971
1016
|
if (idx->odb == NULL) {
|
972
1017
|
git_error_set(GIT_ERROR_INDEXER, "cannot fix a thin pack without an ODB");
|
@@ -979,7 +1024,7 @@ static int fix_thin_pack(git_indexer *idx, git_indexer_progress *stats)
|
|
979
1024
|
continue;
|
980
1025
|
|
981
1026
|
curpos = delta->delta_off;
|
982
|
-
error = git_packfile_unpack_header(&size, &type,
|
1027
|
+
error = git_packfile_unpack_header(&size, &type, idx->pack, &w, &curpos);
|
983
1028
|
if (error < 0)
|
984
1029
|
return error;
|
985
1030
|
|
@@ -1086,7 +1131,7 @@ static int update_header_and_rehash(git_indexer *idx, git_indexer_progress *stat
|
|
1086
1131
|
git_hash_init(&idx->trailer);
|
1087
1132
|
|
1088
1133
|
|
1089
|
-
/* Update the header to include the
|
1134
|
+
/* Update the header to include the number of local objects we injected */
|
1090
1135
|
idx->hdr.hdr_entries = htonl(stats->total_objects + stats->local_objects);
|
1091
1136
|
if (write_at(idx, &idx->hdr, 0, sizeof(struct git_pack_header)) < 0)
|
1092
1137
|
return -1;
|
@@ -1097,7 +1142,9 @@ static int update_header_and_rehash(git_indexer *idx, git_indexer_progress *stat
|
|
1097
1142
|
* hash_partially() keep the existing trailer out of the
|
1098
1143
|
* calculation.
|
1099
1144
|
*/
|
1100
|
-
git_mwindow_free_all(mwf)
|
1145
|
+
if (git_mwindow_free_all(mwf) < 0)
|
1146
|
+
return -1;
|
1147
|
+
|
1101
1148
|
idx->inbuf_len = 0;
|
1102
1149
|
while (hashed < mwf->size) {
|
1103
1150
|
ptr = git_mwindow_open(mwf, &w, hashed, chunk, &left);
|
@@ -1119,11 +1166,13 @@ int git_indexer_commit(git_indexer *idx, git_indexer_progress *stats)
|
|
1119
1166
|
unsigned int i, long_offsets = 0, left;
|
1120
1167
|
int error;
|
1121
1168
|
struct git_pack_idx_header hdr;
|
1122
|
-
|
1169
|
+
git_str filename = GIT_STR_INIT;
|
1123
1170
|
struct entry *entry;
|
1124
|
-
|
1171
|
+
unsigned char checksum[GIT_HASH_SHA1_SIZE];
|
1125
1172
|
git_filebuf index_file = {0};
|
1126
1173
|
void *packfile_trailer;
|
1174
|
+
size_t checksum_size = GIT_HASH_SHA1_SIZE;
|
1175
|
+
bool mismatch;
|
1127
1176
|
|
1128
1177
|
if (!idx->parsed_header) {
|
1129
1178
|
git_error_set(GIT_ERROR_INDEXER, "incomplete pack header");
|
@@ -1131,27 +1180,27 @@ int git_indexer_commit(git_indexer *idx, git_indexer_progress *stats)
|
|
1131
1180
|
}
|
1132
1181
|
|
1133
1182
|
/* Test for this before resolve_deltas(), as it plays with idx->off */
|
1134
|
-
if (idx->off +
|
1183
|
+
if (idx->off + (ssize_t)checksum_size < idx->pack->mwf.size) {
|
1135
1184
|
git_error_set(GIT_ERROR_INDEXER, "unexpected data at the end of the pack");
|
1136
1185
|
return -1;
|
1137
1186
|
}
|
1138
|
-
if (idx->off +
|
1187
|
+
if (idx->off + (ssize_t)checksum_size > idx->pack->mwf.size) {
|
1139
1188
|
git_error_set(GIT_ERROR_INDEXER, "missing trailer at the end of the pack");
|
1140
1189
|
return -1;
|
1141
1190
|
}
|
1142
1191
|
|
1143
|
-
packfile_trailer = git_mwindow_open(&idx->pack->mwf, &w, idx->pack->mwf.size -
|
1192
|
+
packfile_trailer = git_mwindow_open(&idx->pack->mwf, &w, idx->pack->mwf.size - checksum_size, checksum_size, &left);
|
1144
1193
|
if (packfile_trailer == NULL) {
|
1145
1194
|
git_mwindow_close(&w);
|
1146
1195
|
goto on_error;
|
1147
1196
|
}
|
1148
1197
|
|
1149
1198
|
/* Compare the packfile trailer as it was sent to us and what we calculated */
|
1150
|
-
|
1199
|
+
git_hash_final(checksum, &idx->trailer);
|
1200
|
+
mismatch = !!memcmp(checksum, packfile_trailer, checksum_size);
|
1151
1201
|
git_mwindow_close(&w);
|
1152
1202
|
|
1153
|
-
|
1154
|
-
if (git_oid_cmp(&file_hash, &trailer_hash)) {
|
1203
|
+
if (mismatch) {
|
1155
1204
|
git_error_set(GIT_ERROR_INDEXER, "packfile trailer mismatch");
|
1156
1205
|
return -1;
|
1157
1206
|
}
|
@@ -1171,8 +1220,8 @@ int git_indexer_commit(git_indexer *idx, git_indexer_progress *stats)
|
|
1171
1220
|
if (update_header_and_rehash(idx, stats) < 0)
|
1172
1221
|
return -1;
|
1173
1222
|
|
1174
|
-
git_hash_final(
|
1175
|
-
write_at(idx,
|
1223
|
+
git_hash_final(checksum, &idx->trailer);
|
1224
|
+
write_at(idx, checksum, idx->pack->mwf.size - checksum_size, checksum_size);
|
1176
1225
|
}
|
1177
1226
|
|
1178
1227
|
/*
|
@@ -1191,12 +1240,14 @@ int git_indexer_commit(git_indexer *idx, git_indexer_progress *stats)
|
|
1191
1240
|
|
1192
1241
|
/* Use the trailer hash as the pack file name to ensure
|
1193
1242
|
* files with different contents have different names */
|
1194
|
-
|
1243
|
+
memcpy(idx->checksum, checksum, checksum_size);
|
1244
|
+
if (git_hash_fmt(idx->name, checksum, checksum_size) < 0)
|
1245
|
+
return -1;
|
1195
1246
|
|
1196
|
-
|
1197
|
-
|
1198
|
-
|
1199
|
-
if (
|
1247
|
+
git_str_sets(&filename, idx->pack->pack_name);
|
1248
|
+
git_str_shorten(&filename, strlen("pack"));
|
1249
|
+
git_str_puts(&filename, "idx");
|
1250
|
+
if (git_str_oom(&filename))
|
1200
1251
|
return -1;
|
1201
1252
|
|
1202
1253
|
if (git_filebuf_open(&index_file, filename.ptr,
|
@@ -1252,14 +1303,14 @@ int git_indexer_commit(git_indexer *idx, git_indexer_progress *stats)
|
|
1252
1303
|
}
|
1253
1304
|
|
1254
1305
|
/* Write out the packfile trailer to the index */
|
1255
|
-
if (git_filebuf_write(&index_file,
|
1306
|
+
if (git_filebuf_write(&index_file, checksum, checksum_size) < 0)
|
1256
1307
|
goto on_error;
|
1257
1308
|
|
1258
1309
|
/* Write out the hash of the idx */
|
1259
|
-
if (git_filebuf_hash(
|
1310
|
+
if (git_filebuf_hash(checksum, &index_file) < 0)
|
1260
1311
|
goto on_error;
|
1261
1312
|
|
1262
|
-
git_filebuf_write(&index_file,
|
1313
|
+
git_filebuf_write(&index_file, checksum, checksum_size);
|
1263
1314
|
|
1264
1315
|
/* Figure out what the final name should be */
|
1265
1316
|
if (index_path(&filename, idx, ".idx") < 0)
|
@@ -1269,13 +1320,22 @@ int git_indexer_commit(git_indexer *idx, git_indexer_progress *stats)
|
|
1269
1320
|
if (git_filebuf_commit_at(&index_file, filename.ptr) < 0)
|
1270
1321
|
goto on_error;
|
1271
1322
|
|
1272
|
-
git_mwindow_free_all(&idx->pack->mwf)
|
1323
|
+
if (git_mwindow_free_all(&idx->pack->mwf) < 0)
|
1324
|
+
goto on_error;
|
1273
1325
|
|
1274
|
-
|
1326
|
+
#if !defined(NO_MMAP) && defined(GIT_WIN32)
|
1327
|
+
/*
|
1328
|
+
* Some non-Windows remote filesystems fail when truncating files if the
|
1329
|
+
* file permissions change after opening the file (done by p_mkstemp).
|
1330
|
+
*
|
1331
|
+
* Truncation is only needed when mmap is used to undo rounding up to next
|
1332
|
+
* page_size in append_to_pack.
|
1333
|
+
*/
|
1275
1334
|
if (p_ftruncate(idx->pack->mwf.fd, idx->pack->mwf.size) < 0) {
|
1276
1335
|
git_error_set(GIT_ERROR_OS, "failed to truncate pack file '%s'", idx->pack->pack_name);
|
1277
1336
|
return -1;
|
1278
1337
|
}
|
1338
|
+
#endif
|
1279
1339
|
|
1280
1340
|
if (idx->do_fsync && p_fsync(idx->pack->mwf.fd) < 0) {
|
1281
1341
|
git_error_set(GIT_ERROR_OS, "failed to fsync packfile");
|
@@ -1294,23 +1354,23 @@ int git_indexer_commit(git_indexer *idx, git_indexer_progress *stats)
|
|
1294
1354
|
goto on_error;
|
1295
1355
|
|
1296
1356
|
/* And don't forget to rename the packfile to its new place. */
|
1297
|
-
if (p_rename(idx->pack->pack_name,
|
1357
|
+
if (p_rename(idx->pack->pack_name, git_str_cstr(&filename)) < 0)
|
1298
1358
|
goto on_error;
|
1299
1359
|
|
1300
1360
|
/* And fsync the parent directory if we're asked to. */
|
1301
1361
|
if (idx->do_fsync &&
|
1302
|
-
git_futils_fsync_parent(
|
1362
|
+
git_futils_fsync_parent(git_str_cstr(&filename)) < 0)
|
1303
1363
|
goto on_error;
|
1304
1364
|
|
1305
1365
|
idx->pack_committed = 1;
|
1306
1366
|
|
1307
|
-
|
1367
|
+
git_str_dispose(&filename);
|
1308
1368
|
return 0;
|
1309
1369
|
|
1310
1370
|
on_error:
|
1311
1371
|
git_mwindow_free_all(&idx->pack->mwf);
|
1312
1372
|
git_filebuf_cleanup(&index_file);
|
1313
|
-
|
1373
|
+
git_str_dispose(&filename);
|
1314
1374
|
return -1;
|
1315
1375
|
}
|
1316
1376
|
|
@@ -1339,13 +1399,7 @@ void git_indexer_free(git_indexer *idx)
|
|
1339
1399
|
|
1340
1400
|
git_vector_free_deep(&idx->deltas);
|
1341
1401
|
|
1342
|
-
|
1343
|
-
if (!idx->pack_committed)
|
1344
|
-
git_packfile_close(idx->pack, true);
|
1345
|
-
|
1346
|
-
git_packfile_free(idx->pack);
|
1347
|
-
git_mutex_unlock(&git__mwindow_mutex);
|
1348
|
-
}
|
1402
|
+
git_packfile_free(idx->pack, !idx->pack_committed);
|
1349
1403
|
|
1350
1404
|
iter = 0;
|
1351
1405
|
while (git_oidmap_iterate((void **) &value, idx->expected_oids, &iter, &key) == 0)
|
@@ -1353,7 +1407,7 @@ void git_indexer_free(git_indexer *idx)
|
|
1353
1407
|
|
1354
1408
|
git_hash_ctx_cleanup(&idx->trailer);
|
1355
1409
|
git_hash_ctx_cleanup(&idx->hash_ctx);
|
1356
|
-
|
1410
|
+
git_str_dispose(&idx->entry_data);
|
1357
1411
|
git_oidmap_free(idx->expected_oids);
|
1358
1412
|
git__free(idx);
|
1359
1413
|
}
|