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
data/vendor/libgit2/src/fetch.c
CHANGED
@@ -11,6 +11,7 @@
|
|
11
11
|
#include "git2/refs.h"
|
12
12
|
#include "git2/revwalk.h"
|
13
13
|
#include "git2/transport.h"
|
14
|
+
#include "git2/sys/remote.h"
|
14
15
|
|
15
16
|
#include "remote.h"
|
16
17
|
#include "refspec.h"
|
@@ -19,7 +20,7 @@
|
|
19
20
|
#include "repository.h"
|
20
21
|
#include "refs.h"
|
21
22
|
|
22
|
-
static int maybe_want(git_remote *remote, git_remote_head *head,
|
23
|
+
static int maybe_want(git_remote *remote, git_remote_head *head, git_refspec *tagspec, git_remote_autotag_option_t tagopt)
|
23
24
|
{
|
24
25
|
int match = 0, valid;
|
25
26
|
|
@@ -44,23 +45,57 @@ static int maybe_want(git_remote *remote, git_remote_head *head, git_odb *odb, g
|
|
44
45
|
if (!match)
|
45
46
|
return 0;
|
46
47
|
|
47
|
-
|
48
|
-
|
49
|
-
|
48
|
+
return git_vector_insert(&remote->refs, head);
|
49
|
+
}
|
50
|
+
|
51
|
+
static int mark_local(git_remote *remote)
|
52
|
+
{
|
53
|
+
git_remote_head *head;
|
54
|
+
git_odb *odb;
|
55
|
+
size_t i;
|
56
|
+
|
57
|
+
if (git_repository_odb__weakptr(&odb, remote->repo) < 0)
|
58
|
+
return -1;
|
59
|
+
|
60
|
+
git_vector_foreach(&remote->refs, i, head) {
|
61
|
+
/* If we have the object, mark it so we don't ask for it */
|
62
|
+
if (git_odb_exists(odb, &head->oid))
|
63
|
+
head->local = 1;
|
64
|
+
else
|
65
|
+
remote->need_pack = 1;
|
50
66
|
}
|
51
|
-
else
|
52
|
-
remote->need_pack = 1;
|
53
67
|
|
54
|
-
return
|
68
|
+
return 0;
|
69
|
+
}
|
70
|
+
|
71
|
+
static int maybe_want_oid(git_remote *remote, git_refspec *spec)
|
72
|
+
{
|
73
|
+
git_remote_head *oid_head;
|
74
|
+
|
75
|
+
oid_head = git__calloc(1, sizeof(git_remote_head));
|
76
|
+
GIT_ERROR_CHECK_ALLOC(oid_head);
|
77
|
+
|
78
|
+
git_oid_fromstr(&oid_head->oid, spec->src);
|
79
|
+
oid_head->name = git__strdup(spec->dst);
|
80
|
+
GIT_ERROR_CHECK_ALLOC(oid_head->name);
|
81
|
+
|
82
|
+
if (git_vector_insert(&remote->local_heads, oid_head) < 0 ||
|
83
|
+
git_vector_insert(&remote->refs, oid_head) < 0)
|
84
|
+
return -1;
|
85
|
+
|
86
|
+
return 0;
|
55
87
|
}
|
56
88
|
|
57
89
|
static int filter_wants(git_remote *remote, const git_fetch_options *opts)
|
58
90
|
{
|
59
91
|
git_remote_head **heads;
|
60
|
-
git_refspec tagspec, head;
|
92
|
+
git_refspec tagspec, head, *spec;
|
61
93
|
int error = 0;
|
62
94
|
git_odb *odb;
|
63
95
|
size_t i, heads_len;
|
96
|
+
unsigned int remote_caps;
|
97
|
+
unsigned int oid_mask = GIT_REMOTE_CAPABILITY_TIP_OID |
|
98
|
+
GIT_REMOTE_CAPABILITY_REACHABLE_OID;
|
64
99
|
git_remote_autotag_option_t tagopt = remote->download_tags;
|
65
100
|
|
66
101
|
if (opts && opts->download_tags != GIT_REMOTE_DOWNLOAD_TAGS_UNSPECIFIED)
|
@@ -87,17 +122,36 @@ static int filter_wants(git_remote *remote, const git_fetch_options *opts)
|
|
87
122
|
goto cleanup;
|
88
123
|
}
|
89
124
|
|
90
|
-
if (git_repository_odb__weakptr(&odb, remote->repo) < 0)
|
125
|
+
if ((error = git_repository_odb__weakptr(&odb, remote->repo)) < 0)
|
91
126
|
goto cleanup;
|
92
127
|
|
93
|
-
if (git_remote_ls((const git_remote_head ***)&heads, &heads_len, remote) < 0
|
128
|
+
if ((error = git_remote_ls((const git_remote_head ***)&heads, &heads_len, remote)) < 0 ||
|
129
|
+
(error = git_remote_capabilities(&remote_caps, remote)) < 0)
|
94
130
|
goto cleanup;
|
95
131
|
|
132
|
+
/* Handle remote heads */
|
96
133
|
for (i = 0; i < heads_len; i++) {
|
97
|
-
if ((error = maybe_want(remote, heads[i],
|
98
|
-
|
134
|
+
if ((error = maybe_want(remote, heads[i], &tagspec, tagopt)) < 0)
|
135
|
+
goto cleanup;
|
136
|
+
}
|
137
|
+
|
138
|
+
/* Handle explicitly specified OID specs */
|
139
|
+
git_vector_foreach(&remote->active_refspecs, i, spec) {
|
140
|
+
if (!git_oid__is_hexstr(spec->src))
|
141
|
+
continue;
|
142
|
+
|
143
|
+
if (!(remote_caps & oid_mask)) {
|
144
|
+
git_error_set(GIT_ERROR_INVALID, "cannot fetch a specific object from the remote repository");
|
145
|
+
error = -1;
|
146
|
+
goto cleanup;
|
147
|
+
}
|
148
|
+
|
149
|
+
if ((error = maybe_want_oid(remote, spec)) < 0)
|
150
|
+
goto cleanup;
|
99
151
|
}
|
100
152
|
|
153
|
+
error = mark_local(remote);
|
154
|
+
|
101
155
|
cleanup:
|
102
156
|
git_refspec__dispose(&tagspec);
|
103
157
|
|
@@ -115,10 +169,8 @@ int git_fetch_negotiate(git_remote *remote, const git_fetch_options *opts)
|
|
115
169
|
|
116
170
|
remote->need_pack = 0;
|
117
171
|
|
118
|
-
if (filter_wants(remote, opts) < 0)
|
119
|
-
git_error_set(GIT_ERROR_NET, "failed to filter the reference list for wants");
|
172
|
+
if (filter_wants(remote, opts) < 0)
|
120
173
|
return -1;
|
121
|
-
}
|
122
174
|
|
123
175
|
/* Don't try to negotiate when we don't want anything */
|
124
176
|
if (!remote->need_pack)
|
@@ -134,21 +186,14 @@ int git_fetch_negotiate(git_remote *remote, const git_fetch_options *opts)
|
|
134
186
|
remote->refs.length);
|
135
187
|
}
|
136
188
|
|
137
|
-
int git_fetch_download_pack(git_remote *remote
|
189
|
+
int git_fetch_download_pack(git_remote *remote)
|
138
190
|
{
|
139
191
|
git_transport *t = remote->transport;
|
140
|
-
git_indexer_progress_cb progress = NULL;
|
141
|
-
void *payload = NULL;
|
142
192
|
|
143
193
|
if (!remote->need_pack)
|
144
194
|
return 0;
|
145
195
|
|
146
|
-
|
147
|
-
progress = callbacks->transfer_progress;
|
148
|
-
payload = callbacks->payload;
|
149
|
-
}
|
150
|
-
|
151
|
-
return t->download_pack(t, remote->repo, &remote->stats, progress, payload);
|
196
|
+
return t->download_pack(t, remote->repo, &remote->stats);
|
152
197
|
}
|
153
198
|
|
154
199
|
int git_fetch_options_init(git_fetch_options *opts, unsigned int version)
|
data/vendor/libgit2/src/fetch.h
CHANGED
@@ -15,7 +15,7 @@
|
|
15
15
|
|
16
16
|
int git_fetch_negotiate(git_remote *remote, const git_fetch_options *opts);
|
17
17
|
|
18
|
-
int git_fetch_download_pack(git_remote *remote
|
18
|
+
int git_fetch_download_pack(git_remote *remote);
|
19
19
|
|
20
20
|
int git_fetch_setup_walk(git_revwalk **out, git_repository *repo);
|
21
21
|
|
@@ -10,7 +10,7 @@
|
|
10
10
|
#include "git2/types.h"
|
11
11
|
#include "git2/oid.h"
|
12
12
|
|
13
|
-
#include "
|
13
|
+
#include "str.h"
|
14
14
|
#include "futils.h"
|
15
15
|
#include "filebuf.h"
|
16
16
|
#include "refs.h"
|
@@ -44,7 +44,7 @@ static char *sanitized_remote_url(const char *remote_url)
|
|
44
44
|
int error;
|
45
45
|
|
46
46
|
if (git_net_url_parse(&url, remote_url) == 0) {
|
47
|
-
|
47
|
+
git_str buf = GIT_STR_INIT;
|
48
48
|
|
49
49
|
git__free(url.username);
|
50
50
|
git__free(url.password);
|
@@ -53,7 +53,7 @@ static char *sanitized_remote_url(const char *remote_url)
|
|
53
53
|
if ((error = git_net_url_fmt(&buf, &url)) < 0)
|
54
54
|
goto fallback;
|
55
55
|
|
56
|
-
sanitized =
|
56
|
+
sanitized = git_str_detach(&buf);
|
57
57
|
}
|
58
58
|
|
59
59
|
fallback:
|
@@ -143,22 +143,22 @@ static int fetchhead_ref_write(
|
|
143
143
|
int git_fetchhead_write(git_repository *repo, git_vector *fetchhead_refs)
|
144
144
|
{
|
145
145
|
git_filebuf file = GIT_FILEBUF_INIT;
|
146
|
-
|
146
|
+
git_str path = GIT_STR_INIT;
|
147
147
|
unsigned int i;
|
148
148
|
git_fetchhead_ref *fetchhead_ref;
|
149
149
|
|
150
150
|
GIT_ASSERT_ARG(repo);
|
151
151
|
GIT_ASSERT_ARG(fetchhead_refs);
|
152
152
|
|
153
|
-
if (
|
153
|
+
if (git_str_joinpath(&path, repo->gitdir, GIT_FETCH_HEAD_FILE) < 0)
|
154
154
|
return -1;
|
155
155
|
|
156
156
|
if (git_filebuf_open(&file, path.ptr, GIT_FILEBUF_APPEND, GIT_REFS_FILE_MODE) < 0) {
|
157
|
-
|
157
|
+
git_str_dispose(&path);
|
158
158
|
return -1;
|
159
159
|
}
|
160
160
|
|
161
|
-
|
161
|
+
git_str_dispose(&path);
|
162
162
|
|
163
163
|
git_vector_sort(fetchhead_refs);
|
164
164
|
|
@@ -171,7 +171,7 @@ int git_fetchhead_write(git_repository *repo, git_vector *fetchhead_refs)
|
|
171
171
|
static int fetchhead_ref_parse(
|
172
172
|
git_oid *oid,
|
173
173
|
unsigned int *is_merge,
|
174
|
-
|
174
|
+
git_str *ref_name,
|
175
175
|
const char **remote_url,
|
176
176
|
char *line,
|
177
177
|
size_t line_num)
|
@@ -259,12 +259,12 @@ static int fetchhead_ref_parse(
|
|
259
259
|
*remote_url = desc;
|
260
260
|
}
|
261
261
|
|
262
|
-
|
262
|
+
git_str_clear(ref_name);
|
263
263
|
|
264
264
|
if (type)
|
265
|
-
|
265
|
+
git_str_join(ref_name, '/', type, name);
|
266
266
|
else if(name)
|
267
|
-
|
267
|
+
git_str_puts(ref_name, name);
|
268
268
|
|
269
269
|
return error;
|
270
270
|
}
|
@@ -273,7 +273,7 @@ int git_repository_fetchhead_foreach(git_repository *repo,
|
|
273
273
|
git_repository_fetchhead_foreach_cb cb,
|
274
274
|
void *payload)
|
275
275
|
{
|
276
|
-
|
276
|
+
git_str path = GIT_STR_INIT, file = GIT_STR_INIT, name = GIT_STR_INIT;
|
277
277
|
const char *ref_name;
|
278
278
|
git_oid oid;
|
279
279
|
const char *remote_url;
|
@@ -285,10 +285,10 @@ int git_repository_fetchhead_foreach(git_repository *repo,
|
|
285
285
|
GIT_ASSERT_ARG(repo);
|
286
286
|
GIT_ASSERT_ARG(cb);
|
287
287
|
|
288
|
-
if (
|
288
|
+
if (git_str_joinpath(&path, repo->gitdir, GIT_FETCH_HEAD_FILE) < 0)
|
289
289
|
return -1;
|
290
290
|
|
291
|
-
if ((error = git_futils_readbuffer(&file,
|
291
|
+
if ((error = git_futils_readbuffer(&file, git_str_cstr(&path))) < 0)
|
292
292
|
goto done;
|
293
293
|
|
294
294
|
buffer = file.ptr;
|
@@ -300,8 +300,8 @@ int git_repository_fetchhead_foreach(git_repository *repo,
|
|
300
300
|
&oid, &is_merge, &name, &remote_url, line, line_num)) < 0)
|
301
301
|
goto done;
|
302
302
|
|
303
|
-
if (
|
304
|
-
ref_name =
|
303
|
+
if (git_str_len(&name) > 0)
|
304
|
+
ref_name = git_str_cstr(&name);
|
305
305
|
else
|
306
306
|
ref_name = NULL;
|
307
307
|
|
@@ -319,9 +319,9 @@ int git_repository_fetchhead_foreach(git_repository *repo,
|
|
319
319
|
}
|
320
320
|
|
321
321
|
done:
|
322
|
-
|
323
|
-
|
324
|
-
|
322
|
+
git_str_dispose(&file);
|
323
|
+
git_str_dispose(&path);
|
324
|
+
git_str_dispose(&name);
|
325
325
|
|
326
326
|
return error;
|
327
327
|
}
|
@@ -43,7 +43,7 @@ static int verify_last_error(git_filebuf *file)
|
|
43
43
|
|
44
44
|
static int lock_file(git_filebuf *file, int flags, mode_t mode)
|
45
45
|
{
|
46
|
-
if (
|
46
|
+
if (git_fs_path_exists(file->path_lock) == true) {
|
47
47
|
git_error_clear(); /* actual OS error code just confuses */
|
48
48
|
git_error_set(GIT_ERROR_OS,
|
49
49
|
"failed to lock file '%s' for writing", file->path_lock);
|
@@ -63,7 +63,7 @@ static int lock_file(git_filebuf *file, int flags, mode_t mode)
|
|
63
63
|
|
64
64
|
file->fd_is_open = true;
|
65
65
|
|
66
|
-
if ((flags & GIT_FILEBUF_APPEND) &&
|
66
|
+
if ((flags & GIT_FILEBUF_APPEND) && git_fs_path_exists(file->path_original) == true) {
|
67
67
|
git_file source;
|
68
68
|
char buffer[FILEIO_BUFSIZE];
|
69
69
|
ssize_t read_bytes;
|
@@ -103,7 +103,7 @@ void git_filebuf_cleanup(git_filebuf *file)
|
|
103
103
|
if (file->fd_is_open && file->fd >= 0)
|
104
104
|
p_close(file->fd);
|
105
105
|
|
106
|
-
if (file->created_lock && !file->did_rename && file->path_lock &&
|
106
|
+
if (file->created_lock && !file->did_rename && file->path_lock && git_fs_path_exists(file->path_lock))
|
107
107
|
p_unlink(file->path_lock);
|
108
108
|
|
109
109
|
if (file->compute_digest) {
|
@@ -195,21 +195,21 @@ static int write_deflate(git_filebuf *file, void *source, size_t len)
|
|
195
195
|
|
196
196
|
#define MAX_SYMLINK_DEPTH 5
|
197
197
|
|
198
|
-
static int resolve_symlink(
|
198
|
+
static int resolve_symlink(git_str *out, const char *path)
|
199
199
|
{
|
200
200
|
int i, error, root;
|
201
201
|
ssize_t ret;
|
202
202
|
struct stat st;
|
203
|
-
|
203
|
+
git_str curpath = GIT_STR_INIT, target = GIT_STR_INIT;
|
204
204
|
|
205
|
-
if ((error =
|
206
|
-
(error =
|
205
|
+
if ((error = git_str_grow(&target, GIT_PATH_MAX + 1)) < 0 ||
|
206
|
+
(error = git_str_puts(&curpath, path)) < 0)
|
207
207
|
return error;
|
208
208
|
|
209
209
|
for (i = 0; i < MAX_SYMLINK_DEPTH; i++) {
|
210
210
|
error = p_lstat(curpath.ptr, &st);
|
211
211
|
if (error < 0 && errno == ENOENT) {
|
212
|
-
error =
|
212
|
+
error = git_str_puts(out, curpath.ptr);
|
213
213
|
goto cleanup;
|
214
214
|
}
|
215
215
|
|
@@ -220,7 +220,7 @@ static int resolve_symlink(git_buf *out, const char *path)
|
|
220
220
|
}
|
221
221
|
|
222
222
|
if (!S_ISLNK(st.st_mode)) {
|
223
|
-
error =
|
223
|
+
error = git_str_puts(out, curpath.ptr);
|
224
224
|
goto cleanup;
|
225
225
|
}
|
226
226
|
|
@@ -241,20 +241,20 @@ static int resolve_symlink(git_buf *out, const char *path)
|
|
241
241
|
target.ptr[ret] = '\0';
|
242
242
|
target.size = ret;
|
243
243
|
|
244
|
-
root =
|
244
|
+
root = git_fs_path_root(target.ptr);
|
245
245
|
if (root >= 0) {
|
246
|
-
if ((error =
|
246
|
+
if ((error = git_str_sets(&curpath, target.ptr)) < 0)
|
247
247
|
goto cleanup;
|
248
248
|
} else {
|
249
|
-
|
249
|
+
git_str dir = GIT_STR_INIT;
|
250
250
|
|
251
|
-
if ((error =
|
251
|
+
if ((error = git_fs_path_dirname_r(&dir, curpath.ptr)) < 0)
|
252
252
|
goto cleanup;
|
253
253
|
|
254
|
-
|
255
|
-
|
254
|
+
git_str_swap(&curpath, &dir);
|
255
|
+
git_str_dispose(&dir);
|
256
256
|
|
257
|
-
if ((error =
|
257
|
+
if ((error = git_fs_path_apply_relative(&curpath, target.ptr)) < 0)
|
258
258
|
goto cleanup;
|
259
259
|
}
|
260
260
|
}
|
@@ -263,8 +263,8 @@ static int resolve_symlink(git_buf *out, const char *path)
|
|
263
263
|
error = -1;
|
264
264
|
|
265
265
|
cleanup:
|
266
|
-
|
267
|
-
|
266
|
+
git_str_dispose(&curpath);
|
267
|
+
git_str_dispose(&target);
|
268
268
|
return error;
|
269
269
|
}
|
270
270
|
|
@@ -305,7 +305,7 @@ int git_filebuf_open_withsize(git_filebuf *file, const char *path, int flags, mo
|
|
305
305
|
if (flags & GIT_FILEBUF_HASH_CONTENTS) {
|
306
306
|
file->compute_digest = 1;
|
307
307
|
|
308
|
-
if (git_hash_ctx_init(&file->digest) < 0)
|
308
|
+
if (git_hash_ctx_init(&file->digest, GIT_HASH_ALGORITHM_SHA1) < 0)
|
309
309
|
goto cleanup;
|
310
310
|
}
|
311
311
|
|
@@ -332,13 +332,13 @@ int git_filebuf_open_withsize(git_filebuf *file, const char *path, int flags, mo
|
|
332
332
|
|
333
333
|
/* If we are writing to a temp file */
|
334
334
|
if (flags & GIT_FILEBUF_TEMPORARY) {
|
335
|
-
|
335
|
+
git_str tmp_path = GIT_STR_INIT;
|
336
336
|
|
337
337
|
/* Open the file as temporary for locking */
|
338
338
|
file->fd = git_futils_mktmp(&tmp_path, path, mode);
|
339
339
|
|
340
340
|
if (file->fd < 0) {
|
341
|
-
|
341
|
+
git_str_dispose(&tmp_path);
|
342
342
|
goto cleanup;
|
343
343
|
}
|
344
344
|
file->fd_is_open = true;
|
@@ -346,17 +346,17 @@ int git_filebuf_open_withsize(git_filebuf *file, const char *path, int flags, mo
|
|
346
346
|
|
347
347
|
/* No original path */
|
348
348
|
file->path_original = NULL;
|
349
|
-
file->path_lock =
|
349
|
+
file->path_lock = git_str_detach(&tmp_path);
|
350
350
|
GIT_ERROR_CHECK_ALLOC(file->path_lock);
|
351
351
|
} else {
|
352
|
-
|
352
|
+
git_str resolved_path = GIT_STR_INIT;
|
353
353
|
|
354
354
|
if ((error = resolve_symlink(&resolved_path, path)) < 0)
|
355
355
|
goto cleanup;
|
356
356
|
|
357
357
|
/* Save the original path of the file */
|
358
358
|
path_len = resolved_path.size;
|
359
|
-
file->path_original =
|
359
|
+
file->path_original = git_str_detach(&resolved_path);
|
360
360
|
|
361
361
|
/* create the locking path by appending ".lock" to the original */
|
362
362
|
GIT_ERROR_CHECK_ALLOC_ADD(&alloc_len, path_len, GIT_FILELOCK_EXTLENGTH);
|
@@ -366,7 +366,7 @@ int git_filebuf_open_withsize(git_filebuf *file, const char *path, int flags, mo
|
|
366
366
|
memcpy(file->path_lock, file->path_original, path_len);
|
367
367
|
memcpy(file->path_lock + path_len, GIT_FILELOCK_EXTENSION, GIT_FILELOCK_EXTLENGTH);
|
368
368
|
|
369
|
-
if (
|
369
|
+
if (git_fs_path_isdir(file->path_original)) {
|
370
370
|
git_error_set(GIT_ERROR_FILESYSTEM, "path '%s' is a directory", file->path_original);
|
371
371
|
error = GIT_EDIRECTORY;
|
372
372
|
goto cleanup;
|
@@ -386,9 +386,9 @@ cleanup:
|
|
386
386
|
return error;
|
387
387
|
}
|
388
388
|
|
389
|
-
int git_filebuf_hash(
|
389
|
+
int git_filebuf_hash(unsigned char *out, git_filebuf *file)
|
390
390
|
{
|
391
|
-
GIT_ASSERT_ARG(
|
391
|
+
GIT_ASSERT_ARG(out);
|
392
392
|
GIT_ASSERT_ARG(file);
|
393
393
|
GIT_ASSERT_ARG(file->compute_digest);
|
394
394
|
|
@@ -397,7 +397,7 @@ int git_filebuf_hash(git_oid *oid, git_filebuf *file)
|
|
397
397
|
if (verify_last_error(file) < 0)
|
398
398
|
return -1;
|
399
399
|
|
400
|
-
git_hash_final(
|
400
|
+
git_hash_final(out, &file->digest);
|
401
401
|
git_hash_ctx_cleanup(&file->digest);
|
402
402
|
file->compute_digest = 0;
|
403
403
|
|
@@ -87,7 +87,7 @@ int git_filebuf_open_withsize(git_filebuf *file, const char *path, int flags, mo
|
|
87
87
|
int git_filebuf_commit(git_filebuf *lock);
|
88
88
|
int git_filebuf_commit_at(git_filebuf *lock, const char *path);
|
89
89
|
void git_filebuf_cleanup(git_filebuf *lock);
|
90
|
-
int git_filebuf_hash(
|
90
|
+
int git_filebuf_hash(unsigned char *out, git_filebuf *file);
|
91
91
|
int git_filebuf_flush(git_filebuf *file);
|
92
92
|
int git_filebuf_stats(time_t *mtime, size_t *size, git_filebuf *file);
|
93
93
|
|