rugged 1.3.2.3 → 1.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/ext/rugged/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
|
@@ -20,11 +20,11 @@
|
|
|
20
20
|
/* what is the common non-wildcard prefix for all items in the pathspec */
|
|
21
21
|
char *git_pathspec_prefix(const git_strarray *pathspec)
|
|
22
22
|
{
|
|
23
|
-
|
|
23
|
+
git_str prefix = GIT_STR_INIT;
|
|
24
24
|
const char *scan;
|
|
25
25
|
|
|
26
26
|
if (!pathspec || !pathspec->count ||
|
|
27
|
-
|
|
27
|
+
git_str_common_prefix(&prefix, pathspec->strings, pathspec->count) < 0)
|
|
28
28
|
return NULL;
|
|
29
29
|
|
|
30
30
|
/* diff prefix will only be leading non-wildcards */
|
|
@@ -33,16 +33,16 @@ char *git_pathspec_prefix(const git_strarray *pathspec)
|
|
|
33
33
|
(scan == prefix.ptr || (*(scan - 1) != '\\')))
|
|
34
34
|
break;
|
|
35
35
|
}
|
|
36
|
-
|
|
36
|
+
git_str_truncate(&prefix, scan - prefix.ptr);
|
|
37
37
|
|
|
38
38
|
if (prefix.size <= 0) {
|
|
39
|
-
|
|
39
|
+
git_str_dispose(&prefix);
|
|
40
40
|
return NULL;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
|
|
43
|
+
git_str_unescape(&prefix);
|
|
44
44
|
|
|
45
|
-
return
|
|
45
|
+
return git_str_detach(&prefix);
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
/* is there anything in the spec that needs to be filtered on */
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
#include "common.h"
|
|
11
11
|
|
|
12
12
|
#include "git2/pathspec.h"
|
|
13
|
-
#include "
|
|
13
|
+
#include "str.h"
|
|
14
14
|
#include "vector.h"
|
|
15
15
|
#include "pool.h"
|
|
16
16
|
#include "array.h"
|
|
@@ -25,7 +25,7 @@ struct git_pathspec {
|
|
|
25
25
|
|
|
26
26
|
enum {
|
|
27
27
|
PATHSPEC_DATATYPE_STRINGS = 0,
|
|
28
|
-
PATHSPEC_DATATYPE_DIFF = 1
|
|
28
|
+
PATHSPEC_DATATYPE_DIFF = 1
|
|
29
29
|
};
|
|
30
30
|
|
|
31
31
|
typedef git_array_t(char *) git_pathspec_string_array_t;
|
data/vendor/libgit2/src/posix.c
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
#include "posix.h"
|
|
9
9
|
|
|
10
|
-
#include "
|
|
10
|
+
#include "fs_path.h"
|
|
11
11
|
#include <stdio.h>
|
|
12
12
|
#include <ctype.h>
|
|
13
13
|
|
|
@@ -144,8 +144,8 @@ int p_getcwd(char *buffer_out, size_t size)
|
|
|
144
144
|
if (cwd_buffer == NULL)
|
|
145
145
|
return -1;
|
|
146
146
|
|
|
147
|
-
|
|
148
|
-
|
|
147
|
+
git_fs_path_mkposix(buffer_out);
|
|
148
|
+
git_fs_path_string_to_dir(buffer_out, size); /* append trailing slash */
|
|
149
149
|
|
|
150
150
|
return 0;
|
|
151
151
|
}
|
data/vendor/libgit2/src/posix.h
CHANGED
data/vendor/libgit2/src/pqueue.h
CHANGED
data/vendor/libgit2/src/proxy.c
CHANGED
|
@@ -39,8 +39,11 @@ int git_proxy_options_dup(git_proxy_options *tgt, const git_proxy_options *src)
|
|
|
39
39
|
return 0;
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
void
|
|
42
|
+
void git_proxy_options_dispose(git_proxy_options *opts)
|
|
43
43
|
{
|
|
44
|
+
if (!opts)
|
|
45
|
+
return;
|
|
46
|
+
|
|
44
47
|
git__free((char *) opts->url);
|
|
45
48
|
opts->url = NULL;
|
|
46
49
|
}
|
data/vendor/libgit2/src/proxy.h
CHANGED
|
@@ -12,6 +12,6 @@
|
|
|
12
12
|
#include "git2/proxy.h"
|
|
13
13
|
|
|
14
14
|
extern int git_proxy_options_dup(git_proxy_options *tgt, const git_proxy_options *src);
|
|
15
|
-
extern void
|
|
15
|
+
extern void git_proxy_options_dispose(git_proxy_options *opts);
|
|
16
16
|
|
|
17
17
|
#endif
|
data/vendor/libgit2/src/push.c
CHANGED
|
@@ -29,19 +29,26 @@ static int push_status_ref_cmp(const void *a, const void *b)
|
|
|
29
29
|
return strcmp(push_status_a->ref, push_status_b->ref);
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
int git_push_new(git_push **out, git_remote *remote)
|
|
32
|
+
int git_push_new(git_push **out, git_remote *remote, const git_push_options *opts)
|
|
33
33
|
{
|
|
34
34
|
git_push *p;
|
|
35
35
|
|
|
36
36
|
*out = NULL;
|
|
37
37
|
|
|
38
|
+
GIT_ERROR_CHECK_VERSION(opts, GIT_PUSH_OPTIONS_VERSION, "git_push_options");
|
|
39
|
+
|
|
38
40
|
p = git__calloc(1, sizeof(*p));
|
|
39
41
|
GIT_ERROR_CHECK_ALLOC(p);
|
|
40
42
|
|
|
41
43
|
p->repo = remote->repo;
|
|
42
44
|
p->remote = remote;
|
|
43
45
|
p->report_status = 1;
|
|
44
|
-
p->pb_parallelism = 1;
|
|
46
|
+
p->pb_parallelism = opts ? opts->pb_parallelism : 1;
|
|
47
|
+
|
|
48
|
+
if (opts) {
|
|
49
|
+
GIT_ERROR_CHECK_VERSION(&opts->callbacks, GIT_REMOTE_CALLBACKS_VERSION, "git_remote_callbacks");
|
|
50
|
+
memcpy(&p->callbacks, &opts->callbacks, sizeof(git_remote_callbacks));
|
|
51
|
+
}
|
|
45
52
|
|
|
46
53
|
if (git_vector_init(&p->specs, 0, push_spec_rref_cmp) < 0) {
|
|
47
54
|
git__free(p);
|
|
@@ -65,20 +72,6 @@ int git_push_new(git_push **out, git_remote *remote)
|
|
|
65
72
|
return 0;
|
|
66
73
|
}
|
|
67
74
|
|
|
68
|
-
int git_push_set_options(git_push *push, const git_push_options *opts)
|
|
69
|
-
{
|
|
70
|
-
if (!push || !opts)
|
|
71
|
-
return -1;
|
|
72
|
-
|
|
73
|
-
GIT_ERROR_CHECK_VERSION(opts, GIT_PUSH_OPTIONS_VERSION, "git_push_options");
|
|
74
|
-
|
|
75
|
-
push->pb_parallelism = opts->pb_parallelism;
|
|
76
|
-
push->connection.custom_headers = &opts->custom_headers;
|
|
77
|
-
push->connection.proxy = &opts->proxy_opts;
|
|
78
|
-
|
|
79
|
-
return 0;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
75
|
static void free_refspec(push_spec *spec)
|
|
83
76
|
{
|
|
84
77
|
if (spec == NULL)
|
|
@@ -159,7 +152,7 @@ int git_push_add_refspec(git_push *push, const char *refspec)
|
|
|
159
152
|
|
|
160
153
|
int git_push_update_tips(git_push *push, const git_remote_callbacks *callbacks)
|
|
161
154
|
{
|
|
162
|
-
|
|
155
|
+
git_str remote_ref_name = GIT_STR_INIT;
|
|
163
156
|
size_t i, j;
|
|
164
157
|
git_refspec *fetch_spec;
|
|
165
158
|
push_spec *push_spec = NULL;
|
|
@@ -180,9 +173,9 @@ int git_push_update_tips(git_push *push, const git_remote_callbacks *callbacks)
|
|
|
180
173
|
continue;
|
|
181
174
|
|
|
182
175
|
/* Clear the buffer which can be dirty from previous iteration */
|
|
183
|
-
|
|
176
|
+
git_str_clear(&remote_ref_name);
|
|
184
177
|
|
|
185
|
-
if ((error =
|
|
178
|
+
if ((error = git_refspec__transform(&remote_ref_name, fetch_spec, status->ref)) < 0)
|
|
186
179
|
goto on_error;
|
|
187
180
|
|
|
188
181
|
/* Find matching push ref spec */
|
|
@@ -197,7 +190,7 @@ int git_push_update_tips(git_push *push, const git_remote_callbacks *callbacks)
|
|
|
197
190
|
|
|
198
191
|
/* Update the remote ref */
|
|
199
192
|
if (git_oid_is_zero(&push_spec->loid)) {
|
|
200
|
-
error = git_reference_lookup(&remote_ref, push->remote->repo,
|
|
193
|
+
error = git_reference_lookup(&remote_ref, push->remote->repo, git_str_cstr(&remote_ref_name));
|
|
201
194
|
|
|
202
195
|
if (error >= 0) {
|
|
203
196
|
error = git_reference_delete(remote_ref);
|
|
@@ -205,7 +198,7 @@ int git_push_update_tips(git_push *push, const git_remote_callbacks *callbacks)
|
|
|
205
198
|
}
|
|
206
199
|
} else {
|
|
207
200
|
error = git_reference_create(NULL, push->remote->repo,
|
|
208
|
-
|
|
201
|
+
git_str_cstr(&remote_ref_name), &push_spec->loid, 1,
|
|
209
202
|
"update by push");
|
|
210
203
|
}
|
|
211
204
|
|
|
@@ -218,7 +211,7 @@ int git_push_update_tips(git_push *push, const git_remote_callbacks *callbacks)
|
|
|
218
211
|
}
|
|
219
212
|
|
|
220
213
|
if (fire_callback && callbacks && callbacks->update_tips) {
|
|
221
|
-
error = callbacks->update_tips(
|
|
214
|
+
error = callbacks->update_tips(git_str_cstr(&remote_ref_name),
|
|
222
215
|
&push_spec->roid, &push_spec->loid, callbacks->payload);
|
|
223
216
|
|
|
224
217
|
if (error < 0)
|
|
@@ -229,7 +222,7 @@ int git_push_update_tips(git_push *push, const git_remote_callbacks *callbacks)
|
|
|
229
222
|
error = 0;
|
|
230
223
|
|
|
231
224
|
on_error:
|
|
232
|
-
|
|
225
|
+
git_str_dispose(&remote_ref_name);
|
|
233
226
|
return error;
|
|
234
227
|
}
|
|
235
228
|
|
|
@@ -291,7 +284,7 @@ static int queue_objects(git_push *push)
|
|
|
291
284
|
if (git_oid_equal(&spec->loid, &spec->roid))
|
|
292
285
|
continue; /* up-to-date */
|
|
293
286
|
|
|
294
|
-
if (git_odb_read_header(&size, &type, push->repo->_odb, &spec->loid) < 0)
|
|
287
|
+
if ((error = git_odb_read_header(&size, &type, push->repo->_odb, &spec->loid)) < 0)
|
|
295
288
|
goto on_error;
|
|
296
289
|
|
|
297
290
|
if (type == GIT_OBJECT_TAG) {
|
|
@@ -301,19 +294,19 @@ static int queue_objects(git_push *push)
|
|
|
301
294
|
goto on_error;
|
|
302
295
|
|
|
303
296
|
if (git_object_type(target) == GIT_OBJECT_COMMIT) {
|
|
304
|
-
if (git_revwalk_push(rw, git_object_id(target)) < 0) {
|
|
297
|
+
if ((error = git_revwalk_push(rw, git_object_id(target))) < 0) {
|
|
305
298
|
git_object_free(target);
|
|
306
299
|
goto on_error;
|
|
307
300
|
}
|
|
308
301
|
} else {
|
|
309
|
-
if (git_packbuilder_insert(
|
|
310
|
-
push->pb, git_object_id(target), NULL) < 0) {
|
|
302
|
+
if ((error = git_packbuilder_insert(
|
|
303
|
+
push->pb, git_object_id(target), NULL)) < 0) {
|
|
311
304
|
git_object_free(target);
|
|
312
305
|
goto on_error;
|
|
313
306
|
}
|
|
314
307
|
}
|
|
315
308
|
git_object_free(target);
|
|
316
|
-
} else if (git_revwalk_push(rw, &spec->loid) < 0)
|
|
309
|
+
} else if ((error = git_revwalk_push(rw, &spec->loid)) < 0)
|
|
317
310
|
goto on_error;
|
|
318
311
|
|
|
319
312
|
if (!spec->refspec.force) {
|
|
@@ -411,10 +404,11 @@ static int calculate_work(git_push *push)
|
|
|
411
404
|
return 0;
|
|
412
405
|
}
|
|
413
406
|
|
|
414
|
-
static int do_push(git_push *push
|
|
407
|
+
static int do_push(git_push *push)
|
|
415
408
|
{
|
|
416
409
|
int error = 0;
|
|
417
410
|
git_transport *transport = push->remote->transport;
|
|
411
|
+
git_remote_callbacks *callbacks = &push->callbacks;
|
|
418
412
|
|
|
419
413
|
if (!transport->push) {
|
|
420
414
|
git_error_set(GIT_ERROR_NET, "remote transport doesn't support push");
|
|
@@ -446,7 +440,7 @@ static int do_push(git_push *push, const git_remote_callbacks *callbacks)
|
|
|
446
440
|
goto on_error;
|
|
447
441
|
|
|
448
442
|
if ((error = queue_objects(push)) < 0 ||
|
|
449
|
-
(error = transport->push(transport, push
|
|
443
|
+
(error = transport->push(transport, push)) < 0)
|
|
450
444
|
goto on_error;
|
|
451
445
|
|
|
452
446
|
on_error:
|
|
@@ -472,16 +466,17 @@ static int filter_refs(git_remote *remote)
|
|
|
472
466
|
return 0;
|
|
473
467
|
}
|
|
474
468
|
|
|
475
|
-
int git_push_finish(git_push *push
|
|
469
|
+
int git_push_finish(git_push *push)
|
|
476
470
|
{
|
|
477
471
|
int error;
|
|
478
472
|
|
|
479
|
-
if (!git_remote_connected(push->remote)
|
|
480
|
-
|
|
481
|
-
return
|
|
473
|
+
if (!git_remote_connected(push->remote)) {
|
|
474
|
+
git_error_set(GIT_ERROR_NET, "remote is disconnected");
|
|
475
|
+
return -1;
|
|
476
|
+
}
|
|
482
477
|
|
|
483
478
|
if ((error = filter_refs(push->remote)) < 0 ||
|
|
484
|
-
(error = do_push(push
|
|
479
|
+
(error = do_push(push)) < 0)
|
|
485
480
|
return error;
|
|
486
481
|
|
|
487
482
|
if (!push->unpack_ok) {
|
data/vendor/libgit2/src/push.h
CHANGED
|
@@ -41,7 +41,7 @@ struct git_push {
|
|
|
41
41
|
|
|
42
42
|
/* options */
|
|
43
43
|
unsigned pb_parallelism;
|
|
44
|
-
|
|
44
|
+
git_remote_callbacks callbacks;
|
|
45
45
|
};
|
|
46
46
|
|
|
47
47
|
/**
|
|
@@ -56,22 +56,11 @@ void git_push_status_free(push_status *status);
|
|
|
56
56
|
*
|
|
57
57
|
* @param out New push object
|
|
58
58
|
* @param remote Remote instance
|
|
59
|
+
* @param opts Push options or NULL
|
|
59
60
|
*
|
|
60
61
|
* @return 0 or an error code
|
|
61
62
|
*/
|
|
62
|
-
int git_push_new(git_push **out, git_remote *remote);
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* Set options on a push object
|
|
66
|
-
*
|
|
67
|
-
* @param push The push object
|
|
68
|
-
* @param opts The options to set on the push object
|
|
69
|
-
*
|
|
70
|
-
* @return 0 or an error code
|
|
71
|
-
*/
|
|
72
|
-
int git_push_set_options(
|
|
73
|
-
git_push *push,
|
|
74
|
-
const git_push_options *opts);
|
|
63
|
+
int git_push_new(git_push **out, git_remote *remote, const git_push_options *opts);
|
|
75
64
|
|
|
76
65
|
/**
|
|
77
66
|
* Add a refspec to be pushed
|
|
@@ -104,11 +93,10 @@ int git_push_update_tips(git_push *push, const git_remote_callbacks *callbacks);
|
|
|
104
93
|
* order to find out which updates were accepted or rejected.
|
|
105
94
|
*
|
|
106
95
|
* @param push The push object
|
|
107
|
-
* @param callbacks the callbacks to use for this connection
|
|
108
96
|
*
|
|
109
97
|
* @return 0 or an error code
|
|
110
98
|
*/
|
|
111
|
-
int git_push_finish(git_push *push
|
|
99
|
+
int git_push_finish(git_push *push);
|
|
112
100
|
|
|
113
101
|
/**
|
|
114
102
|
* Invoke callback `cb' on each status entry
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
/* Written in 2018 by David Blackman and Sebastiano Vigna (vigna@acm.org)
|
|
2
|
+
|
|
3
|
+
To the extent possible under law, the author has dedicated all copyright
|
|
4
|
+
and related and neighboring rights to this software to the public domain
|
|
5
|
+
worldwide. This software is distributed without any warranty.
|
|
6
|
+
|
|
7
|
+
See <http://creativecommons.org/publicdomain/zero/1.0/>. */
|
|
8
|
+
|
|
9
|
+
#include "common.h"
|
|
10
|
+
#include "rand.h"
|
|
11
|
+
#include "runtime.h"
|
|
12
|
+
|
|
13
|
+
#if defined(GIT_RAND_GETENTROPY)
|
|
14
|
+
# include <sys/random.h>
|
|
15
|
+
#endif
|
|
16
|
+
|
|
17
|
+
static uint64_t state[4];
|
|
18
|
+
static git_mutex state_lock;
|
|
19
|
+
|
|
20
|
+
typedef union {
|
|
21
|
+
double f;
|
|
22
|
+
uint64_t d;
|
|
23
|
+
} bits;
|
|
24
|
+
|
|
25
|
+
#if defined(GIT_WIN32)
|
|
26
|
+
GIT_INLINE(int) getseed(uint64_t *seed)
|
|
27
|
+
{
|
|
28
|
+
HCRYPTPROV provider;
|
|
29
|
+
SYSTEMTIME systemtime;
|
|
30
|
+
FILETIME filetime, idletime, kerneltime, usertime;
|
|
31
|
+
bits convert;
|
|
32
|
+
|
|
33
|
+
if (CryptAcquireContext(&provider, 0, 0, PROV_RSA_FULL,
|
|
34
|
+
CRYPT_VERIFYCONTEXT|CRYPT_SILENT)) {
|
|
35
|
+
BOOL success = CryptGenRandom(provider, sizeof(uint64_t), (void *)seed);
|
|
36
|
+
CryptReleaseContext(provider, 0);
|
|
37
|
+
|
|
38
|
+
if (success)
|
|
39
|
+
return 0;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
GetSystemTime(&systemtime);
|
|
43
|
+
if (!SystemTimeToFileTime(&systemtime, &filetime)) {
|
|
44
|
+
git_error_set(GIT_ERROR_OS, "could not get time for random seed");
|
|
45
|
+
return -1;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/* Fall-through: generate a seed from the time and system state */
|
|
49
|
+
*seed = 0;
|
|
50
|
+
*seed |= ((uint64_t)filetime.dwLowDateTime << 32);
|
|
51
|
+
*seed |= ((uint64_t)filetime.dwHighDateTime);
|
|
52
|
+
|
|
53
|
+
GetSystemTimes(&idletime, &kerneltime, &usertime);
|
|
54
|
+
|
|
55
|
+
*seed ^= ((uint64_t)idletime.dwLowDateTime << 32);
|
|
56
|
+
*seed ^= ((uint64_t)kerneltime.dwLowDateTime);
|
|
57
|
+
*seed ^= ((uint64_t)usertime.dwLowDateTime << 32);
|
|
58
|
+
|
|
59
|
+
*seed ^= ((uint64_t)idletime.dwHighDateTime);
|
|
60
|
+
*seed ^= ((uint64_t)kerneltime.dwHighDateTime << 12);
|
|
61
|
+
*seed ^= ((uint64_t)usertime.dwHighDateTime << 24);
|
|
62
|
+
|
|
63
|
+
*seed ^= ((uint64_t)GetCurrentProcessId() << 32);
|
|
64
|
+
*seed ^= ((uint64_t)GetCurrentThreadId() << 48);
|
|
65
|
+
|
|
66
|
+
convert.f = git__timer(); *seed ^= (convert.d);
|
|
67
|
+
|
|
68
|
+
/* Mix in the addresses of some functions and variables */
|
|
69
|
+
*seed ^= (((uint64_t)((uintptr_t)seed) << 32));
|
|
70
|
+
*seed ^= (((uint64_t)((uintptr_t)&errno)));
|
|
71
|
+
|
|
72
|
+
return 0;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
#else
|
|
76
|
+
|
|
77
|
+
GIT_INLINE(int) getseed(uint64_t *seed)
|
|
78
|
+
{
|
|
79
|
+
struct timeval tv;
|
|
80
|
+
double loadavg[3];
|
|
81
|
+
bits convert;
|
|
82
|
+
int fd;
|
|
83
|
+
|
|
84
|
+
# if defined(GIT_RAND_GETENTROPY)
|
|
85
|
+
GIT_UNUSED((fd = 0));
|
|
86
|
+
|
|
87
|
+
if (getentropy(seed, sizeof(uint64_t)) == 0)
|
|
88
|
+
return 0;
|
|
89
|
+
# else
|
|
90
|
+
/*
|
|
91
|
+
* Try to read from /dev/urandom; most modern systems will have
|
|
92
|
+
* this, but we may be chrooted, etc, so it's not a fatal error
|
|
93
|
+
*/
|
|
94
|
+
if ((fd = open("/dev/urandom", O_RDONLY)) >= 0) {
|
|
95
|
+
ssize_t ret = read(fd, seed, sizeof(uint64_t));
|
|
96
|
+
close(fd);
|
|
97
|
+
|
|
98
|
+
if (ret == (ssize_t)sizeof(uint64_t))
|
|
99
|
+
return 0;
|
|
100
|
+
}
|
|
101
|
+
# endif
|
|
102
|
+
|
|
103
|
+
/* Fall-through: generate a seed from the time and system state */
|
|
104
|
+
if (gettimeofday(&tv, NULL) < 0) {
|
|
105
|
+
git_error_set(GIT_ERROR_OS, "could get time for random seed");
|
|
106
|
+
return -1;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
getloadavg(loadavg, 3);
|
|
110
|
+
|
|
111
|
+
*seed = 0;
|
|
112
|
+
*seed |= ((uint64_t)tv.tv_usec << 40);
|
|
113
|
+
*seed |= ((uint64_t)tv.tv_sec);
|
|
114
|
+
|
|
115
|
+
*seed ^= ((uint64_t)getpid() << 48);
|
|
116
|
+
*seed ^= ((uint64_t)getppid() << 32);
|
|
117
|
+
*seed ^= ((uint64_t)getpgid(0) << 28);
|
|
118
|
+
*seed ^= ((uint64_t)getsid(0) << 16);
|
|
119
|
+
*seed ^= ((uint64_t)getuid() << 8);
|
|
120
|
+
*seed ^= ((uint64_t)getgid());
|
|
121
|
+
|
|
122
|
+
convert.f = loadavg[0]; *seed ^= (convert.d >> 36);
|
|
123
|
+
convert.f = loadavg[1]; *seed ^= (convert.d);
|
|
124
|
+
convert.f = loadavg[2]; *seed ^= (convert.d >> 16);
|
|
125
|
+
|
|
126
|
+
convert.f = git__timer(); *seed ^= (convert.d);
|
|
127
|
+
|
|
128
|
+
/* Mix in the addresses of some variables */
|
|
129
|
+
*seed ^= ((uint64_t)((size_t)((void *)seed)) << 32);
|
|
130
|
+
*seed ^= ((uint64_t)((size_t)((void *)&errno)));
|
|
131
|
+
|
|
132
|
+
return 0;
|
|
133
|
+
}
|
|
134
|
+
#endif
|
|
135
|
+
|
|
136
|
+
static void git_rand_global_shutdown(void)
|
|
137
|
+
{
|
|
138
|
+
git_mutex_free(&state_lock);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
int git_rand_global_init(void)
|
|
142
|
+
{
|
|
143
|
+
uint64_t seed = 0;
|
|
144
|
+
|
|
145
|
+
if (git_mutex_init(&state_lock) < 0 || getseed(&seed) < 0)
|
|
146
|
+
return -1;
|
|
147
|
+
|
|
148
|
+
if (!seed) {
|
|
149
|
+
git_error_set(GIT_ERROR_INTERNAL, "failed to generate random seed");
|
|
150
|
+
return -1;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
git_rand_seed(seed);
|
|
154
|
+
git_runtime_shutdown_register(git_rand_global_shutdown);
|
|
155
|
+
|
|
156
|
+
return 0;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/*
|
|
160
|
+
* This is splitmix64. xoroshiro256** uses 256 bit seed; this is used
|
|
161
|
+
* to generate 256 bits of seed from the given 64, per the author's
|
|
162
|
+
* recommendation.
|
|
163
|
+
*/
|
|
164
|
+
GIT_INLINE(uint64_t) splitmix64(uint64_t *in)
|
|
165
|
+
{
|
|
166
|
+
uint64_t z;
|
|
167
|
+
|
|
168
|
+
*in += 0x9e3779b97f4a7c15;
|
|
169
|
+
|
|
170
|
+
z = *in;
|
|
171
|
+
z = (z ^ (z >> 30)) * 0xbf58476d1ce4e5b9;
|
|
172
|
+
z = (z ^ (z >> 27)) * 0x94d049bb133111eb;
|
|
173
|
+
return z ^ (z >> 31);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
void git_rand_seed(uint64_t seed)
|
|
177
|
+
{
|
|
178
|
+
uint64_t mixer;
|
|
179
|
+
|
|
180
|
+
mixer = seed;
|
|
181
|
+
|
|
182
|
+
git_mutex_lock(&state_lock);
|
|
183
|
+
state[0] = splitmix64(&mixer);
|
|
184
|
+
state[1] = splitmix64(&mixer);
|
|
185
|
+
state[2] = splitmix64(&mixer);
|
|
186
|
+
state[3] = splitmix64(&mixer);
|
|
187
|
+
git_mutex_unlock(&state_lock);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
/* This is xoshiro256** 1.0, one of our all-purpose, rock-solid
|
|
191
|
+
generators. It has excellent (sub-ns) speed, a state (256 bits) that is
|
|
192
|
+
large enough for any parallel application, and it passes all tests we
|
|
193
|
+
are aware of.
|
|
194
|
+
|
|
195
|
+
For generating just floating-point numbers, xoshiro256+ is even faster.
|
|
196
|
+
|
|
197
|
+
The state must be seeded so that it is not everywhere zero. If you have
|
|
198
|
+
a 64-bit seed, we suggest to seed a splitmix64 generator and use its
|
|
199
|
+
output to fill s. */
|
|
200
|
+
|
|
201
|
+
GIT_INLINE(uint64_t) rotl(const uint64_t x, int k) {
|
|
202
|
+
return (x << k) | (x >> (64 - k));
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
uint64_t git_rand_next(void) {
|
|
206
|
+
uint64_t t, result;
|
|
207
|
+
|
|
208
|
+
git_mutex_lock(&state_lock);
|
|
209
|
+
|
|
210
|
+
result = rotl(state[1] * 5, 7) * 9;
|
|
211
|
+
|
|
212
|
+
t = state[1] << 17;
|
|
213
|
+
|
|
214
|
+
state[2] ^= state[0];
|
|
215
|
+
state[3] ^= state[1];
|
|
216
|
+
state[1] ^= state[2];
|
|
217
|
+
state[0] ^= state[3];
|
|
218
|
+
|
|
219
|
+
state[2] ^= t;
|
|
220
|
+
|
|
221
|
+
state[3] = rotl(state[3], 45);
|
|
222
|
+
|
|
223
|
+
git_mutex_unlock(&state_lock);
|
|
224
|
+
|
|
225
|
+
return result;
|
|
226
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (C) the libgit2 contributors. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* This file is part of libgit2, distributed under the GNU GPL v2 with
|
|
5
|
+
* a Linking Exception. For full terms see the included COPYING file.
|
|
6
|
+
*/
|
|
7
|
+
#ifndef INCLUDE_rand_h__
|
|
8
|
+
#define INCLUDE_rand_h__
|
|
9
|
+
|
|
10
|
+
#include "common.h"
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Initialize the random number generation subsystem. This will
|
|
14
|
+
* seed the random number generator with the system's entropy pool,
|
|
15
|
+
* if available, and will fall back to the current time and
|
|
16
|
+
* system information if not.
|
|
17
|
+
*/
|
|
18
|
+
int git_rand_global_init(void);
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Seed the pseudo-random number generator. This is not needed to be
|
|
22
|
+
* called; the PRNG is seeded by `git_rand_global_init`, but it may
|
|
23
|
+
* be useful for testing. When the same seed is specified, the same
|
|
24
|
+
* sequence of random numbers from `git_rand_next` is emitted.
|
|
25
|
+
*
|
|
26
|
+
* @param seed the seed to use
|
|
27
|
+
*/
|
|
28
|
+
void git_rand_seed(uint64_t seed);
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Get the next pseudo-random number in the sequence.
|
|
32
|
+
*
|
|
33
|
+
* @return a 64-bit pseudo-random number
|
|
34
|
+
*/
|
|
35
|
+
uint64_t git_rand_next(void);
|
|
36
|
+
|
|
37
|
+
#endif
|
data/vendor/libgit2/src/reader.c
CHANGED
|
@@ -23,7 +23,7 @@ typedef struct {
|
|
|
23
23
|
} tree_reader;
|
|
24
24
|
|
|
25
25
|
static int tree_reader_read(
|
|
26
|
-
|
|
26
|
+
git_str *out,
|
|
27
27
|
git_oid *out_id,
|
|
28
28
|
git_filemode_t *out_filemode,
|
|
29
29
|
git_reader *_reader,
|
|
@@ -42,7 +42,7 @@ static int tree_reader_read(
|
|
|
42
42
|
blobsize = git_blob_rawsize(blob);
|
|
43
43
|
GIT_ERROR_CHECK_BLOBSIZE(blobsize);
|
|
44
44
|
|
|
45
|
-
if ((error =
|
|
45
|
+
if ((error = git_str_set(out, git_blob_rawcontent(blob), (size_t)blobsize)) < 0)
|
|
46
46
|
goto done;
|
|
47
47
|
|
|
48
48
|
if (out_id)
|
|
@@ -83,14 +83,14 @@ typedef struct {
|
|
|
83
83
|
} workdir_reader;
|
|
84
84
|
|
|
85
85
|
static int workdir_reader_read(
|
|
86
|
-
|
|
86
|
+
git_str *out,
|
|
87
87
|
git_oid *out_id,
|
|
88
88
|
git_filemode_t *out_filemode,
|
|
89
89
|
git_reader *_reader,
|
|
90
90
|
const char *filename)
|
|
91
91
|
{
|
|
92
92
|
workdir_reader *reader = (workdir_reader *)_reader;
|
|
93
|
-
|
|
93
|
+
git_str path = GIT_STR_INIT;
|
|
94
94
|
struct stat st;
|
|
95
95
|
git_filemode_t filemode;
|
|
96
96
|
git_filter_list *filters = NULL;
|
|
@@ -120,7 +120,7 @@ static int workdir_reader_read(
|
|
|
120
120
|
GIT_FILTER_TO_ODB, GIT_FILTER_DEFAULT)) < 0)
|
|
121
121
|
goto done;
|
|
122
122
|
|
|
123
|
-
if ((error =
|
|
123
|
+
if ((error = git_filter_list__apply_to_file(out,
|
|
124
124
|
filters, reader->repo, path.ptr)) < 0)
|
|
125
125
|
goto done;
|
|
126
126
|
|
|
@@ -146,7 +146,7 @@ static int workdir_reader_read(
|
|
|
146
146
|
|
|
147
147
|
done:
|
|
148
148
|
git_filter_list_free(filters);
|
|
149
|
-
|
|
149
|
+
git_str_dispose(&path);
|
|
150
150
|
return error;
|
|
151
151
|
}
|
|
152
152
|
|
|
@@ -186,7 +186,7 @@ typedef struct {
|
|
|
186
186
|
} index_reader;
|
|
187
187
|
|
|
188
188
|
static int index_reader_read(
|
|
189
|
-
|
|
189
|
+
git_str *out,
|
|
190
190
|
git_oid *out_id,
|
|
191
191
|
git_filemode_t *out_filemode,
|
|
192
192
|
git_reader *_reader,
|
|
@@ -247,7 +247,7 @@ int git_reader_for_index(
|
|
|
247
247
|
/* generic */
|
|
248
248
|
|
|
249
249
|
int git_reader_read(
|
|
250
|
-
|
|
250
|
+
git_str *out,
|
|
251
251
|
git_oid *out_id,
|
|
252
252
|
git_filemode_t *out_filemode,
|
|
253
253
|
git_reader *reader,
|
data/vendor/libgit2/src/reader.h
CHANGED
|
@@ -25,7 +25,7 @@ typedef struct git_reader git_reader;
|
|
|
25
25
|
* reader after disposing the underlying object that it reads.
|
|
26
26
|
*/
|
|
27
27
|
struct git_reader {
|
|
28
|
-
int (*read)(
|
|
28
|
+
int (*read)(git_str *out, git_oid *out_oid, git_filemode_t *mode, git_reader *reader, const char *filename);
|
|
29
29
|
};
|
|
30
30
|
|
|
31
31
|
/**
|
|
@@ -91,7 +91,7 @@ extern int git_reader_for_workdir(
|
|
|
91
91
|
* @param filename The filename to read from the reader
|
|
92
92
|
*/
|
|
93
93
|
extern int git_reader_read(
|
|
94
|
-
|
|
94
|
+
git_str *out,
|
|
95
95
|
git_oid *out_id,
|
|
96
96
|
git_filemode_t *out_filemode,
|
|
97
97
|
git_reader *reader,
|