rugged 1.6.3 → 1.9.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/ext/rugged/rugged_allocator.c +0 -54
- data/lib/rugged/version.rb +1 -1
- data/vendor/libgit2/AUTHORS +1 -0
- data/vendor/libgit2/CMakeLists.txt +25 -17
- data/vendor/libgit2/COPYING +195 -1
- data/vendor/libgit2/cmake/CheckPrototypeDefinitionSafe.cmake +16 -0
- data/vendor/libgit2/cmake/{FindIconv.cmake → FindIntlIconv.cmake} +6 -0
- data/vendor/libgit2/cmake/FindLLHTTP.cmake +39 -0
- data/vendor/libgit2/cmake/SelectGSSAPI.cmake +4 -4
- data/vendor/libgit2/cmake/SelectHTTPParser.cmake +23 -8
- data/vendor/libgit2/cmake/SelectHTTPSBackend.cmake +34 -6
- data/vendor/libgit2/cmake/SelectHashes.cmake +32 -11
- data/vendor/libgit2/cmake/SelectRegex.cmake +6 -1
- data/vendor/libgit2/cmake/SelectSSH.cmake +22 -17
- data/vendor/libgit2/cmake/SelectXdiff.cmake +9 -0
- 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/pcre/LICENCE +5 -5
- data/vendor/libgit2/deps/pcre/pcre.h +2 -2
- data/vendor/libgit2/deps/pcre/pcre_compile.c +6 -3
- data/vendor/libgit2/deps/pcre/pcre_exec.c +2 -2
- data/vendor/libgit2/deps/xdiff/CMakeLists.txt +28 -0
- data/vendor/libgit2/{src/libgit2 → deps}/xdiff/git-xdiff.h +4 -1
- data/vendor/libgit2/{src/libgit2 → deps}/xdiff/xdiffi.c +19 -18
- data/vendor/libgit2/{src/libgit2 → deps}/xdiff/xdiffi.h +2 -4
- data/vendor/libgit2/{src/libgit2 → deps}/xdiff/xemit.c +3 -3
- data/vendor/libgit2/{src/libgit2 → deps}/xdiff/xhistogram.c +7 -18
- data/vendor/libgit2/{src/libgit2 → deps}/xdiff/xmacros.h +18 -1
- data/vendor/libgit2/{src/libgit2 → deps}/xdiff/xmerge.c +22 -20
- data/vendor/libgit2/{src/libgit2 → deps}/xdiff/xpatience.c +21 -30
- data/vendor/libgit2/{src/libgit2 → deps}/xdiff/xprepare.c +13 -30
- data/vendor/libgit2/{src/libgit2 → deps}/xdiff/xutils.c +18 -1
- data/vendor/libgit2/{src/libgit2 → deps}/xdiff/xutils.h +2 -1
- 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 +138 -56
- 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 +77 -9
- data/vendor/libgit2/include/git2/email.h +9 -29
- data/vendor/libgit2/include/git2/errors.h +49 -74
- 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 +100 -6
- 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 +24 -25
- 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 +112 -18
- data/vendor/libgit2/include/git2/repository.h +61 -15
- 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 -34
- data/vendor/libgit2/include/git2/sys/commit.h +77 -3
- data/vendor/libgit2/include/git2/sys/commit_graph.h +109 -58
- 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 +47 -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 +25 -2
- data/vendor/libgit2/include/git2/sys/transport.h +44 -5
- 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 +19 -7
- data/vendor/libgit2/src/CMakeLists.txt +40 -15
- 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 +27 -13
- 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 +60 -10
- data/vendor/libgit2/src/cli/progress.h +16 -4
- 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 +27 -27
- data/vendor/libgit2/src/libgit2/annotated_commit.c +2 -2
- data/vendor/libgit2/src/libgit2/annotated_commit.h +1 -1
- data/vendor/libgit2/src/libgit2/apply.c +14 -16
- 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 +152 -59
- data/vendor/libgit2/src/libgit2/blame.h +1 -0
- data/vendor/libgit2/src/libgit2/blame_git.c +0 -1
- data/vendor/libgit2/src/libgit2/branch.c +2 -2
- 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 +4 -5
- data/vendor/libgit2/src/libgit2/clone.c +186 -164
- data/vendor/libgit2/src/libgit2/clone.h +4 -1
- data/vendor/libgit2/src/libgit2/commit.c +123 -9
- data/vendor/libgit2/src/libgit2/commit_graph.c +166 -88
- data/vendor/libgit2/src/libgit2/commit_graph.h +21 -6
- data/vendor/libgit2/src/libgit2/commit_list.c +12 -5
- data/vendor/libgit2/src/libgit2/commit_list.h +1 -0
- data/vendor/libgit2/src/libgit2/config.c +394 -300
- 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 +113 -96
- 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 +34 -31
- data/vendor/libgit2/src/libgit2/diff.c +17 -8
- data/vendor/libgit2/src/libgit2/diff.h +6 -6
- 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_file.c +7 -7
- data/vendor/libgit2/src/libgit2/diff_generate.c +39 -18
- data/vendor/libgit2/src/libgit2/diff_parse.c +22 -6
- data/vendor/libgit2/src/libgit2/diff_print.c +88 -13
- data/vendor/libgit2/src/libgit2/diff_tform.c +40 -12
- data/vendor/libgit2/src/libgit2/diff_xdiff.h +1 -1
- data/vendor/libgit2/src/libgit2/email.c +5 -3
- data/vendor/libgit2/src/libgit2/fetch.c +39 -9
- data/vendor/libgit2/src/libgit2/fetch.h +0 -2
- data/vendor/libgit2/src/libgit2/fetchhead.c +11 -9
- 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 +270 -0
- data/vendor/libgit2/src/libgit2/grafts.h +35 -0
- data/vendor/libgit2/src/libgit2/graph.c +1 -1
- data/vendor/libgit2/src/libgit2/hashmap_oid.h +30 -0
- data/vendor/libgit2/src/libgit2/ident.c +3 -3
- data/vendor/libgit2/src/libgit2/ignore.c +9 -5
- data/vendor/libgit2/src/libgit2/index.c +392 -208
- data/vendor/libgit2/src/libgit2/index.h +16 -3
- 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 +44 -41
- data/vendor/libgit2/src/libgit2/iterator.c +34 -13
- data/vendor/libgit2/src/libgit2/iterator.h +3 -0
- data/vendor/libgit2/src/libgit2/libgit2.c +155 -331
- data/vendor/libgit2/src/libgit2/mailmap.c +1 -1
- data/vendor/libgit2/src/libgit2/merge.c +56 -46
- data/vendor/libgit2/src/libgit2/merge_driver.c +2 -2
- data/vendor/libgit2/src/libgit2/merge_file.c +0 -2
- data/vendor/libgit2/src/libgit2/midx.c +86 -44
- data/vendor/libgit2/src/libgit2/midx.h +13 -3
- data/vendor/libgit2/src/libgit2/mwindow.c +38 -45
- data/vendor/libgit2/src/libgit2/mwindow.h +4 -0
- data/vendor/libgit2/src/libgit2/notes.c +9 -8
- data/vendor/libgit2/src/libgit2/object.c +42 -16
- data/vendor/libgit2/src/libgit2/object.h +6 -0
- data/vendor/libgit2/src/libgit2/odb.c +16 -9
- data/vendor/libgit2/src/libgit2/odb_mempack.c +49 -17
- data/vendor/libgit2/src/libgit2/odb_pack.c +28 -7
- data/vendor/libgit2/src/libgit2/oid.c +35 -2
- data/vendor/libgit2/src/libgit2/oid.h +11 -0
- data/vendor/libgit2/src/libgit2/oidarray.c +49 -3
- data/vendor/libgit2/src/libgit2/oidarray.h +5 -1
- data/vendor/libgit2/src/libgit2/pack-objects.c +77 -43
- data/vendor/libgit2/src/libgit2/pack-objects.h +17 -6
- data/vendor/libgit2/src/libgit2/pack.c +33 -27
- data/vendor/libgit2/src/libgit2/pack.h +15 -10
- data/vendor/libgit2/src/libgit2/parse.c +7 -4
- data/vendor/libgit2/src/libgit2/parse.h +1 -1
- data/vendor/libgit2/src/libgit2/patch.h +7 -1
- data/vendor/libgit2/src/libgit2/patch_generate.c +24 -5
- data/vendor/libgit2/src/libgit2/patch_parse.c +18 -10
- 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 +81 -30
- data/vendor/libgit2/src/libgit2/push.h +1 -0
- data/vendor/libgit2/src/libgit2/reader.c +1 -1
- data/vendor/libgit2/src/libgit2/rebase.c +72 -84
- data/vendor/libgit2/src/libgit2/refdb_fs.c +146 -70
- 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 +34 -8
- 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 +136 -67
- data/vendor/libgit2/src/libgit2/remote.h +1 -0
- data/vendor/libgit2/src/libgit2/repository.c +789 -330
- data/vendor/libgit2/src/libgit2/repository.h +22 -3
- data/vendor/libgit2/src/libgit2/reset.c +2 -2
- data/vendor/libgit2/src/libgit2/revert.c +9 -13
- data/vendor/libgit2/src/libgit2/revparse.c +6 -3
- data/vendor/libgit2/src/libgit2/revwalk.c +36 -11
- 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/stash.c +9 -8
- data/vendor/libgit2/src/libgit2/status.c +1 -1
- data/vendor/libgit2/src/libgit2/streams/mbedtls.c +54 -61
- data/vendor/libgit2/src/libgit2/streams/openssl.c +40 -23
- 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/schannel.c +715 -0
- data/vendor/libgit2/src/libgit2/streams/schannel.h +28 -0
- data/vendor/libgit2/src/libgit2/streams/socket.c +237 -51
- data/vendor/libgit2/src/libgit2/streams/socket.h +3 -1
- data/vendor/libgit2/src/libgit2/streams/stransport.c +79 -19
- data/vendor/libgit2/src/libgit2/streams/tls.c +5 -0
- data/vendor/libgit2/src/libgit2/submodule.c +106 -63
- data/vendor/libgit2/src/libgit2/submodule.h +9 -10
- 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/auth.h +1 -2
- data/vendor/libgit2/src/libgit2/transports/{auth_negotiate.c → auth_gssapi.c} +32 -32
- data/vendor/libgit2/src/libgit2/transports/auth_negotiate.h +1 -1
- data/vendor/libgit2/src/libgit2/transports/auth_ntlm.h +1 -1
- data/vendor/libgit2/src/libgit2/transports/{auth_ntlm.c → auth_ntlmclient.c} +12 -12
- data/vendor/libgit2/src/libgit2/transports/auth_sspi.c +341 -0
- data/vendor/libgit2/src/libgit2/transports/credential.c +1 -1
- data/vendor/libgit2/src/libgit2/transports/git.c +7 -8
- data/vendor/libgit2/src/libgit2/transports/http.c +8 -4
- data/vendor/libgit2/src/libgit2/transports/http.h +0 -10
- data/vendor/libgit2/src/libgit2/transports/httpclient.c +117 -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 +21 -11
- data/vendor/libgit2/src/libgit2/transports/smart.c +50 -32
- data/vendor/libgit2/src/libgit2/transports/smart.h +26 -9
- data/vendor/libgit2/src/libgit2/transports/smart_pkt.c +139 -18
- data/vendor/libgit2/src/libgit2/transports/smart_protocol.c +209 -57
- 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 +48 -21
- data/vendor/libgit2/src/libgit2/tree-cache.c +26 -16
- data/vendor/libgit2/src/libgit2/tree-cache.h +5 -3
- data/vendor/libgit2/src/libgit2/tree.c +35 -27
- data/vendor/libgit2/src/libgit2/tree.h +3 -2
- data/vendor/libgit2/src/libgit2/worktree.c +39 -27
- data/vendor/libgit2/src/util/CMakeLists.txt +4 -6
- data/vendor/libgit2/src/util/alloc.c +69 -7
- data/vendor/libgit2/src/util/alloc.h +34 -9
- 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/failalloc.c +0 -60
- data/vendor/libgit2/src/util/allocators/failalloc.h +0 -6
- data/vendor/libgit2/src/util/allocators/stdalloc.c +2 -115
- data/vendor/libgit2/src/util/allocators/win32_leakcheck.c +0 -68
- data/vendor/libgit2/src/util/array.h +24 -18
- data/vendor/libgit2/src/util/cc-compat.h +4 -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/filebuf.c +6 -1
- data/vendor/libgit2/src/util/filebuf.h +19 -6
- data/vendor/libgit2/src/util/fs_path.c +16 -5
- data/vendor/libgit2/src/util/fs_path.h +23 -0
- data/vendor/libgit2/src/util/futils.c +14 -10
- data/vendor/libgit2/src/util/futils.h +13 -4
- data/vendor/libgit2/src/util/git2_features.h.in +21 -4
- 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 +318 -161
- data/vendor/libgit2/src/util/net.h +27 -0
- data/vendor/libgit2/src/util/pool.c +1 -1
- data/vendor/libgit2/src/util/pool.h +5 -0
- data/vendor/libgit2/src/util/posix.c +54 -0
- data/vendor/libgit2/src/util/posix.h +22 -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 +6 -10
- 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/staticstr.h +66 -0
- 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 +17 -12
- data/vendor/libgit2/src/util/util.h +28 -54
- data/vendor/libgit2/src/util/vector.c +3 -3
- data/vendor/libgit2/src/util/vector.h +2 -2
- data/vendor/libgit2/src/util/win32/error.c +1 -1
- data/vendor/libgit2/src/util/win32/path_w32.c +8 -8
- data/vendor/libgit2/src/util/win32/posix_w32.c +30 -7
- data/vendor/libgit2/src/util/win32/process.c +506 -0
- data/vendor/libgit2/src/util/win32/utf-conv.c +73 -75
- data/vendor/libgit2/src/util/win32/utf-conv.h +81 -14
- data/vendor/libgit2/src/util/win32/w32_util.c +1 -1
- metadata +72 -49
- data/vendor/libgit2/cmake/SelectWinHTTP.cmake +0 -17
- 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 -238
- 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/netops.c +0 -124
- data/vendor/libgit2/src/libgit2/netops.h +0 -68
- 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 -84
- data/vendor/libgit2/src/libgit2/threadstate.h +0 -24
- 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
- /data/vendor/libgit2/{src/libgit2 → deps}/xdiff/xdiff.h +0 -0
- /data/vendor/libgit2/{src/libgit2 → deps}/xdiff/xemit.h +0 -0
- /data/vendor/libgit2/{src/libgit2 → deps}/xdiff/xinclude.h +0 -0
- /data/vendor/libgit2/{src/libgit2 → deps}/xdiff/xprepare.h +0 -0
- /data/vendor/libgit2/{src/libgit2 → deps}/xdiff/xtypes.h +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
|
@@ -13,7 +13,6 @@
|
|
13
13
|
#include "git2/transport.h"
|
14
14
|
#include "posix.h"
|
15
15
|
#include "str.h"
|
16
|
-
#include "netops.h"
|
17
16
|
#include "smart.h"
|
18
17
|
#include "remote.h"
|
19
18
|
#include "repository.h"
|
@@ -158,10 +157,10 @@ static int apply_userpass_credentials(HINTERNET request, DWORD target, int mecha
|
|
158
157
|
goto done;
|
159
158
|
}
|
160
159
|
|
161
|
-
if ((error = user_len =
|
160
|
+
if ((error = user_len = git_utf8_to_16_alloc(&user, c->username)) < 0)
|
162
161
|
goto done;
|
163
162
|
|
164
|
-
if ((error = pass_len =
|
163
|
+
if ((error = pass_len = git_utf8_to_16_alloc(&pass, c->password)) < 0)
|
165
164
|
goto done;
|
166
165
|
|
167
166
|
if (!WinHttpSetCredentials(request, target, native_scheme, user, pass, NULL)) {
|
@@ -242,7 +241,7 @@ static int acquire_fallback_cred(
|
|
242
241
|
HRESULT hCoInitResult;
|
243
242
|
|
244
243
|
/* Convert URL to wide characters */
|
245
|
-
if (
|
244
|
+
if (git_utf8_to_16_alloc(&wide_url, url) < 0) {
|
246
245
|
git_error_set(GIT_ERROR_OS, "failed to convert string to wide form");
|
247
246
|
return -1;
|
248
247
|
}
|
@@ -294,7 +293,7 @@ static int certificate_check(winhttp_stream *s, int valid)
|
|
294
293
|
|
295
294
|
/* If there is no override, we should fail if WinHTTP doesn't think it's fine */
|
296
295
|
if (t->owner->connect_opts.callbacks.certificate_check == NULL && !valid) {
|
297
|
-
if (
|
296
|
+
if (git_error_last()->klass == GIT_ERROR_NONE)
|
298
297
|
git_error_set(GIT_ERROR_HTTP, "unknown certificate check failure");
|
299
298
|
|
300
299
|
return GIT_ECERTIFICATE;
|
@@ -318,7 +317,7 @@ static int certificate_check(winhttp_stream *s, int valid)
|
|
318
317
|
if (error == GIT_PASSTHROUGH)
|
319
318
|
error = valid ? 0 : GIT_ECERTIFICATE;
|
320
319
|
|
321
|
-
if (error < 0 &&
|
320
|
+
if (error < 0 && git_error_last()->klass == GIT_ERROR_NONE)
|
322
321
|
git_error_set(GIT_ERROR_HTTP, "user cancelled certificate check");
|
323
322
|
|
324
323
|
return error;
|
@@ -397,7 +396,7 @@ static int winhttp_stream_connect(winhttp_stream *s)
|
|
397
396
|
return -1;
|
398
397
|
|
399
398
|
/* Convert URL to wide characters */
|
400
|
-
if (
|
399
|
+
if (git_utf8_to_16_alloc(&s->request_uri, git_str_cstr(&buf)) < 0) {
|
401
400
|
git_error_set(GIT_ERROR_OS, "failed to convert string to wide form");
|
402
401
|
goto on_error;
|
403
402
|
}
|
@@ -437,17 +436,17 @@ static int winhttp_stream_connect(winhttp_stream *s)
|
|
437
436
|
GIT_ERROR_CHECK_ALLOC(proxy_url);
|
438
437
|
}
|
439
438
|
|
440
|
-
if (proxy_url) {
|
439
|
+
if (proxy_url && *proxy_url) {
|
441
440
|
git_str processed_url = GIT_STR_INIT;
|
442
441
|
WINHTTP_PROXY_INFO proxy_info;
|
443
442
|
wchar_t *proxy_wide;
|
444
443
|
|
445
444
|
git_net_url_dispose(&t->proxy.url);
|
446
445
|
|
447
|
-
if ((error =
|
446
|
+
if ((error = git_net_url_parse_http(&t->proxy.url, proxy_url)) < 0)
|
448
447
|
goto on_error;
|
449
448
|
|
450
|
-
if (
|
449
|
+
if (!git_net_url_valid(&t->proxy.url)) {
|
451
450
|
git_error_set(GIT_ERROR_HTTP, "invalid URL: '%s'", proxy_url);
|
452
451
|
error = -1;
|
453
452
|
goto on_error;
|
@@ -473,7 +472,7 @@ static int winhttp_stream_connect(winhttp_stream *s)
|
|
473
472
|
}
|
474
473
|
|
475
474
|
/* Convert URL to wide characters */
|
476
|
-
error =
|
475
|
+
error = git_utf8_to_16_alloc(&proxy_wide, processed_url.ptr);
|
477
476
|
git_str_dispose(&processed_url);
|
478
477
|
if (error < 0)
|
479
478
|
goto on_error;
|
@@ -531,7 +530,7 @@ static int winhttp_stream_connect(winhttp_stream *s)
|
|
531
530
|
s->service) < 0)
|
532
531
|
goto on_error;
|
533
532
|
|
534
|
-
if (
|
533
|
+
if (git_utf8_to_16(ct, MAX_CONTENT_TYPE_LEN, git_str_cstr(&buf)) < 0) {
|
535
534
|
git_error_set(GIT_ERROR_OS, "failed to convert content-type to wide characters");
|
536
535
|
goto on_error;
|
537
536
|
}
|
@@ -548,7 +547,7 @@ static int winhttp_stream_connect(winhttp_stream *s)
|
|
548
547
|
s->service) < 0)
|
549
548
|
goto on_error;
|
550
549
|
|
551
|
-
if (
|
550
|
+
if (git_utf8_to_16(ct, MAX_CONTENT_TYPE_LEN, git_str_cstr(&buf)) < 0) {
|
552
551
|
git_error_set(GIT_ERROR_OS, "failed to convert accept header to wide characters");
|
553
552
|
goto on_error;
|
554
553
|
}
|
@@ -568,7 +567,7 @@ static int winhttp_stream_connect(winhttp_stream *s)
|
|
568
567
|
git_str_puts(&buf, t->owner->connect_opts.custom_headers.strings[i]);
|
569
568
|
|
570
569
|
/* Convert header to wide characters */
|
571
|
-
if ((error =
|
570
|
+
if ((error = git_utf8_to_16_alloc(&custom_header_wide, git_str_cstr(&buf))) < 0)
|
572
571
|
goto on_error;
|
573
572
|
|
574
573
|
if (!WinHttpAddRequestHeaders(s->request, custom_header_wide, (ULONG)-1L,
|
@@ -747,6 +746,33 @@ static void CALLBACK winhttp_status(
|
|
747
746
|
}
|
748
747
|
}
|
749
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
|
+
|
750
776
|
static int winhttp_connect(
|
751
777
|
winhttp_subtransport *t)
|
752
778
|
{
|
@@ -758,6 +784,7 @@ static int winhttp_connect(
|
|
758
784
|
int error = -1;
|
759
785
|
int default_timeout = TIMEOUT_INFINITE;
|
760
786
|
int default_connect_timeout = DEFAULT_CONNECT_TIMEOUT;
|
787
|
+
bool has_ua = true;
|
761
788
|
DWORD protocols =
|
762
789
|
WINHTTP_FLAG_SECURE_PROTOCOL_TLS1 |
|
763
790
|
WINHTTP_FLAG_SECURE_PROTOCOL_TLS1_1 |
|
@@ -783,16 +810,16 @@ static int winhttp_connect(
|
|
783
810
|
}
|
784
811
|
|
785
812
|
/* Prepare host */
|
786
|
-
if (
|
813
|
+
if (git_utf8_to_16_alloc(&wide_host, host) < 0) {
|
787
814
|
git_error_set(GIT_ERROR_OS, "unable to convert host to wide characters");
|
788
815
|
goto on_error;
|
789
816
|
}
|
790
817
|
|
791
|
-
|
792
|
-
if (git_http__user_agent(&ua) < 0)
|
818
|
+
if (user_agent(&has_ua, &ua) < 0)
|
793
819
|
goto on_error;
|
794
820
|
|
795
|
-
if (
|
821
|
+
if (has_ua &&
|
822
|
+
git_utf8_to_16_alloc(&wide_ua, git_str_cstr(&ua)) < 0) {
|
796
823
|
git_error_set(GIT_ERROR_OS, "unable to convert host to wide characters");
|
797
824
|
goto on_error;
|
798
825
|
}
|
@@ -934,7 +961,7 @@ static int send_request(winhttp_stream *s, size_t len, bool chunked)
|
|
934
961
|
(!request_failed && s->status_sending_request_reached)) {
|
935
962
|
git_error_clear();
|
936
963
|
if ((error = certificate_check(s, cert_valid)) < 0) {
|
937
|
-
if (
|
964
|
+
if (git_error_last()->klass == GIT_ERROR_NONE)
|
938
965
|
git_error_set(GIT_ERROR_OS, "user cancelled certificate check");
|
939
966
|
|
940
967
|
return error;
|
@@ -1182,7 +1209,7 @@ replay:
|
|
1182
1209
|
}
|
1183
1210
|
|
1184
1211
|
/* Convert the Location header to UTF-8 */
|
1185
|
-
if (
|
1212
|
+
if (git_utf8_from_16_alloc(&location8, location) < 0) {
|
1186
1213
|
git_error_set(GIT_ERROR_OS, "failed to convert Location header to UTF-8");
|
1187
1214
|
git__free(location);
|
1188
1215
|
return -1;
|
@@ -1254,7 +1281,7 @@ replay:
|
|
1254
1281
|
else
|
1255
1282
|
p_snprintf(expected_content_type_8, MAX_CONTENT_TYPE_LEN, "application/x-git-%s-advertisement", s->service);
|
1256
1283
|
|
1257
|
-
if (
|
1284
|
+
if (git_utf8_to_16(expected_content_type, MAX_CONTENT_TYPE_LEN, expected_content_type_8) < 0) {
|
1258
1285
|
git_error_set(GIT_ERROR_OS, "failed to convert expected content-type to wide characters");
|
1259
1286
|
return -1;
|
1260
1287
|
}
|
@@ -71,12 +71,16 @@ const git_tree_cache *git_tree_cache_get(const git_tree_cache *tree, const char
|
|
71
71
|
}
|
72
72
|
}
|
73
73
|
|
74
|
-
static int read_tree_internal(
|
75
|
-
|
76
|
-
|
74
|
+
static int read_tree_internal(
|
75
|
+
git_tree_cache **out,
|
76
|
+
const char **buffer_in,
|
77
|
+
const char *buffer_end,
|
78
|
+
git_oid_t oid_type,
|
79
|
+
git_pool *pool)
|
77
80
|
{
|
78
81
|
git_tree_cache *tree = NULL;
|
79
82
|
const char *name_start, *buffer;
|
83
|
+
size_t oid_size = git_oid_size(oid_type);
|
80
84
|
int count;
|
81
85
|
|
82
86
|
buffer = name_start = *buffer_in;
|
@@ -87,7 +91,7 @@ static int read_tree_internal(git_tree_cache **out,
|
|
87
91
|
if (++buffer >= buffer_end)
|
88
92
|
goto corrupted;
|
89
93
|
|
90
|
-
if (git_tree_cache_new(&tree, name_start, pool) < 0)
|
94
|
+
if (git_tree_cache_new(&tree, name_start, oid_type, pool) < 0)
|
91
95
|
return -1;
|
92
96
|
|
93
97
|
/* Blank-terminated ASCII decimal number of entries in this tree */
|
@@ -108,14 +112,14 @@ static int read_tree_internal(git_tree_cache **out,
|
|
108
112
|
if (*buffer != '\n' || ++buffer > buffer_end)
|
109
113
|
goto corrupted;
|
110
114
|
|
111
|
-
/* The
|
115
|
+
/* The OID is only there if it's not invalidated */
|
112
116
|
if (tree->entry_count >= 0) {
|
113
117
|
/* 160-bit SHA-1 for this tree and it's children */
|
114
|
-
if (buffer +
|
118
|
+
if (buffer + oid_size > buffer_end)
|
115
119
|
goto corrupted;
|
116
120
|
|
117
|
-
git_oid__fromraw(&tree->oid, (const unsigned char *)buffer,
|
118
|
-
buffer +=
|
121
|
+
git_oid__fromraw(&tree->oid, (const unsigned char *)buffer, oid_type);
|
122
|
+
buffer += oid_size;
|
119
123
|
}
|
120
124
|
|
121
125
|
/* Parse children: */
|
@@ -130,7 +134,7 @@ static int read_tree_internal(git_tree_cache **out,
|
|
130
134
|
memset(tree->children, 0x0, bufsize);
|
131
135
|
|
132
136
|
for (i = 0; i < tree->children_count; ++i) {
|
133
|
-
if (read_tree_internal(&tree->children[i], &buffer, buffer_end, pool) < 0)
|
137
|
+
if (read_tree_internal(&tree->children[i], &buffer, buffer_end, oid_type, pool) < 0)
|
134
138
|
goto corrupted;
|
135
139
|
}
|
136
140
|
}
|
@@ -144,11 +148,16 @@ static int read_tree_internal(git_tree_cache **out,
|
|
144
148
|
return -1;
|
145
149
|
}
|
146
150
|
|
147
|
-
int git_tree_cache_read(
|
151
|
+
int git_tree_cache_read(
|
152
|
+
git_tree_cache **tree,
|
153
|
+
const char *buffer,
|
154
|
+
size_t buffer_size,
|
155
|
+
git_oid_t oid_type,
|
156
|
+
git_pool *pool)
|
148
157
|
{
|
149
158
|
const char *buffer_end = buffer + buffer_size;
|
150
159
|
|
151
|
-
if (read_tree_internal(tree, &buffer, buffer_end, pool) < 0)
|
160
|
+
if (read_tree_internal(tree, &buffer, buffer_end, oid_type, pool) < 0)
|
152
161
|
return -1;
|
153
162
|
|
154
163
|
if (buffer < buffer_end) {
|
@@ -201,7 +210,7 @@ static int read_tree_recursive(git_tree_cache *cache, const git_tree *tree, git_
|
|
201
210
|
continue;
|
202
211
|
}
|
203
212
|
|
204
|
-
if ((error = git_tree_cache_new(&cache->children[j], git_tree_entry_name(entry), pool)) < 0)
|
213
|
+
if ((error = git_tree_cache_new(&cache->children[j], git_tree_entry_name(entry), cache->oid_type, pool)) < 0)
|
205
214
|
return error;
|
206
215
|
|
207
216
|
if ((error = git_tree_lookup(&subtree, repo, git_tree_entry_id(entry))) < 0)
|
@@ -219,12 +228,12 @@ static int read_tree_recursive(git_tree_cache *cache, const git_tree *tree, git_
|
|
219
228
|
return 0;
|
220
229
|
}
|
221
230
|
|
222
|
-
int git_tree_cache_read_tree(git_tree_cache **out, const git_tree *tree, git_pool *pool)
|
231
|
+
int git_tree_cache_read_tree(git_tree_cache **out, const git_tree *tree, git_oid_t oid_type, git_pool *pool)
|
223
232
|
{
|
224
233
|
int error;
|
225
234
|
git_tree_cache *cache;
|
226
235
|
|
227
|
-
if ((error = git_tree_cache_new(&cache, "", pool)) < 0)
|
236
|
+
if ((error = git_tree_cache_new(&cache, "", oid_type, pool)) < 0)
|
228
237
|
return error;
|
229
238
|
|
230
239
|
if ((error = read_tree_recursive(cache, tree, pool)) < 0)
|
@@ -234,7 +243,7 @@ int git_tree_cache_read_tree(git_tree_cache **out, const git_tree *tree, git_poo
|
|
234
243
|
return 0;
|
235
244
|
}
|
236
245
|
|
237
|
-
int git_tree_cache_new(git_tree_cache **out, const char *name, git_pool *pool)
|
246
|
+
int git_tree_cache_new(git_tree_cache **out, const char *name, git_oid_t oid_type, git_pool *pool)
|
238
247
|
{
|
239
248
|
size_t name_len, alloc_size;
|
240
249
|
git_tree_cache *tree;
|
@@ -248,6 +257,7 @@ int git_tree_cache_new(git_tree_cache **out, const char *name, git_pool *pool)
|
|
248
257
|
|
249
258
|
memset(tree, 0x0, sizeof(git_tree_cache));
|
250
259
|
/* NUL-terminated tree name */
|
260
|
+
tree->oid_type = oid_type;
|
251
261
|
tree->namelen = name_len;
|
252
262
|
memcpy(tree->name, name, name_len);
|
253
263
|
tree->name[name_len] = '\0';
|
@@ -263,7 +273,7 @@ static void write_tree(git_str *out, git_tree_cache *tree)
|
|
263
273
|
git_str_printf(out, "%s%c%"PRIdZ" %"PRIuZ"\n", tree->name, 0, tree->entry_count, tree->children_count);
|
264
274
|
|
265
275
|
if (tree->entry_count != -1)
|
266
|
-
git_str_put(out, (char *)&tree->oid.id,
|
276
|
+
git_str_put(out, (char *)&tree->oid.id, git_oid_size(tree->oid_type));
|
267
277
|
|
268
278
|
for (i = 0; i < tree->children_count; i++)
|
269
279
|
write_tree(out, tree->children[i]);
|
@@ -18,6 +18,8 @@ typedef struct git_tree_cache {
|
|
18
18
|
struct git_tree_cache **children;
|
19
19
|
size_t children_count;
|
20
20
|
|
21
|
+
git_oid_t oid_type;
|
22
|
+
|
21
23
|
ssize_t entry_count;
|
22
24
|
git_oid oid;
|
23
25
|
size_t namelen;
|
@@ -25,14 +27,14 @@ typedef struct git_tree_cache {
|
|
25
27
|
} git_tree_cache;
|
26
28
|
|
27
29
|
int git_tree_cache_write(git_str *out, git_tree_cache *tree);
|
28
|
-
int git_tree_cache_read(git_tree_cache **tree, const char *buffer, size_t buffer_size, git_pool *pool);
|
30
|
+
int git_tree_cache_read(git_tree_cache **tree, const char *buffer, size_t buffer_size, git_oid_t oid_type, git_pool *pool);
|
29
31
|
void git_tree_cache_invalidate_path(git_tree_cache *tree, const char *path);
|
30
32
|
const git_tree_cache *git_tree_cache_get(const git_tree_cache *tree, const char *path);
|
31
|
-
int git_tree_cache_new(git_tree_cache **out, const char *name, git_pool *pool);
|
33
|
+
int git_tree_cache_new(git_tree_cache **out, const char *name, git_oid_t oid_type, git_pool *pool);
|
32
34
|
/**
|
33
35
|
* Read a tree as the root of the tree cache (like for `git read-tree`)
|
34
36
|
*/
|
35
|
-
int git_tree_cache_read_tree(git_tree_cache **out, const git_tree *tree, git_pool *pool);
|
37
|
+
int git_tree_cache_read_tree(git_tree_cache **out, const git_tree *tree, git_oid_t oid_type, git_pool *pool);
|
36
38
|
void git_tree_cache_free(git_tree_cache *tree);
|
37
39
|
|
38
40
|
#endif
|
@@ -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;
|
@@ -731,7 +735,7 @@ int git_tree__write_index(
|
|
731
735
|
return ret;
|
732
736
|
|
733
737
|
/* Read the tree cache into the index */
|
734
|
-
ret = git_tree_cache_read_tree(&index->tree, tree, &index->tree_pool);
|
738
|
+
ret = git_tree_cache_read_tree(&index->tree, tree, index->oid_type, &index->tree_pool);
|
735
739
|
git_tree_free(tree);
|
736
740
|
|
737
741
|
return ret;
|
@@ -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;
|
@@ -565,6 +562,8 @@ int git_worktree_is_prunable(git_worktree *wt,
|
|
565
562
|
git_worktree_prune_options *opts)
|
566
563
|
{
|
567
564
|
git_worktree_prune_options popts = GIT_WORKTREE_PRUNE_OPTIONS_INIT;
|
565
|
+
git_str path = GIT_STR_INIT;
|
566
|
+
int ret = 0;
|
568
567
|
|
569
568
|
GIT_ERROR_CHECK_VERSION(
|
570
569
|
opts, GIT_WORKTREE_PRUNE_OPTIONS_VERSION,
|
@@ -575,27 +574,40 @@ int git_worktree_is_prunable(git_worktree *wt,
|
|
575
574
|
|
576
575
|
if ((popts.flags & GIT_WORKTREE_PRUNE_LOCKED) == 0) {
|
577
576
|
git_str reason = GIT_STR_INIT;
|
578
|
-
int error;
|
579
577
|
|
580
|
-
if ((
|
581
|
-
|
578
|
+
if ((ret = git_worktree__is_locked(&reason, wt)) < 0)
|
579
|
+
goto out;
|
580
|
+
|
581
|
+
if (ret) {
|
582
|
+
git_error_set(GIT_ERROR_WORKTREE,
|
583
|
+
"not pruning locked working tree: '%s'",
|
584
|
+
reason.size ? reason.ptr : "is locked");
|
582
585
|
|
583
|
-
if (error) {
|
584
|
-
if (!reason.size)
|
585
|
-
git_str_attach_notowned(&reason, "no reason given", 15);
|
586
|
-
git_error_set(GIT_ERROR_WORKTREE, "not pruning locked working tree: '%s'", reason.ptr);
|
587
586
|
git_str_dispose(&reason);
|
588
|
-
|
587
|
+
ret = 0;
|
588
|
+
goto out;
|
589
589
|
}
|
590
590
|
}
|
591
591
|
|
592
592
|
if ((popts.flags & GIT_WORKTREE_PRUNE_VALID) == 0 &&
|
593
593
|
git_worktree_validate(wt) == 0) {
|
594
594
|
git_error_set(GIT_ERROR_WORKTREE, "not pruning valid working tree");
|
595
|
-
|
595
|
+
goto out;
|
596
|
+
}
|
597
|
+
|
598
|
+
if ((ret = git_str_printf(&path, "%s/worktrees/%s", wt->commondir_path, wt->name) < 0))
|
599
|
+
goto out;
|
600
|
+
|
601
|
+
if (!git_fs_path_exists(path.ptr)) {
|
602
|
+
git_error_set(GIT_ERROR_WORKTREE, "worktree gitdir ('%s') does not exist", path.ptr);
|
603
|
+
goto out;
|
596
604
|
}
|
597
605
|
|
598
|
-
|
606
|
+
ret = 1;
|
607
|
+
|
608
|
+
out:
|
609
|
+
git_str_dispose(&path);
|
610
|
+
return ret;
|
599
611
|
}
|
600
612
|
|
601
613
|
int git_worktree_prune(git_worktree *wt,
|