rugged 0.28.4 → 0.28.4.1
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/lib/rugged/version.rb +1 -1
- data/vendor/libgit2/AUTHORS +0 -1
- data/vendor/libgit2/CMakeLists.txt +16 -36
- data/vendor/libgit2/COPYING +0 -28
- data/vendor/libgit2/cmake/Modules/EnableWarnings.cmake +1 -5
- data/vendor/libgit2/cmake/Modules/FindCoreFoundation.cmake +2 -2
- data/vendor/libgit2/cmake/Modules/FindGSSAPI.cmake +1 -1
- data/vendor/libgit2/cmake/Modules/FindSecurity.cmake +2 -2
- data/vendor/libgit2/cmake/Modules/FindStatNsec.cmake +0 -6
- data/vendor/libgit2/deps/http-parser/http_parser.c +6 -11
- data/vendor/libgit2/deps/regex/CMakeLists.txt +2 -0
- data/vendor/libgit2/deps/regex/COPYING +502 -0
- data/vendor/libgit2/deps/regex/config.h +7 -0
- data/vendor/libgit2/deps/regex/regcomp.c +3857 -0
- data/vendor/libgit2/deps/regex/regex.c +92 -0
- data/vendor/libgit2/deps/regex/regex.h +582 -0
- data/vendor/libgit2/deps/regex/regex_internal.c +1744 -0
- data/vendor/libgit2/deps/regex/regex_internal.h +819 -0
- data/vendor/libgit2/deps/regex/regexec.c +4369 -0
- data/vendor/libgit2/deps/zlib/adler32.c +7 -0
- data/vendor/libgit2/deps/zlib/crc32.c +7 -0
- data/vendor/libgit2/include/git2.h +0 -2
- data/vendor/libgit2/include/git2/apply.h +2 -22
- data/vendor/libgit2/include/git2/attr.h +12 -19
- data/vendor/libgit2/include/git2/blame.h +2 -2
- data/vendor/libgit2/include/git2/blob.h +12 -44
- data/vendor/libgit2/include/git2/buffer.h +14 -20
- data/vendor/libgit2/include/git2/checkout.h +14 -46
- data/vendor/libgit2/include/git2/cherrypick.h +3 -3
- data/vendor/libgit2/include/git2/clone.h +2 -2
- data/vendor/libgit2/include/git2/commit.h +1 -23
- data/vendor/libgit2/include/git2/common.h +5 -7
- data/vendor/libgit2/include/git2/config.h +12 -12
- data/vendor/libgit2/include/git2/deprecated.h +3 -243
- data/vendor/libgit2/include/git2/describe.h +4 -4
- data/vendor/libgit2/include/git2/diff.h +14 -16
- data/vendor/libgit2/include/git2/filter.h +0 -8
- data/vendor/libgit2/include/git2/index.h +1 -2
- data/vendor/libgit2/include/git2/indexer.h +4 -48
- data/vendor/libgit2/include/git2/inttypes.h +309 -0
- data/vendor/libgit2/include/git2/merge.h +10 -6
- data/vendor/libgit2/include/git2/net.h +5 -0
- data/vendor/libgit2/include/git2/object.h +14 -2
- data/vendor/libgit2/include/git2/odb.h +2 -3
- data/vendor/libgit2/include/git2/odb_backend.h +4 -5
- data/vendor/libgit2/include/git2/oid.h +1 -1
- data/vendor/libgit2/include/git2/pack.h +1 -12
- data/vendor/libgit2/include/git2/proxy.h +3 -5
- data/vendor/libgit2/include/git2/rebase.h +2 -46
- data/vendor/libgit2/include/git2/refs.h +0 -19
- data/vendor/libgit2/include/git2/remote.h +12 -35
- data/vendor/libgit2/include/git2/repository.h +2 -24
- data/vendor/libgit2/include/git2/revert.h +1 -1
- data/vendor/libgit2/include/git2/stash.h +3 -3
- data/vendor/libgit2/include/git2/status.h +16 -25
- data/vendor/libgit2/include/git2/submodule.h +3 -20
- data/vendor/libgit2/include/git2/sys/alloc.h +9 -9
- data/vendor/libgit2/include/git2/sys/odb_backend.h +4 -48
- data/vendor/libgit2/include/git2/sys/refdb_backend.h +21 -57
- data/vendor/libgit2/include/git2/sys/repository.h +1 -5
- data/vendor/libgit2/include/git2/sys/time.h +31 -0
- data/vendor/libgit2/include/git2/sys/transport.h +2 -2
- data/vendor/libgit2/include/git2/tag.h +2 -11
- data/vendor/libgit2/include/git2/trace.h +2 -2
- data/vendor/libgit2/include/git2/transport.h +340 -11
- data/vendor/libgit2/include/git2/tree.h +1 -1
- data/vendor/libgit2/include/git2/types.h +89 -4
- data/vendor/libgit2/include/git2/version.h +2 -2
- data/vendor/libgit2/include/git2/worktree.h +5 -5
- data/vendor/libgit2/libgit2.pc.in +13 -0
- data/vendor/libgit2/src/CMakeLists.txt +222 -88
- data/vendor/libgit2/src/alloc.c +14 -2
- data/vendor/libgit2/src/apply.c +30 -60
- data/vendor/libgit2/src/attr.c +64 -70
- data/vendor/libgit2/src/attr_file.c +96 -189
- data/vendor/libgit2/src/attr_file.h +9 -9
- data/vendor/libgit2/src/attrcache.c +46 -44
- data/vendor/libgit2/src/attrcache.h +1 -2
- data/vendor/libgit2/src/blame.c +5 -17
- data/vendor/libgit2/src/blame.h +1 -1
- data/vendor/libgit2/src/blame_git.c +7 -21
- data/vendor/libgit2/src/blob.c +17 -81
- data/vendor/libgit2/src/blob.h +2 -2
- data/vendor/libgit2/src/branch.c +5 -29
- data/vendor/libgit2/src/buffer.c +7 -14
- data/vendor/libgit2/src/cache.c +33 -26
- data/vendor/libgit2/src/cache.h +1 -1
- data/vendor/libgit2/src/cc-compat.h +0 -5
- data/vendor/libgit2/src/checkout.c +16 -26
- data/vendor/libgit2/src/cherrypick.c +3 -9
- data/vendor/libgit2/src/clone.c +7 -29
- data/vendor/libgit2/src/clone.h +0 -4
- data/vendor/libgit2/src/commit.c +21 -69
- data/vendor/libgit2/src/commit.h +0 -6
- data/vendor/libgit2/src/commit_list.c +76 -28
- data/vendor/libgit2/src/commit_list.h +2 -2
- data/vendor/libgit2/src/common.h +75 -3
- data/vendor/libgit2/src/config.c +40 -31
- data/vendor/libgit2/src/config.h +6 -7
- data/vendor/libgit2/src/config_backend.h +0 -12
- data/vendor/libgit2/src/config_cache.c +39 -39
- data/vendor/libgit2/src/config_entries.c +99 -69
- data/vendor/libgit2/src/config_entries.h +0 -1
- data/vendor/libgit2/src/config_file.c +380 -337
- data/vendor/libgit2/src/config_mem.c +16 -12
- data/vendor/libgit2/src/config_parse.c +29 -49
- data/vendor/libgit2/src/config_parse.h +12 -13
- data/vendor/libgit2/src/crlf.c +14 -14
- data/vendor/libgit2/src/describe.c +20 -21
- data/vendor/libgit2/src/diff.c +58 -43
- data/vendor/libgit2/src/diff.h +1 -2
- data/vendor/libgit2/src/diff_driver.c +38 -37
- data/vendor/libgit2/src/diff_file.c +7 -9
- data/vendor/libgit2/src/diff_file.h +1 -1
- data/vendor/libgit2/src/diff_generate.c +85 -135
- data/vendor/libgit2/src/diff_generate.h +2 -2
- data/vendor/libgit2/src/diff_parse.c +1 -1
- data/vendor/libgit2/src/diff_print.c +13 -25
- data/vendor/libgit2/src/diff_stats.c +1 -1
- data/vendor/libgit2/src/diff_tform.c +4 -4
- data/vendor/libgit2/src/errors.c +22 -12
- data/vendor/libgit2/src/features.h.in +2 -9
- data/vendor/libgit2/src/fetch.c +2 -7
- data/vendor/libgit2/src/fetchhead.c +1 -1
- data/vendor/libgit2/src/filebuf.c +10 -6
- data/vendor/libgit2/src/filebuf.h +2 -2
- data/vendor/libgit2/src/{futils.c → fileops.c} +17 -21
- data/vendor/libgit2/src/{futils.h → fileops.h} +5 -5
- data/vendor/libgit2/src/filter.c +8 -16
- data/vendor/libgit2/src/fnmatch.c +248 -0
- data/vendor/libgit2/src/fnmatch.h +48 -0
- data/vendor/libgit2/src/global.c +40 -12
- data/vendor/libgit2/src/global.h +2 -0
- data/vendor/libgit2/src/hash.c +0 -61
- data/vendor/libgit2/src/hash.h +21 -19
- data/vendor/libgit2/src/hash/{sha1/collisiondetect.c → hash_collisiondetect.h} +17 -14
- data/vendor/libgit2/src/hash/{sha1/common_crypto.c → hash_common_crypto.h} +19 -15
- data/vendor/libgit2/src/hash/{sha1/generic.c → hash_generic.c} +10 -22
- data/vendor/libgit2/src/hash/{sha1/generic.h → hash_generic.h} +14 -4
- data/vendor/libgit2/src/hash/{sha1/mbedtls.c → hash_mbedtls.c} +7 -15
- data/vendor/libgit2/src/hash/{sha1/mbedtls.h → hash_mbedtls.h} +11 -6
- data/vendor/libgit2/src/hash/{sha1/openssl.c → hash_openssl.h} +18 -14
- data/vendor/libgit2/src/hash/{sha1/win32.c → hash_win32.c} +24 -34
- data/vendor/libgit2/src/hash/{sha1/win32.h → hash_win32.h} +19 -6
- data/vendor/libgit2/src/hash/{sha1/sha1dc → sha1dc}/sha1.c +3 -14
- data/vendor/libgit2/src/hash/{sha1/sha1dc → sha1dc}/sha1.h +0 -0
- data/vendor/libgit2/src/hash/{sha1/sha1dc → sha1dc}/ubc_check.c +0 -0
- data/vendor/libgit2/src/hash/{sha1/sha1dc → sha1dc}/ubc_check.h +0 -0
- data/vendor/libgit2/src/hashsig.c +1 -1
- data/vendor/libgit2/src/idxmap.c +65 -91
- data/vendor/libgit2/src/idxmap.h +15 -151
- data/vendor/libgit2/src/ignore.c +38 -32
- data/vendor/libgit2/src/index.c +43 -66
- data/vendor/libgit2/src/index.h +1 -1
- data/vendor/libgit2/src/indexer.c +70 -69
- data/vendor/libgit2/src/integer.h +4 -39
- data/vendor/libgit2/src/iterator.c +22 -27
- data/vendor/libgit2/src/map.h +1 -1
- data/vendor/libgit2/src/merge.c +44 -58
- data/vendor/libgit2/src/merge_driver.c +4 -4
- data/vendor/libgit2/src/merge_file.c +1 -1
- data/vendor/libgit2/src/mwindow.c +23 -18
- data/vendor/libgit2/src/mwindow.h +4 -4
- data/vendor/libgit2/src/netops.c +165 -55
- data/vendor/libgit2/src/netops.h +25 -3
- data/vendor/libgit2/src/notes.c +2 -2
- data/vendor/libgit2/src/object.c +2 -2
- data/vendor/libgit2/src/object.h +0 -2
- data/vendor/libgit2/src/odb.c +23 -41
- data/vendor/libgit2/src/odb.h +2 -3
- data/vendor/libgit2/src/odb_loose.c +10 -17
- data/vendor/libgit2/src/odb_mempack.c +23 -10
- data/vendor/libgit2/src/odb_pack.c +4 -4
- data/vendor/libgit2/src/offmap.c +55 -43
- data/vendor/libgit2/src/offmap.h +24 -102
- data/vendor/libgit2/src/oid.c +1 -6
- data/vendor/libgit2/src/oidmap.c +57 -39
- data/vendor/libgit2/src/oidmap.h +19 -99
- data/vendor/libgit2/src/pack-objects.c +32 -25
- data/vendor/libgit2/src/pack-objects.h +1 -1
- data/vendor/libgit2/src/pack.c +47 -45
- data/vendor/libgit2/src/pack.h +14 -12
- data/vendor/libgit2/src/parse.c +0 -10
- data/vendor/libgit2/src/parse.h +3 -3
- data/vendor/libgit2/src/patch.c +1 -1
- data/vendor/libgit2/src/patch_generate.c +2 -2
- data/vendor/libgit2/src/patch_parse.c +31 -124
- data/vendor/libgit2/src/path.c +6 -43
- data/vendor/libgit2/src/path.h +0 -2
- data/vendor/libgit2/src/pathspec.c +13 -13
- data/vendor/libgit2/src/pool.c +22 -26
- data/vendor/libgit2/src/pool.h +7 -7
- data/vendor/libgit2/src/posix.c +7 -7
- data/vendor/libgit2/src/posix.h +1 -12
- data/vendor/libgit2/src/proxy.c +2 -7
- data/vendor/libgit2/src/push.c +5 -10
- data/vendor/libgit2/src/reader.c +2 -2
- data/vendor/libgit2/src/rebase.c +7 -66
- data/vendor/libgit2/src/refdb.c +0 -12
- data/vendor/libgit2/src/refdb_fs.c +165 -214
- data/vendor/libgit2/src/reflog.c +13 -11
- data/vendor/libgit2/src/refs.c +18 -24
- data/vendor/libgit2/src/refspec.c +16 -9
- data/vendor/libgit2/src/remote.c +52 -50
- data/vendor/libgit2/src/remote.h +2 -2
- data/vendor/libgit2/src/repository.c +100 -115
- data/vendor/libgit2/src/repository.h +40 -49
- data/vendor/libgit2/src/revert.c +3 -8
- data/vendor/libgit2/src/revparse.c +19 -18
- data/vendor/libgit2/src/revwalk.c +30 -63
- data/vendor/libgit2/src/revwalk.h +0 -20
- data/vendor/libgit2/src/settings.c +0 -5
- data/vendor/libgit2/src/sortedcache.c +26 -12
- data/vendor/libgit2/src/sortedcache.h +1 -1
- data/vendor/libgit2/src/stash.c +65 -45
- data/vendor/libgit2/src/status.c +9 -15
- data/vendor/libgit2/src/{allocators/stdalloc.c → stdalloc.c} +4 -3
- data/vendor/libgit2/src/{allocators/stdalloc.h → stdalloc.h} +4 -4
- data/vendor/libgit2/src/streams/openssl.c +0 -20
- data/vendor/libgit2/src/streams/socket.c +2 -2
- data/vendor/libgit2/src/strmap.c +84 -37
- data/vendor/libgit2/src/strmap.h +33 -105
- data/vendor/libgit2/src/submodule.c +70 -102
- data/vendor/libgit2/src/submodule.h +1 -1
- data/vendor/libgit2/src/sysdir.c +1 -11
- data/vendor/libgit2/src/tag.c +2 -10
- data/vendor/libgit2/src/trace.c +1 -1
- data/vendor/libgit2/src/trace.h +2 -2
- data/vendor/libgit2/src/trailer.c +32 -46
- data/vendor/libgit2/src/transaction.c +9 -10
- data/vendor/libgit2/src/transports/auth.c +9 -10
- data/vendor/libgit2/src/transports/auth.h +4 -11
- data/vendor/libgit2/src/transports/auth_negotiate.c +9 -23
- data/vendor/libgit2/src/transports/auth_negotiate.h +2 -2
- data/vendor/libgit2/src/transports/cred.c +6 -6
- data/vendor/libgit2/src/{allocators/win32_crtdbg.h → transports/cred.h} +4 -5
- data/vendor/libgit2/src/transports/git.c +16 -11
- data/vendor/libgit2/src/transports/http.c +276 -419
- data/vendor/libgit2/src/transports/http.h +1 -1
- data/vendor/libgit2/src/transports/local.c +9 -9
- data/vendor/libgit2/src/transports/smart.c +17 -17
- data/vendor/libgit2/src/transports/smart.h +2 -2
- data/vendor/libgit2/src/transports/smart_protocol.c +60 -36
- data/vendor/libgit2/src/transports/ssh.c +36 -46
- data/vendor/libgit2/src/transports/winhttp.c +207 -231
- data/vendor/libgit2/src/tree-cache.c +7 -14
- data/vendor/libgit2/src/tree.c +24 -10
- data/vendor/libgit2/src/unix/map.c +1 -1
- data/vendor/libgit2/src/unix/posix.h +11 -1
- data/vendor/libgit2/src/userdiff.h +1 -3
- data/vendor/libgit2/src/util.c +53 -51
- data/vendor/libgit2/src/util.h +21 -16
- data/vendor/libgit2/src/win32/map.c +5 -3
- data/vendor/libgit2/src/win32/path_w32.c +2 -12
- data/vendor/libgit2/src/win32/path_w32.h +29 -0
- data/vendor/libgit2/src/win32/posix.h +4 -1
- data/vendor/libgit2/src/win32/posix_w32.c +5 -40
- data/vendor/libgit2/src/win32/precompiled.h +2 -0
- data/vendor/libgit2/src/win32/thread.c +10 -5
- data/vendor/libgit2/src/win32/w32_buffer.c +3 -7
- data/vendor/libgit2/src/win32/w32_crtdbg_stacktrace.c +93 -0
- data/vendor/libgit2/src/win32/w32_crtdbg_stacktrace.h +2 -0
- data/vendor/libgit2/src/win32/w32_stack.c +9 -4
- data/vendor/libgit2/src/win32/w32_stack.h +3 -3
- data/vendor/libgit2/src/win32/w32_util.c +0 -31
- data/vendor/libgit2/src/win32/w32_util.h +32 -6
- data/vendor/libgit2/src/worktree.c +22 -36
- data/vendor/libgit2/src/xdiff/xdiffi.c +1 -1
- data/vendor/libgit2/src/xdiff/xmerge.c +0 -12
- data/vendor/libgit2/src/xdiff/xpatience.c +0 -3
- metadata +34 -98
- data/vendor/libgit2/cmake/Modules/FindGSSFramework.cmake +0 -28
- data/vendor/libgit2/cmake/Modules/FindPCRE.cmake +0 -38
- data/vendor/libgit2/cmake/Modules/FindPCRE2.cmake +0 -37
- data/vendor/libgit2/cmake/Modules/PkgBuildConfig.cmake +0 -110
- data/vendor/libgit2/cmake/Modules/SelectGSSAPI.cmake +0 -53
- data/vendor/libgit2/cmake/Modules/SelectHTTPSBackend.cmake +0 -124
- data/vendor/libgit2/cmake/Modules/SelectHashes.cmake +0 -66
- data/vendor/libgit2/deps/ntlmclient/CMakeLists.txt +0 -21
- data/vendor/libgit2/deps/ntlmclient/compat.h +0 -33
- data/vendor/libgit2/deps/ntlmclient/crypt.h +0 -64
- data/vendor/libgit2/deps/ntlmclient/crypt_commoncrypto.c +0 -120
- data/vendor/libgit2/deps/ntlmclient/crypt_commoncrypto.h +0 -18
- data/vendor/libgit2/deps/ntlmclient/crypt_mbedtls.c +0 -145
- data/vendor/libgit2/deps/ntlmclient/crypt_mbedtls.h +0 -18
- data/vendor/libgit2/deps/ntlmclient/crypt_openssl.c +0 -130
- data/vendor/libgit2/deps/ntlmclient/crypt_openssl.h +0 -21
- data/vendor/libgit2/deps/ntlmclient/ntlm.c +0 -1420
- data/vendor/libgit2/deps/ntlmclient/ntlm.h +0 -174
- data/vendor/libgit2/deps/ntlmclient/ntlmclient.h +0 -320
- data/vendor/libgit2/deps/ntlmclient/unicode.h +0 -36
- data/vendor/libgit2/deps/ntlmclient/unicode_builtin.c +0 -445
- data/vendor/libgit2/deps/ntlmclient/unicode_iconv.c +0 -201
- data/vendor/libgit2/deps/ntlmclient/utf8.h +0 -1257
- data/vendor/libgit2/deps/ntlmclient/util.c +0 -21
- data/vendor/libgit2/deps/ntlmclient/util.h +0 -14
- data/vendor/libgit2/deps/pcre/CMakeLists.txt +0 -140
- data/vendor/libgit2/deps/pcre/COPYING +0 -5
- data/vendor/libgit2/deps/pcre/cmake/COPYING-CMAKE-SCRIPTS +0 -22
- data/vendor/libgit2/deps/pcre/cmake/FindEditline.cmake +0 -17
- data/vendor/libgit2/deps/pcre/cmake/FindPackageHandleStandardArgs.cmake +0 -58
- data/vendor/libgit2/deps/pcre/cmake/FindReadline.cmake +0 -29
- data/vendor/libgit2/deps/pcre/config.h.in +0 -57
- data/vendor/libgit2/deps/pcre/pcre.h +0 -641
- data/vendor/libgit2/deps/pcre/pcre_byte_order.c +0 -319
- data/vendor/libgit2/deps/pcre/pcre_chartables.c +0 -198
- data/vendor/libgit2/deps/pcre/pcre_compile.c +0 -9800
- data/vendor/libgit2/deps/pcre/pcre_config.c +0 -190
- data/vendor/libgit2/deps/pcre/pcre_dfa_exec.c +0 -3676
- data/vendor/libgit2/deps/pcre/pcre_exec.c +0 -7173
- data/vendor/libgit2/deps/pcre/pcre_fullinfo.c +0 -245
- data/vendor/libgit2/deps/pcre/pcre_get.c +0 -669
- data/vendor/libgit2/deps/pcre/pcre_globals.c +0 -86
- data/vendor/libgit2/deps/pcre/pcre_internal.h +0 -2787
- data/vendor/libgit2/deps/pcre/pcre_jit_compile.c +0 -11913
- data/vendor/libgit2/deps/pcre/pcre_maketables.c +0 -156
- data/vendor/libgit2/deps/pcre/pcre_newline.c +0 -210
- data/vendor/libgit2/deps/pcre/pcre_ord2utf8.c +0 -94
- data/vendor/libgit2/deps/pcre/pcre_printint.c +0 -834
- data/vendor/libgit2/deps/pcre/pcre_refcount.c +0 -92
- data/vendor/libgit2/deps/pcre/pcre_string_utils.c +0 -211
- data/vendor/libgit2/deps/pcre/pcre_study.c +0 -1686
- data/vendor/libgit2/deps/pcre/pcre_tables.c +0 -727
- data/vendor/libgit2/deps/pcre/pcre_ucd.c +0 -3644
- data/vendor/libgit2/deps/pcre/pcre_valid_utf8.c +0 -301
- data/vendor/libgit2/deps/pcre/pcre_version.c +0 -98
- data/vendor/libgit2/deps/pcre/pcre_xclass.c +0 -268
- data/vendor/libgit2/deps/pcre/pcreposix.c +0 -421
- data/vendor/libgit2/deps/pcre/pcreposix.h +0 -117
- data/vendor/libgit2/deps/pcre/ucp.h +0 -224
- data/vendor/libgit2/include/git2/cert.h +0 -135
- data/vendor/libgit2/include/git2/cred.h +0 -308
- data/vendor/libgit2/include/git2/sys/cred.h +0 -90
- data/vendor/libgit2/src/allocators/win32_crtdbg.c +0 -118
- data/vendor/libgit2/src/config_snapshot.c +0 -206
- data/vendor/libgit2/src/errors.h +0 -81
- data/vendor/libgit2/src/hash/sha1.h +0 -38
- data/vendor/libgit2/src/hash/sha1/collisiondetect.h +0 -19
- data/vendor/libgit2/src/hash/sha1/common_crypto.h +0 -19
- data/vendor/libgit2/src/hash/sha1/openssl.h +0 -19
- data/vendor/libgit2/src/net.c +0 -184
- data/vendor/libgit2/src/net.h +0 -36
- data/vendor/libgit2/src/regexp.c +0 -221
- data/vendor/libgit2/src/regexp.h +0 -97
- data/vendor/libgit2/src/transports/auth_ntlm.c +0 -223
- data/vendor/libgit2/src/transports/auth_ntlm.h +0 -35
- data/vendor/libgit2/src/wildmatch.c +0 -320
- data/vendor/libgit2/src/wildmatch.h +0 -23
- data/vendor/libgit2/src/win32/w32_common.h +0 -39
|
@@ -309,7 +309,7 @@ static int local_push_update_remote_ref(
|
|
|
309
309
|
if (lref[0] != '\0') {
|
|
310
310
|
/* Create or update a ref */
|
|
311
311
|
error = git_reference_create(NULL, remote_repo, rref, loid,
|
|
312
|
-
!
|
|
312
|
+
!git_oid_iszero(roid), NULL);
|
|
313
313
|
} else {
|
|
314
314
|
/* Delete a ref */
|
|
315
315
|
if ((error = git_reference_lookup(&remote_ref, remote_repo, rref)) < 0) {
|
|
@@ -325,7 +325,7 @@ static int local_push_update_remote_ref(
|
|
|
325
325
|
return error;
|
|
326
326
|
}
|
|
327
327
|
|
|
328
|
-
static int transfer_to_push_transfer(const
|
|
328
|
+
static int transfer_to_push_transfer(const git_transfer_progress *stats, void *payload)
|
|
329
329
|
{
|
|
330
330
|
const git_remote_callbacks *cbs = payload;
|
|
331
331
|
|
|
@@ -460,8 +460,8 @@ on_error:
|
|
|
460
460
|
}
|
|
461
461
|
|
|
462
462
|
typedef struct foreach_data {
|
|
463
|
-
|
|
464
|
-
|
|
463
|
+
git_transfer_progress *stats;
|
|
464
|
+
git_transfer_progress_cb progress_cb;
|
|
465
465
|
void *progress_payload;
|
|
466
466
|
git_odb_writepack *writepack;
|
|
467
467
|
} foreach_data;
|
|
@@ -501,7 +501,7 @@ static int local_counting(int stage, unsigned int current, unsigned int total, v
|
|
|
501
501
|
if (git_buf_oom(&progress_info))
|
|
502
502
|
return -1;
|
|
503
503
|
|
|
504
|
-
error = t->progress_cb(git_buf_cstr(&progress_info),
|
|
504
|
+
error = t->progress_cb(git_buf_cstr(&progress_info), git_buf_len(&progress_info), t->message_cb_payload);
|
|
505
505
|
git_buf_dispose(&progress_info);
|
|
506
506
|
|
|
507
507
|
return error;
|
|
@@ -533,8 +533,8 @@ static int foreach_reference_cb(git_reference *reference, void *payload)
|
|
|
533
533
|
static int local_download_pack(
|
|
534
534
|
git_transport *transport,
|
|
535
535
|
git_repository *repo,
|
|
536
|
-
|
|
537
|
-
|
|
536
|
+
git_transfer_progress *stats,
|
|
537
|
+
git_transfer_progress_cb progress_cb,
|
|
538
538
|
void *progress_payload)
|
|
539
539
|
{
|
|
540
540
|
transport_local *t = (transport_local*)transport;
|
|
@@ -588,7 +588,7 @@ static int local_download_pack(
|
|
|
588
588
|
goto cleanup;
|
|
589
589
|
|
|
590
590
|
if (t->progress_cb &&
|
|
591
|
-
(error = t->progress_cb(git_buf_cstr(&progress_info),
|
|
591
|
+
(error = t->progress_cb(git_buf_cstr(&progress_info), git_buf_len(&progress_info), t->message_cb_payload)) < 0)
|
|
592
592
|
goto cleanup;
|
|
593
593
|
|
|
594
594
|
/* Walk the objects, building a packfile */
|
|
@@ -602,7 +602,7 @@ static int local_download_pack(
|
|
|
602
602
|
goto cleanup;
|
|
603
603
|
|
|
604
604
|
if (t->progress_cb &&
|
|
605
|
-
(error = t->progress_cb(git_buf_cstr(&progress_info),
|
|
605
|
+
(error = t->progress_cb(git_buf_cstr(&progress_info), git_buf_len(&progress_info), t->message_cb_payload)) < 0)
|
|
606
606
|
goto cleanup;
|
|
607
607
|
|
|
608
608
|
if ((error = git_odb_write_pack(&writepack, odb, progress_cb, progress_payload)) != 0)
|
|
@@ -63,7 +63,7 @@ static int git_smart__set_callbacks(
|
|
|
63
63
|
git_transport_certificate_check_cb certificate_check_cb,
|
|
64
64
|
void *message_cb_payload)
|
|
65
65
|
{
|
|
66
|
-
transport_smart *t =
|
|
66
|
+
transport_smart *t = (transport_smart *)transport;
|
|
67
67
|
|
|
68
68
|
t->progress_cb = progress_cb;
|
|
69
69
|
t->error_cb = error_cb;
|
|
@@ -73,7 +73,7 @@ static int git_smart__set_callbacks(
|
|
|
73
73
|
return 0;
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
-
static
|
|
76
|
+
static int http_header_name_length(const char *http_header)
|
|
77
77
|
{
|
|
78
78
|
const char *colon = strchr(http_header, ':');
|
|
79
79
|
if (!colon)
|
|
@@ -84,7 +84,7 @@ static size_t http_header_name_length(const char *http_header)
|
|
|
84
84
|
static bool is_malformed_http_header(const char *http_header)
|
|
85
85
|
{
|
|
86
86
|
const char *c;
|
|
87
|
-
|
|
87
|
+
int name_len;
|
|
88
88
|
|
|
89
89
|
/* Disallow \r and \n */
|
|
90
90
|
c = strchr(http_header, '\r');
|
|
@@ -114,7 +114,7 @@ static char *forbidden_custom_headers[] = {
|
|
|
114
114
|
static bool is_forbidden_custom_header(const char *custom_header)
|
|
115
115
|
{
|
|
116
116
|
unsigned long i;
|
|
117
|
-
|
|
117
|
+
int name_len = http_header_name_length(custom_header);
|
|
118
118
|
|
|
119
119
|
/* Disallow headers that we set */
|
|
120
120
|
for (i = 0; i < ARRAY_SIZE(forbidden_custom_headers); i++)
|
|
@@ -128,7 +128,7 @@ static int git_smart__set_custom_headers(
|
|
|
128
128
|
git_transport *transport,
|
|
129
129
|
const git_strarray *custom_headers)
|
|
130
130
|
{
|
|
131
|
-
transport_smart *t =
|
|
131
|
+
transport_smart *t = (transport_smart *)transport;
|
|
132
132
|
size_t i;
|
|
133
133
|
|
|
134
134
|
if (t->custom_headers.count)
|
|
@@ -212,7 +212,7 @@ static int git_smart__connect(
|
|
|
212
212
|
int direction,
|
|
213
213
|
int flags)
|
|
214
214
|
{
|
|
215
|
-
transport_smart *t =
|
|
215
|
+
transport_smart *t = (transport_smart *)transport;
|
|
216
216
|
git_smart_subtransport_stream *stream;
|
|
217
217
|
int error;
|
|
218
218
|
git_pkt *pkt;
|
|
@@ -286,7 +286,7 @@ static int git_smart__connect(
|
|
|
286
286
|
if ((error = git_smart__detect_caps(first, &t->caps, &symrefs)) == 0) {
|
|
287
287
|
/* If the only ref in the list is capabilities^{} with OID_ZERO, remove it */
|
|
288
288
|
if (1 == t->refs.length && !strcmp(first->head.name, "capabilities^{}") &&
|
|
289
|
-
|
|
289
|
+
git_oid_iszero(&first->head.oid)) {
|
|
290
290
|
git_vector_clear(&t->refs);
|
|
291
291
|
git_pkt_free((git_pkt *)first);
|
|
292
292
|
}
|
|
@@ -315,7 +315,7 @@ cleanup:
|
|
|
315
315
|
|
|
316
316
|
static int git_smart__ls(const git_remote_head ***out, size_t *size, git_transport *transport)
|
|
317
317
|
{
|
|
318
|
-
transport_smart *t =
|
|
318
|
+
transport_smart *t = (transport_smart *)transport;
|
|
319
319
|
|
|
320
320
|
if (!t->have_refs) {
|
|
321
321
|
git_error_set(GIT_ERROR_NET, "the transport has not yet loaded the refs");
|
|
@@ -330,7 +330,7 @@ static int git_smart__ls(const git_remote_head ***out, size_t *size, git_transpo
|
|
|
330
330
|
|
|
331
331
|
int git_smart__negotiation_step(git_transport *transport, void *data, size_t len)
|
|
332
332
|
{
|
|
333
|
-
transport_smart *t =
|
|
333
|
+
transport_smart *t = (transport_smart *)transport;
|
|
334
334
|
git_smart_subtransport_stream *stream;
|
|
335
335
|
int error;
|
|
336
336
|
|
|
@@ -387,21 +387,21 @@ int git_smart__get_push_stream(transport_smart *t, git_smart_subtransport_stream
|
|
|
387
387
|
|
|
388
388
|
static void git_smart__cancel(git_transport *transport)
|
|
389
389
|
{
|
|
390
|
-
transport_smart *t =
|
|
390
|
+
transport_smart *t = (transport_smart *)transport;
|
|
391
391
|
|
|
392
392
|
git_atomic_set(&t->cancelled, 1);
|
|
393
393
|
}
|
|
394
394
|
|
|
395
395
|
static int git_smart__is_connected(git_transport *transport)
|
|
396
396
|
{
|
|
397
|
-
transport_smart *t =
|
|
397
|
+
transport_smart *t = (transport_smart *)transport;
|
|
398
398
|
|
|
399
399
|
return t->connected;
|
|
400
400
|
}
|
|
401
401
|
|
|
402
402
|
static int git_smart__read_flags(git_transport *transport, int *flags)
|
|
403
403
|
{
|
|
404
|
-
transport_smart *t =
|
|
404
|
+
transport_smart *t = (transport_smart *)transport;
|
|
405
405
|
|
|
406
406
|
*flags = t->flags;
|
|
407
407
|
|
|
@@ -410,7 +410,7 @@ static int git_smart__read_flags(git_transport *transport, int *flags)
|
|
|
410
410
|
|
|
411
411
|
static int git_smart__close(git_transport *transport)
|
|
412
412
|
{
|
|
413
|
-
transport_smart *t =
|
|
413
|
+
transport_smart *t = (transport_smart *)transport;
|
|
414
414
|
git_vector *common = &t->common;
|
|
415
415
|
unsigned int i;
|
|
416
416
|
git_pkt *p;
|
|
@@ -447,7 +447,7 @@ static int git_smart__close(git_transport *transport)
|
|
|
447
447
|
|
|
448
448
|
static void git_smart__free(git_transport *transport)
|
|
449
449
|
{
|
|
450
|
-
transport_smart *t =
|
|
450
|
+
transport_smart *t = (transport_smart *)transport;
|
|
451
451
|
git_vector *refs = &t->refs;
|
|
452
452
|
unsigned int i;
|
|
453
453
|
git_pkt *p;
|
|
@@ -479,7 +479,7 @@ static int ref_name_cmp(const void *a, const void *b)
|
|
|
479
479
|
|
|
480
480
|
int git_transport_smart_certificate_check(git_transport *transport, git_cert *cert, int valid, const char *hostname)
|
|
481
481
|
{
|
|
482
|
-
transport_smart *t =
|
|
482
|
+
transport_smart *t = (transport_smart *)transport;
|
|
483
483
|
|
|
484
484
|
assert(transport && cert && hostname);
|
|
485
485
|
|
|
@@ -491,7 +491,7 @@ int git_transport_smart_certificate_check(git_transport *transport, git_cert *ce
|
|
|
491
491
|
|
|
492
492
|
int git_transport_smart_credentials(git_cred **out, git_transport *transport, const char *user, int methods)
|
|
493
493
|
{
|
|
494
|
-
transport_smart *t =
|
|
494
|
+
transport_smart *t = (transport_smart *)transport;
|
|
495
495
|
|
|
496
496
|
assert(out && transport);
|
|
497
497
|
|
|
@@ -503,7 +503,7 @@ int git_transport_smart_credentials(git_cred **out, git_transport *transport, co
|
|
|
503
503
|
|
|
504
504
|
int git_transport_smart_proxy_options(git_proxy_options *out, git_transport *transport)
|
|
505
505
|
{
|
|
506
|
-
transport_smart *t =
|
|
506
|
+
transport_smart *t = (transport_smart *) transport;
|
|
507
507
|
return git_proxy_options_dup(out, &t->proxy);
|
|
508
508
|
}
|
|
509
509
|
|
|
@@ -177,8 +177,8 @@ int git_smart__negotiate_fetch(
|
|
|
177
177
|
int git_smart__download_pack(
|
|
178
178
|
git_transport *transport,
|
|
179
179
|
git_repository *repo,
|
|
180
|
-
|
|
181
|
-
|
|
180
|
+
git_transfer_progress *stats,
|
|
181
|
+
git_transfer_progress_cb progress_cb,
|
|
182
182
|
void *progress_payload);
|
|
183
183
|
|
|
184
184
|
/* smart.c */
|
|
@@ -17,7 +17,6 @@
|
|
|
17
17
|
#include "pack-objects.h"
|
|
18
18
|
#include "remote.h"
|
|
19
19
|
#include "util.h"
|
|
20
|
-
#include "revwalk.h"
|
|
21
20
|
|
|
22
21
|
#define NETWORK_XFER_THRESHOLD (100*1024)
|
|
23
22
|
/* The minimal interval between progress updates (in seconds). */
|
|
@@ -271,6 +270,50 @@ static int store_common(transport_smart *t)
|
|
|
271
270
|
return 0;
|
|
272
271
|
}
|
|
273
272
|
|
|
273
|
+
static int fetch_setup_walk(git_revwalk **out, git_repository *repo)
|
|
274
|
+
{
|
|
275
|
+
git_revwalk *walk = NULL;
|
|
276
|
+
git_strarray refs;
|
|
277
|
+
unsigned int i;
|
|
278
|
+
git_reference *ref = NULL;
|
|
279
|
+
int error;
|
|
280
|
+
|
|
281
|
+
if ((error = git_reference_list(&refs, repo)) < 0)
|
|
282
|
+
return error;
|
|
283
|
+
|
|
284
|
+
if ((error = git_revwalk_new(&walk, repo)) < 0)
|
|
285
|
+
return error;
|
|
286
|
+
|
|
287
|
+
git_revwalk_sorting(walk, GIT_SORT_TIME);
|
|
288
|
+
|
|
289
|
+
for (i = 0; i < refs.count; ++i) {
|
|
290
|
+
git_reference_free(ref);
|
|
291
|
+
ref = NULL;
|
|
292
|
+
|
|
293
|
+
/* No tags */
|
|
294
|
+
if (!git__prefixcmp(refs.strings[i], GIT_REFS_TAGS_DIR))
|
|
295
|
+
continue;
|
|
296
|
+
|
|
297
|
+
if ((error = git_reference_lookup(&ref, repo, refs.strings[i])) < 0)
|
|
298
|
+
goto on_error;
|
|
299
|
+
|
|
300
|
+
if (git_reference_type(ref) == GIT_REFERENCE_SYMBOLIC)
|
|
301
|
+
continue;
|
|
302
|
+
|
|
303
|
+
if ((error = git_revwalk_push(walk, git_reference_target(ref))) < 0)
|
|
304
|
+
goto on_error;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
*out = walk;
|
|
308
|
+
|
|
309
|
+
on_error:
|
|
310
|
+
if (error)
|
|
311
|
+
git_revwalk_free(walk);
|
|
312
|
+
git_reference_free(ref);
|
|
313
|
+
git_strarray_free(&refs);
|
|
314
|
+
return error;
|
|
315
|
+
}
|
|
316
|
+
|
|
274
317
|
static int wait_while_ack(gitno_buffer *buf)
|
|
275
318
|
{
|
|
276
319
|
int error;
|
|
@@ -304,7 +347,6 @@ static int wait_while_ack(gitno_buffer *buf)
|
|
|
304
347
|
int git_smart__negotiate_fetch(git_transport *transport, git_repository *repo, const git_remote_head * const *wants, size_t count)
|
|
305
348
|
{
|
|
306
349
|
transport_smart *t = (transport_smart *)transport;
|
|
307
|
-
git_revwalk__push_options opts = GIT_REVWALK__PUSH_OPTIONS_INIT;
|
|
308
350
|
gitno_buffer *buf = &t->buffer;
|
|
309
351
|
git_buf data = GIT_BUF_INIT;
|
|
310
352
|
git_revwalk *walk = NULL;
|
|
@@ -316,11 +358,7 @@ int git_smart__negotiate_fetch(git_transport *transport, git_repository *repo, c
|
|
|
316
358
|
if ((error = git_pkt_buffer_wants(wants, count, &t->caps, &data)) < 0)
|
|
317
359
|
return error;
|
|
318
360
|
|
|
319
|
-
if ((error =
|
|
320
|
-
goto on_error;
|
|
321
|
-
|
|
322
|
-
opts.insert_by_date = 1;
|
|
323
|
-
if ((error = git_revwalk__push_glob(walk, "refs/*", &opts)) < 0)
|
|
361
|
+
if ((error = fetch_setup_walk(&walk, repo)) < 0)
|
|
324
362
|
goto on_error;
|
|
325
363
|
|
|
326
364
|
/*
|
|
@@ -454,7 +492,7 @@ on_error:
|
|
|
454
492
|
return error;
|
|
455
493
|
}
|
|
456
494
|
|
|
457
|
-
static int no_sideband(transport_smart *t, struct git_odb_writepack *writepack, gitno_buffer *buf,
|
|
495
|
+
static int no_sideband(transport_smart *t, struct git_odb_writepack *writepack, gitno_buffer *buf, git_transfer_progress *stats)
|
|
458
496
|
{
|
|
459
497
|
int recvd;
|
|
460
498
|
|
|
@@ -481,9 +519,9 @@ static int no_sideband(transport_smart *t, struct git_odb_writepack *writepack,
|
|
|
481
519
|
|
|
482
520
|
struct network_packetsize_payload
|
|
483
521
|
{
|
|
484
|
-
|
|
522
|
+
git_transfer_progress_cb callback;
|
|
485
523
|
void *payload;
|
|
486
|
-
|
|
524
|
+
git_transfer_progress *stats;
|
|
487
525
|
size_t last_fired_bytes;
|
|
488
526
|
};
|
|
489
527
|
|
|
@@ -508,8 +546,8 @@ static int network_packetsize(size_t received, void *payload)
|
|
|
508
546
|
int git_smart__download_pack(
|
|
509
547
|
git_transport *transport,
|
|
510
548
|
git_repository *repo,
|
|
511
|
-
|
|
512
|
-
|
|
549
|
+
git_transfer_progress *stats,
|
|
550
|
+
git_transfer_progress_cb transfer_progress_cb,
|
|
513
551
|
void *progress_payload)
|
|
514
552
|
{
|
|
515
553
|
transport_smart *t = (transport_smart *)transport;
|
|
@@ -519,10 +557,10 @@ int git_smart__download_pack(
|
|
|
519
557
|
int error = 0;
|
|
520
558
|
struct network_packetsize_payload npp = {0};
|
|
521
559
|
|
|
522
|
-
memset(stats, 0, sizeof(
|
|
560
|
+
memset(stats, 0, sizeof(git_transfer_progress));
|
|
523
561
|
|
|
524
|
-
if (
|
|
525
|
-
npp.callback =
|
|
562
|
+
if (transfer_progress_cb) {
|
|
563
|
+
npp.callback = transfer_progress_cb;
|
|
526
564
|
npp.payload = progress_payload;
|
|
527
565
|
npp.stats = stats;
|
|
528
566
|
t->packetsize_cb = &network_packetsize;
|
|
@@ -535,7 +573,7 @@ int git_smart__download_pack(
|
|
|
535
573
|
}
|
|
536
574
|
|
|
537
575
|
if ((error = git_repository_odb__weakptr(&odb, repo)) < 0 ||
|
|
538
|
-
((error = git_odb_write_pack(&writepack, odb,
|
|
576
|
+
((error = git_odb_write_pack(&writepack, odb, transfer_progress_cb, progress_payload)) != 0))
|
|
539
577
|
goto done;
|
|
540
578
|
|
|
541
579
|
/*
|
|
@@ -566,14 +604,7 @@ int git_smart__download_pack(
|
|
|
566
604
|
} else if (pkt->type == GIT_PKT_PROGRESS) {
|
|
567
605
|
if (t->progress_cb) {
|
|
568
606
|
git_pkt_progress *p = (git_pkt_progress *) pkt;
|
|
569
|
-
|
|
570
|
-
if (p->len > INT_MAX) {
|
|
571
|
-
git_error_set(GIT_ERROR_NET, "oversized progress message");
|
|
572
|
-
error = GIT_ERROR;
|
|
573
|
-
goto done;
|
|
574
|
-
}
|
|
575
|
-
|
|
576
|
-
error = t->progress_cb(p->data, (int)p->len, t->message_cb_payload);
|
|
607
|
+
error = t->progress_cb(p->data, p->len, t->message_cb_payload);
|
|
577
608
|
}
|
|
578
609
|
} else if (pkt->type == GIT_PKT_DATA) {
|
|
579
610
|
git_pkt_data *p = (git_pkt_data *) pkt;
|
|
@@ -595,7 +626,7 @@ int git_smart__download_pack(
|
|
|
595
626
|
} while (1);
|
|
596
627
|
|
|
597
628
|
/*
|
|
598
|
-
* Trailing execution of
|
|
629
|
+
* Trailing execution of transfer_progress_cb, if necessary...
|
|
599
630
|
* Only the callback through the npp datastructure currently
|
|
600
631
|
* updates the last_fired_bytes value. It is possible that
|
|
601
632
|
* progress has already been reported with the correct
|
|
@@ -614,7 +645,7 @@ int git_smart__download_pack(
|
|
|
614
645
|
done:
|
|
615
646
|
if (writepack)
|
|
616
647
|
writepack->free(writepack);
|
|
617
|
-
if (
|
|
648
|
+
if (transfer_progress_cb) {
|
|
618
649
|
t->packetsize_cb = NULL;
|
|
619
650
|
t->packetsize_payload = NULL;
|
|
620
651
|
}
|
|
@@ -808,14 +839,7 @@ static int parse_report(transport_smart *transport, git_push *push)
|
|
|
808
839
|
case GIT_PKT_PROGRESS:
|
|
809
840
|
if (transport->progress_cb) {
|
|
810
841
|
git_pkt_progress *p = (git_pkt_progress *) pkt;
|
|
811
|
-
|
|
812
|
-
if (p->len > INT_MAX) {
|
|
813
|
-
git_error_set(GIT_ERROR_NET, "oversized progress message");
|
|
814
|
-
error = GIT_ERROR;
|
|
815
|
-
goto done;
|
|
816
|
-
}
|
|
817
|
-
|
|
818
|
-
error = transport->progress_cb(p->data, (int)p->len, transport->message_cb_payload);
|
|
842
|
+
error = transport->progress_cb(p->data, p->len, transport->message_cb_payload);
|
|
819
843
|
}
|
|
820
844
|
break;
|
|
821
845
|
default:
|
|
@@ -939,7 +963,7 @@ static int update_refs_from_report(
|
|
|
939
963
|
|
|
940
964
|
/* Remove any refs which we updated to have a zero OID. */
|
|
941
965
|
git_vector_rforeach(refs, i, ref) {
|
|
942
|
-
if (
|
|
966
|
+
if (git_oid_iszero(&ref->head.oid)) {
|
|
943
967
|
git_vector_remove(refs, i);
|
|
944
968
|
git_pkt_free((git_pkt *)ref);
|
|
945
969
|
}
|
|
@@ -954,7 +978,7 @@ struct push_packbuilder_payload
|
|
|
954
978
|
{
|
|
955
979
|
git_smart_subtransport_stream *stream;
|
|
956
980
|
git_packbuilder *pb;
|
|
957
|
-
|
|
981
|
+
git_push_transfer_progress cb;
|
|
958
982
|
void *cb_payload;
|
|
959
983
|
size_t last_bytes;
|
|
960
984
|
double last_progress_report_time;
|
|
@@ -14,14 +14,11 @@
|
|
|
14
14
|
#include "global.h"
|
|
15
15
|
#include "git2.h"
|
|
16
16
|
#include "buffer.h"
|
|
17
|
-
#include "net.h"
|
|
18
17
|
#include "netops.h"
|
|
19
18
|
#include "smart.h"
|
|
19
|
+
#include "cred.h"
|
|
20
20
|
#include "streams/socket.h"
|
|
21
21
|
|
|
22
|
-
#include "git2/cred.h"
|
|
23
|
-
#include "git2/sys/cred.h"
|
|
24
|
-
|
|
25
22
|
#ifdef GIT_SSH
|
|
26
23
|
|
|
27
24
|
#define OWNING_SUBTRANSPORT(s) ((ssh_subtransport *)(s)->parent.subtransport)
|
|
@@ -135,7 +132,7 @@ static int ssh_stream_read(
|
|
|
135
132
|
size_t *bytes_read)
|
|
136
133
|
{
|
|
137
134
|
int rc;
|
|
138
|
-
ssh_stream *s =
|
|
135
|
+
ssh_stream *s = (ssh_stream *)stream;
|
|
139
136
|
|
|
140
137
|
*bytes_read = 0;
|
|
141
138
|
|
|
@@ -173,7 +170,7 @@ static int ssh_stream_write(
|
|
|
173
170
|
const char *buffer,
|
|
174
171
|
size_t len)
|
|
175
172
|
{
|
|
176
|
-
ssh_stream *s =
|
|
173
|
+
ssh_stream *s = (ssh_stream *)stream;
|
|
177
174
|
size_t off = 0;
|
|
178
175
|
ssize_t ret = 0;
|
|
179
176
|
|
|
@@ -199,7 +196,7 @@ static int ssh_stream_write(
|
|
|
199
196
|
|
|
200
197
|
static void ssh_stream_free(git_smart_subtransport_stream *stream)
|
|
201
198
|
{
|
|
202
|
-
ssh_stream *s =
|
|
199
|
+
ssh_stream *s = (ssh_stream *)stream;
|
|
203
200
|
ssh_subtransport *t;
|
|
204
201
|
|
|
205
202
|
if (!stream)
|
|
@@ -261,7 +258,8 @@ static int ssh_stream_alloc(
|
|
|
261
258
|
}
|
|
262
259
|
|
|
263
260
|
static int git_ssh_extract_url_parts(
|
|
264
|
-
|
|
261
|
+
char **host,
|
|
262
|
+
char **username,
|
|
265
263
|
const char *url)
|
|
266
264
|
{
|
|
267
265
|
char *colon, *at;
|
|
@@ -273,11 +271,11 @@ static int git_ssh_extract_url_parts(
|
|
|
273
271
|
at = strchr(url, '@');
|
|
274
272
|
if (at) {
|
|
275
273
|
start = at + 1;
|
|
276
|
-
|
|
277
|
-
GIT_ERROR_CHECK_ALLOC(
|
|
274
|
+
*username = git__substrdup(url, at - url);
|
|
275
|
+
GIT_ERROR_CHECK_ALLOC(*username);
|
|
278
276
|
} else {
|
|
279
277
|
start = url;
|
|
280
|
-
|
|
278
|
+
*username = NULL;
|
|
281
279
|
}
|
|
282
280
|
|
|
283
281
|
if (colon == NULL || (colon < start)) {
|
|
@@ -285,8 +283,8 @@ static int git_ssh_extract_url_parts(
|
|
|
285
283
|
return -1;
|
|
286
284
|
}
|
|
287
285
|
|
|
288
|
-
|
|
289
|
-
GIT_ERROR_CHECK_ALLOC(
|
|
286
|
+
*host = git__substrdup(start, colon - start);
|
|
287
|
+
GIT_ERROR_CHECK_ALLOC(*host);
|
|
290
288
|
|
|
291
289
|
return 0;
|
|
292
290
|
}
|
|
@@ -481,7 +479,7 @@ static int _git_ssh_session_create(
|
|
|
481
479
|
{
|
|
482
480
|
int rc = 0;
|
|
483
481
|
LIBSSH2_SESSION* s;
|
|
484
|
-
git_socket_stream *socket =
|
|
482
|
+
git_socket_stream *socket = (git_socket_stream *) io;
|
|
485
483
|
|
|
486
484
|
assert(session);
|
|
487
485
|
|
|
@@ -508,15 +506,14 @@ static int _git_ssh_session_create(
|
|
|
508
506
|
return 0;
|
|
509
507
|
}
|
|
510
508
|
|
|
511
|
-
#define SSH_DEFAULT_PORT "22"
|
|
512
|
-
|
|
513
509
|
static int _git_ssh_setup_conn(
|
|
514
510
|
ssh_subtransport *t,
|
|
515
511
|
const char *url,
|
|
516
512
|
const char *cmd,
|
|
517
513
|
git_smart_subtransport_stream **stream)
|
|
518
514
|
{
|
|
519
|
-
|
|
515
|
+
char *host=NULL, *port=NULL, *path=NULL, *user=NULL, *pass=NULL;
|
|
516
|
+
const char *default_port="22";
|
|
520
517
|
int auth_methods, error = 0;
|
|
521
518
|
size_t i;
|
|
522
519
|
ssh_stream *s;
|
|
@@ -538,22 +535,19 @@ static int _git_ssh_setup_conn(
|
|
|
538
535
|
const char *p = ssh_prefixes[i];
|
|
539
536
|
|
|
540
537
|
if (!git__prefixcmp(url, p)) {
|
|
541
|
-
if ((error =
|
|
538
|
+
if ((error = gitno_extract_url_parts(&host, &port, &path, &user, &pass, url, default_port)) < 0)
|
|
542
539
|
goto done;
|
|
543
540
|
|
|
544
541
|
goto post_extract;
|
|
545
542
|
}
|
|
546
543
|
}
|
|
547
|
-
if ((error = git_ssh_extract_url_parts(&
|
|
544
|
+
if ((error = git_ssh_extract_url_parts(&host, &user, url)) < 0)
|
|
548
545
|
goto done;
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
urldata.port = git__strdup(SSH_DEFAULT_PORT);
|
|
552
|
-
|
|
553
|
-
GIT_ERROR_CHECK_ALLOC(urldata.port);
|
|
546
|
+
port = git__strdup(default_port);
|
|
547
|
+
GIT_ERROR_CHECK_ALLOC(port);
|
|
554
548
|
|
|
555
549
|
post_extract:
|
|
556
|
-
if ((error = git_socket_stream_new(&s->io,
|
|
550
|
+
if ((error = git_socket_stream_new(&s->io, host, port)) < 0 ||
|
|
557
551
|
(error = git_stream_connect(s->io)) < 0)
|
|
558
552
|
goto done;
|
|
559
553
|
|
|
@@ -566,14 +560,6 @@ post_extract:
|
|
|
566
560
|
|
|
567
561
|
cert.parent.cert_type = GIT_CERT_HOSTKEY_LIBSSH2;
|
|
568
562
|
|
|
569
|
-
#ifdef LIBSSH2_HOSTKEY_HASH_SHA256
|
|
570
|
-
key = libssh2_hostkey_hash(session, LIBSSH2_HOSTKEY_HASH_SHA256);
|
|
571
|
-
if (key != NULL) {
|
|
572
|
-
cert.type |= GIT_CERT_SSH_SHA256;
|
|
573
|
-
memcpy(&cert.hash_sha256, key, 32);
|
|
574
|
-
}
|
|
575
|
-
#endif
|
|
576
|
-
|
|
577
563
|
key = libssh2_hostkey_hash(session, LIBSSH2_HOSTKEY_HASH_SHA1);
|
|
578
564
|
if (key != NULL) {
|
|
579
565
|
cert.type |= GIT_CERT_SSH_SHA1;
|
|
@@ -597,7 +583,7 @@ post_extract:
|
|
|
597
583
|
|
|
598
584
|
cert_ptr = &cert;
|
|
599
585
|
|
|
600
|
-
error = t->owner->certificate_check_cb((git_cert *) cert_ptr, 0,
|
|
586
|
+
error = t->owner->certificate_check_cb((git_cert *) cert_ptr, 0, host, t->owner->message_cb_payload);
|
|
601
587
|
|
|
602
588
|
if (error < 0 && error != GIT_PASSTHROUGH) {
|
|
603
589
|
if (!git_error_last())
|
|
@@ -608,21 +594,21 @@ post_extract:
|
|
|
608
594
|
}
|
|
609
595
|
|
|
610
596
|
/* we need the username to ask for auth methods */
|
|
611
|
-
if (!
|
|
597
|
+
if (!user) {
|
|
612
598
|
if ((error = request_creds(&cred, t, NULL, GIT_CREDTYPE_USERNAME)) < 0)
|
|
613
599
|
goto done;
|
|
614
600
|
|
|
615
|
-
|
|
601
|
+
user = git__strdup(((git_cred_username *) cred)->username);
|
|
616
602
|
cred->free(cred);
|
|
617
603
|
cred = NULL;
|
|
618
|
-
if (!
|
|
604
|
+
if (!user)
|
|
619
605
|
goto done;
|
|
620
|
-
} else if (
|
|
621
|
-
if ((error = git_cred_userpass_plaintext_new(&cred,
|
|
606
|
+
} else if (user && pass) {
|
|
607
|
+
if ((error = git_cred_userpass_plaintext_new(&cred, user, pass)) < 0)
|
|
622
608
|
goto done;
|
|
623
609
|
}
|
|
624
610
|
|
|
625
|
-
if ((error = list_auth_methods(&auth_methods, session,
|
|
611
|
+
if ((error = list_auth_methods(&auth_methods, session, user)) < 0)
|
|
626
612
|
goto done;
|
|
627
613
|
|
|
628
614
|
error = GIT_EAUTH;
|
|
@@ -636,10 +622,10 @@ post_extract:
|
|
|
636
622
|
cred = NULL;
|
|
637
623
|
}
|
|
638
624
|
|
|
639
|
-
if ((error = request_creds(&cred, t,
|
|
625
|
+
if ((error = request_creds(&cred, t, user, auth_methods)) < 0)
|
|
640
626
|
goto done;
|
|
641
627
|
|
|
642
|
-
if (strcmp(
|
|
628
|
+
if (strcmp(user, git_cred__username(cred))) {
|
|
643
629
|
git_error_set(GIT_ERROR_SSH, "username does not match previous request");
|
|
644
630
|
error = -1;
|
|
645
631
|
goto done;
|
|
@@ -676,7 +662,11 @@ done:
|
|
|
676
662
|
if (cred)
|
|
677
663
|
cred->free(cred);
|
|
678
664
|
|
|
679
|
-
|
|
665
|
+
git__free(host);
|
|
666
|
+
git__free(port);
|
|
667
|
+
git__free(path);
|
|
668
|
+
git__free(user);
|
|
669
|
+
git__free(pass);
|
|
680
670
|
|
|
681
671
|
return error;
|
|
682
672
|
}
|
|
@@ -740,7 +730,7 @@ static int _ssh_action(
|
|
|
740
730
|
const char *url,
|
|
741
731
|
git_smart_service_t action)
|
|
742
732
|
{
|
|
743
|
-
ssh_subtransport *t =
|
|
733
|
+
ssh_subtransport *t = (ssh_subtransport *) subtransport;
|
|
744
734
|
|
|
745
735
|
switch (action) {
|
|
746
736
|
case GIT_SERVICE_UPLOADPACK_LS:
|
|
@@ -762,7 +752,7 @@ static int _ssh_action(
|
|
|
762
752
|
|
|
763
753
|
static int _ssh_close(git_smart_subtransport *subtransport)
|
|
764
754
|
{
|
|
765
|
-
ssh_subtransport *t =
|
|
755
|
+
ssh_subtransport *t = (ssh_subtransport *) subtransport;
|
|
766
756
|
|
|
767
757
|
assert(!t->current_stream);
|
|
768
758
|
|
|
@@ -773,7 +763,7 @@ static int _ssh_close(git_smart_subtransport *subtransport)
|
|
|
773
763
|
|
|
774
764
|
static void _ssh_free(git_smart_subtransport *subtransport)
|
|
775
765
|
{
|
|
776
|
-
ssh_subtransport *t =
|
|
766
|
+
ssh_subtransport *t = (ssh_subtransport *) subtransport;
|
|
777
767
|
|
|
778
768
|
assert(!t->current_stream);
|
|
779
769
|
|