rugged 1.0.1 → 1.3.0
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/rugged.c +7 -4
- data/ext/rugged/rugged_commit.c +1 -1
- data/ext/rugged/rugged_object.c +1 -1
- data/ext/rugged/rugged_repo.c +3 -3
- data/lib/rugged/commit.rb +16 -2
- data/lib/rugged/repository.rb +2 -2
- data/lib/rugged/version.rb +1 -1
- data/vendor/libgit2/CMakeLists.txt +41 -74
- data/vendor/libgit2/COPYING +109 -1
- data/vendor/libgit2/cmake/{Modules/AddCFlagIfSupported.cmake → AddCFlagIfSupported.cmake} +0 -0
- data/vendor/libgit2/cmake/{Modules/EnableWarnings.cmake → EnableWarnings.cmake} +0 -0
- data/vendor/libgit2/cmake/{Modules/FindCoreFoundation.cmake → FindCoreFoundation.cmake} +0 -0
- data/vendor/libgit2/cmake/{Modules/FindGSSAPI.cmake → FindGSSAPI.cmake} +0 -0
- data/vendor/libgit2/cmake/{Modules/FindGSSFramework.cmake → FindGSSFramework.cmake} +0 -0
- data/vendor/libgit2/cmake/{Modules/FindHTTP_Parser.cmake → FindHTTP_Parser.cmake} +0 -0
- data/vendor/libgit2/cmake/{Modules/FindIconv.cmake → FindIconv.cmake} +0 -0
- data/vendor/libgit2/cmake/FindLibSSH2.cmake +13 -0
- data/vendor/libgit2/cmake/{Modules/FindPCRE.cmake → FindPCRE.cmake} +0 -0
- data/vendor/libgit2/cmake/{Modules/FindPCRE2.cmake → FindPCRE2.cmake} +0 -0
- data/vendor/libgit2/cmake/{Modules/FindPkgLibraries.cmake → FindPkgLibraries.cmake} +0 -0
- data/vendor/libgit2/cmake/{Modules/FindSecurity.cmake → FindSecurity.cmake} +0 -0
- data/vendor/libgit2/cmake/{Modules/FindStatNsec.cmake → FindStatNsec.cmake} +0 -0
- data/vendor/libgit2/cmake/Findfutimens.cmake +14 -0
- data/vendor/libgit2/cmake/{Modules/FindmbedTLS.cmake → FindmbedTLS.cmake} +0 -0
- data/vendor/libgit2/cmake/{Modules/IdeSplitSources.cmake → IdeSplitSources.cmake} +0 -0
- data/vendor/libgit2/cmake/{Modules/PkgBuildConfig.cmake → PkgBuildConfig.cmake} +0 -0
- data/vendor/libgit2/cmake/{Modules/SanitizeBool.cmake → SanitizeBool.cmake} +0 -0
- data/vendor/libgit2/cmake/{Modules/SelectGSSAPI.cmake → SelectGSSAPI.cmake} +18 -26
- data/vendor/libgit2/cmake/{Modules/SelectHTTPSBackend.cmake → SelectHTTPSBackend.cmake} +29 -32
- data/vendor/libgit2/cmake/{Modules/SelectHashes.cmake → SelectHashes.cmake} +21 -28
- data/vendor/libgit2/deps/chromium-zlib/CMakeLists.txt +101 -0
- data/vendor/libgit2/deps/http-parser/CMakeLists.txt +4 -3
- data/vendor/libgit2/deps/ntlmclient/CMakeLists.txt +24 -10
- data/vendor/libgit2/deps/ntlmclient/compat.h +0 -27
- 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 +164 -135
- data/vendor/libgit2/deps/ntlmclient/ntlm.h +13 -9
- data/vendor/libgit2/deps/ntlmclient/ntlmclient.h +16 -3
- 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/ntlmclient/util.c +15 -1
- data/vendor/libgit2/deps/ntlmclient/util.h +2 -1
- data/vendor/libgit2/deps/pcre/LICENCE +93 -0
- data/vendor/libgit2/deps/pcre/pcre.h +2 -2
- data/vendor/libgit2/deps/pcre/pcre_compile.c +29 -17
- data/vendor/libgit2/deps/pcre/pcre_jit_compile.c +4 -4
- data/vendor/libgit2/deps/pcre/pcreposix.c +2 -3
- data/vendor/libgit2/deps/zlib/CMakeLists.txt +6 -5
- data/vendor/libgit2/deps/zlib/deflate.c +1 -0
- data/vendor/libgit2/include/git2/annotated_commit.h +1 -1
- data/vendor/libgit2/include/git2/apply.h +2 -0
- data/vendor/libgit2/include/git2/attr.h +95 -0
- data/vendor/libgit2/include/git2/blame.h +95 -42
- data/vendor/libgit2/include/git2/blob.h +37 -3
- data/vendor/libgit2/include/git2/branch.h +25 -0
- data/vendor/libgit2/include/git2/cert.h +42 -5
- data/vendor/libgit2/include/git2/checkout.h +28 -12
- data/vendor/libgit2/include/git2/clone.h +1 -1
- data/vendor/libgit2/include/git2/commit.h +35 -19
- data/vendor/libgit2/include/git2/common.h +51 -6
- data/vendor/libgit2/include/git2/config.h +1 -1
- data/vendor/libgit2/include/git2/deprecated.h +368 -8
- data/vendor/libgit2/include/git2/diff.h +34 -113
- data/vendor/libgit2/include/git2/email.h +127 -0
- data/vendor/libgit2/include/git2/errors.h +8 -7
- data/vendor/libgit2/include/git2/filter.h +63 -17
- data/vendor/libgit2/include/git2/graph.h +20 -2
- data/vendor/libgit2/include/git2/index.h +4 -5
- data/vendor/libgit2/include/git2/indexer.h +2 -1
- data/vendor/libgit2/include/git2/notes.h +2 -2
- data/vendor/libgit2/include/git2/odb.h +44 -20
- data/vendor/libgit2/include/git2/oidarray.h +5 -8
- data/vendor/libgit2/include/git2/pack.h +1 -1
- data/vendor/libgit2/include/git2/patch.h +8 -0
- data/vendor/libgit2/include/git2/rebase.h +25 -1
- data/vendor/libgit2/include/git2/refs.h +9 -5
- data/vendor/libgit2/include/git2/remote.h +62 -9
- data/vendor/libgit2/include/git2/repository.h +107 -62
- data/vendor/libgit2/include/git2/revparse.h +5 -5
- data/vendor/libgit2/include/git2/stash.h +1 -1
- data/vendor/libgit2/include/git2/status.h +115 -59
- data/vendor/libgit2/include/git2/stdint.h +3 -3
- data/vendor/libgit2/include/git2/strarray.h +6 -10
- data/vendor/libgit2/include/git2/submodule.h +9 -0
- 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 +7 -0
- data/vendor/libgit2/include/git2/sys/transport.h +1 -0
- data/vendor/libgit2/include/git2/tag.h +12 -0
- data/vendor/libgit2/include/git2/transport.h +1 -1
- data/vendor/libgit2/include/git2/tree.h +2 -14
- data/vendor/libgit2/include/git2/types.h +9 -0
- data/vendor/libgit2/include/git2/version.h +4 -4
- data/vendor/libgit2/include/git2/worktree.h +1 -0
- data/vendor/libgit2/include/git2.h +1 -0
- data/vendor/libgit2/src/CMakeLists.txt +84 -44
- 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/apply.c +21 -8
- data/vendor/libgit2/src/array.h +11 -11
- data/vendor/libgit2/src/assert_safe.h +58 -0
- data/vendor/libgit2/src/attr.c +192 -70
- data/vendor/libgit2/src/attr_file.c +99 -41
- data/vendor/libgit2/src/attr_file.h +32 -11
- data/vendor/libgit2/src/attrcache.c +44 -40
- data/vendor/libgit2/src/attrcache.h +4 -5
- data/vendor/libgit2/src/blame.c +32 -19
- data/vendor/libgit2/src/blame_git.c +7 -4
- data/vendor/libgit2/src/blob.c +60 -32
- data/vendor/libgit2/src/branch.c +87 -37
- data/vendor/libgit2/src/buffer.c +349 -29
- data/vendor/libgit2/src/buffer.h +154 -2
- data/vendor/libgit2/src/cache.c +3 -24
- data/vendor/libgit2/src/cache.h +7 -7
- data/vendor/libgit2/src/cc-compat.h +10 -8
- data/vendor/libgit2/src/checkout.c +103 -105
- data/vendor/libgit2/src/cherrypick.c +8 -2
- data/vendor/libgit2/src/clone.c +105 -30
- data/vendor/libgit2/src/commit.c +41 -28
- data/vendor/libgit2/src/commit_graph.c +1209 -0
- data/vendor/libgit2/src/commit_graph.h +162 -0
- data/vendor/libgit2/src/commit_list.c +46 -0
- data/vendor/libgit2/src/commit_list.h +2 -0
- data/vendor/libgit2/src/common.h +26 -2
- data/vendor/libgit2/src/config.c +41 -23
- data/vendor/libgit2/src/config_cache.c +9 -4
- data/vendor/libgit2/src/config_entries.c +35 -27
- data/vendor/libgit2/src/config_file.c +17 -9
- data/vendor/libgit2/src/config_parse.c +6 -8
- data/vendor/libgit2/src/config_snapshot.c +2 -1
- data/vendor/libgit2/src/crlf.c +16 -6
- data/vendor/libgit2/src/date.c +4 -3
- data/vendor/libgit2/src/delta.c +1 -1
- data/vendor/libgit2/src/describe.c +12 -5
- data/vendor/libgit2/src/diff.c +55 -183
- data/vendor/libgit2/src/diff_driver.c +21 -17
- data/vendor/libgit2/src/diff_file.c +5 -7
- data/vendor/libgit2/src/diff_generate.c +56 -28
- data/vendor/libgit2/src/diff_parse.c +2 -3
- data/vendor/libgit2/src/diff_print.c +81 -65
- data/vendor/libgit2/src/diff_stats.c +19 -16
- data/vendor/libgit2/src/diff_tform.c +13 -13
- data/vendor/libgit2/src/diff_xdiff.c +4 -2
- data/vendor/libgit2/src/diff_xdiff.h +1 -1
- data/vendor/libgit2/src/email.c +299 -0
- data/vendor/libgit2/src/email.h +25 -0
- data/vendor/libgit2/src/errors.c +26 -19
- data/vendor/libgit2/src/features.h.in +5 -1
- data/vendor/libgit2/src/fetch.c +7 -2
- data/vendor/libgit2/src/fetchhead.c +8 -4
- data/vendor/libgit2/src/filebuf.c +9 -7
- data/vendor/libgit2/src/filter.c +215 -113
- data/vendor/libgit2/src/filter.h +24 -5
- data/vendor/libgit2/src/futils.c +8 -8
- data/vendor/libgit2/src/futils.h +4 -4
- data/vendor/libgit2/src/graph.c +64 -9
- data/vendor/libgit2/src/hash/sha1/collisiondetect.c +3 -3
- data/vendor/libgit2/src/hash/sha1/common_crypto.c +3 -3
- data/vendor/libgit2/src/hash/sha1/generic.h +1 -1
- data/vendor/libgit2/src/hash/sha1/mbedtls.c +12 -12
- data/vendor/libgit2/src/hash/sha1/openssl.c +3 -3
- data/vendor/libgit2/src/hash/sha1/sha1dc/sha1.c +8 -10
- data/vendor/libgit2/src/hash/sha1/win32.c +15 -11
- data/vendor/libgit2/src/hash.c +16 -13
- data/vendor/libgit2/src/hash.h +1 -1
- data/vendor/libgit2/src/hashsig.c +23 -10
- data/vendor/libgit2/src/ident.c +13 -3
- data/vendor/libgit2/src/idxmap.c +0 -22
- data/vendor/libgit2/src/ignore.c +33 -17
- data/vendor/libgit2/src/index.c +124 -82
- data/vendor/libgit2/src/index.h +1 -1
- data/vendor/libgit2/src/indexer.c +95 -37
- data/vendor/libgit2/src/integer.h +79 -2
- data/vendor/libgit2/src/iterator.c +40 -28
- data/vendor/libgit2/src/iterator.h +1 -1
- data/vendor/libgit2/src/khash.h +2 -11
- data/vendor/libgit2/src/{settings.c → libgit2.c} +148 -49
- data/vendor/libgit2/src/libgit2.h +15 -0
- data/vendor/libgit2/src/mailmap.c +23 -10
- data/vendor/libgit2/src/map.h +3 -3
- data/vendor/libgit2/src/merge.c +95 -43
- data/vendor/libgit2/src/merge.h +2 -1
- data/vendor/libgit2/src/merge_driver.c +19 -13
- data/vendor/libgit2/src/merge_file.c +15 -9
- data/vendor/libgit2/src/message.c +3 -1
- data/vendor/libgit2/src/midx.c +879 -0
- data/vendor/libgit2/src/midx.h +110 -0
- data/vendor/libgit2/src/mwindow.c +214 -95
- data/vendor/libgit2/src/mwindow.h +3 -3
- data/vendor/libgit2/src/net.c +133 -4
- data/vendor/libgit2/src/net.h +16 -2
- data/vendor/libgit2/src/netops.c +6 -4
- data/vendor/libgit2/src/netops.h +2 -2
- data/vendor/libgit2/src/notes.c +40 -40
- data/vendor/libgit2/src/object.c +24 -15
- data/vendor/libgit2/src/odb.c +298 -57
- data/vendor/libgit2/src/odb.h +16 -2
- data/vendor/libgit2/src/odb_loose.c +31 -21
- data/vendor/libgit2/src/odb_mempack.c +3 -1
- data/vendor/libgit2/src/odb_pack.c +391 -114
- data/vendor/libgit2/src/oid.c +7 -4
- data/vendor/libgit2/src/oidarray.c +10 -1
- data/vendor/libgit2/src/pack-objects.c +83 -69
- data/vendor/libgit2/src/pack.c +383 -150
- data/vendor/libgit2/src/pack.h +44 -9
- data/vendor/libgit2/src/patch.c +14 -7
- data/vendor/libgit2/src/patch_generate.c +3 -5
- data/vendor/libgit2/src/patch_parse.c +6 -3
- data/vendor/libgit2/src/path.c +103 -58
- data/vendor/libgit2/src/path.h +80 -7
- data/vendor/libgit2/src/pathspec.c +12 -11
- data/vendor/libgit2/src/pool.c +34 -22
- data/vendor/libgit2/src/pool.h +9 -1
- data/vendor/libgit2/src/posix.c +43 -12
- data/vendor/libgit2/src/posix.h +9 -0
- data/vendor/libgit2/src/proxy.c +2 -0
- data/vendor/libgit2/src/push.c +2 -0
- data/vendor/libgit2/src/reader.c +10 -6
- data/vendor/libgit2/src/rebase.c +95 -49
- data/vendor/libgit2/src/refdb.c +165 -13
- data/vendor/libgit2/src/refdb.h +69 -0
- data/vendor/libgit2/src/refdb_fs.c +145 -153
- data/vendor/libgit2/src/reflog.c +21 -20
- data/vendor/libgit2/src/refs.c +153 -233
- data/vendor/libgit2/src/refs.h +2 -20
- data/vendor/libgit2/src/refspec.c +81 -45
- data/vendor/libgit2/src/regexp.c +2 -2
- data/vendor/libgit2/src/remote.c +320 -122
- data/vendor/libgit2/src/remote.h +2 -1
- data/vendor/libgit2/src/repository.c +476 -203
- data/vendor/libgit2/src/repository.h +27 -29
- data/vendor/libgit2/src/reset.c +8 -7
- data/vendor/libgit2/src/revert.c +8 -2
- data/vendor/libgit2/src/revparse.c +23 -17
- data/vendor/libgit2/src/revwalk.c +35 -20
- data/vendor/libgit2/src/runtime.c +162 -0
- data/vendor/libgit2/src/runtime.h +62 -0
- data/vendor/libgit2/src/{refdb_fs.h → settings.h} +3 -11
- data/vendor/libgit2/src/signature.c +6 -5
- data/vendor/libgit2/src/sortedcache.c +2 -3
- data/vendor/libgit2/src/sortedcache.h +10 -8
- data/vendor/libgit2/src/stash.c +6 -2
- data/vendor/libgit2/src/status.c +9 -4
- data/vendor/libgit2/src/strarray.c +64 -0
- data/vendor/libgit2/src/streams/mbedtls.c +14 -17
- data/vendor/libgit2/src/streams/mbedtls.h +1 -1
- data/vendor/libgit2/src/streams/openssl.c +113 -207
- 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 +10 -9
- 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 +134 -66
- data/vendor/libgit2/src/submodule.h +9 -9
- data/vendor/libgit2/src/sysdir.c +8 -26
- data/vendor/libgit2/src/sysdir.h +0 -11
- data/vendor/libgit2/src/tag.c +49 -11
- 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 +2 -2
- data/vendor/libgit2/src/trace.h +17 -13
- data/vendor/libgit2/src/trailer.c +1 -1
- data/vendor/libgit2/src/transaction.c +21 -9
- data/vendor/libgit2/src/transport.c +3 -3
- data/vendor/libgit2/src/transports/auth.c +1 -1
- data/vendor/libgit2/src/transports/auth_negotiate.c +11 -4
- data/vendor/libgit2/src/transports/auth_ntlm.c +10 -6
- data/vendor/libgit2/src/transports/credential.c +17 -7
- data/vendor/libgit2/src/transports/credential_helpers.c +2 -0
- data/vendor/libgit2/src/transports/git.c +1 -3
- data/vendor/libgit2/src/transports/http.c +19 -17
- data/vendor/libgit2/src/transports/http.h +1 -0
- data/vendor/libgit2/src/transports/httpclient.c +68 -38
- data/vendor/libgit2/src/transports/httpclient.h +1 -1
- data/vendor/libgit2/src/transports/local.c +5 -5
- data/vendor/libgit2/src/transports/smart.c +14 -9
- data/vendor/libgit2/src/transports/smart.h +1 -1
- data/vendor/libgit2/src/transports/smart_protocol.c +11 -5
- data/vendor/libgit2/src/transports/ssh.c +55 -21
- data/vendor/libgit2/src/transports/winhttp.c +157 -89
- data/vendor/libgit2/src/tree.c +100 -77
- data/vendor/libgit2/src/tree.h +1 -0
- data/vendor/libgit2/src/tsort.c +0 -2
- data/vendor/libgit2/src/unix/map.c +3 -1
- data/vendor/libgit2/src/unix/posix.h +16 -1
- data/vendor/libgit2/src/unix/pthread.h +2 -1
- data/vendor/libgit2/src/utf8.c +150 -0
- data/vendor/libgit2/src/utf8.h +52 -0
- data/vendor/libgit2/src/util.c +75 -184
- data/vendor/libgit2/src/util.h +34 -40
- data/vendor/libgit2/src/vector.c +23 -19
- data/vendor/libgit2/src/vector.h +4 -2
- data/vendor/libgit2/src/win32/findfile.c +5 -3
- data/vendor/libgit2/src/win32/git2.rc +18 -3
- 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 +23 -25
- data/vendor/libgit2/src/win32/path_w32.h +0 -1
- data/vendor/libgit2/src/win32/posix.h +6 -6
- data/vendor/libgit2/src/win32/posix_w32.c +86 -7
- 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 +3 -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 +36 -14
- data/vendor/libgit2/src/zstream.c +1 -1
- metadata +65 -42
- data/vendor/libgit2/cmake/Modules/CheckPrototypeDefinition.c.in +0 -29
- data/vendor/libgit2/cmake/Modules/CheckPrototypeDefinition.cmake +0 -96
- 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/global.c +0 -361
- 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 -246
- 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
@@ -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)
|
@@ -123,10 +121,12 @@ int git_indexer_options_init(git_indexer_options *opts, unsigned int version)
|
|
123
121
|
return 0;
|
124
122
|
}
|
125
123
|
|
124
|
+
#ifndef GIT_DEPRECATE_HARD
|
126
125
|
int git_indexer_init_options(git_indexer_options *opts, unsigned int version)
|
127
126
|
{
|
128
127
|
return git_indexer_options_init(opts, version);
|
129
128
|
}
|
129
|
+
#endif
|
130
130
|
|
131
131
|
int git_indexer_new(
|
132
132
|
git_indexer **out,
|
@@ -237,7 +237,8 @@ static int hash_object_stream(git_indexer*idx, git_packfile_stream *stream)
|
|
237
237
|
{
|
238
238
|
ssize_t read;
|
239
239
|
|
240
|
-
|
240
|
+
GIT_ASSERT_ARG(idx);
|
241
|
+
GIT_ASSERT_ARG(stream);
|
241
242
|
|
242
243
|
do {
|
243
244
|
if ((read = git_packfile_stream_read(stream, idx->objbuf, sizeof(idx->objbuf))) < 0)
|
@@ -260,15 +261,16 @@ static int advance_delta_offset(git_indexer *idx, git_object_t type)
|
|
260
261
|
{
|
261
262
|
git_mwindow *w = NULL;
|
262
263
|
|
263
|
-
|
264
|
+
GIT_ASSERT_ARG(type == GIT_OBJECT_REF_DELTA || type == GIT_OBJECT_OFS_DELTA);
|
264
265
|
|
265
266
|
if (type == GIT_OBJECT_REF_DELTA) {
|
266
267
|
idx->off += GIT_OID_RAWSZ;
|
267
268
|
} else {
|
268
|
-
off64_t base_off
|
269
|
+
off64_t base_off;
|
270
|
+
int error = get_delta_base(&base_off, idx->pack, &w, &idx->off, type, idx->entry_start);
|
269
271
|
git_mwindow_close(&w);
|
270
|
-
if (
|
271
|
-
return
|
272
|
+
if (error < 0)
|
273
|
+
return error;
|
272
274
|
}
|
273
275
|
|
274
276
|
return 0;
|
@@ -279,7 +281,7 @@ static int read_object_stream(git_indexer *idx, git_packfile_stream *stream)
|
|
279
281
|
{
|
280
282
|
ssize_t read;
|
281
283
|
|
282
|
-
|
284
|
+
GIT_ASSERT_ARG(stream);
|
283
285
|
|
284
286
|
do {
|
285
287
|
read = git_packfile_stream_read(stream, idx->objbuf, sizeof(idx->objbuf));
|
@@ -424,7 +426,10 @@ static int store_object(git_indexer *idx)
|
|
424
426
|
pentry = git__calloc(1, sizeof(struct git_pack_entry));
|
425
427
|
GIT_ERROR_CHECK_ALLOC(pentry);
|
426
428
|
|
427
|
-
git_hash_final(&oid, &idx->hash_ctx)
|
429
|
+
if (git_hash_final(&oid, &idx->hash_ctx)) {
|
430
|
+
git__free(pentry);
|
431
|
+
goto on_error;
|
432
|
+
}
|
428
433
|
entry_size = idx->off - entry_start;
|
429
434
|
if (entry_start > UINT31_MAX) {
|
430
435
|
entry->offset = UINT32_MAX;
|
@@ -596,6 +601,48 @@ static void hash_partially(git_indexer *idx, const uint8_t *data, size_t size)
|
|
596
601
|
idx->inbuf_len += size - to_expell;
|
597
602
|
}
|
598
603
|
|
604
|
+
#if defined(NO_MMAP) || !defined(GIT_WIN32)
|
605
|
+
|
606
|
+
static int write_at(git_indexer *idx, const void *data, off64_t offset, size_t size)
|
607
|
+
{
|
608
|
+
size_t remaining_size = size;
|
609
|
+
const char *ptr = (const char *)data;
|
610
|
+
|
611
|
+
/* Handle data size larger that ssize_t */
|
612
|
+
while (remaining_size > 0) {
|
613
|
+
ssize_t nb;
|
614
|
+
HANDLE_EINTR(nb, p_pwrite(idx->pack->mwf.fd, (void *)ptr,
|
615
|
+
remaining_size, offset));
|
616
|
+
if (nb <= 0)
|
617
|
+
return -1;
|
618
|
+
|
619
|
+
ptr += nb;
|
620
|
+
offset += nb;
|
621
|
+
remaining_size -= nb;
|
622
|
+
}
|
623
|
+
|
624
|
+
return 0;
|
625
|
+
}
|
626
|
+
|
627
|
+
static int append_to_pack(git_indexer *idx, const void *data, size_t size)
|
628
|
+
{
|
629
|
+
if (write_at(idx, data, idx->pack->mwf.size, size) < 0) {
|
630
|
+
git_error_set(GIT_ERROR_OS, "cannot extend packfile '%s'", idx->pack->pack_name);
|
631
|
+
return -1;
|
632
|
+
}
|
633
|
+
|
634
|
+
return 0;
|
635
|
+
}
|
636
|
+
|
637
|
+
#else
|
638
|
+
|
639
|
+
/*
|
640
|
+
* Windows may keep different views to a networked file for the mmap- and
|
641
|
+
* open-accessed versions of a file, so any writes done through
|
642
|
+
* `write(2)`/`pwrite(2)` may not be reflected on the data that `mmap(2)` is
|
643
|
+
* able to read.
|
644
|
+
*/
|
645
|
+
|
599
646
|
static int write_at(git_indexer *idx, const void *data, off64_t offset, size_t size)
|
600
647
|
{
|
601
648
|
git_file fd = idx->pack->mwf.fd;
|
@@ -606,7 +653,8 @@ static int write_at(git_indexer *idx, const void *data, off64_t offset, size_t s
|
|
606
653
|
git_map map;
|
607
654
|
int error;
|
608
655
|
|
609
|
-
|
656
|
+
GIT_ASSERT_ARG(data);
|
657
|
+
GIT_ASSERT_ARG(size);
|
610
658
|
|
611
659
|
if ((error = git__mmap_alignment(&mmap_alignment)) < 0)
|
612
660
|
return error;
|
@@ -632,7 +680,6 @@ static int append_to_pack(git_indexer *idx, const void *data, size_t size)
|
|
632
680
|
size_t page_offset;
|
633
681
|
off64_t page_start;
|
634
682
|
off64_t current_size = idx->pack->mwf.size;
|
635
|
-
int fd = idx->pack->mwf.fd;
|
636
683
|
int error;
|
637
684
|
|
638
685
|
if (!size)
|
@@ -649,8 +696,7 @@ static int append_to_pack(git_indexer *idx, const void *data, size_t size)
|
|
649
696
|
page_offset = new_size % mmap_alignment;
|
650
697
|
page_start = new_size - page_offset;
|
651
698
|
|
652
|
-
if (
|
653
|
-
p_write(idx->pack->mwf.fd, data, 1) < 0) {
|
699
|
+
if (p_pwrite(idx->pack->mwf.fd, data, 1, page_start + mmap_alignment - 1) < 0) {
|
654
700
|
git_error_set(GIT_ERROR_OS, "cannot extend packfile '%s'", idx->pack->pack_name);
|
655
701
|
return -1;
|
656
702
|
}
|
@@ -658,6 +704,8 @@ static int append_to_pack(git_indexer *idx, const void *data, size_t size)
|
|
658
704
|
return write_at(idx, data, idx->pack->mwf.size, size);
|
659
705
|
}
|
660
706
|
|
707
|
+
#endif
|
708
|
+
|
661
709
|
static int read_stream_object(git_indexer *idx, git_indexer_progress *stats)
|
662
710
|
{
|
663
711
|
git_packfile_stream *stream = &idx->stream;
|
@@ -671,7 +719,7 @@ static int read_stream_object(git_indexer *idx, git_indexer_progress *stats)
|
|
671
719
|
return GIT_EBUFS;
|
672
720
|
|
673
721
|
if (!idx->have_stream) {
|
674
|
-
error = git_packfile_unpack_header(&entry_size, &type,
|
722
|
+
error = git_packfile_unpack_header(&entry_size, &type, idx->pack, &w, &idx->off);
|
675
723
|
if (error == GIT_EBUFS) {
|
676
724
|
idx->off = entry_start;
|
677
725
|
return error;
|
@@ -753,7 +801,9 @@ int git_indexer_append(git_indexer *idx, const void *data, size_t size, git_inde
|
|
753
801
|
struct git_pack_header *hdr = &idx->hdr;
|
754
802
|
git_mwindow_file *mwf = &idx->pack->mwf;
|
755
803
|
|
756
|
-
|
804
|
+
GIT_ASSERT_ARG(idx);
|
805
|
+
GIT_ASSERT_ARG(data);
|
806
|
+
GIT_ASSERT_ARG(stats);
|
757
807
|
|
758
808
|
if ((error = append_to_pack(idx, data, size)) < 0)
|
759
809
|
return error;
|
@@ -807,7 +857,8 @@ int git_indexer_append(git_indexer *idx, const void *data, size_t size, git_inde
|
|
807
857
|
/* Now that we have data in the pack, let's try to parse it */
|
808
858
|
|
809
859
|
/* As the file grows any windows we try to use will be out of date */
|
810
|
-
git_mwindow_free_all(mwf)
|
860
|
+
if ((error = git_mwindow_free_all(mwf)) < 0)
|
861
|
+
goto on_error;
|
811
862
|
|
812
863
|
while (stats->indexed_objects < idx->nr_objects) {
|
813
864
|
if ((error = read_stream_object(idx, stats)) != 0) {
|
@@ -851,16 +902,16 @@ static int index_path(git_buf *path, git_indexer *idx, const char *suffix)
|
|
851
902
|
* Rewind the packfile by the trailer, as we might need to fix the
|
852
903
|
* packfile by injecting objects at the tail and must overwrite it.
|
853
904
|
*/
|
854
|
-
static
|
905
|
+
static int seek_back_trailer(git_indexer *idx)
|
855
906
|
{
|
856
907
|
idx->pack->mwf.size -= GIT_OID_RAWSZ;
|
857
|
-
git_mwindow_free_all(&idx->pack->mwf);
|
908
|
+
return git_mwindow_free_all(&idx->pack->mwf);
|
858
909
|
}
|
859
910
|
|
860
911
|
static int inject_object(git_indexer *idx, git_oid *id)
|
861
912
|
{
|
862
|
-
git_odb_object *obj;
|
863
|
-
struct entry *entry;
|
913
|
+
git_odb_object *obj = NULL;
|
914
|
+
struct entry *entry = NULL;
|
864
915
|
struct git_pack_entry *pentry = NULL;
|
865
916
|
git_oid foo = {{0}};
|
866
917
|
unsigned char hdr[64];
|
@@ -870,12 +921,14 @@ static int inject_object(git_indexer *idx, git_oid *id)
|
|
870
921
|
size_t len, hdr_len;
|
871
922
|
int error;
|
872
923
|
|
873
|
-
seek_back_trailer(idx)
|
924
|
+
if ((error = seek_back_trailer(idx)) < 0)
|
925
|
+
goto cleanup;
|
926
|
+
|
874
927
|
entry_start = idx->pack->mwf.size;
|
875
928
|
|
876
|
-
if (git_odb_read(&obj, idx->odb, id) < 0) {
|
929
|
+
if ((error = git_odb_read(&obj, idx->odb, id)) < 0) {
|
877
930
|
git_error_set(GIT_ERROR_INDEXER, "missing delta bases");
|
878
|
-
|
931
|
+
goto cleanup;
|
879
932
|
}
|
880
933
|
|
881
934
|
data = git_odb_object_data(obj);
|
@@ -887,8 +940,8 @@ static int inject_object(git_indexer *idx, git_oid *id)
|
|
887
940
|
entry->crc = crc32(0L, Z_NULL, 0);
|
888
941
|
|
889
942
|
/* Write out the object header */
|
890
|
-
|
891
|
-
|
943
|
+
if ((error = git_packfile__object_header(&hdr_len, hdr, len, git_odb_object_type(obj))) < 0 ||
|
944
|
+
(error = append_to_pack(idx, hdr, hdr_len)) < 0)
|
892
945
|
goto cleanup;
|
893
946
|
|
894
947
|
idx->pack->mwf.size += hdr_len;
|
@@ -944,7 +997,7 @@ static int fix_thin_pack(git_indexer *idx, git_indexer_progress *stats)
|
|
944
997
|
unsigned int left = 0;
|
945
998
|
git_oid base;
|
946
999
|
|
947
|
-
|
1000
|
+
GIT_ASSERT(git_vector_length(&idx->deltas) > 0);
|
948
1001
|
|
949
1002
|
if (idx->odb == NULL) {
|
950
1003
|
git_error_set(GIT_ERROR_INDEXER, "cannot fix a thin pack without an ODB");
|
@@ -957,7 +1010,7 @@ static int fix_thin_pack(git_indexer *idx, git_indexer_progress *stats)
|
|
957
1010
|
continue;
|
958
1011
|
|
959
1012
|
curpos = delta->delta_off;
|
960
|
-
error = git_packfile_unpack_header(&size, &type,
|
1013
|
+
error = git_packfile_unpack_header(&size, &type, idx->pack, &w, &curpos);
|
961
1014
|
if (error < 0)
|
962
1015
|
return error;
|
963
1016
|
|
@@ -1075,7 +1128,9 @@ static int update_header_and_rehash(git_indexer *idx, git_indexer_progress *stat
|
|
1075
1128
|
* hash_partially() keep the existing trailer out of the
|
1076
1129
|
* calculation.
|
1077
1130
|
*/
|
1078
|
-
git_mwindow_free_all(mwf)
|
1131
|
+
if (git_mwindow_free_all(mwf) < 0)
|
1132
|
+
return -1;
|
1133
|
+
|
1079
1134
|
idx->inbuf_len = 0;
|
1080
1135
|
while (hashed < mwf->size) {
|
1081
1136
|
ptr = git_mwindow_open(mwf, &w, hashed, chunk, &left);
|
@@ -1247,13 +1302,22 @@ int git_indexer_commit(git_indexer *idx, git_indexer_progress *stats)
|
|
1247
1302
|
if (git_filebuf_commit_at(&index_file, filename.ptr) < 0)
|
1248
1303
|
goto on_error;
|
1249
1304
|
|
1250
|
-
git_mwindow_free_all(&idx->pack->mwf)
|
1305
|
+
if (git_mwindow_free_all(&idx->pack->mwf) < 0)
|
1306
|
+
goto on_error;
|
1251
1307
|
|
1252
|
-
|
1308
|
+
#if !defined(NO_MMAP) && defined(GIT_WIN32)
|
1309
|
+
/*
|
1310
|
+
* Some non-Windows remote filesystems fail when truncating files if the
|
1311
|
+
* file permissions change after opening the file (done by p_mkstemp).
|
1312
|
+
*
|
1313
|
+
* Truncation is only needed when mmap is used to undo rounding up to next
|
1314
|
+
* page_size in append_to_pack.
|
1315
|
+
*/
|
1253
1316
|
if (p_ftruncate(idx->pack->mwf.fd, idx->pack->mwf.size) < 0) {
|
1254
1317
|
git_error_set(GIT_ERROR_OS, "failed to truncate pack file '%s'", idx->pack->pack_name);
|
1255
1318
|
return -1;
|
1256
1319
|
}
|
1320
|
+
#endif
|
1257
1321
|
|
1258
1322
|
if (idx->do_fsync && p_fsync(idx->pack->mwf.fd) < 0) {
|
1259
1323
|
git_error_set(GIT_ERROR_OS, "failed to fsync packfile");
|
@@ -1317,13 +1381,7 @@ void git_indexer_free(git_indexer *idx)
|
|
1317
1381
|
|
1318
1382
|
git_vector_free_deep(&idx->deltas);
|
1319
1383
|
|
1320
|
-
|
1321
|
-
if (!idx->pack_committed)
|
1322
|
-
git_packfile_close(idx->pack, true);
|
1323
|
-
|
1324
|
-
git_packfile_free(idx->pack);
|
1325
|
-
git_mutex_unlock(&git__mwindow_mutex);
|
1326
|
-
}
|
1384
|
+
git_packfile_free(idx->pack, !idx->pack_committed);
|
1327
1385
|
|
1328
1386
|
iter = 0;
|
1329
1387
|
while (git_oidmap_iterate((void **) &value, idx->expected_oids, &iter, &key) == 0)
|
@@ -43,10 +43,10 @@ GIT_INLINE(int) git__is_ulong(int64_t p)
|
|
43
43
|
}
|
44
44
|
|
45
45
|
/** @return true if p fits into the range of an int */
|
46
|
-
GIT_INLINE(int) git__is_int(
|
46
|
+
GIT_INLINE(int) git__is_int(int64_t p)
|
47
47
|
{
|
48
48
|
int r = (int)p;
|
49
|
-
return p == (
|
49
|
+
return p == (int64_t)r;
|
50
50
|
}
|
51
51
|
|
52
52
|
/* Use clang/gcc compiler intrinsics whenever possible */
|
@@ -77,6 +77,15 @@ GIT_INLINE(int) git__is_int(long long p)
|
|
77
77
|
# define git__sub_int_overflow(out, one, two) \
|
78
78
|
__builtin_ssub_overflow(one, two, out)
|
79
79
|
|
80
|
+
# define git__add_int64_overflow(out, one, two) \
|
81
|
+
__builtin_add_overflow(one, two, out)
|
82
|
+
|
83
|
+
/* clang on 32-bit systems produces an undefined reference to `__mulodi4`. */
|
84
|
+
# if !defined(__clang__) || !defined(GIT_ARCH_32)
|
85
|
+
# define git__multiply_int64_overflow(out, one, two) \
|
86
|
+
__builtin_mul_overflow(one, two, out)
|
87
|
+
# endif
|
88
|
+
|
80
89
|
/* Use Microsoft's safe integer handling functions where available */
|
81
90
|
#elif defined(_MSC_VER)
|
82
91
|
|
@@ -87,11 +96,17 @@ GIT_INLINE(int) git__is_int(long long p)
|
|
87
96
|
(SizeTAdd(one, two, out) != S_OK)
|
88
97
|
# define git__multiply_sizet_overflow(out, one, two) \
|
89
98
|
(SizeTMult(one, two, out) != S_OK)
|
99
|
+
|
90
100
|
#define git__add_int_overflow(out, one, two) \
|
91
101
|
(IntAdd(one, two, out) != S_OK)
|
92
102
|
#define git__sub_int_overflow(out, one, two) \
|
93
103
|
(IntSub(one, two, out) != S_OK)
|
94
104
|
|
105
|
+
#define git__add_int64_overflow(out, one, two) \
|
106
|
+
(LongLongAdd(one, two, out) != S_OK)
|
107
|
+
#define git__multiply_int64_overflow(out, one, two) \
|
108
|
+
(LongLongMult(one, two, out) != S_OK)
|
109
|
+
|
95
110
|
#else
|
96
111
|
|
97
112
|
/**
|
@@ -136,6 +151,68 @@ GIT_INLINE(bool) git__sub_int_overflow(int *out, int one, int two)
|
|
136
151
|
return false;
|
137
152
|
}
|
138
153
|
|
154
|
+
GIT_INLINE(bool) git__add_int64_overflow(int64_t *out, int64_t one, int64_t two)
|
155
|
+
{
|
156
|
+
if ((two > 0 && one > (INT64_MAX - two)) ||
|
157
|
+
(two < 0 && one < (INT64_MIN - two)))
|
158
|
+
return true;
|
159
|
+
*out = one + two;
|
160
|
+
return false;
|
161
|
+
}
|
162
|
+
|
163
|
+
#endif
|
164
|
+
|
165
|
+
/* If we could not provide an intrinsic implementation for this, provide a (slow) fallback. */
|
166
|
+
#if !defined(git__multiply_int64_overflow)
|
167
|
+
GIT_INLINE(bool) git__multiply_int64_overflow(int64_t *out, int64_t one, int64_t two)
|
168
|
+
{
|
169
|
+
/*
|
170
|
+
* Detects whether `INT64_MAX < (one * two) || INT64_MIN > (one * two)`,
|
171
|
+
* without incurring in undefined behavior. That is done by performing the
|
172
|
+
* comparison with a division instead of a multiplication, which translates
|
173
|
+
* to `INT64_MAX / one < two || INT64_MIN / one > two`. Some caveats:
|
174
|
+
*
|
175
|
+
* - The comparison sign is inverted when both sides of the inequality are
|
176
|
+
* multiplied/divided by a negative number, so if `one < 0` the comparison
|
177
|
+
* needs to be flipped.
|
178
|
+
* - `INT64_MAX / -1` itself overflows (or traps), so that case should be
|
179
|
+
* avoided.
|
180
|
+
* - Since the overflow flag is defined as the discrepance between the result
|
181
|
+
* of performing the multiplication in a signed integer at twice the width
|
182
|
+
* of the operands, and the truncated+sign-extended version of that same
|
183
|
+
* result, there are four cases where the result is the opposite of what
|
184
|
+
* would be expected:
|
185
|
+
* * `INT64_MIN * -1` / `-1 * INT64_MIN`
|
186
|
+
* * `INT64_MIN * 1 / `1 * INT64_MIN`
|
187
|
+
*/
|
188
|
+
if (one && two) {
|
189
|
+
if (one > 0 && two > 0) {
|
190
|
+
if (INT64_MAX / one < two)
|
191
|
+
return true;
|
192
|
+
} else if (one < 0 && two < 0) {
|
193
|
+
if ((one == -1 && two == INT64_MIN) ||
|
194
|
+
(two == -1 && one == INT64_MIN)) {
|
195
|
+
*out = INT64_MIN;
|
196
|
+
return false;
|
197
|
+
}
|
198
|
+
if (INT64_MAX / one > two)
|
199
|
+
return true;
|
200
|
+
} else if (one > 0 && two < 0) {
|
201
|
+
if ((one == 1 && two == INT64_MIN) ||
|
202
|
+
(INT64_MIN / one > two))
|
203
|
+
return true;
|
204
|
+
} else if (one == -1) {
|
205
|
+
if (INT64_MIN / two > one)
|
206
|
+
return true;
|
207
|
+
} else {
|
208
|
+
if ((one == INT64_MIN && two == 1) ||
|
209
|
+
(INT64_MIN / one < two))
|
210
|
+
return true;
|
211
|
+
}
|
212
|
+
}
|
213
|
+
*out = one * two;
|
214
|
+
return false;
|
215
|
+
}
|
139
216
|
#endif
|
140
217
|
|
141
218
|
#endif
|
@@ -330,7 +330,7 @@ static iterator_pathlist_search_t iterator_pathlist_search(
|
|
330
330
|
break;
|
331
331
|
|
332
332
|
/* an exact match would have been matched by the bsearch above */
|
333
|
-
|
333
|
+
GIT_ASSERT_WITH_RETVAL(p[path_len], ITERATOR_PATHLIST_NONE);
|
334
334
|
|
335
335
|
/* is this a literal directory entry (eg `foo/`) or a file beneath */
|
336
336
|
if (p[path_len] == '/') {
|
@@ -678,14 +678,14 @@ done:
|
|
678
678
|
return error;
|
679
679
|
}
|
680
680
|
|
681
|
-
static
|
681
|
+
static int tree_iterator_frame_pop(tree_iterator *iter)
|
682
682
|
{
|
683
683
|
tree_iterator_frame *frame;
|
684
684
|
git_buf *buf = NULL;
|
685
685
|
git_tree *tree;
|
686
686
|
size_t i;
|
687
687
|
|
688
|
-
|
688
|
+
GIT_ASSERT(iter->frames.size);
|
689
689
|
|
690
690
|
frame = git_array_pop(iter->frames);
|
691
691
|
|
@@ -705,6 +705,8 @@ static void tree_iterator_frame_pop(tree_iterator *iter)
|
|
705
705
|
git_vector_free(&frame->similar_trees);
|
706
706
|
|
707
707
|
git_buf_dispose(&frame->path);
|
708
|
+
|
709
|
+
return 0;
|
708
710
|
}
|
709
711
|
|
710
712
|
static int tree_iterator_current(
|
@@ -760,7 +762,9 @@ static int tree_iterator_advance(const git_index_entry **out, git_iterator *i)
|
|
760
762
|
|
761
763
|
/* no more entries in this frame. pop the frame out */
|
762
764
|
if (frame->next_idx == frame->entries.length) {
|
763
|
-
tree_iterator_frame_pop(iter)
|
765
|
+
if ((error = tree_iterator_frame_pop(iter)) < 0)
|
766
|
+
break;
|
767
|
+
|
764
768
|
continue;
|
765
769
|
}
|
766
770
|
|
@@ -838,7 +842,7 @@ static int tree_iterator_advance_into(
|
|
838
842
|
const git_index_entry **out, git_iterator *i)
|
839
843
|
{
|
840
844
|
tree_iterator *iter = (tree_iterator *)i;
|
841
|
-
|
845
|
+
tree_iterator_frame *frame;
|
842
846
|
tree_iterator_entry *prev_entry;
|
843
847
|
int error;
|
844
848
|
|
@@ -855,7 +859,7 @@ static int tree_iterator_advance_into(
|
|
855
859
|
* we will have pushed a new (empty) frame on to the stack for this
|
856
860
|
* new directory. since it's empty, its current_entry should be null.
|
857
861
|
*/
|
858
|
-
|
862
|
+
GIT_ASSERT(iterator__do_autoexpand(i) ^ (prev_entry != NULL));
|
859
863
|
|
860
864
|
if (prev_entry) {
|
861
865
|
if (!git_tree_entry__is_tree(prev_entry->tree_entry))
|
@@ -897,9 +901,8 @@ static int tree_iterator_init(tree_iterator *iter)
|
|
897
901
|
{
|
898
902
|
int error;
|
899
903
|
|
900
|
-
git_pool_init(&iter->entry_pool, sizeof(tree_iterator_entry))
|
901
|
-
|
902
|
-
if ((error = tree_iterator_frame_init(iter, iter->root, NULL)) < 0)
|
904
|
+
if ((error = git_pool_init(&iter->entry_pool, sizeof(tree_iterator_entry))) < 0 ||
|
905
|
+
(error = tree_iterator_frame_init(iter, iter->root, NULL)) < 0)
|
903
906
|
return error;
|
904
907
|
|
905
908
|
iter->base.flags &= ~GIT_ITERATOR_FIRST_ACCESS;
|
@@ -974,7 +977,7 @@ int git_iterator_current_tree_entry(
|
|
974
977
|
tree_iterator_frame *frame;
|
975
978
|
tree_iterator_entry *entry;
|
976
979
|
|
977
|
-
|
980
|
+
GIT_ASSERT(i->type == GIT_ITERATOR_TREE);
|
978
981
|
|
979
982
|
iter = (tree_iterator *)i;
|
980
983
|
|
@@ -991,11 +994,11 @@ int git_iterator_current_parent_tree(
|
|
991
994
|
tree_iterator *iter;
|
992
995
|
tree_iterator_frame *frame;
|
993
996
|
|
994
|
-
|
997
|
+
GIT_ASSERT(i->type == GIT_ITERATOR_TREE);
|
995
998
|
|
996
999
|
iter = (tree_iterator *)i;
|
997
1000
|
|
998
|
-
|
1001
|
+
GIT_ASSERT(depth < iter->frames.size);
|
999
1002
|
frame = &iter->frames.ptr[iter->frames.size-depth-1];
|
1000
1003
|
|
1001
1004
|
*parent_tree = frame->tree;
|
@@ -1275,7 +1278,8 @@ static int filesystem_iterator_entry_hash(
|
|
1275
1278
|
return git_repository_hashfile(&entry->id,
|
1276
1279
|
iter->base.repo, entry->path, GIT_OBJECT_BLOB, NULL);
|
1277
1280
|
|
1278
|
-
if (!(error = git_buf_joinpath(&fullpath, iter->root, entry->path))
|
1281
|
+
if (!(error = git_buf_joinpath(&fullpath, iter->root, entry->path)) &&
|
1282
|
+
!(error = git_path_validate_workdir_buf(iter->base.repo, &fullpath)))
|
1279
1283
|
error = git_odb_hashfile(&entry->id, fullpath.ptr, GIT_OBJECT_BLOB);
|
1280
1284
|
|
1281
1285
|
git_buf_dispose(&fullpath);
|
@@ -1356,7 +1360,8 @@ static int filesystem_iterator_frame_push(
|
|
1356
1360
|
else
|
1357
1361
|
git_buf_puts(&root, iter->root);
|
1358
1362
|
|
1359
|
-
if (git_buf_oom(&root)
|
1363
|
+
if (git_buf_oom(&root) ||
|
1364
|
+
git_path_validate_workdir_buf(iter->base.repo, &root) < 0) {
|
1360
1365
|
error = -1;
|
1361
1366
|
goto done;
|
1362
1367
|
}
|
@@ -1376,7 +1381,8 @@ static int filesystem_iterator_frame_push(
|
|
1376
1381
|
filesystem_iterator_entry_cmp)) < 0)
|
1377
1382
|
goto done;
|
1378
1383
|
|
1379
|
-
git_pool_init(&new_frame->entry_pool, 1)
|
1384
|
+
if ((error = git_pool_init(&new_frame->entry_pool, 1)) < 0)
|
1385
|
+
goto done;
|
1380
1386
|
|
1381
1387
|
/* check if this directory is ignored */
|
1382
1388
|
filesystem_iterator_frame_push_ignores(iter, frame_entry, new_frame);
|
@@ -1385,10 +1391,11 @@ static int filesystem_iterator_frame_push(
|
|
1385
1391
|
iterator_pathlist_search_t pathlist_match = ITERATOR_PATHLIST_FULL;
|
1386
1392
|
bool dir_expected = false;
|
1387
1393
|
|
1388
|
-
if ((error = git_path_diriter_fullpath(&path, &path_len, &diriter)) < 0
|
1394
|
+
if ((error = git_path_diriter_fullpath(&path, &path_len, &diriter)) < 0 ||
|
1395
|
+
(error = git_path_validate_workdir_with_len(iter->base.repo, path, path_len)) < 0)
|
1389
1396
|
goto done;
|
1390
1397
|
|
1391
|
-
|
1398
|
+
GIT_ASSERT(path_len > iter->root_len);
|
1392
1399
|
|
1393
1400
|
/* remove the prefix if requested */
|
1394
1401
|
path += iter->root_len;
|
@@ -1469,17 +1476,19 @@ done:
|
|
1469
1476
|
return error;
|
1470
1477
|
}
|
1471
1478
|
|
1472
|
-
GIT_INLINE(
|
1479
|
+
GIT_INLINE(int) filesystem_iterator_frame_pop(filesystem_iterator *iter)
|
1473
1480
|
{
|
1474
1481
|
filesystem_iterator_frame *frame;
|
1475
1482
|
|
1476
|
-
|
1483
|
+
GIT_ASSERT(iter->frames.size);
|
1477
1484
|
|
1478
1485
|
frame = git_array_pop(iter->frames);
|
1479
1486
|
filesystem_iterator_frame_pop_ignores(iter);
|
1480
1487
|
|
1481
1488
|
git_pool_clear(&frame->entry_pool);
|
1482
1489
|
git_vector_free(&frame->entries);
|
1490
|
+
|
1491
|
+
return 0;
|
1483
1492
|
}
|
1484
1493
|
|
1485
1494
|
static void filesystem_iterator_set_current(
|
@@ -1556,7 +1565,8 @@ static int filesystem_iterator_is_dir(
|
|
1556
1565
|
}
|
1557
1566
|
|
1558
1567
|
if ((error = git_buf_joinpath(&fullpath, iter->root, entry->path)) < 0 ||
|
1559
|
-
|
1568
|
+
(error = git_path_validate_workdir_buf(iter->base.repo, &fullpath)) < 0 ||
|
1569
|
+
(error = p_stat(fullpath.ptr, &st)) < 0)
|
1560
1570
|
goto done;
|
1561
1571
|
|
1562
1572
|
*is_dir = S_ISDIR(st.st_mode);
|
@@ -1646,7 +1656,7 @@ static int filesystem_iterator_advance_into(
|
|
1646
1656
|
* we will have pushed a new (empty) frame on to the stack for this
|
1647
1657
|
* new directory. since it's empty, its current_entry should be null.
|
1648
1658
|
*/
|
1649
|
-
|
1659
|
+
GIT_ASSERT(iterator__do_autoexpand(i) ^ (prev_entry != NULL));
|
1650
1660
|
|
1651
1661
|
if (prev_entry) {
|
1652
1662
|
if (prev_entry->st.st_mode != GIT_FILEMODE_COMMIT &&
|
@@ -1762,12 +1772,13 @@ static int filesystem_iterator_advance_over(
|
|
1762
1772
|
*out = NULL;
|
1763
1773
|
*status = GIT_ITERATOR_STATUS_NORMAL;
|
1764
1774
|
|
1765
|
-
|
1775
|
+
GIT_ASSERT(iterator__has_been_accessed(i));
|
1766
1776
|
|
1767
1777
|
current_frame = filesystem_iterator_current_frame(iter);
|
1768
|
-
|
1778
|
+
GIT_ASSERT(current_frame);
|
1779
|
+
|
1769
1780
|
current_entry = filesystem_iterator_current_entry(current_frame);
|
1770
|
-
|
1781
|
+
GIT_ASSERT(current_entry);
|
1771
1782
|
|
1772
1783
|
if ((error = git_iterator_current(&entry, i)) < 0)
|
1773
1784
|
return error;
|
@@ -2065,8 +2076,8 @@ static bool index_iterator_create_pseudotree(
|
|
2065
2076
|
|
2066
2077
|
static int index_iterator_skip_pseudotree(index_iterator *iter)
|
2067
2078
|
{
|
2068
|
-
|
2069
|
-
|
2079
|
+
GIT_ASSERT(iterator__has_been_accessed(&iter->base));
|
2080
|
+
GIT_ASSERT(S_ISDIR(iter->entry->mode));
|
2070
2081
|
|
2071
2082
|
while (true) {
|
2072
2083
|
const git_index_entry *next_entry = NULL;
|
@@ -2280,10 +2291,11 @@ int git_iterator_reset_range(
|
|
2280
2291
|
return i->cb->reset(i);
|
2281
2292
|
}
|
2282
2293
|
|
2283
|
-
|
2294
|
+
int git_iterator_set_ignore_case(git_iterator *i, bool ignore_case)
|
2284
2295
|
{
|
2285
|
-
|
2296
|
+
GIT_ASSERT(!iterator__has_been_accessed(i));
|
2286
2297
|
iterator_set_ignore_case(i, ignore_case);
|
2298
|
+
return 0;
|
2287
2299
|
}
|
2288
2300
|
|
2289
2301
|
void git_iterator_free(git_iterator *iter)
|
@@ -263,7 +263,7 @@ GIT_INLINE(bool) git_iterator_ignore_case(git_iterator *iter)
|
|
263
263
|
return ((iter->flags & GIT_ITERATOR_IGNORE_CASE) != 0);
|
264
264
|
}
|
265
265
|
|
266
|
-
extern
|
266
|
+
extern int git_iterator_set_ignore_case(
|
267
267
|
git_iterator *iter, bool ignore_case);
|
268
268
|
|
269
269
|
extern int git_iterator_current_tree_entry(
|
data/vendor/libgit2/src/khash.h
CHANGED
@@ -131,17 +131,8 @@ int main() {
|
|
131
131
|
|
132
132
|
/* compiler specific configuration */
|
133
133
|
|
134
|
-
|
135
|
-
typedef
|
136
|
-
#elif ULONG_MAX == 0xffffffffu
|
137
|
-
typedef unsigned long khint32_t;
|
138
|
-
#endif
|
139
|
-
|
140
|
-
#if ULONG_MAX == ULLONG_MAX
|
141
|
-
typedef unsigned long khint64_t;
|
142
|
-
#else
|
143
|
-
typedef unsigned long long khint64_t;
|
144
|
-
#endif
|
134
|
+
typedef uint32_t khint32_t;
|
135
|
+
typedef uint64_t khint64_t;
|
145
136
|
|
146
137
|
#ifndef kh_inline
|
147
138
|
#ifdef _MSC_VER
|