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
|
@@ -76,18 +76,18 @@ typedef struct {
|
|
|
76
76
|
***********************************************************/
|
|
77
77
|
|
|
78
78
|
static int object_file_name(
|
|
79
|
-
|
|
79
|
+
git_str *name, const loose_backend *be, const git_oid *id)
|
|
80
80
|
{
|
|
81
81
|
size_t alloclen;
|
|
82
82
|
|
|
83
83
|
/* expand length for object root + 40 hex sha1 chars + 2 * '/' + '\0' */
|
|
84
84
|
GIT_ERROR_CHECK_ALLOC_ADD(&alloclen, be->objects_dirlen, GIT_OID_HEXSZ);
|
|
85
85
|
GIT_ERROR_CHECK_ALLOC_ADD(&alloclen, alloclen, 3);
|
|
86
|
-
if (
|
|
86
|
+
if (git_str_grow(name, alloclen) < 0)
|
|
87
87
|
return -1;
|
|
88
88
|
|
|
89
|
-
|
|
90
|
-
|
|
89
|
+
git_str_set(name, be->objects_dir, be->objects_dirlen);
|
|
90
|
+
git_fs_path_to_dir(name);
|
|
91
91
|
|
|
92
92
|
/* loose object filename: aa/aaa... (41 bytes) */
|
|
93
93
|
git_oid_pathfmt(name->ptr + name->size, id);
|
|
@@ -97,7 +97,7 @@ static int object_file_name(
|
|
|
97
97
|
return 0;
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
-
static int object_mkdir(const
|
|
100
|
+
static int object_mkdir(const git_str *name, const loose_backend *be)
|
|
101
101
|
{
|
|
102
102
|
return git_futils_mkdir_relative(
|
|
103
103
|
name->ptr + be->objects_dirlen, be->objects_dir, be->object_dir_mode,
|
|
@@ -222,9 +222,9 @@ static int is_zlib_compressed_data(unsigned char *data, size_t data_len)
|
|
|
222
222
|
* of loose object data into packs. This format is no longer used, but
|
|
223
223
|
* we must still read it.
|
|
224
224
|
*/
|
|
225
|
-
static int read_loose_packlike(git_rawobj *out,
|
|
225
|
+
static int read_loose_packlike(git_rawobj *out, git_str *obj)
|
|
226
226
|
{
|
|
227
|
-
|
|
227
|
+
git_str body = GIT_STR_INIT;
|
|
228
228
|
const unsigned char *obj_data;
|
|
229
229
|
obj_hdr hdr;
|
|
230
230
|
size_t obj_len, head_len, alloc_size;
|
|
@@ -253,7 +253,7 @@ static int read_loose_packlike(git_rawobj *out, git_buf *obj)
|
|
|
253
253
|
* allocate a buffer and inflate the data into it
|
|
254
254
|
*/
|
|
255
255
|
if (GIT_ADD_SIZET_OVERFLOW(&alloc_size, hdr.size, 1) ||
|
|
256
|
-
|
|
256
|
+
git_str_init(&body, alloc_size) < 0) {
|
|
257
257
|
error = -1;
|
|
258
258
|
goto done;
|
|
259
259
|
}
|
|
@@ -263,14 +263,14 @@ static int read_loose_packlike(git_rawobj *out, git_buf *obj)
|
|
|
263
263
|
|
|
264
264
|
out->len = hdr.size;
|
|
265
265
|
out->type = hdr.type;
|
|
266
|
-
out->data =
|
|
266
|
+
out->data = git_str_detach(&body);
|
|
267
267
|
|
|
268
268
|
done:
|
|
269
|
-
|
|
269
|
+
git_str_dispose(&body);
|
|
270
270
|
return error;
|
|
271
271
|
}
|
|
272
272
|
|
|
273
|
-
static int read_loose_standard(git_rawobj *out,
|
|
273
|
+
static int read_loose_standard(git_rawobj *out, git_str *obj)
|
|
274
274
|
{
|
|
275
275
|
git_zstream zstream = GIT_ZSTREAM_INIT;
|
|
276
276
|
unsigned char head[MAX_HEADER_LEN], *body = NULL;
|
|
@@ -279,7 +279,7 @@ static int read_loose_standard(git_rawobj *out, git_buf *obj)
|
|
|
279
279
|
int error;
|
|
280
280
|
|
|
281
281
|
if ((error = git_zstream_init(&zstream, GIT_ZSTREAM_INFLATE)) < 0 ||
|
|
282
|
-
(error = git_zstream_set_input(&zstream,
|
|
282
|
+
(error = git_zstream_set_input(&zstream, git_str_cstr(obj), git_str_len(obj))) < 0)
|
|
283
283
|
goto done;
|
|
284
284
|
|
|
285
285
|
decompressed = sizeof(head);
|
|
@@ -339,15 +339,15 @@ done:
|
|
|
339
339
|
return error;
|
|
340
340
|
}
|
|
341
341
|
|
|
342
|
-
static int read_loose(git_rawobj *out,
|
|
342
|
+
static int read_loose(git_rawobj *out, git_str *loc)
|
|
343
343
|
{
|
|
344
344
|
int error;
|
|
345
|
-
|
|
345
|
+
git_str obj = GIT_STR_INIT;
|
|
346
346
|
|
|
347
347
|
GIT_ASSERT_ARG(out);
|
|
348
348
|
GIT_ASSERT_ARG(loc);
|
|
349
349
|
|
|
350
|
-
if (
|
|
350
|
+
if (git_str_oom(loc))
|
|
351
351
|
return -1;
|
|
352
352
|
|
|
353
353
|
out->data = NULL;
|
|
@@ -363,7 +363,7 @@ static int read_loose(git_rawobj *out, git_buf *loc)
|
|
|
363
363
|
error = read_loose_standard(out, &obj);
|
|
364
364
|
|
|
365
365
|
done:
|
|
366
|
-
|
|
366
|
+
git_str_dispose(&obj);
|
|
367
367
|
return error;
|
|
368
368
|
}
|
|
369
369
|
|
|
@@ -406,7 +406,7 @@ done:
|
|
|
406
406
|
return error;
|
|
407
407
|
}
|
|
408
408
|
|
|
409
|
-
static int read_header_loose(git_rawobj *out,
|
|
409
|
+
static int read_header_loose(git_rawobj *out, git_str *loc)
|
|
410
410
|
{
|
|
411
411
|
unsigned char obj[1024];
|
|
412
412
|
ssize_t obj_len;
|
|
@@ -415,7 +415,7 @@ static int read_header_loose(git_rawobj *out, git_buf *loc)
|
|
|
415
415
|
GIT_ASSERT_ARG(out);
|
|
416
416
|
GIT_ASSERT_ARG(loc);
|
|
417
417
|
|
|
418
|
-
if (
|
|
418
|
+
if (git_str_oom(loc))
|
|
419
419
|
return -1;
|
|
420
420
|
|
|
421
421
|
out->data = NULL;
|
|
@@ -446,28 +446,28 @@ done:
|
|
|
446
446
|
}
|
|
447
447
|
|
|
448
448
|
static int locate_object(
|
|
449
|
-
|
|
449
|
+
git_str *object_location,
|
|
450
450
|
loose_backend *backend,
|
|
451
451
|
const git_oid *oid)
|
|
452
452
|
{
|
|
453
453
|
int error = object_file_name(object_location, backend, oid);
|
|
454
454
|
|
|
455
|
-
if (!error && !
|
|
455
|
+
if (!error && !git_fs_path_exists(object_location->ptr))
|
|
456
456
|
return GIT_ENOTFOUND;
|
|
457
457
|
|
|
458
458
|
return error;
|
|
459
459
|
}
|
|
460
460
|
|
|
461
461
|
/* Explore an entry of a directory and see if it matches a short oid */
|
|
462
|
-
static int fn_locate_object_short_oid(void *state,
|
|
462
|
+
static int fn_locate_object_short_oid(void *state, git_str *pathbuf) {
|
|
463
463
|
loose_locate_object_state *sstate = (loose_locate_object_state *)state;
|
|
464
464
|
|
|
465
|
-
if (
|
|
465
|
+
if (git_str_len(pathbuf) - sstate->dir_len != GIT_OID_HEXSZ - 2) {
|
|
466
466
|
/* Entry cannot be an object. Continue to next entry */
|
|
467
467
|
return 0;
|
|
468
468
|
}
|
|
469
469
|
|
|
470
|
-
if (
|
|
470
|
+
if (git_fs_path_isdir(pathbuf->ptr) == false) {
|
|
471
471
|
/* We are already in the directory matching the 2 first hex characters,
|
|
472
472
|
* compare the first ncmp characters of the oids */
|
|
473
473
|
if (!memcmp(sstate->short_oid + 2,
|
|
@@ -491,7 +491,7 @@ static int fn_locate_object_short_oid(void *state, git_buf *pathbuf) {
|
|
|
491
491
|
|
|
492
492
|
/* Locate an object matching a given short oid */
|
|
493
493
|
static int locate_object_short_oid(
|
|
494
|
-
|
|
494
|
+
git_str *object_location,
|
|
495
495
|
git_oid *res_oid,
|
|
496
496
|
loose_backend *backend,
|
|
497
497
|
const git_oid *short_oid,
|
|
@@ -505,34 +505,34 @@ static int locate_object_short_oid(
|
|
|
505
505
|
/* prealloc memory for OBJ_DIR/xx/xx..38x..xx */
|
|
506
506
|
GIT_ERROR_CHECK_ALLOC_ADD(&alloc_len, dir_len, GIT_OID_HEXSZ);
|
|
507
507
|
GIT_ERROR_CHECK_ALLOC_ADD(&alloc_len, alloc_len, 3);
|
|
508
|
-
if (
|
|
508
|
+
if (git_str_grow(object_location, alloc_len) < 0)
|
|
509
509
|
return -1;
|
|
510
510
|
|
|
511
|
-
|
|
512
|
-
|
|
511
|
+
git_str_set(object_location, objects_dir, dir_len);
|
|
512
|
+
git_fs_path_to_dir(object_location);
|
|
513
513
|
|
|
514
514
|
/* save adjusted position at end of dir so it can be restored later */
|
|
515
|
-
dir_len =
|
|
515
|
+
dir_len = git_str_len(object_location);
|
|
516
516
|
|
|
517
517
|
/* Convert raw oid to hex formatted oid */
|
|
518
518
|
git_oid_fmt((char *)state.short_oid, short_oid);
|
|
519
519
|
|
|
520
520
|
/* Explore OBJ_DIR/xx/ where xx is the beginning of hex formatted short oid */
|
|
521
|
-
if (
|
|
521
|
+
if (git_str_put(object_location, (char *)state.short_oid, 3) < 0)
|
|
522
522
|
return -1;
|
|
523
523
|
object_location->ptr[object_location->size - 1] = '/';
|
|
524
524
|
|
|
525
525
|
/* Check that directory exists */
|
|
526
|
-
if (
|
|
526
|
+
if (git_fs_path_isdir(object_location->ptr) == false)
|
|
527
527
|
return git_odb__error_notfound("no matching loose object for prefix",
|
|
528
528
|
short_oid, len);
|
|
529
529
|
|
|
530
|
-
state.dir_len =
|
|
530
|
+
state.dir_len = git_str_len(object_location);
|
|
531
531
|
state.short_oid_len = len;
|
|
532
532
|
state.found = 0;
|
|
533
533
|
|
|
534
534
|
/* Explore directory to find a unique object matching short_oid */
|
|
535
|
-
error =
|
|
535
|
+
error = git_fs_path_direach(
|
|
536
536
|
object_location, 0, fn_locate_object_short_oid, &state);
|
|
537
537
|
if (error < 0 && error != GIT_EAMBIGUOUS)
|
|
538
538
|
return error;
|
|
@@ -553,8 +553,8 @@ static int locate_object_short_oid(
|
|
|
553
553
|
GIT_ERROR_CHECK_ALLOC_ADD(&alloc_len, dir_len, GIT_OID_HEXSZ);
|
|
554
554
|
GIT_ERROR_CHECK_ALLOC_ADD(&alloc_len, alloc_len, 2);
|
|
555
555
|
|
|
556
|
-
|
|
557
|
-
if (
|
|
556
|
+
git_str_truncate(object_location, dir_len);
|
|
557
|
+
if (git_str_grow(object_location, alloc_len) < 0)
|
|
558
558
|
return -1;
|
|
559
559
|
|
|
560
560
|
git_oid_pathfmt(object_location->ptr + dir_len, res_oid);
|
|
@@ -583,7 +583,7 @@ static int locate_object_short_oid(
|
|
|
583
583
|
|
|
584
584
|
static int loose_backend__read_header(size_t *len_p, git_object_t *type_p, git_odb_backend *backend, const git_oid *oid)
|
|
585
585
|
{
|
|
586
|
-
|
|
586
|
+
git_str object_path = GIT_STR_INIT;
|
|
587
587
|
git_rawobj raw;
|
|
588
588
|
int error;
|
|
589
589
|
|
|
@@ -601,14 +601,14 @@ static int loose_backend__read_header(size_t *len_p, git_object_t *type_p, git_o
|
|
|
601
601
|
*type_p = raw.type;
|
|
602
602
|
}
|
|
603
603
|
|
|
604
|
-
|
|
604
|
+
git_str_dispose(&object_path);
|
|
605
605
|
|
|
606
606
|
return error;
|
|
607
607
|
}
|
|
608
608
|
|
|
609
609
|
static int loose_backend__read(void **buffer_p, size_t *len_p, git_object_t *type_p, git_odb_backend *backend, const git_oid *oid)
|
|
610
610
|
{
|
|
611
|
-
|
|
611
|
+
git_str object_path = GIT_STR_INIT;
|
|
612
612
|
git_rawobj raw;
|
|
613
613
|
int error = 0;
|
|
614
614
|
|
|
@@ -624,7 +624,7 @@ static int loose_backend__read(void **buffer_p, size_t *len_p, git_object_t *typ
|
|
|
624
624
|
*type_p = raw.type;
|
|
625
625
|
}
|
|
626
626
|
|
|
627
|
-
|
|
627
|
+
git_str_dispose(&object_path);
|
|
628
628
|
|
|
629
629
|
return error;
|
|
630
630
|
}
|
|
@@ -648,7 +648,7 @@ static int loose_backend__read_prefix(
|
|
|
648
648
|
if (!error)
|
|
649
649
|
git_oid_cpy(out_oid, short_oid);
|
|
650
650
|
} else {
|
|
651
|
-
|
|
651
|
+
git_str object_path = GIT_STR_INIT;
|
|
652
652
|
git_rawobj raw;
|
|
653
653
|
|
|
654
654
|
GIT_ASSERT_ARG(backend && short_oid);
|
|
@@ -662,7 +662,7 @@ static int loose_backend__read_prefix(
|
|
|
662
662
|
*type_p = raw.type;
|
|
663
663
|
}
|
|
664
664
|
|
|
665
|
-
|
|
665
|
+
git_str_dispose(&object_path);
|
|
666
666
|
}
|
|
667
667
|
|
|
668
668
|
return error;
|
|
@@ -670,7 +670,7 @@ static int loose_backend__read_prefix(
|
|
|
670
670
|
|
|
671
671
|
static int loose_backend__exists(git_odb_backend *backend, const git_oid *oid)
|
|
672
672
|
{
|
|
673
|
-
|
|
673
|
+
git_str object_path = GIT_STR_INIT;
|
|
674
674
|
int error;
|
|
675
675
|
|
|
676
676
|
GIT_ASSERT_ARG(backend);
|
|
@@ -678,7 +678,7 @@ static int loose_backend__exists(git_odb_backend *backend, const git_oid *oid)
|
|
|
678
678
|
|
|
679
679
|
error = locate_object(&object_path, (loose_backend *)backend, oid);
|
|
680
680
|
|
|
681
|
-
|
|
681
|
+
git_str_dispose(&object_path);
|
|
682
682
|
|
|
683
683
|
return !error;
|
|
684
684
|
}
|
|
@@ -686,7 +686,7 @@ static int loose_backend__exists(git_odb_backend *backend, const git_oid *oid)
|
|
|
686
686
|
static int loose_backend__exists_prefix(
|
|
687
687
|
git_oid *out, git_odb_backend *backend, const git_oid *short_id, size_t len)
|
|
688
688
|
{
|
|
689
|
-
|
|
689
|
+
git_str object_path = GIT_STR_INIT;
|
|
690
690
|
int error;
|
|
691
691
|
|
|
692
692
|
GIT_ASSERT_ARG(backend);
|
|
@@ -697,7 +697,7 @@ static int loose_backend__exists_prefix(
|
|
|
697
697
|
error = locate_object_short_oid(
|
|
698
698
|
&object_path, out, (loose_backend *)backend, short_id, len);
|
|
699
699
|
|
|
700
|
-
|
|
700
|
+
git_str_dispose(&object_path);
|
|
701
701
|
|
|
702
702
|
return error;
|
|
703
703
|
}
|
|
@@ -736,7 +736,7 @@ GIT_INLINE(int) filename_to_oid(git_oid *oid, const char *ptr)
|
|
|
736
736
|
return 0;
|
|
737
737
|
}
|
|
738
738
|
|
|
739
|
-
static int foreach_object_dir_cb(void *_state,
|
|
739
|
+
static int foreach_object_dir_cb(void *_state, git_str *path)
|
|
740
740
|
{
|
|
741
741
|
git_oid oid;
|
|
742
742
|
struct foreach_state *state = (struct foreach_state *) _state;
|
|
@@ -748,22 +748,22 @@ static int foreach_object_dir_cb(void *_state, git_buf *path)
|
|
|
748
748
|
state->cb(&oid, state->data), "git_odb_foreach");
|
|
749
749
|
}
|
|
750
750
|
|
|
751
|
-
static int foreach_cb(void *_state,
|
|
751
|
+
static int foreach_cb(void *_state, git_str *path)
|
|
752
752
|
{
|
|
753
753
|
struct foreach_state *state = (struct foreach_state *) _state;
|
|
754
754
|
|
|
755
755
|
/* non-dir is some stray file, ignore it */
|
|
756
|
-
if (!
|
|
756
|
+
if (!git_fs_path_isdir(git_str_cstr(path)))
|
|
757
757
|
return 0;
|
|
758
758
|
|
|
759
|
-
return
|
|
759
|
+
return git_fs_path_direach(path, 0, foreach_object_dir_cb, state);
|
|
760
760
|
}
|
|
761
761
|
|
|
762
762
|
static int loose_backend__foreach(git_odb_backend *_backend, git_odb_foreach_cb cb, void *data)
|
|
763
763
|
{
|
|
764
764
|
char *objects_dir;
|
|
765
765
|
int error;
|
|
766
|
-
|
|
766
|
+
git_str buf = GIT_STR_INIT;
|
|
767
767
|
struct foreach_state state;
|
|
768
768
|
loose_backend *backend = (loose_backend *) _backend;
|
|
769
769
|
|
|
@@ -772,19 +772,19 @@ static int loose_backend__foreach(git_odb_backend *_backend, git_odb_foreach_cb
|
|
|
772
772
|
|
|
773
773
|
objects_dir = backend->objects_dir;
|
|
774
774
|
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
if (
|
|
775
|
+
git_str_sets(&buf, objects_dir);
|
|
776
|
+
git_fs_path_to_dir(&buf);
|
|
777
|
+
if (git_str_oom(&buf))
|
|
778
778
|
return -1;
|
|
779
779
|
|
|
780
780
|
memset(&state, 0, sizeof(state));
|
|
781
781
|
state.cb = cb;
|
|
782
782
|
state.data = data;
|
|
783
|
-
state.dir_len =
|
|
783
|
+
state.dir_len = git_str_len(&buf);
|
|
784
784
|
|
|
785
|
-
error =
|
|
785
|
+
error = git_fs_path_direach(&buf, 0, foreach_cb, &state);
|
|
786
786
|
|
|
787
|
-
|
|
787
|
+
git_str_dispose(&buf);
|
|
788
788
|
|
|
789
789
|
return error;
|
|
790
790
|
}
|
|
@@ -793,7 +793,7 @@ static int loose_backend__writestream_finalize(git_odb_stream *_stream, const gi
|
|
|
793
793
|
{
|
|
794
794
|
loose_writestream *stream = (loose_writestream *)_stream;
|
|
795
795
|
loose_backend *backend = (loose_backend *)_stream->backend;
|
|
796
|
-
|
|
796
|
+
git_str final_path = GIT_STR_INIT;
|
|
797
797
|
int error = 0;
|
|
798
798
|
|
|
799
799
|
if (object_file_name(&final_path, backend, oid) < 0 ||
|
|
@@ -803,7 +803,7 @@ static int loose_backend__writestream_finalize(git_odb_stream *_stream, const gi
|
|
|
803
803
|
error = git_filebuf_commit_at(
|
|
804
804
|
&stream->fbuf, final_path.ptr);
|
|
805
805
|
|
|
806
|
-
|
|
806
|
+
git_str_dispose(&final_path);
|
|
807
807
|
|
|
808
808
|
return error;
|
|
809
809
|
}
|
|
@@ -838,7 +838,7 @@ static int loose_backend__writestream(git_odb_stream **stream_out, git_odb_backe
|
|
|
838
838
|
loose_backend *backend;
|
|
839
839
|
loose_writestream *stream = NULL;
|
|
840
840
|
char hdr[MAX_HEADER_LEN];
|
|
841
|
-
|
|
841
|
+
git_str tmp_path = GIT_STR_INIT;
|
|
842
842
|
size_t hdrlen;
|
|
843
843
|
int error;
|
|
844
844
|
|
|
@@ -861,7 +861,7 @@ static int loose_backend__writestream(git_odb_stream **stream_out, git_odb_backe
|
|
|
861
861
|
stream->stream.free = &loose_backend__writestream_free;
|
|
862
862
|
stream->stream.mode = GIT_STREAM_WRONLY;
|
|
863
863
|
|
|
864
|
-
if (
|
|
864
|
+
if (git_str_joinpath(&tmp_path, backend->objects_dir, "tmp_object") < 0 ||
|
|
865
865
|
git_filebuf_open(&stream->fbuf, tmp_path.ptr, filebuf_flags(backend),
|
|
866
866
|
backend->object_file_mode) < 0 ||
|
|
867
867
|
stream->stream.write((git_odb_stream *)stream, hdr, hdrlen) < 0)
|
|
@@ -870,7 +870,7 @@ static int loose_backend__writestream(git_odb_stream **stream_out, git_odb_backe
|
|
|
870
870
|
git__free(stream);
|
|
871
871
|
stream = NULL;
|
|
872
872
|
}
|
|
873
|
-
|
|
873
|
+
git_str_dispose(&tmp_path);
|
|
874
874
|
*stream_out = (git_odb_stream *)stream;
|
|
875
875
|
|
|
876
876
|
return !stream ? -1 : 0;
|
|
@@ -996,7 +996,7 @@ static int loose_backend__readstream(
|
|
|
996
996
|
loose_backend *backend;
|
|
997
997
|
loose_readstream *stream = NULL;
|
|
998
998
|
git_hash_ctx *hash_ctx = NULL;
|
|
999
|
-
|
|
999
|
+
git_str object_path = GIT_STR_INIT;
|
|
1000
1000
|
obj_hdr hdr;
|
|
1001
1001
|
int error = 0;
|
|
1002
1002
|
|
|
@@ -1023,7 +1023,7 @@ static int loose_backend__readstream(
|
|
|
1023
1023
|
hash_ctx = git__malloc(sizeof(git_hash_ctx));
|
|
1024
1024
|
GIT_ERROR_CHECK_ALLOC(hash_ctx);
|
|
1025
1025
|
|
|
1026
|
-
if ((error = git_hash_ctx_init(hash_ctx)) < 0 ||
|
|
1026
|
+
if ((error = git_hash_ctx_init(hash_ctx, GIT_HASH_ALGORITHM_SHA1)) < 0 ||
|
|
1027
1027
|
(error = git_futils_mmap_ro_file(&stream->map, object_path.ptr)) < 0 ||
|
|
1028
1028
|
(error = git_zstream_init(&stream->zstream, GIT_ZSTREAM_INFLATE)) < 0)
|
|
1029
1029
|
goto done;
|
|
@@ -1059,14 +1059,14 @@ done:
|
|
|
1059
1059
|
}
|
|
1060
1060
|
}
|
|
1061
1061
|
|
|
1062
|
-
|
|
1062
|
+
git_str_dispose(&object_path);
|
|
1063
1063
|
return error;
|
|
1064
1064
|
}
|
|
1065
1065
|
|
|
1066
1066
|
static int loose_backend__write(git_odb_backend *_backend, const git_oid *oid, const void *data, size_t len, git_object_t type)
|
|
1067
1067
|
{
|
|
1068
1068
|
int error = 0;
|
|
1069
|
-
|
|
1069
|
+
git_str final_path = GIT_STR_INIT;
|
|
1070
1070
|
char header[MAX_HEADER_LEN];
|
|
1071
1071
|
size_t header_len;
|
|
1072
1072
|
git_filebuf fbuf = GIT_FILEBUF_INIT;
|
|
@@ -1079,7 +1079,7 @@ static int loose_backend__write(git_odb_backend *_backend, const git_oid *oid, c
|
|
|
1079
1079
|
header, sizeof(header), len, type)) < 0)
|
|
1080
1080
|
goto cleanup;
|
|
1081
1081
|
|
|
1082
|
-
if (
|
|
1082
|
+
if (git_str_joinpath(&final_path, backend->objects_dir, "tmp_object") < 0 ||
|
|
1083
1083
|
git_filebuf_open(&fbuf, final_path.ptr, filebuf_flags(backend),
|
|
1084
1084
|
backend->object_file_mode) < 0)
|
|
1085
1085
|
{
|
|
@@ -1098,7 +1098,7 @@ static int loose_backend__write(git_odb_backend *_backend, const git_oid *oid, c
|
|
|
1098
1098
|
cleanup:
|
|
1099
1099
|
if (error < 0)
|
|
1100
1100
|
git_filebuf_cleanup(&fbuf);
|
|
1101
|
-
|
|
1101
|
+
git_str_dispose(&final_path);
|
|
1102
1102
|
return error;
|
|
1103
1103
|
}
|
|
1104
1104
|
|
|
@@ -1107,14 +1107,14 @@ static int loose_backend__freshen(
|
|
|
1107
1107
|
const git_oid *oid)
|
|
1108
1108
|
{
|
|
1109
1109
|
loose_backend *backend = (loose_backend *)_backend;
|
|
1110
|
-
|
|
1110
|
+
git_str path = GIT_STR_INIT;
|
|
1111
1111
|
int error;
|
|
1112
1112
|
|
|
1113
1113
|
if (object_file_name(&path, backend, oid) < 0)
|
|
1114
1114
|
return -1;
|
|
1115
1115
|
|
|
1116
1116
|
error = git_futils_touch(path.ptr, NULL);
|
|
1117
|
-
|
|
1117
|
+
git_str_dispose(&path);
|
|
1118
1118
|
|
|
1119
1119
|
return error;
|
|
1120
1120
|
}
|
|
@@ -7,18 +7,20 @@
|
|
|
7
7
|
|
|
8
8
|
#include "common.h"
|
|
9
9
|
|
|
10
|
-
#include "
|
|
11
|
-
#include "git2/sys/odb_backend.h"
|
|
12
|
-
#include "git2/sys/mempack.h"
|
|
10
|
+
#include "buf.h"
|
|
13
11
|
#include "futils.h"
|
|
14
12
|
#include "hash.h"
|
|
15
13
|
#include "odb.h"
|
|
16
14
|
#include "array.h"
|
|
17
15
|
#include "oidmap.h"
|
|
16
|
+
#include "pack-objects.h"
|
|
18
17
|
|
|
19
18
|
#include "git2/odb_backend.h"
|
|
19
|
+
#include "git2/object.h"
|
|
20
20
|
#include "git2/types.h"
|
|
21
21
|
#include "git2/pack.h"
|
|
22
|
+
#include "git2/sys/odb_backend.h"
|
|
23
|
+
#include "git2/sys/mempack.h"
|
|
22
24
|
|
|
23
25
|
struct memobject {
|
|
24
26
|
git_oid oid;
|
|
@@ -100,7 +102,10 @@ static int impl__read_header(size_t *len_p, git_object_t *type_p, git_odb_backen
|
|
|
100
102
|
return 0;
|
|
101
103
|
}
|
|
102
104
|
|
|
103
|
-
int
|
|
105
|
+
static int git_mempack__dump(
|
|
106
|
+
git_str *pack,
|
|
107
|
+
git_repository *repo,
|
|
108
|
+
git_odb_backend *_backend)
|
|
104
109
|
{
|
|
105
110
|
struct memory_packer_db *db = (struct memory_packer_db *)_backend;
|
|
106
111
|
git_packbuilder *packbuilder;
|
|
@@ -120,13 +125,21 @@ int git_mempack_dump(git_buf *pack, git_repository *repo, git_odb_backend *_back
|
|
|
120
125
|
goto cleanup;
|
|
121
126
|
}
|
|
122
127
|
|
|
123
|
-
err =
|
|
128
|
+
err = git_packbuilder__write_buf(pack, packbuilder);
|
|
124
129
|
|
|
125
130
|
cleanup:
|
|
126
131
|
git_packbuilder_free(packbuilder);
|
|
127
132
|
return err;
|
|
128
133
|
}
|
|
129
134
|
|
|
135
|
+
int git_mempack_dump(
|
|
136
|
+
git_buf *pack,
|
|
137
|
+
git_repository *repo,
|
|
138
|
+
git_odb_backend *_backend)
|
|
139
|
+
{
|
|
140
|
+
GIT_BUF_WRAP_PRIVATE(pack, git_mempack__dump, repo, _backend);
|
|
141
|
+
}
|
|
142
|
+
|
|
130
143
|
int git_mempack_reset(git_odb_backend *_backend)
|
|
131
144
|
{
|
|
132
145
|
struct memory_packer_db *db = (struct memory_packer_db *)_backend;
|