rugged 1.1.1 → 1.4.3
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/extconf.rb +2 -2
- data/ext/rugged/rugged.c +7 -4
- data/ext/rugged/rugged_config.c +7 -2
- data/ext/rugged/rugged_object.c +1 -1
- data/ext/rugged/rugged_remote.c +17 -0
- data/ext/rugged/rugged_repo.c +3 -3
- data/lib/rugged/repository.rb +2 -2
- data/lib/rugged/version.rb +1 -1
- data/vendor/libgit2/CMakeLists.txt +103 -271
- data/vendor/libgit2/COPYING +149 -24
- data/vendor/libgit2/cmake/AddCFlagIfSupported.cmake +21 -21
- data/vendor/libgit2/cmake/DefaultCFlags.cmake +154 -0
- data/vendor/libgit2/cmake/EnableWarnings.cmake +13 -13
- data/vendor/libgit2/cmake/FindCoreFoundation.cmake +13 -13
- data/vendor/libgit2/cmake/FindGSSAPI.cmake +171 -287
- data/vendor/libgit2/cmake/FindGSSFramework.cmake +13 -13
- data/vendor/libgit2/cmake/{FindHTTP_Parser.cmake → FindHTTPParser.cmake} +17 -17
- data/vendor/libgit2/cmake/FindIconv.cmake +27 -27
- data/vendor/libgit2/cmake/FindLibSSH2.cmake +13 -0
- data/vendor/libgit2/cmake/FindPCRE.cmake +13 -13
- data/vendor/libgit2/cmake/FindPCRE2.cmake +12 -12
- data/vendor/libgit2/cmake/FindPkgLibraries.cmake +19 -19
- data/vendor/libgit2/cmake/FindSecurity.cmake +14 -14
- data/vendor/libgit2/cmake/FindStatNsec.cmake +12 -18
- data/vendor/libgit2/cmake/Findfutimens.cmake +14 -0
- data/vendor/libgit2/cmake/FindmbedTLS.cmake +63 -70
- data/vendor/libgit2/cmake/IdeSplitSources.cmake +18 -18
- data/vendor/libgit2/cmake/PkgBuildConfig.cmake +60 -60
- data/vendor/libgit2/cmake/SanitizeBool.cmake +20 -20
- data/vendor/libgit2/cmake/SelectGSSAPI.cmake +37 -37
- data/vendor/libgit2/cmake/SelectHTTPParser.cmake +19 -0
- data/vendor/libgit2/cmake/SelectHTTPSBackend.cmake +100 -96
- data/vendor/libgit2/cmake/SelectHashes.cmake +39 -48
- data/vendor/libgit2/cmake/SelectRegex.cmake +51 -0
- data/vendor/libgit2/cmake/SelectSSH.cmake +41 -0
- data/vendor/libgit2/cmake/SelectWinHTTP.cmake +17 -0
- data/vendor/libgit2/cmake/SelectZlib.cmake +34 -0
- data/vendor/libgit2/deps/chromium-zlib/CMakeLists.txt +101 -0
- data/vendor/libgit2/deps/ntlmclient/CMakeLists.txt +32 -20
- 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 +154 -122
- data/vendor/libgit2/deps/ntlmclient/ntlm.h +17 -13
- data/vendor/libgit2/deps/ntlmclient/ntlmclient.h +17 -4
- 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/pcre/CMakeLists.txt +88 -88
- data/vendor/libgit2/deps/winhttp/CMakeLists.txt +14 -16
- data/vendor/libgit2/include/git2/apply.h +16 -2
- data/vendor/libgit2/include/git2/attr.h +106 -2
- data/vendor/libgit2/include/git2/blame.h +97 -43
- data/vendor/libgit2/include/git2/blob.h +33 -2
- data/vendor/libgit2/include/git2/branch.h +27 -0
- data/vendor/libgit2/include/git2/buffer.h +18 -78
- data/vendor/libgit2/include/git2/cert.h +43 -6
- data/vendor/libgit2/include/git2/checkout.h +32 -13
- data/vendor/libgit2/include/git2/clone.h +4 -4
- data/vendor/libgit2/include/git2/commit.h +37 -19
- data/vendor/libgit2/include/git2/common.h +46 -5
- data/vendor/libgit2/include/git2/config.h +19 -3
- data/vendor/libgit2/include/git2/credential.h +2 -1
- data/vendor/libgit2/include/git2/credential_helpers.h +1 -0
- data/vendor/libgit2/include/git2/deprecated.h +326 -6
- data/vendor/libgit2/include/git2/describe.h +7 -2
- data/vendor/libgit2/include/git2/diff.h +50 -121
- data/vendor/libgit2/include/git2/email.h +127 -0
- data/vendor/libgit2/include/git2/errors.h +7 -6
- data/vendor/libgit2/include/git2/filter.h +69 -18
- data/vendor/libgit2/include/git2/graph.h +21 -2
- data/vendor/libgit2/include/git2/ignore.h +1 -1
- data/vendor/libgit2/include/git2/index.h +13 -7
- data/vendor/libgit2/include/git2/indexer.h +19 -0
- data/vendor/libgit2/include/git2/merge.h +23 -3
- data/vendor/libgit2/include/git2/message.h +2 -0
- data/vendor/libgit2/include/git2/notes.h +2 -2
- data/vendor/libgit2/include/git2/object.h +23 -0
- data/vendor/libgit2/include/git2/odb.h +65 -6
- data/vendor/libgit2/include/git2/odb_backend.h +1 -1
- data/vendor/libgit2/include/git2/oidarray.h +5 -8
- data/vendor/libgit2/include/git2/pack.h +24 -8
- data/vendor/libgit2/include/git2/patch.h +16 -0
- data/vendor/libgit2/include/git2/pathspec.h +1 -1
- data/vendor/libgit2/include/git2/proxy.h +1 -1
- data/vendor/libgit2/include/git2/rebase.h +34 -2
- data/vendor/libgit2/include/git2/refdb.h +3 -0
- data/vendor/libgit2/include/git2/reflog.h +1 -1
- data/vendor/libgit2/include/git2/refs.h +8 -4
- data/vendor/libgit2/include/git2/remote.h +246 -46
- data/vendor/libgit2/include/git2/repository.h +25 -18
- data/vendor/libgit2/include/git2/reset.h +2 -2
- data/vendor/libgit2/include/git2/revparse.h +5 -5
- data/vendor/libgit2/include/git2/revwalk.h +4 -1
- data/vendor/libgit2/include/git2/signature.h +1 -1
- data/vendor/libgit2/include/git2/stash.h +4 -4
- data/vendor/libgit2/include/git2/status.h +124 -62
- data/vendor/libgit2/include/git2/stdint.h +3 -3
- data/vendor/libgit2/include/git2/submodule.h +16 -2
- 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 +9 -5
- data/vendor/libgit2/include/git2/sys/remote.h +31 -0
- data/vendor/libgit2/include/git2/sys/stream.h +1 -1
- data/vendor/libgit2/include/git2/sys/transport.h +26 -34
- data/vendor/libgit2/include/git2/tag.h +13 -0
- data/vendor/libgit2/include/git2/tree.h +4 -17
- data/vendor/libgit2/include/git2/types.h +16 -7
- data/vendor/libgit2/include/git2/version.h +4 -4
- data/vendor/libgit2/include/git2/worktree.h +13 -2
- data/vendor/libgit2/include/git2.h +1 -0
- data/vendor/libgit2/src/CMakeLists.txt +192 -290
- 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/annotated_commit.h +1 -1
- data/vendor/libgit2/src/apply.c +34 -25
- data/vendor/libgit2/src/apply.h +2 -2
- data/vendor/libgit2/src/array.h +11 -11
- data/vendor/libgit2/src/attr.c +204 -82
- data/vendor/libgit2/src/attr_file.c +105 -52
- data/vendor/libgit2/src/attr_file.h +36 -15
- data/vendor/libgit2/src/attrcache.c +55 -45
- data/vendor/libgit2/src/attrcache.h +4 -5
- data/vendor/libgit2/src/blame.c +15 -9
- data/vendor/libgit2/src/blame_git.c +2 -2
- data/vendor/libgit2/src/blob.c +76 -52
- data/vendor/libgit2/src/blob.h +1 -1
- data/vendor/libgit2/src/branch.c +203 -110
- data/vendor/libgit2/src/branch.h +15 -3
- data/vendor/libgit2/src/buf.c +126 -0
- data/vendor/libgit2/src/buf.h +50 -0
- data/vendor/libgit2/src/cache.c +2 -2
- data/vendor/libgit2/src/cache.h +7 -7
- data/vendor/libgit2/src/cc-compat.h +11 -9
- data/vendor/libgit2/src/checkout.c +118 -91
- data/vendor/libgit2/src/cherrypick.c +16 -12
- data/vendor/libgit2/src/clone.c +97 -103
- data/vendor/libgit2/src/commit.c +167 -84
- data/vendor/libgit2/src/commit.h +24 -1
- data/vendor/libgit2/src/commit_graph.c +1224 -0
- data/vendor/libgit2/src/commit_graph.h +169 -0
- data/vendor/libgit2/src/commit_list.c +48 -3
- data/vendor/libgit2/src/commit_list.h +2 -0
- data/vendor/libgit2/src/common.h +35 -5
- data/vendor/libgit2/src/config.c +119 -64
- data/vendor/libgit2/src/config.h +15 -2
- data/vendor/libgit2/src/config_cache.c +5 -3
- data/vendor/libgit2/src/config_file.c +120 -100
- data/vendor/libgit2/src/config_mem.c +9 -9
- data/vendor/libgit2/src/config_parse.c +29 -27
- data/vendor/libgit2/src/crlf.c +36 -23
- data/vendor/libgit2/src/date.c +13 -19
- data/vendor/libgit2/src/date.h +33 -0
- data/vendor/libgit2/src/delta.c +1 -1
- data/vendor/libgit2/src/describe.c +32 -21
- data/vendor/libgit2/src/diff.c +71 -183
- data/vendor/libgit2/src/diff.h +2 -4
- data/vendor/libgit2/src/diff_driver.c +53 -51
- data/vendor/libgit2/src/diff_driver.h +3 -3
- data/vendor/libgit2/src/diff_file.c +31 -26
- data/vendor/libgit2/src/diff_generate.c +76 -23
- data/vendor/libgit2/src/diff_generate.h +5 -3
- data/vendor/libgit2/src/diff_print.c +120 -95
- data/vendor/libgit2/src/diff_stats.c +47 -34
- data/vendor/libgit2/src/{message.h → diff_stats.h} +7 -6
- data/vendor/libgit2/src/diff_tform.c +18 -16
- data/vendor/libgit2/src/diff_xdiff.c +7 -10
- data/vendor/libgit2/src/diff_xdiff.h +1 -1
- data/vendor/libgit2/src/email.c +315 -0
- data/vendor/libgit2/src/email.h +25 -0
- data/vendor/libgit2/src/errors.c +37 -32
- data/vendor/libgit2/src/features.h.in +11 -2
- data/vendor/libgit2/src/fetch.c +77 -26
- data/vendor/libgit2/src/fetch.h +1 -1
- data/vendor/libgit2/src/fetchhead.c +27 -23
- data/vendor/libgit2/src/filebuf.c +36 -34
- data/vendor/libgit2/src/filebuf.h +1 -1
- data/vendor/libgit2/src/filter.c +278 -132
- data/vendor/libgit2/src/filter.h +46 -6
- data/vendor/libgit2/src/fs_path.c +2071 -0
- data/vendor/libgit2/src/fs_path.h +772 -0
- data/vendor/libgit2/src/futils.c +96 -90
- data/vendor/libgit2/src/futils.h +27 -15
- data/vendor/libgit2/src/graph.c +64 -9
- data/vendor/libgit2/src/hash/sha1/collisiondetect.c +5 -5
- data/vendor/libgit2/src/hash/sha1/common_crypto.c +5 -5
- data/vendor/libgit2/src/hash/sha1/generic.c +2 -2
- data/vendor/libgit2/src/hash/sha1/generic.h +1 -1
- data/vendor/libgit2/src/hash/sha1/mbedtls.c +13 -13
- data/vendor/libgit2/src/hash/sha1/openssl.c +5 -5
- data/vendor/libgit2/src/hash/sha1/sha1dc/sha1.c +9 -11
- data/vendor/libgit2/src/hash/sha1/win32.c +21 -17
- data/vendor/libgit2/src/hash/sha1.h +3 -1
- data/vendor/libgit2/src/hash.c +71 -36
- data/vendor/libgit2/src/hash.h +13 -13
- data/vendor/libgit2/src/hashsig.c +23 -10
- data/vendor/libgit2/src/ident.c +30 -20
- data/vendor/libgit2/src/ignore.c +63 -46
- data/vendor/libgit2/src/ignore.h +2 -2
- data/vendor/libgit2/src/index.c +184 -149
- data/vendor/libgit2/src/index.h +7 -4
- data/vendor/libgit2/src/indexer.c +143 -89
- data/vendor/libgit2/src/integer.h +64 -2
- data/vendor/libgit2/src/iterator.c +93 -73
- data/vendor/libgit2/src/iterator.h +6 -6
- data/vendor/libgit2/src/khash.h +3 -12
- data/vendor/libgit2/src/{settings.c → libgit2.c} +165 -56
- data/vendor/libgit2/src/libgit2.h +15 -0
- data/vendor/libgit2/src/mailmap.c +60 -45
- data/vendor/libgit2/src/map.h +3 -3
- data/vendor/libgit2/src/merge.c +104 -61
- data/vendor/libgit2/src/merge.h +3 -15
- data/vendor/libgit2/src/merge_driver.c +21 -15
- data/vendor/libgit2/src/merge_file.c +24 -6
- data/vendor/libgit2/src/message.c +21 -8
- data/vendor/libgit2/src/midx.c +501 -18
- data/vendor/libgit2/src/midx.h +29 -2
- data/vendor/libgit2/src/mwindow.c +103 -59
- data/vendor/libgit2/src/mwindow.h +3 -3
- data/vendor/libgit2/src/net.c +405 -71
- data/vendor/libgit2/src/net.h +26 -5
- data/vendor/libgit2/src/netops.c +7 -5
- data/vendor/libgit2/src/netops.h +3 -3
- data/vendor/libgit2/src/notes.c +40 -49
- data/vendor/libgit2/src/object.c +68 -20
- data/vendor/libgit2/src/object.h +1 -1
- data/vendor/libgit2/src/odb.c +320 -80
- data/vendor/libgit2/src/odb.h +17 -3
- data/vendor/libgit2/src/odb_loose.c +96 -86
- data/vendor/libgit2/src/odb_mempack.c +19 -6
- data/vendor/libgit2/src/odb_pack.c +402 -125
- data/vendor/libgit2/src/oid.c +16 -8
- data/vendor/libgit2/src/oid.h +15 -0
- data/vendor/libgit2/src/oidarray.c +10 -1
- data/vendor/libgit2/src/pack-objects.c +90 -69
- data/vendor/libgit2/src/pack-objects.h +11 -6
- data/vendor/libgit2/src/pack.c +337 -127
- data/vendor/libgit2/src/pack.h +25 -7
- data/vendor/libgit2/src/patch.c +17 -10
- data/vendor/libgit2/src/patch.h +1 -0
- data/vendor/libgit2/src/patch_generate.c +29 -13
- data/vendor/libgit2/src/patch_generate.h +5 -5
- data/vendor/libgit2/src/patch_parse.c +26 -25
- data/vendor/libgit2/src/path.c +86 -1768
- data/vendor/libgit2/src/path.h +39 -635
- data/vendor/libgit2/src/pathspec.c +12 -12
- data/vendor/libgit2/src/pathspec.h +2 -2
- data/vendor/libgit2/src/pool.c +13 -7
- data/vendor/libgit2/src/posix.c +14 -6
- data/vendor/libgit2/src/posix.h +1 -0
- data/vendor/libgit2/src/pqueue.h +1 -1
- data/vendor/libgit2/src/proxy.c +4 -1
- data/vendor/libgit2/src/proxy.h +1 -1
- data/vendor/libgit2/src/push.c +30 -35
- data/vendor/libgit2/src/push.h +4 -16
- data/vendor/libgit2/src/rand.c +226 -0
- data/vendor/libgit2/src/rand.h +37 -0
- data/vendor/libgit2/src/reader.c +18 -14
- data/vendor/libgit2/src/reader.h +2 -2
- data/vendor/libgit2/src/rebase.c +177 -132
- data/vendor/libgit2/src/refdb.c +30 -13
- data/vendor/libgit2/src/refdb_fs.c +548 -222
- data/vendor/libgit2/src/reflog.c +19 -14
- data/vendor/libgit2/src/refs.c +107 -72
- data/vendor/libgit2/src/refs.h +2 -2
- data/vendor/libgit2/src/refspec.c +53 -38
- data/vendor/libgit2/src/refspec.h +5 -2
- data/vendor/libgit2/src/regexp.c +1 -1
- data/vendor/libgit2/src/remote.c +960 -486
- data/vendor/libgit2/src/remote.h +16 -10
- data/vendor/libgit2/src/repository.c +702 -422
- data/vendor/libgit2/src/repository.h +26 -8
- data/vendor/libgit2/src/reset.c +16 -12
- data/vendor/libgit2/src/revert.c +16 -12
- data/vendor/libgit2/src/revparse.c +66 -48
- data/vendor/libgit2/src/revwalk.c +39 -22
- data/vendor/libgit2/src/runtime.c +162 -0
- data/vendor/libgit2/src/runtime.h +62 -0
- data/vendor/libgit2/src/settings.h +11 -0
- data/vendor/libgit2/src/signature.c +18 -11
- data/vendor/libgit2/src/signature.h +1 -1
- data/vendor/libgit2/src/sortedcache.c +1 -1
- data/vendor/libgit2/src/sortedcache.h +10 -8
- data/vendor/libgit2/src/stash.c +39 -38
- data/vendor/libgit2/src/status.c +11 -5
- data/vendor/libgit2/src/{buffer.c → str.c} +459 -136
- data/vendor/libgit2/src/str.h +357 -0
- data/vendor/libgit2/src/strarray.c +2 -1
- data/vendor/libgit2/src/streams/mbedtls.c +22 -23
- data/vendor/libgit2/src/streams/mbedtls.h +1 -1
- data/vendor/libgit2/src/streams/openssl.c +101 -201
- 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 +5 -6
- 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 +290 -212
- data/vendor/libgit2/src/submodule.h +10 -10
- data/vendor/libgit2/src/sysdir.c +70 -56
- data/vendor/libgit2/src/sysdir.h +15 -10
- data/vendor/libgit2/src/tag.c +72 -34
- 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 +3 -16
- data/vendor/libgit2/src/trace.h +17 -30
- data/vendor/libgit2/src/trailer.c +2 -2
- data/vendor/libgit2/src/transaction.c +20 -9
- data/vendor/libgit2/src/transport.c +13 -13
- data/vendor/libgit2/src/transports/auth.c +8 -10
- data/vendor/libgit2/src/transports/auth.h +2 -3
- data/vendor/libgit2/src/transports/auth_negotiate.c +23 -17
- data/vendor/libgit2/src/transports/auth_ntlm.c +20 -16
- data/vendor/libgit2/src/transports/auth_ntlm.h +0 -1
- data/vendor/libgit2/src/transports/credential.c +15 -7
- data/vendor/libgit2/src/transports/git.c +10 -14
- data/vendor/libgit2/src/transports/http.c +56 -34
- data/vendor/libgit2/src/transports/http.h +3 -3
- data/vendor/libgit2/src/transports/httpclient.c +106 -79
- data/vendor/libgit2/src/transports/httpclient.h +1 -1
- data/vendor/libgit2/src/transports/local.c +127 -119
- data/vendor/libgit2/src/transports/smart.c +61 -144
- data/vendor/libgit2/src/transports/smart.h +26 -32
- data/vendor/libgit2/src/transports/smart_pkt.c +33 -33
- data/vendor/libgit2/src/transports/smart_protocol.c +68 -44
- data/vendor/libgit2/src/transports/ssh.c +100 -131
- data/vendor/libgit2/src/transports/winhttp.c +86 -82
- data/vendor/libgit2/src/tree-cache.c +5 -5
- data/vendor/libgit2/src/tree-cache.h +2 -2
- data/vendor/libgit2/src/tree.c +150 -116
- data/vendor/libgit2/src/tree.h +1 -0
- data/vendor/libgit2/src/tsort.c +0 -2
- data/vendor/libgit2/src/unix/map.c +3 -3
- data/vendor/libgit2/src/unix/posix.h +1 -4
- data/vendor/libgit2/src/unix/pthread.h +2 -1
- data/vendor/libgit2/src/unix/realpath.c +0 -2
- data/vendor/libgit2/src/utf8.c +150 -0
- data/vendor/libgit2/src/utf8.h +52 -0
- data/vendor/libgit2/src/util.c +68 -144
- data/vendor/libgit2/src/util.h +36 -68
- data/vendor/libgit2/src/vector.c +23 -19
- data/vendor/libgit2/src/vector.h +5 -3
- data/vendor/libgit2/src/win32/findfile.c +172 -114
- data/vendor/libgit2/src/win32/findfile.h +7 -4
- 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 +162 -33
- data/vendor/libgit2/src/win32/path_w32.h +2 -1
- data/vendor/libgit2/src/win32/posix.h +6 -7
- data/vendor/libgit2/src/win32/posix_w32.c +26 -33
- 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 +5 -6
- data/vendor/libgit2/src/win32/w32_buffer.h +2 -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 +138 -105
- data/vendor/libgit2/src/worktree.h +1 -1
- data/vendor/libgit2/src/xdiff/git-xdiff.h +53 -0
- data/vendor/libgit2/src/xdiff/xdiff.h +15 -15
- data/vendor/libgit2/src/xdiff/xdiffi.c +134 -108
- data/vendor/libgit2/src/xdiff/xemit.c +23 -7
- data/vendor/libgit2/src/xdiff/xhistogram.c +87 -78
- data/vendor/libgit2/src/xdiff/xinclude.h +1 -12
- data/vendor/libgit2/src/xdiff/xmerge.c +104 -117
- data/vendor/libgit2/src/xdiff/xpatience.c +6 -17
- data/vendor/libgit2/src/xdiff/xprepare.c +15 -20
- data/vendor/libgit2/src/xdiff/xutils.c +18 -7
- data/vendor/libgit2/src/zstream.c +6 -6
- data/vendor/libgit2/src/zstream.h +4 -4
- metadata +60 -24
- 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/buffer.h +0 -222
- data/vendor/libgit2/src/global.c +0 -363
- 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 -369
- 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
@@ -7,53 +7,56 @@
|
|
7
7
|
|
8
8
|
#include "worktree.h"
|
9
9
|
|
10
|
+
#include "buf.h"
|
11
|
+
#include "repository.h"
|
12
|
+
#include "path.h"
|
13
|
+
|
10
14
|
#include "git2/branch.h"
|
11
15
|
#include "git2/commit.h"
|
12
16
|
#include "git2/worktree.h"
|
13
17
|
|
14
|
-
#include "repository.h"
|
15
|
-
|
16
18
|
static bool is_worktree_dir(const char *dir)
|
17
19
|
{
|
18
|
-
|
20
|
+
git_str buf = GIT_STR_INIT;
|
19
21
|
int error;
|
20
22
|
|
21
|
-
if (
|
23
|
+
if (git_str_sets(&buf, dir) < 0)
|
22
24
|
return -1;
|
23
25
|
|
24
|
-
error =
|
25
|
-
&&
|
26
|
-
&&
|
26
|
+
error = git_fs_path_contains_file(&buf, "commondir")
|
27
|
+
&& git_fs_path_contains_file(&buf, "gitdir")
|
28
|
+
&& git_fs_path_contains_file(&buf, "HEAD");
|
27
29
|
|
28
|
-
|
30
|
+
git_str_dispose(&buf);
|
29
31
|
return error;
|
30
32
|
}
|
31
33
|
|
32
34
|
int git_worktree_list(git_strarray *wts, git_repository *repo)
|
33
35
|
{
|
34
36
|
git_vector worktrees = GIT_VECTOR_INIT;
|
35
|
-
|
37
|
+
git_str path = GIT_STR_INIT;
|
36
38
|
char *worktree;
|
37
39
|
size_t i, len;
|
38
40
|
int error;
|
39
41
|
|
40
|
-
|
42
|
+
GIT_ASSERT_ARG(wts);
|
43
|
+
GIT_ASSERT_ARG(repo);
|
41
44
|
|
42
45
|
wts->count = 0;
|
43
46
|
wts->strings = NULL;
|
44
47
|
|
45
|
-
if ((error =
|
48
|
+
if ((error = git_str_joinpath(&path, repo->commondir, "worktrees/")) < 0)
|
46
49
|
goto exit;
|
47
|
-
if (!
|
50
|
+
if (!git_fs_path_exists(path.ptr) || git_fs_path_is_empty_dir(path.ptr))
|
48
51
|
goto exit;
|
49
|
-
if ((error =
|
52
|
+
if ((error = git_fs_path_dirload(&worktrees, path.ptr, path.size, 0x0)) < 0)
|
50
53
|
goto exit;
|
51
54
|
|
52
55
|
len = path.size;
|
53
56
|
|
54
57
|
git_vector_foreach(&worktrees, i, worktree) {
|
55
|
-
|
56
|
-
|
58
|
+
git_str_truncate(&path, len);
|
59
|
+
git_str_puts(&path, worktree);
|
57
60
|
|
58
61
|
if (!is_worktree_dir(path.ptr)) {
|
59
62
|
git_vector_remove(&worktrees, i);
|
@@ -64,65 +67,68 @@ int git_worktree_list(git_strarray *wts, git_repository *repo)
|
|
64
67
|
wts->strings = (char **)git_vector_detach(&wts->count, NULL, &worktrees);
|
65
68
|
|
66
69
|
exit:
|
67
|
-
|
70
|
+
git_str_dispose(&path);
|
68
71
|
|
69
72
|
return error;
|
70
73
|
}
|
71
74
|
|
72
75
|
char *git_worktree__read_link(const char *base, const char *file)
|
73
76
|
{
|
74
|
-
|
77
|
+
git_str path = GIT_STR_INIT, buf = GIT_STR_INIT;
|
75
78
|
|
76
|
-
|
79
|
+
GIT_ASSERT_ARG_WITH_RETVAL(base, NULL);
|
80
|
+
GIT_ASSERT_ARG_WITH_RETVAL(file, NULL);
|
77
81
|
|
78
|
-
if (
|
82
|
+
if (git_str_joinpath(&path, base, file) < 0)
|
79
83
|
goto err;
|
80
84
|
if (git_futils_readbuffer(&buf, path.ptr) < 0)
|
81
85
|
goto err;
|
82
|
-
|
86
|
+
git_str_dispose(&path);
|
83
87
|
|
84
|
-
|
88
|
+
git_str_rtrim(&buf);
|
85
89
|
|
86
|
-
if (!
|
87
|
-
return
|
90
|
+
if (!git_fs_path_is_relative(buf.ptr))
|
91
|
+
return git_str_detach(&buf);
|
88
92
|
|
89
|
-
if (
|
93
|
+
if (git_str_sets(&path, base) < 0)
|
90
94
|
goto err;
|
91
|
-
if (
|
95
|
+
if (git_fs_path_apply_relative(&path, buf.ptr) < 0)
|
92
96
|
goto err;
|
93
|
-
|
97
|
+
git_str_dispose(&buf);
|
94
98
|
|
95
|
-
return
|
99
|
+
return git_str_detach(&path);
|
96
100
|
|
97
101
|
err:
|
98
|
-
|
99
|
-
|
102
|
+
git_str_dispose(&buf);
|
103
|
+
git_str_dispose(&path);
|
100
104
|
|
101
105
|
return NULL;
|
102
106
|
}
|
103
107
|
|
104
|
-
static int write_wtfile(const char *base, const char *file, const
|
108
|
+
static int write_wtfile(const char *base, const char *file, const git_str *buf)
|
105
109
|
{
|
106
|
-
|
110
|
+
git_str path = GIT_STR_INIT;
|
107
111
|
int err;
|
108
112
|
|
109
|
-
|
113
|
+
GIT_ASSERT_ARG(base);
|
114
|
+
GIT_ASSERT_ARG(file);
|
115
|
+
GIT_ASSERT_ARG(buf);
|
110
116
|
|
111
|
-
if ((err =
|
117
|
+
if ((err = git_str_joinpath(&path, base, file)) < 0)
|
112
118
|
goto out;
|
113
119
|
|
114
120
|
if ((err = git_futils_writebuffer(buf, path.ptr, O_CREAT|O_EXCL|O_WRONLY, 0644)) < 0)
|
115
121
|
goto out;
|
116
122
|
|
117
123
|
out:
|
118
|
-
|
124
|
+
git_str_dispose(&path);
|
119
125
|
|
120
126
|
return err;
|
121
127
|
}
|
122
128
|
|
123
129
|
static int open_worktree_dir(git_worktree **out, const char *parent, const char *dir, const char *name)
|
124
130
|
{
|
125
|
-
|
131
|
+
git_str gitdir = GIT_STR_INIT;
|
126
132
|
git_worktree *wt = NULL;
|
127
133
|
int error = 0;
|
128
134
|
|
@@ -131,6 +137,9 @@ static int open_worktree_dir(git_worktree **out, const char *parent, const char
|
|
131
137
|
goto out;
|
132
138
|
}
|
133
139
|
|
140
|
+
if ((error = git_path_validate_length(NULL, dir)) < 0)
|
141
|
+
goto out;
|
142
|
+
|
134
143
|
if ((wt = git__calloc(1, sizeof(*wt))) == NULL) {
|
135
144
|
error = -1;
|
136
145
|
goto out;
|
@@ -140,14 +149,14 @@ static int open_worktree_dir(git_worktree **out, const char *parent, const char
|
|
140
149
|
(wt->commondir_path = git_worktree__read_link(dir, "commondir")) == NULL ||
|
141
150
|
(wt->gitlink_path = git_worktree__read_link(dir, "gitdir")) == NULL ||
|
142
151
|
(parent && (wt->parent_path = git__strdup(parent)) == NULL) ||
|
143
|
-
(wt->worktree_path =
|
152
|
+
(wt->worktree_path = git_fs_path_dirname(wt->gitlink_path)) == NULL) {
|
144
153
|
error = -1;
|
145
154
|
goto out;
|
146
155
|
}
|
147
156
|
|
148
|
-
if ((error =
|
157
|
+
if ((error = git_fs_path_prettify_dir(&gitdir, dir, NULL)) < 0)
|
149
158
|
goto out;
|
150
|
-
wt->gitdir_path =
|
159
|
+
wt->gitdir_path = git_str_detach(&gitdir);
|
151
160
|
|
152
161
|
if ((error = git_worktree_is_locked(NULL, wt)) < 0)
|
153
162
|
goto out;
|
@@ -159,29 +168,30 @@ static int open_worktree_dir(git_worktree **out, const char *parent, const char
|
|
159
168
|
out:
|
160
169
|
if (error)
|
161
170
|
git_worktree_free(wt);
|
162
|
-
|
171
|
+
git_str_dispose(&gitdir);
|
163
172
|
|
164
173
|
return error;
|
165
174
|
}
|
166
175
|
|
167
176
|
int git_worktree_lookup(git_worktree **out, git_repository *repo, const char *name)
|
168
177
|
{
|
169
|
-
|
178
|
+
git_str path = GIT_STR_INIT;
|
170
179
|
git_worktree *wt = NULL;
|
171
180
|
int error;
|
172
181
|
|
173
|
-
|
182
|
+
GIT_ASSERT_ARG(repo);
|
183
|
+
GIT_ASSERT_ARG(name);
|
174
184
|
|
175
185
|
*out = NULL;
|
176
186
|
|
177
|
-
if ((error =
|
187
|
+
if ((error = git_str_join3(&path, '/', repo->commondir, "worktrees", name)) < 0)
|
178
188
|
goto out;
|
179
189
|
|
180
190
|
if ((error = (open_worktree_dir(out, git_repository_workdir(repo), path.ptr, name))) < 0)
|
181
191
|
goto out;
|
182
192
|
|
183
193
|
out:
|
184
|
-
|
194
|
+
git_str_dispose(&path);
|
185
195
|
|
186
196
|
if (error)
|
187
197
|
git_worktree_free(wt);
|
@@ -191,7 +201,7 @@ out:
|
|
191
201
|
|
192
202
|
int git_worktree_open_from_repository(git_worktree **out, git_repository *repo)
|
193
203
|
{
|
194
|
-
|
204
|
+
git_str parent = GIT_STR_INIT;
|
195
205
|
const char *gitdir, *commondir;
|
196
206
|
char *name = NULL;
|
197
207
|
int error = 0;
|
@@ -205,18 +215,18 @@ int git_worktree_open_from_repository(git_worktree **out, git_repository *repo)
|
|
205
215
|
gitdir = git_repository_path(repo);
|
206
216
|
commondir = git_repository_commondir(repo);
|
207
217
|
|
208
|
-
if ((error =
|
218
|
+
if ((error = git_fs_path_prettify_dir(&parent, "..", commondir)) < 0)
|
209
219
|
goto out;
|
210
220
|
|
211
221
|
/* The name is defined by the last component in '.git/worktree/%s' */
|
212
|
-
name =
|
222
|
+
name = git_fs_path_basename(gitdir);
|
213
223
|
|
214
224
|
if ((error = open_worktree_dir(out, parent.ptr, gitdir, name)) < 0)
|
215
225
|
goto out;
|
216
226
|
|
217
227
|
out:
|
218
228
|
git__free(name);
|
219
|
-
|
229
|
+
git_str_dispose(&parent);
|
220
230
|
|
221
231
|
return error;
|
222
232
|
}
|
@@ -237,7 +247,7 @@ void git_worktree_free(git_worktree *wt)
|
|
237
247
|
|
238
248
|
int git_worktree_validate(const git_worktree *wt)
|
239
249
|
{
|
240
|
-
|
250
|
+
GIT_ASSERT_ARG(wt);
|
241
251
|
|
242
252
|
if (!is_worktree_dir(wt->gitdir_path)) {
|
243
253
|
git_error_set(GIT_ERROR_WORKTREE,
|
@@ -246,27 +256,27 @@ int git_worktree_validate(const git_worktree *wt)
|
|
246
256
|
return GIT_ERROR;
|
247
257
|
}
|
248
258
|
|
249
|
-
if (wt->parent_path && !
|
259
|
+
if (wt->parent_path && !git_fs_path_exists(wt->parent_path)) {
|
250
260
|
git_error_set(GIT_ERROR_WORKTREE,
|
251
261
|
"worktree parent directory ('%s') does not exist ",
|
252
262
|
wt->parent_path);
|
253
263
|
return GIT_ERROR;
|
254
264
|
}
|
255
265
|
|
256
|
-
if (!
|
266
|
+
if (!git_fs_path_exists(wt->commondir_path)) {
|
257
267
|
git_error_set(GIT_ERROR_WORKTREE,
|
258
268
|
"worktree common directory ('%s') does not exist ",
|
259
269
|
wt->commondir_path);
|
260
270
|
return GIT_ERROR;
|
261
271
|
}
|
262
|
-
|
263
|
-
if (!
|
272
|
+
|
273
|
+
if (!git_fs_path_exists(wt->worktree_path)) {
|
264
274
|
git_error_set(GIT_ERROR_WORKTREE,
|
265
275
|
"worktree directory '%s' does not exist",
|
266
276
|
wt->worktree_path);
|
267
277
|
return GIT_ERROR;
|
268
278
|
}
|
269
|
-
|
279
|
+
|
270
280
|
return 0;
|
271
281
|
}
|
272
282
|
|
@@ -290,23 +300,28 @@ int git_worktree_add(git_worktree **out, git_repository *repo,
|
|
290
300
|
const char *name, const char *worktree,
|
291
301
|
const git_worktree_add_options *opts)
|
292
302
|
{
|
293
|
-
|
303
|
+
git_str gitdir = GIT_STR_INIT, wddir = GIT_STR_INIT, buf = GIT_STR_INIT;
|
294
304
|
git_reference *ref = NULL, *head = NULL;
|
295
305
|
git_commit *commit = NULL;
|
296
306
|
git_repository *wt = NULL;
|
297
|
-
git_checkout_options coopts
|
307
|
+
git_checkout_options coopts;
|
298
308
|
git_worktree_add_options wtopts = GIT_WORKTREE_ADD_OPTIONS_INIT;
|
299
309
|
int err;
|
300
310
|
|
301
311
|
GIT_ERROR_CHECK_VERSION(
|
302
312
|
opts, GIT_WORKTREE_ADD_OPTIONS_VERSION, "git_worktree_add_options");
|
303
313
|
|
314
|
+
GIT_ASSERT_ARG(out);
|
315
|
+
GIT_ASSERT_ARG(repo);
|
316
|
+
GIT_ASSERT_ARG(name);
|
317
|
+
GIT_ASSERT_ARG(worktree);
|
318
|
+
|
319
|
+
*out = NULL;
|
320
|
+
|
304
321
|
if (opts)
|
305
322
|
memcpy(&wtopts, opts, sizeof(wtopts));
|
306
323
|
|
307
|
-
|
308
|
-
|
309
|
-
*out = NULL;
|
324
|
+
memcpy(&coopts, &wtopts.checkout_options, sizeof(coopts));
|
310
325
|
|
311
326
|
if (wtopts.ref) {
|
312
327
|
if (!git_reference_is_branch(wtopts.ref)) {
|
@@ -323,28 +338,28 @@ int git_worktree_add(git_worktree **out, git_repository *repo,
|
|
323
338
|
}
|
324
339
|
|
325
340
|
/* Create gitdir directory ".git/worktrees/<name>" */
|
326
|
-
if ((err =
|
341
|
+
if ((err = git_str_joinpath(&gitdir, repo->commondir, "worktrees")) < 0)
|
327
342
|
goto out;
|
328
|
-
if (!
|
343
|
+
if (!git_fs_path_exists(gitdir.ptr))
|
329
344
|
if ((err = git_futils_mkdir(gitdir.ptr, 0755, GIT_MKDIR_EXCL)) < 0)
|
330
345
|
goto out;
|
331
|
-
if ((err =
|
346
|
+
if ((err = git_str_joinpath(&gitdir, gitdir.ptr, name)) < 0)
|
332
347
|
goto out;
|
333
348
|
if ((err = git_futils_mkdir(gitdir.ptr, 0755, GIT_MKDIR_EXCL)) < 0)
|
334
349
|
goto out;
|
335
|
-
if ((err =
|
350
|
+
if ((err = git_fs_path_prettify_dir(&gitdir, gitdir.ptr, NULL)) < 0)
|
336
351
|
goto out;
|
337
352
|
|
338
353
|
/* Create worktree work dir */
|
339
354
|
if ((err = git_futils_mkdir(worktree, 0755, GIT_MKDIR_EXCL)) < 0)
|
340
355
|
goto out;
|
341
|
-
if ((err =
|
356
|
+
if ((err = git_fs_path_prettify_dir(&wddir, worktree, NULL)) < 0)
|
342
357
|
goto out;
|
343
358
|
|
344
359
|
if (wtopts.lock) {
|
345
360
|
int fd;
|
346
361
|
|
347
|
-
if ((err =
|
362
|
+
if ((err = git_str_joinpath(&buf, gitdir.ptr, "locked")) < 0)
|
348
363
|
goto out;
|
349
364
|
|
350
365
|
if ((fd = p_creat(buf.ptr, 0644)) < 0) {
|
@@ -353,22 +368,22 @@ int git_worktree_add(git_worktree **out, git_repository *repo,
|
|
353
368
|
}
|
354
369
|
|
355
370
|
p_close(fd);
|
356
|
-
|
371
|
+
git_str_clear(&buf);
|
357
372
|
}
|
358
373
|
|
359
374
|
/* Create worktree .git file */
|
360
|
-
if ((err =
|
375
|
+
if ((err = git_str_printf(&buf, "gitdir: %s\n", gitdir.ptr)) < 0)
|
361
376
|
goto out;
|
362
377
|
if ((err = write_wtfile(wddir.ptr, ".git", &buf)) < 0)
|
363
378
|
goto out;
|
364
379
|
|
365
380
|
/* Create gitdir files */
|
366
|
-
if ((err =
|
367
|
-
|| (err =
|
381
|
+
if ((err = git_fs_path_prettify_dir(&buf, repo->commondir, NULL) < 0)
|
382
|
+
|| (err = git_str_putc(&buf, '\n')) < 0
|
368
383
|
|| (err = write_wtfile(gitdir.ptr, "commondir", &buf)) < 0)
|
369
384
|
goto out;
|
370
|
-
if ((err =
|
371
|
-
|| (err =
|
385
|
+
if ((err = git_str_joinpath(&buf, wddir.ptr, ".git")) < 0
|
386
|
+
|| (err = git_str_putc(&buf, '\n')) < 0
|
372
387
|
|| (err = write_wtfile(gitdir.ptr, "gitdir", &buf)) < 0)
|
373
388
|
goto out;
|
374
389
|
|
@@ -392,7 +407,6 @@ int git_worktree_add(git_worktree **out, git_repository *repo,
|
|
392
407
|
goto out;
|
393
408
|
|
394
409
|
/* Checkout worktree's HEAD */
|
395
|
-
coopts.checkout_strategy = GIT_CHECKOUT_FORCE;
|
396
410
|
if ((err = git_checkout_head(wt, &coopts)) < 0)
|
397
411
|
goto out;
|
398
412
|
|
@@ -401,9 +415,9 @@ int git_worktree_add(git_worktree **out, git_repository *repo,
|
|
401
415
|
goto out;
|
402
416
|
|
403
417
|
out:
|
404
|
-
|
405
|
-
|
406
|
-
|
418
|
+
git_str_dispose(&gitdir);
|
419
|
+
git_str_dispose(&wddir);
|
420
|
+
git_str_dispose(&buf);
|
407
421
|
git_reference_free(ref);
|
408
422
|
git_reference_free(head);
|
409
423
|
git_commit_free(commit);
|
@@ -414,10 +428,10 @@ out:
|
|
414
428
|
|
415
429
|
int git_worktree_lock(git_worktree *wt, const char *reason)
|
416
430
|
{
|
417
|
-
|
431
|
+
git_str buf = GIT_STR_INIT, path = GIT_STR_INIT;
|
418
432
|
int error;
|
419
433
|
|
420
|
-
|
434
|
+
GIT_ASSERT_ARG(wt);
|
421
435
|
|
422
436
|
if ((error = git_worktree_is_locked(NULL, wt)) < 0)
|
423
437
|
goto out;
|
@@ -426,11 +440,11 @@ int git_worktree_lock(git_worktree *wt, const char *reason)
|
|
426
440
|
goto out;
|
427
441
|
}
|
428
442
|
|
429
|
-
if ((error =
|
443
|
+
if ((error = git_str_joinpath(&path, wt->gitdir_path, "locked")) < 0)
|
430
444
|
goto out;
|
431
445
|
|
432
446
|
if (reason)
|
433
|
-
|
447
|
+
git_str_attach_notowned(&buf, reason, strlen(reason));
|
434
448
|
|
435
449
|
if ((error = git_futils_writebuffer(&buf, path.ptr, O_CREAT|O_EXCL|O_WRONLY, 0644)) < 0)
|
436
450
|
goto out;
|
@@ -438,71 +452,90 @@ int git_worktree_lock(git_worktree *wt, const char *reason)
|
|
438
452
|
wt->locked = 1;
|
439
453
|
|
440
454
|
out:
|
441
|
-
|
455
|
+
git_str_dispose(&path);
|
442
456
|
|
443
457
|
return error;
|
444
458
|
}
|
445
459
|
|
446
460
|
int git_worktree_unlock(git_worktree *wt)
|
447
461
|
{
|
448
|
-
|
462
|
+
git_str path = GIT_STR_INIT;
|
449
463
|
int error;
|
450
464
|
|
451
|
-
|
465
|
+
GIT_ASSERT_ARG(wt);
|
452
466
|
|
453
467
|
if ((error = git_worktree_is_locked(NULL, wt)) < 0)
|
454
468
|
return error;
|
455
469
|
if (!error)
|
456
470
|
return 1;
|
457
471
|
|
458
|
-
if (
|
472
|
+
if (git_str_joinpath(&path, wt->gitdir_path, "locked") < 0)
|
459
473
|
return -1;
|
460
474
|
|
461
475
|
if (p_unlink(path.ptr) != 0) {
|
462
|
-
|
476
|
+
git_str_dispose(&path);
|
463
477
|
return -1;
|
464
478
|
}
|
465
479
|
|
466
480
|
wt->locked = 0;
|
467
481
|
|
468
|
-
|
482
|
+
git_str_dispose(&path);
|
469
483
|
|
470
484
|
return 0;
|
471
485
|
}
|
472
486
|
|
473
|
-
int
|
487
|
+
static int git_worktree__is_locked(git_str *reason, const git_worktree *wt)
|
474
488
|
{
|
475
|
-
|
489
|
+
git_str path = GIT_STR_INIT;
|
476
490
|
int error, locked;
|
477
491
|
|
478
|
-
|
492
|
+
GIT_ASSERT_ARG(wt);
|
479
493
|
|
480
494
|
if (reason)
|
481
|
-
|
495
|
+
git_str_clear(reason);
|
482
496
|
|
483
|
-
if ((error =
|
497
|
+
if ((error = git_str_joinpath(&path, wt->gitdir_path, "locked")) < 0)
|
484
498
|
goto out;
|
485
|
-
locked =
|
499
|
+
locked = git_fs_path_exists(path.ptr);
|
486
500
|
if (locked && reason &&
|
487
501
|
(error = git_futils_readbuffer(reason, path.ptr)) < 0)
|
488
502
|
goto out;
|
489
503
|
|
490
504
|
error = locked;
|
491
505
|
out:
|
492
|
-
|
506
|
+
git_str_dispose(&path);
|
507
|
+
|
508
|
+
return error;
|
509
|
+
}
|
510
|
+
|
511
|
+
int git_worktree_is_locked(git_buf *reason, const git_worktree *wt)
|
512
|
+
{
|
513
|
+
git_str str = GIT_STR_INIT;
|
514
|
+
int error = 0;
|
515
|
+
|
516
|
+
if (reason && (error = git_buf_tostr(&str, reason)) < 0)
|
517
|
+
return error;
|
518
|
+
|
519
|
+
error = git_worktree__is_locked(reason ? &str : NULL, wt);
|
520
|
+
|
521
|
+
if (error >= 0 && reason) {
|
522
|
+
if (git_buf_fromstr(reason, &str) < 0)
|
523
|
+
error = -1;
|
524
|
+
}
|
493
525
|
|
526
|
+
git_str_dispose(&str);
|
494
527
|
return error;
|
495
528
|
}
|
496
529
|
|
497
530
|
const char *git_worktree_name(const git_worktree *wt)
|
498
531
|
{
|
499
|
-
|
532
|
+
GIT_ASSERT_ARG_WITH_RETVAL(wt, NULL);
|
500
533
|
return wt->name;
|
501
534
|
}
|
502
535
|
|
503
536
|
const char *git_worktree_path(const git_worktree *wt)
|
504
537
|
{
|
505
|
-
|
538
|
+
GIT_ASSERT_ARG_WITH_RETVAL(wt, NULL);
|
506
539
|
return wt->worktree_path;
|
507
540
|
}
|
508
541
|
|
@@ -536,17 +569,17 @@ int git_worktree_is_prunable(git_worktree *wt,
|
|
536
569
|
memcpy(&popts, opts, sizeof(popts));
|
537
570
|
|
538
571
|
if ((popts.flags & GIT_WORKTREE_PRUNE_LOCKED) == 0) {
|
539
|
-
|
572
|
+
git_str reason = GIT_STR_INIT;
|
540
573
|
int error;
|
541
574
|
|
542
|
-
if ((error =
|
575
|
+
if ((error = git_worktree__is_locked(&reason, wt)) < 0)
|
543
576
|
return error;
|
544
577
|
|
545
578
|
if (error) {
|
546
579
|
if (!reason.size)
|
547
|
-
|
580
|
+
git_str_attach_notowned(&reason, "no reason given", 15);
|
548
581
|
git_error_set(GIT_ERROR_WORKTREE, "not pruning locked working tree: '%s'", reason.ptr);
|
549
|
-
|
582
|
+
git_str_dispose(&reason);
|
550
583
|
return 0;
|
551
584
|
}
|
552
585
|
}
|
@@ -564,7 +597,7 @@ int git_worktree_prune(git_worktree *wt,
|
|
564
597
|
git_worktree_prune_options *opts)
|
565
598
|
{
|
566
599
|
git_worktree_prune_options popts = GIT_WORKTREE_PRUNE_OPTIONS_INIT;
|
567
|
-
|
600
|
+
git_str path = GIT_STR_INIT;
|
568
601
|
char *wtpath;
|
569
602
|
int err;
|
570
603
|
|
@@ -581,9 +614,9 @@ int git_worktree_prune(git_worktree *wt,
|
|
581
614
|
}
|
582
615
|
|
583
616
|
/* Delete gitdir in parent repository */
|
584
|
-
if ((err =
|
617
|
+
if ((err = git_str_join3(&path, '/', wt->commondir_path, "worktrees", wt->name)) < 0)
|
585
618
|
goto out;
|
586
|
-
if (!
|
619
|
+
if (!git_fs_path_exists(path.ptr))
|
587
620
|
{
|
588
621
|
git_error_set(GIT_ERROR_WORKTREE, "worktree gitdir '%s' does not exist", path.ptr);
|
589
622
|
err = -1;
|
@@ -595,15 +628,15 @@ int git_worktree_prune(git_worktree *wt,
|
|
595
628
|
/* Skip deletion of the actual working tree if it does
|
596
629
|
* not exist or deletion was not requested */
|
597
630
|
if ((popts.flags & GIT_WORKTREE_PRUNE_WORKING_TREE) == 0 ||
|
598
|
-
!
|
631
|
+
!git_fs_path_exists(wt->gitlink_path))
|
599
632
|
{
|
600
633
|
goto out;
|
601
634
|
}
|
602
635
|
|
603
|
-
if ((wtpath =
|
636
|
+
if ((wtpath = git_fs_path_dirname(wt->gitlink_path)) == NULL)
|
604
637
|
goto out;
|
605
|
-
|
606
|
-
if (!
|
638
|
+
git_str_attach(&path, wtpath, 0);
|
639
|
+
if (!git_fs_path_exists(path.ptr))
|
607
640
|
{
|
608
641
|
git_error_set(GIT_ERROR_WORKTREE, "working tree '%s' does not exist", path.ptr);
|
609
642
|
err = -1;
|
@@ -613,7 +646,7 @@ int git_worktree_prune(git_worktree *wt,
|
|
613
646
|
goto out;
|
614
647
|
|
615
648
|
out:
|
616
|
-
|
649
|
+
git_str_dispose(&path);
|
617
650
|
|
618
651
|
return err;
|
619
652
|
}
|
@@ -0,0 +1,53 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright (C) the libgit2 contributors. All rights reserved.
|
3
|
+
*
|
4
|
+
* This file is part of libgit2, distributed under the GNU GPL v2 with
|
5
|
+
* a Linking Exception. For full terms see the included COPYING file.
|
6
|
+
*/
|
7
|
+
|
8
|
+
/*
|
9
|
+
* This file provides the necessary indirection between xdiff and
|
10
|
+
* libgit2. libgit2-specific functionality should live here, so
|
11
|
+
* that git and libgit2 can share a common xdiff implementation.
|
12
|
+
*/
|
13
|
+
|
14
|
+
#ifndef INCLUDE_git_xdiff_h__
|
15
|
+
#define INCLUDE_git_xdiff_h__
|
16
|
+
|
17
|
+
#include "regexp.h"
|
18
|
+
|
19
|
+
/* Work around C90-conformance issues */
|
20
|
+
#if !defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L)
|
21
|
+
# if defined(_MSC_VER)
|
22
|
+
# define inline __inline
|
23
|
+
# elif defined(__GNUC__)
|
24
|
+
# define inline __inline__
|
25
|
+
# else
|
26
|
+
# define inline
|
27
|
+
# endif
|
28
|
+
#endif
|
29
|
+
|
30
|
+
#define xdl_malloc(x) git__malloc(x)
|
31
|
+
#define xdl_free(ptr) git__free(ptr)
|
32
|
+
#define xdl_realloc(ptr, x) git__realloc(ptr, x)
|
33
|
+
|
34
|
+
#define XDL_BUG(msg) GIT_ASSERT(msg)
|
35
|
+
|
36
|
+
#define xdl_regex_t git_regexp
|
37
|
+
#define xdl_regmatch_t git_regmatch
|
38
|
+
|
39
|
+
GIT_INLINE(int) xdl_regexec_buf(
|
40
|
+
const xdl_regex_t *preg, const char *buf, size_t size,
|
41
|
+
size_t nmatch, xdl_regmatch_t pmatch[], int eflags)
|
42
|
+
{
|
43
|
+
GIT_UNUSED(preg);
|
44
|
+
GIT_UNUSED(buf);
|
45
|
+
GIT_UNUSED(size);
|
46
|
+
GIT_UNUSED(nmatch);
|
47
|
+
GIT_UNUSED(pmatch);
|
48
|
+
GIT_UNUSED(eflags);
|
49
|
+
GIT_ASSERT("not implemented");
|
50
|
+
return -1;
|
51
|
+
}
|
52
|
+
|
53
|
+
#endif
|