rugged 0.28.5 → 0.99.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/rugged/extconf.rb +3 -1
- data/ext/rugged/rugged.c +35 -31
- data/ext/rugged/rugged.h +13 -0
- data/ext/rugged/rugged_blob.c +11 -9
- data/ext/rugged/rugged_commit.c +17 -15
- data/ext/rugged/rugged_diff.c +4 -26
- data/ext/rugged/rugged_index.c +4 -2
- data/ext/rugged/rugged_note.c +5 -3
- data/ext/rugged/rugged_object.c +57 -10
- data/ext/rugged/rugged_rebase.c +3 -1
- data/ext/rugged/rugged_remote.c +0 -6
- data/ext/rugged/rugged_repo.c +222 -17
- data/ext/rugged/rugged_tag.c +8 -6
- data/ext/rugged/rugged_tree.c +18 -16
- data/lib/rugged/version.rb +1 -1
- data/vendor/libgit2/CMakeLists.txt +38 -19
- data/vendor/libgit2/COPYING +28 -0
- data/vendor/libgit2/cmake/Modules/EnableWarnings.cmake +5 -1
- 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/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 +1422 -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/zlib/adler32.c +0 -7
- data/vendor/libgit2/deps/zlib/crc32.c +0 -7
- data/vendor/libgit2/include/git2.h +2 -0
- data/vendor/libgit2/include/git2/apply.h +22 -2
- data/vendor/libgit2/include/git2/attr.h +23 -13
- data/vendor/libgit2/include/git2/blame.h +2 -2
- data/vendor/libgit2/include/git2/blob.h +44 -12
- data/vendor/libgit2/include/git2/branch.h +74 -57
- data/vendor/libgit2/include/git2/buffer.h +20 -14
- data/vendor/libgit2/include/git2/cert.h +135 -0
- data/vendor/libgit2/include/git2/checkout.h +46 -14
- data/vendor/libgit2/include/git2/cherrypick.h +3 -3
- data/vendor/libgit2/include/git2/clone.h +2 -2
- data/vendor/libgit2/include/git2/commit.h +23 -1
- data/vendor/libgit2/include/git2/common.h +15 -6
- data/vendor/libgit2/include/git2/config.h +12 -12
- data/vendor/libgit2/include/git2/cred_helpers.h +4 -42
- data/vendor/libgit2/include/git2/credential.h +314 -0
- data/vendor/libgit2/include/git2/credential_helpers.h +52 -0
- data/vendor/libgit2/include/git2/deprecated.h +314 -3
- data/vendor/libgit2/include/git2/describe.h +4 -4
- data/vendor/libgit2/include/git2/diff.h +16 -14
- data/vendor/libgit2/include/git2/errors.h +4 -2
- data/vendor/libgit2/include/git2/filter.h +8 -0
- data/vendor/libgit2/include/git2/index.h +2 -1
- data/vendor/libgit2/include/git2/indexer.h +48 -4
- data/vendor/libgit2/include/git2/merge.h +6 -10
- data/vendor/libgit2/include/git2/net.h +0 -5
- data/vendor/libgit2/include/git2/object.h +2 -14
- data/vendor/libgit2/include/git2/odb.h +3 -2
- data/vendor/libgit2/include/git2/odb_backend.h +5 -4
- data/vendor/libgit2/include/git2/oid.h +11 -6
- data/vendor/libgit2/include/git2/pack.h +12 -1
- data/vendor/libgit2/include/git2/proxy.h +6 -4
- data/vendor/libgit2/include/git2/rebase.h +46 -2
- data/vendor/libgit2/include/git2/refs.h +19 -0
- data/vendor/libgit2/include/git2/remote.h +40 -15
- data/vendor/libgit2/include/git2/repository.h +24 -2
- data/vendor/libgit2/include/git2/revert.h +1 -1
- data/vendor/libgit2/include/git2/revwalk.h +7 -3
- data/vendor/libgit2/include/git2/stash.h +4 -4
- data/vendor/libgit2/include/git2/status.h +25 -16
- data/vendor/libgit2/include/git2/submodule.h +20 -3
- data/vendor/libgit2/include/git2/sys/alloc.h +9 -9
- data/vendor/libgit2/include/git2/sys/cred.h +15 -0
- data/vendor/libgit2/include/git2/sys/credential.h +90 -0
- data/vendor/libgit2/include/git2/sys/index.h +4 -2
- data/vendor/libgit2/include/git2/sys/mempack.h +2 -1
- data/vendor/libgit2/include/git2/sys/merge.h +1 -1
- data/vendor/libgit2/include/git2/sys/odb_backend.h +48 -4
- data/vendor/libgit2/include/git2/sys/refdb_backend.h +57 -21
- data/vendor/libgit2/include/git2/sys/repository.h +17 -6
- data/vendor/libgit2/include/git2/sys/transport.h +4 -4
- data/vendor/libgit2/include/git2/tag.h +11 -2
- data/vendor/libgit2/include/git2/trace.h +2 -2
- data/vendor/libgit2/include/git2/transport.h +11 -340
- data/vendor/libgit2/include/git2/tree.h +5 -3
- data/vendor/libgit2/include/git2/types.h +4 -89
- data/vendor/libgit2/include/git2/version.h +4 -4
- data/vendor/libgit2/include/git2/worktree.h +5 -5
- data/vendor/libgit2/src/CMakeLists.txt +89 -224
- data/vendor/libgit2/src/alloc.c +2 -14
- data/vendor/libgit2/src/{stdalloc.c → allocators/stdalloc.c} +3 -4
- 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/apply.c +31 -15
- data/vendor/libgit2/src/attr.c +70 -64
- data/vendor/libgit2/src/attr_file.c +189 -96
- data/vendor/libgit2/src/attr_file.h +9 -9
- data/vendor/libgit2/src/attrcache.c +47 -47
- data/vendor/libgit2/src/attrcache.h +2 -1
- data/vendor/libgit2/src/blame.c +17 -5
- data/vendor/libgit2/src/blame.h +1 -1
- data/vendor/libgit2/src/blame_git.c +21 -7
- data/vendor/libgit2/src/blob.c +81 -17
- data/vendor/libgit2/src/blob.h +2 -2
- data/vendor/libgit2/src/branch.c +60 -32
- data/vendor/libgit2/src/buffer.c +5 -0
- data/vendor/libgit2/src/buffer.h +1 -0
- data/vendor/libgit2/src/cache.c +26 -33
- data/vendor/libgit2/src/cache.h +1 -1
- data/vendor/libgit2/src/cc-compat.h +5 -0
- data/vendor/libgit2/src/checkout.c +26 -16
- data/vendor/libgit2/src/cherrypick.c +7 -1
- data/vendor/libgit2/src/clone.c +29 -7
- data/vendor/libgit2/src/clone.h +4 -0
- data/vendor/libgit2/src/commit.c +70 -22
- data/vendor/libgit2/src/commit.h +6 -0
- data/vendor/libgit2/src/commit_list.c +28 -76
- data/vendor/libgit2/src/commit_list.h +2 -2
- data/vendor/libgit2/src/common.h +3 -75
- data/vendor/libgit2/src/config.c +31 -40
- data/vendor/libgit2/src/config.h +7 -6
- data/vendor/libgit2/src/config_backend.h +12 -0
- data/vendor/libgit2/src/config_cache.c +39 -39
- data/vendor/libgit2/src/config_entries.c +69 -99
- data/vendor/libgit2/src/config_entries.h +1 -0
- data/vendor/libgit2/src/config_file.c +337 -380
- data/vendor/libgit2/src/config_mem.c +12 -16
- data/vendor/libgit2/src/config_parse.c +49 -29
- data/vendor/libgit2/src/config_parse.h +13 -12
- data/vendor/libgit2/src/config_snapshot.c +206 -0
- data/vendor/libgit2/src/crlf.c +14 -14
- data/vendor/libgit2/src/describe.c +21 -20
- data/vendor/libgit2/src/diff.c +43 -66
- data/vendor/libgit2/src/diff.h +4 -3
- data/vendor/libgit2/src/diff_driver.c +37 -38
- data/vendor/libgit2/src/diff_file.c +12 -10
- data/vendor/libgit2/src/diff_file.h +2 -2
- data/vendor/libgit2/src/diff_generate.c +26 -26
- data/vendor/libgit2/src/diff_generate.h +2 -2
- data/vendor/libgit2/src/diff_parse.c +1 -1
- data/vendor/libgit2/src/diff_print.c +25 -13
- data/vendor/libgit2/src/diff_stats.c +1 -1
- data/vendor/libgit2/src/diff_tform.c +11 -11
- data/vendor/libgit2/src/errors.c +21 -25
- data/vendor/libgit2/src/errors.h +81 -0
- data/vendor/libgit2/src/features.h.in +9 -2
- data/vendor/libgit2/src/fetch.c +7 -2
- data/vendor/libgit2/src/fetchhead.c +9 -9
- data/vendor/libgit2/src/filebuf.c +1 -1
- data/vendor/libgit2/src/filebuf.h +1 -1
- data/vendor/libgit2/src/filter.c +16 -8
- data/vendor/libgit2/src/{fileops.c → futils.c} +20 -17
- data/vendor/libgit2/src/{fileops.h → futils.h} +5 -5
- data/vendor/libgit2/src/hash.c +61 -0
- data/vendor/libgit2/src/hash.h +19 -21
- data/vendor/libgit2/src/hash/sha1.h +38 -0
- data/vendor/libgit2/src/hash/{hash_collisiondetect.h → sha1/collisiondetect.c} +14 -17
- data/vendor/libgit2/src/hash/sha1/collisiondetect.h +19 -0
- data/vendor/libgit2/src/hash/{hash_common_crypto.h → sha1/common_crypto.c} +15 -19
- 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 -14
- 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 -11
- data/vendor/libgit2/src/hash/{hash_openssl.h → sha1/openssl.c} +14 -18
- 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/{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/hash/{hash_win32.c → sha1/win32.c} +34 -24
- data/vendor/libgit2/src/hash/{hash_win32.h → sha1/win32.h} +6 -19
- data/vendor/libgit2/src/hashsig.c +1 -1
- data/vendor/libgit2/src/idxmap.c +91 -65
- data/vendor/libgit2/src/idxmap.h +151 -15
- data/vendor/libgit2/src/ignore.c +26 -35
- data/vendor/libgit2/src/index.c +103 -81
- data/vendor/libgit2/src/index.h +1 -1
- data/vendor/libgit2/src/indexer.c +69 -70
- data/vendor/libgit2/src/integer.h +11 -4
- data/vendor/libgit2/src/iterator.c +32 -28
- data/vendor/libgit2/src/iterator.h +8 -8
- data/vendor/libgit2/src/map.h +1 -1
- data/vendor/libgit2/src/merge.c +55 -41
- data/vendor/libgit2/src/merge.h +2 -2
- data/vendor/libgit2/src/merge_driver.c +5 -5
- data/vendor/libgit2/src/merge_file.c +1 -1
- data/vendor/libgit2/src/mwindow.c +18 -23
- data/vendor/libgit2/src/mwindow.h +4 -4
- data/vendor/libgit2/src/net.c +411 -0
- data/vendor/libgit2/src/net.h +57 -0
- data/vendor/libgit2/src/netops.c +6 -222
- data/vendor/libgit2/src/netops.h +1 -37
- data/vendor/libgit2/src/notes.c +2 -2
- data/vendor/libgit2/src/object.c +3 -3
- data/vendor/libgit2/src/object.h +2 -0
- data/vendor/libgit2/src/odb.c +41 -23
- data/vendor/libgit2/src/odb.h +3 -2
- data/vendor/libgit2/src/odb_loose.c +17 -10
- data/vendor/libgit2/src/odb_mempack.c +13 -24
- data/vendor/libgit2/src/odb_pack.c +4 -4
- data/vendor/libgit2/src/offmap.c +43 -55
- data/vendor/libgit2/src/offmap.h +102 -24
- data/vendor/libgit2/src/oid.c +19 -8
- data/vendor/libgit2/src/oidmap.c +39 -57
- data/vendor/libgit2/src/oidmap.h +99 -19
- data/vendor/libgit2/src/pack-objects.c +25 -32
- data/vendor/libgit2/src/pack-objects.h +1 -1
- data/vendor/libgit2/src/pack.c +97 -129
- data/vendor/libgit2/src/pack.h +15 -18
- data/vendor/libgit2/src/parse.c +10 -0
- data/vendor/libgit2/src/parse.h +3 -3
- data/vendor/libgit2/src/patch.c +1 -1
- data/vendor/libgit2/src/patch_generate.c +1 -1
- data/vendor/libgit2/src/patch_parse.c +30 -9
- data/vendor/libgit2/src/path.c +43 -6
- data/vendor/libgit2/src/path.h +2 -0
- data/vendor/libgit2/src/pathspec.c +14 -14
- data/vendor/libgit2/src/pool.c +26 -22
- data/vendor/libgit2/src/pool.h +7 -7
- data/vendor/libgit2/src/posix.c +7 -7
- data/vendor/libgit2/src/posix.h +12 -1
- data/vendor/libgit2/src/proxy.c +7 -2
- data/vendor/libgit2/src/push.c +10 -5
- data/vendor/libgit2/src/reader.c +2 -2
- data/vendor/libgit2/src/rebase.c +87 -28
- data/vendor/libgit2/src/refdb.c +12 -0
- data/vendor/libgit2/src/refdb_fs.c +215 -169
- data/vendor/libgit2/src/reflog.c +11 -13
- data/vendor/libgit2/src/refs.c +34 -23
- data/vendor/libgit2/src/refs.h +8 -1
- data/vendor/libgit2/src/refspec.c +9 -16
- data/vendor/libgit2/src/regexp.c +221 -0
- data/vendor/libgit2/src/regexp.h +97 -0
- data/vendor/libgit2/src/remote.c +57 -55
- data/vendor/libgit2/src/remote.h +2 -2
- data/vendor/libgit2/src/repository.c +120 -103
- data/vendor/libgit2/src/repository.h +49 -40
- data/vendor/libgit2/src/revert.c +6 -1
- data/vendor/libgit2/src/revparse.c +18 -19
- data/vendor/libgit2/src/revwalk.c +71 -33
- data/vendor/libgit2/src/revwalk.h +20 -0
- data/vendor/libgit2/src/settings.c +13 -1
- data/vendor/libgit2/src/sortedcache.c +12 -26
- data/vendor/libgit2/src/sortedcache.h +1 -1
- data/vendor/libgit2/src/stash.c +45 -65
- data/vendor/libgit2/src/status.c +17 -11
- data/vendor/libgit2/src/streams/openssl.c +53 -1
- data/vendor/libgit2/src/streams/socket.c +2 -2
- data/vendor/libgit2/src/strmap.c +37 -84
- data/vendor/libgit2/src/strmap.h +105 -33
- data/vendor/libgit2/src/submodule.c +151 -126
- data/vendor/libgit2/src/submodule.h +1 -1
- data/vendor/libgit2/src/tag.c +10 -2
- data/vendor/libgit2/src/trace.c +1 -1
- data/vendor/libgit2/src/trace.h +3 -3
- data/vendor/libgit2/src/trailer.c +46 -32
- data/vendor/libgit2/src/transaction.c +3 -8
- data/vendor/libgit2/src/transports/auth.c +16 -15
- data/vendor/libgit2/src/transports/auth.h +18 -11
- data/vendor/libgit2/src/transports/auth_negotiate.c +64 -33
- 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 +38 -0
- data/vendor/libgit2/src/transports/credential.c +476 -0
- data/vendor/libgit2/src/transports/{cred_helpers.c → credential_helpers.c} +21 -8
- data/vendor/libgit2/src/transports/git.c +11 -16
- data/vendor/libgit2/src/transports/http.c +488 -1248
- data/vendor/libgit2/src/transports/http.h +4 -1
- data/vendor/libgit2/src/transports/httpclient.c +1526 -0
- data/vendor/libgit2/src/transports/httpclient.h +190 -0
- data/vendor/libgit2/src/transports/local.c +10 -10
- data/vendor/libgit2/src/transports/smart.c +19 -19
- data/vendor/libgit2/src/transports/smart.h +3 -3
- data/vendor/libgit2/src/transports/smart_protocol.c +40 -64
- data/vendor/libgit2/src/transports/ssh.c +77 -59
- data/vendor/libgit2/src/transports/winhttp.c +266 -241
- data/vendor/libgit2/src/tree-cache.c +14 -7
- data/vendor/libgit2/src/tree.c +16 -26
- data/vendor/libgit2/src/unix/map.c +1 -1
- data/vendor/libgit2/src/unix/posix.h +2 -12
- data/vendor/libgit2/src/userdiff.h +3 -1
- data/vendor/libgit2/src/util.c +51 -53
- data/vendor/libgit2/src/util.h +16 -21
- data/vendor/libgit2/src/wildmatch.c +320 -0
- data/vendor/libgit2/src/wildmatch.h +23 -0
- data/vendor/libgit2/src/win32/map.c +3 -5
- data/vendor/libgit2/src/win32/path_w32.c +12 -2
- data/vendor/libgit2/src/win32/path_w32.h +0 -29
- data/vendor/libgit2/src/win32/posix.h +1 -4
- data/vendor/libgit2/src/win32/posix_w32.c +48 -5
- data/vendor/libgit2/src/win32/precompiled.h +0 -2
- data/vendor/libgit2/src/win32/thread.c +5 -5
- data/vendor/libgit2/src/win32/w32_buffer.c +7 -3
- data/vendor/libgit2/src/win32/w32_common.h +39 -0
- data/vendor/libgit2/src/win32/w32_crtdbg_stacktrace.c +0 -93
- data/vendor/libgit2/src/win32/w32_crtdbg_stacktrace.h +0 -2
- data/vendor/libgit2/src/win32/w32_stack.c +4 -9
- data/vendor/libgit2/src/win32/w32_stack.h +3 -3
- data/vendor/libgit2/src/win32/w32_util.c +31 -0
- data/vendor/libgit2/src/win32/w32_util.h +6 -32
- data/vendor/libgit2/src/worktree.c +36 -22
- data/vendor/libgit2/src/xdiff/xdiffi.c +1 -1
- data/vendor/libgit2/src/xdiff/xmerge.c +12 -0
- data/vendor/libgit2/src/xdiff/xpatience.c +3 -0
- data/vendor/libgit2/src/zstream.c +5 -0
- data/vendor/libgit2/src/zstream.h +1 -0
- metadata +108 -38
- data/vendor/libgit2/deps/regex/CMakeLists.txt +0 -2
- data/vendor/libgit2/deps/regex/COPYING +0 -502
- 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/fnmatch.c +0 -248
- data/vendor/libgit2/src/fnmatch.h +0 -48
- data/vendor/libgit2/src/transports/cred.c +0 -390
@@ -0,0 +1,97 @@
|
|
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
|
+
#ifndef INCLUDE_regexp_h__
|
9
|
+
#define INCLUDE_regexp_h__
|
10
|
+
|
11
|
+
#include "common.h"
|
12
|
+
|
13
|
+
#if defined(GIT_REGEX_BUILTIN) || defined(GIT_REGEX_PCRE)
|
14
|
+
# include "pcre.h"
|
15
|
+
typedef pcre *git_regexp;
|
16
|
+
# define GIT_REGEX_INIT NULL
|
17
|
+
#elif defined(GIT_REGEX_PCRE2)
|
18
|
+
# define PCRE2_CODE_UNIT_WIDTH 8
|
19
|
+
# include <pcre2.h>
|
20
|
+
typedef pcre2_code *git_regexp;
|
21
|
+
# define GIT_REGEX_INIT NULL
|
22
|
+
#elif defined(GIT_REGEX_REGCOMP) || defined(GIT_REGEX_REGCOMP_L)
|
23
|
+
# include <regex.h>
|
24
|
+
typedef regex_t git_regexp;
|
25
|
+
# define GIT_REGEX_INIT { 0 }
|
26
|
+
#else
|
27
|
+
# error "No regex backend"
|
28
|
+
#endif
|
29
|
+
|
30
|
+
/** Options supported by @git_regexp_compile. */
|
31
|
+
typedef enum {
|
32
|
+
/** Enable case-insensitive matching */
|
33
|
+
GIT_REGEXP_ICASE = (1 << 0)
|
34
|
+
} git_regexp_flags_t;
|
35
|
+
|
36
|
+
/** Structure containing information about regular expression matching groups */
|
37
|
+
typedef struct {
|
38
|
+
/** Start of the given match. -1 if the group didn't match anything */
|
39
|
+
ssize_t start;
|
40
|
+
/** End of the given match. -1 if the group didn't match anything */
|
41
|
+
ssize_t end;
|
42
|
+
} git_regmatch;
|
43
|
+
|
44
|
+
/**
|
45
|
+
* Compile a regular expression. The compiled expression needs to
|
46
|
+
* be cleaned up afterwards with `git_regexp_dispose`.
|
47
|
+
*
|
48
|
+
* @param r Pointer to the storage where to initialize the regular expression.
|
49
|
+
* @param pattern The pattern that shall be compiled.
|
50
|
+
* @param flags Flags to alter how the pattern shall be handled.
|
51
|
+
* 0 for defaults, otherwise see @git_regexp_flags_t.
|
52
|
+
* @return 0 on success, otherwise a negative return value.
|
53
|
+
*/
|
54
|
+
int git_regexp_compile(git_regexp *r, const char *pattern, int flags);
|
55
|
+
|
56
|
+
/**
|
57
|
+
* Free memory associated with the regular expression
|
58
|
+
*
|
59
|
+
* @param r The regular expression structure to dispose.
|
60
|
+
*/
|
61
|
+
void git_regexp_dispose(git_regexp *r);
|
62
|
+
|
63
|
+
/**
|
64
|
+
* Test whether a given string matches a compiled regular
|
65
|
+
* expression.
|
66
|
+
*
|
67
|
+
* @param r Compiled regular expression.
|
68
|
+
* @param string String to match against the regular expression.
|
69
|
+
* @return 0 if the string matches, a negative error code
|
70
|
+
* otherwise. GIT_ENOTFOUND if no match was found,
|
71
|
+
* GIT_EINVALIDSPEC if the regular expression matching
|
72
|
+
* was invalid.
|
73
|
+
*/
|
74
|
+
int git_regexp_match(const git_regexp *r, const char *string);
|
75
|
+
|
76
|
+
/**
|
77
|
+
* Search for matches inside of a given string.
|
78
|
+
*
|
79
|
+
* Given a regular expression with capturing groups, this
|
80
|
+
* function will populate provided @git_regmatch structures with
|
81
|
+
* offsets for each of the given matches. Non-matching groups
|
82
|
+
* will have start and end values of the respective @git_regmatch
|
83
|
+
* structure set to -1.
|
84
|
+
*
|
85
|
+
* @param r Compiled regular expression.
|
86
|
+
* @param string String to match against the regular expression.
|
87
|
+
* @param nmatches Number of @git_regmatch structures provided by
|
88
|
+
* the user.
|
89
|
+
* @param matches Pointer to an array of @git_regmatch structures.
|
90
|
+
* @return 0 if the string matches, a negative error code
|
91
|
+
* otherwise. GIT_ENOTFOUND if no match was found,
|
92
|
+
* GIT_EINVALIDSPEC if the regular expression matching
|
93
|
+
* was invalid.
|
94
|
+
*/
|
95
|
+
int git_regexp_search(const git_regexp *r, const char *string, size_t nmatches, git_regmatch *matches);
|
96
|
+
|
97
|
+
#endif
|
data/vendor/libgit2/src/remote.c
CHANGED
@@ -136,35 +136,6 @@ cleanup:
|
|
136
136
|
return 0;
|
137
137
|
}
|
138
138
|
|
139
|
-
#if 0
|
140
|
-
/* We could export this as a helper */
|
141
|
-
static int get_check_cert(int *out, git_repository *repo)
|
142
|
-
{
|
143
|
-
git_config *cfg;
|
144
|
-
const char *val;
|
145
|
-
int error = 0;
|
146
|
-
|
147
|
-
assert(out && repo);
|
148
|
-
|
149
|
-
/* By default, we *DO* want to verify the certificate. */
|
150
|
-
*out = 1;
|
151
|
-
|
152
|
-
/* Go through the possible sources for SSL verification settings, from
|
153
|
-
* most specific to least specific. */
|
154
|
-
|
155
|
-
/* GIT_SSL_NO_VERIFY environment variable */
|
156
|
-
if ((val = p_getenv("GIT_SSL_NO_VERIFY")) != NULL)
|
157
|
-
return git_config_parse_bool(out, val);
|
158
|
-
|
159
|
-
/* http.sslVerify config setting */
|
160
|
-
if ((error = git_repository_config__weakptr(&cfg, repo)) < 0)
|
161
|
-
return error;
|
162
|
-
|
163
|
-
*out = git_config__get_bool_force(cfg, "http.sslverify", 1);
|
164
|
-
return 0;
|
165
|
-
}
|
166
|
-
#endif
|
167
|
-
|
168
139
|
static int canonicalize_url(git_buf *out, const char *in)
|
169
140
|
{
|
170
141
|
if (in == NULL || strlen(in) == 0) {
|
@@ -217,13 +188,18 @@ static int ensure_remote_doesnot_exist(git_repository *repo, const char *name)
|
|
217
188
|
return GIT_EEXISTS;
|
218
189
|
}
|
219
190
|
|
220
|
-
int
|
191
|
+
int git_remote_create_options_init(git_remote_create_options *opts, unsigned int version)
|
221
192
|
{
|
222
193
|
GIT_INIT_STRUCTURE_FROM_TEMPLATE(
|
223
194
|
opts, version, git_remote_create_options, GIT_REMOTE_CREATE_OPTIONS_INIT);
|
224
195
|
return 0;
|
225
196
|
}
|
226
197
|
|
198
|
+
int git_remote_create_init_options(git_remote_create_options *opts, unsigned int version)
|
199
|
+
{
|
200
|
+
return git_remote_create_options_init(opts, version);
|
201
|
+
}
|
202
|
+
|
227
203
|
int git_remote_create_with_opts(git_remote **out, const char *url, const git_remote_create_options *opts)
|
228
204
|
{
|
229
205
|
git_remote *remote = NULL;
|
@@ -670,21 +646,44 @@ int git_remote_set_pushurl(git_repository *repo, const char *remote, const char*
|
|
670
646
|
return set_url(repo, remote, CONFIG_PUSHURL_FMT, url);
|
671
647
|
}
|
672
648
|
|
673
|
-
|
649
|
+
static int resolve_url(git_buf *resolved_url, const char *url, int direction, const git_remote_callbacks *callbacks)
|
674
650
|
{
|
675
|
-
|
651
|
+
int status;
|
652
|
+
|
653
|
+
if (callbacks && callbacks->resolve_url) {
|
654
|
+
git_buf_clear(resolved_url);
|
655
|
+
status = callbacks->resolve_url(resolved_url, url, direction, callbacks->payload);
|
656
|
+
if (status != GIT_PASSTHROUGH) {
|
657
|
+
git_error_set_after_callback_function(status, "git_resolve_url_cb");
|
658
|
+
git_buf_sanitize(resolved_url);
|
659
|
+
return status;
|
660
|
+
}
|
661
|
+
}
|
676
662
|
|
663
|
+
return git_buf_sets(resolved_url, url);
|
664
|
+
}
|
665
|
+
|
666
|
+
int git_remote__urlfordirection(git_buf *url_out, struct git_remote *remote, int direction, const git_remote_callbacks *callbacks)
|
667
|
+
{
|
668
|
+
const char *url = NULL;
|
669
|
+
|
670
|
+
assert(remote);
|
677
671
|
assert(direction == GIT_DIRECTION_FETCH || direction == GIT_DIRECTION_PUSH);
|
678
672
|
|
679
673
|
if (direction == GIT_DIRECTION_FETCH) {
|
680
|
-
|
674
|
+
url = remote->url;
|
675
|
+
} else if (direction == GIT_DIRECTION_PUSH) {
|
676
|
+
url = remote->pushurl ? remote->pushurl : remote->url;
|
681
677
|
}
|
682
678
|
|
683
|
-
if (
|
684
|
-
|
679
|
+
if (!url) {
|
680
|
+
git_error_set(GIT_ERROR_INVALID,
|
681
|
+
"malformed remote '%s' - missing %s URL",
|
682
|
+
remote->name ? remote->name : "(anonymous)",
|
683
|
+
direction == GIT_DIRECTION_FETCH ? "fetch" : "push");
|
684
|
+
return GIT_EINVALID;
|
685
685
|
}
|
686
|
-
|
687
|
-
return NULL;
|
686
|
+
return resolve_url(url_out, url, direction, callbacks);
|
688
687
|
}
|
689
688
|
|
690
689
|
int set_transport_callbacks(git_transport *t, const git_remote_callbacks *cbs)
|
@@ -707,11 +706,11 @@ static int set_transport_custom_headers(git_transport *t, const git_strarray *cu
|
|
707
706
|
int git_remote__connect(git_remote *remote, git_direction direction, const git_remote_callbacks *callbacks, const git_remote_connection_opts *conn)
|
708
707
|
{
|
709
708
|
git_transport *t;
|
710
|
-
|
709
|
+
git_buf url = GIT_BUF_INIT;
|
711
710
|
int flags = GIT_TRANSPORTFLAGS_NONE;
|
712
711
|
int error;
|
713
712
|
void *payload = NULL;
|
714
|
-
|
713
|
+
git_credential_acquire_cb credentials = NULL;
|
715
714
|
git_transport_cb transport = NULL;
|
716
715
|
|
717
716
|
assert(remote);
|
@@ -728,39 +727,38 @@ int git_remote__connect(git_remote *remote, git_direction direction, const git_r
|
|
728
727
|
|
729
728
|
t = remote->transport;
|
730
729
|
|
731
|
-
|
732
|
-
|
733
|
-
git_error_set(GIT_ERROR_INVALID,
|
734
|
-
"Malformed remote '%s' - missing %s URL",
|
735
|
-
remote->name ? remote->name : "(anonymous)",
|
736
|
-
direction == GIT_DIRECTION_FETCH ? "fetch" : "push");
|
737
|
-
return -1;
|
738
|
-
}
|
730
|
+
if ((error = git_remote__urlfordirection(&url, remote, direction, callbacks)) < 0)
|
731
|
+
goto on_error;
|
739
732
|
|
740
733
|
/* If we don't have a transport object yet, and the caller specified a
|
741
734
|
* custom transport factory, use that */
|
742
735
|
if (!t && transport &&
|
743
736
|
(error = transport(&t, remote, payload)) < 0)
|
744
|
-
|
737
|
+
goto on_error;
|
745
738
|
|
746
739
|
/* If we still don't have a transport, then use the global
|
747
740
|
* transport registrations which map URI schemes to transport factories */
|
748
|
-
if (!t && (error = git_transport_new(&t, remote, url)) < 0)
|
749
|
-
|
741
|
+
if (!t && (error = git_transport_new(&t, remote, url.ptr)) < 0)
|
742
|
+
goto on_error;
|
750
743
|
|
751
744
|
if ((error = set_transport_custom_headers(t, conn->custom_headers)) != 0)
|
752
745
|
goto on_error;
|
753
746
|
|
754
747
|
if ((error = set_transport_callbacks(t, callbacks)) < 0 ||
|
755
|
-
(error = t->connect(t, url, credentials, payload, conn->proxy, direction, flags)) != 0)
|
748
|
+
(error = t->connect(t, url.ptr, credentials, payload, conn->proxy, direction, flags)) != 0)
|
756
749
|
goto on_error;
|
757
750
|
|
758
751
|
remote->transport = t;
|
759
752
|
|
753
|
+
git_buf_dispose(&url);
|
754
|
+
|
760
755
|
return 0;
|
761
756
|
|
762
757
|
on_error:
|
763
|
-
|
758
|
+
if (t)
|
759
|
+
t->free(t);
|
760
|
+
|
761
|
+
git_buf_dispose(&url);
|
764
762
|
|
765
763
|
if (t == remote->transport)
|
766
764
|
remote->transport = NULL;
|
@@ -1678,20 +1676,24 @@ int git_remote_connected(const git_remote *remote)
|
|
1678
1676
|
return remote->transport->is_connected(remote->transport);
|
1679
1677
|
}
|
1680
1678
|
|
1681
|
-
|
1679
|
+
int git_remote_stop(git_remote *remote)
|
1682
1680
|
{
|
1683
1681
|
assert(remote);
|
1684
1682
|
|
1685
1683
|
if (remote->transport && remote->transport->cancel)
|
1686
1684
|
remote->transport->cancel(remote->transport);
|
1685
|
+
|
1686
|
+
return 0;
|
1687
1687
|
}
|
1688
1688
|
|
1689
|
-
|
1689
|
+
int git_remote_disconnect(git_remote *remote)
|
1690
1690
|
{
|
1691
1691
|
assert(remote);
|
1692
1692
|
|
1693
1693
|
if (git_remote_connected(remote))
|
1694
1694
|
remote->transport->close(remote->transport);
|
1695
|
+
|
1696
|
+
return 0;
|
1695
1697
|
}
|
1696
1698
|
|
1697
1699
|
void git_remote_free(git_remote *remote)
|
@@ -1770,7 +1772,7 @@ int git_remote_list(git_strarray *remotes_list, git_repository *repo)
|
|
1770
1772
|
return 0;
|
1771
1773
|
}
|
1772
1774
|
|
1773
|
-
const
|
1775
|
+
const git_indexer_progress *git_remote_stats(git_remote *remote)
|
1774
1776
|
{
|
1775
1777
|
assert(remote);
|
1776
1778
|
return &remote->stats;
|
data/vendor/libgit2/src/remote.h
CHANGED
@@ -29,7 +29,7 @@ struct git_remote {
|
|
29
29
|
git_transport *transport;
|
30
30
|
git_repository *repo;
|
31
31
|
git_push *push;
|
32
|
-
|
32
|
+
git_indexer_progress stats;
|
33
33
|
unsigned int need_pack;
|
34
34
|
git_remote_autotag_option_t download_tags;
|
35
35
|
int prune_refs;
|
@@ -45,7 +45,7 @@ typedef struct git_remote_connection_opts {
|
|
45
45
|
|
46
46
|
int git_remote__connect(git_remote *remote, git_direction direction, const git_remote_callbacks *callbacks, const git_remote_connection_opts *conn);
|
47
47
|
|
48
|
-
|
48
|
+
int git_remote__urlfordirection(git_buf *url_out, struct git_remote *remote, int direction, const git_remote_callbacks *callbacks);
|
49
49
|
int git_remote__get_http_proxy(git_remote *remote, bool use_ssl, char **proxy_url);
|
50
50
|
|
51
51
|
git_refspec *git_remote__matching_refspec(git_remote *remote, const char *refname);
|
@@ -16,7 +16,7 @@
|
|
16
16
|
#include "commit.h"
|
17
17
|
#include "tag.h"
|
18
18
|
#include "blob.h"
|
19
|
-
#include "
|
19
|
+
#include "futils.h"
|
20
20
|
#include "sysdir.h"
|
21
21
|
#include "filebuf.h"
|
22
22
|
#include "index.h"
|
@@ -42,23 +42,24 @@ bool git_repository__fsync_gitdir = false;
|
|
42
42
|
|
43
43
|
static const struct {
|
44
44
|
git_repository_item_t parent;
|
45
|
+
git_repository_item_t fallback;
|
45
46
|
const char *name;
|
46
47
|
bool directory;
|
47
48
|
} items[] = {
|
48
|
-
{ GIT_REPOSITORY_ITEM_GITDIR, NULL, true },
|
49
|
-
{ GIT_REPOSITORY_ITEM_WORKDIR, NULL, true },
|
50
|
-
{ GIT_REPOSITORY_ITEM_COMMONDIR, NULL, true },
|
51
|
-
{ GIT_REPOSITORY_ITEM_GITDIR, "index", false },
|
52
|
-
{ GIT_REPOSITORY_ITEM_COMMONDIR, "objects", true },
|
53
|
-
{ GIT_REPOSITORY_ITEM_COMMONDIR, "refs", true },
|
54
|
-
{ GIT_REPOSITORY_ITEM_COMMONDIR, "packed-refs", false },
|
55
|
-
{ GIT_REPOSITORY_ITEM_COMMONDIR, "remotes", true },
|
56
|
-
{ GIT_REPOSITORY_ITEM_COMMONDIR, "config", false },
|
57
|
-
{ GIT_REPOSITORY_ITEM_COMMONDIR, "info", true },
|
58
|
-
{ GIT_REPOSITORY_ITEM_COMMONDIR, "hooks", true },
|
59
|
-
{ GIT_REPOSITORY_ITEM_COMMONDIR, "logs", true },
|
60
|
-
{ GIT_REPOSITORY_ITEM_GITDIR, "modules", true },
|
61
|
-
{ GIT_REPOSITORY_ITEM_COMMONDIR, "worktrees", true }
|
49
|
+
{ GIT_REPOSITORY_ITEM_GITDIR, GIT_REPOSITORY_ITEM__LAST, NULL, true },
|
50
|
+
{ GIT_REPOSITORY_ITEM_WORKDIR, GIT_REPOSITORY_ITEM__LAST, NULL, true },
|
51
|
+
{ GIT_REPOSITORY_ITEM_COMMONDIR, GIT_REPOSITORY_ITEM__LAST, NULL, true },
|
52
|
+
{ GIT_REPOSITORY_ITEM_GITDIR, GIT_REPOSITORY_ITEM__LAST, "index", false },
|
53
|
+
{ GIT_REPOSITORY_ITEM_COMMONDIR, GIT_REPOSITORY_ITEM_GITDIR, "objects", true },
|
54
|
+
{ GIT_REPOSITORY_ITEM_COMMONDIR, GIT_REPOSITORY_ITEM_GITDIR, "refs", true },
|
55
|
+
{ GIT_REPOSITORY_ITEM_COMMONDIR, GIT_REPOSITORY_ITEM_GITDIR, "packed-refs", false },
|
56
|
+
{ GIT_REPOSITORY_ITEM_COMMONDIR, GIT_REPOSITORY_ITEM_GITDIR, "remotes", true },
|
57
|
+
{ GIT_REPOSITORY_ITEM_COMMONDIR, GIT_REPOSITORY_ITEM_GITDIR, "config", false },
|
58
|
+
{ GIT_REPOSITORY_ITEM_COMMONDIR, GIT_REPOSITORY_ITEM_GITDIR, "info", true },
|
59
|
+
{ GIT_REPOSITORY_ITEM_COMMONDIR, GIT_REPOSITORY_ITEM_GITDIR, "hooks", true },
|
60
|
+
{ GIT_REPOSITORY_ITEM_COMMONDIR, GIT_REPOSITORY_ITEM_GITDIR, "logs", true },
|
61
|
+
{ GIT_REPOSITORY_ITEM_GITDIR, GIT_REPOSITORY_ITEM__LAST, "modules", true },
|
62
|
+
{ GIT_REPOSITORY_ITEM_COMMONDIR, GIT_REPOSITORY_ITEM_GITDIR, "worktrees", true }
|
62
63
|
};
|
63
64
|
|
64
65
|
static int check_repositoryformatversion(git_config *config);
|
@@ -121,7 +122,7 @@ static void set_config(git_repository *repo, git_config *config)
|
|
121
122
|
git_config_free(config);
|
122
123
|
}
|
123
124
|
|
124
|
-
|
125
|
+
git_repository__configmap_lookup_cache_clear(repo);
|
125
126
|
}
|
126
127
|
|
127
128
|
static void set_index(git_repository *repo, git_index *index)
|
@@ -137,7 +138,7 @@ static void set_index(git_repository *repo, git_index *index)
|
|
137
138
|
}
|
138
139
|
}
|
139
140
|
|
140
|
-
|
141
|
+
int git_repository__cleanup(git_repository *repo)
|
141
142
|
{
|
142
143
|
assert(repo);
|
143
144
|
|
@@ -149,6 +150,8 @@ void git_repository__cleanup(git_repository *repo)
|
|
149
150
|
set_index(repo, NULL);
|
150
151
|
set_odb(repo, NULL);
|
151
152
|
set_refdb(repo, NULL);
|
153
|
+
|
154
|
+
return 0;
|
152
155
|
}
|
153
156
|
|
154
157
|
void git_repository_free(git_repository *repo)
|
@@ -160,7 +163,7 @@ void git_repository_free(git_repository *repo)
|
|
160
163
|
|
161
164
|
git_repository__cleanup(repo);
|
162
165
|
|
163
|
-
|
166
|
+
git_cache_dispose(&repo->objects);
|
164
167
|
|
165
168
|
git_diff_driver_registry_free(repo->diff_drivers);
|
166
169
|
repo->diff_drivers = NULL;
|
@@ -238,14 +241,14 @@ static git_repository *repository_alloc(void)
|
|
238
241
|
if (!repo->reserved_names.ptr)
|
239
242
|
goto on_error;
|
240
243
|
|
241
|
-
/* set all the entries in the
|
242
|
-
|
244
|
+
/* set all the entries in the configmap cache to `unset` */
|
245
|
+
git_repository__configmap_lookup_cache_clear(repo);
|
243
246
|
|
244
247
|
return repo;
|
245
248
|
|
246
249
|
on_error:
|
247
250
|
if (repo)
|
248
|
-
|
251
|
+
git_cache_dispose(&repo->objects);
|
249
252
|
|
250
253
|
git__free(repo);
|
251
254
|
return NULL;
|
@@ -864,8 +867,7 @@ cleanup:
|
|
864
867
|
|
865
868
|
if (error < 0)
|
866
869
|
git_repository_free(repo);
|
867
|
-
|
868
|
-
if (repo_ptr)
|
870
|
+
else if (repo_ptr)
|
869
871
|
*repo_ptr = repo;
|
870
872
|
|
871
873
|
return error;
|
@@ -881,7 +883,8 @@ int git_repository_open_from_worktree(git_repository **repo_out, git_worktree *w
|
|
881
883
|
{
|
882
884
|
git_buf path = GIT_BUF_INIT;
|
883
885
|
git_repository *repo = NULL;
|
884
|
-
|
886
|
+
size_t len;
|
887
|
+
int err;
|
885
888
|
|
886
889
|
assert(repo_out && wt);
|
887
890
|
|
@@ -1069,10 +1072,11 @@ int git_repository_config_snapshot(git_config **out, git_repository *repo)
|
|
1069
1072
|
return git_config_snapshot(out, weak);
|
1070
1073
|
}
|
1071
1074
|
|
1072
|
-
|
1075
|
+
int git_repository_set_config(git_repository *repo, git_config *config)
|
1073
1076
|
{
|
1074
1077
|
assert(repo && config);
|
1075
1078
|
set_config(repo, config);
|
1079
|
+
return 0;
|
1076
1080
|
}
|
1077
1081
|
|
1078
1082
|
int git_repository_odb__weakptr(git_odb **out, git_repository *repo)
|
@@ -1120,10 +1124,11 @@ int git_repository_odb(git_odb **out, git_repository *repo)
|
|
1120
1124
|
return 0;
|
1121
1125
|
}
|
1122
1126
|
|
1123
|
-
|
1127
|
+
int git_repository_set_odb(git_repository *repo, git_odb *odb)
|
1124
1128
|
{
|
1125
1129
|
assert(repo && odb);
|
1126
1130
|
set_odb(repo, odb);
|
1131
|
+
return 0;
|
1127
1132
|
}
|
1128
1133
|
|
1129
1134
|
int git_repository_refdb__weakptr(git_refdb **out, git_repository *repo)
|
@@ -1160,10 +1165,11 @@ int git_repository_refdb(git_refdb **out, git_repository *repo)
|
|
1160
1165
|
return 0;
|
1161
1166
|
}
|
1162
1167
|
|
1163
|
-
|
1168
|
+
int git_repository_set_refdb(git_repository *repo, git_refdb *refdb)
|
1164
1169
|
{
|
1165
1170
|
assert(repo && refdb);
|
1166
1171
|
set_refdb(repo, refdb);
|
1172
|
+
return 0;
|
1167
1173
|
}
|
1168
1174
|
|
1169
1175
|
int git_repository_index__weakptr(git_index **out, git_repository *repo)
|
@@ -1209,10 +1215,11 @@ int git_repository_index(git_index **out, git_repository *repo)
|
|
1209
1215
|
return 0;
|
1210
1216
|
}
|
1211
1217
|
|
1212
|
-
|
1218
|
+
int git_repository_set_index(git_repository *repo, git_index *index)
|
1213
1219
|
{
|
1214
1220
|
assert(repo);
|
1215
1221
|
set_index(repo, index);
|
1222
|
+
return 0;
|
1216
1223
|
}
|
1217
1224
|
|
1218
1225
|
int git_repository_set_namespace(git_repository *repo, const char *namespace)
|
@@ -1288,8 +1295,8 @@ bool git_repository__reserved_names(
|
|
1288
1295
|
int (*prefixcmp)(const char *, const char *);
|
1289
1296
|
int error, ignorecase;
|
1290
1297
|
|
1291
|
-
error =
|
1292
|
-
&ignorecase, repo,
|
1298
|
+
error = git_repository__configmap_lookup(
|
1299
|
+
&ignorecase, repo, GIT_CONFIGMAP_IGNORECASE);
|
1293
1300
|
prefixcmp = (error || ignorecase) ? git__prefixcmp_icase :
|
1294
1301
|
git__prefixcmp;
|
1295
1302
|
|
@@ -1361,10 +1368,11 @@ int git_repository_create_head(const char *git_dir, const char *ref_name)
|
|
1361
1368
|
git_buf ref_path = GIT_BUF_INIT;
|
1362
1369
|
git_filebuf ref = GIT_FILEBUF_INIT;
|
1363
1370
|
const char *fmt;
|
1371
|
+
int error;
|
1364
1372
|
|
1365
|
-
if (git_buf_joinpath(&ref_path, git_dir, GIT_HEAD_FILE) < 0 ||
|
1366
|
-
|
1367
|
-
goto
|
1373
|
+
if ((error = git_buf_joinpath(&ref_path, git_dir, GIT_HEAD_FILE)) < 0 ||
|
1374
|
+
(error = git_filebuf_open(&ref, ref_path.ptr, 0, GIT_REFS_FILE_MODE)) < 0)
|
1375
|
+
goto out;
|
1368
1376
|
|
1369
1377
|
if (!ref_name)
|
1370
1378
|
ref_name = GIT_BRANCH_MASTER;
|
@@ -1374,17 +1382,14 @@ int git_repository_create_head(const char *git_dir, const char *ref_name)
|
|
1374
1382
|
else
|
1375
1383
|
fmt = "ref: " GIT_REFS_HEADS_DIR "%s\n";
|
1376
1384
|
|
1377
|
-
if (git_filebuf_printf(&ref, fmt, ref_name) < 0 ||
|
1378
|
-
|
1379
|
-
goto
|
1380
|
-
|
1381
|
-
git_buf_dispose(&ref_path);
|
1382
|
-
return 0;
|
1385
|
+
if ((error = git_filebuf_printf(&ref, fmt, ref_name)) < 0 ||
|
1386
|
+
(error = git_filebuf_commit(&ref)) < 0)
|
1387
|
+
goto out;
|
1383
1388
|
|
1384
|
-
|
1389
|
+
out:
|
1385
1390
|
git_buf_dispose(&ref_path);
|
1386
1391
|
git_filebuf_cleanup(&ref);
|
1387
|
-
return
|
1392
|
+
return error;
|
1388
1393
|
}
|
1389
1394
|
|
1390
1395
|
static bool is_chmod_supported(const char *file_path)
|
@@ -1422,9 +1427,6 @@ static bool are_symlinks_supported(const char *wd_path)
|
|
1422
1427
|
git_buf xdg_buf = GIT_BUF_INIT;
|
1423
1428
|
git_buf system_buf = GIT_BUF_INIT;
|
1424
1429
|
git_buf programdata_buf = GIT_BUF_INIT;
|
1425
|
-
git_buf path = GIT_BUF_INIT;
|
1426
|
-
int fd;
|
1427
|
-
struct stat st;
|
1428
1430
|
int symlinks = 0;
|
1429
1431
|
|
1430
1432
|
/*
|
@@ -1451,23 +1453,14 @@ static bool are_symlinks_supported(const char *wd_path)
|
|
1451
1453
|
goto done;
|
1452
1454
|
#endif
|
1453
1455
|
|
1454
|
-
if ((
|
1455
|
-
p_close(fd) < 0 ||
|
1456
|
-
p_unlink(path.ptr) < 0 ||
|
1457
|
-
p_symlink("testing", path.ptr) < 0 ||
|
1458
|
-
p_lstat(path.ptr, &st) < 0)
|
1456
|
+
if (!(symlinks = git_path_supports_symlinks(wd_path)))
|
1459
1457
|
goto done;
|
1460
1458
|
|
1461
|
-
symlinks = (S_ISLNK(st.st_mode) != 0);
|
1462
|
-
|
1463
|
-
(void)p_unlink(path.ptr);
|
1464
|
-
|
1465
1459
|
done:
|
1466
1460
|
git_buf_dispose(&global_buf);
|
1467
1461
|
git_buf_dispose(&xdg_buf);
|
1468
1462
|
git_buf_dispose(&system_buf);
|
1469
1463
|
git_buf_dispose(&programdata_buf);
|
1470
|
-
git_buf_dispose(&path);
|
1471
1464
|
git_config_free(config);
|
1472
1465
|
return symlinks != 0;
|
1473
1466
|
}
|
@@ -1661,7 +1654,7 @@ int git_repository_reinit_filesystem(git_repository *repo, int recurse)
|
|
1661
1654
|
git_config_free(config);
|
1662
1655
|
git_buf_dispose(&path);
|
1663
1656
|
|
1664
|
-
|
1657
|
+
git_repository__configmap_lookup_cache_clear(repo);
|
1665
1658
|
|
1666
1659
|
if (!repo->is_bare && recurse)
|
1667
1660
|
(void)git_submodule_foreach(repo, repo_reinit_submodule_fs, NULL);
|
@@ -2059,53 +2052,59 @@ int git_repository_init_ext(
|
|
2059
2052
|
const char *given_repo,
|
2060
2053
|
git_repository_init_options *opts)
|
2061
2054
|
{
|
2062
|
-
int error;
|
2063
2055
|
git_buf repo_path = GIT_BUF_INIT, wd_path = GIT_BUF_INIT,
|
2064
|
-
common_path = GIT_BUF_INIT;
|
2056
|
+
common_path = GIT_BUF_INIT, head_path = GIT_BUF_INIT;
|
2065
2057
|
const char *wd;
|
2058
|
+
int error;
|
2066
2059
|
|
2067
2060
|
assert(out && given_repo && opts);
|
2068
2061
|
|
2069
2062
|
GIT_ERROR_CHECK_VERSION(opts, GIT_REPOSITORY_INIT_OPTIONS_VERSION, "git_repository_init_options");
|
2070
2063
|
|
2071
|
-
error = repo_init_directories(&repo_path, &wd_path, given_repo, opts)
|
2072
|
-
|
2073
|
-
goto cleanup;
|
2064
|
+
if ((error = repo_init_directories(&repo_path, &wd_path, given_repo, opts)) < 0)
|
2065
|
+
goto out;
|
2074
2066
|
|
2075
2067
|
wd = (opts->flags & GIT_REPOSITORY_INIT_BARE) ? NULL : git_buf_cstr(&wd_path);
|
2076
|
-
if (valid_repository_path(&repo_path, &common_path)) {
|
2077
2068
|
|
2069
|
+
if (valid_repository_path(&repo_path, &common_path)) {
|
2078
2070
|
if ((opts->flags & GIT_REPOSITORY_INIT_NO_REINIT) != 0) {
|
2079
2071
|
git_error_set(GIT_ERROR_REPOSITORY,
|
2080
2072
|
"attempt to reinitialize '%s'", given_repo);
|
2081
2073
|
error = GIT_EEXISTS;
|
2082
|
-
goto
|
2074
|
+
goto out;
|
2083
2075
|
}
|
2084
2076
|
|
2085
2077
|
opts->flags |= GIT_REPOSITORY_INIT__IS_REINIT;
|
2086
2078
|
|
2087
|
-
error = repo_init_config(
|
2088
|
-
|
2079
|
+
if ((error = repo_init_config(repo_path.ptr, wd, opts->flags, opts->mode)) < 0)
|
2080
|
+
goto out;
|
2089
2081
|
|
2090
2082
|
/* TODO: reinitialize the templates */
|
2083
|
+
} else {
|
2084
|
+
if ((error = repo_init_structure(repo_path.ptr, wd, opts)) < 0 ||
|
2085
|
+
(error = repo_init_config(repo_path.ptr, wd, opts->flags, opts->mode)) < 0 ||
|
2086
|
+
(error = git_buf_joinpath(&head_path, repo_path.ptr, GIT_HEAD_FILE)) < 0)
|
2087
|
+
goto out;
|
2088
|
+
|
2089
|
+
/*
|
2090
|
+
* Only set the new HEAD if the file does not exist already via
|
2091
|
+
* a template or if the caller has explicitly supplied an
|
2092
|
+
* initial HEAD value.
|
2093
|
+
*/
|
2094
|
+
if ((!git_path_exists(head_path.ptr) || opts->initial_head) &&
|
2095
|
+
(error = git_repository_create_head(repo_path.ptr, opts->initial_head)) < 0)
|
2096
|
+
goto out;
|
2091
2097
|
}
|
2092
|
-
else {
|
2093
|
-
if (!(error = repo_init_structure(
|
2094
|
-
repo_path.ptr, wd, opts)) &&
|
2095
|
-
!(error = repo_init_config(
|
2096
|
-
repo_path.ptr, wd, opts->flags, opts->mode)))
|
2097
|
-
error = git_repository_create_head(
|
2098
|
-
repo_path.ptr, opts->initial_head);
|
2099
|
-
}
|
2100
|
-
if (error < 0)
|
2101
|
-
goto cleanup;
|
2102
2098
|
|
2103
|
-
error = git_repository_open(out, repo_path.ptr)
|
2099
|
+
if ((error = git_repository_open(out, repo_path.ptr)) < 0)
|
2100
|
+
goto out;
|
2104
2101
|
|
2105
|
-
if (
|
2106
|
-
|
2102
|
+
if (opts->origin_url &&
|
2103
|
+
(error = repo_init_create_origin(*out, opts->origin_url)) < 0)
|
2104
|
+
goto out;
|
2107
2105
|
|
2108
|
-
|
2106
|
+
out:
|
2107
|
+
git_buf_dispose(&head_path);
|
2109
2108
|
git_buf_dispose(&common_path);
|
2110
2109
|
git_buf_dispose(&repo_path);
|
2111
2110
|
git_buf_dispose(&wd_path);
|
@@ -2213,30 +2212,37 @@ out:
|
|
2213
2212
|
return error;
|
2214
2213
|
}
|
2215
2214
|
|
2216
|
-
int git_repository_foreach_head(git_repository *repo,
|
2215
|
+
int git_repository_foreach_head(git_repository *repo,
|
2216
|
+
git_repository_foreach_head_cb cb,
|
2217
|
+
int flags, void *payload)
|
2217
2218
|
{
|
2218
2219
|
git_strarray worktrees = GIT_VECTOR_INIT;
|
2219
2220
|
git_buf path = GIT_BUF_INIT;
|
2220
|
-
int error;
|
2221
|
+
int error = 0;
|
2221
2222
|
size_t i;
|
2222
2223
|
|
2223
|
-
/* Execute callback for HEAD of commondir */
|
2224
|
-
if ((error = git_buf_joinpath(&path, repo->commondir, GIT_HEAD_FILE)) < 0 ||
|
2225
|
-
(error = cb(repo, path.ptr, payload) != 0))
|
2226
|
-
goto out;
|
2227
2224
|
|
2228
|
-
if ((
|
2229
|
-
|
2230
|
-
|
2225
|
+
if (!(flags & GIT_REPOSITORY_FOREACH_HEAD_SKIP_REPO)) {
|
2226
|
+
/* Gather HEAD of main repository */
|
2227
|
+
if ((error = git_buf_joinpath(&path, repo->commondir, GIT_HEAD_FILE)) < 0 ||
|
2228
|
+
(error = cb(repo, path.ptr, payload) != 0))
|
2229
|
+
goto out;
|
2231
2230
|
}
|
2232
2231
|
|
2233
|
-
|
2234
|
-
|
2235
|
-
|
2236
|
-
continue;
|
2237
|
-
|
2238
|
-
if ((error = cb(repo, path.ptr, payload)) != 0)
|
2232
|
+
if (!(flags & GIT_REPOSITORY_FOREACH_HEAD_SKIP_WORKTREES)) {
|
2233
|
+
if ((error = git_worktree_list(&worktrees, repo)) < 0) {
|
2234
|
+
error = 0;
|
2239
2235
|
goto out;
|
2236
|
+
}
|
2237
|
+
|
2238
|
+
/* Gather HEADs of all worktrees */
|
2239
|
+
for (i = 0; i < worktrees.count; i++) {
|
2240
|
+
if (get_worktree_file_path(&path, repo, worktrees.strings[i], GIT_HEAD_FILE) < 0)
|
2241
|
+
continue;
|
2242
|
+
|
2243
|
+
if ((error = cb(repo, path.ptr, payload)) != 0)
|
2244
|
+
goto out;
|
2245
|
+
}
|
2240
2246
|
}
|
2241
2247
|
|
2242
2248
|
out:
|
@@ -2303,11 +2309,11 @@ int git_repository_is_empty(git_repository *repo)
|
|
2303
2309
|
return is_empty;
|
2304
2310
|
}
|
2305
2311
|
|
2306
|
-
|
2312
|
+
static const char *resolved_parent_path(const git_repository *repo, git_repository_item_t item, git_repository_item_t fallback)
|
2307
2313
|
{
|
2308
2314
|
const char *parent;
|
2309
2315
|
|
2310
|
-
switch (
|
2316
|
+
switch (item) {
|
2311
2317
|
case GIT_REPOSITORY_ITEM_GITDIR:
|
2312
2318
|
parent = git_repository_path(repo);
|
2313
2319
|
break;
|
@@ -2319,9 +2325,17 @@ int git_repository_item_path(git_buf *out, const git_repository *repo, git_repos
|
|
2319
2325
|
break;
|
2320
2326
|
default:
|
2321
2327
|
git_error_set(GIT_ERROR_INVALID, "invalid item directory");
|
2322
|
-
return
|
2328
|
+
return NULL;
|
2323
2329
|
}
|
2330
|
+
if (!parent && fallback != GIT_REPOSITORY_ITEM__LAST)
|
2331
|
+
return resolved_parent_path(repo, fallback, GIT_REPOSITORY_ITEM__LAST);
|
2332
|
+
|
2333
|
+
return parent;
|
2334
|
+
}
|
2324
2335
|
|
2336
|
+
int git_repository_item_path(git_buf *out, const git_repository *repo, git_repository_item_t item)
|
2337
|
+
{
|
2338
|
+
const char *parent = resolved_parent_path(repo, items[item].parent, items[item].fallback);
|
2325
2339
|
if (parent == NULL) {
|
2326
2340
|
git_error_set(GIT_ERROR_INVALID, "path cannot exist in repository");
|
2327
2341
|
return GIT_ENOTFOUND;
|
@@ -2536,7 +2550,7 @@ int git_repository_hashfile(
|
|
2536
2550
|
int error;
|
2537
2551
|
git_filter_list *fl = NULL;
|
2538
2552
|
git_file fd = -1;
|
2539
|
-
|
2553
|
+
uint64_t len;
|
2540
2554
|
git_buf full_path = GIT_BUF_INIT;
|
2541
2555
|
|
2542
2556
|
assert(out && path && repo); /* as_path can be NULL */
|
@@ -2573,11 +2587,8 @@ int git_repository_hashfile(
|
|
2573
2587
|
goto cleanup;
|
2574
2588
|
}
|
2575
2589
|
|
2576
|
-
|
2577
|
-
if (len < 0) {
|
2578
|
-
error = (int)len;
|
2590
|
+
if ((error = git_futils_filesize(&len, fd)) < 0)
|
2579
2591
|
goto cleanup;
|
2580
|
-
}
|
2581
2592
|
|
2582
2593
|
if (!git__is_sizet(len)) {
|
2583
2594
|
git_error_set(GIT_ERROR_OS, "file size overflow for 32-bit systems");
|
@@ -2866,7 +2877,7 @@ int git_repository_is_shallow(git_repository *repo)
|
|
2866
2877
|
return st.st_size == 0 ? 0 : 1;
|
2867
2878
|
}
|
2868
2879
|
|
2869
|
-
int
|
2880
|
+
int git_repository_init_options_init(
|
2870
2881
|
git_repository_init_options *opts, unsigned int version)
|
2871
2882
|
{
|
2872
2883
|
GIT_INIT_STRUCTURE_FROM_TEMPLATE(
|
@@ -2875,6 +2886,12 @@ int git_repository_init_init_options(
|
|
2875
2886
|
return 0;
|
2876
2887
|
}
|
2877
2888
|
|
2889
|
+
int git_repository_init_init_options(
|
2890
|
+
git_repository_init_options *opts, unsigned int version)
|
2891
|
+
{
|
2892
|
+
return git_repository_init_options_init(opts, version);
|
2893
|
+
}
|
2894
|
+
|
2878
2895
|
int git_repository_ident(const char **name, const char **email, const git_repository *repo)
|
2879
2896
|
{
|
2880
2897
|
*name = repo->ident_name;
|
@@ -2912,7 +2929,7 @@ int git_repository_submodule_cache_all(git_repository *repo)
|
|
2912
2929
|
|
2913
2930
|
assert(repo);
|
2914
2931
|
|
2915
|
-
if ((error =
|
2932
|
+
if ((error = git_strmap_new(&repo->submodule_cache)))
|
2916
2933
|
return error;
|
2917
2934
|
|
2918
2935
|
error = git_submodule__map(repo, repo->submodule_cache);
|