rugged 1.5.0.1 → 1.7.1
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 +2 -2
- data/ext/rugged/rugged_allocator.c +0 -54
- data/ext/rugged/rugged_blame.c +2 -0
- data/ext/rugged/rugged_blob.c +3 -0
- data/ext/rugged/rugged_commit.c +1 -0
- data/ext/rugged/rugged_config.c +2 -0
- data/ext/rugged/rugged_diff.c +1 -0
- data/ext/rugged/rugged_index.c +2 -0
- data/ext/rugged/rugged_patch.c +1 -0
- data/ext/rugged/rugged_rebase.c +1 -0
- data/ext/rugged/rugged_reference.c +1 -0
- data/ext/rugged/rugged_remote.c +1 -0
- data/ext/rugged/rugged_repo.c +5 -2
- data/ext/rugged/rugged_revwalk.c +5 -1
- data/ext/rugged/rugged_submodule.c +1 -0
- data/ext/rugged/rugged_tag.c +1 -0
- data/ext/rugged/rugged_tree.c +4 -0
- data/lib/rugged/index.rb +1 -1
- data/lib/rugged/tree.rb +1 -1
- data/lib/rugged/version.rb +1 -1
- data/vendor/libgit2/CMakeLists.txt +7 -8
- data/vendor/libgit2/COPYING +30 -0
- data/vendor/libgit2/cmake/CheckPrototypeDefinitionSafe.cmake +16 -0
- data/vendor/libgit2/cmake/ExperimentalFeatures.cmake +23 -0
- data/vendor/libgit2/cmake/SelectGSSAPI.cmake +3 -3
- data/vendor/libgit2/cmake/SelectHTTPSBackend.cmake +21 -2
- data/vendor/libgit2/cmake/SelectHashes.cmake +4 -0
- data/vendor/libgit2/cmake/SelectXdiff.cmake +9 -0
- data/vendor/libgit2/deps/ntlmclient/CMakeLists.txt +2 -0
- data/vendor/libgit2/deps/pcre/LICENCE +5 -5
- data/vendor/libgit2/deps/pcre/pcre.h +2 -2
- data/vendor/libgit2/deps/pcre/pcre_compile.c +6 -3
- data/vendor/libgit2/deps/pcre/pcre_exec.c +2 -2
- data/vendor/libgit2/deps/xdiff/CMakeLists.txt +28 -0
- data/vendor/libgit2/{src/libgit2 → deps}/xdiff/git-xdiff.h +4 -1
- data/vendor/libgit2/{src/libgit2 → deps}/xdiff/xdiffi.c +19 -18
- data/vendor/libgit2/{src/libgit2 → deps}/xdiff/xdiffi.h +2 -4
- data/vendor/libgit2/{src/libgit2 → deps}/xdiff/xemit.c +3 -3
- data/vendor/libgit2/{src/libgit2 → deps}/xdiff/xhistogram.c +7 -18
- data/vendor/libgit2/{src/libgit2 → deps}/xdiff/xmacros.h +18 -1
- data/vendor/libgit2/{src/libgit2 → deps}/xdiff/xmerge.c +24 -22
- data/vendor/libgit2/{src/libgit2 → deps}/xdiff/xpatience.c +21 -30
- data/vendor/libgit2/{src/libgit2 → deps}/xdiff/xprepare.c +13 -30
- data/vendor/libgit2/{src/libgit2 → deps}/xdiff/xutils.c +18 -1
- data/vendor/libgit2/{src/libgit2 → deps}/xdiff/xutils.h +2 -1
- data/vendor/libgit2/include/git2/common.h +38 -6
- data/vendor/libgit2/include/git2/deprecated.h +6 -0
- data/vendor/libgit2/include/git2/diff.h +42 -4
- data/vendor/libgit2/include/git2/errors.h +4 -2
- data/vendor/libgit2/include/git2/experimental.h +20 -0
- data/vendor/libgit2/include/git2/index.h +9 -0
- data/vendor/libgit2/include/git2/indexer.h +29 -0
- data/vendor/libgit2/include/git2/object.h +28 -2
- data/vendor/libgit2/include/git2/odb.h +58 -7
- data/vendor/libgit2/include/git2/odb_backend.h +106 -18
- data/vendor/libgit2/include/git2/oid.h +116 -16
- data/vendor/libgit2/include/git2/remote.h +18 -0
- data/vendor/libgit2/include/git2/repository.h +32 -3
- data/vendor/libgit2/include/git2/stash.h +60 -6
- data/vendor/libgit2/include/git2/strarray.h +0 -13
- data/vendor/libgit2/include/git2/sys/alloc.h +0 -34
- data/vendor/libgit2/include/git2/sys/commit_graph.h +12 -2
- data/vendor/libgit2/include/git2/sys/midx.h +5 -1
- data/vendor/libgit2/include/git2/sys/odb_backend.h +1 -1
- data/vendor/libgit2/include/git2/sys/stream.h +16 -2
- data/vendor/libgit2/include/git2/sys/transport.h +32 -2
- data/vendor/libgit2/include/git2/version.h +4 -4
- data/vendor/libgit2/include/git2/worktree.h +3 -1
- data/vendor/libgit2/include/git2.h +1 -0
- data/vendor/libgit2/src/CMakeLists.txt +34 -17
- data/vendor/libgit2/src/cli/CMakeLists.txt +5 -2
- data/vendor/libgit2/src/cli/cmd_clone.c +22 -6
- data/vendor/libgit2/src/cli/cmd_hash_object.c +27 -8
- data/vendor/libgit2/src/cli/opt.c +1 -1
- data/vendor/libgit2/src/cli/progress.c +9 -8
- data/vendor/libgit2/src/cli/progress.h +4 -4
- data/vendor/libgit2/src/libgit2/CMakeLists.txt +25 -34
- data/vendor/libgit2/src/libgit2/annotated_commit.c +2 -2
- data/vendor/libgit2/src/libgit2/annotated_commit.h +1 -1
- data/vendor/libgit2/src/libgit2/apply.c +4 -3
- data/vendor/libgit2/src/libgit2/attr_file.c +1 -1
- data/vendor/libgit2/src/libgit2/attrcache.c +1 -1
- data/vendor/libgit2/src/libgit2/blame.c +23 -14
- data/vendor/libgit2/src/libgit2/blame_git.c +0 -1
- data/vendor/libgit2/src/libgit2/blob.c +4 -2
- data/vendor/libgit2/src/libgit2/blob.h +2 -2
- data/vendor/libgit2/src/libgit2/branch.c +2 -2
- data/vendor/libgit2/src/libgit2/cherrypick.c +3 -3
- data/vendor/libgit2/src/libgit2/clone.c +34 -3
- data/vendor/libgit2/src/libgit2/commit.c +78 -21
- data/vendor/libgit2/src/libgit2/commit.h +25 -7
- data/vendor/libgit2/src/libgit2/commit_graph.c +129 -47
- data/vendor/libgit2/src/libgit2/commit_graph.h +23 -4
- data/vendor/libgit2/src/libgit2/commit_list.c +16 -5
- data/vendor/libgit2/src/libgit2/commit_list.h +1 -0
- data/vendor/libgit2/src/libgit2/config.c +6 -3
- data/vendor/libgit2/src/libgit2/config_file.c +16 -10
- data/vendor/libgit2/src/libgit2/describe.c +11 -8
- data/vendor/libgit2/src/libgit2/diff.c +19 -6
- data/vendor/libgit2/src/libgit2/diff.h +6 -6
- data/vendor/libgit2/src/libgit2/diff_file.c +16 -7
- data/vendor/libgit2/src/libgit2/diff_generate.c +37 -11
- data/vendor/libgit2/src/libgit2/diff_parse.c +20 -4
- data/vendor/libgit2/src/libgit2/diff_print.c +26 -7
- data/vendor/libgit2/src/libgit2/diff_tform.c +4 -0
- data/vendor/libgit2/src/libgit2/diff_xdiff.h +1 -1
- data/vendor/libgit2/src/libgit2/email.c +4 -3
- data/vendor/libgit2/src/libgit2/errors.c +73 -18
- data/vendor/libgit2/src/libgit2/experimental.h.in +13 -0
- data/vendor/libgit2/src/libgit2/fetch.c +38 -13
- data/vendor/libgit2/src/libgit2/fetch.h +0 -2
- data/vendor/libgit2/src/libgit2/fetchhead.c +11 -9
- data/vendor/libgit2/src/libgit2/grafts.c +272 -0
- data/vendor/libgit2/src/libgit2/grafts.h +36 -0
- data/vendor/libgit2/src/libgit2/ident.c +3 -3
- data/vendor/libgit2/src/libgit2/index.c +327 -123
- data/vendor/libgit2/src/libgit2/index.h +14 -1
- data/vendor/libgit2/src/libgit2/indexer.c +116 -46
- data/vendor/libgit2/src/libgit2/iterator.c +21 -4
- data/vendor/libgit2/src/libgit2/iterator.h +3 -0
- data/vendor/libgit2/src/libgit2/libgit2.c +58 -0
- data/vendor/libgit2/src/libgit2/merge.c +14 -9
- data/vendor/libgit2/src/libgit2/merge_file.c +0 -2
- data/vendor/libgit2/src/libgit2/midx.c +68 -38
- data/vendor/libgit2/src/libgit2/midx.h +13 -3
- data/vendor/libgit2/src/libgit2/mwindow.c +5 -2
- data/vendor/libgit2/src/libgit2/mwindow.h +4 -1
- data/vendor/libgit2/src/libgit2/notes.c +9 -8
- data/vendor/libgit2/src/libgit2/object.c +118 -29
- data/vendor/libgit2/src/libgit2/object.h +17 -2
- data/vendor/libgit2/src/libgit2/odb.c +224 -55
- data/vendor/libgit2/src/libgit2/odb.h +43 -4
- data/vendor/libgit2/src/libgit2/odb_loose.c +128 -70
- data/vendor/libgit2/src/libgit2/odb_pack.c +111 -46
- data/vendor/libgit2/src/libgit2/oid.c +141 -77
- data/vendor/libgit2/src/libgit2/oid.h +183 -9
- data/vendor/libgit2/src/libgit2/oidarray.c +49 -3
- data/vendor/libgit2/src/libgit2/oidarray.h +5 -1
- data/vendor/libgit2/src/libgit2/pack-objects.c +31 -13
- data/vendor/libgit2/src/libgit2/pack-objects.h +5 -2
- data/vendor/libgit2/src/libgit2/pack.c +93 -70
- data/vendor/libgit2/src/libgit2/pack.h +29 -15
- data/vendor/libgit2/src/libgit2/parse.c +8 -4
- data/vendor/libgit2/src/libgit2/parse.h +1 -1
- data/vendor/libgit2/src/libgit2/patch.h +7 -1
- data/vendor/libgit2/src/libgit2/patch_generate.c +24 -5
- data/vendor/libgit2/src/libgit2/patch_parse.c +16 -8
- data/vendor/libgit2/src/libgit2/push.c +13 -3
- data/vendor/libgit2/src/libgit2/reader.c +1 -1
- data/vendor/libgit2/src/libgit2/rebase.c +72 -83
- data/vendor/libgit2/src/libgit2/refdb_fs.c +92 -52
- data/vendor/libgit2/src/libgit2/reflog.c +7 -5
- data/vendor/libgit2/src/libgit2/reflog.h +1 -2
- data/vendor/libgit2/src/libgit2/refs.c +9 -0
- data/vendor/libgit2/src/libgit2/remote.c +47 -37
- data/vendor/libgit2/src/libgit2/remote.h +41 -0
- data/vendor/libgit2/src/libgit2/repository.c +784 -329
- data/vendor/libgit2/src/libgit2/repository.h +26 -2
- data/vendor/libgit2/src/libgit2/reset.c +2 -2
- data/vendor/libgit2/src/libgit2/revert.c +8 -11
- data/vendor/libgit2/src/libgit2/revparse.c +23 -7
- data/vendor/libgit2/src/libgit2/revwalk.c +31 -5
- data/vendor/libgit2/src/libgit2/stash.c +209 -33
- data/vendor/libgit2/src/libgit2/strarray.c +1 -0
- data/vendor/libgit2/src/libgit2/strarray.h +25 -0
- data/vendor/libgit2/src/libgit2/streams/mbedtls.c +0 -1
- data/vendor/libgit2/src/libgit2/streams/openssl.c +9 -17
- data/vendor/libgit2/src/libgit2/streams/openssl_dynamic.c +7 -3
- data/vendor/libgit2/src/libgit2/streams/schannel.c +715 -0
- data/vendor/libgit2/src/libgit2/streams/schannel.h +28 -0
- data/vendor/libgit2/src/libgit2/streams/socket.c +240 -51
- data/vendor/libgit2/src/libgit2/streams/socket.h +3 -1
- data/vendor/libgit2/src/libgit2/streams/stransport.c +40 -12
- data/vendor/libgit2/src/libgit2/streams/tls.c +5 -0
- data/vendor/libgit2/src/libgit2/submodule.c +6 -2
- data/vendor/libgit2/src/libgit2/submodule.h +3 -3
- data/vendor/libgit2/src/libgit2/sysdir.c +294 -7
- data/vendor/libgit2/src/libgit2/sysdir.h +41 -9
- data/vendor/libgit2/src/libgit2/tag.c +29 -10
- data/vendor/libgit2/src/libgit2/tag.h +2 -2
- data/vendor/libgit2/src/libgit2/threadstate.c +15 -2
- data/vendor/libgit2/src/libgit2/threadstate.h +1 -3
- data/vendor/libgit2/src/libgit2/transports/auth.h +1 -2
- data/vendor/libgit2/src/libgit2/transports/{auth_negotiate.c → auth_gssapi.c} +32 -32
- data/vendor/libgit2/src/libgit2/transports/auth_negotiate.h +1 -1
- data/vendor/libgit2/src/libgit2/transports/auth_ntlm.h +1 -1
- data/vendor/libgit2/src/libgit2/transports/{auth_ntlm.c → auth_ntlmclient.c} +12 -12
- data/vendor/libgit2/src/libgit2/transports/auth_sspi.c +341 -0
- data/vendor/libgit2/src/libgit2/transports/git.c +7 -8
- data/vendor/libgit2/src/libgit2/transports/http.c +15 -9
- data/vendor/libgit2/src/libgit2/transports/httpclient.c +14 -0
- data/vendor/libgit2/src/libgit2/transports/httpclient.h +10 -0
- data/vendor/libgit2/src/libgit2/transports/local.c +27 -4
- data/vendor/libgit2/src/libgit2/transports/smart.c +68 -27
- data/vendor/libgit2/src/libgit2/transports/smart.h +33 -9
- data/vendor/libgit2/src/libgit2/transports/smart_pkt.c +281 -49
- data/vendor/libgit2/src/libgit2/transports/smart_protocol.c +192 -55
- data/vendor/libgit2/src/libgit2/transports/ssh.c +334 -102
- data/vendor/libgit2/src/libgit2/transports/winhttp.c +22 -18
- data/vendor/libgit2/src/libgit2/tree-cache.c +26 -16
- data/vendor/libgit2/src/libgit2/tree-cache.h +5 -3
- data/vendor/libgit2/src/libgit2/tree.c +23 -17
- data/vendor/libgit2/src/libgit2/tree.h +2 -2
- data/vendor/libgit2/src/libgit2/worktree.c +30 -10
- data/vendor/libgit2/src/util/CMakeLists.txt +6 -1
- data/vendor/libgit2/src/util/alloc.c +65 -6
- data/vendor/libgit2/src/util/alloc.h +34 -9
- data/vendor/libgit2/src/util/allocators/failalloc.c +0 -60
- data/vendor/libgit2/src/util/allocators/failalloc.h +0 -6
- data/vendor/libgit2/src/util/allocators/stdalloc.c +2 -105
- data/vendor/libgit2/src/util/allocators/win32_leakcheck.c +0 -68
- data/vendor/libgit2/src/util/array.h +6 -1
- data/vendor/libgit2/src/util/cc-compat.h +2 -0
- data/vendor/libgit2/src/util/filebuf.c +6 -1
- data/vendor/libgit2/src/util/filebuf.h +19 -6
- data/vendor/libgit2/src/util/fs_path.c +2 -2
- data/vendor/libgit2/src/util/futils.c +8 -8
- data/vendor/libgit2/src/{features.h.in → util/git2_features.h.in} +9 -3
- data/vendor/libgit2/src/util/git2_util.h +2 -2
- data/vendor/libgit2/src/util/hash/openssl.c +4 -3
- data/vendor/libgit2/src/util/hash/rfc6234/sha.h +0 -112
- data/vendor/libgit2/src/util/hash.h +13 -0
- data/vendor/libgit2/src/util/net.c +492 -87
- data/vendor/libgit2/src/util/net.h +32 -0
- data/vendor/libgit2/src/util/posix.c +54 -0
- data/vendor/libgit2/src/util/posix.h +24 -0
- data/vendor/libgit2/src/util/rand.c +10 -4
- data/vendor/libgit2/src/util/regexp.c +3 -3
- data/vendor/libgit2/src/util/staticstr.h +66 -0
- data/vendor/libgit2/src/util/thread.h +20 -19
- data/vendor/libgit2/src/util/util.c +15 -10
- data/vendor/libgit2/src/util/util.h +25 -16
- data/vendor/libgit2/src/util/win32/error.c +1 -1
- data/vendor/libgit2/src/util/win32/path_w32.c +8 -8
- data/vendor/libgit2/src/util/win32/posix_w32.c +1 -1
- data/vendor/libgit2/src/util/win32/utf-conv.c +73 -75
- data/vendor/libgit2/src/util/win32/utf-conv.h +81 -14
- data/vendor/libgit2/src/util/win32/w32_util.c +1 -1
- metadata +34 -26
- data/vendor/libgit2/cmake/SelectWinHTTP.cmake +0 -17
- data/vendor/libgit2/src/libgit2/netops.c +0 -124
- data/vendor/libgit2/src/libgit2/netops.h +0 -68
- data/vendor/libgit2/src/util/win32/findfile.c +0 -286
- data/vendor/libgit2/src/util/win32/findfile.h +0 -22
- /data/vendor/libgit2/{src/libgit2 → deps}/xdiff/xdiff.h +0 -0
- /data/vendor/libgit2/{src/libgit2 → deps}/xdiff/xemit.h +0 -0
- /data/vendor/libgit2/{src/libgit2 → deps}/xdiff/xinclude.h +0 -0
- /data/vendor/libgit2/{src/libgit2 → deps}/xdiff/xprepare.h +0 -0
- /data/vendor/libgit2/{src/libgit2 → deps}/xdiff/xtypes.h +0 -0
@@ -11,7 +11,6 @@
|
|
11
11
|
|
12
12
|
#include "http_parser.h"
|
13
13
|
#include "net.h"
|
14
|
-
#include "netops.h"
|
15
14
|
#include "remote.h"
|
16
15
|
#include "smart.h"
|
17
16
|
#include "auth.h"
|
@@ -336,9 +335,15 @@ static int lookup_proxy(
|
|
336
335
|
}
|
337
336
|
|
338
337
|
if (!proxy ||
|
339
|
-
(error =
|
338
|
+
(error = git_net_url_parse_http(&transport->proxy.url, proxy)) < 0)
|
340
339
|
goto done;
|
341
340
|
|
341
|
+
if (!git_net_url_valid(&transport->proxy.url)) {
|
342
|
+
git_error_set(GIT_ERROR_HTTP, "invalid URL: '%s'", proxy);
|
343
|
+
error = -1;
|
344
|
+
goto done;
|
345
|
+
}
|
346
|
+
|
342
347
|
*out_use = true;
|
343
348
|
|
344
349
|
done:
|
@@ -655,6 +660,7 @@ static int http_action(
|
|
655
660
|
{
|
656
661
|
http_subtransport *transport = GIT_CONTAINER_OF(t, http_subtransport, parent);
|
657
662
|
git_remote_connect_options *connect_opts = &transport->owner->connect_opts;
|
663
|
+
git_http_client_options opts = {0};
|
658
664
|
http_stream *stream;
|
659
665
|
const http_service *service;
|
660
666
|
int error;
|
@@ -683,14 +689,14 @@ static int http_action(
|
|
683
689
|
stream = git__calloc(sizeof(http_stream), 1);
|
684
690
|
GIT_ERROR_CHECK_ALLOC(stream);
|
685
691
|
|
686
|
-
|
687
|
-
|
688
|
-
|
689
|
-
|
690
|
-
opts.server_certificate_check_payload = connect_opts->callbacks.payload;
|
691
|
-
opts.proxy_certificate_check_cb = connect_opts->proxy_opts.certificate_check;
|
692
|
-
opts.proxy_certificate_check_payload = connect_opts->proxy_opts.payload;
|
692
|
+
opts.server_certificate_check_cb = connect_opts->callbacks.certificate_check;
|
693
|
+
opts.server_certificate_check_payload = connect_opts->callbacks.payload;
|
694
|
+
opts.proxy_certificate_check_cb = connect_opts->proxy_opts.certificate_check;
|
695
|
+
opts.proxy_certificate_check_payload = connect_opts->proxy_opts.payload;
|
693
696
|
|
697
|
+
if (transport->http_client) {
|
698
|
+
git_http_client_set_options(transport->http_client, &opts);
|
699
|
+
} else {
|
694
700
|
if (git_http_client_new(&transport->http_client, &opts) < 0)
|
695
701
|
return -1;
|
696
702
|
}
|
@@ -837,6 +837,11 @@ GIT_INLINE(int) server_setup_from_url(
|
|
837
837
|
git_http_server *server,
|
838
838
|
git_net_url *url)
|
839
839
|
{
|
840
|
+
GIT_ASSERT_ARG(url);
|
841
|
+
GIT_ASSERT_ARG(url->scheme);
|
842
|
+
GIT_ASSERT_ARG(url->host);
|
843
|
+
GIT_ASSERT_ARG(url->port);
|
844
|
+
|
840
845
|
if (!server->url.scheme || strcmp(server->url.scheme, url->scheme) ||
|
841
846
|
!server->url.host || strcmp(server->url.host, url->host) ||
|
842
847
|
!server->url.port || strcmp(server->url.port, url->port)) {
|
@@ -1541,6 +1546,15 @@ int git_http_client_new(
|
|
1541
1546
|
return 0;
|
1542
1547
|
}
|
1543
1548
|
|
1549
|
+
/* Update the options of an existing httpclient instance. */
|
1550
|
+
void git_http_client_set_options(
|
1551
|
+
git_http_client *client,
|
1552
|
+
git_http_client_options *opts)
|
1553
|
+
{
|
1554
|
+
if (opts)
|
1555
|
+
memcpy(&client->opts, opts, sizeof(git_http_client_options));
|
1556
|
+
}
|
1557
|
+
|
1544
1558
|
GIT_INLINE(void) http_server_close(git_http_server *server)
|
1545
1559
|
{
|
1546
1560
|
if (server->stream) {
|
@@ -88,6 +88,16 @@ extern int git_http_client_new(
|
|
88
88
|
git_http_client **out,
|
89
89
|
git_http_client_options *opts);
|
90
90
|
|
91
|
+
/**
|
92
|
+
* Update the options of an existing httpclient instance.
|
93
|
+
*
|
94
|
+
* @param client the httpclient instance to modify
|
95
|
+
* @param opts new options or NULL to keep existing options
|
96
|
+
*/
|
97
|
+
extern void git_http_client_set_options(
|
98
|
+
git_http_client *client,
|
99
|
+
git_http_client_options *opts);
|
100
|
+
|
91
101
|
/*
|
92
102
|
* Sends a request to the host specified by the request URL. If the
|
93
103
|
* method is POST, either the content_length or the chunked flag must
|
@@ -266,6 +266,17 @@ static int local_capabilities(unsigned int *capabilities, git_transport *transpo
|
|
266
266
|
return 0;
|
267
267
|
}
|
268
268
|
|
269
|
+
#ifdef GIT_EXPERIMENTAL_SHA256
|
270
|
+
static int local_oid_type(git_oid_t *out, git_transport *transport)
|
271
|
+
{
|
272
|
+
transport_local *t = (transport_local *)transport;
|
273
|
+
|
274
|
+
*out = t->repo->oid_type;
|
275
|
+
|
276
|
+
return 0;
|
277
|
+
}
|
278
|
+
#endif
|
279
|
+
|
269
280
|
static int local_ls(const git_remote_head ***out, size_t *size, git_transport *transport)
|
270
281
|
{
|
271
282
|
transport_local *t = (transport_local *)transport;
|
@@ -284,15 +295,13 @@ static int local_ls(const git_remote_head ***out, size_t *size, git_transport *t
|
|
284
295
|
static int local_negotiate_fetch(
|
285
296
|
git_transport *transport,
|
286
297
|
git_repository *repo,
|
287
|
-
const
|
288
|
-
size_t count)
|
298
|
+
const git_fetch_negotiation *wants)
|
289
299
|
{
|
290
300
|
transport_local *t = (transport_local*)transport;
|
291
301
|
git_remote_head *rhead;
|
292
302
|
unsigned int i;
|
293
303
|
|
294
|
-
GIT_UNUSED(
|
295
|
-
GIT_UNUSED(count);
|
304
|
+
GIT_UNUSED(wants);
|
296
305
|
|
297
306
|
/* Fill in the loids */
|
298
307
|
git_vector_foreach(&t->refs, i, rhead) {
|
@@ -311,6 +320,16 @@ static int local_negotiate_fetch(
|
|
311
320
|
return 0;
|
312
321
|
}
|
313
322
|
|
323
|
+
static int local_shallow_roots(
|
324
|
+
git_oidarray *out,
|
325
|
+
git_transport *transport)
|
326
|
+
{
|
327
|
+
GIT_UNUSED(out);
|
328
|
+
GIT_UNUSED(transport);
|
329
|
+
|
330
|
+
return 0;
|
331
|
+
}
|
332
|
+
|
314
333
|
static int local_push_update_remote_ref(
|
315
334
|
git_repository *remote_repo,
|
316
335
|
const char *lref,
|
@@ -732,7 +751,11 @@ int git_transport_local(git_transport **out, git_remote *owner, void *param)
|
|
732
751
|
t->parent.connect = local_connect;
|
733
752
|
t->parent.set_connect_opts = local_set_connect_opts;
|
734
753
|
t->parent.capabilities = local_capabilities;
|
754
|
+
#ifdef GIT_EXPERIMENTAL_SHA256
|
755
|
+
t->parent.oid_type = local_oid_type;
|
756
|
+
#endif
|
735
757
|
t->parent.negotiate_fetch = local_negotiate_fetch;
|
758
|
+
t->parent.shallow_roots = local_shallow_roots;
|
736
759
|
t->parent.download_pack = local_download_pack;
|
737
760
|
t->parent.push = local_push;
|
738
761
|
t->parent.close = local_close;
|
@@ -13,30 +13,42 @@
|
|
13
13
|
#include "refspec.h"
|
14
14
|
#include "proxy.h"
|
15
15
|
|
16
|
-
|
16
|
+
int git_smart__recv(transport_smart *t)
|
17
17
|
{
|
18
|
-
|
19
|
-
|
20
|
-
int error;
|
18
|
+
size_t bytes_read;
|
19
|
+
int ret;
|
21
20
|
|
21
|
+
GIT_ASSERT_ARG(t);
|
22
22
|
GIT_ASSERT(t->current_stream);
|
23
23
|
|
24
|
-
|
24
|
+
if (git_staticstr_remain(&t->buffer) == 0) {
|
25
|
+
git_error_set(GIT_ERROR_NET, "out of buffer space");
|
26
|
+
return -1;
|
27
|
+
}
|
25
28
|
|
26
|
-
|
27
|
-
|
29
|
+
ret = t->current_stream->read(t->current_stream,
|
30
|
+
git_staticstr_offset(&t->buffer),
|
31
|
+
git_staticstr_remain(&t->buffer),
|
32
|
+
&bytes_read);
|
28
33
|
|
29
|
-
|
34
|
+
if (ret < 0)
|
35
|
+
return ret;
|
36
|
+
|
37
|
+
GIT_ASSERT(bytes_read <= INT_MAX);
|
38
|
+
GIT_ASSERT(bytes_read <= git_staticstr_remain(&t->buffer));
|
39
|
+
|
40
|
+
git_staticstr_increase(&t->buffer, bytes_read);
|
30
41
|
|
31
42
|
if (t->packetsize_cb && !t->cancelled.val) {
|
32
|
-
|
33
|
-
|
43
|
+
ret = t->packetsize_cb(bytes_read, t->packetsize_payload);
|
44
|
+
|
45
|
+
if (ret) {
|
34
46
|
git_atomic32_set(&t->cancelled, 1);
|
35
47
|
return GIT_EUSER;
|
36
48
|
}
|
37
49
|
}
|
38
50
|
|
39
|
-
return (int)
|
51
|
+
return (int)bytes_read;
|
40
52
|
}
|
41
53
|
|
42
54
|
GIT_INLINE(int) git_smart__reset_stream(transport_smart *t, bool close_subtransport)
|
@@ -54,6 +66,12 @@ GIT_INLINE(int) git_smart__reset_stream(transport_smart *t, bool close_subtransp
|
|
54
66
|
return -1;
|
55
67
|
}
|
56
68
|
|
69
|
+
git__free(t->caps.object_format);
|
70
|
+
t->caps.object_format = NULL;
|
71
|
+
|
72
|
+
git__free(t->caps.agent);
|
73
|
+
t->caps.agent = NULL;
|
74
|
+
|
57
75
|
return 0;
|
58
76
|
}
|
59
77
|
|
@@ -149,8 +167,6 @@ static int git_smart__connect(
|
|
149
167
|
/* Save off the current stream (i.e. socket) that we are working with */
|
150
168
|
t->current_stream = stream;
|
151
169
|
|
152
|
-
gitno_buffer_setup_callback(&t->buffer, t->buffer_data, sizeof(t->buffer_data), git_smart__recv_cb, t);
|
153
|
-
|
154
170
|
/* 2 flushes for RPC; 1 for stateful */
|
155
171
|
if ((error = git_smart__store_refs(t, t->rpc ? 2 : 1)) < 0)
|
156
172
|
return error;
|
@@ -242,6 +258,30 @@ static int git_smart__capabilities(unsigned int *capabilities, git_transport *tr
|
|
242
258
|
return 0;
|
243
259
|
}
|
244
260
|
|
261
|
+
#ifdef GIT_EXPERIMENTAL_SHA256
|
262
|
+
static int git_smart__oid_type(git_oid_t *out, git_transport *transport)
|
263
|
+
{
|
264
|
+
transport_smart *t = GIT_CONTAINER_OF(transport, transport_smart, parent);
|
265
|
+
|
266
|
+
*out = 0;
|
267
|
+
|
268
|
+
if (t->caps.object_format == NULL) {
|
269
|
+
*out = GIT_OID_DEFAULT;
|
270
|
+
} else {
|
271
|
+
*out = git_oid_type_fromstr(t->caps.object_format);
|
272
|
+
|
273
|
+
if (!*out) {
|
274
|
+
git_error_set(GIT_ERROR_INVALID,
|
275
|
+
"unknown object format '%s'",
|
276
|
+
t->caps.object_format);
|
277
|
+
return -1;
|
278
|
+
}
|
279
|
+
}
|
280
|
+
|
281
|
+
return 0;
|
282
|
+
}
|
283
|
+
#endif
|
284
|
+
|
245
285
|
static int git_smart__ls(const git_remote_head ***out, size_t *size, git_transport *transport)
|
246
286
|
{
|
247
287
|
transport_smart *t = GIT_CONTAINER_OF(transport, transport_smart, parent);
|
@@ -283,8 +323,6 @@ int git_smart__negotiation_step(git_transport *transport, void *data, size_t len
|
|
283
323
|
if ((error = stream->write(stream, (const char *)data, len)) < 0)
|
284
324
|
return error;
|
285
325
|
|
286
|
-
gitno_buffer_setup_callback(&t->buffer, t->buffer_data, sizeof(t->buffer_data), git_smart__recv_cb, t);
|
287
|
-
|
288
326
|
return 0;
|
289
327
|
}
|
290
328
|
|
@@ -309,8 +347,6 @@ int git_smart__get_push_stream(transport_smart *t, git_smart_subtransport_stream
|
|
309
347
|
/* Save off the current stream (i.e. socket) that we are working with */
|
310
348
|
t->current_stream = *stream;
|
311
349
|
|
312
|
-
gitno_buffer_setup_callback(&t->buffer, t->buffer_data, sizeof(t->buffer_data), git_smart__recv_cb, t);
|
313
|
-
|
314
350
|
return 0;
|
315
351
|
}
|
316
352
|
|
@@ -386,6 +422,10 @@ static void git_smart__free(git_transport *transport)
|
|
386
422
|
|
387
423
|
git_remote_connect_options_dispose(&t->connect_opts);
|
388
424
|
|
425
|
+
git_array_dispose(t->shallow_roots);
|
426
|
+
|
427
|
+
git__free(t->caps.object_format);
|
428
|
+
git__free(t->caps.agent);
|
389
429
|
git__free(t);
|
390
430
|
}
|
391
431
|
|
@@ -452,9 +492,13 @@ int git_transport_smart(git_transport **out, git_remote *owner, void *param)
|
|
452
492
|
t->parent.connect = git_smart__connect;
|
453
493
|
t->parent.set_connect_opts = git_smart__set_connect_opts;
|
454
494
|
t->parent.capabilities = git_smart__capabilities;
|
495
|
+
#ifdef GIT_EXPERIMENTAL_SHA256
|
496
|
+
t->parent.oid_type = git_smart__oid_type;
|
497
|
+
#endif
|
455
498
|
t->parent.close = git_smart__close;
|
456
499
|
t->parent.free = git_smart__free;
|
457
500
|
t->parent.negotiate_fetch = git_smart__negotiate_fetch;
|
501
|
+
t->parent.shallow_roots = git_smart__shallow_roots;
|
458
502
|
t->parent.download_pack = git_smart__download_pack;
|
459
503
|
t->parent.push = git_smart__push;
|
460
504
|
t->parent.ls = git_smart__ls;
|
@@ -464,20 +508,17 @@ int git_transport_smart(git_transport **out, git_remote *owner, void *param)
|
|
464
508
|
t->owner = owner;
|
465
509
|
t->rpc = definition->rpc;
|
466
510
|
|
467
|
-
if (git_vector_init(&t->refs, 16, ref_name_cmp) < 0
|
468
|
-
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
|
511
|
+
if (git_vector_init(&t->refs, 16, ref_name_cmp) < 0 ||
|
512
|
+
git_vector_init(&t->heads, 16, ref_name_cmp) < 0 ||
|
513
|
+
definition->callback(&t->wrapped, &t->parent, definition->param) < 0) {
|
514
|
+
git_vector_free(&t->refs);
|
515
|
+
git_vector_free(&t->heads);
|
516
|
+
t->wrapped->free(t->wrapped);
|
473
517
|
git__free(t);
|
474
518
|
return -1;
|
475
519
|
}
|
476
520
|
|
477
|
-
|
478
|
-
git__free(t);
|
479
|
-
return -1;
|
480
|
-
}
|
521
|
+
git_staticstr_init(&t->buffer, GIT_SMART_BUFFER_SIZE);
|
481
522
|
|
482
523
|
*out = (git_transport *) t;
|
483
524
|
return 0;
|
@@ -11,11 +11,14 @@
|
|
11
11
|
|
12
12
|
#include "git2.h"
|
13
13
|
#include "vector.h"
|
14
|
-
#include "netops.h"
|
15
14
|
#include "push.h"
|
16
15
|
#include "str.h"
|
16
|
+
#include "oidarray.h"
|
17
|
+
#include "staticstr.h"
|
17
18
|
#include "git2/sys/transport.h"
|
18
19
|
|
20
|
+
#define GIT_SMART_BUFFER_SIZE 65536
|
21
|
+
|
19
22
|
#define GIT_SIDE_BAND_DATA 1
|
20
23
|
#define GIT_SIDE_BAND_PROGRESS 2
|
21
24
|
#define GIT_SIDE_BAND_ERROR 3
|
@@ -32,6 +35,9 @@
|
|
32
35
|
#define GIT_CAP_SYMREF "symref"
|
33
36
|
#define GIT_CAP_WANT_TIP_SHA1 "allow-tip-sha1-in-want"
|
34
37
|
#define GIT_CAP_WANT_REACHABLE_SHA1 "allow-reachable-sha1-in-want"
|
38
|
+
#define GIT_CAP_SHALLOW "shallow"
|
39
|
+
#define GIT_CAP_OBJECT_FORMAT "object-format="
|
40
|
+
#define GIT_CAP_AGENT "agent="
|
35
41
|
|
36
42
|
extern bool git_smart__ofs_delta_enabled;
|
37
43
|
|
@@ -48,7 +54,9 @@ typedef enum {
|
|
48
54
|
GIT_PKT_PROGRESS,
|
49
55
|
GIT_PKT_OK,
|
50
56
|
GIT_PKT_NG,
|
51
|
-
GIT_PKT_UNPACK
|
57
|
+
GIT_PKT_UNPACK,
|
58
|
+
GIT_PKT_SHALLOW,
|
59
|
+
GIT_PKT_UNSHALLOW
|
52
60
|
} git_pkt_type;
|
53
61
|
|
54
62
|
/* Used for multi_ack and multi_ack_detailed */
|
@@ -120,6 +128,11 @@ typedef struct {
|
|
120
128
|
int unpack_ok;
|
121
129
|
} git_pkt_unpack;
|
122
130
|
|
131
|
+
typedef struct {
|
132
|
+
git_pkt_type type;
|
133
|
+
git_oid oid;
|
134
|
+
} git_pkt_shallow;
|
135
|
+
|
123
136
|
typedef struct transport_smart_caps {
|
124
137
|
unsigned int common:1,
|
125
138
|
ofs_delta:1,
|
@@ -132,7 +145,10 @@ typedef struct transport_smart_caps {
|
|
132
145
|
report_status:1,
|
133
146
|
thin_pack:1,
|
134
147
|
want_tip_sha1:1,
|
135
|
-
want_reachable_sha1:1
|
148
|
+
want_reachable_sha1:1,
|
149
|
+
shallow:1;
|
150
|
+
char *object_format;
|
151
|
+
char *agent;
|
136
152
|
} transport_smart_caps;
|
137
153
|
|
138
154
|
typedef int (*packetsize_cb)(size_t received, void *payload);
|
@@ -149,14 +165,14 @@ typedef struct {
|
|
149
165
|
git_vector refs;
|
150
166
|
git_vector heads;
|
151
167
|
git_vector common;
|
168
|
+
git_array_oid_t shallow_roots;
|
152
169
|
git_atomic32 cancelled;
|
153
170
|
packetsize_cb packetsize_cb;
|
154
171
|
void *packetsize_payload;
|
155
172
|
unsigned rpc : 1,
|
156
173
|
have_refs : 1,
|
157
174
|
connected : 1;
|
158
|
-
|
159
|
-
char buffer_data[65536];
|
175
|
+
git_staticstr_with_size(GIT_SMART_BUFFER_SIZE) buffer;
|
160
176
|
} transport_smart;
|
161
177
|
|
162
178
|
/* smart_protocol.c */
|
@@ -167,8 +183,9 @@ int git_smart__push(git_transport *transport, git_push *push);
|
|
167
183
|
int git_smart__negotiate_fetch(
|
168
184
|
git_transport *transport,
|
169
185
|
git_repository *repo,
|
170
|
-
const
|
171
|
-
|
186
|
+
const git_fetch_negotiation *wants);
|
187
|
+
|
188
|
+
int git_smart__shallow_roots(git_oidarray *out, git_transport *transport);
|
172
189
|
|
173
190
|
int git_smart__download_pack(
|
174
191
|
git_transport *transport,
|
@@ -176,17 +193,24 @@ int git_smart__download_pack(
|
|
176
193
|
git_indexer_progress *stats);
|
177
194
|
|
178
195
|
/* smart.c */
|
196
|
+
int git_smart__recv(transport_smart *t);
|
197
|
+
|
179
198
|
int git_smart__negotiation_step(git_transport *transport, void *data, size_t len);
|
180
199
|
int git_smart__get_push_stream(transport_smart *t, git_smart_subtransport_stream **out);
|
181
200
|
|
182
201
|
int git_smart__update_heads(transport_smart *t, git_vector *symrefs);
|
183
202
|
|
184
203
|
/* smart_pkt.c */
|
185
|
-
|
204
|
+
typedef struct {
|
205
|
+
git_oid_t oid_type;
|
206
|
+
int seen_capabilities: 1;
|
207
|
+
} git_pkt_parse_data;
|
208
|
+
|
209
|
+
int git_pkt_parse_line(git_pkt **head, const char **endptr, const char *line, size_t linelen, git_pkt_parse_data *data);
|
186
210
|
int git_pkt_buffer_flush(git_str *buf);
|
187
211
|
int git_pkt_send_flush(GIT_SOCKET s);
|
188
212
|
int git_pkt_buffer_done(git_str *buf);
|
189
|
-
int git_pkt_buffer_wants(const
|
213
|
+
int git_pkt_buffer_wants(const git_fetch_negotiation *wants, transport_smart_caps *caps, git_str *buf);
|
190
214
|
int git_pkt_buffer_have(git_oid *oid, git_str *buf);
|
191
215
|
void git_pkt_free(git_pkt *pkt);
|
192
216
|
|