rugged 1.0.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/LICENSE +1 -0
- data/README.md +3 -3
- data/ext/rugged/rugged.c +7 -4
- data/ext/rugged/rugged_commit.c +1 -1
- data/ext/rugged/rugged_config.c +1 -1
- data/ext/rugged/rugged_object.c +1 -1
- data/ext/rugged/rugged_remote.c +32 -2
- data/ext/rugged/rugged_repo.c +13 -3
- data/lib/rugged/commit.rb +17 -4
- data/lib/rugged/repository.rb +7 -8
- data/lib/rugged/submodule_collection.rb +4 -4
- 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/{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 +89 -0
- data/vendor/libgit2/include/git2/blame.h +95 -42
- data/vendor/libgit2/include/git2/blob.h +31 -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/commit.h +35 -19
- data/vendor/libgit2/include/git2/common.h +33 -6
- data/vendor/libgit2/include/git2/config.h +1 -1
- data/vendor/libgit2/include/git2/deprecated.h +248 -8
- data/vendor/libgit2/include/git2/diff.h +35 -20
- data/vendor/libgit2/include/git2/errors.h +8 -7
- data/vendor/libgit2/include/git2/filter.h +57 -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/odb.h +44 -20
- 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 +59 -6
- data/vendor/libgit2/include/git2/repository.h +95 -52
- data/vendor/libgit2/include/git2/revparse.h +5 -5
- data/vendor/libgit2/include/git2/status.h +115 -59
- 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/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 +3 -3
- data/vendor/libgit2/include/git2/worktree.h +1 -0
- data/vendor/libgit2/src/CMakeLists.txt +77 -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 +181 -74
- data/vendor/libgit2/src/attr_file.c +92 -42
- 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 +28 -15
- data/vendor/libgit2/src/blame_git.c +6 -3
- data/vendor/libgit2/src/blob.c +46 -24
- data/vendor/libgit2/src/branch.c +87 -37
- data/vendor/libgit2/src/buffer.c +339 -27
- data/vendor/libgit2/src/buffer.h +153 -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 -2
- data/vendor/libgit2/src/checkout.c +97 -98
- data/vendor/libgit2/src/cherrypick.c +8 -2
- data/vendor/libgit2/src/clone.c +104 -29
- 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 +40 -22
- 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 +25 -8
- data/vendor/libgit2/src/config_parse.c +5 -7
- 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 +11 -4
- data/vendor/libgit2/src/diff.c +23 -19
- 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/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 +209 -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 +0 -2
- 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 +35 -19
- data/vendor/libgit2/src/index.c +126 -84
- data/vendor/libgit2/src/index.h +1 -1
- data/vendor/libgit2/src/indexer.c +60 -36
- 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} +125 -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 +108 -46
- 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 +10 -10
- 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/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 +102 -57
- data/vendor/libgit2/src/path.h +79 -6
- 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 +144 -152
- data/vendor/libgit2/src/reflog.c +21 -20
- data/vendor/libgit2/src/refs.c +151 -231
- data/vendor/libgit2/src/refs.h +2 -20
- data/vendor/libgit2/src/refspec.c +80 -44
- data/vendor/libgit2/src/regexp.c +2 -2
- data/vendor/libgit2/src/remote.c +312 -121
- data/vendor/libgit2/src/remote.h +2 -1
- data/vendor/libgit2/src/repository.c +351 -189
- data/vendor/libgit2/src/repository.h +23 -29
- data/vendor/libgit2/src/reset.c +7 -6
- data/vendor/libgit2/src/revert.c +8 -2
- data/vendor/libgit2/src/revparse.c +19 -13
- 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 +7 -3
- 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 +83 -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/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 +84 -42
- 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 +51 -17
- data/vendor/libgit2/src/transports/winhttp.c +156 -88
- 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 +74 -183
- data/vendor/libgit2/src/util.h +33 -39
- data/vendor/libgit2/src/vector.c +23 -19
- data/vendor/libgit2/src/vector.h +4 -2
- data/vendor/libgit2/src/win32/findfile.c +4 -2
- 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_w32.c +77 -1
- 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 +37 -15
- data/vendor/libgit2/src/zstream.c +1 -1
- metadata +56 -38
- 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
|
@@ -1,122 +0,0 @@
|
|
|
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
|
-
#ifndef INCLUDE_buf_text_h__
|
|
8
|
-
#define INCLUDE_buf_text_h__
|
|
9
|
-
|
|
10
|
-
#include "common.h"
|
|
11
|
-
|
|
12
|
-
#include "buffer.h"
|
|
13
|
-
|
|
14
|
-
typedef enum {
|
|
15
|
-
GIT_BOM_NONE = 0,
|
|
16
|
-
GIT_BOM_UTF8 = 1,
|
|
17
|
-
GIT_BOM_UTF16_LE = 2,
|
|
18
|
-
GIT_BOM_UTF16_BE = 3,
|
|
19
|
-
GIT_BOM_UTF32_LE = 4,
|
|
20
|
-
GIT_BOM_UTF32_BE = 5
|
|
21
|
-
} git_bom_t;
|
|
22
|
-
|
|
23
|
-
typedef struct {
|
|
24
|
-
git_bom_t bom; /* BOM found at head of text */
|
|
25
|
-
unsigned int nul, cr, lf, crlf; /* NUL, CR, LF and CRLF counts */
|
|
26
|
-
unsigned int printable, nonprintable; /* These are just approximations! */
|
|
27
|
-
} git_buf_text_stats;
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Append string to buffer, prefixing each character from `esc_chars` with
|
|
31
|
-
* `esc_with` string.
|
|
32
|
-
*
|
|
33
|
-
* @param buf Buffer to append data to
|
|
34
|
-
* @param string String to escape and append
|
|
35
|
-
* @param esc_chars Characters to be escaped
|
|
36
|
-
* @param esc_with String to insert in from of each found character
|
|
37
|
-
* @return 0 on success, <0 on failure (probably allocation problem)
|
|
38
|
-
*/
|
|
39
|
-
extern int git_buf_text_puts_escaped(
|
|
40
|
-
git_buf *buf,
|
|
41
|
-
const char *string,
|
|
42
|
-
const char *esc_chars,
|
|
43
|
-
const char *esc_with);
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Append string escaping characters that are regex special
|
|
47
|
-
*/
|
|
48
|
-
GIT_INLINE(int) git_buf_text_puts_escape_regex(git_buf *buf, const char *string)
|
|
49
|
-
{
|
|
50
|
-
return git_buf_text_puts_escaped(buf, string, "^.[]$()|*+?{}\\", "\\");
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* Unescape all characters in a buffer in place
|
|
55
|
-
*
|
|
56
|
-
* I.e. remove backslashes
|
|
57
|
-
*/
|
|
58
|
-
extern void git_buf_text_unescape(git_buf *buf);
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* Replace all \r\n with \n.
|
|
62
|
-
*
|
|
63
|
-
* @return 0 on success, -1 on memory error
|
|
64
|
-
*/
|
|
65
|
-
extern int git_buf_text_crlf_to_lf(git_buf *tgt, const git_buf *src);
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* Replace all \n with \r\n. Does not modify existing \r\n.
|
|
69
|
-
*
|
|
70
|
-
* @return 0 on success, -1 on memory error
|
|
71
|
-
*/
|
|
72
|
-
extern int git_buf_text_lf_to_crlf(git_buf *tgt, const git_buf *src);
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* Fill buffer with the common prefix of a array of strings
|
|
76
|
-
*
|
|
77
|
-
* Buffer will be set to empty if there is no common prefix
|
|
78
|
-
*/
|
|
79
|
-
extern int git_buf_text_common_prefix(git_buf *buf, const git_strarray *strs);
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
* Check quickly if buffer looks like it contains binary data
|
|
83
|
-
*
|
|
84
|
-
* @param buf Buffer to check
|
|
85
|
-
* @return true if buffer looks like non-text data
|
|
86
|
-
*/
|
|
87
|
-
extern bool git_buf_text_is_binary(const git_buf *buf);
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* Check quickly if buffer contains a NUL byte
|
|
91
|
-
*
|
|
92
|
-
* @param buf Buffer to check
|
|
93
|
-
* @return true if buffer contains a NUL byte
|
|
94
|
-
*/
|
|
95
|
-
extern bool git_buf_text_contains_nul(const git_buf *buf);
|
|
96
|
-
|
|
97
|
-
/**
|
|
98
|
-
* Check if a buffer begins with a UTF BOM
|
|
99
|
-
*
|
|
100
|
-
* @param bom Set to the type of BOM detected or GIT_BOM_NONE
|
|
101
|
-
* @param buf Buffer in which to check the first bytes for a BOM
|
|
102
|
-
* @return Number of bytes of BOM data (or 0 if no BOM found)
|
|
103
|
-
*/
|
|
104
|
-
extern int git_buf_text_detect_bom(git_bom_t *bom, const git_buf *buf);
|
|
105
|
-
|
|
106
|
-
/**
|
|
107
|
-
* Gather stats for a piece of text
|
|
108
|
-
*
|
|
109
|
-
* Fill the `stats` structure with counts of unreadable characters, carriage
|
|
110
|
-
* returns, etc, so it can be used in heuristics. This automatically skips
|
|
111
|
-
* a trailing EOF (\032 character). Also it will look for a BOM at the
|
|
112
|
-
* start of the text and can be told to skip that as well.
|
|
113
|
-
*
|
|
114
|
-
* @param stats Structure to be filled in
|
|
115
|
-
* @param buf Text to process
|
|
116
|
-
* @param skip_bom Exclude leading BOM from stats if true
|
|
117
|
-
* @return Does the buffer heuristically look like binary data
|
|
118
|
-
*/
|
|
119
|
-
extern bool git_buf_text_gather_stats(
|
|
120
|
-
git_buf_text_stats *stats, const git_buf *buf, bool skip_bom);
|
|
121
|
-
|
|
122
|
-
#endif
|
data/vendor/libgit2/src/global.c
DELETED
|
@@ -1,361 +0,0 @@
|
|
|
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
|
-
#include "global.h"
|
|
9
|
-
|
|
10
|
-
#include "alloc.h"
|
|
11
|
-
#include "hash.h"
|
|
12
|
-
#include "sysdir.h"
|
|
13
|
-
#include "filter.h"
|
|
14
|
-
#include "merge_driver.h"
|
|
15
|
-
#include "streams/registry.h"
|
|
16
|
-
#include "streams/mbedtls.h"
|
|
17
|
-
#include "streams/openssl.h"
|
|
18
|
-
#include "thread-utils.h"
|
|
19
|
-
#include "git2/global.h"
|
|
20
|
-
#include "transports/ssh.h"
|
|
21
|
-
|
|
22
|
-
#if defined(GIT_MSVC_CRTDBG)
|
|
23
|
-
#include "win32/w32_stack.h"
|
|
24
|
-
#include "win32/w32_crtdbg_stacktrace.h"
|
|
25
|
-
#endif
|
|
26
|
-
|
|
27
|
-
git_mutex git__mwindow_mutex;
|
|
28
|
-
|
|
29
|
-
typedef int (*git_global_init_fn)(void);
|
|
30
|
-
|
|
31
|
-
static git_global_init_fn git__init_callbacks[] = {
|
|
32
|
-
git_allocator_global_init,
|
|
33
|
-
git_hash_global_init,
|
|
34
|
-
git_sysdir_global_init,
|
|
35
|
-
git_filter_global_init,
|
|
36
|
-
git_merge_driver_global_init,
|
|
37
|
-
git_transport_ssh_global_init,
|
|
38
|
-
git_stream_registry_global_init,
|
|
39
|
-
git_openssl_stream_global_init,
|
|
40
|
-
git_mbedtls_stream_global_init,
|
|
41
|
-
git_mwindow_global_init
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
static git_global_shutdown_fn git__shutdown_callbacks[ARRAY_SIZE(git__init_callbacks)];
|
|
45
|
-
|
|
46
|
-
static git_atomic git__n_shutdown_callbacks;
|
|
47
|
-
static git_atomic git__n_inits;
|
|
48
|
-
char *git__user_agent;
|
|
49
|
-
char *git__ssl_ciphers;
|
|
50
|
-
|
|
51
|
-
void git__on_shutdown(git_global_shutdown_fn callback)
|
|
52
|
-
{
|
|
53
|
-
int count = git_atomic_inc(&git__n_shutdown_callbacks);
|
|
54
|
-
assert(count <= (int) ARRAY_SIZE(git__shutdown_callbacks) && count > 0);
|
|
55
|
-
git__shutdown_callbacks[count - 1] = callback;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
static void git__global_state_cleanup(git_global_st *st)
|
|
59
|
-
{
|
|
60
|
-
if (!st)
|
|
61
|
-
return;
|
|
62
|
-
|
|
63
|
-
git__free(st->error_t.message);
|
|
64
|
-
st->error_t.message = NULL;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
static int init_common(void)
|
|
68
|
-
{
|
|
69
|
-
size_t i;
|
|
70
|
-
int ret;
|
|
71
|
-
|
|
72
|
-
/* Initialize the CRT debug allocator first, before our first malloc */
|
|
73
|
-
#if defined(GIT_MSVC_CRTDBG)
|
|
74
|
-
git_win32__crtdbg_stacktrace_init();
|
|
75
|
-
git_win32__stack_init();
|
|
76
|
-
#endif
|
|
77
|
-
|
|
78
|
-
/* Initialize subsystems that have global state */
|
|
79
|
-
for (i = 0; i < ARRAY_SIZE(git__init_callbacks); i++)
|
|
80
|
-
if ((ret = git__init_callbacks[i]()) != 0)
|
|
81
|
-
break;
|
|
82
|
-
|
|
83
|
-
GIT_MEMORY_BARRIER;
|
|
84
|
-
|
|
85
|
-
return ret;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
static void shutdown_common(void)
|
|
89
|
-
{
|
|
90
|
-
int pos;
|
|
91
|
-
|
|
92
|
-
/* Shutdown subsystems that have registered */
|
|
93
|
-
for (pos = git_atomic_get(&git__n_shutdown_callbacks);
|
|
94
|
-
pos > 0;
|
|
95
|
-
pos = git_atomic_dec(&git__n_shutdown_callbacks)) {
|
|
96
|
-
|
|
97
|
-
git_global_shutdown_fn cb = git__swap(
|
|
98
|
-
git__shutdown_callbacks[pos - 1], NULL);
|
|
99
|
-
|
|
100
|
-
if (cb != NULL)
|
|
101
|
-
cb();
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
git__free(git__user_agent);
|
|
105
|
-
git__free(git__ssl_ciphers);
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
/**
|
|
109
|
-
* Handle the global state with TLS
|
|
110
|
-
*
|
|
111
|
-
* If libgit2 is built with GIT_THREADS enabled,
|
|
112
|
-
* the `git_libgit2_init()` function must be called
|
|
113
|
-
* before calling any other function of the library.
|
|
114
|
-
*
|
|
115
|
-
* This function allocates a TLS index (using pthreads
|
|
116
|
-
* or the native Win32 API) to store the global state
|
|
117
|
-
* on a per-thread basis.
|
|
118
|
-
*
|
|
119
|
-
* Any internal method that requires global state will
|
|
120
|
-
* then call `git__global_state()` which returns a pointer
|
|
121
|
-
* to the global state structure; this pointer is lazily
|
|
122
|
-
* allocated on each thread.
|
|
123
|
-
*
|
|
124
|
-
* Before shutting down the library, the
|
|
125
|
-
* `git_libgit2_shutdown` method must be called to free
|
|
126
|
-
* the previously reserved TLS index.
|
|
127
|
-
*
|
|
128
|
-
* If libgit2 is built without threading support, the
|
|
129
|
-
* `git__global_statestate()` call returns a pointer to a single,
|
|
130
|
-
* statically allocated global state. The `git_thread_`
|
|
131
|
-
* functions are not available in that case.
|
|
132
|
-
*/
|
|
133
|
-
|
|
134
|
-
/*
|
|
135
|
-
* `git_libgit2_init()` allows subsystems to perform global setup,
|
|
136
|
-
* which may take place in the global scope. An explicit memory
|
|
137
|
-
* fence exists at the exit of `git_libgit2_init()`. Without this,
|
|
138
|
-
* CPU cores are free to reorder cache invalidation of `_tls_init`
|
|
139
|
-
* before cache invalidation of the subsystems' newly written global
|
|
140
|
-
* state.
|
|
141
|
-
*/
|
|
142
|
-
#if defined(GIT_THREADS) && defined(GIT_WIN32)
|
|
143
|
-
|
|
144
|
-
static DWORD _fls_index;
|
|
145
|
-
static volatile LONG _mutex = 0;
|
|
146
|
-
|
|
147
|
-
static void WINAPI fls_free(void *st)
|
|
148
|
-
{
|
|
149
|
-
git__global_state_cleanup(st);
|
|
150
|
-
git__free(st);
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
static int synchronized_threads_init(void)
|
|
154
|
-
{
|
|
155
|
-
int error;
|
|
156
|
-
|
|
157
|
-
if ((_fls_index = FlsAlloc(fls_free)) == FLS_OUT_OF_INDEXES)
|
|
158
|
-
return -1;
|
|
159
|
-
|
|
160
|
-
git_threads_init();
|
|
161
|
-
|
|
162
|
-
if (git_mutex_init(&git__mwindow_mutex))
|
|
163
|
-
return -1;
|
|
164
|
-
|
|
165
|
-
error = init_common();
|
|
166
|
-
|
|
167
|
-
return error;
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
int git_libgit2_init(void)
|
|
171
|
-
{
|
|
172
|
-
int ret;
|
|
173
|
-
|
|
174
|
-
/* Enter the lock */
|
|
175
|
-
while (InterlockedCompareExchange(&_mutex, 1, 0)) { Sleep(0); }
|
|
176
|
-
|
|
177
|
-
/* Only do work on a 0 -> 1 transition of the refcount */
|
|
178
|
-
if ((ret = git_atomic_inc(&git__n_inits)) == 1) {
|
|
179
|
-
if (synchronized_threads_init() < 0)
|
|
180
|
-
ret = -1;
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
/* Exit the lock */
|
|
184
|
-
InterlockedExchange(&_mutex, 0);
|
|
185
|
-
|
|
186
|
-
return ret;
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
int git_libgit2_shutdown(void)
|
|
190
|
-
{
|
|
191
|
-
int ret;
|
|
192
|
-
|
|
193
|
-
/* Enter the lock */
|
|
194
|
-
while (InterlockedCompareExchange(&_mutex, 1, 0)) { Sleep(0); }
|
|
195
|
-
|
|
196
|
-
/* Only do work on a 1 -> 0 transition of the refcount */
|
|
197
|
-
if ((ret = git_atomic_dec(&git__n_inits)) == 0) {
|
|
198
|
-
shutdown_common();
|
|
199
|
-
|
|
200
|
-
FlsFree(_fls_index);
|
|
201
|
-
git_mutex_free(&git__mwindow_mutex);
|
|
202
|
-
|
|
203
|
-
#if defined(GIT_MSVC_CRTDBG)
|
|
204
|
-
git_win32__crtdbg_stacktrace_cleanup();
|
|
205
|
-
git_win32__stack_cleanup();
|
|
206
|
-
#endif
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
/* Exit the lock */
|
|
210
|
-
InterlockedExchange(&_mutex, 0);
|
|
211
|
-
|
|
212
|
-
return ret;
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
git_global_st *git__global_state(void)
|
|
216
|
-
{
|
|
217
|
-
git_global_st *ptr;
|
|
218
|
-
|
|
219
|
-
assert(git_atomic_get(&git__n_inits) > 0);
|
|
220
|
-
|
|
221
|
-
if ((ptr = FlsGetValue(_fls_index)) != NULL)
|
|
222
|
-
return ptr;
|
|
223
|
-
|
|
224
|
-
ptr = git__calloc(1, sizeof(git_global_st));
|
|
225
|
-
if (!ptr)
|
|
226
|
-
return NULL;
|
|
227
|
-
|
|
228
|
-
git_buf_init(&ptr->error_buf, 0);
|
|
229
|
-
|
|
230
|
-
FlsSetValue(_fls_index, ptr);
|
|
231
|
-
return ptr;
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
#elif defined(GIT_THREADS) && defined(_POSIX_THREADS)
|
|
235
|
-
|
|
236
|
-
static pthread_key_t _tls_key;
|
|
237
|
-
static pthread_mutex_t _init_mutex = PTHREAD_MUTEX_INITIALIZER;
|
|
238
|
-
static pthread_once_t _once_init = PTHREAD_ONCE_INIT;
|
|
239
|
-
int init_error = 0;
|
|
240
|
-
|
|
241
|
-
static void cb__free_status(void *st)
|
|
242
|
-
{
|
|
243
|
-
git__global_state_cleanup(st);
|
|
244
|
-
git__free(st);
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
static void init_once(void)
|
|
248
|
-
{
|
|
249
|
-
if ((init_error = git_mutex_init(&git__mwindow_mutex)) != 0)
|
|
250
|
-
return;
|
|
251
|
-
|
|
252
|
-
pthread_key_create(&_tls_key, &cb__free_status);
|
|
253
|
-
|
|
254
|
-
init_error = init_common();
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
int git_libgit2_init(void)
|
|
258
|
-
{
|
|
259
|
-
int ret, err;
|
|
260
|
-
|
|
261
|
-
if ((err = pthread_mutex_lock(&_init_mutex)) != 0)
|
|
262
|
-
return err;
|
|
263
|
-
|
|
264
|
-
ret = git_atomic_inc(&git__n_inits);
|
|
265
|
-
err = pthread_once(&_once_init, init_once);
|
|
266
|
-
err |= pthread_mutex_unlock(&_init_mutex);
|
|
267
|
-
|
|
268
|
-
if (err || init_error)
|
|
269
|
-
return err | init_error;
|
|
270
|
-
|
|
271
|
-
return ret;
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
int git_libgit2_shutdown(void)
|
|
275
|
-
{
|
|
276
|
-
void *ptr = NULL;
|
|
277
|
-
pthread_once_t new_once = PTHREAD_ONCE_INIT;
|
|
278
|
-
int error, ret;
|
|
279
|
-
|
|
280
|
-
if ((error = pthread_mutex_lock(&_init_mutex)) != 0)
|
|
281
|
-
return error;
|
|
282
|
-
|
|
283
|
-
if ((ret = git_atomic_dec(&git__n_inits)) != 0)
|
|
284
|
-
goto out;
|
|
285
|
-
|
|
286
|
-
/* Shut down any subsystems that have global state */
|
|
287
|
-
shutdown_common();
|
|
288
|
-
|
|
289
|
-
ptr = pthread_getspecific(_tls_key);
|
|
290
|
-
pthread_setspecific(_tls_key, NULL);
|
|
291
|
-
|
|
292
|
-
git__global_state_cleanup(ptr);
|
|
293
|
-
git__free(ptr);
|
|
294
|
-
|
|
295
|
-
pthread_key_delete(_tls_key);
|
|
296
|
-
git_mutex_free(&git__mwindow_mutex);
|
|
297
|
-
_once_init = new_once;
|
|
298
|
-
|
|
299
|
-
out:
|
|
300
|
-
if ((error = pthread_mutex_unlock(&_init_mutex)) != 0)
|
|
301
|
-
return error;
|
|
302
|
-
|
|
303
|
-
return ret;
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
git_global_st *git__global_state(void)
|
|
307
|
-
{
|
|
308
|
-
git_global_st *ptr;
|
|
309
|
-
|
|
310
|
-
assert(git_atomic_get(&git__n_inits) > 0);
|
|
311
|
-
|
|
312
|
-
if ((ptr = pthread_getspecific(_tls_key)) != NULL)
|
|
313
|
-
return ptr;
|
|
314
|
-
|
|
315
|
-
ptr = git__calloc(1, sizeof(git_global_st));
|
|
316
|
-
if (!ptr)
|
|
317
|
-
return NULL;
|
|
318
|
-
|
|
319
|
-
git_buf_init(&ptr->error_buf, 0);
|
|
320
|
-
pthread_setspecific(_tls_key, ptr);
|
|
321
|
-
return ptr;
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
#else
|
|
325
|
-
|
|
326
|
-
static git_global_st __state;
|
|
327
|
-
|
|
328
|
-
int git_libgit2_init(void)
|
|
329
|
-
{
|
|
330
|
-
int ret;
|
|
331
|
-
|
|
332
|
-
/* Only init subsystems the first time */
|
|
333
|
-
if ((ret = git_atomic_inc(&git__n_inits)) != 1)
|
|
334
|
-
return ret;
|
|
335
|
-
|
|
336
|
-
if ((ret = init_common()) < 0)
|
|
337
|
-
return ret;
|
|
338
|
-
|
|
339
|
-
return 1;
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
int git_libgit2_shutdown(void)
|
|
343
|
-
{
|
|
344
|
-
int ret;
|
|
345
|
-
|
|
346
|
-
/* Shut down any subsystems that have global state */
|
|
347
|
-
if ((ret = git_atomic_dec(&git__n_inits)) == 0) {
|
|
348
|
-
shutdown_common();
|
|
349
|
-
git__global_state_cleanup(&__state);
|
|
350
|
-
memset(&__state, 0, sizeof(__state));
|
|
351
|
-
}
|
|
352
|
-
|
|
353
|
-
return ret;
|
|
354
|
-
}
|
|
355
|
-
|
|
356
|
-
git_global_st *git__global_state(void)
|
|
357
|
-
{
|
|
358
|
-
return &__state;
|
|
359
|
-
}
|
|
360
|
-
|
|
361
|
-
#endif /* GIT_THREADS */
|