rugged 1.3.2.3 → 1.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/rugged/extconf.rb +1 -1
- data/ext/rugged/rugged_config.c +7 -2
- data/ext/rugged/rugged_remote.c +17 -0
- data/lib/rugged/version.rb +1 -1
- data/vendor/libgit2/CMakeLists.txt +103 -276
- data/vendor/libgit2/COPYING +36 -19
- data/vendor/libgit2/cmake/AddCFlagIfSupported.cmake +21 -21
- data/vendor/libgit2/cmake/DefaultCFlags.cmake +154 -0
- data/vendor/libgit2/cmake/EnableWarnings.cmake +13 -13
- data/vendor/libgit2/cmake/FindCoreFoundation.cmake +13 -13
- data/vendor/libgit2/cmake/FindGSSAPI.cmake +171 -287
- data/vendor/libgit2/cmake/FindGSSFramework.cmake +13 -13
- data/vendor/libgit2/cmake/{FindHTTP_Parser.cmake → FindHTTPParser.cmake} +17 -17
- data/vendor/libgit2/cmake/FindIconv.cmake +27 -27
- data/vendor/libgit2/cmake/FindLibSSH2.cmake +5 -5
- data/vendor/libgit2/cmake/FindPCRE.cmake +13 -13
- data/vendor/libgit2/cmake/FindPCRE2.cmake +12 -12
- data/vendor/libgit2/cmake/FindPkgLibraries.cmake +19 -19
- data/vendor/libgit2/cmake/FindSecurity.cmake +14 -14
- data/vendor/libgit2/cmake/FindStatNsec.cmake +12 -18
- data/vendor/libgit2/cmake/Findfutimens.cmake +8 -8
- data/vendor/libgit2/cmake/FindmbedTLS.cmake +63 -70
- data/vendor/libgit2/cmake/IdeSplitSources.cmake +18 -18
- data/vendor/libgit2/cmake/PkgBuildConfig.cmake +60 -60
- data/vendor/libgit2/cmake/SanitizeBool.cmake +20 -20
- data/vendor/libgit2/cmake/SelectGSSAPI.cmake +37 -37
- data/vendor/libgit2/cmake/SelectHTTPParser.cmake +19 -0
- data/vendor/libgit2/cmake/SelectHTTPSBackend.cmake +100 -100
- data/vendor/libgit2/cmake/SelectHashes.cmake +39 -49
- data/vendor/libgit2/cmake/SelectRegex.cmake +51 -0
- data/vendor/libgit2/cmake/SelectSSH.cmake +41 -0
- data/vendor/libgit2/cmake/SelectWinHTTP.cmake +17 -0
- data/vendor/libgit2/cmake/SelectZlib.cmake +34 -0
- data/vendor/libgit2/deps/chromium-zlib/CMakeLists.txt +6 -6
- data/vendor/libgit2/deps/ntlmclient/CMakeLists.txt +31 -31
- data/vendor/libgit2/deps/ntlmclient/crypt_openssl.c +1 -1
- data/vendor/libgit2/deps/ntlmclient/ntlm.c +4 -4
- data/vendor/libgit2/deps/ntlmclient/ntlm.h +4 -4
- data/vendor/libgit2/deps/ntlmclient/ntlmclient.h +2 -2
- data/vendor/libgit2/deps/pcre/CMakeLists.txt +88 -88
- data/vendor/libgit2/deps/winhttp/CMakeLists.txt +14 -16
- data/vendor/libgit2/deps/zlib/adler32.c +0 -7
- data/vendor/libgit2/deps/zlib/crc32.c +288 -975
- data/vendor/libgit2/deps/zlib/crc32.h +436 -9441
- data/vendor/libgit2/deps/zlib/deflate.c +31 -83
- data/vendor/libgit2/deps/zlib/deflate.h +15 -12
- data/vendor/libgit2/deps/zlib/gzguts.h +2 -3
- data/vendor/libgit2/deps/zlib/infback.c +1 -2
- data/vendor/libgit2/deps/zlib/inffast.c +14 -14
- data/vendor/libgit2/deps/zlib/inflate.c +8 -39
- data/vendor/libgit2/deps/zlib/inflate.h +2 -3
- data/vendor/libgit2/deps/zlib/inftrees.c +3 -3
- data/vendor/libgit2/deps/zlib/trees.c +48 -27
- data/vendor/libgit2/deps/zlib/zlib.h +100 -126
- data/vendor/libgit2/deps/zlib/zutil.c +2 -2
- data/vendor/libgit2/deps/zlib/zutil.h +9 -12
- data/vendor/libgit2/include/git2/apply.h +16 -2
- data/vendor/libgit2/include/git2/attr.h +11 -2
- data/vendor/libgit2/include/git2/blame.h +4 -1
- data/vendor/libgit2/include/git2/blob.h +14 -1
- data/vendor/libgit2/include/git2/branch.h +2 -0
- data/vendor/libgit2/include/git2/buffer.h +18 -78
- data/vendor/libgit2/include/git2/cert.h +2 -2
- data/vendor/libgit2/include/git2/checkout.h +5 -2
- data/vendor/libgit2/include/git2/clone.h +3 -3
- data/vendor/libgit2/include/git2/commit.h +2 -0
- data/vendor/libgit2/include/git2/common.h +5 -12
- data/vendor/libgit2/include/git2/config.h +19 -3
- data/vendor/libgit2/include/git2/credential.h +2 -1
- data/vendor/libgit2/include/git2/credential_helpers.h +1 -0
- data/vendor/libgit2/include/git2/deprecated.h +1 -1
- data/vendor/libgit2/include/git2/describe.h +7 -2
- data/vendor/libgit2/include/git2/diff.h +17 -9
- data/vendor/libgit2/include/git2/email.h +1 -1
- data/vendor/libgit2/include/git2/errors.h +1 -2
- data/vendor/libgit2/include/git2/filter.h +7 -2
- data/vendor/libgit2/include/git2/graph.h +1 -0
- data/vendor/libgit2/include/git2/ignore.h +1 -1
- data/vendor/libgit2/include/git2/index.h +11 -5
- data/vendor/libgit2/include/git2/indexer.h +19 -0
- data/vendor/libgit2/include/git2/merge.h +23 -3
- data/vendor/libgit2/include/git2/message.h +2 -0
- data/vendor/libgit2/include/git2/object.h +23 -0
- data/vendor/libgit2/include/git2/odb.h +37 -7
- data/vendor/libgit2/include/git2/odb_backend.h +1 -1
- data/vendor/libgit2/include/git2/pack.h +24 -8
- data/vendor/libgit2/include/git2/patch.h +8 -0
- data/vendor/libgit2/include/git2/pathspec.h +1 -1
- data/vendor/libgit2/include/git2/proxy.h +1 -1
- data/vendor/libgit2/include/git2/rebase.h +9 -1
- data/vendor/libgit2/include/git2/refdb.h +3 -0
- data/vendor/libgit2/include/git2/reflog.h +1 -1
- data/vendor/libgit2/include/git2/refs.h +2 -2
- data/vendor/libgit2/include/git2/remote.h +184 -37
- data/vendor/libgit2/include/git2/repository.h +14 -9
- data/vendor/libgit2/include/git2/reset.h +2 -2
- data/vendor/libgit2/include/git2/revparse.h +1 -1
- data/vendor/libgit2/include/git2/revwalk.h +4 -1
- data/vendor/libgit2/include/git2/signature.h +1 -1
- data/vendor/libgit2/include/git2/stash.h +3 -3
- data/vendor/libgit2/include/git2/status.h +9 -3
- data/vendor/libgit2/include/git2/submodule.h +7 -2
- data/vendor/libgit2/include/git2/sys/commit_graph.h +1 -1
- data/vendor/libgit2/include/git2/sys/odb_backend.h +2 -5
- data/vendor/libgit2/include/git2/sys/remote.h +31 -0
- data/vendor/libgit2/include/git2/sys/stream.h +1 -1
- data/vendor/libgit2/include/git2/sys/transport.h +25 -34
- data/vendor/libgit2/include/git2/tag.h +1 -0
- data/vendor/libgit2/include/git2/tree.h +4 -3
- data/vendor/libgit2/include/git2/types.h +7 -7
- data/vendor/libgit2/include/git2/version.h +3 -3
- data/vendor/libgit2/include/git2/worktree.h +12 -2
- data/vendor/libgit2/src/CMakeLists.txt +189 -315
- data/vendor/libgit2/src/annotated_commit.h +1 -1
- data/vendor/libgit2/src/apply.c +18 -18
- data/vendor/libgit2/src/apply.h +2 -2
- data/vendor/libgit2/src/attr.c +18 -18
- data/vendor/libgit2/src/attr_file.c +17 -17
- data/vendor/libgit2/src/attr_file.h +4 -4
- data/vendor/libgit2/src/attrcache.c +17 -12
- data/vendor/libgit2/src/blame_git.c +1 -1
- data/vendor/libgit2/src/blob.c +33 -26
- data/vendor/libgit2/src/blob.h +1 -1
- data/vendor/libgit2/src/branch.c +150 -109
- data/vendor/libgit2/src/branch.h +15 -3
- data/vendor/libgit2/src/buf.c +126 -0
- data/vendor/libgit2/src/buf.h +50 -0
- data/vendor/libgit2/src/cc-compat.h +1 -1
- data/vendor/libgit2/src/checkout.c +74 -68
- data/vendor/libgit2/src/cherrypick.c +10 -10
- data/vendor/libgit2/src/clone.c +66 -66
- data/vendor/libgit2/src/commit.c +128 -58
- data/vendor/libgit2/src/commit.h +24 -1
- data/vendor/libgit2/src/commit_graph.c +68 -53
- data/vendor/libgit2/src/commit_graph.h +10 -3
- data/vendor/libgit2/src/commit_list.c +2 -3
- data/vendor/libgit2/src/common.h +10 -3
- data/vendor/libgit2/src/config.c +99 -77
- data/vendor/libgit2/src/config.h +15 -2
- data/vendor/libgit2/src/config_file.c +103 -91
- data/vendor/libgit2/src/config_mem.c +9 -9
- data/vendor/libgit2/src/config_parse.c +27 -23
- data/vendor/libgit2/src/crlf.c +24 -21
- data/vendor/libgit2/src/date.c +10 -17
- data/vendor/libgit2/src/date.h +33 -0
- data/vendor/libgit2/src/describe.c +27 -19
- data/vendor/libgit2/src/diff.c +25 -8
- data/vendor/libgit2/src/diff.h +2 -4
- data/vendor/libgit2/src/diff_driver.c +34 -36
- data/vendor/libgit2/src/diff_driver.h +3 -3
- data/vendor/libgit2/src/diff_file.c +29 -20
- data/vendor/libgit2/src/diff_generate.c +30 -6
- data/vendor/libgit2/src/diff_generate.h +5 -3
- data/vendor/libgit2/src/diff_print.c +102 -95
- data/vendor/libgit2/src/diff_stats.c +40 -29
- data/vendor/libgit2/src/{message.h → diff_stats.h} +7 -6
- data/vendor/libgit2/src/diff_tform.c +9 -8
- data/vendor/libgit2/src/diff_xdiff.c +3 -8
- data/vendor/libgit2/src/email.c +54 -38
- data/vendor/libgit2/src/email.h +1 -1
- data/vendor/libgit2/src/errors.c +18 -18
- data/vendor/libgit2/src/features.h.in +6 -1
- data/vendor/libgit2/src/fetch.c +69 -24
- data/vendor/libgit2/src/fetch.h +1 -1
- data/vendor/libgit2/src/fetchhead.c +19 -19
- data/vendor/libgit2/src/filebuf.c +28 -28
- data/vendor/libgit2/src/filebuf.h +1 -1
- data/vendor/libgit2/src/filter.c +96 -52
- data/vendor/libgit2/src/filter.h +26 -5
- data/vendor/libgit2/src/fs_path.c +1912 -0
- data/vendor/libgit2/src/fs_path.h +752 -0
- data/vendor/libgit2/src/futils.c +91 -85
- data/vendor/libgit2/src/futils.h +26 -14
- data/vendor/libgit2/src/hash/sha1/collisiondetect.c +2 -2
- data/vendor/libgit2/src/hash/sha1/common_crypto.c +2 -2
- data/vendor/libgit2/src/hash/sha1/generic.c +2 -2
- data/vendor/libgit2/src/hash/sha1/mbedtls.c +2 -2
- data/vendor/libgit2/src/hash/sha1/openssl.c +2 -2
- data/vendor/libgit2/src/hash/sha1/sha1dc/sha1.c +1 -1
- data/vendor/libgit2/src/hash/sha1/win32.c +6 -6
- data/vendor/libgit2/src/hash/sha1.h +3 -1
- data/vendor/libgit2/src/hash.c +67 -35
- data/vendor/libgit2/src/hash.h +12 -12
- data/vendor/libgit2/src/ident.c +18 -18
- data/vendor/libgit2/src/ignore.c +35 -34
- data/vendor/libgit2/src/ignore.h +2 -2
- data/vendor/libgit2/src/index.c +79 -80
- data/vendor/libgit2/src/index.h +6 -3
- data/vendor/libgit2/src/indexer.c +75 -57
- data/vendor/libgit2/src/iterator.c +64 -56
- data/vendor/libgit2/src/iterator.h +5 -5
- data/vendor/libgit2/src/khash.h +1 -1
- data/vendor/libgit2/src/libgit2.c +22 -19
- data/vendor/libgit2/src/mailmap.c +38 -36
- data/vendor/libgit2/src/merge.c +27 -27
- data/vendor/libgit2/src/merge.h +1 -14
- data/vendor/libgit2/src/merge_driver.c +2 -2
- data/vendor/libgit2/src/merge_file.c +13 -3
- data/vendor/libgit2/src/message.c +21 -10
- data/vendor/libgit2/src/midx.c +83 -66
- data/vendor/libgit2/src/midx.h +3 -3
- data/vendor/libgit2/src/mwindow.c +1 -1
- data/vendor/libgit2/src/net.c +278 -68
- data/vendor/libgit2/src/net.h +10 -3
- data/vendor/libgit2/src/netops.c +1 -1
- data/vendor/libgit2/src/netops.h +1 -1
- data/vendor/libgit2/src/notes.c +20 -29
- data/vendor/libgit2/src/object.c +49 -9
- data/vendor/libgit2/src/object.h +1 -1
- data/vendor/libgit2/src/odb.c +35 -32
- data/vendor/libgit2/src/odb.h +1 -1
- data/vendor/libgit2/src/odb_loose.c +68 -68
- data/vendor/libgit2/src/odb_mempack.c +18 -5
- data/vendor/libgit2/src/odb_pack.c +43 -43
- data/vendor/libgit2/src/oid.c +11 -4
- data/vendor/libgit2/src/oid.h +15 -0
- data/vendor/libgit2/src/pack-objects.c +41 -26
- data/vendor/libgit2/src/pack-objects.h +11 -6
- data/vendor/libgit2/src/pack.c +10 -10
- data/vendor/libgit2/src/patch.c +3 -3
- data/vendor/libgit2/src/patch.h +1 -0
- data/vendor/libgit2/src/patch_generate.c +27 -11
- data/vendor/libgit2/src/patch_generate.h +5 -5
- data/vendor/libgit2/src/patch_parse.c +24 -24
- data/vendor/libgit2/src/path.c +76 -1951
- data/vendor/libgit2/src/path.h +34 -741
- data/vendor/libgit2/src/pathspec.c +6 -6
- data/vendor/libgit2/src/pathspec.h +2 -2
- data/vendor/libgit2/src/posix.c +3 -3
- data/vendor/libgit2/src/posix.h +1 -0
- data/vendor/libgit2/src/pqueue.h +1 -1
- data/vendor/libgit2/src/proxy.c +4 -1
- data/vendor/libgit2/src/proxy.h +1 -1
- data/vendor/libgit2/src/push.c +30 -35
- data/vendor/libgit2/src/push.h +4 -16
- data/vendor/libgit2/src/rand.c +226 -0
- data/vendor/libgit2/src/rand.h +37 -0
- data/vendor/libgit2/src/reader.c +8 -8
- data/vendor/libgit2/src/reader.h +2 -2
- data/vendor/libgit2/src/rebase.c +89 -88
- data/vendor/libgit2/src/refdb_fs.c +447 -173
- data/vendor/libgit2/src/refs.c +32 -32
- data/vendor/libgit2/src/refs.h +2 -2
- data/vendor/libgit2/src/refspec.c +32 -37
- data/vendor/libgit2/src/refspec.h +5 -2
- data/vendor/libgit2/src/regexp.c +1 -1
- data/vendor/libgit2/src/remote.c +713 -419
- data/vendor/libgit2/src/remote.h +15 -10
- data/vendor/libgit2/src/repository.c +350 -467
- data/vendor/libgit2/src/repository.h +11 -10
- data/vendor/libgit2/src/reset.c +8 -5
- data/vendor/libgit2/src/revert.c +10 -10
- data/vendor/libgit2/src/revparse.c +48 -35
- data/vendor/libgit2/src/revwalk.c +7 -7
- data/vendor/libgit2/src/signature.c +12 -6
- data/vendor/libgit2/src/signature.h +1 -1
- data/vendor/libgit2/src/sortedcache.c +1 -1
- data/vendor/libgit2/src/sortedcache.h +1 -1
- data/vendor/libgit2/src/stash.c +36 -37
- data/vendor/libgit2/src/status.c +4 -1
- data/vendor/libgit2/src/{buffer.c → str.c} +157 -151
- data/vendor/libgit2/src/str.h +357 -0
- data/vendor/libgit2/src/streams/mbedtls.c +8 -6
- data/vendor/libgit2/src/streams/openssl_dynamic.h +3 -3
- data/vendor/libgit2/src/submodule.c +171 -159
- data/vendor/libgit2/src/submodule.h +1 -1
- data/vendor/libgit2/src/sysdir.c +68 -52
- data/vendor/libgit2/src/sysdir.h +15 -10
- data/vendor/libgit2/src/tag.c +29 -27
- data/vendor/libgit2/src/thread.h +3 -3
- data/vendor/libgit2/src/threadstate.c +3 -3
- data/vendor/libgit2/src/threadstate.h +1 -1
- data/vendor/libgit2/src/trace.c +1 -14
- data/vendor/libgit2/src/trace.h +5 -22
- data/vendor/libgit2/src/trailer.c +1 -1
- data/vendor/libgit2/src/transaction.c +1 -1
- data/vendor/libgit2/src/transport.c +10 -10
- data/vendor/libgit2/src/transports/auth.c +7 -9
- data/vendor/libgit2/src/transports/auth.h +2 -3
- data/vendor/libgit2/src/transports/auth_negotiate.c +12 -13
- data/vendor/libgit2/src/transports/auth_ntlm.c +10 -10
- data/vendor/libgit2/src/transports/auth_ntlm.h +0 -1
- data/vendor/libgit2/src/transports/git.c +9 -11
- data/vendor/libgit2/src/transports/http.c +37 -17
- data/vendor/libgit2/src/transports/http.h +2 -3
- data/vendor/libgit2/src/transports/httpclient.c +65 -65
- data/vendor/libgit2/src/transports/local.c +124 -116
- data/vendor/libgit2/src/transports/smart.c +51 -139
- data/vendor/libgit2/src/transports/smart.h +25 -31
- data/vendor/libgit2/src/transports/smart_pkt.c +33 -33
- data/vendor/libgit2/src/transports/smart_protocol.c +57 -39
- data/vendor/libgit2/src/transports/ssh.c +47 -112
- data/vendor/libgit2/src/transports/winhttp.c +50 -56
- data/vendor/libgit2/src/tree-cache.c +5 -5
- data/vendor/libgit2/src/tree-cache.h +2 -2
- data/vendor/libgit2/src/tree.c +59 -48
- data/vendor/libgit2/src/tree.h +1 -1
- data/vendor/libgit2/src/unix/map.c +0 -2
- data/vendor/libgit2/src/unix/posix.h +1 -4
- data/vendor/libgit2/src/unix/realpath.c +0 -2
- data/vendor/libgit2/src/util.c +14 -14
- data/vendor/libgit2/src/util.h +2 -28
- data/vendor/libgit2/src/vector.h +1 -1
- data/vendor/libgit2/src/win32/findfile.c +172 -116
- data/vendor/libgit2/src/win32/findfile.h +7 -4
- data/vendor/libgit2/src/win32/path_w32.c +140 -9
- data/vendor/libgit2/src/win32/path_w32.h +2 -0
- data/vendor/libgit2/src/win32/posix.h +0 -1
- data/vendor/libgit2/src/win32/posix_w32.c +11 -27
- data/vendor/libgit2/src/win32/w32_buffer.c +2 -3
- data/vendor/libgit2/src/win32/w32_buffer.h +2 -3
- data/vendor/libgit2/src/win32/w32_leakcheck.c +1 -1
- data/vendor/libgit2/src/worktree.c +116 -94
- data/vendor/libgit2/src/worktree.h +1 -1
- data/vendor/libgit2/src/xdiff/git-xdiff.h +53 -0
- data/vendor/libgit2/src/xdiff/xdiff.h +15 -15
- data/vendor/libgit2/src/xdiff/xdiffi.c +134 -108
- data/vendor/libgit2/src/xdiff/xemit.c +23 -7
- data/vendor/libgit2/src/xdiff/xhistogram.c +87 -78
- data/vendor/libgit2/src/xdiff/xinclude.h +1 -12
- data/vendor/libgit2/src/xdiff/xmerge.c +104 -117
- data/vendor/libgit2/src/xdiff/xpatience.c +6 -17
- data/vendor/libgit2/src/xdiff/xprepare.c +15 -20
- data/vendor/libgit2/src/xdiff/xutils.c +18 -7
- data/vendor/libgit2/src/zstream.c +5 -5
- data/vendor/libgit2/src/zstream.h +4 -4
- metadata +25 -10
- data/vendor/libgit2/src/buffer.h +0 -374
@@ -89,7 +89,7 @@ static int append_symref(const char **out, git_vector *symrefs, const char *ptr)
|
|
89
89
|
{
|
90
90
|
int error;
|
91
91
|
const char *end;
|
92
|
-
|
92
|
+
git_str buf = GIT_STR_INIT;
|
93
93
|
git_refspec *mapping = NULL;
|
94
94
|
|
95
95
|
ptr += strlen(GIT_CAP_SYMREF);
|
@@ -101,15 +101,15 @@ static int append_symref(const char **out, git_vector *symrefs, const char *ptr)
|
|
101
101
|
!(end = strchr(ptr, '\0')))
|
102
102
|
goto on_invalid;
|
103
103
|
|
104
|
-
if ((error =
|
104
|
+
if ((error = git_str_put(&buf, ptr, end - ptr)) < 0)
|
105
105
|
return error;
|
106
106
|
|
107
107
|
/* symref mapping has refspec format */
|
108
108
|
mapping = git__calloc(1, sizeof(git_refspec));
|
109
109
|
GIT_ERROR_CHECK_ALLOC(mapping);
|
110
110
|
|
111
|
-
error = git_refspec__parse(mapping,
|
112
|
-
|
111
|
+
error = git_refspec__parse(mapping, git_str_cstr(&buf), true);
|
112
|
+
git_str_dispose(&buf);
|
113
113
|
|
114
114
|
/* if the error isn't OOM, then it's a parse error; let's use a nicer message */
|
115
115
|
if (error < 0) {
|
@@ -137,7 +137,7 @@ int git_smart__detect_caps(git_pkt_ref *pkt, transport_smart_caps *caps, git_vec
|
|
137
137
|
{
|
138
138
|
const char *ptr;
|
139
139
|
|
140
|
-
/* No refs or
|
140
|
+
/* No refs or capabilities, odd but not a problem */
|
141
141
|
if (pkt == NULL || pkt->capabilities == NULL)
|
142
142
|
return GIT_ENOTFOUND;
|
143
143
|
|
@@ -205,6 +205,18 @@ int git_smart__detect_caps(git_pkt_ref *pkt, transport_smart_caps *caps, git_vec
|
|
205
205
|
continue;
|
206
206
|
}
|
207
207
|
|
208
|
+
if (!git__prefixcmp(ptr, GIT_CAP_WANT_TIP_SHA1)) {
|
209
|
+
caps->common = caps->want_tip_sha1 = 1;
|
210
|
+
ptr += strlen(GIT_CAP_DELETE_REFS);
|
211
|
+
continue;
|
212
|
+
}
|
213
|
+
|
214
|
+
if (!git__prefixcmp(ptr, GIT_CAP_WANT_REACHABLE_SHA1)) {
|
215
|
+
caps->common = caps->want_reachable_sha1 = 1;
|
216
|
+
ptr += strlen(GIT_CAP_DELETE_REFS);
|
217
|
+
continue;
|
218
|
+
}
|
219
|
+
|
208
220
|
/* We don't know this capability, so skip it */
|
209
221
|
ptr = strchr(ptr, ' ');
|
210
222
|
}
|
@@ -310,7 +322,7 @@ int git_smart__negotiate_fetch(git_transport *transport, git_repository *repo, c
|
|
310
322
|
transport_smart *t = (transport_smart *)transport;
|
311
323
|
git_revwalk__push_options opts = GIT_REVWALK__PUSH_OPTIONS_INIT;
|
312
324
|
gitno_buffer *buf = &t->buffer;
|
313
|
-
|
325
|
+
git_str data = GIT_STR_INIT;
|
314
326
|
git_revwalk *walk = NULL;
|
315
327
|
int error = -1;
|
316
328
|
git_pkt_type pkt_type;
|
@@ -354,7 +366,7 @@ int git_smart__negotiate_fetch(git_transport *transport, git_repository *repo, c
|
|
354
366
|
}
|
355
367
|
|
356
368
|
git_pkt_buffer_flush(&data);
|
357
|
-
if (
|
369
|
+
if (git_str_oom(&data)) {
|
358
370
|
error = -1;
|
359
371
|
goto on_error;
|
360
372
|
}
|
@@ -362,7 +374,7 @@ int git_smart__negotiate_fetch(git_transport *transport, git_repository *repo, c
|
|
362
374
|
if ((error = git_smart__negotiation_step(&t->parent, data.ptr, data.size)) < 0)
|
363
375
|
goto on_error;
|
364
376
|
|
365
|
-
|
377
|
+
git_str_clear(&data);
|
366
378
|
if (t->caps.multi_ack || t->caps.multi_ack_detailed) {
|
367
379
|
if ((error = store_common(t)) < 0)
|
368
380
|
goto on_error;
|
@@ -397,7 +409,7 @@ int git_smart__negotiate_fetch(git_transport *transport, git_repository *repo, c
|
|
397
409
|
goto on_error;
|
398
410
|
}
|
399
411
|
|
400
|
-
if (
|
412
|
+
if (git_str_oom(&data)) {
|
401
413
|
error = -1;
|
402
414
|
goto on_error;
|
403
415
|
}
|
@@ -417,7 +429,7 @@ int git_smart__negotiate_fetch(git_transport *transport, git_repository *repo, c
|
|
417
429
|
goto on_error;
|
418
430
|
}
|
419
431
|
|
420
|
-
if (
|
432
|
+
if (git_str_oom(&data)) {
|
421
433
|
error = -1;
|
422
434
|
goto on_error;
|
423
435
|
}
|
@@ -434,7 +446,7 @@ int git_smart__negotiate_fetch(git_transport *transport, git_repository *repo, c
|
|
434
446
|
if ((error = git_smart__negotiation_step(&t->parent, data.ptr, data.size)) < 0)
|
435
447
|
goto on_error;
|
436
448
|
|
437
|
-
|
449
|
+
git_str_dispose(&data);
|
438
450
|
git_revwalk_free(walk);
|
439
451
|
|
440
452
|
/* Now let's eat up whatever the server gives us */
|
@@ -454,7 +466,7 @@ int git_smart__negotiate_fetch(git_transport *transport, git_repository *repo, c
|
|
454
466
|
|
455
467
|
on_error:
|
456
468
|
git_revwalk_free(walk);
|
457
|
-
|
469
|
+
git_str_dispose(&data);
|
458
470
|
return error;
|
459
471
|
}
|
460
472
|
|
@@ -512,9 +524,7 @@ static int network_packetsize(size_t received, void *payload)
|
|
512
524
|
int git_smart__download_pack(
|
513
525
|
git_transport *transport,
|
514
526
|
git_repository *repo,
|
515
|
-
git_indexer_progress *stats
|
516
|
-
git_indexer_progress_cb progress_cb,
|
517
|
-
void *progress_payload)
|
527
|
+
git_indexer_progress *stats)
|
518
528
|
{
|
519
529
|
transport_smart *t = (transport_smart *)transport;
|
520
530
|
gitno_buffer *buf = &t->buffer;
|
@@ -523,6 +533,9 @@ int git_smart__download_pack(
|
|
523
533
|
int error = 0;
|
524
534
|
struct network_packetsize_payload npp = {0};
|
525
535
|
|
536
|
+
git_indexer_progress_cb progress_cb = t->connect_opts.callbacks.transfer_progress;
|
537
|
+
void *progress_payload = t->connect_opts.callbacks.payload;
|
538
|
+
|
526
539
|
memset(stats, 0, sizeof(git_indexer_progress));
|
527
540
|
|
528
541
|
if (progress_cb) {
|
@@ -568,7 +581,7 @@ int git_smart__download_pack(
|
|
568
581
|
git_error_clear();
|
569
582
|
error = GIT_EUSER;
|
570
583
|
} else if (pkt->type == GIT_PKT_PROGRESS) {
|
571
|
-
if (t->
|
584
|
+
if (t->connect_opts.callbacks.sideband_progress) {
|
572
585
|
git_pkt_progress *p = (git_pkt_progress *) pkt;
|
573
586
|
|
574
587
|
if (p->len > INT_MAX) {
|
@@ -577,7 +590,7 @@ int git_smart__download_pack(
|
|
577
590
|
goto done;
|
578
591
|
}
|
579
592
|
|
580
|
-
error = t->
|
593
|
+
error = t->connect_opts.callbacks.sideband_progress(p->data, (int)p->len, t->connect_opts.callbacks.payload);
|
581
594
|
}
|
582
595
|
} else if (pkt->type == GIT_PKT_DATA) {
|
583
596
|
git_pkt_data *p = (git_pkt_data *) pkt;
|
@@ -626,7 +639,7 @@ done:
|
|
626
639
|
return error;
|
627
640
|
}
|
628
641
|
|
629
|
-
static int gen_pktline(
|
642
|
+
static int gen_pktline(git_str *buf, git_push *push)
|
630
643
|
{
|
631
644
|
push_spec *spec;
|
632
645
|
size_t i, len;
|
@@ -647,24 +660,24 @@ static int gen_pktline(git_buf *buf, git_push *push)
|
|
647
660
|
git_oid_fmt(old_id, &spec->roid);
|
648
661
|
git_oid_fmt(new_id, &spec->loid);
|
649
662
|
|
650
|
-
|
663
|
+
git_str_printf(buf, "%04"PRIxZ"%s %s %s", len, old_id, new_id, spec->refspec.dst);
|
651
664
|
|
652
665
|
if (i == 0) {
|
653
|
-
|
666
|
+
git_str_putc(buf, '\0');
|
654
667
|
/* Core git always starts their capabilities string with a space */
|
655
668
|
if (push->report_status) {
|
656
|
-
|
657
|
-
|
669
|
+
git_str_putc(buf, ' ');
|
670
|
+
git_str_printf(buf, GIT_CAP_REPORT_STATUS);
|
658
671
|
}
|
659
|
-
|
660
|
-
|
672
|
+
git_str_putc(buf, ' ');
|
673
|
+
git_str_printf(buf, GIT_CAP_SIDE_BAND_64K);
|
661
674
|
}
|
662
675
|
|
663
|
-
|
676
|
+
git_str_putc(buf, '\n');
|
664
677
|
}
|
665
678
|
|
666
|
-
|
667
|
-
return
|
679
|
+
git_str_puts(buf, "0000");
|
680
|
+
return git_str_oom(buf) ? -1 : 0;
|
668
681
|
}
|
669
682
|
|
670
683
|
static int add_push_report_pkt(git_push *push, git_pkt *pkt)
|
@@ -707,7 +720,7 @@ static int add_push_report_pkt(git_push *push, git_pkt *pkt)
|
|
707
720
|
return 0;
|
708
721
|
}
|
709
722
|
|
710
|
-
static int add_push_report_sideband_pkt(git_push *push, git_pkt_data *data_pkt,
|
723
|
+
static int add_push_report_sideband_pkt(git_push *push, git_pkt_data *data_pkt, git_str *data_pkt_buf)
|
711
724
|
{
|
712
725
|
git_pkt *pkt;
|
713
726
|
const char *line, *line_end = NULL;
|
@@ -718,7 +731,7 @@ static int add_push_report_sideband_pkt(git_push *push, git_pkt_data *data_pkt,
|
|
718
731
|
if (reading_from_buf) {
|
719
732
|
/* We had an existing partial packet, so add the new
|
720
733
|
* packet to the buffer and parse the whole thing */
|
721
|
-
|
734
|
+
git_str_put(data_pkt_buf, data_pkt->data, data_pkt->len);
|
722
735
|
line = data_pkt_buf->ptr;
|
723
736
|
line_len = data_pkt_buf->size;
|
724
737
|
}
|
@@ -734,7 +747,7 @@ static int add_push_report_sideband_pkt(git_push *push, git_pkt_data *data_pkt,
|
|
734
747
|
/* Buffer the data when the inner packet is split
|
735
748
|
* across multiple sideband packets */
|
736
749
|
if (!reading_from_buf)
|
737
|
-
|
750
|
+
git_str_put(data_pkt_buf, line, line_len);
|
738
751
|
error = 0;
|
739
752
|
goto done;
|
740
753
|
}
|
@@ -757,7 +770,7 @@ static int add_push_report_sideband_pkt(git_push *push, git_pkt_data *data_pkt,
|
|
757
770
|
|
758
771
|
done:
|
759
772
|
if (reading_from_buf)
|
760
|
-
|
773
|
+
git_str_consume(data_pkt_buf, line_end);
|
761
774
|
return error;
|
762
775
|
}
|
763
776
|
|
@@ -767,7 +780,7 @@ static int parse_report(transport_smart *transport, git_push *push)
|
|
767
780
|
const char *line_end = NULL;
|
768
781
|
gitno_buffer *buf = &transport->buffer;
|
769
782
|
int error, recvd;
|
770
|
-
|
783
|
+
git_str data_pkt_buf = GIT_STR_INIT;
|
771
784
|
|
772
785
|
for (;;) {
|
773
786
|
if (buf->offset > 0)
|
@@ -811,7 +824,7 @@ static int parse_report(transport_smart *transport, git_push *push)
|
|
811
824
|
error = -1;
|
812
825
|
break;
|
813
826
|
case GIT_PKT_PROGRESS:
|
814
|
-
if (transport->
|
827
|
+
if (transport->connect_opts.callbacks.sideband_progress) {
|
815
828
|
git_pkt_progress *p = (git_pkt_progress *) pkt;
|
816
829
|
|
817
830
|
if (p->len > INT_MAX) {
|
@@ -820,7 +833,7 @@ static int parse_report(transport_smart *transport, git_push *push)
|
|
820
833
|
goto done;
|
821
834
|
}
|
822
835
|
|
823
|
-
error = transport->
|
836
|
+
error = transport->connect_opts.callbacks.sideband_progress(p->data, (int)p->len, transport->connect_opts.callbacks.payload);
|
824
837
|
}
|
825
838
|
break;
|
826
839
|
default:
|
@@ -847,7 +860,7 @@ static int parse_report(transport_smart *transport, git_push *push)
|
|
847
860
|
}
|
848
861
|
}
|
849
862
|
done:
|
850
|
-
|
863
|
+
git_str_dispose(&data_pkt_buf);
|
851
864
|
return error;
|
852
865
|
}
|
853
866
|
|
@@ -987,11 +1000,12 @@ static int stream_thunk(void *buf, size_t size, void *data)
|
|
987
1000
|
return error;
|
988
1001
|
}
|
989
1002
|
|
990
|
-
int git_smart__push(git_transport *transport, git_push *push
|
1003
|
+
int git_smart__push(git_transport *transport, git_push *push)
|
991
1004
|
{
|
992
1005
|
transport_smart *t = (transport_smart *)transport;
|
1006
|
+
git_remote_callbacks *cbs = &t->connect_opts.callbacks;
|
993
1007
|
struct push_packbuilder_payload packbuilder_payload = {0};
|
994
|
-
|
1008
|
+
git_str pktline = GIT_STR_INIT;
|
995
1009
|
int error = 0, need_pack = 0;
|
996
1010
|
push_spec *spec;
|
997
1011
|
unsigned int i;
|
@@ -1034,9 +1048,13 @@ int git_smart__push(git_transport *transport, git_push *push, const git_remote_c
|
|
1034
1048
|
}
|
1035
1049
|
}
|
1036
1050
|
|
1051
|
+
/* prepare pack before sending pack header to avoid timeouts */
|
1052
|
+
if (need_pack && ((error = git_packbuilder__prepare(push->pb))) < 0)
|
1053
|
+
goto done;
|
1054
|
+
|
1037
1055
|
if ((error = git_smart__get_push_stream(t, &packbuilder_payload.stream)) < 0 ||
|
1038
1056
|
(error = gen_pktline(&pktline, push)) < 0 ||
|
1039
|
-
(error = packbuilder_payload.stream->write(packbuilder_payload.stream,
|
1057
|
+
(error = packbuilder_payload.stream->write(packbuilder_payload.stream, git_str_cstr(&pktline), git_str_len(&pktline))) < 0)
|
1040
1058
|
goto done;
|
1041
1059
|
|
1042
1060
|
if (need_pack &&
|
@@ -1071,6 +1089,6 @@ int git_smart__push(git_transport *transport, git_push *push, const git_remote_c
|
|
1071
1089
|
}
|
1072
1090
|
|
1073
1091
|
done:
|
1074
|
-
|
1092
|
+
git_str_dispose(&pktline);
|
1075
1093
|
return error;
|
1076
1094
|
}
|
@@ -12,8 +12,6 @@
|
|
12
12
|
#endif
|
13
13
|
|
14
14
|
#include "runtime.h"
|
15
|
-
#include "git2.h"
|
16
|
-
#include "buffer.h"
|
17
15
|
#include "net.h"
|
18
16
|
#include "netops.h"
|
19
17
|
#include "smart.h"
|
@@ -26,8 +24,6 @@
|
|
26
24
|
|
27
25
|
#define OWNING_SUBTRANSPORT(s) ((ssh_subtransport *)(s)->parent.subtransport)
|
28
26
|
|
29
|
-
static const char *ssh_prefixes[] = { "ssh://", "ssh+git://", "git+ssh://" };
|
30
|
-
|
31
27
|
static const char cmd_uploadpack[] = "git-upload-pack";
|
32
28
|
static const char cmd_receivepack[] = "git-receive-pack";
|
33
29
|
|
@@ -37,7 +33,7 @@ typedef struct {
|
|
37
33
|
LIBSSH2_SESSION *session;
|
38
34
|
LIBSSH2_CHANNEL *channel;
|
39
35
|
const char *cmd;
|
40
|
-
|
36
|
+
git_net_url url;
|
41
37
|
unsigned sent_command : 1;
|
42
38
|
} ssh_stream;
|
43
39
|
|
@@ -65,42 +61,26 @@ static void ssh_error(LIBSSH2_SESSION *session, const char *errmsg)
|
|
65
61
|
*
|
66
62
|
* For example: git-upload-pack '/libgit2/libgit2'
|
67
63
|
*/
|
68
|
-
static int gen_proto(
|
64
|
+
static int gen_proto(git_str *request, const char *cmd, git_net_url *url)
|
69
65
|
{
|
70
66
|
const char *repo;
|
71
|
-
int len;
|
72
|
-
size_t i;
|
73
|
-
|
74
|
-
for (i = 0; i < ARRAY_SIZE(ssh_prefixes); ++i) {
|
75
|
-
const char *p = ssh_prefixes[i];
|
76
67
|
|
77
|
-
|
78
|
-
url = url + strlen(p);
|
79
|
-
repo = strchr(url, '/');
|
80
|
-
if (repo && repo[1] == '~')
|
81
|
-
++repo;
|
68
|
+
repo = url->path;
|
82
69
|
|
83
|
-
|
84
|
-
|
85
|
-
}
|
86
|
-
repo = strchr(url, ':');
|
87
|
-
if (repo) repo++;
|
70
|
+
if (repo && repo[0] == '/' && repo[1] == '~')
|
71
|
+
repo++;
|
88
72
|
|
89
|
-
|
90
|
-
if (!repo) {
|
73
|
+
if (!repo || !repo[0]) {
|
91
74
|
git_error_set(GIT_ERROR_NET, "malformed git protocol URL");
|
92
75
|
return -1;
|
93
76
|
}
|
94
77
|
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
git_buf_puts(request, " '");
|
100
|
-
git_buf_decode_percent(request, repo, strlen(repo));
|
101
|
-
git_buf_puts(request, "'");
|
78
|
+
git_str_puts(request, cmd);
|
79
|
+
git_str_puts(request, " '");
|
80
|
+
git_str_puts(request, repo);
|
81
|
+
git_str_puts(request, "'");
|
102
82
|
|
103
|
-
if (
|
83
|
+
if (git_str_oom(request))
|
104
84
|
return -1;
|
105
85
|
|
106
86
|
return 0;
|
@@ -109,9 +89,9 @@ done:
|
|
109
89
|
static int send_command(ssh_stream *s)
|
110
90
|
{
|
111
91
|
int error;
|
112
|
-
|
92
|
+
git_str request = GIT_STR_INIT;
|
113
93
|
|
114
|
-
error = gen_proto(&request, s->cmd, s->url);
|
94
|
+
error = gen_proto(&request, s->cmd, &s->url);
|
115
95
|
if (error < 0)
|
116
96
|
goto cleanup;
|
117
97
|
|
@@ -124,7 +104,7 @@ static int send_command(ssh_stream *s)
|
|
124
104
|
s->sent_command = 1;
|
125
105
|
|
126
106
|
cleanup:
|
127
|
-
|
107
|
+
git_str_dispose(&request);
|
128
108
|
return error;
|
129
109
|
}
|
130
110
|
|
@@ -226,13 +206,12 @@ static void ssh_stream_free(git_smart_subtransport_stream *stream)
|
|
226
206
|
s->io = NULL;
|
227
207
|
}
|
228
208
|
|
229
|
-
|
209
|
+
git_net_url_dispose(&s->url);
|
230
210
|
git__free(s);
|
231
211
|
}
|
232
212
|
|
233
213
|
static int ssh_stream_alloc(
|
234
214
|
ssh_subtransport *t,
|
235
|
-
const char *url,
|
236
215
|
const char *cmd,
|
237
216
|
git_smart_subtransport_stream **stream)
|
238
217
|
{
|
@@ -250,47 +229,10 @@ static int ssh_stream_alloc(
|
|
250
229
|
|
251
230
|
s->cmd = cmd;
|
252
231
|
|
253
|
-
s->url = git__strdup(url);
|
254
|
-
if (!s->url) {
|
255
|
-
git__free(s);
|
256
|
-
return -1;
|
257
|
-
}
|
258
|
-
|
259
232
|
*stream = &s->parent;
|
260
233
|
return 0;
|
261
234
|
}
|
262
235
|
|
263
|
-
static int git_ssh_extract_url_parts(
|
264
|
-
git_net_url *urldata,
|
265
|
-
const char *url)
|
266
|
-
{
|
267
|
-
char *colon, *at;
|
268
|
-
const char *start;
|
269
|
-
|
270
|
-
colon = strchr(url, ':');
|
271
|
-
|
272
|
-
|
273
|
-
at = strchr(url, '@');
|
274
|
-
if (at) {
|
275
|
-
start = at + 1;
|
276
|
-
urldata->username = git__substrdup(url, at - url);
|
277
|
-
GIT_ERROR_CHECK_ALLOC(urldata->username);
|
278
|
-
} else {
|
279
|
-
start = url;
|
280
|
-
urldata->username = NULL;
|
281
|
-
}
|
282
|
-
|
283
|
-
if (colon == NULL || (colon < start)) {
|
284
|
-
git_error_set(GIT_ERROR_NET, "malformed URL");
|
285
|
-
return -1;
|
286
|
-
}
|
287
|
-
|
288
|
-
urldata->host = git__substrdup(start, colon - start);
|
289
|
-
GIT_ERROR_CHECK_ALLOC(urldata->host);
|
290
|
-
|
291
|
-
return 0;
|
292
|
-
}
|
293
|
-
|
294
236
|
static int ssh_agent_auth(LIBSSH2_SESSION *session, git_credential_ssh_key *c) {
|
295
237
|
int rc = LIBSSH2_ERROR_NONE;
|
296
238
|
|
@@ -443,11 +385,15 @@ static int request_creds(git_credential **out, ssh_subtransport *t, const char *
|
|
443
385
|
int error, no_callback = 0;
|
444
386
|
git_credential *cred = NULL;
|
445
387
|
|
446
|
-
if (!t->owner->
|
388
|
+
if (!t->owner->connect_opts.callbacks.credentials) {
|
447
389
|
no_callback = 1;
|
448
390
|
} else {
|
449
|
-
error = t->owner->
|
450
|
-
|
391
|
+
error = t->owner->connect_opts.callbacks.credentials(
|
392
|
+
&cred,
|
393
|
+
t->owner->url,
|
394
|
+
user,
|
395
|
+
auth_methods,
|
396
|
+
t->owner->connect_opts.callbacks.payload);
|
451
397
|
|
452
398
|
if (error == GIT_PASSTHROUGH) {
|
453
399
|
no_callback = 1;
|
@@ -516,9 +462,7 @@ static int _git_ssh_setup_conn(
|
|
516
462
|
const char *cmd,
|
517
463
|
git_smart_subtransport_stream **stream)
|
518
464
|
{
|
519
|
-
git_net_url urldata = GIT_NET_URL_INIT;
|
520
465
|
int auth_methods, error = 0;
|
521
|
-
size_t i;
|
522
466
|
ssh_stream *s;
|
523
467
|
git_credential *cred = NULL;
|
524
468
|
LIBSSH2_SESSION *session=NULL;
|
@@ -527,40 +471,29 @@ static int _git_ssh_setup_conn(
|
|
527
471
|
t->current_stream = NULL;
|
528
472
|
|
529
473
|
*stream = NULL;
|
530
|
-
if (ssh_stream_alloc(t,
|
474
|
+
if (ssh_stream_alloc(t, cmd, stream) < 0)
|
531
475
|
return -1;
|
532
476
|
|
533
477
|
s = (ssh_stream *)*stream;
|
534
478
|
s->session = NULL;
|
535
479
|
s->channel = NULL;
|
536
480
|
|
537
|
-
|
538
|
-
|
539
|
-
|
540
|
-
|
541
|
-
if ((error = git_net_url_parse(&urldata, url)) < 0)
|
542
|
-
goto done;
|
481
|
+
if (git_net_str_is_url(url))
|
482
|
+
error = git_net_url_parse(&s->url, url);
|
483
|
+
else
|
484
|
+
error = git_net_url_parse_scp(&s->url, url);
|
543
485
|
|
544
|
-
|
545
|
-
}
|
546
|
-
}
|
547
|
-
if ((error = git_ssh_extract_url_parts(&urldata, url)) < 0)
|
486
|
+
if (error < 0)
|
548
487
|
goto done;
|
549
488
|
|
550
|
-
if (
|
551
|
-
urldata.port = git__strdup(SSH_DEFAULT_PORT);
|
552
|
-
|
553
|
-
GIT_ERROR_CHECK_ALLOC(urldata.port);
|
554
|
-
|
555
|
-
post_extract:
|
556
|
-
if ((error = git_socket_stream_new(&s->io, urldata.host, urldata.port)) < 0 ||
|
489
|
+
if ((error = git_socket_stream_new(&s->io, s->url.host, s->url.port)) < 0 ||
|
557
490
|
(error = git_stream_connect(s->io)) < 0)
|
558
491
|
goto done;
|
559
492
|
|
560
493
|
if ((error = _git_ssh_session_create(&session, s->io)) < 0)
|
561
494
|
goto done;
|
562
495
|
|
563
|
-
if (t->owner->
|
496
|
+
if (t->owner->connect_opts.callbacks.certificate_check != NULL) {
|
564
497
|
git_cert_hostkey cert = {{ 0 }}, *cert_ptr;
|
565
498
|
const char *key;
|
566
499
|
size_t cert_len;
|
@@ -580,7 +513,7 @@ post_extract:
|
|
580
513
|
case LIBSSH2_HOSTKEY_TYPE_DSS:
|
581
514
|
cert.raw_type = GIT_CERT_SSH_RAW_TYPE_DSS;
|
582
515
|
break;
|
583
|
-
|
516
|
+
|
584
517
|
#ifdef LIBSSH2_HOSTKEY_TYPE_ECDSA_256
|
585
518
|
case LIBSSH2_HOSTKEY_TYPE_ECDSA_256:
|
586
519
|
cert.raw_type = GIT_CERT_SSH_RAW_TYPE_KEY_ECDSA_256;
|
@@ -592,7 +525,7 @@ post_extract:
|
|
592
525
|
cert.raw_type = GIT_CERT_SSH_RAW_TYPE_KEY_ECDSA_521;
|
593
526
|
break;
|
594
527
|
#endif
|
595
|
-
|
528
|
+
|
596
529
|
#ifdef LIBSSH2_HOSTKEY_TYPE_ED25519
|
597
530
|
case LIBSSH2_HOSTKEY_TYPE_ED25519:
|
598
531
|
cert.raw_type = GIT_CERT_SSH_RAW_TYPE_KEY_ED25519;
|
@@ -634,7 +567,11 @@ post_extract:
|
|
634
567
|
|
635
568
|
cert_ptr = &cert;
|
636
569
|
|
637
|
-
error = t->owner->
|
570
|
+
error = t->owner->connect_opts.callbacks.certificate_check(
|
571
|
+
(git_cert *)cert_ptr,
|
572
|
+
0,
|
573
|
+
s->url.host,
|
574
|
+
t->owner->connect_opts.callbacks.payload);
|
638
575
|
|
639
576
|
if (error < 0 && error != GIT_PASSTHROUGH) {
|
640
577
|
if (!git_error_last())
|
@@ -645,21 +582,21 @@ post_extract:
|
|
645
582
|
}
|
646
583
|
|
647
584
|
/* we need the username to ask for auth methods */
|
648
|
-
if (!
|
585
|
+
if (!s->url.username) {
|
649
586
|
if ((error = request_creds(&cred, t, NULL, GIT_CREDENTIAL_USERNAME)) < 0)
|
650
587
|
goto done;
|
651
588
|
|
652
|
-
|
589
|
+
s->url.username = git__strdup(((git_credential_username *) cred)->username);
|
653
590
|
cred->free(cred);
|
654
591
|
cred = NULL;
|
655
|
-
if (!
|
592
|
+
if (!s->url.username)
|
656
593
|
goto done;
|
657
|
-
} else if (
|
658
|
-
if ((error = git_credential_userpass_plaintext_new(&cred,
|
594
|
+
} else if (s->url.username && s->url.password) {
|
595
|
+
if ((error = git_credential_userpass_plaintext_new(&cred, s->url.username, s->url.password)) < 0)
|
659
596
|
goto done;
|
660
597
|
}
|
661
598
|
|
662
|
-
if ((error = list_auth_methods(&auth_methods, session,
|
599
|
+
if ((error = list_auth_methods(&auth_methods, session, s->url.username)) < 0)
|
663
600
|
goto done;
|
664
601
|
|
665
602
|
error = GIT_EAUTH;
|
@@ -673,10 +610,10 @@ post_extract:
|
|
673
610
|
cred = NULL;
|
674
611
|
}
|
675
612
|
|
676
|
-
if ((error = request_creds(&cred, t,
|
613
|
+
if ((error = request_creds(&cred, t, s->url.username, auth_methods)) < 0)
|
677
614
|
goto done;
|
678
615
|
|
679
|
-
if (strcmp(
|
616
|
+
if (strcmp(s->url.username, git_credential_get_username(cred))) {
|
680
617
|
git_error_set(GIT_ERROR_SSH, "username does not match previous request");
|
681
618
|
error = -1;
|
682
619
|
goto done;
|
@@ -686,7 +623,7 @@ post_extract:
|
|
686
623
|
|
687
624
|
if (error == GIT_EAUTH) {
|
688
625
|
/* refresh auth methods */
|
689
|
-
if ((error = list_auth_methods(&auth_methods, session,
|
626
|
+
if ((error = list_auth_methods(&auth_methods, session, s->url.username)) < 0)
|
690
627
|
goto done;
|
691
628
|
else
|
692
629
|
error = GIT_EAUTH;
|
@@ -721,8 +658,6 @@ done:
|
|
721
658
|
if (cred)
|
722
659
|
cred->free(cred);
|
723
660
|
|
724
|
-
git_net_url_dispose(&urldata);
|
725
|
-
|
726
661
|
return error;
|
727
662
|
}
|
728
663
|
|
@@ -870,7 +805,7 @@ static int list_auth_methods(int *out, LIBSSH2_SESSION *session, const char *use
|
|
870
805
|
continue;
|
871
806
|
}
|
872
807
|
|
873
|
-
/*
|
808
|
+
/* Skip it if we don't know it */
|
874
809
|
ptr = strchr(ptr, ',');
|
875
810
|
}
|
876
811
|
|