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
data/vendor/libgit2/src/index.c
CHANGED
|
@@ -29,23 +29,23 @@
|
|
|
29
29
|
|
|
30
30
|
#define INSERT_IN_MAP_EX(idx, map, e, err) do { \
|
|
31
31
|
if ((idx)->ignore_case) \
|
|
32
|
-
|
|
32
|
+
(err) = git_idxmap_icase_set((git_idxmap_icase *) (map), (e), (e)); \
|
|
33
33
|
else \
|
|
34
|
-
|
|
34
|
+
(err) = git_idxmap_set((map), (e), (e)); \
|
|
35
35
|
} while (0)
|
|
36
36
|
|
|
37
37
|
#define INSERT_IN_MAP(idx, e, err) INSERT_IN_MAP_EX(idx, (idx)->entries_map, e, err)
|
|
38
38
|
|
|
39
|
-
#define LOOKUP_IN_MAP(
|
|
39
|
+
#define LOOKUP_IN_MAP(v, idx, k) do { \
|
|
40
40
|
if ((idx)->ignore_case) \
|
|
41
|
-
(
|
|
41
|
+
(v) = git_idxmap_icase_get((git_idxmap_icase *) index->entries_map, (k)); \
|
|
42
42
|
else \
|
|
43
|
-
(
|
|
43
|
+
(v) = git_idxmap_get(index->entries_map, (k)); \
|
|
44
44
|
} while (0)
|
|
45
45
|
|
|
46
46
|
#define DELETE_IN_MAP(idx, e) do { \
|
|
47
47
|
if ((idx)->ignore_case) \
|
|
48
|
-
git_idxmap_icase_delete((
|
|
48
|
+
git_idxmap_icase_delete((git_idxmap_icase *) (idx)->entries_map, (e)); \
|
|
49
49
|
else \
|
|
50
50
|
git_idxmap_delete((idx)->entries_map, (e)); \
|
|
51
51
|
} while (0)
|
|
@@ -138,7 +138,7 @@ struct reuc_entry_internal {
|
|
|
138
138
|
bool git_index__enforce_unsaved_safety = false;
|
|
139
139
|
|
|
140
140
|
/* local declarations */
|
|
141
|
-
static
|
|
141
|
+
static int read_extension(size_t *read_len, git_index *index, const char *buffer, size_t buffer_size);
|
|
142
142
|
static int read_header(struct index_header *dest, const void *buffer);
|
|
143
143
|
|
|
144
144
|
static int parse_index(git_index *index, const char *buffer, size_t buffer_size);
|
|
@@ -168,7 +168,7 @@ int git_index_entry_srch(const void *key, const void *array_member)
|
|
|
168
168
|
return 1;
|
|
169
169
|
|
|
170
170
|
if (srch_key->stage != GIT_INDEX_STAGE_ANY)
|
|
171
|
-
return srch_key->stage -
|
|
171
|
+
return srch_key->stage - GIT_INDEX_ENTRY_STAGE(&entry->entry);
|
|
172
172
|
|
|
173
173
|
return 0;
|
|
174
174
|
}
|
|
@@ -194,7 +194,7 @@ int git_index_entry_isrch(const void *key, const void *array_member)
|
|
|
194
194
|
return 1;
|
|
195
195
|
|
|
196
196
|
if (srch_key->stage != GIT_INDEX_STAGE_ANY)
|
|
197
|
-
return srch_key->stage -
|
|
197
|
+
return srch_key->stage - GIT_INDEX_ENTRY_STAGE(&entry->entry);
|
|
198
198
|
|
|
199
199
|
return 0;
|
|
200
200
|
}
|
|
@@ -222,7 +222,7 @@ int git_index_entry_cmp(const void *a, const void *b)
|
|
|
222
222
|
diff = strcmp(entry_a->path, entry_b->path);
|
|
223
223
|
|
|
224
224
|
if (diff == 0)
|
|
225
|
-
diff = (
|
|
225
|
+
diff = (GIT_INDEX_ENTRY_STAGE(entry_a) - GIT_INDEX_ENTRY_STAGE(entry_b));
|
|
226
226
|
|
|
227
227
|
return diff;
|
|
228
228
|
}
|
|
@@ -236,7 +236,7 @@ int git_index_entry_icmp(const void *a, const void *b)
|
|
|
236
236
|
diff = strcasecmp(entry_a->path, entry_b->path);
|
|
237
237
|
|
|
238
238
|
if (diff == 0)
|
|
239
|
-
diff = (
|
|
239
|
+
diff = (GIT_INDEX_ENTRY_STAGE(entry_a) - GIT_INDEX_ENTRY_STAGE(entry_b));
|
|
240
240
|
|
|
241
241
|
return diff;
|
|
242
242
|
}
|
|
@@ -408,7 +408,7 @@ int git_index_open(git_index **index_out, const char *index_path)
|
|
|
408
408
|
assert(index_out);
|
|
409
409
|
|
|
410
410
|
index = git__calloc(1, sizeof(git_index));
|
|
411
|
-
|
|
411
|
+
GIT_ERROR_CHECK_ALLOC(index);
|
|
412
412
|
|
|
413
413
|
git_pool_init(&index->tree_pool, 1);
|
|
414
414
|
|
|
@@ -423,10 +423,10 @@ int git_index_open(git_index **index_out, const char *index_path)
|
|
|
423
423
|
}
|
|
424
424
|
|
|
425
425
|
if (git_vector_init(&index->entries, 32, git_index_entry_cmp) < 0 ||
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
426
|
+
git_idxmap_new(&index->entries_map) < 0 ||
|
|
427
|
+
git_vector_init(&index->names, 8, conflict_name_cmp) < 0 ||
|
|
428
|
+
git_vector_init(&index->reuc, 8, reuc_cmp) < 0 ||
|
|
429
|
+
git_vector_init(&index->deleted, 8, git_index_entry_cmp) < 0)
|
|
430
430
|
goto fail;
|
|
431
431
|
|
|
432
432
|
index->entries_cmp_path = git__strcmp_cb;
|
|
@@ -550,7 +550,7 @@ int git_index_clear(git_index *index)
|
|
|
550
550
|
|
|
551
551
|
static int create_index_error(int error, const char *msg)
|
|
552
552
|
{
|
|
553
|
-
|
|
553
|
+
git_error_set_str(GIT_ERROR_INDEX, msg);
|
|
554
554
|
return error;
|
|
555
555
|
}
|
|
556
556
|
|
|
@@ -562,7 +562,7 @@ int git_index_set_caps(git_index *index, int caps)
|
|
|
562
562
|
|
|
563
563
|
old_ignore_case = index->ignore_case;
|
|
564
564
|
|
|
565
|
-
if (caps ==
|
|
565
|
+
if (caps == GIT_INDEX_CAPABILITY_FROM_OWNER) {
|
|
566
566
|
git_repository *repo = INDEX_OWNER(index);
|
|
567
567
|
int val;
|
|
568
568
|
|
|
@@ -570,17 +570,17 @@ int git_index_set_caps(git_index *index, int caps)
|
|
|
570
570
|
return create_index_error(
|
|
571
571
|
-1, "cannot access repository to set index caps");
|
|
572
572
|
|
|
573
|
-
if (!
|
|
573
|
+
if (!git_repository__configmap_lookup(&val, repo, GIT_CONFIGMAP_IGNORECASE))
|
|
574
574
|
index->ignore_case = (val != 0);
|
|
575
|
-
if (!
|
|
575
|
+
if (!git_repository__configmap_lookup(&val, repo, GIT_CONFIGMAP_FILEMODE))
|
|
576
576
|
index->distrust_filemode = (val == 0);
|
|
577
|
-
if (!
|
|
577
|
+
if (!git_repository__configmap_lookup(&val, repo, GIT_CONFIGMAP_SYMLINKS))
|
|
578
578
|
index->no_symlinks = (val == 0);
|
|
579
579
|
}
|
|
580
580
|
else {
|
|
581
|
-
index->ignore_case = ((caps &
|
|
582
|
-
index->distrust_filemode = ((caps &
|
|
583
|
-
index->no_symlinks = ((caps &
|
|
581
|
+
index->ignore_case = ((caps & GIT_INDEX_CAPABILITY_IGNORE_CASE) != 0);
|
|
582
|
+
index->distrust_filemode = ((caps & GIT_INDEX_CAPABILITY_NO_FILEMODE) != 0);
|
|
583
|
+
index->no_symlinks = ((caps & GIT_INDEX_CAPABILITY_NO_SYMLINKS) != 0);
|
|
584
584
|
}
|
|
585
585
|
|
|
586
586
|
if (old_ignore_case != index->ignore_case) {
|
|
@@ -592,9 +592,9 @@ int git_index_set_caps(git_index *index, int caps)
|
|
|
592
592
|
|
|
593
593
|
int git_index_caps(const git_index *index)
|
|
594
594
|
{
|
|
595
|
-
return ((index->ignore_case ?
|
|
596
|
-
(index->distrust_filemode ?
|
|
597
|
-
(index->no_symlinks ?
|
|
595
|
+
return ((index->ignore_case ? GIT_INDEX_CAPABILITY_IGNORE_CASE : 0) |
|
|
596
|
+
(index->distrust_filemode ? GIT_INDEX_CAPABILITY_NO_FILEMODE : 0) |
|
|
597
|
+
(index->no_symlinks ? GIT_INDEX_CAPABILITY_NO_SYMLINKS : 0));
|
|
598
598
|
}
|
|
599
599
|
|
|
600
600
|
const git_oid *git_index_checksum(git_index *index)
|
|
@@ -616,7 +616,7 @@ static int compare_checksum(git_index *index)
|
|
|
616
616
|
|
|
617
617
|
if (p_lseek(fd, -20, SEEK_END) < 0) {
|
|
618
618
|
p_close(fd);
|
|
619
|
-
|
|
619
|
+
git_error_set(GIT_ERROR_OS, "failed to seek to end of file");
|
|
620
620
|
return -1;
|
|
621
621
|
}
|
|
622
622
|
|
|
@@ -651,8 +651,8 @@ int git_index_read(git_index *index, int force)
|
|
|
651
651
|
|
|
652
652
|
if ((updated = git_futils_filestamp_check(&stamp, index->index_file_path) < 0) ||
|
|
653
653
|
((updated = compare_checksum(index)) < 0)) {
|
|
654
|
-
|
|
655
|
-
|
|
654
|
+
git_error_set(
|
|
655
|
+
GIT_ERROR_INDEX,
|
|
656
656
|
"failed to read index: '%s' no longer exists",
|
|
657
657
|
index->index_file_path);
|
|
658
658
|
return updated;
|
|
@@ -685,7 +685,7 @@ int git_index_read(git_index *index, int force)
|
|
|
685
685
|
int git_index_read_safely(git_index *index)
|
|
686
686
|
{
|
|
687
687
|
if (git_index__enforce_unsaved_safety && index->dirty) {
|
|
688
|
-
|
|
688
|
+
git_error_set(GIT_ERROR_INDEX,
|
|
689
689
|
"the index has unsaved changes that would be overwritten by this operation");
|
|
690
690
|
return GIT_EINDEXDIRTY;
|
|
691
691
|
}
|
|
@@ -698,7 +698,7 @@ int git_index__changed_relative_to(
|
|
|
698
698
|
{
|
|
699
699
|
/* attempt to update index (ignoring errors) */
|
|
700
700
|
if (git_index_read(index, false) < 0)
|
|
701
|
-
|
|
701
|
+
git_error_clear();
|
|
702
702
|
|
|
703
703
|
return !!git_oid_cmp(&index->checksum, checksum);
|
|
704
704
|
}
|
|
@@ -736,7 +736,7 @@ static int truncate_racily_clean(git_index *index)
|
|
|
736
736
|
|
|
737
737
|
diff_opts.flags |= GIT_DIFF_INCLUDE_TYPECHANGE | GIT_DIFF_IGNORE_SUBMODULES | GIT_DIFF_DISABLE_PATHSPEC_MATCH;
|
|
738
738
|
git_vector_foreach(&index->entries, i, entry) {
|
|
739
|
-
if ((entry->flags_extended &
|
|
739
|
+
if ((entry->flags_extended & GIT_INDEX_ENTRY_UPTODATE) == 0 &&
|
|
740
740
|
is_racy_entry(index, entry))
|
|
741
741
|
git_vector_insert(&paths, (char *)entry->path);
|
|
742
742
|
}
|
|
@@ -781,7 +781,7 @@ int git_index_set_version(git_index *index, unsigned int version)
|
|
|
781
781
|
|
|
782
782
|
if (version < INDEX_VERSION_NUMBER_LB ||
|
|
783
783
|
version > INDEX_VERSION_NUMBER_UB) {
|
|
784
|
-
|
|
784
|
+
git_error_set(GIT_ERROR_INDEX, "invalid version number");
|
|
785
785
|
return -1;
|
|
786
786
|
}
|
|
787
787
|
|
|
@@ -851,21 +851,22 @@ const git_index_entry *git_index_get_byindex(
|
|
|
851
851
|
const git_index_entry *git_index_get_bypath(
|
|
852
852
|
git_index *index, const char *path, int stage)
|
|
853
853
|
{
|
|
854
|
-
khiter_t pos;
|
|
855
854
|
git_index_entry key = {{ 0 }};
|
|
855
|
+
git_index_entry *value;
|
|
856
856
|
|
|
857
857
|
assert(index);
|
|
858
858
|
|
|
859
859
|
key.path = path;
|
|
860
|
-
|
|
860
|
+
GIT_INDEX_ENTRY_STAGE_SET(&key, stage);
|
|
861
861
|
|
|
862
|
-
LOOKUP_IN_MAP(
|
|
862
|
+
LOOKUP_IN_MAP(value, index, &key);
|
|
863
863
|
|
|
864
|
-
if (
|
|
865
|
-
|
|
864
|
+
if (!value) {
|
|
865
|
+
git_error_set(GIT_ERROR_INDEX, "index does not contain '%s'", path);
|
|
866
|
+
return NULL;
|
|
867
|
+
}
|
|
866
868
|
|
|
867
|
-
|
|
868
|
-
return NULL;
|
|
869
|
+
return value;
|
|
869
870
|
}
|
|
870
871
|
|
|
871
872
|
void git_index_entry__init_from_stat(
|
|
@@ -890,12 +891,12 @@ static void index_entry_adjust_namemask(
|
|
|
890
891
|
git_index_entry *entry,
|
|
891
892
|
size_t path_length)
|
|
892
893
|
{
|
|
893
|
-
entry->flags &= ~
|
|
894
|
+
entry->flags &= ~GIT_INDEX_ENTRY_NAMEMASK;
|
|
894
895
|
|
|
895
|
-
if (path_length <
|
|
896
|
-
entry->flags |= path_length &
|
|
896
|
+
if (path_length < GIT_INDEX_ENTRY_NAMEMASK)
|
|
897
|
+
entry->flags |= path_length & GIT_INDEX_ENTRY_NAMEMASK;
|
|
897
898
|
else
|
|
898
|
-
entry->flags |=
|
|
899
|
+
entry->flags |= GIT_INDEX_ENTRY_NAMEMASK;
|
|
899
900
|
}
|
|
900
901
|
|
|
901
902
|
/* When `from_workdir` is true, we will validate the paths to avoid placing
|
|
@@ -926,14 +927,14 @@ static int index_entry_create(
|
|
|
926
927
|
mode = st->st_mode;
|
|
927
928
|
|
|
928
929
|
if (!git_path_isvalid(repo, path, mode, path_valid_flags)) {
|
|
929
|
-
|
|
930
|
+
git_error_set(GIT_ERROR_INDEX, "invalid path: '%s'", path);
|
|
930
931
|
return -1;
|
|
931
932
|
}
|
|
932
933
|
|
|
933
|
-
|
|
934
|
-
|
|
934
|
+
GIT_ERROR_CHECK_ALLOC_ADD(&alloclen, sizeof(struct entry_internal), pathlen);
|
|
935
|
+
GIT_ERROR_CHECK_ALLOC_ADD(&alloclen, alloclen, 1);
|
|
935
936
|
entry = git__calloc(1, alloclen);
|
|
936
|
-
|
|
937
|
+
GIT_ERROR_CHECK_ALLOC(entry);
|
|
937
938
|
|
|
938
939
|
entry->pathlen = pathlen;
|
|
939
940
|
memcpy(entry->path, path, pathlen);
|
|
@@ -1030,7 +1031,7 @@ static int index_entry_reuc_init(git_index_reuc_entry **reuc_out,
|
|
|
1030
1031
|
assert(reuc_out && path);
|
|
1031
1032
|
|
|
1032
1033
|
*reuc_out = reuc = reuc_entry_alloc(path);
|
|
1033
|
-
|
|
1034
|
+
GIT_ERROR_CHECK_ALLOC(reuc);
|
|
1034
1035
|
|
|
1035
1036
|
if ((reuc->mode[0] = ancestor_mode) > 0) {
|
|
1036
1037
|
assert(ancestor_oid);
|
|
@@ -1078,7 +1079,7 @@ static void index_entry_cpy_nocache(
|
|
|
1078
1079
|
git_oid_cpy(&tgt->id, &src->id);
|
|
1079
1080
|
tgt->mode = src->mode;
|
|
1080
1081
|
tgt->flags = src->flags;
|
|
1081
|
-
tgt->flags_extended = (src->flags_extended &
|
|
1082
|
+
tgt->flags_extended = (src->flags_extended & GIT_INDEX_ENTRY_EXTENDED_FLAGS);
|
|
1082
1083
|
}
|
|
1083
1084
|
|
|
1084
1085
|
static int index_entry_dup_nocache(
|
|
@@ -1096,9 +1097,8 @@ static int index_entry_dup_nocache(
|
|
|
1096
1097
|
static int has_file_name(git_index *index,
|
|
1097
1098
|
const git_index_entry *entry, size_t pos, int ok_to_replace)
|
|
1098
1099
|
{
|
|
1099
|
-
int retval = 0;
|
|
1100
1100
|
size_t len = strlen(entry->path);
|
|
1101
|
-
int stage =
|
|
1101
|
+
int stage = GIT_INDEX_ENTRY_STAGE(entry);
|
|
1102
1102
|
const char *name = entry->path;
|
|
1103
1103
|
|
|
1104
1104
|
while (pos < index->entries.length) {
|
|
@@ -1108,18 +1108,17 @@ static int has_file_name(git_index *index,
|
|
|
1108
1108
|
break;
|
|
1109
1109
|
if (memcmp(name, p->path, len))
|
|
1110
1110
|
break;
|
|
1111
|
-
if (
|
|
1111
|
+
if (GIT_INDEX_ENTRY_STAGE(&p->entry) != stage)
|
|
1112
1112
|
continue;
|
|
1113
1113
|
if (p->path[len] != '/')
|
|
1114
1114
|
continue;
|
|
1115
|
-
retval = -1;
|
|
1116
1115
|
if (!ok_to_replace)
|
|
1117
|
-
|
|
1116
|
+
return -1;
|
|
1118
1117
|
|
|
1119
1118
|
if (index_remove_entry(index, --pos) < 0)
|
|
1120
1119
|
break;
|
|
1121
1120
|
}
|
|
1122
|
-
return
|
|
1121
|
+
return 0;
|
|
1123
1122
|
}
|
|
1124
1123
|
|
|
1125
1124
|
/*
|
|
@@ -1129,8 +1128,7 @@ static int has_file_name(git_index *index,
|
|
|
1129
1128
|
static int has_dir_name(git_index *index,
|
|
1130
1129
|
const git_index_entry *entry, int ok_to_replace)
|
|
1131
1130
|
{
|
|
1132
|
-
int
|
|
1133
|
-
int stage = GIT_IDXENTRY_STAGE(entry);
|
|
1131
|
+
int stage = GIT_INDEX_ENTRY_STAGE(entry);
|
|
1134
1132
|
const char *name = entry->path;
|
|
1135
1133
|
const char *slash = name + strlen(name);
|
|
1136
1134
|
|
|
@@ -1141,14 +1139,13 @@ static int has_dir_name(git_index *index,
|
|
|
1141
1139
|
if (*--slash == '/')
|
|
1142
1140
|
break;
|
|
1143
1141
|
if (slash <= entry->path)
|
|
1144
|
-
return
|
|
1142
|
+
return 0;
|
|
1145
1143
|
}
|
|
1146
1144
|
len = slash - name;
|
|
1147
1145
|
|
|
1148
1146
|
if (!index_find(&pos, index, name, len, stage)) {
|
|
1149
|
-
retval = -1;
|
|
1150
1147
|
if (!ok_to_replace)
|
|
1151
|
-
|
|
1148
|
+
return -1;
|
|
1152
1149
|
|
|
1153
1150
|
if (index_remove_entry(index, pos) < 0)
|
|
1154
1151
|
break;
|
|
@@ -1168,22 +1165,20 @@ static int has_dir_name(git_index *index,
|
|
|
1168
1165
|
memcmp(p->path, name, len))
|
|
1169
1166
|
break; /* not our subdirectory */
|
|
1170
1167
|
|
|
1171
|
-
if (
|
|
1172
|
-
return
|
|
1168
|
+
if (GIT_INDEX_ENTRY_STAGE(&p->entry) == stage)
|
|
1169
|
+
return 0;
|
|
1173
1170
|
}
|
|
1174
1171
|
}
|
|
1175
1172
|
|
|
1176
|
-
return
|
|
1173
|
+
return 0;
|
|
1177
1174
|
}
|
|
1178
1175
|
|
|
1179
1176
|
static int check_file_directory_collision(git_index *index,
|
|
1180
1177
|
git_index_entry *entry, size_t pos, int ok_to_replace)
|
|
1181
1178
|
{
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
if (retval) {
|
|
1186
|
-
giterr_set(GITERR_INDEX,
|
|
1179
|
+
if (has_file_name(index, entry, pos, ok_to_replace) < 0 ||
|
|
1180
|
+
has_dir_name(index, entry, ok_to_replace) < 0) {
|
|
1181
|
+
git_error_set(GIT_ERROR_INDEX,
|
|
1187
1182
|
"'%s' appears as both a file and a directory", entry->path);
|
|
1188
1183
|
return -1;
|
|
1189
1184
|
}
|
|
@@ -1228,7 +1223,7 @@ static int canonicalize_directory_path(
|
|
|
1228
1223
|
&pos, &index->entries, index->entries_search_path, search);
|
|
1229
1224
|
|
|
1230
1225
|
while ((match = git_vector_get(&index->entries, pos))) {
|
|
1231
|
-
if (
|
|
1226
|
+
if (GIT_INDEX_ENTRY_STAGE(match) != 0) {
|
|
1232
1227
|
/* conflicts do not contribute to canonical paths */
|
|
1233
1228
|
} else if (strncmp(search, match->path, search_len) == 0) {
|
|
1234
1229
|
/* prefer an exact match to the input filename */
|
|
@@ -1265,8 +1260,8 @@ static int index_no_dups(void **old, void *new)
|
|
|
1265
1260
|
{
|
|
1266
1261
|
const git_index_entry *entry = new;
|
|
1267
1262
|
GIT_UNUSED(old);
|
|
1268
|
-
|
|
1269
|
-
entry->path,
|
|
1263
|
+
git_error_set(GIT_ERROR_INDEX, "'%s' appears multiple times at stage %d",
|
|
1264
|
+
entry->path, GIT_INDEX_ENTRY_STAGE(entry));
|
|
1270
1265
|
return GIT_EEXISTS;
|
|
1271
1266
|
}
|
|
1272
1267
|
|
|
@@ -1282,7 +1277,7 @@ static void index_existing_and_best(
|
|
|
1282
1277
|
int error;
|
|
1283
1278
|
|
|
1284
1279
|
error = index_find(&pos,
|
|
1285
|
-
index, entry->path, 0,
|
|
1280
|
+
index, entry->path, 0, GIT_INDEX_ENTRY_STAGE(entry));
|
|
1286
1281
|
|
|
1287
1282
|
if (error == 0) {
|
|
1288
1283
|
*existing = index->entries.contents[pos];
|
|
@@ -1295,7 +1290,7 @@ static void index_existing_and_best(
|
|
|
1295
1290
|
*existing_position = 0;
|
|
1296
1291
|
*best = NULL;
|
|
1297
1292
|
|
|
1298
|
-
if (
|
|
1293
|
+
if (GIT_INDEX_ENTRY_STAGE(entry) == 0) {
|
|
1299
1294
|
for (; pos < index->entries.length; pos++) {
|
|
1300
1295
|
int (*strcomp)(const char *a, const char *b) =
|
|
1301
1296
|
index->ignore_case ? git__strcasecmp : git__strcmp;
|
|
@@ -1305,7 +1300,7 @@ static void index_existing_and_best(
|
|
|
1305
1300
|
if (strcomp(entry->path, e->path) != 0)
|
|
1306
1301
|
break;
|
|
1307
1302
|
|
|
1308
|
-
if (
|
|
1303
|
+
if (GIT_INDEX_ENTRY_STAGE(e) == GIT_INDEX_STAGE_ANCESTOR) {
|
|
1309
1304
|
*best = e;
|
|
1310
1305
|
continue;
|
|
1311
1306
|
} else {
|
|
@@ -1337,57 +1332,58 @@ static int index_insert(
|
|
|
1337
1332
|
bool trust_mode,
|
|
1338
1333
|
bool trust_id)
|
|
1339
1334
|
{
|
|
1340
|
-
int error = 0;
|
|
1341
|
-
size_t path_length, position;
|
|
1342
1335
|
git_index_entry *existing, *best, *entry;
|
|
1336
|
+
size_t path_length, position;
|
|
1337
|
+
int error;
|
|
1343
1338
|
|
|
1344
1339
|
assert(index && entry_ptr);
|
|
1345
1340
|
|
|
1346
1341
|
entry = *entry_ptr;
|
|
1347
1342
|
|
|
1348
|
-
/*
|
|
1343
|
+
/* Make sure that the path length flag is correct */
|
|
1349
1344
|
path_length = ((struct entry_internal *)entry)->pathlen;
|
|
1350
1345
|
index_entry_adjust_namemask(entry, path_length);
|
|
1351
1346
|
|
|
1352
|
-
/*
|
|
1353
|
-
entry->flags_extended |=
|
|
1347
|
+
/* This entry is now up-to-date and should not be checked for raciness */
|
|
1348
|
+
entry->flags_extended |= GIT_INDEX_ENTRY_UPTODATE;
|
|
1354
1349
|
|
|
1355
1350
|
git_vector_sort(&index->entries);
|
|
1356
1351
|
|
|
1357
|
-
/*
|
|
1352
|
+
/*
|
|
1353
|
+
* Look if an entry with this path already exists, either staged, or (if
|
|
1358
1354
|
* this entry is a regular staged item) as the "ours" side of a conflict.
|
|
1359
1355
|
*/
|
|
1360
1356
|
index_existing_and_best(&existing, &position, &best, index, entry);
|
|
1361
1357
|
|
|
1362
|
-
/*
|
|
1358
|
+
/* Update the file mode */
|
|
1363
1359
|
entry->mode = trust_mode ?
|
|
1364
1360
|
git_index__create_mode(entry->mode) :
|
|
1365
1361
|
index_merge_mode(index, best, entry->mode);
|
|
1366
1362
|
|
|
1367
|
-
/*
|
|
1368
|
-
if (!trust_path)
|
|
1369
|
-
|
|
1363
|
+
/* Canonicalize the directory name */
|
|
1364
|
+
if (!trust_path && (error = canonicalize_directory_path(index, entry, best)) < 0)
|
|
1365
|
+
goto out;
|
|
1370
1366
|
|
|
1371
|
-
/*
|
|
1372
|
-
if (!
|
|
1373
|
-
|
|
1367
|
+
/* Ensure that the given id exists (unless it's a submodule) */
|
|
1368
|
+
if (!trust_id && INDEX_OWNER(index) &&
|
|
1369
|
+
(entry->mode & GIT_FILEMODE_COMMIT) != GIT_FILEMODE_COMMIT) {
|
|
1374
1370
|
|
|
1375
1371
|
if (!git_object__is_valid(INDEX_OWNER(index), &entry->id,
|
|
1376
|
-
|
|
1372
|
+
git_object__type_from_filemode(entry->mode))) {
|
|
1377
1373
|
error = -1;
|
|
1374
|
+
goto out;
|
|
1375
|
+
}
|
|
1378
1376
|
}
|
|
1379
1377
|
|
|
1380
|
-
/*
|
|
1381
|
-
if (
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
if (error < 0)
|
|
1385
|
-
/* skip changes */;
|
|
1378
|
+
/* Look for tree / blob name collisions, removing conflicts if requested */
|
|
1379
|
+
if ((error = check_file_directory_collision(index, entry, position, replace)) < 0)
|
|
1380
|
+
goto out;
|
|
1386
1381
|
|
|
1387
|
-
/*
|
|
1382
|
+
/*
|
|
1383
|
+
* If we are replacing an existing item, overwrite the existing entry
|
|
1388
1384
|
* and return it in place of the passed in one.
|
|
1389
1385
|
*/
|
|
1390
|
-
|
|
1386
|
+
if (existing) {
|
|
1391
1387
|
if (replace) {
|
|
1392
1388
|
index_entry_cpy(existing, entry);
|
|
1393
1389
|
|
|
@@ -1396,25 +1392,25 @@ static int index_insert(
|
|
|
1396
1392
|
}
|
|
1397
1393
|
|
|
1398
1394
|
index_entry_free(entry);
|
|
1399
|
-
*entry_ptr =
|
|
1400
|
-
}
|
|
1401
|
-
|
|
1402
|
-
|
|
1395
|
+
*entry_ptr = existing;
|
|
1396
|
+
} else {
|
|
1397
|
+
/*
|
|
1398
|
+
* If replace is not requested or no existing entry exists, insert
|
|
1403
1399
|
* at the sorted position. (Since we re-sort after each insert to
|
|
1404
1400
|
* check for dups, this is actually cheaper in the long run.)
|
|
1405
1401
|
*/
|
|
1406
|
-
error = git_vector_insert_sorted(&index->entries, entry, index_no_dups)
|
|
1402
|
+
if ((error = git_vector_insert_sorted(&index->entries, entry, index_no_dups)) < 0)
|
|
1403
|
+
goto out;
|
|
1407
1404
|
|
|
1408
|
-
|
|
1409
|
-
INSERT_IN_MAP(index, entry, &error);
|
|
1410
|
-
}
|
|
1405
|
+
INSERT_IN_MAP(index, entry, error);
|
|
1411
1406
|
}
|
|
1412
1407
|
|
|
1408
|
+
index->dirty = 1;
|
|
1409
|
+
|
|
1410
|
+
out:
|
|
1413
1411
|
if (error < 0) {
|
|
1414
1412
|
index_entry_free(*entry_ptr);
|
|
1415
1413
|
*entry_ptr = NULL;
|
|
1416
|
-
} else {
|
|
1417
|
-
index->dirty = 1;
|
|
1418
1414
|
}
|
|
1419
1415
|
|
|
1420
1416
|
return error;
|
|
@@ -1458,7 +1454,7 @@ GIT_INLINE(bool) valid_filemode(const int filemode)
|
|
|
1458
1454
|
return (is_file_or_link(filemode) || filemode == GIT_FILEMODE_COMMIT);
|
|
1459
1455
|
}
|
|
1460
1456
|
|
|
1461
|
-
int
|
|
1457
|
+
int git_index_add_from_buffer(
|
|
1462
1458
|
git_index *index, const git_index_entry *source_entry,
|
|
1463
1459
|
const void *buffer, size_t len)
|
|
1464
1460
|
{
|
|
@@ -1474,21 +1470,26 @@ int git_index_add_frombuffer(
|
|
|
1474
1470
|
"Index is not backed up by an existing repository.");
|
|
1475
1471
|
|
|
1476
1472
|
if (!is_file_or_link(source_entry->mode)) {
|
|
1477
|
-
|
|
1473
|
+
git_error_set(GIT_ERROR_INDEX, "invalid filemode");
|
|
1474
|
+
return -1;
|
|
1475
|
+
}
|
|
1476
|
+
|
|
1477
|
+
if (len > UINT32_MAX) {
|
|
1478
|
+
git_error_set(GIT_ERROR_INDEX, "buffer is too large");
|
|
1478
1479
|
return -1;
|
|
1479
1480
|
}
|
|
1480
1481
|
|
|
1481
1482
|
if (index_entry_dup(&entry, index, source_entry) < 0)
|
|
1482
1483
|
return -1;
|
|
1483
1484
|
|
|
1484
|
-
error =
|
|
1485
|
+
error = git_blob_create_from_buffer(&id, INDEX_OWNER(index), buffer, len);
|
|
1485
1486
|
if (error < 0) {
|
|
1486
1487
|
index_entry_free(entry);
|
|
1487
1488
|
return error;
|
|
1488
1489
|
}
|
|
1489
1490
|
|
|
1490
1491
|
git_oid_cpy(&entry->id, &id);
|
|
1491
|
-
entry->file_size = len;
|
|
1492
|
+
entry->file_size = (uint32_t)len;
|
|
1492
1493
|
|
|
1493
1494
|
if ((error = index_insert(index, &entry, 1, true, true, true)) < 0)
|
|
1494
1495
|
return error;
|
|
@@ -1515,7 +1516,7 @@ static int add_repo_as_submodule(git_index_entry **out, git_index *index, const
|
|
|
1515
1516
|
return error;
|
|
1516
1517
|
|
|
1517
1518
|
if ((error = p_stat(abspath.ptr, &st)) < 0) {
|
|
1518
|
-
|
|
1519
|
+
git_error_set(GIT_ERROR_OS, "failed to stat repository dir");
|
|
1519
1520
|
return -1;
|
|
1520
1521
|
}
|
|
1521
1522
|
|
|
@@ -1559,13 +1560,13 @@ int git_index_add_bypath(git_index *index, const char *path)
|
|
|
1559
1560
|
git_submodule *sm;
|
|
1560
1561
|
git_error_state err;
|
|
1561
1562
|
|
|
1562
|
-
|
|
1563
|
+
git_error_state_capture(&err, ret);
|
|
1563
1564
|
|
|
1564
1565
|
ret = git_submodule_lookup(&sm, INDEX_OWNER(index), path);
|
|
1565
1566
|
if (ret == GIT_ENOTFOUND)
|
|
1566
|
-
return
|
|
1567
|
+
return git_error_state_restore(&err);
|
|
1567
1568
|
|
|
1568
|
-
|
|
1569
|
+
git_error_state_free(&err);
|
|
1569
1570
|
|
|
1570
1571
|
/*
|
|
1571
1572
|
* EEXISTS means that there is a repository at that path, but it's not known
|
|
@@ -1607,7 +1608,7 @@ int git_index_remove_bypath(git_index *index, const char *path)
|
|
|
1607
1608
|
return ret;
|
|
1608
1609
|
|
|
1609
1610
|
if (ret == GIT_ENOTFOUND)
|
|
1610
|
-
|
|
1611
|
+
git_error_clear();
|
|
1611
1612
|
|
|
1612
1613
|
return 0;
|
|
1613
1614
|
}
|
|
@@ -1623,8 +1624,9 @@ int git_index__fill(git_index *index, const git_vector *source_entries)
|
|
|
1623
1624
|
if (!source_entries->length)
|
|
1624
1625
|
return 0;
|
|
1625
1626
|
|
|
1626
|
-
git_vector_size_hint(&index->entries, source_entries->length)
|
|
1627
|
-
|
|
1627
|
+
if (git_vector_size_hint(&index->entries, source_entries->length) < 0 ||
|
|
1628
|
+
git_idxmap_resize(index->entries_map, (size_t)(source_entries->length * 1.3)) < 0)
|
|
1629
|
+
return -1;
|
|
1628
1630
|
|
|
1629
1631
|
git_vector_foreach(source_entries, i, source_entry) {
|
|
1630
1632
|
git_index_entry *entry = NULL;
|
|
@@ -1633,13 +1635,13 @@ int git_index__fill(git_index *index, const git_vector *source_entries)
|
|
|
1633
1635
|
break;
|
|
1634
1636
|
|
|
1635
1637
|
index_entry_adjust_namemask(entry, ((struct entry_internal *)entry)->pathlen);
|
|
1636
|
-
entry->flags_extended |=
|
|
1638
|
+
entry->flags_extended |= GIT_INDEX_ENTRY_UPTODATE;
|
|
1637
1639
|
entry->mode = git_index__create_mode(entry->mode);
|
|
1638
1640
|
|
|
1639
1641
|
if ((ret = git_vector_insert(&index->entries, entry)) < 0)
|
|
1640
1642
|
break;
|
|
1641
1643
|
|
|
1642
|
-
INSERT_IN_MAP(index, entry,
|
|
1644
|
+
INSERT_IN_MAP(index, entry, ret);
|
|
1643
1645
|
if (ret < 0)
|
|
1644
1646
|
break;
|
|
1645
1647
|
|
|
@@ -1661,7 +1663,7 @@ int git_index_add(git_index *index, const git_index_entry *source_entry)
|
|
|
1661
1663
|
assert(index && source_entry && source_entry->path);
|
|
1662
1664
|
|
|
1663
1665
|
if (!valid_filemode(source_entry->mode)) {
|
|
1664
|
-
|
|
1666
|
+
git_error_set(GIT_ERROR_INDEX, "invalid entry mode");
|
|
1665
1667
|
return -1;
|
|
1666
1668
|
}
|
|
1667
1669
|
|
|
@@ -1680,13 +1682,13 @@ int git_index_remove(git_index *index, const char *path, int stage)
|
|
|
1680
1682
|
git_index_entry remove_key = {{ 0 }};
|
|
1681
1683
|
|
|
1682
1684
|
remove_key.path = path;
|
|
1683
|
-
|
|
1685
|
+
GIT_INDEX_ENTRY_STAGE_SET(&remove_key, stage);
|
|
1684
1686
|
|
|
1685
1687
|
DELETE_IN_MAP(index, &remove_key);
|
|
1686
1688
|
|
|
1687
1689
|
if (index_find(&position, index, path, 0, stage) < 0) {
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
+
git_error_set(
|
|
1691
|
+
GIT_ERROR_INDEX, "index does not contain %s at stage %d", path, stage);
|
|
1690
1692
|
error = GIT_ENOTFOUND;
|
|
1691
1693
|
} else {
|
|
1692
1694
|
error = index_remove_entry(index, position);
|
|
@@ -1711,7 +1713,7 @@ int git_index_remove_directory(git_index *index, const char *dir, int stage)
|
|
|
1711
1713
|
if (!entry || git__prefixcmp(entry->path, pfx.ptr) != 0)
|
|
1712
1714
|
break;
|
|
1713
1715
|
|
|
1714
|
-
if (
|
|
1716
|
+
if (GIT_INDEX_ENTRY_STAGE(entry) != stage) {
|
|
1715
1717
|
++pos;
|
|
1716
1718
|
continue;
|
|
1717
1719
|
}
|
|
@@ -1758,7 +1760,7 @@ int git_index_find(size_t *at_pos, git_index *index, const char *path)
|
|
|
1758
1760
|
|
|
1759
1761
|
if (git_vector_bsearch2(
|
|
1760
1762
|
&pos, &index->entries, index->entries_search_path, path) < 0) {
|
|
1761
|
-
|
|
1763
|
+
git_error_set(GIT_ERROR_INDEX, "index does not contain %s", path);
|
|
1762
1764
|
return GIT_ENOTFOUND;
|
|
1763
1765
|
}
|
|
1764
1766
|
|
|
@@ -1800,9 +1802,10 @@ int git_index_conflict_add(git_index *index,
|
|
|
1800
1802
|
/* Validate entries */
|
|
1801
1803
|
for (i = 0; i < 3; i++) {
|
|
1802
1804
|
if (entries[i] && !valid_filemode(entries[i]->mode)) {
|
|
1803
|
-
|
|
1805
|
+
git_error_set(GIT_ERROR_INDEX, "invalid filemode for stage %d entry",
|
|
1804
1806
|
i + 1);
|
|
1805
|
-
|
|
1807
|
+
ret = -1;
|
|
1808
|
+
goto on_error;
|
|
1806
1809
|
}
|
|
1807
1810
|
}
|
|
1808
1811
|
|
|
@@ -1815,7 +1818,7 @@ int git_index_conflict_add(git_index *index,
|
|
|
1815
1818
|
if (ret != GIT_ENOTFOUND)
|
|
1816
1819
|
goto on_error;
|
|
1817
1820
|
|
|
1818
|
-
|
|
1821
|
+
git_error_clear();
|
|
1819
1822
|
ret = 0;
|
|
1820
1823
|
}
|
|
1821
1824
|
}
|
|
@@ -1826,7 +1829,7 @@ int git_index_conflict_add(git_index *index,
|
|
|
1826
1829
|
continue;
|
|
1827
1830
|
|
|
1828
1831
|
/* Make sure stage is correct */
|
|
1829
|
-
|
|
1832
|
+
GIT_INDEX_ENTRY_STAGE_SET(entries[i], i + 1);
|
|
1830
1833
|
|
|
1831
1834
|
if ((ret = index_insert(index, &entries[i], 1, true, true, false)) < 0)
|
|
1832
1835
|
goto on_error;
|
|
@@ -1869,7 +1872,7 @@ static int index_conflict__get_byindex(
|
|
|
1869
1872
|
if (path && index->entries_cmp_path(conflict_entry->path, path) != 0)
|
|
1870
1873
|
break;
|
|
1871
1874
|
|
|
1872
|
-
stage =
|
|
1875
|
+
stage = GIT_INDEX_ENTRY_STAGE(conflict_entry);
|
|
1873
1876
|
path = conflict_entry->path;
|
|
1874
1877
|
|
|
1875
1878
|
switch (stage) {
|
|
@@ -1936,7 +1939,7 @@ static int index_conflict_remove(git_index *index, const char *path)
|
|
|
1936
1939
|
index->entries_cmp_path(conflict_entry->path, path) != 0)
|
|
1937
1940
|
break;
|
|
1938
1941
|
|
|
1939
|
-
if (
|
|
1942
|
+
if (GIT_INDEX_ENTRY_STAGE(conflict_entry) == 0) {
|
|
1940
1943
|
pos++;
|
|
1941
1944
|
continue;
|
|
1942
1945
|
}
|
|
@@ -1968,13 +1971,58 @@ int git_index_has_conflicts(const git_index *index)
|
|
|
1968
1971
|
assert(index);
|
|
1969
1972
|
|
|
1970
1973
|
git_vector_foreach(&index->entries, i, entry) {
|
|
1971
|
-
if (
|
|
1974
|
+
if (GIT_INDEX_ENTRY_STAGE(entry) > 0)
|
|
1972
1975
|
return 1;
|
|
1973
1976
|
}
|
|
1974
1977
|
|
|
1975
1978
|
return 0;
|
|
1976
1979
|
}
|
|
1977
1980
|
|
|
1981
|
+
int git_index_iterator_new(
|
|
1982
|
+
git_index_iterator **iterator_out,
|
|
1983
|
+
git_index *index)
|
|
1984
|
+
{
|
|
1985
|
+
git_index_iterator *it;
|
|
1986
|
+
int error;
|
|
1987
|
+
|
|
1988
|
+
assert(iterator_out && index);
|
|
1989
|
+
|
|
1990
|
+
it = git__calloc(1, sizeof(git_index_iterator));
|
|
1991
|
+
GIT_ERROR_CHECK_ALLOC(it);
|
|
1992
|
+
|
|
1993
|
+
if ((error = git_index_snapshot_new(&it->snap, index)) < 0) {
|
|
1994
|
+
git__free(it);
|
|
1995
|
+
return error;
|
|
1996
|
+
}
|
|
1997
|
+
|
|
1998
|
+
it->index = index;
|
|
1999
|
+
|
|
2000
|
+
*iterator_out = it;
|
|
2001
|
+
return 0;
|
|
2002
|
+
}
|
|
2003
|
+
|
|
2004
|
+
int git_index_iterator_next(
|
|
2005
|
+
const git_index_entry **out,
|
|
2006
|
+
git_index_iterator *it)
|
|
2007
|
+
{
|
|
2008
|
+
assert(out && it);
|
|
2009
|
+
|
|
2010
|
+
if (it->cur >= git_vector_length(&it->snap))
|
|
2011
|
+
return GIT_ITEROVER;
|
|
2012
|
+
|
|
2013
|
+
*out = (git_index_entry *)git_vector_get(&it->snap, it->cur++);
|
|
2014
|
+
return 0;
|
|
2015
|
+
}
|
|
2016
|
+
|
|
2017
|
+
void git_index_iterator_free(git_index_iterator *it)
|
|
2018
|
+
{
|
|
2019
|
+
if (it == NULL)
|
|
2020
|
+
return;
|
|
2021
|
+
|
|
2022
|
+
git_index_snapshot_release(&it->snap, it->index);
|
|
2023
|
+
git__free(it);
|
|
2024
|
+
}
|
|
2025
|
+
|
|
1978
2026
|
int git_index_conflict_iterator_new(
|
|
1979
2027
|
git_index_conflict_iterator **iterator_out,
|
|
1980
2028
|
git_index *index)
|
|
@@ -1984,7 +2032,7 @@ int git_index_conflict_iterator_new(
|
|
|
1984
2032
|
assert(iterator_out && index);
|
|
1985
2033
|
|
|
1986
2034
|
it = git__calloc(1, sizeof(git_index_conflict_iterator));
|
|
1987
|
-
|
|
2035
|
+
GIT_ERROR_CHECK_ALLOC(it);
|
|
1988
2036
|
|
|
1989
2037
|
it->index = index;
|
|
1990
2038
|
|
|
@@ -2070,7 +2118,7 @@ int git_index_name_add(git_index *index,
|
|
|
2070
2118
|
assert((ancestor && ours) || (ancestor && theirs) || (ours && theirs));
|
|
2071
2119
|
|
|
2072
2120
|
conflict_name = git__calloc(1, sizeof(git_index_name_entry));
|
|
2073
|
-
|
|
2121
|
+
GIT_ERROR_CHECK_ALLOC(conflict_name);
|
|
2074
2122
|
|
|
2075
2123
|
if ((ancestor && !(conflict_name->ancestor = git__strdup(ancestor))) ||
|
|
2076
2124
|
(ours && !(conflict_name->ours = git__strdup(ours))) ||
|
|
@@ -2210,7 +2258,7 @@ void git_index_reuc_clear(git_index *index)
|
|
|
2210
2258
|
|
|
2211
2259
|
static int index_error_invalid(const char *message)
|
|
2212
2260
|
{
|
|
2213
|
-
|
|
2261
|
+
git_error_set(GIT_ERROR_INDEX, "invalid data in index - %s", message);
|
|
2214
2262
|
return -1;
|
|
2215
2263
|
}
|
|
2216
2264
|
|
|
@@ -2233,7 +2281,7 @@ static int read_reuc(git_index *index, const char *buffer, size_t size)
|
|
|
2233
2281
|
return index_error_invalid("reading reuc entries");
|
|
2234
2282
|
|
|
2235
2283
|
lost = reuc_entry_alloc(buffer);
|
|
2236
|
-
|
|
2284
|
+
GIT_ERROR_CHECK_ALLOC(lost);
|
|
2237
2285
|
|
|
2238
2286
|
size -= len;
|
|
2239
2287
|
buffer += len;
|
|
@@ -2242,7 +2290,7 @@ static int read_reuc(git_index *index, const char *buffer, size_t size)
|
|
|
2242
2290
|
for (i = 0; i < 3; i++) {
|
|
2243
2291
|
int64_t tmp;
|
|
2244
2292
|
|
|
2245
|
-
if (
|
|
2293
|
+
if (git__strntol64(&tmp, buffer, size, &endptr, 8) < 0 ||
|
|
2246
2294
|
!endptr || endptr == buffer || *endptr ||
|
|
2247
2295
|
tmp < 0 || tmp > UINT32_MAX) {
|
|
2248
2296
|
index_entry_reuc_free(lost);
|
|
@@ -2306,7 +2354,7 @@ static int read_conflict_names(git_index *index, const char *buffer, size_t size
|
|
|
2306
2354
|
ptr = NULL; \
|
|
2307
2355
|
else { \
|
|
2308
2356
|
ptr = git__malloc(len); \
|
|
2309
|
-
|
|
2357
|
+
GIT_ERROR_CHECK_ALLOC(ptr); \
|
|
2310
2358
|
memcpy(ptr, buffer, len); \
|
|
2311
2359
|
} \
|
|
2312
2360
|
\
|
|
@@ -2315,7 +2363,7 @@ static int read_conflict_names(git_index *index, const char *buffer, size_t size
|
|
|
2315
2363
|
|
|
2316
2364
|
while (size) {
|
|
2317
2365
|
git_index_name_entry *conflict_name = git__calloc(1, sizeof(git_index_name_entry));
|
|
2318
|
-
|
|
2366
|
+
GIT_ERROR_CHECK_ALLOC(conflict_name);
|
|
2319
2367
|
|
|
2320
2368
|
read_conflict_name(conflict_name->ancestor);
|
|
2321
2369
|
read_conflict_name(conflict_name->ours);
|
|
@@ -2345,13 +2393,13 @@ out_err:
|
|
|
2345
2393
|
static size_t index_entry_size(size_t path_len, size_t varint_len, uint32_t flags)
|
|
2346
2394
|
{
|
|
2347
2395
|
if (varint_len) {
|
|
2348
|
-
if (flags &
|
|
2396
|
+
if (flags & GIT_INDEX_ENTRY_EXTENDED)
|
|
2349
2397
|
return offsetof(struct entry_long, path) + path_len + 1 + varint_len;
|
|
2350
2398
|
else
|
|
2351
2399
|
return offsetof(struct entry_short, path) + path_len + 1 + varint_len;
|
|
2352
2400
|
} else {
|
|
2353
2401
|
#define entry_size(type,len) ((offsetof(type, path) + (len) + 8) & ~7)
|
|
2354
|
-
if (flags &
|
|
2402
|
+
if (flags & GIT_INDEX_ENTRY_EXTENDED)
|
|
2355
2403
|
return entry_size(struct entry_long, path_len);
|
|
2356
2404
|
else
|
|
2357
2405
|
return entry_size(struct entry_short, path_len);
|
|
@@ -2393,7 +2441,7 @@ static int read_entry(
|
|
|
2393
2441
|
git_oid_cpy(&entry.id, &source.oid);
|
|
2394
2442
|
entry.flags = ntohs(source.flags);
|
|
2395
2443
|
|
|
2396
|
-
if (entry.flags &
|
|
2444
|
+
if (entry.flags & GIT_INDEX_ENTRY_EXTENDED) {
|
|
2397
2445
|
uint16_t flags_raw;
|
|
2398
2446
|
size_t flags_offset;
|
|
2399
2447
|
|
|
@@ -2408,7 +2456,7 @@ static int read_entry(
|
|
|
2408
2456
|
path_ptr = (const char *) buffer + offsetof(struct entry_short, path);
|
|
2409
2457
|
|
|
2410
2458
|
if (!compressed) {
|
|
2411
|
-
path_length = entry.flags &
|
|
2459
|
+
path_length = entry.flags & GIT_INDEX_ENTRY_NAMEMASK;
|
|
2412
2460
|
|
|
2413
2461
|
/* if this is a very long string, we must find its
|
|
2414
2462
|
* real length without overflowing */
|
|
@@ -2434,17 +2482,17 @@ static int read_entry(
|
|
|
2434
2482
|
if (varint_len == 0 || last_len < strip_len)
|
|
2435
2483
|
return index_error_invalid("incorrect prefix length");
|
|
2436
2484
|
|
|
2437
|
-
prefix_len = last_len - strip_len;
|
|
2485
|
+
prefix_len = last_len - (size_t)strip_len;
|
|
2438
2486
|
suffix_len = strlen(path_ptr + varint_len);
|
|
2439
2487
|
|
|
2440
|
-
|
|
2441
|
-
|
|
2488
|
+
GIT_ERROR_CHECK_ALLOC_ADD(&path_len, prefix_len, suffix_len);
|
|
2489
|
+
GIT_ERROR_CHECK_ALLOC_ADD(&path_len, path_len, 1);
|
|
2442
2490
|
|
|
2443
2491
|
if (path_len > GIT_PATH_MAX)
|
|
2444
2492
|
return index_error_invalid("unreasonable path length");
|
|
2445
2493
|
|
|
2446
2494
|
tmp_path = git__malloc(path_len);
|
|
2447
|
-
|
|
2495
|
+
GIT_ERROR_CHECK_ALLOC(tmp_path);
|
|
2448
2496
|
|
|
2449
2497
|
memcpy(tmp_path, last, prefix_len);
|
|
2450
2498
|
memcpy(tmp_path + prefix_len, path_ptr + varint_len, suffix_len + 1);
|
|
@@ -2485,7 +2533,7 @@ static int read_header(struct index_header *dest, const void *buffer)
|
|
|
2485
2533
|
return 0;
|
|
2486
2534
|
}
|
|
2487
2535
|
|
|
2488
|
-
static
|
|
2536
|
+
static int read_extension(size_t *read_len, git_index *index, const char *buffer, size_t buffer_size)
|
|
2489
2537
|
{
|
|
2490
2538
|
struct index_extension dest;
|
|
2491
2539
|
size_t total_size;
|
|
@@ -2498,31 +2546,36 @@ static size_t read_extension(git_index *index, const char *buffer, size_t buffer
|
|
|
2498
2546
|
|
|
2499
2547
|
if (dest.extension_size > total_size ||
|
|
2500
2548
|
buffer_size < total_size ||
|
|
2501
|
-
buffer_size - total_size < INDEX_FOOTER_SIZE)
|
|
2502
|
-
|
|
2549
|
+
buffer_size - total_size < INDEX_FOOTER_SIZE) {
|
|
2550
|
+
index_error_invalid("extension is truncated");
|
|
2551
|
+
return -1;
|
|
2552
|
+
}
|
|
2503
2553
|
|
|
2504
2554
|
/* optional extension */
|
|
2505
2555
|
if (dest.signature[0] >= 'A' && dest.signature[0] <= 'Z') {
|
|
2506
2556
|
/* tree cache */
|
|
2507
2557
|
if (memcmp(dest.signature, INDEX_EXT_TREECACHE_SIG, 4) == 0) {
|
|
2508
2558
|
if (git_tree_cache_read(&index->tree, buffer + 8, dest.extension_size, &index->tree_pool) < 0)
|
|
2509
|
-
return
|
|
2559
|
+
return -1;
|
|
2510
2560
|
} else if (memcmp(dest.signature, INDEX_EXT_UNMERGED_SIG, 4) == 0) {
|
|
2511
2561
|
if (read_reuc(index, buffer + 8, dest.extension_size) < 0)
|
|
2512
|
-
return
|
|
2562
|
+
return -1;
|
|
2513
2563
|
} else if (memcmp(dest.signature, INDEX_EXT_CONFLICT_NAME_SIG, 4) == 0) {
|
|
2514
2564
|
if (read_conflict_names(index, buffer + 8, dest.extension_size) < 0)
|
|
2515
|
-
return
|
|
2565
|
+
return -1;
|
|
2516
2566
|
}
|
|
2517
2567
|
/* else, unsupported extension. We cannot parse this, but we can skip
|
|
2518
2568
|
* it by returning `total_size */
|
|
2519
2569
|
} else {
|
|
2520
2570
|
/* we cannot handle non-ignorable extensions;
|
|
2521
2571
|
* in fact they aren't even defined in the standard */
|
|
2522
|
-
|
|
2572
|
+
git_error_set(GIT_ERROR_INDEX, "unsupported mandatory extension: '%.4s'", dest.signature);
|
|
2573
|
+
return -1;
|
|
2523
2574
|
}
|
|
2524
2575
|
|
|
2525
|
-
|
|
2576
|
+
*read_len = total_size;
|
|
2577
|
+
|
|
2578
|
+
return 0;
|
|
2526
2579
|
}
|
|
2527
2580
|
|
|
2528
2581
|
static int parse_index(git_index *index, const char *buffer, size_t buffer_size)
|
|
@@ -2561,10 +2614,12 @@ static int parse_index(git_index *index, const char *buffer, size_t buffer_size)
|
|
|
2561
2614
|
|
|
2562
2615
|
assert(!index->entries.length);
|
|
2563
2616
|
|
|
2564
|
-
if (index->ignore_case
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2617
|
+
if (index->ignore_case &&
|
|
2618
|
+
(error = git_idxmap_icase_resize((git_idxmap_icase *) index->entries_map,
|
|
2619
|
+
header.entry_count)) < 0)
|
|
2620
|
+
return error;
|
|
2621
|
+
else if ((error = git_idxmap_resize(index->entries_map, header.entry_count)) < 0)
|
|
2622
|
+
return error;
|
|
2568
2623
|
|
|
2569
2624
|
/* Parse all the entries */
|
|
2570
2625
|
for (i = 0; i < header.entry_count && buffer_size > INDEX_FOOTER_SIZE; ++i) {
|
|
@@ -2581,7 +2636,7 @@ static int parse_index(git_index *index, const char *buffer, size_t buffer_size)
|
|
|
2581
2636
|
goto done;
|
|
2582
2637
|
}
|
|
2583
2638
|
|
|
2584
|
-
INSERT_IN_MAP(index, entry,
|
|
2639
|
+
INSERT_IN_MAP(index, entry, error);
|
|
2585
2640
|
|
|
2586
2641
|
if (error < 0) {
|
|
2587
2642
|
index_entry_free(entry);
|
|
@@ -2604,11 +2659,7 @@ static int parse_index(git_index *index, const char *buffer, size_t buffer_size)
|
|
|
2604
2659
|
while (buffer_size > INDEX_FOOTER_SIZE) {
|
|
2605
2660
|
size_t extension_size;
|
|
2606
2661
|
|
|
2607
|
-
|
|
2608
|
-
|
|
2609
|
-
/* see if we have read any bytes from the extension */
|
|
2610
|
-
if (extension_size == 0) {
|
|
2611
|
-
error = index_error_invalid("extension is truncated");
|
|
2662
|
+
if ((error = read_extension(&extension_size, index, buffer, buffer_size)) < 0) {
|
|
2612
2663
|
goto done;
|
|
2613
2664
|
}
|
|
2614
2665
|
|
|
@@ -2653,10 +2704,10 @@ static bool is_index_extended(git_index *index)
|
|
|
2653
2704
|
extended = 0;
|
|
2654
2705
|
|
|
2655
2706
|
git_vector_foreach(&index->entries, i, entry) {
|
|
2656
|
-
entry->flags &= ~
|
|
2657
|
-
if (entry->flags_extended &
|
|
2707
|
+
entry->flags &= ~GIT_INDEX_ENTRY_EXTENDED;
|
|
2708
|
+
if (entry->flags_extended & GIT_INDEX_ENTRY_EXTENDED_FLAGS) {
|
|
2658
2709
|
extended++;
|
|
2659
|
-
entry->flags |=
|
|
2710
|
+
entry->flags |= GIT_INDEX_ENTRY_EXTENDED;
|
|
2660
2711
|
}
|
|
2661
2712
|
}
|
|
2662
2713
|
|
|
@@ -2721,11 +2772,11 @@ static int write_disk_entry(git_filebuf *file, git_index_entry *entry, const cha
|
|
|
2721
2772
|
|
|
2722
2773
|
ondisk.flags = htons(entry->flags);
|
|
2723
2774
|
|
|
2724
|
-
if (entry->flags &
|
|
2775
|
+
if (entry->flags & GIT_INDEX_ENTRY_EXTENDED) {
|
|
2725
2776
|
struct entry_long ondisk_ext;
|
|
2726
2777
|
memcpy(&ondisk_ext, &ondisk, sizeof(struct entry_short));
|
|
2727
2778
|
ondisk_ext.flags_extended = htons(entry->flags_extended &
|
|
2728
|
-
|
|
2779
|
+
GIT_INDEX_ENTRY_EXTENDED_FLAGS);
|
|
2729
2780
|
memcpy(mem, &ondisk_ext, offsetof(struct entry_long, path));
|
|
2730
2781
|
path = ((struct entry_long*)mem)->path;
|
|
2731
2782
|
disk_size -= offsetof(struct entry_long, path);
|
|
@@ -2939,7 +2990,7 @@ static void clear_uptodate(git_index *index)
|
|
|
2939
2990
|
size_t i;
|
|
2940
2991
|
|
|
2941
2992
|
git_vector_foreach(&index->entries, i, entry)
|
|
2942
|
-
entry->flags_extended &= ~
|
|
2993
|
+
entry->flags_extended &= ~GIT_INDEX_ENTRY_UPTODATE;
|
|
2943
2994
|
}
|
|
2944
2995
|
|
|
2945
2996
|
static int write_index(git_oid *checksum, git_index *index, git_filebuf *file)
|
|
@@ -2996,12 +3047,12 @@ static int write_index(git_oid *checksum, git_index *index, git_filebuf *file)
|
|
|
2996
3047
|
|
|
2997
3048
|
int git_index_entry_stage(const git_index_entry *entry)
|
|
2998
3049
|
{
|
|
2999
|
-
return
|
|
3050
|
+
return GIT_INDEX_ENTRY_STAGE(entry);
|
|
3000
3051
|
}
|
|
3001
3052
|
|
|
3002
3053
|
int git_index_entry_is_conflict(const git_index_entry *entry)
|
|
3003
3054
|
{
|
|
3004
|
-
return (
|
|
3055
|
+
return (GIT_INDEX_ENTRY_STAGE(entry) > 0);
|
|
3005
3056
|
}
|
|
3006
3057
|
|
|
3007
3058
|
typedef struct read_tree_data {
|
|
@@ -3064,7 +3115,7 @@ int git_index_read_tree(git_index *index, const git_tree *tree)
|
|
|
3064
3115
|
size_t i;
|
|
3065
3116
|
git_index_entry *e;
|
|
3066
3117
|
|
|
3067
|
-
if (
|
|
3118
|
+
if (git_idxmap_new(&entries_map) < 0)
|
|
3068
3119
|
return -1;
|
|
3069
3120
|
|
|
3070
3121
|
git_vector_set_cmp(&entries, index->entries._cmp); /* match sort */
|
|
@@ -3082,16 +3133,18 @@ int git_index_read_tree(git_index *index, const git_tree *tree)
|
|
|
3082
3133
|
if ((error = git_tree_walk(tree, GIT_TREEWALK_POST, read_tree_cb, &data)) < 0)
|
|
3083
3134
|
goto cleanup;
|
|
3084
3135
|
|
|
3085
|
-
if (index->ignore_case
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
|
|
3136
|
+
if (index->ignore_case &&
|
|
3137
|
+
(error = git_idxmap_icase_resize((git_idxmap_icase *) entries_map,
|
|
3138
|
+
entries.length)) < 0)
|
|
3139
|
+
goto cleanup;
|
|
3140
|
+
else if ((error = git_idxmap_resize(entries_map, entries.length)) < 0)
|
|
3141
|
+
goto cleanup;
|
|
3089
3142
|
|
|
3090
3143
|
git_vector_foreach(&entries, i, e) {
|
|
3091
|
-
INSERT_IN_MAP_EX(index, entries_map, e,
|
|
3144
|
+
INSERT_IN_MAP_EX(index, entries_map, e, error);
|
|
3092
3145
|
|
|
3093
3146
|
if (error < 0) {
|
|
3094
|
-
|
|
3147
|
+
git_error_set(GIT_ERROR_INDEX, "failed to insert entry into map");
|
|
3095
3148
|
return error;
|
|
3096
3149
|
}
|
|
3097
3150
|
}
|
|
@@ -3138,14 +3191,17 @@ static int git_index_read_iterator(
|
|
|
3138
3191
|
assert((new_iterator->flags & GIT_ITERATOR_DONT_IGNORE_CASE));
|
|
3139
3192
|
|
|
3140
3193
|
if ((error = git_vector_init(&new_entries, new_length_hint, index->entries._cmp)) < 0 ||
|
|
3141
|
-
|
|
3142
|
-
|
|
3194
|
+
(error = git_vector_init(&remove_entries, index->entries.length, NULL)) < 0 ||
|
|
3195
|
+
(error = git_idxmap_new(&new_entries_map)) < 0)
|
|
3143
3196
|
goto done;
|
|
3144
3197
|
|
|
3145
|
-
if (index->ignore_case && new_length_hint
|
|
3146
|
-
|
|
3147
|
-
|
|
3148
|
-
|
|
3198
|
+
if (index->ignore_case && new_length_hint &&
|
|
3199
|
+
(error = git_idxmap_icase_resize((git_idxmap_icase *) new_entries_map,
|
|
3200
|
+
new_length_hint)) < 0)
|
|
3201
|
+
goto done;
|
|
3202
|
+
else if (new_length_hint &&
|
|
3203
|
+
(error = git_idxmap_resize(new_entries_map, new_length_hint)) < 0)
|
|
3204
|
+
goto done;
|
|
3149
3205
|
|
|
3150
3206
|
opts.flags = GIT_ITERATOR_DONT_IGNORE_CASE |
|
|
3151
3207
|
GIT_ITERATOR_INCLUDE_CONFLICTS;
|
|
@@ -3209,14 +3265,14 @@ static int git_index_read_iterator(
|
|
|
3209
3265
|
|
|
3210
3266
|
if (add_entry) {
|
|
3211
3267
|
if ((error = git_vector_insert(&new_entries, add_entry)) == 0)
|
|
3212
|
-
INSERT_IN_MAP_EX(index, new_entries_map, add_entry,
|
|
3268
|
+
INSERT_IN_MAP_EX(index, new_entries_map, add_entry, error);
|
|
3213
3269
|
}
|
|
3214
3270
|
|
|
3215
3271
|
if (remove_entry && error >= 0)
|
|
3216
3272
|
error = git_vector_insert(&remove_entries, remove_entry);
|
|
3217
3273
|
|
|
3218
3274
|
if (error < 0) {
|
|
3219
|
-
|
|
3275
|
+
git_error_set(GIT_ERROR_INDEX, "failed to insert entry");
|
|
3220
3276
|
goto done;
|
|
3221
3277
|
}
|
|
3222
3278
|
|
|
@@ -3325,7 +3381,7 @@ int git_index_add_all(
|
|
|
3325
3381
|
error = index_apply_to_wd_diff(index, INDEX_ACTION_ADDALL, paths, flags, cb, payload);
|
|
3326
3382
|
|
|
3327
3383
|
if (error)
|
|
3328
|
-
|
|
3384
|
+
git_error_set_after_callback(error);
|
|
3329
3385
|
|
|
3330
3386
|
cleanup:
|
|
3331
3387
|
git_iterator_free(wditer);
|
|
@@ -3427,7 +3483,7 @@ static int index_apply_to_wd_diff(git_index *index, int action, const git_strarr
|
|
|
3427
3483
|
git_diff_free(diff);
|
|
3428
3484
|
|
|
3429
3485
|
if (error) /* make sure error is set if callback stopped iteration */
|
|
3430
|
-
|
|
3486
|
+
git_error_set_after_callback(error);
|
|
3431
3487
|
|
|
3432
3488
|
cleanup:
|
|
3433
3489
|
git_pathspec__clear(&ps);
|
|
@@ -3484,7 +3540,7 @@ static int index_apply_to_all(
|
|
|
3484
3540
|
error = git_index_add_bypath(index, path.ptr);
|
|
3485
3541
|
|
|
3486
3542
|
if (error == GIT_ENOTFOUND) {
|
|
3487
|
-
|
|
3543
|
+
git_error_clear();
|
|
3488
3544
|
|
|
3489
3545
|
error = git_index_remove_bypath(index, path.ptr);
|
|
3490
3546
|
|
|
@@ -3497,7 +3553,7 @@ static int index_apply_to_all(
|
|
|
3497
3553
|
i--; /* back up foreach if we removed this */
|
|
3498
3554
|
break;
|
|
3499
3555
|
default:
|
|
3500
|
-
|
|
3556
|
+
git_error_set(GIT_ERROR_INVALID, "unknown index action %d", action);
|
|
3501
3557
|
error = -1;
|
|
3502
3558
|
break;
|
|
3503
3559
|
}
|
|
@@ -3519,7 +3575,7 @@ int git_index_remove_all(
|
|
|
3519
3575
|
index, INDEX_ACTION_REMOVE, pathspec, cb, payload);
|
|
3520
3576
|
|
|
3521
3577
|
if (error) /* make sure error is set if callback stopped iteration */
|
|
3522
|
-
|
|
3578
|
+
git_error_set_after_callback(error);
|
|
3523
3579
|
|
|
3524
3580
|
return error;
|
|
3525
3581
|
}
|
|
@@ -3532,7 +3588,7 @@ int git_index_update_all(
|
|
|
3532
3588
|
{
|
|
3533
3589
|
int error = index_apply_to_wd_diff(index, INDEX_ACTION_UPDATE, pathspec, 0, cb, payload);
|
|
3534
3590
|
if (error) /* make sure error is set if callback stopped iteration */
|
|
3535
|
-
|
|
3591
|
+
git_error_set_after_callback(error);
|
|
3536
3592
|
|
|
3537
3593
|
return error;
|
|
3538
3594
|
}
|
|
@@ -3549,7 +3605,7 @@ int git_index_snapshot_new(git_vector *snap, git_index *index)
|
|
|
3549
3605
|
error = git_vector_dup(snap, &index->entries, index->entries._cmp);
|
|
3550
3606
|
|
|
3551
3607
|
if (error < 0)
|
|
3552
|
-
|
|
3608
|
+
git_index_snapshot_release(snap, index);
|
|
3553
3609
|
|
|
3554
3610
|
return error;
|
|
3555
3611
|
}
|
|
@@ -3588,7 +3644,7 @@ int git_indexwriter_init(
|
|
|
3588
3644
|
&writer->file, index->index_file_path, GIT_FILEBUF_HASH_CONTENTS, GIT_INDEX_FILE_MODE)) < 0) {
|
|
3589
3645
|
|
|
3590
3646
|
if (error == GIT_ELOCKED)
|
|
3591
|
-
|
|
3647
|
+
git_error_set(GIT_ERROR_INDEX, "the index is locked; this might be due to a concurrent or crashed process");
|
|
3592
3648
|
|
|
3593
3649
|
return error;
|
|
3594
3650
|
}
|
|
@@ -3637,7 +3693,7 @@ int git_indexwriter_commit(git_indexwriter *writer)
|
|
|
3637
3693
|
|
|
3638
3694
|
if ((error = git_futils_filestamp_check(
|
|
3639
3695
|
&writer->index->stamp, writer->index->index_file_path)) < 0) {
|
|
3640
|
-
|
|
3696
|
+
git_error_set(GIT_ERROR_OS, "could not read index timestamp");
|
|
3641
3697
|
return -1;
|
|
3642
3698
|
}
|
|
3643
3699
|
|
|
@@ -3658,3 +3714,12 @@ void git_indexwriter_cleanup(git_indexwriter *writer)
|
|
|
3658
3714
|
git_index_free(writer->index);
|
|
3659
3715
|
writer->index = NULL;
|
|
3660
3716
|
}
|
|
3717
|
+
|
|
3718
|
+
/* Deprecated functions */
|
|
3719
|
+
|
|
3720
|
+
int git_index_add_frombuffer(
|
|
3721
|
+
git_index *index, const git_index_entry *source_entry,
|
|
3722
|
+
const void *buffer, size_t len)
|
|
3723
|
+
{
|
|
3724
|
+
return git_index_add_from_buffer(index, source_entry, buffer, len);
|
|
3725
|
+
}
|