rugged 1.7.2 → 1.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rugged/version.rb +1 -1
- data/vendor/libgit2/AUTHORS +1 -0
- data/vendor/libgit2/CMakeLists.txt +23 -10
- data/vendor/libgit2/COPYING +195 -1
- data/vendor/libgit2/cmake/{FindIconv.cmake → FindIntlIconv.cmake} +6 -0
- data/vendor/libgit2/cmake/FindLLHTTP.cmake +39 -0
- data/vendor/libgit2/cmake/SelectGSSAPI.cmake +1 -1
- data/vendor/libgit2/cmake/SelectHTTPParser.cmake +23 -8
- data/vendor/libgit2/cmake/SelectHTTPSBackend.cmake +17 -8
- data/vendor/libgit2/cmake/SelectHashes.cmake +28 -11
- data/vendor/libgit2/cmake/SelectRegex.cmake +6 -1
- data/vendor/libgit2/cmake/SelectSSH.cmake +22 -17
- data/vendor/libgit2/cmake/SelectZlib.cmake +4 -0
- data/vendor/libgit2/deps/llhttp/CMakeLists.txt +8 -0
- data/vendor/libgit2/deps/llhttp/LICENSE-MIT +22 -0
- data/vendor/libgit2/deps/llhttp/api.c +510 -0
- data/vendor/libgit2/deps/llhttp/http.c +170 -0
- data/vendor/libgit2/deps/llhttp/llhttp.c +10168 -0
- data/vendor/libgit2/deps/llhttp/llhttp.h +897 -0
- data/vendor/libgit2/deps/ntlmclient/CMakeLists.txt +1 -1
- data/vendor/libgit2/deps/ntlmclient/crypt_builtin_md4.c +311 -0
- data/vendor/libgit2/deps/ntlmclient/crypt_commoncrypto.c +2 -1
- data/vendor/libgit2/deps/ntlmclient/crypt_mbedtls.c +0 -20
- data/vendor/libgit2/deps/ntlmclient/crypt_openssl.c +4 -4
- data/vendor/libgit2/deps/ntlmclient/ntlm.c +21 -21
- data/vendor/libgit2/deps/ntlmclient/unicode_builtin.c +5 -4
- data/vendor/libgit2/deps/ntlmclient/unicode_iconv.c +2 -1
- data/vendor/libgit2/deps/ntlmclient/utf8.h +1176 -721
- data/vendor/libgit2/deps/ntlmclient/util.h +11 -0
- data/vendor/libgit2/deps/pcre/CMakeLists.txt +1 -0
- data/vendor/libgit2/deps/xdiff/xmerge.c +2 -2
- data/vendor/libgit2/deps/zlib/CMakeLists.txt +6 -1
- data/vendor/libgit2/deps/zlib/LICENSE +22 -0
- data/vendor/libgit2/deps/zlib/adler32.c +5 -27
- data/vendor/libgit2/deps/zlib/crc32.c +94 -167
- data/vendor/libgit2/deps/zlib/deflate.c +358 -435
- data/vendor/libgit2/deps/zlib/deflate.h +41 -10
- data/vendor/libgit2/deps/zlib/gzguts.h +13 -18
- data/vendor/libgit2/deps/zlib/infback.c +17 -30
- data/vendor/libgit2/deps/zlib/inffast.c +1 -4
- data/vendor/libgit2/deps/zlib/inffast.h +1 -1
- data/vendor/libgit2/deps/zlib/inflate.c +36 -102
- data/vendor/libgit2/deps/zlib/inftrees.c +6 -11
- data/vendor/libgit2/deps/zlib/inftrees.h +6 -6
- data/vendor/libgit2/deps/zlib/trees.c +287 -352
- data/vendor/libgit2/deps/zlib/zconf.h +23 -14
- data/vendor/libgit2/deps/zlib/zlib.h +202 -202
- data/vendor/libgit2/deps/zlib/zutil.c +18 -44
- data/vendor/libgit2/deps/zlib/zutil.h +13 -33
- data/vendor/libgit2/include/git2/annotated_commit.h +12 -5
- data/vendor/libgit2/include/git2/apply.h +27 -6
- data/vendor/libgit2/include/git2/attr.h +17 -4
- data/vendor/libgit2/include/git2/blame.h +133 -28
- data/vendor/libgit2/include/git2/blob.h +71 -28
- data/vendor/libgit2/include/git2/branch.h +22 -15
- data/vendor/libgit2/include/git2/buffer.h +6 -4
- data/vendor/libgit2/include/git2/cert.h +2 -1
- data/vendor/libgit2/include/git2/checkout.h +83 -32
- data/vendor/libgit2/include/git2/cherrypick.h +10 -3
- data/vendor/libgit2/include/git2/clone.h +25 -9
- data/vendor/libgit2/include/git2/commit.h +132 -3
- data/vendor/libgit2/include/git2/common.h +120 -63
- data/vendor/libgit2/include/git2/config.h +93 -23
- data/vendor/libgit2/include/git2/credential.h +30 -2
- data/vendor/libgit2/include/git2/credential_helpers.h +1 -0
- data/vendor/libgit2/include/git2/deprecated.h +133 -3
- data/vendor/libgit2/include/git2/describe.h +13 -1
- data/vendor/libgit2/include/git2/diff.h +38 -8
- data/vendor/libgit2/include/git2/email.h +9 -29
- data/vendor/libgit2/include/git2/errors.h +46 -73
- data/vendor/libgit2/include/git2/filter.h +14 -7
- data/vendor/libgit2/include/git2/global.h +8 -1
- data/vendor/libgit2/include/git2/graph.h +3 -2
- data/vendor/libgit2/include/git2/ignore.h +10 -0
- data/vendor/libgit2/include/git2/index.h +99 -14
- data/vendor/libgit2/include/git2/indexer.h +21 -4
- data/vendor/libgit2/include/git2/mailmap.h +7 -1
- data/vendor/libgit2/include/git2/merge.h +46 -1
- data/vendor/libgit2/include/git2/message.h +2 -2
- data/vendor/libgit2/include/git2/net.h +3 -1
- data/vendor/libgit2/include/git2/notes.h +9 -6
- data/vendor/libgit2/include/git2/object.h +9 -8
- data/vendor/libgit2/include/git2/odb.h +91 -49
- data/vendor/libgit2/include/git2/odb_backend.h +80 -52
- data/vendor/libgit2/include/git2/oid.h +23 -24
- data/vendor/libgit2/include/git2/oidarray.h +7 -1
- data/vendor/libgit2/include/git2/pack.h +13 -1
- data/vendor/libgit2/include/git2/patch.h +2 -3
- data/vendor/libgit2/include/git2/pathspec.h +9 -0
- data/vendor/libgit2/include/git2/proxy.h +10 -0
- data/vendor/libgit2/include/git2/rebase.h +9 -6
- data/vendor/libgit2/include/git2/refdb.h +2 -2
- data/vendor/libgit2/include/git2/reflog.h +3 -2
- data/vendor/libgit2/include/git2/refs.h +9 -6
- data/vendor/libgit2/include/git2/refspec.h +14 -4
- data/vendor/libgit2/include/git2/remote.h +94 -18
- data/vendor/libgit2/include/git2/repository.h +57 -21
- data/vendor/libgit2/include/git2/reset.h +16 -3
- data/vendor/libgit2/include/git2/revert.h +9 -4
- data/vendor/libgit2/include/git2/revparse.h +3 -3
- data/vendor/libgit2/include/git2/revwalk.h +3 -2
- data/vendor/libgit2/include/git2/signature.h +46 -1
- data/vendor/libgit2/include/git2/stash.h +17 -3
- data/vendor/libgit2/include/git2/status.h +10 -6
- data/vendor/libgit2/include/git2/stdint.h +87 -85
- data/vendor/libgit2/include/git2/strarray.h +2 -3
- data/vendor/libgit2/include/git2/submodule.h +20 -9
- data/vendor/libgit2/include/git2/sys/alloc.h +12 -0
- data/vendor/libgit2/include/git2/sys/commit.h +77 -3
- data/vendor/libgit2/include/git2/sys/commit_graph.h +103 -62
- data/vendor/libgit2/include/git2/sys/config.h +80 -4
- data/vendor/libgit2/include/git2/sys/credential.h +4 -3
- data/vendor/libgit2/include/git2/sys/diff.h +21 -1
- data/vendor/libgit2/include/git2/sys/email.h +7 -0
- data/vendor/libgit2/include/git2/sys/errors.h +76 -0
- data/vendor/libgit2/include/git2/sys/filter.h +66 -3
- data/vendor/libgit2/include/git2/sys/hashsig.h +11 -0
- data/vendor/libgit2/include/git2/sys/index.h +3 -2
- data/vendor/libgit2/include/git2/sys/mempack.h +32 -2
- data/vendor/libgit2/include/git2/sys/merge.h +55 -7
- data/vendor/libgit2/include/git2/sys/midx.h +43 -4
- data/vendor/libgit2/include/git2/sys/odb_backend.h +7 -3
- data/vendor/libgit2/include/git2/sys/openssl.h +8 -1
- data/vendor/libgit2/include/git2/sys/path.h +12 -1
- data/vendor/libgit2/include/git2/sys/refdb_backend.h +40 -36
- data/vendor/libgit2/include/git2/sys/refs.h +3 -2
- data/vendor/libgit2/include/git2/sys/remote.h +8 -1
- data/vendor/libgit2/include/git2/sys/repository.h +63 -3
- data/vendor/libgit2/include/git2/sys/stream.h +11 -2
- data/vendor/libgit2/include/git2/sys/transport.h +24 -3
- data/vendor/libgit2/include/git2/tag.h +3 -1
- data/vendor/libgit2/include/git2/trace.h +9 -3
- data/vendor/libgit2/include/git2/transaction.h +3 -2
- data/vendor/libgit2/include/git2/transport.h +11 -3
- data/vendor/libgit2/include/git2/tree.h +16 -5
- data/vendor/libgit2/include/git2/types.h +19 -3
- data/vendor/libgit2/include/git2/version.h +44 -8
- data/vendor/libgit2/include/git2/worktree.h +16 -6
- data/vendor/libgit2/src/CMakeLists.txt +6 -4
- data/vendor/libgit2/src/cli/CMakeLists.txt +2 -2
- data/vendor/libgit2/src/cli/cmd.c +1 -1
- data/vendor/libgit2/src/cli/cmd.h +4 -0
- data/vendor/libgit2/src/cli/cmd_blame.c +287 -0
- data/vendor/libgit2/src/cli/cmd_cat_file.c +6 -8
- data/vendor/libgit2/src/cli/cmd_clone.c +5 -7
- data/vendor/libgit2/src/cli/cmd_config.c +241 -0
- data/vendor/libgit2/src/cli/cmd_hash_object.c +6 -8
- data/vendor/libgit2/src/cli/cmd_help.c +6 -7
- data/vendor/libgit2/src/cli/cmd_index_pack.c +114 -0
- data/vendor/libgit2/src/cli/cmd_init.c +102 -0
- data/vendor/libgit2/src/cli/common.c +168 -0
- data/vendor/libgit2/src/cli/common.h +63 -0
- data/vendor/libgit2/src/cli/error.h +1 -1
- data/vendor/libgit2/src/cli/main.c +52 -24
- data/vendor/libgit2/src/cli/opt.c +29 -3
- data/vendor/libgit2/src/cli/opt.h +21 -3
- data/vendor/libgit2/src/cli/opt_usage.c +102 -33
- data/vendor/libgit2/src/cli/opt_usage.h +6 -1
- data/vendor/libgit2/src/cli/progress.c +51 -2
- data/vendor/libgit2/src/cli/progress.h +12 -0
- data/vendor/libgit2/src/cli/unix/sighandler.c +2 -1
- data/vendor/libgit2/src/cli/win32/precompiled.h +1 -1
- data/vendor/libgit2/src/cli/win32/sighandler.c +1 -1
- data/vendor/libgit2/src/libgit2/CMakeLists.txt +26 -8
- data/vendor/libgit2/src/libgit2/apply.c +10 -13
- data/vendor/libgit2/src/libgit2/attr.c +30 -13
- data/vendor/libgit2/src/libgit2/attr_file.c +7 -2
- data/vendor/libgit2/src/libgit2/attr_file.h +2 -0
- data/vendor/libgit2/src/libgit2/attrcache.c +69 -33
- data/vendor/libgit2/src/libgit2/attrcache.h +5 -9
- data/vendor/libgit2/src/libgit2/blame.c +130 -44
- data/vendor/libgit2/src/libgit2/blame.h +1 -0
- data/vendor/libgit2/src/libgit2/cache.c +22 -17
- data/vendor/libgit2/src/libgit2/cache.h +7 -9
- data/vendor/libgit2/src/libgit2/checkout.c +34 -24
- data/vendor/libgit2/src/libgit2/checkout.h +0 -2
- data/vendor/libgit2/src/libgit2/cherrypick.c +1 -2
- data/vendor/libgit2/src/libgit2/clone.c +186 -166
- data/vendor/libgit2/src/libgit2/clone.h +4 -1
- data/vendor/libgit2/src/libgit2/commit.c +92 -0
- data/vendor/libgit2/src/libgit2/commit_graph.c +67 -56
- data/vendor/libgit2/src/libgit2/commit_graph.h +1 -2
- data/vendor/libgit2/src/libgit2/config.c +389 -298
- data/vendor/libgit2/src/libgit2/config.cmake.in +3 -0
- data/vendor/libgit2/src/libgit2/config.h +9 -4
- data/vendor/libgit2/src/libgit2/config_backend.h +8 -10
- data/vendor/libgit2/src/libgit2/config_cache.c +4 -5
- data/vendor/libgit2/src/libgit2/config_file.c +99 -88
- data/vendor/libgit2/src/libgit2/config_list.c +285 -0
- data/vendor/libgit2/src/libgit2/config_list.h +32 -0
- data/vendor/libgit2/src/libgit2/config_mem.c +194 -40
- data/vendor/libgit2/src/libgit2/config_parse.c +10 -9
- data/vendor/libgit2/src/libgit2/config_snapshot.c +24 -31
- data/vendor/libgit2/src/libgit2/describe.c +24 -24
- data/vendor/libgit2/src/libgit2/diff.c +1 -1
- data/vendor/libgit2/src/libgit2/diff_driver.c +12 -19
- data/vendor/libgit2/src/libgit2/diff_driver.h +2 -2
- data/vendor/libgit2/src/libgit2/diff_generate.c +3 -3
- data/vendor/libgit2/src/libgit2/diff_parse.c +2 -2
- data/vendor/libgit2/src/libgit2/diff_print.c +65 -9
- data/vendor/libgit2/src/libgit2/diff_tform.c +36 -8
- data/vendor/libgit2/src/libgit2/email.c +1 -0
- data/vendor/libgit2/src/libgit2/fetch.c +5 -3
- data/vendor/libgit2/src/libgit2/filter.c +5 -5
- data/vendor/libgit2/src/libgit2/git2.rc +3 -3
- data/vendor/libgit2/src/libgit2/grafts.c +18 -20
- data/vendor/libgit2/src/libgit2/grafts.h +0 -1
- data/vendor/libgit2/src/libgit2/graph.c +1 -1
- data/vendor/libgit2/src/libgit2/hashmap_oid.h +30 -0
- data/vendor/libgit2/src/libgit2/ignore.c +9 -5
- data/vendor/libgit2/src/libgit2/index.c +68 -90
- data/vendor/libgit2/src/libgit2/index.h +2 -2
- data/vendor/libgit2/src/libgit2/index_map.c +95 -0
- data/vendor/libgit2/src/libgit2/index_map.h +28 -0
- data/vendor/libgit2/src/libgit2/indexer.c +34 -38
- data/vendor/libgit2/src/libgit2/iterator.c +14 -8
- data/vendor/libgit2/src/libgit2/libgit2.c +153 -368
- data/vendor/libgit2/src/libgit2/mailmap.c +1 -1
- data/vendor/libgit2/src/libgit2/merge.c +42 -37
- data/vendor/libgit2/src/libgit2/merge_driver.c +2 -2
- data/vendor/libgit2/src/libgit2/midx.c +28 -15
- data/vendor/libgit2/src/libgit2/mwindow.c +38 -45
- data/vendor/libgit2/src/libgit2/mwindow.h +4 -0
- data/vendor/libgit2/src/libgit2/object.c +6 -5
- data/vendor/libgit2/src/libgit2/odb.c +5 -4
- data/vendor/libgit2/src/libgit2/odb_mempack.c +49 -17
- data/vendor/libgit2/src/libgit2/odb_pack.c +13 -5
- data/vendor/libgit2/src/libgit2/oid.c +32 -5
- data/vendor/libgit2/src/libgit2/oid.h +11 -0
- data/vendor/libgit2/src/libgit2/pack-objects.c +58 -31
- data/vendor/libgit2/src/libgit2/pack-objects.h +12 -4
- data/vendor/libgit2/src/libgit2/pack.c +30 -24
- data/vendor/libgit2/src/libgit2/pack.h +15 -10
- data/vendor/libgit2/src/libgit2/patch_parse.c +2 -2
- data/vendor/libgit2/src/libgit2/path.c +1 -1
- data/vendor/libgit2/src/libgit2/pathspec.c +1 -1
- data/vendor/libgit2/src/libgit2/push.c +79 -28
- data/vendor/libgit2/src/libgit2/push.h +1 -0
- data/vendor/libgit2/src/libgit2/refdb_fs.c +128 -61
- data/vendor/libgit2/src/libgit2/reflog.c +1 -2
- data/vendor/libgit2/src/libgit2/reflog.h +2 -0
- data/vendor/libgit2/src/libgit2/refs.c +26 -7
- data/vendor/libgit2/src/libgit2/refs.h +6 -1
- data/vendor/libgit2/src/libgit2/refspec.c +28 -1
- data/vendor/libgit2/src/libgit2/refspec.h +8 -0
- data/vendor/libgit2/src/libgit2/remote.c +121 -61
- data/vendor/libgit2/src/libgit2/repository.c +231 -51
- data/vendor/libgit2/src/libgit2/repository.h +10 -6
- data/vendor/libgit2/src/libgit2/revert.c +1 -2
- data/vendor/libgit2/src/libgit2/revparse.c +2 -2
- data/vendor/libgit2/src/libgit2/revwalk.c +13 -10
- data/vendor/libgit2/src/libgit2/revwalk.h +3 -3
- data/vendor/libgit2/src/libgit2/settings.c +468 -0
- data/vendor/libgit2/src/libgit2/settings.h +6 -2
- data/vendor/libgit2/src/libgit2/signature.c +132 -15
- data/vendor/libgit2/src/libgit2/signature.h +0 -1
- data/vendor/libgit2/src/libgit2/status.c +1 -1
- data/vendor/libgit2/src/libgit2/streams/mbedtls.c +54 -60
- data/vendor/libgit2/src/libgit2/streams/openssl.c +32 -7
- data/vendor/libgit2/src/libgit2/streams/openssl.h +2 -0
- data/vendor/libgit2/src/libgit2/streams/openssl_dynamic.c +4 -0
- data/vendor/libgit2/src/libgit2/streams/openssl_dynamic.h +3 -0
- data/vendor/libgit2/src/libgit2/streams/stransport.c +39 -7
- data/vendor/libgit2/src/libgit2/submodule.c +106 -63
- data/vendor/libgit2/src/libgit2/submodule.h +6 -7
- data/vendor/libgit2/src/libgit2/tag.c +1 -1
- data/vendor/libgit2/src/libgit2/trailer.c +6 -6
- data/vendor/libgit2/src/libgit2/transaction.c +26 -20
- data/vendor/libgit2/src/libgit2/transaction.h +4 -1
- data/vendor/libgit2/src/libgit2/transport.c +4 -1
- data/vendor/libgit2/src/libgit2/transports/credential.c +1 -1
- data/vendor/libgit2/src/libgit2/transports/http.c +1 -2
- data/vendor/libgit2/src/libgit2/transports/http.h +0 -10
- data/vendor/libgit2/src/libgit2/transports/httpclient.c +112 -72
- data/vendor/libgit2/src/libgit2/transports/httpparser.c +128 -0
- data/vendor/libgit2/src/libgit2/transports/httpparser.h +99 -0
- data/vendor/libgit2/src/libgit2/transports/local.c +8 -7
- data/vendor/libgit2/src/libgit2/transports/smart.c +20 -8
- data/vendor/libgit2/src/libgit2/transports/smart.h +4 -2
- data/vendor/libgit2/src/libgit2/transports/smart_pkt.c +2 -2
- data/vendor/libgit2/src/libgit2/transports/smart_protocol.c +55 -10
- data/vendor/libgit2/src/libgit2/transports/ssh.c +41 -1103
- data/vendor/libgit2/src/libgit2/transports/ssh_exec.c +347 -0
- data/vendor/libgit2/src/libgit2/transports/ssh_exec.h +26 -0
- data/vendor/libgit2/src/libgit2/transports/ssh_libssh2.c +1126 -0
- data/vendor/libgit2/src/libgit2/transports/ssh_libssh2.h +28 -0
- data/vendor/libgit2/src/libgit2/transports/winhttp.c +35 -7
- data/vendor/libgit2/src/libgit2/tree.c +34 -26
- data/vendor/libgit2/src/libgit2/tree.h +3 -2
- data/vendor/libgit2/src/libgit2/worktree.c +14 -17
- data/vendor/libgit2/src/util/CMakeLists.txt +4 -6
- data/vendor/libgit2/src/util/alloc.c +4 -1
- data/vendor/libgit2/src/util/allocators/debugalloc.c +73 -0
- data/vendor/libgit2/src/{cli/cli.h → util/allocators/debugalloc.h} +6 -9
- data/vendor/libgit2/src/util/allocators/stdalloc.c +0 -10
- data/vendor/libgit2/src/util/array.h +18 -17
- data/vendor/libgit2/src/util/cc-compat.h +2 -0
- data/vendor/libgit2/src/util/ctype_compat.h +70 -0
- data/vendor/libgit2/src/util/date.c +22 -14
- data/vendor/libgit2/src/util/date.h +12 -0
- data/vendor/libgit2/src/util/errors.c +401 -0
- data/vendor/libgit2/src/{libgit2 → util}/errors.h +21 -17
- data/vendor/libgit2/src/util/fs_path.c +15 -4
- data/vendor/libgit2/src/util/fs_path.h +23 -0
- data/vendor/libgit2/src/util/futils.c +6 -5
- data/vendor/libgit2/src/util/futils.h +13 -4
- data/vendor/libgit2/src/util/git2_features.h.in +12 -1
- data/vendor/libgit2/src/util/git2_util.h +6 -0
- data/vendor/libgit2/src/util/hash/openssl.c +152 -0
- data/vendor/libgit2/src/util/hash/openssl.h +17 -1
- data/vendor/libgit2/src/util/hash/sha.h +4 -1
- data/vendor/libgit2/src/util/hashmap.h +424 -0
- data/vendor/libgit2/src/util/hashmap_str.h +43 -0
- data/vendor/libgit2/src/util/integer.h +3 -1
- data/vendor/libgit2/src/util/net.c +13 -7
- data/vendor/libgit2/src/util/net.h +2 -0
- data/vendor/libgit2/src/util/pool.c +1 -1
- data/vendor/libgit2/src/util/pool.h +5 -0
- data/vendor/libgit2/src/util/pqueue.h +1 -1
- data/vendor/libgit2/src/util/process.h +222 -0
- data/vendor/libgit2/src/util/rand.c +1 -7
- data/vendor/libgit2/src/util/regexp.c +1 -1
- data/vendor/libgit2/src/util/sortedcache.c +14 -13
- data/vendor/libgit2/src/util/sortedcache.h +3 -3
- data/vendor/libgit2/src/util/str.c +2 -2
- data/vendor/libgit2/src/util/strlist.c +108 -0
- data/vendor/libgit2/src/util/strlist.h +36 -0
- data/vendor/libgit2/src/util/unix/posix.h +0 -2
- data/vendor/libgit2/src/util/unix/process.c +629 -0
- data/vendor/libgit2/src/util/unix/realpath.c +23 -5
- data/vendor/libgit2/src/util/util.c +2 -2
- data/vendor/libgit2/src/util/util.h +4 -38
- data/vendor/libgit2/src/util/vector.c +3 -3
- data/vendor/libgit2/src/util/vector.h +2 -2
- data/vendor/libgit2/src/util/win32/posix_w32.c +29 -6
- data/vendor/libgit2/src/util/win32/process.c +506 -0
- metadata +45 -28
- data/vendor/libgit2/deps/http-parser/CMakeLists.txt +0 -6
- data/vendor/libgit2/deps/http-parser/COPYING +0 -23
- data/vendor/libgit2/deps/http-parser/http_parser.c +0 -2182
- data/vendor/libgit2/deps/http-parser/http_parser.h +0 -305
- data/vendor/libgit2/deps/zlib/COPYING +0 -27
- data/vendor/libgit2/include/git2/sys/reflog.h +0 -21
- data/vendor/libgit2/src/libgit2/config_entries.c +0 -237
- data/vendor/libgit2/src/libgit2/config_entries.h +0 -24
- data/vendor/libgit2/src/libgit2/errors.c +0 -293
- data/vendor/libgit2/src/libgit2/idxmap.c +0 -157
- data/vendor/libgit2/src/libgit2/idxmap.h +0 -177
- data/vendor/libgit2/src/libgit2/libgit2.h +0 -15
- data/vendor/libgit2/src/libgit2/offmap.c +0 -101
- data/vendor/libgit2/src/libgit2/offmap.h +0 -133
- data/vendor/libgit2/src/libgit2/oidmap.c +0 -107
- data/vendor/libgit2/src/libgit2/oidmap.h +0 -128
- data/vendor/libgit2/src/libgit2/threadstate.c +0 -97
- data/vendor/libgit2/src/libgit2/threadstate.h +0 -22
- data/vendor/libgit2/src/libgit2/transports/ssh.h +0 -14
- data/vendor/libgit2/src/util/khash.h +0 -615
- data/vendor/libgit2/src/util/strmap.c +0 -100
- data/vendor/libgit2/src/util/strmap.h +0 -131
- /data/vendor/libgit2/cmake/{FindHTTPParser.cmake → FindHTTP_Parser.cmake} +0 -0
@@ -0,0 +1,28 @@
|
|
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_transports_libssh2_h__
|
8
|
+
#define INCLUDE_transports_libssh2_h__
|
9
|
+
|
10
|
+
#include "common.h"
|
11
|
+
|
12
|
+
#include "git2.h"
|
13
|
+
#include "git2/transport.h"
|
14
|
+
#include "git2/sys/transport.h"
|
15
|
+
|
16
|
+
int git_transport_ssh_libssh2_global_init(void);
|
17
|
+
|
18
|
+
int git_smart_subtransport_ssh_libssh2(
|
19
|
+
git_smart_subtransport **out,
|
20
|
+
git_transport *owner,
|
21
|
+
void *param);
|
22
|
+
|
23
|
+
int git_smart_subtransport_ssh_libssh2_set_paths(
|
24
|
+
git_smart_subtransport *subtransport,
|
25
|
+
const char *cmd_uploadpack,
|
26
|
+
const char *cmd_receivepack);
|
27
|
+
|
28
|
+
#endif
|
@@ -293,7 +293,7 @@ static int certificate_check(winhttp_stream *s, int valid)
|
|
293
293
|
|
294
294
|
/* If there is no override, we should fail if WinHTTP doesn't think it's fine */
|
295
295
|
if (t->owner->connect_opts.callbacks.certificate_check == NULL && !valid) {
|
296
|
-
if (
|
296
|
+
if (git_error_last()->klass == GIT_ERROR_NONE)
|
297
297
|
git_error_set(GIT_ERROR_HTTP, "unknown certificate check failure");
|
298
298
|
|
299
299
|
return GIT_ECERTIFICATE;
|
@@ -317,7 +317,7 @@ static int certificate_check(winhttp_stream *s, int valid)
|
|
317
317
|
if (error == GIT_PASSTHROUGH)
|
318
318
|
error = valid ? 0 : GIT_ECERTIFICATE;
|
319
319
|
|
320
|
-
if (error < 0 &&
|
320
|
+
if (error < 0 && git_error_last()->klass == GIT_ERROR_NONE)
|
321
321
|
git_error_set(GIT_ERROR_HTTP, "user cancelled certificate check");
|
322
322
|
|
323
323
|
return error;
|
@@ -436,7 +436,7 @@ static int winhttp_stream_connect(winhttp_stream *s)
|
|
436
436
|
GIT_ERROR_CHECK_ALLOC(proxy_url);
|
437
437
|
}
|
438
438
|
|
439
|
-
if (proxy_url) {
|
439
|
+
if (proxy_url && *proxy_url) {
|
440
440
|
git_str processed_url = GIT_STR_INIT;
|
441
441
|
WINHTTP_PROXY_INFO proxy_info;
|
442
442
|
wchar_t *proxy_wide;
|
@@ -746,6 +746,33 @@ static void CALLBACK winhttp_status(
|
|
746
746
|
}
|
747
747
|
}
|
748
748
|
|
749
|
+
static int user_agent(bool *exists, git_str *out)
|
750
|
+
{
|
751
|
+
const char *product = git_settings__user_agent_product();
|
752
|
+
const char *comment = git_settings__user_agent();
|
753
|
+
|
754
|
+
GIT_ASSERT(product && comment);
|
755
|
+
|
756
|
+
if (!*product) {
|
757
|
+
*exists = false;
|
758
|
+
return 0;
|
759
|
+
}
|
760
|
+
|
761
|
+
git_str_puts(out, product);
|
762
|
+
|
763
|
+
if (*comment) {
|
764
|
+
git_str_puts(out, " (");
|
765
|
+
git_str_puts(out, comment);
|
766
|
+
git_str_puts(out, ")");
|
767
|
+
}
|
768
|
+
|
769
|
+
if (git_str_oom(out))
|
770
|
+
return -1;
|
771
|
+
|
772
|
+
*exists = true;
|
773
|
+
return 0;
|
774
|
+
}
|
775
|
+
|
749
776
|
static int winhttp_connect(
|
750
777
|
winhttp_subtransport *t)
|
751
778
|
{
|
@@ -757,6 +784,7 @@ static int winhttp_connect(
|
|
757
784
|
int error = -1;
|
758
785
|
int default_timeout = TIMEOUT_INFINITE;
|
759
786
|
int default_connect_timeout = DEFAULT_CONNECT_TIMEOUT;
|
787
|
+
bool has_ua = true;
|
760
788
|
DWORD protocols =
|
761
789
|
WINHTTP_FLAG_SECURE_PROTOCOL_TLS1 |
|
762
790
|
WINHTTP_FLAG_SECURE_PROTOCOL_TLS1_1 |
|
@@ -787,11 +815,11 @@ static int winhttp_connect(
|
|
787
815
|
goto on_error;
|
788
816
|
}
|
789
817
|
|
790
|
-
|
791
|
-
if (git_http__user_agent(&ua) < 0)
|
818
|
+
if (user_agent(&has_ua, &ua) < 0)
|
792
819
|
goto on_error;
|
793
820
|
|
794
|
-
if (
|
821
|
+
if (has_ua &&
|
822
|
+
git_utf8_to_16_alloc(&wide_ua, git_str_cstr(&ua)) < 0) {
|
795
823
|
git_error_set(GIT_ERROR_OS, "unable to convert host to wide characters");
|
796
824
|
goto on_error;
|
797
825
|
}
|
@@ -933,7 +961,7 @@ static int send_request(winhttp_stream *s, size_t len, bool chunked)
|
|
933
961
|
(!request_failed && s->status_sending_request_reached)) {
|
934
962
|
git_error_clear();
|
935
963
|
if ((error = certificate_check(s, cert_valid)) < 0) {
|
936
|
-
if (
|
964
|
+
if (git_error_last()->klass == GIT_ERROR_NONE)
|
937
965
|
git_error_set(GIT_ERROR_OS, "user cancelled certificate check");
|
938
966
|
|
939
967
|
return error;
|
@@ -21,6 +21,8 @@
|
|
21
21
|
#define TREE_ENTRY_CHECK_NAMELEN(n) \
|
22
22
|
if (n > UINT16_MAX) { git_error_set(GIT_ERROR_INVALID, "tree entry path too long"); }
|
23
23
|
|
24
|
+
GIT_HASHMAP_STR_FUNCTIONS(git_treebuilder_entrymap, GIT_HASHMAP_INLINE, git_tree_entry *);
|
25
|
+
|
24
26
|
static bool valid_filemode(const int filemode)
|
25
27
|
{
|
26
28
|
return (filemode == GIT_FILEMODE_TREE
|
@@ -347,7 +349,7 @@ size_t git_treebuilder_entrycount(git_treebuilder *bld)
|
|
347
349
|
{
|
348
350
|
GIT_ASSERT_ARG_WITH_RETVAL(bld, 0);
|
349
351
|
|
350
|
-
return
|
352
|
+
return git_treebuilder_entrymap_size(&bld->map);
|
351
353
|
}
|
352
354
|
|
353
355
|
GIT_INLINE(void) set_error(const char *str, const char *path)
|
@@ -381,7 +383,7 @@ static int parse_mode(uint16_t *mode_out, const char *buffer, size_t buffer_len,
|
|
381
383
|
if ((error = git__strntol32(&mode, buffer, buffer_len, buffer_out, 8)) < 0)
|
382
384
|
return error;
|
383
385
|
|
384
|
-
if (mode < 0 || mode > UINT16_MAX)
|
386
|
+
if (mode < 0 || (uint32_t)mode > UINT16_MAX)
|
385
387
|
return -1;
|
386
388
|
|
387
389
|
*mode_out = mode;
|
@@ -512,10 +514,12 @@ static int git_treebuilder__write_with_buffer(
|
|
512
514
|
git_tree_entry *entry;
|
513
515
|
git_vector entries = GIT_VECTOR_INIT;
|
514
516
|
size_t oid_size = git_oid_size(bld->repo->oid_type);
|
517
|
+
git_hashmap_iter_t iter = GIT_HASHMAP_ITER_INIT;
|
515
518
|
|
516
519
|
git_str_clear(buf);
|
517
520
|
|
518
|
-
entrycount =
|
521
|
+
entrycount = git_treebuilder_entrymap_size(&bld->map);
|
522
|
+
|
519
523
|
if ((error = git_vector_init(&entries, entrycount, entry_sort_cmp)) < 0)
|
520
524
|
goto out;
|
521
525
|
|
@@ -523,10 +527,10 @@ static int git_treebuilder__write_with_buffer(
|
|
523
527
|
(error = git_str_grow(buf, entrycount * 72)) < 0)
|
524
528
|
goto out;
|
525
529
|
|
526
|
-
|
530
|
+
while (git_treebuilder_entrymap_iterate(&iter, NULL, &entry, &bld->map) == 0) {
|
527
531
|
if ((error = git_vector_insert(&entries, entry)) < 0)
|
528
532
|
goto out;
|
529
|
-
}
|
533
|
+
}
|
530
534
|
|
531
535
|
git_vector_sort(&entries);
|
532
536
|
|
@@ -547,7 +551,7 @@ static int git_treebuilder__write_with_buffer(
|
|
547
551
|
error = git_odb_write(oid, odb, buf->ptr, buf->size, GIT_OBJECT_TREE);
|
548
552
|
|
549
553
|
out:
|
550
|
-
|
554
|
+
git_vector_dispose(&entries);
|
551
555
|
|
552
556
|
return error;
|
553
557
|
}
|
@@ -570,7 +574,7 @@ static int append_entry(
|
|
570
574
|
|
571
575
|
entry->attr = (uint16_t)filemode;
|
572
576
|
|
573
|
-
if ((error =
|
577
|
+
if ((error = git_treebuilder_entrymap_put(&bld->map, entry->filename, entry)) < 0) {
|
574
578
|
git_tree_entry_free(entry);
|
575
579
|
git_error_set(GIT_ERROR_TREE, "failed to append entry %s to the tree builder", filename);
|
576
580
|
return -1;
|
@@ -753,11 +757,6 @@ int git_treebuilder_new(
|
|
753
757
|
|
754
758
|
bld->repo = repo;
|
755
759
|
|
756
|
-
if (git_strmap_new(&bld->map) < 0) {
|
757
|
-
git__free(bld);
|
758
|
-
return -1;
|
759
|
-
}
|
760
|
-
|
761
760
|
if (source != NULL) {
|
762
761
|
git_tree_entry *entry_src;
|
763
762
|
|
@@ -796,13 +795,13 @@ int git_treebuilder_insert(
|
|
796
795
|
if ((error = check_entry(bld->repo, filename, id, filemode)) < 0)
|
797
796
|
return error;
|
798
797
|
|
799
|
-
if ((entry
|
798
|
+
if (git_treebuilder_entrymap_get(&entry, &bld->map, filename) == 0) {
|
800
799
|
git_oid_cpy(&entry->oid, id);
|
801
800
|
} else {
|
802
801
|
entry = alloc_entry(filename, strlen(filename), id);
|
803
802
|
GIT_ERROR_CHECK_ALLOC(entry);
|
804
803
|
|
805
|
-
if ((
|
804
|
+
if (git_treebuilder_entrymap_put(&bld->map, entry->filename, entry) < 0) {
|
806
805
|
git_tree_entry_free(entry);
|
807
806
|
git_error_set(GIT_ERROR_TREE, "failed to insert %s", filename);
|
808
807
|
return -1;
|
@@ -819,10 +818,15 @@ int git_treebuilder_insert(
|
|
819
818
|
|
820
819
|
static git_tree_entry *treebuilder_get(git_treebuilder *bld, const char *filename)
|
821
820
|
{
|
821
|
+
git_tree_entry *entry;
|
822
|
+
|
822
823
|
GIT_ASSERT_ARG_WITH_RETVAL(bld, NULL);
|
823
824
|
GIT_ASSERT_ARG_WITH_RETVAL(filename, NULL);
|
824
825
|
|
825
|
-
|
826
|
+
if (git_treebuilder_entrymap_get(&entry, &bld->map, filename) != 0)
|
827
|
+
return NULL;
|
828
|
+
|
829
|
+
return entry;
|
826
830
|
}
|
827
831
|
|
828
832
|
const git_tree_entry *git_treebuilder_get(git_treebuilder *bld, const char *filename)
|
@@ -837,7 +841,7 @@ int git_treebuilder_remove(git_treebuilder *bld, const char *filename)
|
|
837
841
|
if (entry == NULL)
|
838
842
|
return tree_error("failed to remove entry: file isn't in the tree", filename);
|
839
843
|
|
840
|
-
|
844
|
+
git_treebuilder_entrymap_remove(&bld->map, filename);
|
841
845
|
git_tree_entry_free(entry);
|
842
846
|
|
843
847
|
return 0;
|
@@ -858,16 +862,17 @@ int git_treebuilder_filter(
|
|
858
862
|
{
|
859
863
|
const char *filename;
|
860
864
|
git_tree_entry *entry;
|
865
|
+
git_hashmap_iter_t iter = GIT_HASHMAP_ITER_INIT;
|
861
866
|
|
862
867
|
GIT_ASSERT_ARG(bld);
|
863
868
|
GIT_ASSERT_ARG(filter);
|
864
869
|
|
865
|
-
|
866
|
-
|
867
|
-
|
868
|
-
|
869
|
-
|
870
|
-
}
|
870
|
+
while (git_treebuilder_entrymap_iterate(&iter, &filename, &entry, &bld->map) == 0) {
|
871
|
+
if (filter(entry, payload)) {
|
872
|
+
git_treebuilder_entrymap_remove(&bld->map, filename);
|
873
|
+
git_tree_entry_free(entry);
|
874
|
+
}
|
875
|
+
}
|
871
876
|
|
872
877
|
return 0;
|
873
878
|
}
|
@@ -875,11 +880,14 @@ int git_treebuilder_filter(
|
|
875
880
|
int git_treebuilder_clear(git_treebuilder *bld)
|
876
881
|
{
|
877
882
|
git_tree_entry *e;
|
883
|
+
git_hashmap_iter_t iter = GIT_HASHMAP_ITER_INIT;
|
878
884
|
|
879
885
|
GIT_ASSERT_ARG(bld);
|
880
886
|
|
881
|
-
|
882
|
-
|
887
|
+
while (git_treebuilder_entrymap_iterate(&iter, NULL, &e, &bld->map) == 0)
|
888
|
+
git_tree_entry_free(e);
|
889
|
+
|
890
|
+
git_treebuilder_entrymap_clear(&bld->map);
|
883
891
|
|
884
892
|
return 0;
|
885
893
|
}
|
@@ -891,7 +899,7 @@ void git_treebuilder_free(git_treebuilder *bld)
|
|
891
899
|
|
892
900
|
git_str_dispose(&bld->write_cache);
|
893
901
|
git_treebuilder_clear(bld);
|
894
|
-
|
902
|
+
git_treebuilder_entrymap_dispose(&bld->map);
|
895
903
|
git__free(bld);
|
896
904
|
}
|
897
905
|
|
@@ -1312,7 +1320,7 @@ cleanup:
|
|
1312
1320
|
|
1313
1321
|
git_str_dispose(&component);
|
1314
1322
|
git_array_clear(stack);
|
1315
|
-
|
1323
|
+
git_vector_dispose(&entries);
|
1316
1324
|
return error;
|
1317
1325
|
}
|
1318
1326
|
|
@@ -13,7 +13,6 @@
|
|
13
13
|
#include "repository.h"
|
14
14
|
#include "odb.h"
|
15
15
|
#include "vector.h"
|
16
|
-
#include "strmap.h"
|
17
16
|
#include "pool.h"
|
18
17
|
|
19
18
|
struct git_tree_entry {
|
@@ -29,9 +28,11 @@ struct git_tree {
|
|
29
28
|
git_array_t(git_tree_entry) entries;
|
30
29
|
};
|
31
30
|
|
31
|
+
GIT_HASHMAP_STR_STRUCT(git_treebuilder_entrymap, git_tree_entry *);
|
32
|
+
|
32
33
|
struct git_treebuilder {
|
33
34
|
git_repository *repo;
|
34
|
-
|
35
|
+
git_treebuilder_entrymap map;
|
35
36
|
git_str write_cache;
|
36
37
|
};
|
37
38
|
|
@@ -335,11 +335,21 @@ int git_worktree_add(git_worktree **out, git_repository *repo,
|
|
335
335
|
goto out;
|
336
336
|
}
|
337
337
|
|
338
|
-
if (
|
339
|
-
git_error_set(GIT_ERROR_WORKTREE, "reference is already checked out");
|
340
|
-
err = -1;
|
338
|
+
if ((err = git_reference_dup(&ref, wtopts.ref)) < 0)
|
341
339
|
goto out;
|
342
|
-
|
340
|
+
} else if (wtopts.checkout_existing && git_branch_lookup(&ref, repo, name, GIT_BRANCH_LOCAL) == 0) {
|
341
|
+
/* Do nothing */
|
342
|
+
} else if ((err = git_repository_head(&head, repo)) < 0 ||
|
343
|
+
(err = git_commit_lookup(&commit, repo, &head->target.oid)) < 0 ||
|
344
|
+
(err = git_branch_create(&ref, repo, name, commit, false)) < 0) {
|
345
|
+
goto out;
|
346
|
+
}
|
347
|
+
|
348
|
+
if (git_branch_is_checked_out(ref)) {
|
349
|
+
git_error_set(GIT_ERROR_WORKTREE, "reference %s is already checked out",
|
350
|
+
git_reference_name(ref));
|
351
|
+
err = -1;
|
352
|
+
goto out;
|
343
353
|
}
|
344
354
|
|
345
355
|
/* Create gitdir directory ".git/worktrees/<name>" */
|
@@ -392,19 +402,6 @@ int git_worktree_add(git_worktree **out, git_repository *repo,
|
|
392
402
|
|| (err = write_wtfile(gitdir.ptr, "gitdir", &buf)) < 0)
|
393
403
|
goto out;
|
394
404
|
|
395
|
-
/* Set up worktree reference */
|
396
|
-
if (wtopts.ref) {
|
397
|
-
if ((err = git_reference_dup(&ref, wtopts.ref)) < 0)
|
398
|
-
goto out;
|
399
|
-
} else {
|
400
|
-
if ((err = git_repository_head(&head, repo)) < 0)
|
401
|
-
goto out;
|
402
|
-
if ((err = git_commit_lookup(&commit, repo, &head->target.oid)) < 0)
|
403
|
-
goto out;
|
404
|
-
if ((err = git_branch_create(&ref, repo, name, commit, false)) < 0)
|
405
|
-
goto out;
|
406
|
-
}
|
407
|
-
|
408
405
|
/* Set worktree's HEAD */
|
409
406
|
if ((err = git_repository_create_head(gitdir.ptr, git_reference_name(ref))) < 0)
|
410
407
|
goto out;
|
@@ -1,8 +1,6 @@
|
|
1
1
|
# util: a shared library for common utility functions for libgit2 projects
|
2
2
|
|
3
3
|
add_library(util OBJECT)
|
4
|
-
set_target_properties(util PROPERTIES C_STANDARD 90)
|
5
|
-
set_target_properties(util PROPERTIES C_EXTENSIONS OFF)
|
6
4
|
|
7
5
|
configure_file(git2_features.h.in git2_features.h)
|
8
6
|
|
@@ -36,7 +34,7 @@ if(USE_SHA1 STREQUAL "CollisionDetection")
|
|
36
34
|
target_compile_definitions(util PRIVATE SHA1DC_NO_STANDARD_INCLUDES=1)
|
37
35
|
target_compile_definitions(util PRIVATE SHA1DC_CUSTOM_INCLUDE_SHA1_C=\"git2_util.h\")
|
38
36
|
target_compile_definitions(util PRIVATE SHA1DC_CUSTOM_INCLUDE_UBC_CHECK_C=\"git2_util.h\")
|
39
|
-
elseif(USE_SHA1 STREQUAL "OpenSSL" OR USE_SHA1 STREQUAL "OpenSSL-Dynamic")
|
37
|
+
elseif(USE_SHA1 STREQUAL "OpenSSL" OR USE_SHA1 STREQUAL "OpenSSL-Dynamic" OR USE_SHA1 STREQUAL "OpenSSL-FIPS")
|
40
38
|
add_definitions(-DOPENSSL_API_COMPAT=0x10100000L)
|
41
39
|
file(GLOB UTIL_SRC_SHA1 hash/openssl.*)
|
42
40
|
elseif(USE_SHA1 STREQUAL "CommonCrypto")
|
@@ -51,9 +49,9 @@ endif()
|
|
51
49
|
|
52
50
|
list(SORT UTIL_SRC_SHA1)
|
53
51
|
|
54
|
-
if(USE_SHA256 STREQUAL "
|
52
|
+
if(USE_SHA256 STREQUAL "builtin")
|
55
53
|
file(GLOB UTIL_SRC_SHA256 hash/builtin.* hash/rfc6234/*)
|
56
|
-
elseif(USE_SHA256 STREQUAL "OpenSSL" OR USE_SHA256 STREQUAL "OpenSSL-Dynamic")
|
54
|
+
elseif(USE_SHA256 STREQUAL "OpenSSL" OR USE_SHA256 STREQUAL "OpenSSL-Dynamic" OR USE_SHA256 STREQUAL "OpenSSL-FIPS")
|
57
55
|
add_definitions(-DOPENSSL_API_COMPAT=0x10100000L)
|
58
56
|
file(GLOB UTIL_SRC_SHA256 hash/openssl.*)
|
59
57
|
elseif(USE_SHA256 STREQUAL "CommonCrypto")
|
@@ -63,7 +61,7 @@ elseif(USE_SHA256 STREQUAL "mbedTLS")
|
|
63
61
|
elseif(USE_SHA256 STREQUAL "Win32")
|
64
62
|
file(GLOB UTIL_SRC_SHA256 hash/win32.*)
|
65
63
|
else()
|
66
|
-
message(FATAL_ERROR "
|
64
|
+
message(FATAL_ERROR "asked for unknown SHA256 backend: ${USE_SHA256}")
|
67
65
|
endif()
|
68
66
|
|
69
67
|
list(SORT UTIL_SRC_SHA256)
|
@@ -8,8 +8,9 @@
|
|
8
8
|
#include "alloc.h"
|
9
9
|
#include "runtime.h"
|
10
10
|
|
11
|
-
#include "allocators/failalloc.h"
|
12
11
|
#include "allocators/stdalloc.h"
|
12
|
+
#include "allocators/debugalloc.h"
|
13
|
+
#include "allocators/failalloc.h"
|
13
14
|
#include "allocators/win32_leakcheck.h"
|
14
15
|
|
15
16
|
/* Fail any allocation until git_libgit2_init is called. */
|
@@ -88,6 +89,8 @@ static int setup_default_allocator(void)
|
|
88
89
|
{
|
89
90
|
#if defined(GIT_WIN32_LEAKCHECK)
|
90
91
|
return git_win32_leakcheck_init_allocator(&git__allocator);
|
92
|
+
#elif defined(GIT_DEBUG_STRICT_ALLOC)
|
93
|
+
return git_debugalloc_init_allocator(&git__allocator);
|
91
94
|
#else
|
92
95
|
return git_stdalloc_init_allocator(&git__allocator);
|
93
96
|
#endif
|
@@ -0,0 +1,73 @@
|
|
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 "debugalloc.h"
|
9
|
+
|
10
|
+
static void *debugalloc__malloc(size_t len, const char *file, int line)
|
11
|
+
{
|
12
|
+
unsigned char *ptr;
|
13
|
+
size_t total = len + sizeof(size_t);
|
14
|
+
|
15
|
+
GIT_UNUSED(file);
|
16
|
+
GIT_UNUSED(line);
|
17
|
+
|
18
|
+
if (!len || (ptr = malloc(total)) == NULL)
|
19
|
+
return NULL;
|
20
|
+
|
21
|
+
memcpy(ptr, &len, sizeof(size_t));
|
22
|
+
return ptr + sizeof(size_t);
|
23
|
+
}
|
24
|
+
|
25
|
+
static void *debugalloc__realloc(void *_ptr, size_t len, const char *file, int line)
|
26
|
+
{
|
27
|
+
unsigned char *ptr = _ptr, *newptr;
|
28
|
+
size_t original_len;
|
29
|
+
size_t total = len + sizeof(size_t);
|
30
|
+
|
31
|
+
GIT_UNUSED(file);
|
32
|
+
GIT_UNUSED(line);
|
33
|
+
|
34
|
+
if (!len && !ptr)
|
35
|
+
return NULL;
|
36
|
+
|
37
|
+
if (!len) {
|
38
|
+
free(ptr - sizeof(size_t));
|
39
|
+
return NULL;
|
40
|
+
}
|
41
|
+
|
42
|
+
if ((newptr = malloc(total)) == NULL)
|
43
|
+
return NULL;
|
44
|
+
|
45
|
+
if (ptr) {
|
46
|
+
memcpy(&original_len, ptr - sizeof(size_t), sizeof(size_t));
|
47
|
+
memcpy(newptr + sizeof(size_t), ptr, min(len, original_len));
|
48
|
+
|
49
|
+
memset(ptr - sizeof(size_t), 0xfd, original_len + sizeof(size_t));
|
50
|
+
free(ptr - sizeof(size_t));
|
51
|
+
}
|
52
|
+
|
53
|
+
memcpy(newptr, &len, sizeof(size_t));
|
54
|
+
return newptr + sizeof(size_t);
|
55
|
+
}
|
56
|
+
|
57
|
+
static void debugalloc__free(void *_ptr)
|
58
|
+
{
|
59
|
+
unsigned char *ptr = _ptr;
|
60
|
+
|
61
|
+
if (!ptr)
|
62
|
+
return;
|
63
|
+
|
64
|
+
free(ptr - sizeof(size_t));
|
65
|
+
}
|
66
|
+
|
67
|
+
int git_debugalloc_init_allocator(git_allocator *allocator)
|
68
|
+
{
|
69
|
+
allocator->gmalloc = debugalloc__malloc;
|
70
|
+
allocator->grealloc = debugalloc__realloc;
|
71
|
+
allocator->gfree = debugalloc__free;
|
72
|
+
return 0;
|
73
|
+
}
|
@@ -5,16 +5,13 @@
|
|
5
5
|
* a Linking Exception. For full terms see the included COPYING file.
|
6
6
|
*/
|
7
7
|
|
8
|
-
#ifndef
|
9
|
-
#define
|
10
|
-
|
11
|
-
#define PROGRAM_NAME "git2"
|
8
|
+
#ifndef INCLUDE_allocators_debugalloc_h__
|
9
|
+
#define INCLUDE_allocators_debugalloc_h__
|
12
10
|
|
13
11
|
#include "git2_util.h"
|
14
12
|
|
15
|
-
#include "
|
16
|
-
|
17
|
-
|
18
|
-
#include "sighandler.h"
|
13
|
+
#include "alloc.h"
|
14
|
+
|
15
|
+
int git_debugalloc_init_allocator(git_allocator *allocator);
|
19
16
|
|
20
|
-
#endif
|
17
|
+
#endif
|
@@ -12,11 +12,6 @@ static void *stdalloc__malloc(size_t len, const char *file, int line)
|
|
12
12
|
GIT_UNUSED(file);
|
13
13
|
GIT_UNUSED(line);
|
14
14
|
|
15
|
-
#ifdef GIT_DEBUG_STRICT_ALLOC
|
16
|
-
if (!len)
|
17
|
-
return NULL;
|
18
|
-
#endif
|
19
|
-
|
20
15
|
return malloc(len);
|
21
16
|
}
|
22
17
|
|
@@ -25,11 +20,6 @@ static void *stdalloc__realloc(void *ptr, size_t size, const char *file, int lin
|
|
25
20
|
GIT_UNUSED(file);
|
26
21
|
GIT_UNUSED(line);
|
27
22
|
|
28
|
-
#ifdef GIT_DEBUG_STRICT_ALLOC
|
29
|
-
if (!size)
|
30
|
-
return NULL;
|
31
|
-
#endif
|
32
|
-
|
33
23
|
return realloc(ptr, size);
|
34
24
|
}
|
35
25
|
|
@@ -41,39 +41,40 @@
|
|
41
41
|
|
42
42
|
#define GIT_ERROR_CHECK_ARRAY(a) GIT_ERROR_CHECK_ALLOC((a).ptr)
|
43
43
|
|
44
|
-
|
45
|
-
typedef git_array_t(char) git_array_generic_t;
|
46
|
-
|
47
|
-
/* use a generic array for growth, return 0 on success */
|
48
|
-
GIT_INLINE(int) git_array_grow(void *_a, size_t item_size)
|
44
|
+
GIT_INLINE(void *) git_array__alloc(void *arr, size_t *size, size_t *asize, size_t item_size)
|
49
45
|
{
|
50
|
-
volatile git_array_generic_t *a = _a;
|
51
46
|
size_t new_size;
|
52
|
-
|
47
|
+
void *new_array;
|
48
|
+
|
49
|
+
if (*size < *asize)
|
50
|
+
return arr;
|
53
51
|
|
54
|
-
if (
|
52
|
+
if (*size < 8) {
|
55
53
|
new_size = 8;
|
56
54
|
} else {
|
57
|
-
if (GIT_MULTIPLY_SIZET_OVERFLOW(&new_size,
|
55
|
+
if (GIT_MULTIPLY_SIZET_OVERFLOW(&new_size, *asize, 3))
|
58
56
|
goto on_oom;
|
57
|
+
|
59
58
|
new_size /= 2;
|
60
59
|
}
|
61
60
|
|
62
|
-
if ((new_array = git__reallocarray(
|
61
|
+
if ((new_array = git__reallocarray(arr, new_size, item_size)) == NULL)
|
63
62
|
goto on_oom;
|
64
63
|
|
65
|
-
|
66
|
-
|
67
|
-
return
|
64
|
+
*asize = new_size;
|
65
|
+
|
66
|
+
return new_array;
|
68
67
|
|
69
68
|
on_oom:
|
70
|
-
|
71
|
-
|
69
|
+
git__free(arr);
|
70
|
+
*size = 0;
|
71
|
+
*asize = 0;
|
72
|
+
return NULL;
|
72
73
|
}
|
73
74
|
|
74
75
|
#define git_array_alloc(a) \
|
75
|
-
(((a).size < (a).asize ||
|
76
|
-
|
76
|
+
(((a).size < (a).asize || \
|
77
|
+
((a).ptr = git_array__alloc((a).ptr, &(a).size, &(a).asize, sizeof(*(a).ptr))) != NULL) ? &(a).ptr[(a).size++] : (void *)NULL)
|
77
78
|
|
78
79
|
#define git_array_last(a) ((a).size ? &(a).ptr[(a).size - 1] : (void *)NULL)
|
79
80
|
|
@@ -44,9 +44,11 @@
|
|
44
44
|
_unused = (x); \
|
45
45
|
} while (0)
|
46
46
|
# define GIT_UNUSED_ARG __attribute__((unused))
|
47
|
+
# define GIT_UNUSED_FUNCTION __attribute__((unused))
|
47
48
|
#else
|
48
49
|
# define GIT_UNUSED(x) ((void)(x))
|
49
50
|
# define GIT_UNUSED_ARG
|
51
|
+
# define GIT_UNUSED_FUNCTION
|
50
52
|
#endif
|
51
53
|
|
52
54
|
/* Define the printf format specifier to use for size_t output */
|
@@ -0,0 +1,70 @@
|
|
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_ctype_compat_h__
|
8
|
+
#define INCLUDE_ctype_compat_h__
|
9
|
+
|
10
|
+
/*
|
11
|
+
* The Microsoft C runtime (MSVCRT) may take a heavy lock on the
|
12
|
+
* locale in order to figure out how the `ctype` functions work.
|
13
|
+
* This is deeply slow. Provide our own to avoid that.
|
14
|
+
*/
|
15
|
+
|
16
|
+
#ifdef GIT_WIN32
|
17
|
+
|
18
|
+
GIT_INLINE(int) git__tolower(int c)
|
19
|
+
{
|
20
|
+
return (c >= 'A' && c <= 'Z') ? (c + 32) : c;
|
21
|
+
}
|
22
|
+
|
23
|
+
GIT_INLINE(int) git__toupper(int c)
|
24
|
+
{
|
25
|
+
return (c >= 'a' && c <= 'z') ? (c - 32) : c;
|
26
|
+
}
|
27
|
+
|
28
|
+
GIT_INLINE(bool) git__isalpha(int c)
|
29
|
+
{
|
30
|
+
return ((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z'));
|
31
|
+
}
|
32
|
+
|
33
|
+
GIT_INLINE(bool) git__isdigit(int c)
|
34
|
+
{
|
35
|
+
return (c >= '0' && c <= '9');
|
36
|
+
}
|
37
|
+
|
38
|
+
GIT_INLINE(bool) git__isalnum(int c)
|
39
|
+
{
|
40
|
+
return git__isalpha(c) || git__isdigit(c);
|
41
|
+
}
|
42
|
+
|
43
|
+
GIT_INLINE(bool) git__isspace(int c)
|
44
|
+
{
|
45
|
+
return (c == ' ' || c == '\t' || c == '\n' || c == '\f' || c == '\r' || c == '\v');
|
46
|
+
}
|
47
|
+
|
48
|
+
GIT_INLINE(bool) git__isxdigit(int c)
|
49
|
+
{
|
50
|
+
return ((c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F'));
|
51
|
+
}
|
52
|
+
|
53
|
+
GIT_INLINE(bool) git__isprint(int c)
|
54
|
+
{
|
55
|
+
return (c >= ' ' && c <= '~');
|
56
|
+
}
|
57
|
+
|
58
|
+
#else
|
59
|
+
# define git__tolower(a) tolower((unsigned char)(a))
|
60
|
+
# define git__toupper(a) toupper((unsigned char)(a))
|
61
|
+
|
62
|
+
# define git__isalpha(a) (!!isalpha((unsigned char)(a)))
|
63
|
+
# define git__isdigit(a) (!!isdigit((unsigned char)(a)))
|
64
|
+
# define git__isalnum(a) (!!isalnum((unsigned char)(a)))
|
65
|
+
# define git__isspace(a) (!!isspace((unsigned char)(a)))
|
66
|
+
# define git__isxdigit(a) (!!isxdigit((unsigned char)(a)))
|
67
|
+
# define git__isprint(a) (!!isprint((unsigned char)(a)))
|
68
|
+
#endif
|
69
|
+
|
70
|
+
#endif
|