rugged 1.0.0 → 1.2.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 +3 -3
- data/ext/rugged/rugged.c +7 -4
- data/ext/rugged/rugged_commit.c +1 -1
- data/ext/rugged/rugged_config.c +1 -1
- data/ext/rugged/rugged_object.c +1 -1
- data/ext/rugged/rugged_remote.c +32 -2
- data/ext/rugged/rugged_repo.c +13 -3
- data/lib/rugged/commit.rb +17 -4
- data/lib/rugged/repository.rb +7 -8
- data/lib/rugged/submodule_collection.rb +4 -4
- 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/{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 +89 -0
- data/vendor/libgit2/include/git2/blame.h +95 -42
- data/vendor/libgit2/include/git2/blob.h +31 -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/commit.h +35 -19
- data/vendor/libgit2/include/git2/common.h +33 -6
- data/vendor/libgit2/include/git2/config.h +1 -1
- data/vendor/libgit2/include/git2/deprecated.h +248 -8
- data/vendor/libgit2/include/git2/diff.h +35 -20
- data/vendor/libgit2/include/git2/errors.h +8 -7
- data/vendor/libgit2/include/git2/filter.h +57 -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/odb.h +44 -20
- 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 +59 -6
- data/vendor/libgit2/include/git2/repository.h +95 -52
- data/vendor/libgit2/include/git2/revparse.h +5 -5
- data/vendor/libgit2/include/git2/status.h +115 -59
- 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/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 +3 -3
- data/vendor/libgit2/include/git2/worktree.h +1 -0
- data/vendor/libgit2/src/CMakeLists.txt +77 -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 +181 -74
- data/vendor/libgit2/src/attr_file.c +92 -42
- 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 +28 -15
- data/vendor/libgit2/src/blame_git.c +6 -3
- data/vendor/libgit2/src/blob.c +46 -24
- data/vendor/libgit2/src/branch.c +87 -37
- data/vendor/libgit2/src/buffer.c +339 -27
- data/vendor/libgit2/src/buffer.h +153 -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 -2
- data/vendor/libgit2/src/checkout.c +97 -98
- data/vendor/libgit2/src/cherrypick.c +8 -2
- data/vendor/libgit2/src/clone.c +104 -29
- 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 +40 -22
- 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 +25 -8
- data/vendor/libgit2/src/config_parse.c +5 -7
- 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 +11 -4
- data/vendor/libgit2/src/diff.c +23 -19
- 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/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 +209 -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 +0 -2
- 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 +35 -19
- data/vendor/libgit2/src/index.c +126 -84
- data/vendor/libgit2/src/index.h +1 -1
- data/vendor/libgit2/src/indexer.c +60 -36
- 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} +125 -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 +108 -46
- 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 +10 -10
- 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/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 +102 -57
- data/vendor/libgit2/src/path.h +79 -6
- 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 +144 -152
- data/vendor/libgit2/src/reflog.c +21 -20
- data/vendor/libgit2/src/refs.c +151 -231
- data/vendor/libgit2/src/refs.h +2 -20
- data/vendor/libgit2/src/refspec.c +80 -44
- data/vendor/libgit2/src/regexp.c +2 -2
- data/vendor/libgit2/src/remote.c +312 -121
- data/vendor/libgit2/src/remote.h +2 -1
- data/vendor/libgit2/src/repository.c +351 -189
- data/vendor/libgit2/src/repository.h +23 -29
- data/vendor/libgit2/src/reset.c +7 -6
- data/vendor/libgit2/src/revert.c +8 -2
- data/vendor/libgit2/src/revparse.c +19 -13
- 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 +7 -3
- 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 +83 -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/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 +84 -42
- 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 +51 -17
- data/vendor/libgit2/src/transports/winhttp.c +156 -88
- 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 +74 -183
- data/vendor/libgit2/src/util.h +33 -39
- data/vendor/libgit2/src/vector.c +23 -19
- data/vendor/libgit2/src/vector.h +4 -2
- data/vendor/libgit2/src/win32/findfile.c +4 -2
- 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_w32.c +77 -1
- 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 +37 -15
- data/vendor/libgit2/src/zstream.c +1 -1
- metadata +56 -38
- 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
data/vendor/libgit2/src/path.h
CHANGED
@@ -67,8 +67,6 @@ extern int git_path_basename_r(git_buf *buffer, const char *path);
|
|
67
67
|
*/
|
68
68
|
extern size_t git_path_basename_offset(git_buf *buffer);
|
69
69
|
|
70
|
-
extern const char *git_path_topdir(const char *path);
|
71
|
-
|
72
70
|
/**
|
73
71
|
* Find offset to root of path if path has one.
|
74
72
|
*
|
@@ -285,7 +283,7 @@ extern int git_path_prettify_dir(git_buf *path_out, const char *path, const char
|
|
285
283
|
* appends the trailing '/'. If the path does not exist, it is
|
286
284
|
* treated like a regular filename.
|
287
285
|
*/
|
288
|
-
extern int git_path_find_dir(git_buf *dir
|
286
|
+
extern int git_path_find_dir(git_buf *dir);
|
289
287
|
|
290
288
|
/**
|
291
289
|
* Resolve relative references within a path.
|
@@ -628,20 +626,95 @@ extern int git_path_from_url_or_path(git_buf *local_path_out, const char *url_or
|
|
628
626
|
#define GIT_PATH_REJECT_INDEX_DEFAULTS \
|
629
627
|
GIT_PATH_REJECT_TRAVERSAL | GIT_PATH_REJECT_DOT_GIT
|
630
628
|
|
631
|
-
|
632
|
-
*
|
629
|
+
/**
|
630
|
+
* Validate a "bare" git path. This ensures that the given path is legal
|
631
|
+
* to place in the index or a tree. This should be checked by mechanisms
|
632
|
+
* like `git_index_add` and `git_treebuilder_insert` when taking user
|
633
|
+
* data, and by `git_checkout` before constructing on-disk paths.
|
634
|
+
*
|
635
|
+
* This will ensure that a git path does not contain any "unsafe" components,
|
633
636
|
* a '.' or '..' component, or a component that is ".git" (in any case).
|
634
637
|
*
|
638
|
+
* (Note: if you take or construct an on-disk path -- a workdir path,
|
639
|
+
* a path to a git repository or a reference name that could be a loose
|
640
|
+
* ref -- you should _also_ validate that with `git_path_validate_workdir`.)
|
641
|
+
*
|
635
642
|
* `repo` is optional. If specified, it will be used to determine the short
|
636
643
|
* path name to reject (if `GIT_PATH_REJECT_DOS_SHORTNAME` is specified),
|
637
644
|
* in addition to the default of "git~1".
|
638
645
|
*/
|
639
|
-
extern bool
|
646
|
+
extern bool git_path_validate(
|
640
647
|
git_repository *repo,
|
641
648
|
const char *path,
|
642
649
|
uint16_t mode,
|
643
650
|
unsigned int flags);
|
644
651
|
|
652
|
+
/**
|
653
|
+
* Validate an on-disk path, taking into account that it will have a
|
654
|
+
* suffix appended (eg, `.lock`).
|
655
|
+
*/
|
656
|
+
GIT_INLINE(int) git_path_validate_filesystem_with_suffix(
|
657
|
+
const char *path,
|
658
|
+
size_t path_len,
|
659
|
+
size_t suffix_len)
|
660
|
+
{
|
661
|
+
#ifdef GIT_WIN32
|
662
|
+
size_t path_chars, total_chars;
|
663
|
+
|
664
|
+
path_chars = git_utf8_char_length(path, path_len);
|
665
|
+
|
666
|
+
if (GIT_ADD_SIZET_OVERFLOW(&total_chars, path_chars, suffix_len) ||
|
667
|
+
total_chars > MAX_PATH) {
|
668
|
+
git_error_set(GIT_ERROR_FILESYSTEM, "path too long: '%s'", path);
|
669
|
+
return -1;
|
670
|
+
}
|
671
|
+
return 0;
|
672
|
+
#else
|
673
|
+
GIT_UNUSED(path);
|
674
|
+
GIT_UNUSED(path_len);
|
675
|
+
GIT_UNUSED(suffix_len);
|
676
|
+
return 0;
|
677
|
+
#endif
|
678
|
+
}
|
679
|
+
|
680
|
+
/**
|
681
|
+
* Validate an path on the filesystem. This ensures that the given
|
682
|
+
* path is valid for the operating system/platform; for example, this
|
683
|
+
* will ensure that the given absolute path is smaller than MAX_PATH on
|
684
|
+
* Windows.
|
685
|
+
*
|
686
|
+
* For paths within the working directory, you should use ensure that
|
687
|
+
* `core.longpaths` is obeyed. Use `git_path_validate_workdir`.
|
688
|
+
*/
|
689
|
+
GIT_INLINE(int) git_path_validate_filesystem(
|
690
|
+
const char *path,
|
691
|
+
size_t path_len)
|
692
|
+
{
|
693
|
+
return git_path_validate_filesystem_with_suffix(path, path_len, 0);
|
694
|
+
}
|
695
|
+
|
696
|
+
/**
|
697
|
+
* Validate a path relative to the repo's worktree. This ensures that
|
698
|
+
* the given working tree path is valid for the operating system/platform.
|
699
|
+
* This will ensure that an absolute path is smaller than MAX_PATH on
|
700
|
+
* Windows, while keeping `core.longpaths` configuration settings in mind.
|
701
|
+
*
|
702
|
+
* This should be checked by mechamisms like `git_checkout` after
|
703
|
+
* contructing on-disk paths and before trying to write them.
|
704
|
+
*
|
705
|
+
* If the repository is null, no repository configuration is applied.
|
706
|
+
*/
|
707
|
+
extern int git_path_validate_workdir(
|
708
|
+
git_repository *repo,
|
709
|
+
const char *path);
|
710
|
+
extern int git_path_validate_workdir_with_len(
|
711
|
+
git_repository *repo,
|
712
|
+
const char *path,
|
713
|
+
size_t path_len);
|
714
|
+
extern int git_path_validate_workdir_buf(
|
715
|
+
git_repository *repo,
|
716
|
+
git_buf *buf);
|
717
|
+
|
645
718
|
/**
|
646
719
|
* Convert any backslashes into slashes
|
647
720
|
*/
|
@@ -9,7 +9,6 @@
|
|
9
9
|
|
10
10
|
#include "git2/pathspec.h"
|
11
11
|
#include "git2/diff.h"
|
12
|
-
#include "buf_text.h"
|
13
12
|
#include "attr_file.h"
|
14
13
|
#include "iterator.h"
|
15
14
|
#include "repository.h"
|
@@ -25,7 +24,7 @@ char *git_pathspec_prefix(const git_strarray *pathspec)
|
|
25
24
|
const char *scan;
|
26
25
|
|
27
26
|
if (!pathspec || !pathspec->count ||
|
28
|
-
|
27
|
+
git_buf_common_prefix(&prefix, pathspec) < 0)
|
29
28
|
return NULL;
|
30
29
|
|
31
30
|
/* diff prefix will only be leading non-wildcards */
|
@@ -41,7 +40,7 @@ char *git_pathspec_prefix(const git_strarray *pathspec)
|
|
41
40
|
return NULL;
|
42
41
|
}
|
43
42
|
|
44
|
-
|
43
|
+
git_buf_unescape(&prefix);
|
45
44
|
|
46
45
|
return git_buf_detach(&prefix);
|
47
46
|
}
|
@@ -238,9 +237,9 @@ int git_pathspec__init(git_pathspec *ps, const git_strarray *paths)
|
|
238
237
|
memset(ps, 0, sizeof(*ps));
|
239
238
|
|
240
239
|
ps->prefix = git_pathspec_prefix(paths);
|
241
|
-
git_pool_init(&ps->pool, 1);
|
242
240
|
|
243
|
-
if ((error =
|
241
|
+
if ((error = git_pool_init(&ps->pool, 1)) < 0 ||
|
242
|
+
(error = git_pathspec__vinit(&ps->pathspec, paths, &ps->pool)) < 0)
|
244
243
|
git_pathspec__clear(ps);
|
245
244
|
|
246
245
|
return error;
|
@@ -289,7 +288,8 @@ int git_pathspec_matches_path(
|
|
289
288
|
bool no_fnmatch = (flags & GIT_PATHSPEC_NO_GLOB) != 0;
|
290
289
|
bool casefold = (flags & GIT_PATHSPEC_IGNORE_CASE) != 0;
|
291
290
|
|
292
|
-
|
291
|
+
GIT_ASSERT_ARG(ps);
|
292
|
+
GIT_ASSERT_ARG(path);
|
293
293
|
|
294
294
|
return (0 != git_pathspec__match(
|
295
295
|
&ps->pathspec, path, no_fnmatch, casefold, NULL, NULL));
|
@@ -316,7 +316,8 @@ static git_pathspec_match_list *pathspec_match_alloc(
|
|
316
316
|
if (!m)
|
317
317
|
return NULL;
|
318
318
|
|
319
|
-
git_pool_init(&m->pool, 1)
|
319
|
+
if (git_pool_init(&m->pool, 1) < 0)
|
320
|
+
return NULL;
|
320
321
|
|
321
322
|
/* need to keep reference to pathspec and increment refcount because
|
322
323
|
* failures array stores pointers to the pattern strings of the
|
@@ -525,7 +526,7 @@ int git_pathspec_match_workdir(
|
|
525
526
|
git_iterator_options iter_opts = GIT_ITERATOR_OPTIONS_INIT;
|
526
527
|
int error = 0;
|
527
528
|
|
528
|
-
|
529
|
+
GIT_ASSERT_ARG(repo);
|
529
530
|
|
530
531
|
iter_opts.flags = pathspec_match_iter_flags(flags);
|
531
532
|
|
@@ -547,7 +548,7 @@ int git_pathspec_match_index(
|
|
547
548
|
git_iterator_options iter_opts = GIT_ITERATOR_OPTIONS_INIT;
|
548
549
|
int error = 0;
|
549
550
|
|
550
|
-
|
551
|
+
GIT_ASSERT_ARG(index);
|
551
552
|
|
552
553
|
iter_opts.flags = pathspec_match_iter_flags(flags);
|
553
554
|
|
@@ -569,7 +570,7 @@ int git_pathspec_match_tree(
|
|
569
570
|
git_iterator_options iter_opts = GIT_ITERATOR_OPTIONS_INIT;
|
570
571
|
int error = 0;
|
571
572
|
|
572
|
-
|
573
|
+
GIT_ASSERT_ARG(tree);
|
573
574
|
|
574
575
|
iter_opts.flags = pathspec_match_iter_flags(flags);
|
575
576
|
|
@@ -597,7 +598,7 @@ int git_pathspec_match_diff(
|
|
597
598
|
const git_diff_delta *delta, **match;
|
598
599
|
git_bitvec used_patterns;
|
599
600
|
|
600
|
-
|
601
|
+
GIT_ASSERT_ARG(diff);
|
601
602
|
|
602
603
|
if (git_bitvec_init(&used_patterns, patterns->length) < 0)
|
603
604
|
return -1;
|
data/vendor/libgit2/src/pool.c
CHANGED
@@ -21,30 +21,29 @@ struct git_pool_page {
|
|
21
21
|
|
22
22
|
static void *pool_alloc_page(git_pool *pool, size_t size);
|
23
23
|
|
24
|
-
|
25
|
-
{
|
26
|
-
static size_t size = 0;
|
24
|
+
#ifndef GIT_DEBUG_POOL
|
27
25
|
|
28
|
-
|
29
|
-
size_t page_size;
|
30
|
-
if (git__page_size(&page_size) < 0)
|
31
|
-
page_size = 4096;
|
32
|
-
/* allow space for malloc overhead */
|
33
|
-
size = (page_size - (2 * sizeof(void *)) - sizeof(git_pool_page));
|
34
|
-
}
|
26
|
+
static size_t system_page_size = 0;
|
35
27
|
|
36
|
-
|
28
|
+
int git_pool_global_init(void)
|
29
|
+
{
|
30
|
+
if (git__page_size(&system_page_size) < 0)
|
31
|
+
system_page_size = 4096;
|
32
|
+
/* allow space for malloc overhead */
|
33
|
+
system_page_size -= (2 * sizeof(void *)) + sizeof(git_pool_page);
|
34
|
+
return 0;
|
37
35
|
}
|
38
36
|
|
39
|
-
|
40
|
-
void git_pool_init(git_pool *pool, size_t item_size)
|
37
|
+
int git_pool_init(git_pool *pool, size_t item_size)
|
41
38
|
{
|
42
|
-
|
43
|
-
|
39
|
+
GIT_ASSERT_ARG(pool);
|
40
|
+
GIT_ASSERT_ARG(item_size >= 1);
|
44
41
|
|
45
42
|
memset(pool, 0, sizeof(git_pool));
|
46
43
|
pool->item_size = item_size;
|
47
|
-
pool->page_size =
|
44
|
+
pool->page_size = system_page_size;
|
45
|
+
|
46
|
+
return 0;
|
48
47
|
}
|
49
48
|
|
50
49
|
void git_pool_clear(git_pool *pool)
|
@@ -112,6 +111,11 @@ bool git_pool__ptr_in_pool(git_pool *pool, void *ptr)
|
|
112
111
|
|
113
112
|
#else
|
114
113
|
|
114
|
+
int git_pool_global_init(void)
|
115
|
+
{
|
116
|
+
return 0;
|
117
|
+
}
|
118
|
+
|
115
119
|
static int git_pool__ptr_cmp(const void * a, const void * b)
|
116
120
|
{
|
117
121
|
if(a > b) {
|
@@ -125,15 +129,17 @@ static int git_pool__ptr_cmp(const void * a, const void * b)
|
|
125
129
|
}
|
126
130
|
}
|
127
131
|
|
128
|
-
|
132
|
+
int git_pool_init(git_pool *pool, size_t item_size)
|
129
133
|
{
|
130
|
-
|
131
|
-
|
134
|
+
GIT_ASSERT_ARG(pool);
|
135
|
+
GIT_ASSERT_ARG(item_size >= 1);
|
132
136
|
|
133
137
|
memset(pool, 0, sizeof(git_pool));
|
134
138
|
pool->item_size = item_size;
|
135
139
|
pool->page_size = git_pool__system_page_size();
|
136
140
|
git_vector_init(&pool->allocations, 100, git_pool__ptr_cmp);
|
141
|
+
|
142
|
+
return 0;
|
137
143
|
}
|
138
144
|
|
139
145
|
void git_pool_clear(git_pool *pool)
|
@@ -199,7 +205,9 @@ char *git_pool_strndup(git_pool *pool, const char *str, size_t n)
|
|
199
205
|
{
|
200
206
|
char *ptr = NULL;
|
201
207
|
|
202
|
-
|
208
|
+
GIT_ASSERT_ARG_WITH_RETVAL(pool, NULL);
|
209
|
+
GIT_ASSERT_ARG_WITH_RETVAL(str, NULL);
|
210
|
+
GIT_ASSERT_ARG_WITH_RETVAL(pool->item_size == sizeof(char), NULL);
|
203
211
|
|
204
212
|
if (n == SIZE_MAX)
|
205
213
|
return NULL;
|
@@ -214,7 +222,10 @@ char *git_pool_strndup(git_pool *pool, const char *str, size_t n)
|
|
214
222
|
|
215
223
|
char *git_pool_strdup(git_pool *pool, const char *str)
|
216
224
|
{
|
217
|
-
|
225
|
+
GIT_ASSERT_ARG_WITH_RETVAL(pool, NULL);
|
226
|
+
GIT_ASSERT_ARG_WITH_RETVAL(str, NULL);
|
227
|
+
GIT_ASSERT_ARG_WITH_RETVAL(pool->item_size == sizeof(char), NULL);
|
228
|
+
|
218
229
|
return git_pool_strndup(pool, str, strlen(str));
|
219
230
|
}
|
220
231
|
|
@@ -228,7 +239,8 @@ char *git_pool_strcat(git_pool *pool, const char *a, const char *b)
|
|
228
239
|
void *ptr;
|
229
240
|
size_t len_a, len_b, total;
|
230
241
|
|
231
|
-
|
242
|
+
GIT_ASSERT_ARG_WITH_RETVAL(pool, NULL);
|
243
|
+
GIT_ASSERT_ARG_WITH_RETVAL(pool->item_size == sizeof(char), NULL);
|
232
244
|
|
233
245
|
len_a = a ? strlen(a) : 0;
|
234
246
|
len_b = b ? strlen(b) : 0;
|
data/vendor/libgit2/src/pool.h
CHANGED
@@ -81,7 +81,7 @@ typedef struct {
|
|
81
81
|
* Of course, you can use this in other ways, but those are the
|
82
82
|
* two most common patterns.
|
83
83
|
*/
|
84
|
-
extern
|
84
|
+
extern int git_pool_init(git_pool *pool, size_t item_size);
|
85
85
|
|
86
86
|
/**
|
87
87
|
* Free all items in pool
|
@@ -135,4 +135,12 @@ extern uint32_t git_pool__open_pages(git_pool *pool);
|
|
135
135
|
#endif
|
136
136
|
extern bool git_pool__ptr_in_pool(git_pool *pool, void *ptr);
|
137
137
|
|
138
|
+
/**
|
139
|
+
* This function is being called by our global setup routines to
|
140
|
+
* initialize the system pool size.
|
141
|
+
*
|
142
|
+
* @return 0 on success, <0 on failure
|
143
|
+
*/
|
144
|
+
extern int git_pool_global_init(void);
|
145
|
+
|
138
146
|
#endif
|
data/vendor/libgit2/src/posix.c
CHANGED
@@ -109,6 +109,13 @@ int p_open(const char *path, volatile int flags, ...)
|
|
109
109
|
{
|
110
110
|
mode_t mode = 0;
|
111
111
|
|
112
|
+
#ifdef GIT_DEBUG_STRICT_OPEN
|
113
|
+
if (strstr(path, "//") != NULL) {
|
114
|
+
errno = EACCES;
|
115
|
+
return -1;
|
116
|
+
}
|
117
|
+
#endif
|
118
|
+
|
112
119
|
if (flags & O_CREAT) {
|
113
120
|
va_list arg_list;
|
114
121
|
|
@@ -129,7 +136,8 @@ int p_getcwd(char *buffer_out, size_t size)
|
|
129
136
|
{
|
130
137
|
char *cwd_buffer;
|
131
138
|
|
132
|
-
|
139
|
+
GIT_ASSERT_ARG(buffer_out);
|
140
|
+
GIT_ASSERT_ARG(size > 0);
|
133
141
|
|
134
142
|
cwd_buffer = getcwd(buffer_out, size);
|
135
143
|
|
@@ -196,7 +204,7 @@ int p_write(git_file fd, const void *buf, size_t cnt)
|
|
196
204
|
while (cnt) {
|
197
205
|
ssize_t r;
|
198
206
|
#ifdef GIT_WIN32
|
199
|
-
|
207
|
+
GIT_ASSERT((size_t)((unsigned int)cnt) == cnt);
|
200
208
|
r = write(fd, b, (unsigned int)cnt);
|
201
209
|
#else
|
202
210
|
r = write(fd, b, cnt);
|
@@ -237,24 +245,43 @@ int git__mmap_alignment(size_t *alignment)
|
|
237
245
|
|
238
246
|
int p_mmap(git_map *out, size_t len, int prot, int flags, int fd, off64_t offset)
|
239
247
|
{
|
248
|
+
const char *ptr;
|
249
|
+
size_t remaining_len;
|
250
|
+
|
240
251
|
GIT_MMAP_VALIDATE(out, len, prot, flags);
|
241
252
|
|
242
|
-
|
243
|
-
|
253
|
+
/* writes cannot be emulated without handling pagefaults since write happens by
|
254
|
+
* writing to mapped memory */
|
255
|
+
if (prot & GIT_PROT_WRITE) {
|
256
|
+
git_error_set(GIT_ERROR_OS, "trying to map %s-writeable",
|
257
|
+
((flags & GIT_MAP_TYPE) == GIT_MAP_SHARED) ? "shared": "private");
|
258
|
+
return -1;
|
259
|
+
}
|
244
260
|
|
245
|
-
if ((
|
246
|
-
|
261
|
+
if (!git__is_ssizet(len)) {
|
262
|
+
errno = EINVAL;
|
247
263
|
return -1;
|
248
264
|
}
|
249
265
|
|
266
|
+
out->len = 0;
|
250
267
|
out->data = git__malloc(len);
|
251
268
|
GIT_ERROR_CHECK_ALLOC(out->data);
|
252
269
|
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
270
|
+
remaining_len = len;
|
271
|
+
ptr = (const char *)out->data;
|
272
|
+
while (remaining_len > 0) {
|
273
|
+
ssize_t nb;
|
274
|
+
HANDLE_EINTR(nb, p_pread(fd, (void *)ptr, remaining_len, offset));
|
275
|
+
if (nb <= 0) {
|
276
|
+
git_error_set(GIT_ERROR_OS, "mmap emulation failed");
|
277
|
+
git__free(out->data);
|
278
|
+
out->data = NULL;
|
279
|
+
return -1;
|
280
|
+
}
|
281
|
+
|
282
|
+
ptr += nb;
|
283
|
+
offset += nb;
|
284
|
+
remaining_len -= nb;
|
258
285
|
}
|
259
286
|
|
260
287
|
out->len = len;
|
@@ -263,9 +290,13 @@ int p_mmap(git_map *out, size_t len, int prot, int flags, int fd, off64_t offset
|
|
263
290
|
|
264
291
|
int p_munmap(git_map *map)
|
265
292
|
{
|
266
|
-
|
293
|
+
GIT_ASSERT_ARG(map);
|
267
294
|
git__free(map->data);
|
268
295
|
|
296
|
+
/* Initializing will help debug use-after-free */
|
297
|
+
map->len = 0;
|
298
|
+
map->data = NULL;
|
299
|
+
|
269
300
|
return 0;
|
270
301
|
}
|
271
302
|
|
data/vendor/libgit2/src/posix.h
CHANGED
@@ -89,6 +89,12 @@
|
|
89
89
|
#define EAFNOSUPPORT (INT_MAX-1)
|
90
90
|
#endif
|
91
91
|
|
92
|
+
/* Compiler independent macro to handle signal interrpted system calls */
|
93
|
+
#define HANDLE_EINTR(result, x) do { \
|
94
|
+
result = (x); \
|
95
|
+
} while (result == -1 && errno == EINTR);
|
96
|
+
|
97
|
+
|
92
98
|
/* Provide a 64-bit size for offsets. */
|
93
99
|
|
94
100
|
#if defined(_MSC_VER)
|
@@ -119,6 +125,9 @@ typedef int git_file;
|
|
119
125
|
extern ssize_t p_read(git_file fd, void *buf, size_t cnt);
|
120
126
|
extern int p_write(git_file fd, const void *buf, size_t cnt);
|
121
127
|
|
128
|
+
extern ssize_t p_pread(int fd, void *data, size_t size, off64_t offset);
|
129
|
+
extern ssize_t p_pwrite(int fd, const void *data, size_t size, off64_t offset);
|
130
|
+
|
122
131
|
#define p_close(fd) close(fd)
|
123
132
|
#define p_umask(m) umask(m)
|
124
133
|
|