rugged 1.0.1 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +1 -0
- data/README.md +1 -1
- data/ext/rugged/rugged.c +7 -4
- data/ext/rugged/rugged_commit.c +1 -1
- data/ext/rugged/rugged_object.c +1 -1
- data/ext/rugged/rugged_repo.c +3 -3
- data/lib/rugged/commit.rb +16 -2
- data/lib/rugged/repository.rb +2 -2
- data/lib/rugged/version.rb +1 -1
- data/vendor/libgit2/CMakeLists.txt +41 -74
- data/vendor/libgit2/COPYING +109 -1
- data/vendor/libgit2/cmake/{Modules/AddCFlagIfSupported.cmake → AddCFlagIfSupported.cmake} +0 -0
- data/vendor/libgit2/cmake/{Modules/EnableWarnings.cmake → EnableWarnings.cmake} +0 -0
- data/vendor/libgit2/cmake/{Modules/FindCoreFoundation.cmake → FindCoreFoundation.cmake} +0 -0
- data/vendor/libgit2/cmake/{Modules/FindGSSAPI.cmake → FindGSSAPI.cmake} +0 -0
- data/vendor/libgit2/cmake/{Modules/FindGSSFramework.cmake → FindGSSFramework.cmake} +0 -0
- data/vendor/libgit2/cmake/{Modules/FindHTTP_Parser.cmake → FindHTTP_Parser.cmake} +0 -0
- data/vendor/libgit2/cmake/{Modules/FindIconv.cmake → FindIconv.cmake} +0 -0
- data/vendor/libgit2/cmake/FindLibSSH2.cmake +13 -0
- data/vendor/libgit2/cmake/{Modules/FindPCRE.cmake → FindPCRE.cmake} +0 -0
- data/vendor/libgit2/cmake/{Modules/FindPCRE2.cmake → FindPCRE2.cmake} +0 -0
- data/vendor/libgit2/cmake/{Modules/FindPkgLibraries.cmake → FindPkgLibraries.cmake} +0 -0
- data/vendor/libgit2/cmake/{Modules/FindSecurity.cmake → FindSecurity.cmake} +0 -0
- data/vendor/libgit2/cmake/{Modules/FindStatNsec.cmake → FindStatNsec.cmake} +0 -0
- data/vendor/libgit2/cmake/Findfutimens.cmake +14 -0
- data/vendor/libgit2/cmake/{Modules/FindmbedTLS.cmake → FindmbedTLS.cmake} +0 -0
- data/vendor/libgit2/cmake/{Modules/IdeSplitSources.cmake → IdeSplitSources.cmake} +0 -0
- data/vendor/libgit2/cmake/{Modules/PkgBuildConfig.cmake → PkgBuildConfig.cmake} +0 -0
- data/vendor/libgit2/cmake/{Modules/SanitizeBool.cmake → SanitizeBool.cmake} +0 -0
- data/vendor/libgit2/cmake/{Modules/SelectGSSAPI.cmake → SelectGSSAPI.cmake} +18 -26
- data/vendor/libgit2/cmake/{Modules/SelectHTTPSBackend.cmake → SelectHTTPSBackend.cmake} +29 -32
- data/vendor/libgit2/cmake/{Modules/SelectHashes.cmake → SelectHashes.cmake} +21 -28
- data/vendor/libgit2/deps/chromium-zlib/CMakeLists.txt +101 -0
- data/vendor/libgit2/deps/http-parser/CMakeLists.txt +4 -3
- data/vendor/libgit2/deps/ntlmclient/CMakeLists.txt +24 -10
- data/vendor/libgit2/deps/ntlmclient/compat.h +0 -27
- data/vendor/libgit2/deps/ntlmclient/crypt.h +14 -9
- data/vendor/libgit2/deps/ntlmclient/crypt_commoncrypto.c +20 -20
- data/vendor/libgit2/deps/ntlmclient/crypt_commoncrypto.h +3 -3
- data/vendor/libgit2/deps/ntlmclient/crypt_mbedtls.c +37 -36
- data/vendor/libgit2/deps/ntlmclient/crypt_mbedtls.h +4 -3
- data/vendor/libgit2/deps/ntlmclient/crypt_openssl.c +178 -51
- data/vendor/libgit2/deps/ntlmclient/crypt_openssl.h +74 -5
- data/vendor/libgit2/deps/ntlmclient/ntlm.c +164 -135
- data/vendor/libgit2/deps/ntlmclient/ntlm.h +13 -9
- data/vendor/libgit2/deps/ntlmclient/ntlmclient.h +16 -3
- data/vendor/libgit2/deps/ntlmclient/unicode.h +10 -4
- data/vendor/libgit2/deps/ntlmclient/unicode_builtin.c +16 -27
- data/vendor/libgit2/deps/ntlmclient/unicode_builtin.h +20 -0
- data/vendor/libgit2/deps/ntlmclient/unicode_iconv.c +28 -52
- data/vendor/libgit2/deps/ntlmclient/unicode_iconv.h +22 -0
- data/vendor/libgit2/deps/ntlmclient/util.c +15 -1
- data/vendor/libgit2/deps/ntlmclient/util.h +2 -1
- data/vendor/libgit2/deps/pcre/LICENCE +93 -0
- data/vendor/libgit2/deps/pcre/pcre.h +2 -2
- data/vendor/libgit2/deps/pcre/pcre_compile.c +29 -17
- data/vendor/libgit2/deps/pcre/pcre_jit_compile.c +4 -4
- data/vendor/libgit2/deps/pcre/pcreposix.c +2 -3
- data/vendor/libgit2/deps/zlib/CMakeLists.txt +6 -5
- data/vendor/libgit2/deps/zlib/deflate.c +1 -0
- data/vendor/libgit2/include/git2/annotated_commit.h +1 -1
- data/vendor/libgit2/include/git2/apply.h +2 -0
- data/vendor/libgit2/include/git2/attr.h +95 -0
- data/vendor/libgit2/include/git2/blame.h +95 -42
- data/vendor/libgit2/include/git2/blob.h +37 -3
- data/vendor/libgit2/include/git2/branch.h +25 -0
- data/vendor/libgit2/include/git2/cert.h +42 -5
- data/vendor/libgit2/include/git2/checkout.h +28 -12
- data/vendor/libgit2/include/git2/clone.h +1 -1
- data/vendor/libgit2/include/git2/commit.h +35 -19
- data/vendor/libgit2/include/git2/common.h +51 -6
- data/vendor/libgit2/include/git2/config.h +1 -1
- data/vendor/libgit2/include/git2/deprecated.h +368 -8
- data/vendor/libgit2/include/git2/diff.h +34 -113
- data/vendor/libgit2/include/git2/email.h +127 -0
- data/vendor/libgit2/include/git2/errors.h +8 -7
- data/vendor/libgit2/include/git2/filter.h +63 -17
- data/vendor/libgit2/include/git2/graph.h +20 -2
- data/vendor/libgit2/include/git2/index.h +4 -5
- data/vendor/libgit2/include/git2/indexer.h +2 -1
- data/vendor/libgit2/include/git2/notes.h +2 -2
- data/vendor/libgit2/include/git2/odb.h +44 -20
- data/vendor/libgit2/include/git2/oidarray.h +5 -8
- data/vendor/libgit2/include/git2/pack.h +1 -1
- data/vendor/libgit2/include/git2/patch.h +8 -0
- data/vendor/libgit2/include/git2/rebase.h +25 -1
- data/vendor/libgit2/include/git2/refs.h +9 -5
- data/vendor/libgit2/include/git2/remote.h +62 -9
- data/vendor/libgit2/include/git2/repository.h +107 -62
- data/vendor/libgit2/include/git2/revparse.h +5 -5
- data/vendor/libgit2/include/git2/stash.h +1 -1
- data/vendor/libgit2/include/git2/status.h +115 -59
- data/vendor/libgit2/include/git2/stdint.h +3 -3
- data/vendor/libgit2/include/git2/strarray.h +6 -10
- data/vendor/libgit2/include/git2/submodule.h +9 -0
- data/vendor/libgit2/include/git2/sys/commit_graph.h +174 -0
- data/vendor/libgit2/include/git2/sys/email.h +45 -0
- data/vendor/libgit2/include/git2/sys/filter.h +49 -28
- data/vendor/libgit2/include/git2/sys/midx.h +74 -0
- data/vendor/libgit2/include/git2/sys/odb_backend.h +7 -0
- data/vendor/libgit2/include/git2/sys/transport.h +1 -0
- data/vendor/libgit2/include/git2/tag.h +12 -0
- data/vendor/libgit2/include/git2/transport.h +1 -1
- data/vendor/libgit2/include/git2/tree.h +2 -14
- data/vendor/libgit2/include/git2/types.h +9 -0
- data/vendor/libgit2/include/git2/version.h +4 -4
- data/vendor/libgit2/include/git2/worktree.h +1 -0
- data/vendor/libgit2/include/git2.h +1 -0
- data/vendor/libgit2/src/CMakeLists.txt +84 -44
- data/vendor/libgit2/src/alloc.c +21 -8
- data/vendor/libgit2/src/allocators/failalloc.c +92 -0
- data/vendor/libgit2/src/allocators/failalloc.h +23 -0
- data/vendor/libgit2/src/allocators/stdalloc.c +41 -10
- data/vendor/libgit2/src/allocators/win32_leakcheck.c +118 -0
- data/vendor/libgit2/src/allocators/{win32_crtdbg.h → win32_leakcheck.h} +3 -3
- data/vendor/libgit2/src/annotated_commit.c +21 -9
- data/vendor/libgit2/src/apply.c +21 -8
- data/vendor/libgit2/src/array.h +11 -11
- data/vendor/libgit2/src/assert_safe.h +58 -0
- data/vendor/libgit2/src/attr.c +192 -70
- data/vendor/libgit2/src/attr_file.c +99 -41
- data/vendor/libgit2/src/attr_file.h +32 -11
- data/vendor/libgit2/src/attrcache.c +44 -40
- data/vendor/libgit2/src/attrcache.h +4 -5
- data/vendor/libgit2/src/blame.c +32 -19
- data/vendor/libgit2/src/blame_git.c +7 -4
- data/vendor/libgit2/src/blob.c +60 -32
- data/vendor/libgit2/src/branch.c +87 -37
- data/vendor/libgit2/src/buffer.c +349 -29
- data/vendor/libgit2/src/buffer.h +154 -2
- data/vendor/libgit2/src/cache.c +3 -24
- data/vendor/libgit2/src/cache.h +7 -7
- data/vendor/libgit2/src/cc-compat.h +10 -8
- data/vendor/libgit2/src/checkout.c +103 -105
- data/vendor/libgit2/src/cherrypick.c +8 -2
- data/vendor/libgit2/src/clone.c +105 -30
- data/vendor/libgit2/src/commit.c +41 -28
- data/vendor/libgit2/src/commit_graph.c +1209 -0
- data/vendor/libgit2/src/commit_graph.h +162 -0
- data/vendor/libgit2/src/commit_list.c +46 -0
- data/vendor/libgit2/src/commit_list.h +2 -0
- data/vendor/libgit2/src/common.h +26 -2
- data/vendor/libgit2/src/config.c +41 -23
- data/vendor/libgit2/src/config_cache.c +9 -4
- data/vendor/libgit2/src/config_entries.c +35 -27
- data/vendor/libgit2/src/config_file.c +17 -9
- data/vendor/libgit2/src/config_parse.c +6 -8
- data/vendor/libgit2/src/config_snapshot.c +2 -1
- data/vendor/libgit2/src/crlf.c +16 -6
- data/vendor/libgit2/src/date.c +4 -3
- data/vendor/libgit2/src/delta.c +1 -1
- data/vendor/libgit2/src/describe.c +12 -5
- data/vendor/libgit2/src/diff.c +55 -183
- data/vendor/libgit2/src/diff_driver.c +21 -17
- data/vendor/libgit2/src/diff_file.c +5 -7
- data/vendor/libgit2/src/diff_generate.c +56 -28
- data/vendor/libgit2/src/diff_parse.c +2 -3
- data/vendor/libgit2/src/diff_print.c +81 -65
- data/vendor/libgit2/src/diff_stats.c +19 -16
- data/vendor/libgit2/src/diff_tform.c +13 -13
- data/vendor/libgit2/src/diff_xdiff.c +4 -2
- data/vendor/libgit2/src/diff_xdiff.h +1 -1
- data/vendor/libgit2/src/email.c +299 -0
- data/vendor/libgit2/src/email.h +25 -0
- data/vendor/libgit2/src/errors.c +26 -19
- data/vendor/libgit2/src/features.h.in +5 -1
- data/vendor/libgit2/src/fetch.c +7 -2
- data/vendor/libgit2/src/fetchhead.c +8 -4
- data/vendor/libgit2/src/filebuf.c +9 -7
- data/vendor/libgit2/src/filter.c +215 -113
- data/vendor/libgit2/src/filter.h +24 -5
- data/vendor/libgit2/src/futils.c +8 -8
- data/vendor/libgit2/src/futils.h +4 -4
- data/vendor/libgit2/src/graph.c +64 -9
- data/vendor/libgit2/src/hash/sha1/collisiondetect.c +3 -3
- data/vendor/libgit2/src/hash/sha1/common_crypto.c +3 -3
- data/vendor/libgit2/src/hash/sha1/generic.h +1 -1
- data/vendor/libgit2/src/hash/sha1/mbedtls.c +12 -12
- data/vendor/libgit2/src/hash/sha1/openssl.c +3 -3
- data/vendor/libgit2/src/hash/sha1/sha1dc/sha1.c +8 -10
- data/vendor/libgit2/src/hash/sha1/win32.c +15 -11
- data/vendor/libgit2/src/hash.c +16 -13
- data/vendor/libgit2/src/hash.h +1 -1
- data/vendor/libgit2/src/hashsig.c +23 -10
- data/vendor/libgit2/src/ident.c +13 -3
- data/vendor/libgit2/src/idxmap.c +0 -22
- data/vendor/libgit2/src/ignore.c +33 -17
- data/vendor/libgit2/src/index.c +124 -82
- data/vendor/libgit2/src/index.h +1 -1
- data/vendor/libgit2/src/indexer.c +95 -37
- data/vendor/libgit2/src/integer.h +79 -2
- data/vendor/libgit2/src/iterator.c +40 -28
- data/vendor/libgit2/src/iterator.h +1 -1
- data/vendor/libgit2/src/khash.h +2 -11
- data/vendor/libgit2/src/{settings.c → libgit2.c} +148 -49
- data/vendor/libgit2/src/libgit2.h +15 -0
- data/vendor/libgit2/src/mailmap.c +23 -10
- data/vendor/libgit2/src/map.h +3 -3
- data/vendor/libgit2/src/merge.c +95 -43
- data/vendor/libgit2/src/merge.h +2 -1
- data/vendor/libgit2/src/merge_driver.c +19 -13
- data/vendor/libgit2/src/merge_file.c +15 -9
- data/vendor/libgit2/src/message.c +3 -1
- data/vendor/libgit2/src/midx.c +879 -0
- data/vendor/libgit2/src/midx.h +110 -0
- data/vendor/libgit2/src/mwindow.c +214 -95
- data/vendor/libgit2/src/mwindow.h +3 -3
- data/vendor/libgit2/src/net.c +133 -4
- data/vendor/libgit2/src/net.h +16 -2
- data/vendor/libgit2/src/netops.c +6 -4
- data/vendor/libgit2/src/netops.h +2 -2
- data/vendor/libgit2/src/notes.c +40 -40
- data/vendor/libgit2/src/object.c +24 -15
- data/vendor/libgit2/src/odb.c +298 -57
- data/vendor/libgit2/src/odb.h +16 -2
- data/vendor/libgit2/src/odb_loose.c +31 -21
- data/vendor/libgit2/src/odb_mempack.c +3 -1
- data/vendor/libgit2/src/odb_pack.c +391 -114
- data/vendor/libgit2/src/oid.c +7 -4
- data/vendor/libgit2/src/oidarray.c +10 -1
- data/vendor/libgit2/src/pack-objects.c +83 -69
- data/vendor/libgit2/src/pack.c +383 -150
- data/vendor/libgit2/src/pack.h +44 -9
- data/vendor/libgit2/src/patch.c +14 -7
- data/vendor/libgit2/src/patch_generate.c +3 -5
- data/vendor/libgit2/src/patch_parse.c +6 -3
- data/vendor/libgit2/src/path.c +103 -58
- data/vendor/libgit2/src/path.h +80 -7
- data/vendor/libgit2/src/pathspec.c +12 -11
- data/vendor/libgit2/src/pool.c +34 -22
- data/vendor/libgit2/src/pool.h +9 -1
- data/vendor/libgit2/src/posix.c +43 -12
- data/vendor/libgit2/src/posix.h +9 -0
- data/vendor/libgit2/src/proxy.c +2 -0
- data/vendor/libgit2/src/push.c +2 -0
- data/vendor/libgit2/src/reader.c +10 -6
- data/vendor/libgit2/src/rebase.c +95 -49
- data/vendor/libgit2/src/refdb.c +165 -13
- data/vendor/libgit2/src/refdb.h +69 -0
- data/vendor/libgit2/src/refdb_fs.c +145 -153
- data/vendor/libgit2/src/reflog.c +21 -20
- data/vendor/libgit2/src/refs.c +153 -233
- data/vendor/libgit2/src/refs.h +2 -20
- data/vendor/libgit2/src/refspec.c +81 -45
- data/vendor/libgit2/src/regexp.c +2 -2
- data/vendor/libgit2/src/remote.c +320 -122
- data/vendor/libgit2/src/remote.h +2 -1
- data/vendor/libgit2/src/repository.c +476 -203
- data/vendor/libgit2/src/repository.h +27 -29
- data/vendor/libgit2/src/reset.c +8 -7
- data/vendor/libgit2/src/revert.c +8 -2
- data/vendor/libgit2/src/revparse.c +23 -17
- data/vendor/libgit2/src/revwalk.c +35 -20
- data/vendor/libgit2/src/runtime.c +162 -0
- data/vendor/libgit2/src/runtime.h +62 -0
- data/vendor/libgit2/src/{refdb_fs.h → settings.h} +3 -11
- data/vendor/libgit2/src/signature.c +6 -5
- data/vendor/libgit2/src/sortedcache.c +2 -3
- data/vendor/libgit2/src/sortedcache.h +10 -8
- data/vendor/libgit2/src/stash.c +6 -2
- data/vendor/libgit2/src/status.c +9 -4
- data/vendor/libgit2/src/strarray.c +64 -0
- data/vendor/libgit2/src/streams/mbedtls.c +14 -17
- data/vendor/libgit2/src/streams/mbedtls.h +1 -1
- data/vendor/libgit2/src/streams/openssl.c +113 -207
- data/vendor/libgit2/src/streams/openssl.h +9 -1
- data/vendor/libgit2/src/streams/openssl_dynamic.c +309 -0
- data/vendor/libgit2/src/streams/openssl_dynamic.h +348 -0
- data/vendor/libgit2/src/streams/openssl_legacy.c +203 -0
- data/vendor/libgit2/src/streams/openssl_legacy.h +63 -0
- data/vendor/libgit2/src/streams/registry.c +10 -9
- data/vendor/libgit2/src/streams/socket.c +6 -2
- data/vendor/libgit2/src/streams/stransport.c +6 -3
- data/vendor/libgit2/src/streams/tls.c +5 -3
- data/vendor/libgit2/src/submodule.c +134 -66
- data/vendor/libgit2/src/submodule.h +9 -9
- data/vendor/libgit2/src/sysdir.c +8 -26
- data/vendor/libgit2/src/sysdir.h +0 -11
- data/vendor/libgit2/src/tag.c +49 -11
- data/vendor/libgit2/src/thread.c +140 -0
- data/vendor/libgit2/src/thread.h +479 -0
- data/vendor/libgit2/src/threadstate.c +84 -0
- data/vendor/libgit2/src/threadstate.h +24 -0
- data/vendor/libgit2/src/trace.c +2 -2
- data/vendor/libgit2/src/trace.h +17 -13
- data/vendor/libgit2/src/trailer.c +1 -1
- data/vendor/libgit2/src/transaction.c +21 -9
- data/vendor/libgit2/src/transport.c +3 -3
- data/vendor/libgit2/src/transports/auth.c +1 -1
- data/vendor/libgit2/src/transports/auth_negotiate.c +11 -4
- data/vendor/libgit2/src/transports/auth_ntlm.c +10 -6
- data/vendor/libgit2/src/transports/credential.c +17 -7
- data/vendor/libgit2/src/transports/credential_helpers.c +2 -0
- data/vendor/libgit2/src/transports/git.c +1 -3
- data/vendor/libgit2/src/transports/http.c +19 -17
- data/vendor/libgit2/src/transports/http.h +1 -0
- data/vendor/libgit2/src/transports/httpclient.c +68 -38
- data/vendor/libgit2/src/transports/httpclient.h +1 -1
- data/vendor/libgit2/src/transports/local.c +5 -5
- data/vendor/libgit2/src/transports/smart.c +14 -9
- data/vendor/libgit2/src/transports/smart.h +1 -1
- data/vendor/libgit2/src/transports/smart_protocol.c +11 -5
- data/vendor/libgit2/src/transports/ssh.c +55 -21
- data/vendor/libgit2/src/transports/winhttp.c +157 -89
- data/vendor/libgit2/src/tree.c +100 -77
- data/vendor/libgit2/src/tree.h +1 -0
- data/vendor/libgit2/src/tsort.c +0 -2
- data/vendor/libgit2/src/unix/map.c +3 -1
- data/vendor/libgit2/src/unix/posix.h +16 -1
- data/vendor/libgit2/src/unix/pthread.h +2 -1
- data/vendor/libgit2/src/utf8.c +150 -0
- data/vendor/libgit2/src/utf8.h +52 -0
- data/vendor/libgit2/src/util.c +75 -184
- data/vendor/libgit2/src/util.h +34 -40
- data/vendor/libgit2/src/vector.c +23 -19
- data/vendor/libgit2/src/vector.h +4 -2
- data/vendor/libgit2/src/win32/findfile.c +5 -3
- data/vendor/libgit2/src/win32/git2.rc +18 -3
- data/vendor/libgit2/src/win32/map.c +1 -1
- data/vendor/libgit2/src/win32/msvc-compat.h +9 -1
- data/vendor/libgit2/src/win32/path_w32.c +23 -25
- data/vendor/libgit2/src/win32/path_w32.h +0 -1
- data/vendor/libgit2/src/win32/posix.h +6 -6
- data/vendor/libgit2/src/win32/posix_w32.c +86 -7
- data/vendor/libgit2/src/win32/precompiled.h +0 -1
- data/vendor/libgit2/src/win32/reparse.h +4 -4
- data/vendor/libgit2/src/win32/thread.c +24 -15
- data/vendor/libgit2/src/win32/thread.h +1 -1
- data/vendor/libgit2/src/win32/w32_buffer.c +3 -3
- data/vendor/libgit2/src/win32/w32_common.h +18 -9
- data/vendor/libgit2/src/win32/{w32_crtdbg_stacktrace.c → w32_leakcheck.c} +269 -33
- data/vendor/libgit2/src/win32/w32_leakcheck.h +222 -0
- data/vendor/libgit2/src/win32/w32_util.h +6 -6
- data/vendor/libgit2/src/worktree.c +36 -14
- data/vendor/libgit2/src/zstream.c +1 -1
- metadata +65 -42
- data/vendor/libgit2/cmake/Modules/CheckPrototypeDefinition.c.in +0 -29
- data/vendor/libgit2/cmake/Modules/CheckPrototypeDefinition.cmake +0 -96
- data/vendor/libgit2/src/allocators/win32_crtdbg.c +0 -118
- data/vendor/libgit2/src/buf_text.c +0 -316
- data/vendor/libgit2/src/buf_text.h +0 -122
- data/vendor/libgit2/src/global.c +0 -361
- data/vendor/libgit2/src/global.h +0 -41
- data/vendor/libgit2/src/thread-utils.c +0 -58
- data/vendor/libgit2/src/thread-utils.h +0 -246
- data/vendor/libgit2/src/win32/w32_crtdbg_stacktrace.h +0 -127
- data/vendor/libgit2/src/win32/w32_stack.c +0 -188
- data/vendor/libgit2/src/win32/w32_stack.h +0 -140
data/vendor/libgit2/src/cache.c
CHANGED
@@ -9,7 +9,7 @@
|
|
9
9
|
|
10
10
|
#include "repository.h"
|
11
11
|
#include "commit.h"
|
12
|
-
#include "thread
|
12
|
+
#include "thread.h"
|
13
13
|
#include "util.h"
|
14
14
|
#include "odb.h"
|
15
15
|
#include "object.h"
|
@@ -41,27 +41,6 @@ int git_cache_set_max_object_size(git_object_t type, size_t size)
|
|
41
41
|
return 0;
|
42
42
|
}
|
43
43
|
|
44
|
-
void git_cache_dump_stats(git_cache *cache)
|
45
|
-
{
|
46
|
-
git_cached_obj *object;
|
47
|
-
|
48
|
-
if (git_cache_size(cache) == 0)
|
49
|
-
return;
|
50
|
-
|
51
|
-
printf("Cache %p: %"PRIuZ" items cached, %"PRIdZ" bytes\n",
|
52
|
-
cache, git_cache_size(cache), cache->used_memory);
|
53
|
-
|
54
|
-
git_oidmap_foreach_value(cache->map, object, {
|
55
|
-
char oid_str[9];
|
56
|
-
printf(" %s%c %s (%"PRIuZ")\n",
|
57
|
-
git_object_type2string(object->type),
|
58
|
-
object->flags == GIT_CACHE_STORE_PARSED ? '*' : ' ',
|
59
|
-
git_oid_tostr(oid_str, sizeof(oid_str), &object->oid),
|
60
|
-
object->size
|
61
|
-
);
|
62
|
-
});
|
63
|
-
}
|
64
|
-
|
65
44
|
int git_cache_init(git_cache *cache)
|
66
45
|
{
|
67
46
|
memset(cache, 0, sizeof(*cache));
|
@@ -189,7 +168,7 @@ static void *cache_store(git_cache *cache, git_cached_obj *entry)
|
|
189
168
|
return entry;
|
190
169
|
|
191
170
|
/* soften the load on the cache */
|
192
|
-
if (git_cache__current_storage
|
171
|
+
if (git_atomic_ssize_get(&git_cache__current_storage) > git_cache__max_storage)
|
193
172
|
cache_evict_entries(cache);
|
194
173
|
|
195
174
|
/* not found */
|
@@ -256,7 +235,7 @@ void git_cached_obj_decref(void *_obj)
|
|
256
235
|
{
|
257
236
|
git_cached_obj *obj = _obj;
|
258
237
|
|
259
|
-
if (
|
238
|
+
if (git_atomic32_dec(&obj->refcount) == 0) {
|
260
239
|
switch (obj->flags) {
|
261
240
|
case GIT_CACHE_STORE_RAW:
|
262
241
|
git_odb_object__free(_obj);
|
data/vendor/libgit2/src/cache.h
CHANGED
@@ -13,7 +13,7 @@
|
|
13
13
|
#include "git2/oid.h"
|
14
14
|
#include "git2/odb.h"
|
15
15
|
|
16
|
-
#include "thread
|
16
|
+
#include "thread.h"
|
17
17
|
#include "oidmap.h"
|
18
18
|
|
19
19
|
enum {
|
@@ -23,11 +23,11 @@ enum {
|
|
23
23
|
};
|
24
24
|
|
25
25
|
typedef struct {
|
26
|
-
git_oid
|
27
|
-
int16_t
|
28
|
-
uint16_t
|
29
|
-
size_t
|
30
|
-
|
26
|
+
git_oid oid;
|
27
|
+
int16_t type; /* git_object_t value */
|
28
|
+
uint16_t flags; /* GIT_CACHE_STORE value */
|
29
|
+
size_t size;
|
30
|
+
git_atomic32 refcount;
|
31
31
|
} git_cached_obj;
|
32
32
|
|
33
33
|
typedef struct {
|
@@ -61,7 +61,7 @@ GIT_INLINE(size_t) git_cache_size(git_cache *cache)
|
|
61
61
|
GIT_INLINE(void) git_cached_obj_incref(void *_obj)
|
62
62
|
{
|
63
63
|
git_cached_obj *obj = _obj;
|
64
|
-
|
64
|
+
git_atomic32_inc(&obj->refcount);
|
65
65
|
}
|
66
66
|
|
67
67
|
void git_cached_obj_decref(void *_obj);
|
@@ -29,12 +29,6 @@
|
|
29
29
|
# endif
|
30
30
|
#endif
|
31
31
|
|
32
|
-
#ifdef __GNUC__
|
33
|
-
# define GIT_TYPEOF(x) (__typeof__(x))
|
34
|
-
#else
|
35
|
-
# define GIT_TYPEOF(x)
|
36
|
-
#endif
|
37
|
-
|
38
32
|
#if defined(__GNUC__)
|
39
33
|
# define GIT_ALIGN(x,size) x __attribute__ ((aligned(size)))
|
40
34
|
#elif defined(_MSC_VER)
|
@@ -43,9 +37,17 @@
|
|
43
37
|
# define GIT_ALIGN(x,size) x
|
44
38
|
#endif
|
45
39
|
|
46
|
-
#
|
40
|
+
#if defined(__GNUC__)
|
41
|
+
# define GIT_UNUSED(x) \
|
42
|
+
do { \
|
43
|
+
__typeof__(x) _unused __attribute__((unused)); \
|
44
|
+
_unused = (x); \
|
45
|
+
} while (0)
|
46
|
+
#else
|
47
|
+
# define GIT_UNUSED(x) ((void)(x))
|
48
|
+
#endif
|
47
49
|
|
48
|
-
/* Define the printf format
|
50
|
+
/* Define the printf format specifier to use for size_t output */
|
49
51
|
#if defined(_MSC_VER) || defined(__MINGW32__)
|
50
52
|
|
51
53
|
/* Visual Studio 2012 and prior lack PRId64 entirely */
|
@@ -26,7 +26,6 @@
|
|
26
26
|
#include "diff.h"
|
27
27
|
#include "diff_generate.h"
|
28
28
|
#include "pathspec.h"
|
29
|
-
#include "buf_text.h"
|
30
29
|
#include "diff_xdiff.h"
|
31
30
|
#include "path.h"
|
32
31
|
#include "attr.h"
|
@@ -44,7 +43,6 @@ enum {
|
|
44
43
|
CHECKOUT_ACTION__REMOVE_CONFLICT = 16,
|
45
44
|
CHECKOUT_ACTION__UPDATE_CONFLICT = 32,
|
46
45
|
CHECKOUT_ACTION__MAX = 32,
|
47
|
-
CHECKOUT_ACTION__DEFER_REMOVE = 64,
|
48
46
|
CHECKOUT_ACTION__REMOVE_AND_UPDATE =
|
49
47
|
(CHECKOUT_ACTION__UPDATE_BLOB | CHECKOUT_ACTION__REMOVE),
|
50
48
|
};
|
@@ -196,7 +194,7 @@ static bool checkout_is_workdir_modified(
|
|
196
194
|
}
|
197
195
|
|
198
196
|
if (git_submodule_status(&sm_status, data->repo, wditem->path, GIT_SUBMODULE_IGNORE_UNSPECIFIED) < 0 ||
|
199
|
-
|
197
|
+
GIT_SUBMODULE_STATUS_IS_WD_DIRTY(sm_status))
|
200
198
|
rval = true;
|
201
199
|
else if ((sm_oid = git_submodule_wd_id(sm)) == NULL)
|
202
200
|
rval = false;
|
@@ -217,9 +215,10 @@ static bool checkout_is_workdir_modified(
|
|
217
215
|
ie = git_index_get_bypath(data->index, wditem->path, 0);
|
218
216
|
|
219
217
|
if (ie != NULL &&
|
220
|
-
|
221
|
-
|
222
|
-
|
218
|
+
!git_index_entry_newer_than_index(ie, data->index) &&
|
219
|
+
git_index_time_eq(&wditem->mtime, &ie->mtime) &&
|
220
|
+
wditem->file_size == ie->file_size &&
|
221
|
+
!is_filemode_changed(wditem->mode, ie->mode, data->respect_filemode)) {
|
223
222
|
|
224
223
|
/* The workdir is modified iff the index entry is modified */
|
225
224
|
return !is_workdir_base_or_new(&ie->id, baseitem, newitem) ||
|
@@ -273,9 +272,8 @@ static int checkout_action_common(
|
|
273
272
|
|
274
273
|
/* if the file is on disk and doesn't match our mode, force update */
|
275
274
|
if (wd &&
|
276
|
-
|
277
|
-
|
278
|
-
*action |= CHECKOUT_ACTION__REMOVE;
|
275
|
+
GIT_PERMS_IS_EXEC(wd->mode) != GIT_PERMS_IS_EXEC(delta->new_file.mode))
|
276
|
+
*action |= CHECKOUT_ACTION__REMOVE;
|
279
277
|
|
280
278
|
notify = GIT_CHECKOUT_NOTIFY_UPDATED;
|
281
279
|
}
|
@@ -330,6 +328,9 @@ static int checkout_target_fullpath(
|
|
330
328
|
if (path && git_buf_puts(&data->target_path, path) < 0)
|
331
329
|
return -1;
|
332
330
|
|
331
|
+
if (git_path_validate_workdir_buf(data->repo, &data->target_path) < 0)
|
332
|
+
return -1;
|
333
|
+
|
333
334
|
*out = &data->target_path;
|
334
335
|
|
335
336
|
return 0;
|
@@ -371,8 +372,13 @@ static int checkout_action_wd_only(
|
|
371
372
|
if (!git_pathspec__match(
|
372
373
|
pathspec, wd->path,
|
373
374
|
(data->strategy & GIT_CHECKOUT_DISABLE_PATHSPEC_MATCH) != 0,
|
374
|
-
git_iterator_ignore_case(workdir), NULL, NULL))
|
375
|
-
|
375
|
+
git_iterator_ignore_case(workdir), NULL, NULL)) {
|
376
|
+
|
377
|
+
if (wd->mode == GIT_FILEMODE_TREE)
|
378
|
+
return git_iterator_advance_into(wditem, workdir);
|
379
|
+
else
|
380
|
+
return git_iterator_advance(wditem, workdir);
|
381
|
+
}
|
376
382
|
|
377
383
|
/* check if item is tracked in the index but not in the checkout diff */
|
378
384
|
if (data->index != NULL) {
|
@@ -794,13 +800,13 @@ static int checkout_conflictdata_cmp(const void *a, const void *b)
|
|
794
800
|
int diff;
|
795
801
|
|
796
802
|
if ((diff = checkout_idxentry_cmp(ca->ancestor, cb->ancestor)) == 0 &&
|
797
|
-
|
803
|
+
(diff = checkout_idxentry_cmp(ca->ours, cb->theirs)) == 0)
|
798
804
|
diff = checkout_idxentry_cmp(ca->theirs, cb->theirs);
|
799
805
|
|
800
806
|
return diff;
|
801
807
|
}
|
802
808
|
|
803
|
-
int checkout_conflictdata_empty(
|
809
|
+
static int checkout_conflictdata_empty(
|
804
810
|
const git_vector *conflicts, size_t idx, void *payload)
|
805
811
|
{
|
806
812
|
checkout_conflictdata *conflict;
|
@@ -1173,7 +1179,7 @@ static int checkout_conflicts_mark_directoryfile(
|
|
1173
1179
|
/* Find d/f conflicts */
|
1174
1180
|
git_vector_foreach(&data->update_conflicts, i, conflict) {
|
1175
1181
|
if ((conflict->ours && conflict->theirs) ||
|
1176
|
-
|
1182
|
+
(!conflict->ours && !conflict->theirs))
|
1177
1183
|
continue;
|
1178
1184
|
|
1179
1185
|
path = conflict->ours ?
|
@@ -1222,8 +1228,8 @@ static int checkout_get_update_conflicts(
|
|
1222
1228
|
return 0;
|
1223
1229
|
|
1224
1230
|
if ((error = checkout_conflicts_load(data, workdir, pathspec)) < 0 ||
|
1225
|
-
|
1226
|
-
|
1231
|
+
(error = checkout_conflicts_coalesce_renames(data)) < 0 ||
|
1232
|
+
(error = checkout_conflicts_mark_directoryfile(data)) < 0)
|
1227
1233
|
goto done;
|
1228
1234
|
|
1229
1235
|
done:
|
@@ -1239,7 +1245,7 @@ static int checkout_conflict_append_remove(
|
|
1239
1245
|
checkout_data *data = payload;
|
1240
1246
|
const char *name;
|
1241
1247
|
|
1242
|
-
|
1248
|
+
GIT_ASSERT_ARG(ancestor || ours || theirs);
|
1243
1249
|
|
1244
1250
|
if (ancestor)
|
1245
1251
|
name = git__strdup(ancestor->path);
|
@@ -1274,14 +1280,14 @@ static int checkout_verify_paths(
|
|
1274
1280
|
unsigned int flags = GIT_PATH_REJECT_WORKDIR_DEFAULTS;
|
1275
1281
|
|
1276
1282
|
if (action & CHECKOUT_ACTION__REMOVE) {
|
1277
|
-
if (!
|
1283
|
+
if (!git_path_validate(repo, delta->old_file.path, delta->old_file.mode, flags)) {
|
1278
1284
|
git_error_set(GIT_ERROR_CHECKOUT, "cannot remove invalid path '%s'", delta->old_file.path);
|
1279
1285
|
return -1;
|
1280
1286
|
}
|
1281
1287
|
}
|
1282
1288
|
|
1283
1289
|
if (action & ~CHECKOUT_ACTION__REMOVE) {
|
1284
|
-
if (!
|
1290
|
+
if (!git_path_validate(repo, delta->new_file.path, delta->new_file.mode, flags)) {
|
1285
1291
|
git_error_set(GIT_ERROR_CHECKOUT, "cannot checkout to invalid path '%s'", delta->new_file.path);
|
1286
1292
|
return -1;
|
1287
1293
|
}
|
@@ -1304,14 +1310,15 @@ static int checkout_get_actions(
|
|
1304
1310
|
size_t i, *counts = NULL;
|
1305
1311
|
uint32_t *actions = NULL;
|
1306
1312
|
|
1307
|
-
git_pool_init(&pathpool, 1)
|
1313
|
+
if (git_pool_init(&pathpool, 1) < 0)
|
1314
|
+
return -1;
|
1308
1315
|
|
1309
1316
|
if (data->opts.paths.count > 0 &&
|
1310
|
-
|
1317
|
+
git_pathspec__vinit(&pathspec, &data->opts.paths, &pathpool) < 0)
|
1311
1318
|
return -1;
|
1312
1319
|
|
1313
1320
|
if ((error = git_iterator_current(&wditem, workdir)) < 0 &&
|
1314
|
-
|
1321
|
+
error != GIT_ITEROVER)
|
1315
1322
|
goto fail;
|
1316
1323
|
|
1317
1324
|
deltas = &data->diff->deltas;
|
@@ -1350,8 +1357,7 @@ static int checkout_get_actions(
|
|
1350
1357
|
counts[CHECKOUT_ACTION__REMOVE] += data->removes.length;
|
1351
1358
|
|
1352
1359
|
if (counts[CHECKOUT_ACTION__CONFLICT] > 0 &&
|
1353
|
-
|
1354
|
-
{
|
1360
|
+
(data->strategy & GIT_CHECKOUT_ALLOW_CONFLICTS) == 0) {
|
1355
1361
|
git_error_set(GIT_ERROR_CHECKOUT, "%"PRIuZ" %s checkout",
|
1356
1362
|
counts[CHECKOUT_ACTION__CONFLICT],
|
1357
1363
|
counts[CHECKOUT_ACTION__CONFLICT] == 1 ?
|
@@ -1362,7 +1368,7 @@ static int checkout_get_actions(
|
|
1362
1368
|
|
1363
1369
|
|
1364
1370
|
if ((error = checkout_get_remove_conflicts(data, workdir, &pathspec)) < 0 ||
|
1365
|
-
|
1371
|
+
(error = checkout_get_update_conflicts(data, workdir, &pathspec)) < 0)
|
1366
1372
|
goto fail;
|
1367
1373
|
|
1368
1374
|
counts[CHECKOUT_ACTION__REMOVE_CONFLICT] = git_vector_length(&data->remove_conflicts);
|
@@ -1483,7 +1489,9 @@ static int checkout_stream_write(
|
|
1483
1489
|
static int checkout_stream_close(git_writestream *s)
|
1484
1490
|
{
|
1485
1491
|
struct checkout_stream *stream = (struct checkout_stream *)s;
|
1486
|
-
|
1492
|
+
|
1493
|
+
GIT_ASSERT_ARG(stream);
|
1494
|
+
GIT_ASSERT_ARG(stream->open);
|
1487
1495
|
|
1488
1496
|
stream->open = 0;
|
1489
1497
|
return p_close(stream->fd);
|
@@ -1505,15 +1513,14 @@ static int blob_content_to_file(
|
|
1505
1513
|
int flags = data->opts.file_open_flags;
|
1506
1514
|
mode_t file_mode = data->opts.file_mode ?
|
1507
1515
|
data->opts.file_mode : entry_filemode;
|
1508
|
-
|
1516
|
+
git_filter_session filter_session = GIT_FILTER_SESSION_INIT;
|
1509
1517
|
struct checkout_stream writer;
|
1510
1518
|
mode_t mode;
|
1511
1519
|
git_filter_list *fl = NULL;
|
1512
1520
|
int fd;
|
1513
1521
|
int error = 0;
|
1514
1522
|
|
1515
|
-
|
1516
|
-
hint_path = path;
|
1523
|
+
GIT_ASSERT(hint_path != NULL);
|
1517
1524
|
|
1518
1525
|
if ((error = mkpath2file(data, path, data->opts.dir_mode)) < 0)
|
1519
1526
|
return error;
|
@@ -1528,13 +1535,13 @@ static int blob_content_to_file(
|
|
1528
1535
|
return fd;
|
1529
1536
|
}
|
1530
1537
|
|
1531
|
-
|
1532
|
-
|
1538
|
+
filter_session.attr_session = &data->attr_session;
|
1539
|
+
filter_session.temp_buf = &data->tmp;
|
1533
1540
|
|
1534
1541
|
if (!data->opts.disable_filters &&
|
1535
|
-
(error =
|
1542
|
+
(error = git_filter_list__load(
|
1536
1543
|
&fl, data->repo, blob, hint_path,
|
1537
|
-
GIT_FILTER_TO_WORKTREE, &
|
1544
|
+
GIT_FILTER_TO_WORKTREE, &filter_session))) {
|
1538
1545
|
p_close(fd);
|
1539
1546
|
return error;
|
1540
1547
|
}
|
@@ -1550,7 +1557,7 @@ static int blob_content_to_file(
|
|
1550
1557
|
|
1551
1558
|
error = git_filter_list_stream_blob(fl, blob, &writer.base);
|
1552
1559
|
|
1553
|
-
|
1560
|
+
GIT_ASSERT(writer.open == 0);
|
1554
1561
|
|
1555
1562
|
git_filter_list_free(fl);
|
1556
1563
|
|
@@ -1781,7 +1788,7 @@ static int checkout_blob(
|
|
1781
1788
|
}
|
1782
1789
|
|
1783
1790
|
error = checkout_write_content(
|
1784
|
-
data, &file->id, fullpath->ptr,
|
1791
|
+
data, &file->id, fullpath->ptr, file->path, file->mode, &st);
|
1785
1792
|
|
1786
1793
|
/* update the index unless prevented */
|
1787
1794
|
if (!error && (data->strategy & GIT_CHECKOUT_DONT_UPDATE_INDEX) == 0)
|
@@ -1853,26 +1860,6 @@ static int checkout_remove_the_old(
|
|
1853
1860
|
return 0;
|
1854
1861
|
}
|
1855
1862
|
|
1856
|
-
static int checkout_deferred_remove(git_repository *repo, const char *path)
|
1857
|
-
{
|
1858
|
-
#if 0
|
1859
|
-
int error = git_futils_rmdir_r(
|
1860
|
-
path, data->opts.target_directory, GIT_RMDIR_EMPTY_PARENTS);
|
1861
|
-
|
1862
|
-
if (error == GIT_ENOTFOUND) {
|
1863
|
-
error = 0;
|
1864
|
-
git_error_clear();
|
1865
|
-
}
|
1866
|
-
|
1867
|
-
return error;
|
1868
|
-
#else
|
1869
|
-
GIT_UNUSED(repo);
|
1870
|
-
GIT_UNUSED(path);
|
1871
|
-
assert(false);
|
1872
|
-
return 0;
|
1873
|
-
#endif
|
1874
|
-
}
|
1875
|
-
|
1876
1863
|
static int checkout_create_the_new(
|
1877
1864
|
unsigned int *actions,
|
1878
1865
|
checkout_data *data)
|
@@ -1882,15 +1869,6 @@ static int checkout_create_the_new(
|
|
1882
1869
|
size_t i;
|
1883
1870
|
|
1884
1871
|
git_vector_foreach(&data->diff->deltas, i, delta) {
|
1885
|
-
if (actions[i] & CHECKOUT_ACTION__DEFER_REMOVE) {
|
1886
|
-
/* this had a blocker directory that should only be removed iff
|
1887
|
-
* all of the contents of the directory were safely removed
|
1888
|
-
*/
|
1889
|
-
if ((error = checkout_deferred_remove(
|
1890
|
-
data->repo, delta->old_file.path)) < 0)
|
1891
|
-
return error;
|
1892
|
-
}
|
1893
|
-
|
1894
1872
|
if (actions[i] & CHECKOUT_ACTION__UPDATE_BLOB && !S_ISLNK(delta->new_file.mode)) {
|
1895
1873
|
if ((error = checkout_blob(data, &delta->new_file)) < 0)
|
1896
1874
|
return error;
|
@@ -1915,20 +1893,10 @@ static int checkout_create_submodules(
|
|
1915
1893
|
unsigned int *actions,
|
1916
1894
|
checkout_data *data)
|
1917
1895
|
{
|
1918
|
-
int error = 0;
|
1919
1896
|
git_diff_delta *delta;
|
1920
1897
|
size_t i;
|
1921
1898
|
|
1922
1899
|
git_vector_foreach(&data->diff->deltas, i, delta) {
|
1923
|
-
if (actions[i] & CHECKOUT_ACTION__DEFER_REMOVE) {
|
1924
|
-
/* this has a blocker directory that should only be removed iff
|
1925
|
-
* all of the contents of the directory were safely removed
|
1926
|
-
*/
|
1927
|
-
if ((error = checkout_deferred_remove(
|
1928
|
-
data->repo, delta->old_file.path)) < 0)
|
1929
|
-
return error;
|
1930
|
-
}
|
1931
|
-
|
1932
1900
|
if (actions[i] & CHECKOUT_ACTION__UPDATE_SUBMODULE) {
|
1933
1901
|
int error = checkout_submodule(data, &delta->new_file);
|
1934
1902
|
if (error < 0)
|
@@ -2006,12 +1974,12 @@ static int checkout_write_entry(
|
|
2006
1974
|
checkout_conflictdata *conflict,
|
2007
1975
|
const git_index_entry *side)
|
2008
1976
|
{
|
2009
|
-
const char *hint_path
|
1977
|
+
const char *hint_path, *suffix;
|
2010
1978
|
git_buf *fullpath;
|
2011
1979
|
struct stat st;
|
2012
1980
|
int error;
|
2013
1981
|
|
2014
|
-
|
1982
|
+
GIT_ASSERT(side == conflict->ours || side == conflict->theirs);
|
2015
1983
|
|
2016
1984
|
if (checkout_target_fullpath(&fullpath, data, side->path) < 0)
|
2017
1985
|
return -1;
|
@@ -2029,10 +1997,10 @@ static int checkout_write_entry(
|
|
2029
1997
|
|
2030
1998
|
if (checkout_path_suffixed(fullpath, suffix) < 0)
|
2031
1999
|
return -1;
|
2032
|
-
|
2033
|
-
hint_path = side->path;
|
2034
2000
|
}
|
2035
2001
|
|
2002
|
+
hint_path = side->path;
|
2003
|
+
|
2036
2004
|
if ((data->strategy & GIT_CHECKOUT_UPDATE_ONLY) != 0 &&
|
2037
2005
|
(error = checkout_safe_for_update_only(data, fullpath->ptr, side->mode)) <= 0)
|
2038
2006
|
return error;
|
@@ -2065,7 +2033,8 @@ static int checkout_merge_path(
|
|
2065
2033
|
const char *our_label_raw, *their_label_raw, *suffix;
|
2066
2034
|
int error = 0;
|
2067
2035
|
|
2068
|
-
if ((error = git_buf_joinpath(out,
|
2036
|
+
if ((error = git_buf_joinpath(out, data->opts.target_directory, result->path)) < 0 ||
|
2037
|
+
(error = git_path_validate_workdir_buf(data->repo, out)) < 0)
|
2069
2038
|
return error;
|
2070
2039
|
|
2071
2040
|
/* Most conflicts simply use the filename in the index */
|
@@ -2094,7 +2063,7 @@ static int checkout_write_merge(
|
|
2094
2063
|
git_merge_file_result result = {0};
|
2095
2064
|
git_filebuf output = GIT_FILEBUF_INIT;
|
2096
2065
|
git_filter_list *fl = NULL;
|
2097
|
-
|
2066
|
+
git_filter_session filter_session = GIT_FILTER_SESSION_INIT;
|
2098
2067
|
int error = 0;
|
2099
2068
|
|
2100
2069
|
if (data->opts.checkout_strategy & GIT_CHECKOUT_CONFLICT_STYLE_DIFF3)
|
@@ -2144,13 +2113,13 @@ static int checkout_write_merge(
|
|
2144
2113
|
in_data.ptr = (char *)result.ptr;
|
2145
2114
|
in_data.size = result.len;
|
2146
2115
|
|
2147
|
-
|
2148
|
-
|
2116
|
+
filter_session.attr_session = &data->attr_session;
|
2117
|
+
filter_session.temp_buf = &data->tmp;
|
2149
2118
|
|
2150
|
-
if ((error =
|
2151
|
-
&fl, data->repo, NULL,
|
2152
|
-
GIT_FILTER_TO_WORKTREE, &
|
2153
|
-
(error =
|
2119
|
+
if ((error = git_filter_list__load(
|
2120
|
+
&fl, data->repo, NULL, result.path,
|
2121
|
+
GIT_FILTER_TO_WORKTREE, &filter_session)) < 0 ||
|
2122
|
+
(error = git_filter_list__convert_buf(&out_data, fl, &in_data)) < 0)
|
2154
2123
|
goto done;
|
2155
2124
|
} else {
|
2156
2125
|
out_data.ptr = (char *)result.ptr;
|
@@ -2364,6 +2333,22 @@ static void checkout_data_clear(checkout_data *data)
|
|
2364
2333
|
git_attr_session__free(&data->attr_session);
|
2365
2334
|
}
|
2366
2335
|
|
2336
|
+
static int validate_target_directory(checkout_data *data)
|
2337
|
+
{
|
2338
|
+
int error;
|
2339
|
+
|
2340
|
+
if ((error = git_path_validate_workdir(data->repo, data->opts.target_directory)) < 0)
|
2341
|
+
return error;
|
2342
|
+
|
2343
|
+
if (git_path_isdir(data->opts.target_directory))
|
2344
|
+
return 0;
|
2345
|
+
|
2346
|
+
error = checkout_mkdir(data, data->opts.target_directory, NULL,
|
2347
|
+
GIT_DIR_MODE, GIT_MKDIR_VERIFY_DIR);
|
2348
|
+
|
2349
|
+
return error;
|
2350
|
+
}
|
2351
|
+
|
2367
2352
|
static int checkout_data_init(
|
2368
2353
|
checkout_data *data,
|
2369
2354
|
git_iterator *target,
|
@@ -2396,10 +2381,7 @@ static int checkout_data_init(
|
|
2396
2381
|
|
2397
2382
|
if (!data->opts.target_directory)
|
2398
2383
|
data->opts.target_directory = git_repository_workdir(repo);
|
2399
|
-
else if (
|
2400
|
-
(error = checkout_mkdir(data,
|
2401
|
-
data->opts.target_directory, NULL,
|
2402
|
-
GIT_DIR_MODE, GIT_MKDIR_VERIFY_DIR)) < 0)
|
2384
|
+
else if ((error = validate_target_directory(data)) < 0)
|
2403
2385
|
goto cleanup;
|
2404
2386
|
|
2405
2387
|
if ((error = git_repository_index(&data->index, data->repo)) < 0)
|
@@ -2520,9 +2502,8 @@ static int checkout_data_init(
|
|
2520
2502
|
git_config_entry_free(conflict_style);
|
2521
2503
|
}
|
2522
2504
|
|
2523
|
-
git_pool_init(&data->pool, 1)
|
2524
|
-
|
2525
|
-
if ((error = git_vector_init(&data->removes, 0, git__strcmp_cb)) < 0 ||
|
2505
|
+
if ((error = git_pool_init(&data->pool, 1)) < 0 ||
|
2506
|
+
(error = git_vector_init(&data->removes, 0, git__strcmp_cb)) < 0 ||
|
2526
2507
|
(error = git_vector_init(&data->remove_conflicts, 0, NULL)) < 0 ||
|
2527
2508
|
(error = git_vector_init(&data->update_conflicts, 0, NULL)) < 0 ||
|
2528
2509
|
(error = git_buf_puts(&data->target_path, data->opts.target_directory)) < 0 ||
|
@@ -2544,6 +2525,17 @@ cleanup:
|
|
2544
2525
|
#define CHECKOUT_INDEX_DONT_WRITE_MASK \
|
2545
2526
|
(GIT_CHECKOUT_DONT_UPDATE_INDEX | GIT_CHECKOUT_DONT_WRITE_INDEX)
|
2546
2527
|
|
2528
|
+
GIT_INLINE(void) setup_pathspecs(
|
2529
|
+
git_iterator_options *iter_opts,
|
2530
|
+
const git_checkout_options *checkout_opts)
|
2531
|
+
{
|
2532
|
+
if (checkout_opts &&
|
2533
|
+
(checkout_opts->checkout_strategy & GIT_CHECKOUT_DISABLE_PATHSPEC_MATCH)) {
|
2534
|
+
iter_opts->pathlist.count = checkout_opts->paths.count;
|
2535
|
+
iter_opts->pathlist.strings = checkout_opts->paths.strings;
|
2536
|
+
}
|
2537
|
+
}
|
2538
|
+
|
2547
2539
|
int git_checkout_iterator(
|
2548
2540
|
git_iterator *target,
|
2549
2541
|
git_index *index,
|
@@ -2586,6 +2578,8 @@ int git_checkout_iterator(
|
|
2586
2578
|
workdir_opts.start = data.pfx;
|
2587
2579
|
workdir_opts.end = data.pfx;
|
2588
2580
|
|
2581
|
+
setup_pathspecs(&workdir_opts, opts);
|
2582
|
+
|
2589
2583
|
if ((error = git_iterator_reset_range(target, data.pfx, data.pfx)) < 0 ||
|
2590
2584
|
(error = git_iterator_for_workdir_ext(
|
2591
2585
|
&workdir, data.repo, data.opts.target_directory, index, NULL,
|
@@ -2596,10 +2590,8 @@ int git_checkout_iterator(
|
|
2596
2590
|
GIT_ITERATOR_IGNORE_CASE : GIT_ITERATOR_DONT_IGNORE_CASE;
|
2597
2591
|
baseline_opts.start = data.pfx;
|
2598
2592
|
baseline_opts.end = data.pfx;
|
2599
|
-
|
2600
|
-
|
2601
|
-
baseline_opts.pathlist.strings = opts->paths.strings;
|
2602
|
-
}
|
2593
|
+
|
2594
|
+
setup_pathspecs(&baseline_opts, opts);
|
2603
2595
|
|
2604
2596
|
if (data.opts.baseline_index) {
|
2605
2597
|
if ((error = git_iterator_for_index(
|
@@ -2613,7 +2605,7 @@ int git_checkout_iterator(
|
|
2613
2605
|
}
|
2614
2606
|
|
2615
2607
|
/* Should not have case insensitivity mismatch */
|
2616
|
-
|
2608
|
+
GIT_ASSERT(git_iterator_ignore_case(workdir) == git_iterator_ignore_case(baseline));
|
2617
2609
|
|
2618
2610
|
/* Generate baseline-to-target diff which will include an entry for
|
2619
2611
|
* every possible update that might need to be made.
|
@@ -2629,6 +2621,9 @@ int git_checkout_iterator(
|
|
2629
2621
|
if ((error = checkout_get_actions(&actions, &counts, &data, workdir)) != 0)
|
2630
2622
|
goto cleanup;
|
2631
2623
|
|
2624
|
+
if (data.strategy & GIT_CHECKOUT_DRY_RUN)
|
2625
|
+
goto cleanup;
|
2626
|
+
|
2632
2627
|
data.total_steps = counts[CHECKOUT_ACTION__REMOVE] +
|
2633
2628
|
counts[CHECKOUT_ACTION__REMOVE_CONFLICT] +
|
2634
2629
|
counts[CHECKOUT_ACTION__UPDATE_BLOB] +
|
@@ -2664,7 +2659,7 @@ int git_checkout_iterator(
|
|
2664
2659
|
(error = checkout_extensions_update_index(&data)) < 0)
|
2665
2660
|
goto cleanup;
|
2666
2661
|
|
2667
|
-
|
2662
|
+
GIT_ASSERT(data.completed_steps == data.total_steps);
|
2668
2663
|
|
2669
2664
|
if (data.opts.perfdata_cb)
|
2670
2665
|
data.opts.perfdata_cb(&data.perfdata, data.opts.perfdata_payload);
|
@@ -2689,6 +2684,7 @@ int git_checkout_index(
|
|
2689
2684
|
git_index *index,
|
2690
2685
|
const git_checkout_options *opts)
|
2691
2686
|
{
|
2687
|
+
git_iterator_options iter_opts = GIT_ITERATOR_OPTIONS_INIT;
|
2692
2688
|
int error, owned = 0;
|
2693
2689
|
git_iterator *index_i;
|
2694
2690
|
|
@@ -2716,7 +2712,9 @@ int git_checkout_index(
|
|
2716
2712
|
return error;
|
2717
2713
|
GIT_REFCOUNT_INC(index);
|
2718
2714
|
|
2719
|
-
|
2715
|
+
setup_pathspecs(&iter_opts, opts);
|
2716
|
+
|
2717
|
+
if (!(error = git_iterator_for_index(&index_i, repo, index, &iter_opts)))
|
2720
2718
|
error = git_checkout_iterator(index_i, index, opts);
|
2721
2719
|
|
2722
2720
|
if (owned)
|
@@ -2773,10 +2771,7 @@ int git_checkout_tree(
|
|
2773
2771
|
if ((error = git_repository_index(&index, repo)) < 0)
|
2774
2772
|
return error;
|
2775
2773
|
|
2776
|
-
|
2777
|
-
iter_opts.pathlist.count = opts->paths.count;
|
2778
|
-
iter_opts.pathlist.strings = opts->paths.strings;
|
2779
|
-
}
|
2774
|
+
setup_pathspecs(&iter_opts, opts);
|
2780
2775
|
|
2781
2776
|
if (!(error = git_iterator_for_tree(&tree_i, tree, &iter_opts)))
|
2782
2777
|
error = git_checkout_iterator(tree_i, index, opts);
|
@@ -2792,7 +2787,8 @@ int git_checkout_head(
|
|
2792
2787
|
git_repository *repo,
|
2793
2788
|
const git_checkout_options *opts)
|
2794
2789
|
{
|
2795
|
-
|
2790
|
+
GIT_ASSERT_ARG(repo);
|
2791
|
+
|
2796
2792
|
return git_checkout_tree(repo, NULL, opts);
|
2797
2793
|
}
|
2798
2794
|
|
@@ -2803,7 +2799,9 @@ int git_checkout_options_init(git_checkout_options *opts, unsigned int version)
|
|
2803
2799
|
return 0;
|
2804
2800
|
}
|
2805
2801
|
|
2802
|
+
#ifndef GIT_DEPRECATE_HARD
|
2806
2803
|
int git_checkout_init_options(git_checkout_options *opts, unsigned int version)
|
2807
2804
|
{
|
2808
2805
|
return git_checkout_options_init(opts, version);
|
2809
2806
|
}
|
2807
|
+
#endif
|
@@ -126,7 +126,10 @@ int git_cherrypick_commit(
|
|
126
126
|
git_tree *parent_tree = NULL, *our_tree = NULL, *cherrypick_tree = NULL;
|
127
127
|
int parent = 0, error = 0;
|
128
128
|
|
129
|
-
|
129
|
+
GIT_ASSERT_ARG(out);
|
130
|
+
GIT_ASSERT_ARG(repo);
|
131
|
+
GIT_ASSERT_ARG(cherrypick_commit);
|
132
|
+
GIT_ASSERT_ARG(our_commit);
|
130
133
|
|
131
134
|
if (git_commit_parentcount(cherrypick_commit) > 1) {
|
132
135
|
if (!mainline)
|
@@ -177,7 +180,8 @@ int git_cherrypick(
|
|
177
180
|
git_indexwriter indexwriter = GIT_INDEXWRITER_INIT;
|
178
181
|
int error = 0;
|
179
182
|
|
180
|
-
|
183
|
+
GIT_ASSERT_ARG(repo);
|
184
|
+
GIT_ASSERT_ARG(commit);
|
181
185
|
|
182
186
|
GIT_ERROR_CHECK_VERSION(given_opts, GIT_CHERRYPICK_OPTIONS_VERSION, "git_cherrypick_options");
|
183
187
|
|
@@ -229,8 +233,10 @@ int git_cherrypick_options_init(
|
|
229
233
|
return 0;
|
230
234
|
}
|
231
235
|
|
236
|
+
#ifndef GIT_DEPRECATE_HARD
|
232
237
|
int git_cherrypick_init_options(
|
233
238
|
git_cherrypick_options *opts, unsigned int version)
|
234
239
|
{
|
235
240
|
return git_cherrypick_options_init(opts, version);
|
236
241
|
}
|
242
|
+
#endif
|