rugged 0.27.7 → 0.27.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/rugged/version.rb +1 -1
- data/vendor/libgit2/AUTHORS +1 -0
- data/vendor/libgit2/CMakeLists.txt +99 -51
- data/vendor/libgit2/COPYING +28 -0
- data/vendor/libgit2/cmake/Modules/AddCFlagIfSupported.cmake +15 -1
- data/vendor/libgit2/cmake/Modules/CheckPrototypeDefinition.c.in +29 -0
- data/vendor/libgit2/cmake/Modules/CheckPrototypeDefinition.cmake +96 -0
- data/vendor/libgit2/cmake/Modules/EnableWarnings.cmake +9 -8
- data/vendor/libgit2/cmake/Modules/FindCoreFoundation.cmake +2 -2
- data/vendor/libgit2/cmake/Modules/FindGSSAPI.cmake +1 -1
- data/vendor/libgit2/cmake/Modules/FindGSSFramework.cmake +28 -0
- data/vendor/libgit2/cmake/Modules/FindIconv.cmake +11 -6
- data/vendor/libgit2/cmake/Modules/FindPCRE.cmake +38 -0
- data/vendor/libgit2/cmake/Modules/FindPCRE2.cmake +37 -0
- data/vendor/libgit2/cmake/Modules/FindSecurity.cmake +2 -2
- data/vendor/libgit2/cmake/Modules/FindStatNsec.cmake +6 -0
- data/vendor/libgit2/cmake/Modules/PkgBuildConfig.cmake +110 -0
- data/vendor/libgit2/cmake/Modules/SelectGSSAPI.cmake +53 -0
- data/vendor/libgit2/cmake/Modules/SelectHTTPSBackend.cmake +124 -0
- data/vendor/libgit2/cmake/Modules/SelectHashes.cmake +66 -0
- data/vendor/libgit2/deps/http-parser/http_parser.c +11 -6
- data/vendor/libgit2/deps/ntlmclient/CMakeLists.txt +21 -0
- data/vendor/libgit2/deps/ntlmclient/compat.h +33 -0
- data/vendor/libgit2/deps/ntlmclient/crypt.h +64 -0
- data/vendor/libgit2/deps/ntlmclient/crypt_commoncrypto.c +120 -0
- data/vendor/libgit2/deps/ntlmclient/crypt_commoncrypto.h +18 -0
- data/vendor/libgit2/deps/ntlmclient/crypt_mbedtls.c +145 -0
- data/vendor/libgit2/deps/ntlmclient/crypt_mbedtls.h +18 -0
- data/vendor/libgit2/deps/ntlmclient/crypt_openssl.c +130 -0
- data/vendor/libgit2/deps/ntlmclient/crypt_openssl.h +21 -0
- data/vendor/libgit2/deps/ntlmclient/ntlm.c +1420 -0
- data/vendor/libgit2/deps/ntlmclient/ntlm.h +174 -0
- data/vendor/libgit2/deps/ntlmclient/ntlmclient.h +320 -0
- data/vendor/libgit2/deps/ntlmclient/unicode.h +36 -0
- data/vendor/libgit2/deps/ntlmclient/unicode_builtin.c +445 -0
- data/vendor/libgit2/deps/ntlmclient/unicode_iconv.c +201 -0
- data/vendor/libgit2/deps/ntlmclient/utf8.h +1257 -0
- data/vendor/libgit2/deps/ntlmclient/util.c +21 -0
- data/vendor/libgit2/deps/ntlmclient/util.h +14 -0
- data/vendor/libgit2/deps/pcre/CMakeLists.txt +140 -0
- data/vendor/libgit2/deps/pcre/COPYING +5 -0
- data/vendor/libgit2/deps/pcre/cmake/COPYING-CMAKE-SCRIPTS +22 -0
- data/vendor/libgit2/deps/pcre/cmake/FindEditline.cmake +17 -0
- data/vendor/libgit2/deps/pcre/cmake/FindPackageHandleStandardArgs.cmake +58 -0
- data/vendor/libgit2/deps/pcre/cmake/FindReadline.cmake +29 -0
- data/vendor/libgit2/deps/pcre/config.h.in +57 -0
- data/vendor/libgit2/deps/pcre/pcre.h +641 -0
- data/vendor/libgit2/deps/pcre/pcre_byte_order.c +319 -0
- data/vendor/libgit2/deps/pcre/pcre_chartables.c +198 -0
- data/vendor/libgit2/deps/pcre/pcre_compile.c +9800 -0
- data/vendor/libgit2/deps/pcre/pcre_config.c +190 -0
- data/vendor/libgit2/deps/pcre/pcre_dfa_exec.c +3676 -0
- data/vendor/libgit2/deps/pcre/pcre_exec.c +7173 -0
- data/vendor/libgit2/deps/pcre/pcre_fullinfo.c +245 -0
- data/vendor/libgit2/deps/pcre/pcre_get.c +669 -0
- data/vendor/libgit2/deps/pcre/pcre_globals.c +86 -0
- data/vendor/libgit2/deps/pcre/pcre_internal.h +2787 -0
- data/vendor/libgit2/deps/pcre/pcre_jit_compile.c +11913 -0
- data/vendor/libgit2/deps/pcre/pcre_maketables.c +156 -0
- data/vendor/libgit2/deps/pcre/pcre_newline.c +210 -0
- data/vendor/libgit2/deps/pcre/pcre_ord2utf8.c +94 -0
- data/vendor/libgit2/deps/pcre/pcre_printint.c +834 -0
- data/vendor/libgit2/deps/pcre/pcre_refcount.c +92 -0
- data/vendor/libgit2/deps/pcre/pcre_string_utils.c +211 -0
- data/vendor/libgit2/deps/pcre/pcre_study.c +1686 -0
- data/vendor/libgit2/deps/pcre/pcre_tables.c +727 -0
- data/vendor/libgit2/deps/pcre/pcre_ucd.c +3644 -0
- data/vendor/libgit2/deps/pcre/pcre_valid_utf8.c +301 -0
- data/vendor/libgit2/deps/pcre/pcre_version.c +98 -0
- data/vendor/libgit2/deps/pcre/pcre_xclass.c +268 -0
- data/vendor/libgit2/deps/pcre/pcreposix.c +421 -0
- data/vendor/libgit2/deps/pcre/pcreposix.h +117 -0
- data/vendor/libgit2/deps/pcre/ucp.h +224 -0
- data/vendor/libgit2/deps/winhttp/COPYING.GPL +993 -0
- data/vendor/libgit2/deps/winhttp/COPYING.LGPL +502 -0
- data/vendor/libgit2/deps/zlib/CMakeLists.txt +1 -0
- data/vendor/libgit2/deps/zlib/COPYING +27 -0
- data/vendor/libgit2/deps/zlib/adler32.c +0 -7
- data/vendor/libgit2/deps/zlib/crc32.c +0 -7
- data/vendor/libgit2/include/git2/annotated_commit.h +9 -0
- data/vendor/libgit2/include/git2/apply.h +149 -0
- data/vendor/libgit2/include/git2/attr.h +20 -13
- data/vendor/libgit2/include/git2/blame.h +4 -4
- data/vendor/libgit2/include/git2/blob.h +44 -12
- data/vendor/libgit2/include/git2/buffer.h +20 -26
- data/vendor/libgit2/include/git2/cert.h +135 -0
- data/vendor/libgit2/include/git2/checkout.h +53 -21
- data/vendor/libgit2/include/git2/cherrypick.h +3 -3
- data/vendor/libgit2/include/git2/clone.h +5 -5
- data/vendor/libgit2/include/git2/commit.h +25 -3
- data/vendor/libgit2/include/git2/common.h +35 -10
- data/vendor/libgit2/include/git2/config.h +29 -19
- data/vendor/libgit2/include/git2/cred.h +308 -0
- data/vendor/libgit2/include/git2/deprecated.h +493 -0
- data/vendor/libgit2/include/git2/describe.h +4 -4
- data/vendor/libgit2/include/git2/diff.h +177 -135
- data/vendor/libgit2/include/git2/errors.h +53 -46
- data/vendor/libgit2/include/git2/filter.h +8 -0
- data/vendor/libgit2/include/git2/index.h +74 -52
- data/vendor/libgit2/include/git2/indexer.h +76 -6
- data/vendor/libgit2/include/git2/merge.h +25 -10
- data/vendor/libgit2/include/git2/net.h +0 -5
- data/vendor/libgit2/include/git2/notes.h +1 -1
- data/vendor/libgit2/include/git2/object.h +17 -29
- data/vendor/libgit2/include/git2/odb.h +12 -11
- data/vendor/libgit2/include/git2/odb_backend.h +10 -9
- data/vendor/libgit2/include/git2/oid.h +2 -2
- data/vendor/libgit2/include/git2/pack.h +14 -3
- data/vendor/libgit2/include/git2/proxy.h +5 -3
- data/vendor/libgit2/include/git2/rebase.h +46 -2
- data/vendor/libgit2/include/git2/refs.h +34 -16
- data/vendor/libgit2/include/git2/remote.h +111 -14
- data/vendor/libgit2/include/git2/repository.h +69 -34
- data/vendor/libgit2/include/git2/revert.h +1 -1
- data/vendor/libgit2/include/git2/revwalk.h +7 -7
- data/vendor/libgit2/include/git2/signature.h +2 -2
- data/vendor/libgit2/include/git2/stash.h +5 -5
- data/vendor/libgit2/include/git2/status.h +26 -17
- data/vendor/libgit2/include/git2/submodule.h +23 -6
- data/vendor/libgit2/include/git2/sys/alloc.h +18 -18
- data/vendor/libgit2/include/git2/sys/commit.h +1 -1
- data/vendor/libgit2/include/git2/sys/config.h +13 -13
- data/vendor/libgit2/include/git2/sys/cred.h +90 -0
- data/vendor/libgit2/include/git2/sys/filter.h +6 -6
- data/vendor/libgit2/include/git2/sys/merge.h +3 -3
- data/vendor/libgit2/include/git2/sys/odb_backend.h +66 -22
- data/vendor/libgit2/include/git2/sys/path.h +14 -5
- data/vendor/libgit2/include/git2/sys/refdb_backend.h +76 -40
- data/vendor/libgit2/include/git2/sys/repository.h +5 -1
- data/vendor/libgit2/include/git2/sys/stream.h +92 -12
- data/vendor/libgit2/include/git2/sys/transport.h +129 -83
- data/vendor/libgit2/include/git2/tag.h +13 -4
- data/vendor/libgit2/include/git2/trace.h +2 -2
- data/vendor/libgit2/include/git2/transport.h +11 -311
- data/vendor/libgit2/include/git2/tree.h +4 -4
- data/vendor/libgit2/include/git2/types.h +25 -106
- data/vendor/libgit2/include/git2/version.h +3 -3
- data/vendor/libgit2/include/git2/worktree.h +5 -5
- data/vendor/libgit2/include/git2.h +4 -0
- data/vendor/libgit2/src/CMakeLists.txt +104 -235
- data/vendor/libgit2/src/alloc.c +14 -18
- data/vendor/libgit2/src/{stdalloc.c → allocators/stdalloc.c} +7 -8
- data/vendor/libgit2/src/{stdalloc.h → allocators/stdalloc.h} +4 -4
- data/vendor/libgit2/src/allocators/win32_crtdbg.c +118 -0
- data/vendor/libgit2/src/{transports/cred.h → allocators/win32_crtdbg.h} +5 -4
- data/vendor/libgit2/src/annotated_commit.c +18 -11
- data/vendor/libgit2/src/apply.c +535 -28
- data/vendor/libgit2/src/apply.h +3 -1
- data/vendor/libgit2/src/array.h +2 -2
- data/vendor/libgit2/src/attr.c +77 -71
- data/vendor/libgit2/src/attr_file.c +203 -117
- data/vendor/libgit2/src/attr_file.h +9 -9
- data/vendor/libgit2/src/attrcache.c +49 -51
- data/vendor/libgit2/src/attrcache.h +2 -1
- data/vendor/libgit2/src/blame.c +38 -18
- data/vendor/libgit2/src/blame.h +1 -1
- data/vendor/libgit2/src/blame_git.c +29 -15
- data/vendor/libgit2/src/blob.c +123 -37
- data/vendor/libgit2/src/blob.h +19 -2
- data/vendor/libgit2/src/branch.c +47 -23
- data/vendor/libgit2/src/buf_text.c +7 -6
- data/vendor/libgit2/src/buffer.c +60 -53
- data/vendor/libgit2/src/cache.c +38 -45
- data/vendor/libgit2/src/cache.h +3 -3
- data/vendor/libgit2/src/cc-compat.h +20 -3
- data/vendor/libgit2/src/checkout.c +77 -67
- data/vendor/libgit2/src/cherrypick.c +12 -6
- data/vendor/libgit2/src/clone.c +36 -14
- data/vendor/libgit2/src/clone.h +4 -0
- data/vendor/libgit2/src/commit.c +103 -48
- data/vendor/libgit2/src/commit.h +7 -0
- data/vendor/libgit2/src/commit_list.c +36 -78
- data/vendor/libgit2/src/commit_list.h +2 -2
- data/vendor/libgit2/src/common.h +24 -90
- data/vendor/libgit2/src/config.c +203 -176
- data/vendor/libgit2/src/config.h +8 -20
- data/vendor/libgit2/src/config_backend.h +96 -0
- data/vendor/libgit2/src/config_cache.c +41 -35
- data/vendor/libgit2/src/config_entries.c +229 -0
- data/vendor/libgit2/src/config_entries.h +24 -0
- data/vendor/libgit2/src/config_file.c +422 -680
- data/vendor/libgit2/src/config_mem.c +220 -0
- data/vendor/libgit2/src/config_parse.c +96 -68
- data/vendor/libgit2/src/config_parse.h +15 -14
- data/vendor/libgit2/src/config_snapshot.c +206 -0
- data/vendor/libgit2/src/crlf.c +219 -196
- data/vendor/libgit2/src/delta.c +25 -18
- data/vendor/libgit2/src/describe.c +42 -41
- data/vendor/libgit2/src/diff.c +52 -67
- data/vendor/libgit2/src/diff.h +2 -1
- data/vendor/libgit2/src/diff_driver.c +44 -46
- data/vendor/libgit2/src/diff_file.c +16 -14
- data/vendor/libgit2/src/diff_file.h +1 -1
- data/vendor/libgit2/src/diff_generate.c +158 -103
- data/vendor/libgit2/src/diff_generate.h +3 -3
- data/vendor/libgit2/src/diff_parse.c +4 -4
- data/vendor/libgit2/src/diff_print.c +34 -22
- data/vendor/libgit2/src/diff_stats.c +22 -7
- data/vendor/libgit2/src/diff_tform.c +18 -16
- data/vendor/libgit2/src/diff_xdiff.c +3 -3
- data/vendor/libgit2/src/errors.c +51 -39
- data/vendor/libgit2/src/errors.h +81 -0
- data/vendor/libgit2/src/features.h.in +9 -3
- data/vendor/libgit2/src/fetch.c +8 -3
- data/vendor/libgit2/src/fetchhead.c +12 -12
- data/vendor/libgit2/src/filebuf.c +28 -32
- data/vendor/libgit2/src/filebuf.h +2 -2
- data/vendor/libgit2/src/filter.c +47 -33
- data/vendor/libgit2/src/filter.h +0 -10
- data/vendor/libgit2/src/{fileops.c → futils.c} +70 -63
- data/vendor/libgit2/src/{fileops.h → futils.h} +6 -6
- data/vendor/libgit2/src/global.c +35 -55
- data/vendor/libgit2/src/global.h +0 -2
- data/vendor/libgit2/src/hash/sha1/collisiondetect.c +48 -0
- data/vendor/libgit2/src/hash/sha1/collisiondetect.h +19 -0
- data/vendor/libgit2/src/hash/{hash_common_crypto.h → sha1/common_crypto.c} +17 -17
- data/vendor/libgit2/src/hash/sha1/common_crypto.h +19 -0
- data/vendor/libgit2/src/hash/{hash_generic.c → sha1/generic.c} +22 -10
- data/vendor/libgit2/src/hash/{hash_generic.h → sha1/generic.h} +4 -10
- data/vendor/libgit2/src/hash/{hash_mbedtls.c → sha1/mbedtls.c} +15 -7
- data/vendor/libgit2/src/hash/{hash_mbedtls.h → sha1/mbedtls.h} +6 -7
- data/vendor/libgit2/src/hash/sha1/openssl.c +59 -0
- data/vendor/libgit2/src/hash/sha1/openssl.h +19 -0
- data/vendor/libgit2/src/hash/{sha1dc → sha1/sha1dc}/sha1.c +14 -3
- data/vendor/libgit2/src/hash/{hash_win32.c → sha1/win32.c} +47 -37
- data/vendor/libgit2/src/hash/{hash_win32.h → sha1/win32.h} +6 -19
- data/vendor/libgit2/src/hash/sha1.h +38 -0
- data/vendor/libgit2/src/hash.c +61 -0
- data/vendor/libgit2/src/hash.h +20 -21
- data/vendor/libgit2/src/hashsig.c +5 -5
- data/vendor/libgit2/src/idxmap.c +107 -61
- data/vendor/libgit2/src/idxmap.h +153 -31
- data/vendor/libgit2/src/ignore.c +38 -42
- data/vendor/libgit2/src/index.c +264 -199
- data/vendor/libgit2/src/index.h +7 -1
- data/vendor/libgit2/src/indexer.c +338 -167
- data/vendor/libgit2/src/integer.h +71 -26
- data/vendor/libgit2/src/iterator.c +134 -62
- data/vendor/libgit2/src/iterator.h +15 -0
- data/vendor/libgit2/src/mailmap.c +8 -8
- data/vendor/libgit2/src/map.h +1 -1
- data/vendor/libgit2/src/merge.c +137 -93
- data/vendor/libgit2/src/merge_driver.c +11 -11
- data/vendor/libgit2/src/merge_file.c +2 -2
- data/vendor/libgit2/src/mwindow.c +24 -29
- data/vendor/libgit2/src/mwindow.h +4 -4
- data/vendor/libgit2/src/net.c +184 -0
- data/vendor/libgit2/src/net.h +36 -0
- data/vendor/libgit2/src/netops.c +55 -156
- data/vendor/libgit2/src/netops.h +3 -23
- data/vendor/libgit2/src/notes.c +14 -9
- data/vendor/libgit2/src/object.c +120 -69
- data/vendor/libgit2/src/object.h +22 -9
- data/vendor/libgit2/src/object_api.c +8 -8
- data/vendor/libgit2/src/odb.c +111 -88
- data/vendor/libgit2/src/odb.h +8 -7
- data/vendor/libgit2/src/odb_loose.c +58 -47
- data/vendor/libgit2/src/odb_mempack.c +21 -34
- data/vendor/libgit2/src/odb_pack.c +17 -13
- data/vendor/libgit2/src/offmap.c +53 -35
- data/vendor/libgit2/src/offmap.h +108 -21
- data/vendor/libgit2/src/oid.c +12 -7
- data/vendor/libgit2/src/oidmap.c +49 -47
- data/vendor/libgit2/src/oidmap.h +101 -24
- data/vendor/libgit2/src/pack-objects.c +87 -86
- data/vendor/libgit2/src/pack-objects.h +2 -8
- data/vendor/libgit2/src/pack.c +94 -96
- data/vendor/libgit2/src/pack.h +16 -18
- data/vendor/libgit2/src/parse.c +17 -4
- data/vendor/libgit2/src/parse.h +3 -3
- data/vendor/libgit2/src/patch.c +3 -3
- data/vendor/libgit2/src/patch_generate.c +18 -18
- data/vendor/libgit2/src/patch_parse.c +147 -79
- data/vendor/libgit2/src/path.c +207 -62
- data/vendor/libgit2/src/path.h +14 -0
- data/vendor/libgit2/src/pathspec.c +18 -18
- data/vendor/libgit2/src/pool.c +26 -22
- data/vendor/libgit2/src/pool.h +7 -7
- data/vendor/libgit2/src/posix.c +10 -10
- data/vendor/libgit2/src/posix.h +12 -1
- data/vendor/libgit2/src/proxy.c +8 -3
- data/vendor/libgit2/src/push.c +35 -29
- data/vendor/libgit2/src/push.h +2 -1
- data/vendor/libgit2/src/reader.c +265 -0
- data/vendor/libgit2/src/reader.h +107 -0
- data/vendor/libgit2/src/rebase.c +97 -38
- data/vendor/libgit2/src/refdb.c +15 -3
- data/vendor/libgit2/src/refdb_fs.c +318 -222
- data/vendor/libgit2/src/reflog.c +13 -15
- data/vendor/libgit2/src/refs.c +122 -89
- data/vendor/libgit2/src/refs.h +5 -3
- data/vendor/libgit2/src/refspec.c +27 -33
- data/vendor/libgit2/src/regexp.c +221 -0
- data/vendor/libgit2/src/regexp.h +97 -0
- data/vendor/libgit2/src/remote.c +229 -178
- data/vendor/libgit2/src/remote.h +11 -2
- data/vendor/libgit2/src/repository.c +227 -172
- data/vendor/libgit2/src/repository.h +52 -40
- data/vendor/libgit2/src/reset.c +7 -7
- data/vendor/libgit2/src/revert.c +11 -6
- data/vendor/libgit2/src/revparse.c +46 -46
- data/vendor/libgit2/src/revwalk.c +89 -54
- data/vendor/libgit2/src/revwalk.h +20 -0
- data/vendor/libgit2/src/settings.c +22 -9
- data/vendor/libgit2/src/signature.c +15 -13
- data/vendor/libgit2/src/sortedcache.c +22 -36
- data/vendor/libgit2/src/sortedcache.h +1 -1
- data/vendor/libgit2/src/stash.c +56 -76
- data/vendor/libgit2/src/status.c +27 -21
- data/vendor/libgit2/src/stream.h +17 -2
- data/vendor/libgit2/src/streams/mbedtls.c +100 -80
- data/vendor/libgit2/src/streams/mbedtls.h +5 -2
- data/vendor/libgit2/src/streams/openssl.c +93 -81
- data/vendor/libgit2/src/streams/openssl.h +5 -2
- data/vendor/libgit2/src/streams/registry.c +118 -0
- data/vendor/libgit2/src/streams/registry.h +19 -0
- data/vendor/libgit2/src/streams/socket.c +55 -30
- data/vendor/libgit2/src/streams/stransport.c +57 -32
- data/vendor/libgit2/src/streams/stransport.h +5 -0
- data/vendor/libgit2/src/streams/tls.c +48 -20
- data/vendor/libgit2/src/streams/tls.h +12 -4
- data/vendor/libgit2/src/strmap.c +47 -74
- data/vendor/libgit2/src/strmap.h +108 -33
- data/vendor/libgit2/src/submodule.c +190 -169
- data/vendor/libgit2/src/submodule.h +1 -1
- data/vendor/libgit2/src/sysdir.c +25 -15
- data/vendor/libgit2/src/tag.c +39 -26
- data/vendor/libgit2/src/tag.h +2 -1
- data/vendor/libgit2/src/trace.c +2 -2
- data/vendor/libgit2/src/trace.h +2 -2
- data/vendor/libgit2/src/trailer.c +46 -32
- data/vendor/libgit2/src/transaction.c +30 -29
- data/vendor/libgit2/src/transport.c +3 -3
- data/vendor/libgit2/src/transports/auth.c +14 -10
- data/vendor/libgit2/src/transports/auth.h +10 -3
- data/vendor/libgit2/src/transports/auth_negotiate.c +31 -16
- data/vendor/libgit2/src/transports/auth_negotiate.h +2 -2
- data/vendor/libgit2/src/transports/auth_ntlm.c +223 -0
- data/vendor/libgit2/src/transports/auth_ntlm.h +35 -0
- data/vendor/libgit2/src/transports/cred.c +24 -24
- data/vendor/libgit2/src/transports/git.c +25 -30
- data/vendor/libgit2/src/transports/http.c +871 -335
- data/vendor/libgit2/src/transports/http.h +2 -0
- data/vendor/libgit2/src/transports/local.c +28 -28
- data/vendor/libgit2/src/transports/smart.c +64 -46
- data/vendor/libgit2/src/transports/smart.h +5 -6
- data/vendor/libgit2/src/transports/smart_pkt.c +162 -151
- data/vendor/libgit2/src/transports/smart_protocol.c +64 -94
- data/vendor/libgit2/src/transports/ssh.c +76 -65
- data/vendor/libgit2/src/transports/winhttp.c +328 -319
- data/vendor/libgit2/src/tree-cache.c +21 -14
- data/vendor/libgit2/src/tree.c +119 -112
- data/vendor/libgit2/src/tree.h +1 -0
- data/vendor/libgit2/src/unix/map.c +3 -3
- data/vendor/libgit2/src/unix/posix.h +1 -11
- data/vendor/libgit2/src/userdiff.h +3 -1
- data/vendor/libgit2/src/util.c +154 -93
- data/vendor/libgit2/src/util.h +19 -23
- data/vendor/libgit2/src/vector.c +15 -10
- data/vendor/libgit2/src/wildmatch.c +320 -0
- data/vendor/libgit2/src/wildmatch.h +23 -0
- data/vendor/libgit2/src/win32/dir.c +3 -3
- data/vendor/libgit2/src/win32/findfile.c +1 -1
- data/vendor/libgit2/src/win32/map.c +9 -11
- data/vendor/libgit2/src/win32/msvc-compat.h +6 -0
- data/vendor/libgit2/src/win32/path_w32.c +113 -9
- data/vendor/libgit2/src/win32/path_w32.h +18 -29
- data/vendor/libgit2/src/win32/posix.h +1 -4
- data/vendor/libgit2/src/win32/posix_w32.c +69 -44
- data/vendor/libgit2/src/win32/precompiled.h +0 -2
- data/vendor/libgit2/src/win32/thread.c +5 -10
- data/vendor/libgit2/src/win32/w32_buffer.c +9 -5
- data/vendor/libgit2/src/win32/w32_common.h +39 -0
- data/vendor/libgit2/src/win32/w32_crtdbg_stacktrace.c +2 -95
- data/vendor/libgit2/src/win32/w32_crtdbg_stacktrace.h +0 -2
- data/vendor/libgit2/src/win32/w32_stack.c +6 -11
- data/vendor/libgit2/src/win32/w32_stack.h +3 -3
- data/vendor/libgit2/src/win32/w32_util.c +27 -64
- data/vendor/libgit2/src/win32/w32_util.h +5 -49
- data/vendor/libgit2/src/worktree.c +44 -30
- data/vendor/libgit2/src/xdiff/xdiffi.c +5 -5
- data/vendor/libgit2/src/xdiff/xhistogram.c +1 -1
- data/vendor/libgit2/src/xdiff/xmerge.c +27 -15
- data/vendor/libgit2/src/xdiff/xpatience.c +3 -0
- data/vendor/libgit2/src/zstream.c +4 -4
- metadata +115 -38
- data/vendor/libgit2/deps/regex/CMakeLists.txt +0 -2
- data/vendor/libgit2/deps/regex/config.h +0 -7
- data/vendor/libgit2/deps/regex/regcomp.c +0 -3857
- data/vendor/libgit2/deps/regex/regex.c +0 -92
- data/vendor/libgit2/deps/regex/regex.h +0 -582
- data/vendor/libgit2/deps/regex/regex_internal.c +0 -1744
- data/vendor/libgit2/deps/regex/regex_internal.h +0 -819
- data/vendor/libgit2/deps/regex/regexec.c +0 -4369
- data/vendor/libgit2/include/git2/inttypes.h +0 -309
- data/vendor/libgit2/include/git2/sys/time.h +0 -31
- data/vendor/libgit2/libgit2.pc.in +0 -13
- data/vendor/libgit2/src/config_file.h +0 -73
- data/vendor/libgit2/src/fnmatch.c +0 -248
- data/vendor/libgit2/src/fnmatch.h +0 -48
- data/vendor/libgit2/src/hash/hash_collisiondetect.h +0 -47
- data/vendor/libgit2/src/hash/hash_openssl.h +0 -59
- data/vendor/libgit2/src/streams/curl.c +0 -385
- data/vendor/libgit2/src/streams/curl.h +0 -17
- /data/vendor/libgit2/deps/http-parser/{LICENSE-MIT → COPYING} +0 -0
- /data/vendor/libgit2/src/hash/{sha1dc → sha1/sha1dc}/sha1.h +0 -0
- /data/vendor/libgit2/src/hash/{sha1dc → sha1/sha1dc}/ubc_check.c +0 -0
- /data/vendor/libgit2/src/hash/{sha1dc → sha1/sha1dc}/ubc_check.h +0 -0
|
@@ -91,7 +91,7 @@ static int read_tree_internal(git_tree_cache **out,
|
|
|
91
91
|
return -1;
|
|
92
92
|
|
|
93
93
|
/* Blank-terminated ASCII decimal number of entries in this tree */
|
|
94
|
-
if (
|
|
94
|
+
if (git__strntol32(&count, buffer, buffer_end - buffer, &buffer, 10) < 0)
|
|
95
95
|
goto corrupted;
|
|
96
96
|
|
|
97
97
|
tree->entry_count = count;
|
|
@@ -100,7 +100,7 @@ static int read_tree_internal(git_tree_cache **out,
|
|
|
100
100
|
goto corrupted;
|
|
101
101
|
|
|
102
102
|
/* Number of children of the tree, newline-terminated */
|
|
103
|
-
if (
|
|
103
|
+
if (git__strntol32(&count, buffer, buffer_end - buffer, &buffer, 10) < 0 || count < 0)
|
|
104
104
|
goto corrupted;
|
|
105
105
|
|
|
106
106
|
tree->children_count = count;
|
|
@@ -120,12 +120,14 @@ static int read_tree_internal(git_tree_cache **out,
|
|
|
120
120
|
|
|
121
121
|
/* Parse children: */
|
|
122
122
|
if (tree->children_count > 0) {
|
|
123
|
-
|
|
123
|
+
size_t i, bufsize;
|
|
124
124
|
|
|
125
|
-
|
|
126
|
-
GITERR_CHECK_ALLOC(tree->children);
|
|
125
|
+
GIT_ERROR_CHECK_ALLOC_MULTIPLY(&bufsize, tree->children_count, sizeof(git_tree_cache*));
|
|
127
126
|
|
|
128
|
-
|
|
127
|
+
tree->children = git_pool_malloc(pool, bufsize);
|
|
128
|
+
GIT_ERROR_CHECK_ALLOC(tree->children);
|
|
129
|
+
|
|
130
|
+
memset(tree->children, 0x0, bufsize);
|
|
129
131
|
|
|
130
132
|
for (i = 0; i < tree->children_count; ++i) {
|
|
131
133
|
if (read_tree_internal(&tree->children[i], &buffer, buffer_end, pool) < 0)
|
|
@@ -138,7 +140,7 @@ static int read_tree_internal(git_tree_cache **out,
|
|
|
138
140
|
return 0;
|
|
139
141
|
|
|
140
142
|
corrupted:
|
|
141
|
-
|
|
143
|
+
git_error_set(GIT_ERROR_INDEX, "corrupted TREE extension in index");
|
|
142
144
|
return -1;
|
|
143
145
|
}
|
|
144
146
|
|
|
@@ -150,7 +152,7 @@ int git_tree_cache_read(git_tree_cache **tree, const char *buffer, size_t buffer
|
|
|
150
152
|
return -1;
|
|
151
153
|
|
|
152
154
|
if (buffer < buffer_end) {
|
|
153
|
-
|
|
155
|
+
git_error_set(GIT_ERROR_INDEX, "corrupted TREE extension in index (unexpected trailing data)");
|
|
154
156
|
return -1;
|
|
155
157
|
}
|
|
156
158
|
|
|
@@ -160,7 +162,7 @@ int git_tree_cache_read(git_tree_cache **tree, const char *buffer, size_t buffer
|
|
|
160
162
|
static int read_tree_recursive(git_tree_cache *cache, const git_tree *tree, git_pool *pool)
|
|
161
163
|
{
|
|
162
164
|
git_repository *repo;
|
|
163
|
-
size_t i, j, nentries, ntrees;
|
|
165
|
+
size_t i, j, nentries, ntrees, alloc_size;
|
|
164
166
|
int error;
|
|
165
167
|
|
|
166
168
|
repo = git_tree_owner(tree);
|
|
@@ -182,9 +184,11 @@ static int read_tree_recursive(git_tree_cache *cache, const git_tree *tree, git_
|
|
|
182
184
|
ntrees++;
|
|
183
185
|
}
|
|
184
186
|
|
|
187
|
+
GIT_ERROR_CHECK_ALLOC_MULTIPLY(&alloc_size, ntrees, sizeof(git_tree_cache *));
|
|
188
|
+
|
|
185
189
|
cache->children_count = ntrees;
|
|
186
|
-
cache->children = git_pool_mallocz(pool,
|
|
187
|
-
|
|
190
|
+
cache->children = git_pool_mallocz(pool, alloc_size);
|
|
191
|
+
GIT_ERROR_CHECK_ALLOC(cache->children);
|
|
188
192
|
|
|
189
193
|
j = 0;
|
|
190
194
|
for (i = 0; i < nentries; i++) {
|
|
@@ -232,12 +236,15 @@ int git_tree_cache_read_tree(git_tree_cache **out, const git_tree *tree, git_poo
|
|
|
232
236
|
|
|
233
237
|
int git_tree_cache_new(git_tree_cache **out, const char *name, git_pool *pool)
|
|
234
238
|
{
|
|
235
|
-
size_t name_len;
|
|
239
|
+
size_t name_len, alloc_size;
|
|
236
240
|
git_tree_cache *tree;
|
|
237
241
|
|
|
238
242
|
name_len = strlen(name);
|
|
239
|
-
|
|
240
|
-
|
|
243
|
+
|
|
244
|
+
GIT_ERROR_CHECK_ALLOC_ADD3(&alloc_size, sizeof(git_tree_cache), name_len, 1);
|
|
245
|
+
|
|
246
|
+
tree = git_pool_malloc(pool, alloc_size);
|
|
247
|
+
GIT_ERROR_CHECK_ALLOC(tree);
|
|
241
248
|
|
|
242
249
|
memset(tree, 0x0, sizeof(git_tree_cache));
|
|
243
250
|
/* NUL-terminated tree name */
|
data/vendor/libgit2/src/tree.c
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
#include "commit.h"
|
|
11
11
|
#include "git2/repository.h"
|
|
12
12
|
#include "git2/object.h"
|
|
13
|
-
#include "
|
|
13
|
+
#include "futils.h"
|
|
14
14
|
#include "tree-cache.h"
|
|
15
15
|
#include "index.h"
|
|
16
16
|
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
#define MAX_FILEMODE_BYTES 6
|
|
19
19
|
|
|
20
20
|
#define TREE_ENTRY_CHECK_NAMELEN(n) \
|
|
21
|
-
if (n > UINT16_MAX) {
|
|
21
|
+
if (n > UINT16_MAX) { git_error_set(GIT_ERROR_INVALID, "tree entry path too long"); }
|
|
22
22
|
|
|
23
23
|
static bool valid_filemode(const int filemode)
|
|
24
24
|
{
|
|
@@ -271,16 +271,16 @@ const git_oid *git_tree_entry_id(const git_tree_entry *entry)
|
|
|
271
271
|
return entry->oid;
|
|
272
272
|
}
|
|
273
273
|
|
|
274
|
-
|
|
274
|
+
git_object_t git_tree_entry_type(const git_tree_entry *entry)
|
|
275
275
|
{
|
|
276
276
|
assert(entry);
|
|
277
277
|
|
|
278
278
|
if (S_ISGITLINK(entry->attr))
|
|
279
|
-
return
|
|
279
|
+
return GIT_OBJECT_COMMIT;
|
|
280
280
|
else if (S_ISDIR(entry->attr))
|
|
281
|
-
return
|
|
281
|
+
return GIT_OBJECT_TREE;
|
|
282
282
|
else
|
|
283
|
-
return
|
|
283
|
+
return GIT_OBJECT_BLOB;
|
|
284
284
|
}
|
|
285
285
|
|
|
286
286
|
int git_tree_entry_to_object(
|
|
@@ -289,7 +289,7 @@ int git_tree_entry_to_object(
|
|
|
289
289
|
const git_tree_entry *entry)
|
|
290
290
|
{
|
|
291
291
|
assert(entry && object_out);
|
|
292
|
-
return git_object_lookup(object_out, repo, entry->oid,
|
|
292
|
+
return git_object_lookup(object_out, repo, entry->oid, GIT_OBJECT_ANY);
|
|
293
293
|
}
|
|
294
294
|
|
|
295
295
|
static const git_tree_entry *entry_fromname(
|
|
@@ -340,69 +340,70 @@ size_t git_tree_entrycount(const git_tree *tree)
|
|
|
340
340
|
return tree->entries.size;
|
|
341
341
|
}
|
|
342
342
|
|
|
343
|
-
|
|
343
|
+
size_t git_treebuilder_entrycount(git_treebuilder *bld)
|
|
344
344
|
{
|
|
345
345
|
assert(bld);
|
|
346
346
|
|
|
347
|
-
return
|
|
347
|
+
return git_strmap_size(bld->map);
|
|
348
348
|
}
|
|
349
349
|
|
|
350
350
|
static int tree_error(const char *str, const char *path)
|
|
351
351
|
{
|
|
352
352
|
if (path)
|
|
353
|
-
|
|
353
|
+
git_error_set(GIT_ERROR_TREE, "%s - %s", str, path);
|
|
354
354
|
else
|
|
355
|
-
|
|
355
|
+
git_error_set(GIT_ERROR_TREE, "%s", str);
|
|
356
356
|
return -1;
|
|
357
357
|
}
|
|
358
358
|
|
|
359
|
-
static int parse_mode(
|
|
359
|
+
static int parse_mode(uint16_t *mode_out, const char *buffer, size_t buffer_len, const char **buffer_out)
|
|
360
360
|
{
|
|
361
|
-
|
|
362
|
-
|
|
361
|
+
int32_t mode;
|
|
362
|
+
int error;
|
|
363
363
|
|
|
364
|
-
if (*buffer
|
|
364
|
+
if (!buffer_len || git__isspace(*buffer))
|
|
365
365
|
return -1;
|
|
366
366
|
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
*
|
|
367
|
+
if ((error = git__strntol32(&mode, buffer, buffer_len, buffer_out, 8)) < 0)
|
|
368
|
+
return error;
|
|
369
|
+
|
|
370
|
+
if (mode < 0 || mode > UINT16_MAX)
|
|
371
|
+
return -1;
|
|
372
|
+
|
|
373
|
+
*mode_out = mode;
|
|
374
374
|
|
|
375
375
|
return 0;
|
|
376
376
|
}
|
|
377
377
|
|
|
378
|
-
int
|
|
378
|
+
int git_tree__parse_raw(void *_tree, const char *data, size_t size)
|
|
379
379
|
{
|
|
380
380
|
git_tree *tree = _tree;
|
|
381
381
|
const char *buffer;
|
|
382
382
|
const char *buffer_end;
|
|
383
383
|
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
buffer = git_odb_object_data(tree->odb_obj);
|
|
388
|
-
buffer_end = buffer + git_odb_object_size(tree->odb_obj);
|
|
384
|
+
buffer = data;
|
|
385
|
+
buffer_end = buffer + size;
|
|
389
386
|
|
|
387
|
+
tree->odb_obj = NULL;
|
|
390
388
|
git_array_init_to_size(tree->entries, DEFAULT_TREE_SIZE);
|
|
391
|
-
|
|
389
|
+
GIT_ERROR_CHECK_ARRAY(tree->entries);
|
|
392
390
|
|
|
393
391
|
while (buffer < buffer_end) {
|
|
394
392
|
git_tree_entry *entry;
|
|
395
393
|
size_t filename_len;
|
|
396
394
|
const char *nul;
|
|
397
|
-
|
|
395
|
+
uint16_t attr;
|
|
398
396
|
|
|
399
|
-
if (parse_mode(&attr, buffer, &buffer) < 0 || !buffer)
|
|
397
|
+
if (parse_mode(&attr, buffer, buffer_end - buffer, &buffer) < 0 || !buffer)
|
|
400
398
|
return tree_error("failed to parse tree: can't parse filemode", NULL);
|
|
401
399
|
|
|
400
|
+
if (buffer >= buffer_end || (*buffer++) != ' ')
|
|
401
|
+
return tree_error("failed to parse tree: missing space after filemode", NULL);
|
|
402
|
+
|
|
402
403
|
if ((nul = memchr(buffer, 0, buffer_end - buffer)) == NULL)
|
|
403
404
|
return tree_error("failed to parse tree: object is corrupted", NULL);
|
|
404
405
|
|
|
405
|
-
if ((filename_len = nul - buffer) == 0)
|
|
406
|
+
if ((filename_len = nul - buffer) == 0 || filename_len > UINT16_MAX)
|
|
406
407
|
return tree_error("failed to parse tree: can't parse filename", NULL);
|
|
407
408
|
|
|
408
409
|
if ((buffer_end - (nul + 1)) < GIT_OID_RAWSZ)
|
|
@@ -411,10 +412,10 @@ int git_tree__parse(void *_tree, git_odb_object *odb_obj)
|
|
|
411
412
|
/* Allocate the entry */
|
|
412
413
|
{
|
|
413
414
|
entry = git_array_alloc(tree->entries);
|
|
414
|
-
|
|
415
|
+
GIT_ERROR_CHECK_ALLOC(entry);
|
|
415
416
|
|
|
416
417
|
entry->attr = attr;
|
|
417
|
-
entry->filename_len = filename_len;
|
|
418
|
+
entry->filename_len = (uint16_t)filename_len;
|
|
418
419
|
entry->filename = buffer;
|
|
419
420
|
entry->oid = (git_oid *) ((char *) buffer + filename_len + 1);
|
|
420
421
|
}
|
|
@@ -426,6 +427,21 @@ int git_tree__parse(void *_tree, git_odb_object *odb_obj)
|
|
|
426
427
|
return 0;
|
|
427
428
|
}
|
|
428
429
|
|
|
430
|
+
int git_tree__parse(void *_tree, git_odb_object *odb_obj)
|
|
431
|
+
{
|
|
432
|
+
git_tree *tree = _tree;
|
|
433
|
+
|
|
434
|
+
if ((git_tree__parse_raw(tree,
|
|
435
|
+
git_odb_object_data(odb_obj),
|
|
436
|
+
git_odb_object_size(odb_obj))) < 0)
|
|
437
|
+
return -1;
|
|
438
|
+
|
|
439
|
+
if (git_odb_object_dup(&tree->odb_obj, odb_obj) < 0)
|
|
440
|
+
return -1;
|
|
441
|
+
|
|
442
|
+
return 0;
|
|
443
|
+
}
|
|
444
|
+
|
|
429
445
|
static size_t find_next_dir(const char *dirname, git_index *index, size_t start)
|
|
430
446
|
{
|
|
431
447
|
size_t dirlen, i, entries = git_index_entrycount(index);
|
|
@@ -443,31 +459,57 @@ static size_t find_next_dir(const char *dirname, git_index *index, size_t start)
|
|
|
443
459
|
return i;
|
|
444
460
|
}
|
|
445
461
|
|
|
462
|
+
static git_object_t otype_from_mode(git_filemode_t filemode)
|
|
463
|
+
{
|
|
464
|
+
switch (filemode) {
|
|
465
|
+
case GIT_FILEMODE_TREE:
|
|
466
|
+
return GIT_OBJECT_TREE;
|
|
467
|
+
case GIT_FILEMODE_COMMIT:
|
|
468
|
+
return GIT_OBJECT_COMMIT;
|
|
469
|
+
default:
|
|
470
|
+
return GIT_OBJECT_BLOB;
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
static int check_entry(git_repository *repo, const char *filename, const git_oid *id, git_filemode_t filemode)
|
|
475
|
+
{
|
|
476
|
+
if (!valid_filemode(filemode))
|
|
477
|
+
return tree_error("failed to insert entry: invalid filemode for file", filename);
|
|
478
|
+
|
|
479
|
+
if (!valid_entry_name(repo, filename))
|
|
480
|
+
return tree_error("failed to insert entry: invalid name for a tree entry", filename);
|
|
481
|
+
|
|
482
|
+
if (git_oid_is_zero(id))
|
|
483
|
+
return tree_error("failed to insert entry: invalid null OID", filename);
|
|
484
|
+
|
|
485
|
+
if (filemode != GIT_FILEMODE_COMMIT &&
|
|
486
|
+
!git_object__is_valid(repo, id, otype_from_mode(filemode)))
|
|
487
|
+
return tree_error("failed to insert entry: invalid object specified", filename);
|
|
488
|
+
|
|
489
|
+
return 0;
|
|
490
|
+
}
|
|
491
|
+
|
|
446
492
|
static int append_entry(
|
|
447
493
|
git_treebuilder *bld,
|
|
448
494
|
const char *filename,
|
|
449
495
|
const git_oid *id,
|
|
450
496
|
git_filemode_t filemode,
|
|
451
|
-
bool
|
|
497
|
+
bool validate)
|
|
452
498
|
{
|
|
453
499
|
git_tree_entry *entry;
|
|
454
500
|
int error = 0;
|
|
455
501
|
|
|
456
|
-
if (
|
|
457
|
-
return
|
|
458
|
-
|
|
459
|
-
if (!from_tree && git_oid_iszero(id))
|
|
460
|
-
return tree_error("failed to insert entry: invalid null OID for a tree entry", filename);
|
|
502
|
+
if (validate && ((error = check_entry(bld->repo, filename, id, filemode)) < 0))
|
|
503
|
+
return error;
|
|
461
504
|
|
|
462
505
|
entry = alloc_entry(filename, strlen(filename), id);
|
|
463
|
-
|
|
506
|
+
GIT_ERROR_CHECK_ALLOC(entry);
|
|
464
507
|
|
|
465
508
|
entry->attr = (uint16_t)filemode;
|
|
466
509
|
|
|
467
|
-
|
|
468
|
-
if (error < 0) {
|
|
510
|
+
if ((error = git_strmap_set(bld->map, entry->filename, entry)) < 0) {
|
|
469
511
|
git_tree_entry_free(entry);
|
|
470
|
-
|
|
512
|
+
git_error_set(GIT_ERROR_TREE, "failed to append entry %s to the tree builder", filename);
|
|
471
513
|
return -1;
|
|
472
514
|
}
|
|
473
515
|
|
|
@@ -530,7 +572,7 @@ static int write_tree(
|
|
|
530
572
|
char *subdir, *last_comp;
|
|
531
573
|
|
|
532
574
|
subdir = git__strndup(entry->path, next_slash - entry->path);
|
|
533
|
-
|
|
575
|
+
GIT_ERROR_CHECK_ALLOC(subdir);
|
|
534
576
|
|
|
535
577
|
/* Write out the subtree */
|
|
536
578
|
written = write_tree(&sub_oid, repo, index, subdir, i, shared_buf);
|
|
@@ -554,12 +596,12 @@ static int write_tree(
|
|
|
554
596
|
last_comp = subdir;
|
|
555
597
|
}
|
|
556
598
|
|
|
557
|
-
error = append_entry(bld, last_comp, &sub_oid, S_IFDIR,
|
|
599
|
+
error = append_entry(bld, last_comp, &sub_oid, S_IFDIR, true);
|
|
558
600
|
git__free(subdir);
|
|
559
601
|
if (error < 0)
|
|
560
602
|
goto on_error;
|
|
561
603
|
} else {
|
|
562
|
-
error = append_entry(bld, filename, &entry->id, entry->mode,
|
|
604
|
+
error = append_entry(bld, filename, &entry->id, entry->mode, true);
|
|
563
605
|
if (error < 0)
|
|
564
606
|
goto on_error;
|
|
565
607
|
}
|
|
@@ -587,7 +629,7 @@ int git_tree__write_index(
|
|
|
587
629
|
assert(oid && index && repo);
|
|
588
630
|
|
|
589
631
|
if (git_index_has_conflicts(index)) {
|
|
590
|
-
|
|
632
|
+
git_error_set(GIT_ERROR_INDEX,
|
|
591
633
|
"cannot create a tree from a not fully merged index.");
|
|
592
634
|
return GIT_EUNMERGED;
|
|
593
635
|
}
|
|
@@ -641,11 +683,11 @@ int git_treebuilder_new(
|
|
|
641
683
|
assert(builder_p && repo);
|
|
642
684
|
|
|
643
685
|
bld = git__calloc(1, sizeof(git_treebuilder));
|
|
644
|
-
|
|
686
|
+
GIT_ERROR_CHECK_ALLOC(bld);
|
|
645
687
|
|
|
646
688
|
bld->repo = repo;
|
|
647
689
|
|
|
648
|
-
if (
|
|
690
|
+
if (git_strmap_new(&bld->map) < 0) {
|
|
649
691
|
git__free(bld);
|
|
650
692
|
return -1;
|
|
651
693
|
}
|
|
@@ -658,7 +700,7 @@ int git_treebuilder_new(
|
|
|
658
700
|
bld, entry_src->filename,
|
|
659
701
|
entry_src->oid,
|
|
660
702
|
entry_src->attr,
|
|
661
|
-
|
|
703
|
+
false) < 0)
|
|
662
704
|
goto on_error;
|
|
663
705
|
}
|
|
664
706
|
}
|
|
@@ -671,18 +713,6 @@ on_error:
|
|
|
671
713
|
return -1;
|
|
672
714
|
}
|
|
673
715
|
|
|
674
|
-
static git_otype otype_from_mode(git_filemode_t filemode)
|
|
675
|
-
{
|
|
676
|
-
switch (filemode) {
|
|
677
|
-
case GIT_FILEMODE_TREE:
|
|
678
|
-
return GIT_OBJ_TREE;
|
|
679
|
-
case GIT_FILEMODE_COMMIT:
|
|
680
|
-
return GIT_OBJ_COMMIT;
|
|
681
|
-
default:
|
|
682
|
-
return GIT_OBJ_BLOB;
|
|
683
|
-
}
|
|
684
|
-
}
|
|
685
|
-
|
|
686
716
|
int git_treebuilder_insert(
|
|
687
717
|
const git_tree_entry **entry_out,
|
|
688
718
|
git_treebuilder *bld,
|
|
@@ -692,36 +722,21 @@ int git_treebuilder_insert(
|
|
|
692
722
|
{
|
|
693
723
|
git_tree_entry *entry;
|
|
694
724
|
int error;
|
|
695
|
-
git_strmap_iter pos;
|
|
696
725
|
|
|
697
726
|
assert(bld && id && filename);
|
|
698
727
|
|
|
699
|
-
if (
|
|
700
|
-
return
|
|
701
|
-
|
|
702
|
-
if (!valid_entry_name(bld->repo, filename))
|
|
703
|
-
return tree_error("failed to insert entry: invalid name for a tree entry", filename);
|
|
704
|
-
|
|
705
|
-
if (git_oid_iszero(id))
|
|
706
|
-
return tree_error("failed to insert entry: invalid null OID", filename);
|
|
707
|
-
|
|
708
|
-
if (filemode != GIT_FILEMODE_COMMIT &&
|
|
709
|
-
!git_object__is_valid(bld->repo, id, otype_from_mode(filemode)))
|
|
710
|
-
return tree_error("failed to insert entry: invalid object specified", filename);
|
|
728
|
+
if ((error = check_entry(bld->repo, filename, id, filemode)) < 0)
|
|
729
|
+
return error;
|
|
711
730
|
|
|
712
|
-
|
|
713
|
-
if (git_strmap_valid_index(bld->map, pos)) {
|
|
714
|
-
entry = git_strmap_value_at(bld->map, pos);
|
|
731
|
+
if ((entry = git_strmap_get(bld->map, filename)) != NULL) {
|
|
715
732
|
git_oid_cpy((git_oid *) entry->oid, id);
|
|
716
733
|
} else {
|
|
717
734
|
entry = alloc_entry(filename, strlen(filename), id);
|
|
718
|
-
|
|
735
|
+
GIT_ERROR_CHECK_ALLOC(entry);
|
|
719
736
|
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
if (error < 0) {
|
|
737
|
+
if ((error = git_strmap_set(bld->map, entry->filename, entry)) < 0) {
|
|
723
738
|
git_tree_entry_free(entry);
|
|
724
|
-
|
|
739
|
+
git_error_set(GIT_ERROR_TREE, "failed to insert %s", filename);
|
|
725
740
|
return -1;
|
|
726
741
|
}
|
|
727
742
|
}
|
|
@@ -736,16 +751,8 @@ int git_treebuilder_insert(
|
|
|
736
751
|
|
|
737
752
|
static git_tree_entry *treebuilder_get(git_treebuilder *bld, const char *filename)
|
|
738
753
|
{
|
|
739
|
-
git_tree_entry *entry = NULL;
|
|
740
|
-
git_strmap_iter pos;
|
|
741
|
-
|
|
742
754
|
assert(bld && filename);
|
|
743
|
-
|
|
744
|
-
pos = git_strmap_lookup_index(bld->map, filename);
|
|
745
|
-
if (git_strmap_valid_index(bld->map, pos))
|
|
746
|
-
entry = git_strmap_value_at(bld->map, pos);
|
|
747
|
-
|
|
748
|
-
return entry;
|
|
755
|
+
return git_strmap_get(bld->map, filename);
|
|
749
756
|
}
|
|
750
757
|
|
|
751
758
|
const git_tree_entry *git_treebuilder_get(git_treebuilder *bld, const char *filename)
|
|
@@ -790,7 +797,7 @@ int git_treebuilder_write_with_buffer(git_oid *oid, git_treebuilder *bld, git_bu
|
|
|
790
797
|
|
|
791
798
|
git_buf_clear(tree);
|
|
792
799
|
|
|
793
|
-
entrycount =
|
|
800
|
+
entrycount = git_strmap_size(bld->map);
|
|
794
801
|
if ((error = git_vector_init(&entries, entrycount, entry_sort_cmp)) < 0)
|
|
795
802
|
goto out;
|
|
796
803
|
|
|
@@ -819,7 +826,7 @@ int git_treebuilder_write_with_buffer(git_oid *oid, git_treebuilder *bld, git_bu
|
|
|
819
826
|
}
|
|
820
827
|
|
|
821
828
|
if ((error = git_repository_odb__weakptr(&odb, bld->repo)) == 0)
|
|
822
|
-
error = git_odb_write(oid, odb, tree->ptr, tree->size,
|
|
829
|
+
error = git_odb_write(oid, odb, tree->ptr, tree->size, GIT_OBJECT_TREE);
|
|
823
830
|
|
|
824
831
|
out:
|
|
825
832
|
git_vector_free(&entries);
|
|
@@ -889,14 +896,14 @@ int git_tree_entry_bypath(
|
|
|
889
896
|
filename_len = subpath_len(path);
|
|
890
897
|
|
|
891
898
|
if (filename_len == 0) {
|
|
892
|
-
|
|
899
|
+
git_error_set(GIT_ERROR_TREE, "invalid tree path given");
|
|
893
900
|
return GIT_ENOTFOUND;
|
|
894
901
|
}
|
|
895
902
|
|
|
896
903
|
entry = entry_fromname(root, path, filename_len);
|
|
897
904
|
|
|
898
905
|
if (entry == NULL) {
|
|
899
|
-
|
|
906
|
+
git_error_set(GIT_ERROR_TREE,
|
|
900
907
|
"the path '%.*s' does not exist in the given tree", (int) filename_len, path);
|
|
901
908
|
return GIT_ENOTFOUND;
|
|
902
909
|
}
|
|
@@ -906,7 +913,7 @@ int git_tree_entry_bypath(
|
|
|
906
913
|
/* If there are more components in the path...
|
|
907
914
|
* then this entry *must* be a tree */
|
|
908
915
|
if (!git_tree_entry__is_tree(entry)) {
|
|
909
|
-
|
|
916
|
+
git_error_set(GIT_ERROR_TREE,
|
|
910
917
|
"the path '%.*s' exists but is not a tree", (int) filename_len, path);
|
|
911
918
|
return GIT_ENOTFOUND;
|
|
912
919
|
}
|
|
@@ -951,7 +958,7 @@ static int tree_walk(
|
|
|
951
958
|
if (preorder) {
|
|
952
959
|
error = callback(path->ptr, entry, payload);
|
|
953
960
|
if (error < 0) { /* negative value stops iteration */
|
|
954
|
-
|
|
961
|
+
git_error_set_after_callback_function(error, "git_tree_walk");
|
|
955
962
|
break;
|
|
956
963
|
}
|
|
957
964
|
if (error > 0) { /* positive value skips this entry */
|
|
@@ -987,7 +994,7 @@ static int tree_walk(
|
|
|
987
994
|
if (!preorder) {
|
|
988
995
|
error = callback(path->ptr, entry, payload);
|
|
989
996
|
if (error < 0) { /* negative value stops iteration */
|
|
990
|
-
|
|
997
|
+
git_error_set_after_callback_function(error, "git_tree_walk");
|
|
991
998
|
break;
|
|
992
999
|
}
|
|
993
1000
|
error = 0;
|
|
@@ -1007,7 +1014,7 @@ int git_tree_walk(
|
|
|
1007
1014
|
git_buf root_path = GIT_BUF_INIT;
|
|
1008
1015
|
|
|
1009
1016
|
if (mode != GIT_TREEWALK_POST && mode != GIT_TREEWALK_PRE) {
|
|
1010
|
-
|
|
1017
|
+
git_error_set(GIT_ERROR_INVALID, "invalid walking mode for tree walk");
|
|
1011
1018
|
return -1;
|
|
1012
1019
|
}
|
|
1013
1020
|
|
|
@@ -1031,7 +1038,7 @@ static int on_dup_entry(void **old, void *new)
|
|
|
1031
1038
|
{
|
|
1032
1039
|
GIT_UNUSED(old); GIT_UNUSED(new);
|
|
1033
1040
|
|
|
1034
|
-
|
|
1041
|
+
git_error_set(GIT_ERROR_TREE, "duplicate entries given for update");
|
|
1035
1042
|
return -1;
|
|
1036
1043
|
}
|
|
1037
1044
|
|
|
@@ -1100,14 +1107,14 @@ static int create_popped_tree(tree_stack_entry *current, tree_stack_entry *poppe
|
|
|
1100
1107
|
git_buf_puts(component, popped->name);
|
|
1101
1108
|
git__free(popped->name);
|
|
1102
1109
|
|
|
1103
|
-
|
|
1110
|
+
GIT_ERROR_CHECK_ALLOC(component->ptr);
|
|
1104
1111
|
|
|
1105
1112
|
/* Error out if this would create a D/F conflict in this update */
|
|
1106
1113
|
if (current->tree) {
|
|
1107
1114
|
const git_tree_entry *to_replace;
|
|
1108
1115
|
to_replace = git_tree_entry_byname(current->tree, component->ptr);
|
|
1109
|
-
if (to_replace && git_tree_entry_type(to_replace) !=
|
|
1110
|
-
|
|
1116
|
+
if (to_replace && git_tree_entry_type(to_replace) != GIT_OBJECT_TREE) {
|
|
1117
|
+
git_error_set(GIT_ERROR_TREE, "D/F conflict when updating tree");
|
|
1111
1118
|
return -1;
|
|
1112
1119
|
}
|
|
1113
1120
|
}
|
|
@@ -1134,7 +1141,7 @@ int git_tree_create_updated(git_oid *out, git_repository *repo, git_tree *baseli
|
|
|
1134
1141
|
}
|
|
1135
1142
|
|
|
1136
1143
|
root_elem = git_array_alloc(stack);
|
|
1137
|
-
|
|
1144
|
+
GIT_ERROR_CHECK_ALLOC(root_elem);
|
|
1138
1145
|
memset(root_elem, 0, sizeof(*root_elem));
|
|
1139
1146
|
|
|
1140
1147
|
if (baseline && (error = git_tree_dup(&root_elem->tree, baseline)) < 0)
|
|
@@ -1183,14 +1190,14 @@ int git_tree_create_updated(git_oid *out, git_repository *repo, git_tree *baseli
|
|
|
1183
1190
|
if (!entry)
|
|
1184
1191
|
entry = treebuilder_get(last->bld, component.ptr);
|
|
1185
1192
|
|
|
1186
|
-
if (entry && git_tree_entry_type(entry) !=
|
|
1187
|
-
|
|
1193
|
+
if (entry && git_tree_entry_type(entry) != GIT_OBJECT_TREE) {
|
|
1194
|
+
git_error_set(GIT_ERROR_TREE, "D/F conflict when updating tree");
|
|
1188
1195
|
error = -1;
|
|
1189
1196
|
goto cleanup;
|
|
1190
1197
|
}
|
|
1191
1198
|
|
|
1192
1199
|
new_entry = git_array_alloc(stack);
|
|
1193
|
-
|
|
1200
|
+
GIT_ERROR_CHECK_ALLOC(new_entry);
|
|
1194
1201
|
memset(new_entry, 0, sizeof(*new_entry));
|
|
1195
1202
|
|
|
1196
1203
|
new_entry->tree = NULL;
|
|
@@ -1201,7 +1208,7 @@ int git_tree_create_updated(git_oid *out, git_repository *repo, git_tree *baseli
|
|
|
1201
1208
|
goto cleanup;
|
|
1202
1209
|
|
|
1203
1210
|
new_entry->name = git__strdup(component.ptr);
|
|
1204
|
-
|
|
1211
|
+
GIT_ERROR_CHECK_ALLOC(new_entry->name);
|
|
1205
1212
|
|
|
1206
1213
|
/* Get to the start of the next component */
|
|
1207
1214
|
path += component.size + 1;
|
|
@@ -1217,7 +1224,7 @@ int git_tree_create_updated(git_oid *out, git_repository *repo, git_tree *baseli
|
|
|
1217
1224
|
const git_tree_entry *e = git_treebuilder_get(last->bld, basename);
|
|
1218
1225
|
if (e && git_tree_entry_type(e) != git_object__type_from_filemode(update->filemode)) {
|
|
1219
1226
|
git__free(basename);
|
|
1220
|
-
|
|
1227
|
+
git_error_set(GIT_ERROR_TREE, "cannot replace '%s' with '%s' at '%s'",
|
|
1221
1228
|
git_object_type2string(git_tree_entry_type(e)),
|
|
1222
1229
|
git_object_type2string(git_object__type_from_filemode(update->filemode)),
|
|
1223
1230
|
update->path);
|
|
@@ -1237,7 +1244,7 @@ int git_tree_create_updated(git_oid *out, git_repository *repo, git_tree *baseli
|
|
|
1237
1244
|
break;
|
|
1238
1245
|
}
|
|
1239
1246
|
default:
|
|
1240
|
-
|
|
1247
|
+
git_error_set(GIT_ERROR_TREE, "unknown action for update");
|
|
1241
1248
|
error = -1;
|
|
1242
1249
|
goto cleanup;
|
|
1243
1250
|
}
|
data/vendor/libgit2/src/tree.h
CHANGED
|
@@ -41,6 +41,7 @@ GIT_INLINE(bool) git_tree_entry__is_tree(const struct git_tree_entry *e)
|
|
|
41
41
|
|
|
42
42
|
void git_tree__free(void *tree);
|
|
43
43
|
int git_tree__parse(void *tree, git_odb_object *obj);
|
|
44
|
+
int git_tree__parse_raw(void *_tree, const char *data, size_t size);
|
|
44
45
|
|
|
45
46
|
/**
|
|
46
47
|
* Write a tree to the given repository
|
|
@@ -20,7 +20,7 @@ int git__page_size(size_t *page_size)
|
|
|
20
20
|
{
|
|
21
21
|
long sc_page_size = sysconf(_SC_PAGE_SIZE);
|
|
22
22
|
if (sc_page_size < 0) {
|
|
23
|
-
|
|
23
|
+
git_error_set(GIT_ERROR_OS, "can't determine system page size");
|
|
24
24
|
return -1;
|
|
25
25
|
}
|
|
26
26
|
*page_size = (size_t) sc_page_size;
|
|
@@ -32,7 +32,7 @@ int git__mmap_alignment(size_t *alignment)
|
|
|
32
32
|
return git__page_size(alignment);
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
int p_mmap(git_map *out, size_t len, int prot, int flags, int fd,
|
|
35
|
+
int p_mmap(git_map *out, size_t len, int prot, int flags, int fd, off64_t offset)
|
|
36
36
|
{
|
|
37
37
|
int mprot = PROT_READ;
|
|
38
38
|
int mflag = 0;
|
|
@@ -55,7 +55,7 @@ int p_mmap(git_map *out, size_t len, int prot, int flags, int fd, git_off_t offs
|
|
|
55
55
|
out->data = mmap(NULL, len, mprot, mflag, fd, offset);
|
|
56
56
|
|
|
57
57
|
if (!out->data || out->data == MAP_FAILED) {
|
|
58
|
-
|
|
58
|
+
git_error_set(GIT_ERROR_OS, "failed to mmap. Could not write data");
|
|
59
59
|
return -1;
|
|
60
60
|
}
|
|
61
61
|
|
|
@@ -59,7 +59,7 @@ GIT_INLINE(int) p_fsync(int fd)
|
|
|
59
59
|
#define p_strcasecmp(s1, s2) strcasecmp(s1, s2)
|
|
60
60
|
#define p_strncasecmp(s1, s2, c) strncasecmp(s1, s2, c)
|
|
61
61
|
#define p_vsnprintf(b, c, f, a) vsnprintf(b, c, f, a)
|
|
62
|
-
#define p_snprintf
|
|
62
|
+
#define p_snprintf snprintf
|
|
63
63
|
#define p_mkstemp(p) mkstemp(p)
|
|
64
64
|
#define p_chdir(p) chdir(p)
|
|
65
65
|
#define p_chmod(p,m) chmod(p, m)
|
|
@@ -89,14 +89,4 @@ GIT_INLINE(int) p_futimes(int f, const struct p_timeval t[2])
|
|
|
89
89
|
# define p_futimes futimes
|
|
90
90
|
#endif
|
|
91
91
|
|
|
92
|
-
#ifdef GIT_USE_REGCOMP_L
|
|
93
|
-
#include <xlocale.h>
|
|
94
|
-
GIT_INLINE(int) p_regcomp(regex_t *preg, const char *pattern, int cflags)
|
|
95
|
-
{
|
|
96
|
-
return regcomp_l(preg, pattern, cflags, (locale_t) 0);
|
|
97
|
-
}
|
|
98
|
-
#else
|
|
99
|
-
# define p_regcomp regcomp
|
|
100
|
-
#endif
|
|
101
|
-
|
|
102
92
|
#endif
|