rugged 0.27.10.1 → 0.28.0
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 +23 -2
- data/ext/rugged/rugged.c +48 -2
- data/ext/rugged/rugged.h +5 -0
- data/ext/rugged/rugged_allocator.c +89 -0
- data/ext/rugged/rugged_blob.c +3 -3
- data/ext/rugged/rugged_branch.c +1 -1
- data/ext/rugged/rugged_commit.c +8 -8
- data/ext/rugged/rugged_config.c +1 -1
- data/ext/rugged/rugged_diff.c +24 -4
- data/ext/rugged/rugged_note.c +1 -1
- data/ext/rugged/rugged_repo.c +10 -10
- data/ext/rugged/rugged_settings.c +1 -1
- data/lib/rugged/version.rb +1 -1
- data/vendor/libgit2/CMakeLists.txt +69 -47
- data/vendor/libgit2/cmake/Modules/AddCFlagIfSupported.cmake +15 -1
- data/vendor/libgit2/cmake/Modules/EnableWarnings.cmake +5 -8
- data/vendor/libgit2/cmake/Modules/FindmbedTLS.cmake +93 -0
- data/vendor/libgit2/deps/http-parser/CMakeLists.txt +2 -0
- data/vendor/libgit2/deps/http-parser/{LICENSE-MIT → COPYING} +0 -0
- data/vendor/libgit2/deps/regex/COPYING +502 -0
- data/vendor/libgit2/deps/winhttp/COPYING.GPL +993 -0
- data/vendor/libgit2/deps/winhttp/COPYING.LGPL +502 -0
- data/vendor/libgit2/deps/zlib/CMakeLists.txt +1 -0
- data/vendor/libgit2/deps/zlib/COPYING +27 -0
- data/vendor/libgit2/include/git2.h +3 -0
- data/vendor/libgit2/include/git2/annotated_commit.h +9 -0
- data/vendor/libgit2/include/git2/apply.h +129 -0
- data/vendor/libgit2/include/git2/attr.h +19 -8
- data/vendor/libgit2/include/git2/blame.h +41 -24
- data/vendor/libgit2/include/git2/blob.h +1 -1
- data/vendor/libgit2/include/git2/branch.h +1 -1
- data/vendor/libgit2/include/git2/buffer.h +2 -2
- data/vendor/libgit2/include/git2/checkout.h +20 -19
- data/vendor/libgit2/include/git2/cherrypick.h +6 -4
- data/vendor/libgit2/include/git2/clone.h +11 -9
- data/vendor/libgit2/include/git2/commit.h +30 -2
- data/vendor/libgit2/include/git2/common.h +54 -4
- data/vendor/libgit2/include/git2/config.h +18 -7
- data/vendor/libgit2/include/git2/deprecated.h +253 -0
- data/vendor/libgit2/include/git2/describe.h +30 -7
- data/vendor/libgit2/include/git2/diff.h +193 -143
- data/vendor/libgit2/include/git2/errors.h +54 -46
- data/vendor/libgit2/include/git2/ignore.h +2 -2
- data/vendor/libgit2/include/git2/index.h +72 -51
- data/vendor/libgit2/include/git2/indexer.h +30 -4
- data/vendor/libgit2/include/git2/mailmap.h +115 -0
- data/vendor/libgit2/include/git2/merge.h +29 -8
- data/vendor/libgit2/include/git2/net.h +1 -1
- data/vendor/libgit2/include/git2/notes.h +1 -1
- data/vendor/libgit2/include/git2/object.h +16 -16
- data/vendor/libgit2/include/git2/odb.h +10 -10
- data/vendor/libgit2/include/git2/odb_backend.h +7 -7
- data/vendor/libgit2/include/git2/oid.h +1 -1
- data/vendor/libgit2/include/git2/pack.h +2 -2
- data/vendor/libgit2/include/git2/proxy.h +9 -5
- data/vendor/libgit2/include/git2/rebase.h +7 -4
- data/vendor/libgit2/include/git2/refs.h +14 -15
- data/vendor/libgit2/include/git2/refspec.h +17 -0
- data/vendor/libgit2/include/git2/remote.h +92 -16
- data/vendor/libgit2/include/git2/repository.h +52 -37
- data/vendor/libgit2/include/git2/revert.h +5 -3
- data/vendor/libgit2/include/git2/revwalk.h +7 -7
- data/vendor/libgit2/include/git2/signature.h +2 -2
- data/vendor/libgit2/include/git2/stash.h +13 -10
- data/vendor/libgit2/include/git2/status.h +8 -4
- data/vendor/libgit2/include/git2/submodule.h +11 -10
- data/vendor/libgit2/include/git2/sys/alloc.h +101 -0
- data/vendor/libgit2/include/git2/sys/commit.h +1 -1
- data/vendor/libgit2/include/git2/sys/config.h +13 -13
- data/vendor/libgit2/include/git2/sys/filter.h +6 -6
- data/vendor/libgit2/include/git2/sys/index.h +3 -0
- data/vendor/libgit2/include/git2/sys/mempack.h +35 -35
- data/vendor/libgit2/include/git2/sys/merge.h +9 -4
- data/vendor/libgit2/include/git2/sys/odb_backend.h +19 -19
- data/vendor/libgit2/include/git2/sys/path.h +64 -0
- data/vendor/libgit2/include/git2/sys/refdb_backend.h +19 -19
- data/vendor/libgit2/include/git2/sys/stream.h +92 -12
- data/vendor/libgit2/include/git2/sys/transport.h +127 -81
- data/vendor/libgit2/include/git2/tag.h +2 -2
- data/vendor/libgit2/include/git2/trace.h +1 -1
- data/vendor/libgit2/include/git2/transaction.h +1 -0
- data/vendor/libgit2/include/git2/transport.h +47 -18
- data/vendor/libgit2/include/git2/tree.h +3 -3
- data/vendor/libgit2/include/git2/types.h +35 -28
- data/vendor/libgit2/include/git2/version.h +4 -4
- data/vendor/libgit2/include/git2/worktree.h +47 -12
- data/vendor/libgit2/src/CMakeLists.txt +87 -26
- data/vendor/libgit2/src/alloc.c +55 -0
- data/vendor/libgit2/src/alloc.h +40 -0
- data/vendor/libgit2/src/annotated_commit.c +15 -8
- data/vendor/libgit2/src/apply.c +490 -14
- data/vendor/libgit2/src/apply.h +3 -1
- data/vendor/libgit2/src/array.h +2 -2
- data/vendor/libgit2/src/attr.c +11 -11
- data/vendor/libgit2/src/attr_file.c +20 -15
- data/vendor/libgit2/src/attrcache.c +11 -11
- data/vendor/libgit2/src/blame.c +30 -15
- data/vendor/libgit2/src/blame.h +1 -0
- data/vendor/libgit2/src/blame_git.c +16 -13
- data/vendor/libgit2/src/blob.c +50 -28
- data/vendor/libgit2/src/blob.h +18 -1
- data/vendor/libgit2/src/branch.c +38 -38
- data/vendor/libgit2/src/buf_text.c +7 -6
- data/vendor/libgit2/src/buffer.c +55 -50
- data/vendor/libgit2/src/buffer.h +1 -1
- data/vendor/libgit2/src/cache.c +16 -16
- data/vendor/libgit2/src/cache.h +2 -2
- data/vendor/libgit2/src/cc-compat.h +15 -3
- data/vendor/libgit2/src/checkout.c +83 -74
- data/vendor/libgit2/src/cherrypick.c +6 -6
- data/vendor/libgit2/src/clone.c +20 -20
- data/vendor/libgit2/src/commit.c +53 -33
- data/vendor/libgit2/src/commit.h +1 -0
- data/vendor/libgit2/src/commit_list.c +6 -10
- data/vendor/libgit2/src/common.h +32 -30
- data/vendor/libgit2/src/config.c +167 -147
- data/vendor/libgit2/src/config.h +1 -14
- data/vendor/libgit2/src/config_backend.h +84 -0
- data/vendor/libgit2/src/config_cache.c +7 -1
- data/vendor/libgit2/src/config_entries.c +259 -0
- data/vendor/libgit2/src/config_entries.h +23 -0
- data/vendor/libgit2/src/config_file.c +167 -439
- data/vendor/libgit2/src/config_mem.c +224 -0
- data/vendor/libgit2/src/config_parse.c +69 -38
- data/vendor/libgit2/src/config_parse.h +4 -4
- data/vendor/libgit2/src/crlf.c +215 -186
- data/vendor/libgit2/src/delta.c +25 -18
- data/vendor/libgit2/src/describe.c +23 -23
- data/vendor/libgit2/src/diff.c +12 -12
- data/vendor/libgit2/src/diff_driver.c +14 -15
- data/vendor/libgit2/src/diff_file.c +10 -10
- data/vendor/libgit2/src/diff_generate.c +29 -23
- data/vendor/libgit2/src/diff_generate.h +1 -1
- data/vendor/libgit2/src/diff_parse.c +3 -3
- data/vendor/libgit2/src/diff_print.c +17 -17
- data/vendor/libgit2/src/diff_stats.c +22 -7
- data/vendor/libgit2/src/diff_tform.c +12 -12
- data/vendor/libgit2/src/diff_xdiff.c +15 -3
- data/vendor/libgit2/src/errors.c +42 -20
- data/vendor/libgit2/src/features.h.in +2 -1
- data/vendor/libgit2/src/fetch.c +3 -3
- data/vendor/libgit2/src/fetchhead.c +16 -16
- data/vendor/libgit2/src/filebuf.c +28 -28
- data/vendor/libgit2/src/fileops.c +54 -54
- data/vendor/libgit2/src/fileops.h +1 -1
- data/vendor/libgit2/src/filter.c +30 -30
- data/vendor/libgit2/src/filter.h +0 -10
- data/vendor/libgit2/src/global.c +36 -23
- data/vendor/libgit2/src/hash.h +4 -1
- data/vendor/libgit2/src/hash/hash_collisiondetect.h +6 -2
- data/vendor/libgit2/src/hash/hash_common_crypto.h +5 -1
- data/vendor/libgit2/src/hash/hash_generic.h +5 -1
- data/vendor/libgit2/src/hash/hash_mbedtls.c +38 -0
- data/vendor/libgit2/src/hash/hash_mbedtls.h +24 -0
- data/vendor/libgit2/src/hash/hash_openssl.h +8 -4
- data/vendor/libgit2/src/hash/hash_win32.c +13 -13
- data/vendor/libgit2/src/hashsig.c +4 -4
- data/vendor/libgit2/src/idxmap.c +25 -5
- data/vendor/libgit2/src/idxmap.h +4 -18
- data/vendor/libgit2/src/ignore.c +9 -9
- data/vendor/libgit2/src/index.c +280 -198
- data/vendor/libgit2/src/index.h +16 -0
- data/vendor/libgit2/src/indexer.c +311 -139
- data/vendor/libgit2/src/integer.h +32 -22
- data/vendor/libgit2/src/iterator.c +116 -49
- data/vendor/libgit2/src/iterator.h +15 -0
- data/vendor/libgit2/src/khash.h +3 -1
- data/vendor/libgit2/src/mailmap.c +485 -0
- data/vendor/libgit2/src/mailmap.h +35 -0
- data/vendor/libgit2/src/merge.c +89 -59
- data/vendor/libgit2/src/merge_driver.c +7 -7
- data/vendor/libgit2/src/merge_file.c +1 -1
- data/vendor/libgit2/src/mwindow.c +8 -8
- data/vendor/libgit2/src/netops.c +22 -13
- data/vendor/libgit2/src/netops.h +2 -0
- data/vendor/libgit2/src/notes.c +15 -10
- data/vendor/libgit2/src/object.c +118 -67
- data/vendor/libgit2/src/object.h +20 -9
- data/vendor/libgit2/src/object_api.c +8 -8
- data/vendor/libgit2/src/odb.c +72 -72
- data/vendor/libgit2/src/odb.h +7 -7
- data/vendor/libgit2/src/odb_loose.c +46 -46
- data/vendor/libgit2/src/odb_mempack.c +14 -14
- data/vendor/libgit2/src/odb_pack.c +14 -10
- data/vendor/libgit2/src/offmap.c +30 -0
- data/vendor/libgit2/src/offmap.h +20 -11
- data/vendor/libgit2/src/oid.c +6 -6
- data/vendor/libgit2/src/oidmap.c +20 -0
- data/vendor/libgit2/src/oidmap.h +9 -12
- data/vendor/libgit2/src/pack-objects.c +71 -63
- data/vendor/libgit2/src/pack-objects.h +1 -7
- data/vendor/libgit2/src/pack.c +58 -58
- data/vendor/libgit2/src/pack.h +6 -6
- data/vendor/libgit2/src/parse.h +1 -1
- data/vendor/libgit2/src/patch.c +3 -3
- data/vendor/libgit2/src/patch_generate.c +18 -18
- data/vendor/libgit2/src/patch_parse.c +13 -13
- data/vendor/libgit2/src/path.c +93 -225
- data/vendor/libgit2/src/path.h +2 -84
- data/vendor/libgit2/src/pathspec.c +6 -6
- data/vendor/libgit2/src/posix.c +3 -3
- data/vendor/libgit2/src/proxy.c +1 -1
- data/vendor/libgit2/src/push.c +27 -26
- data/vendor/libgit2/src/push.h +2 -1
- data/vendor/libgit2/src/reader.c +265 -0
- data/vendor/libgit2/src/reader.h +107 -0
- data/vendor/libgit2/src/rebase.c +49 -52
- data/vendor/libgit2/src/refdb.c +3 -3
- data/vendor/libgit2/src/refdb_fs.c +181 -103
- data/vendor/libgit2/src/reflog.c +3 -3
- data/vendor/libgit2/src/refs.c +98 -74
- data/vendor/libgit2/src/refs.h +5 -3
- data/vendor/libgit2/src/refspec.c +47 -21
- data/vendor/libgit2/src/refspec.h +1 -1
- data/vendor/libgit2/src/remote.c +219 -166
- data/vendor/libgit2/src/remote.h +9 -0
- data/vendor/libgit2/src/repository.c +173 -133
- data/vendor/libgit2/src/repository.h +6 -3
- data/vendor/libgit2/src/reset.c +8 -8
- data/vendor/libgit2/src/revert.c +6 -6
- data/vendor/libgit2/src/revparse.c +30 -30
- data/vendor/libgit2/src/revwalk.c +60 -30
- data/vendor/libgit2/src/revwalk.h +2 -1
- data/vendor/libgit2/src/settings.c +42 -10
- data/vendor/libgit2/src/signature.c +11 -11
- data/vendor/libgit2/src/sortedcache.c +13 -13
- data/vendor/libgit2/src/stash.c +91 -45
- data/vendor/libgit2/src/status.c +13 -13
- data/vendor/libgit2/src/stdalloc.c +120 -0
- data/vendor/libgit2/src/{streams/curl.h → stdalloc.h} +6 -6
- data/vendor/libgit2/src/stream.h +17 -2
- data/vendor/libgit2/src/streams/mbedtls.c +483 -0
- data/vendor/libgit2/src/streams/mbedtls.h +23 -0
- data/vendor/libgit2/src/streams/openssl.c +204 -114
- data/vendor/libgit2/src/streams/openssl.h +4 -108
- data/vendor/libgit2/src/streams/registry.c +118 -0
- data/vendor/libgit2/src/streams/registry.h +19 -0
- data/vendor/libgit2/src/streams/socket.c +54 -29
- data/vendor/libgit2/src/streams/stransport.c +57 -32
- data/vendor/libgit2/src/streams/stransport.h +5 -0
- data/vendor/libgit2/src/streams/tls.c +50 -19
- data/vendor/libgit2/src/streams/tls.h +12 -4
- data/vendor/libgit2/src/strmap.c +22 -2
- data/vendor/libgit2/src/strmap.h +18 -15
- data/vendor/libgit2/src/submodule.c +179 -155
- data/vendor/libgit2/src/sysdir.c +18 -18
- data/vendor/libgit2/src/tag.c +31 -26
- data/vendor/libgit2/src/tag.h +2 -1
- data/vendor/libgit2/src/trace.c +1 -1
- data/vendor/libgit2/src/trace.h +1 -1
- data/vendor/libgit2/src/trailer.c +6 -6
- data/vendor/libgit2/src/transaction.c +23 -23
- data/vendor/libgit2/src/transport.c +5 -5
- data/vendor/libgit2/src/transports/auth.c +7 -4
- data/vendor/libgit2/src/transports/auth.h +1 -1
- data/vendor/libgit2/src/transports/auth_negotiate.c +12 -11
- data/vendor/libgit2/src/transports/cred.c +18 -18
- data/vendor/libgit2/src/transports/git.c +15 -15
- data/vendor/libgit2/src/transports/http.c +606 -216
- data/vendor/libgit2/src/transports/http.h +2 -0
- data/vendor/libgit2/src/transports/local.c +26 -26
- data/vendor/libgit2/src/transports/smart.c +54 -31
- data/vendor/libgit2/src/transports/smart.h +1 -2
- data/vendor/libgit2/src/transports/smart_pkt.c +43 -40
- data/vendor/libgit2/src/transports/smart_protocol.c +61 -57
- data/vendor/libgit2/src/transports/ssh.c +34 -33
- data/vendor/libgit2/src/transports/winhttp.c +99 -119
- data/vendor/libgit2/src/tree-cache.c +5 -5
- data/vendor/libgit2/src/tree.c +96 -121
- data/vendor/libgit2/src/tree.h +1 -12
- data/vendor/libgit2/src/unix/map.c +2 -2
- data/vendor/libgit2/src/util.c +22 -6
- data/vendor/libgit2/src/util.h +12 -135
- data/vendor/libgit2/src/vector.c +4 -4
- data/vendor/libgit2/src/win32/dir.c +3 -3
- data/vendor/libgit2/src/win32/findfile.c +3 -3
- data/vendor/libgit2/src/win32/map.c +6 -6
- data/vendor/libgit2/src/win32/msvc-compat.h +6 -0
- data/vendor/libgit2/src/win32/path_w32.c +101 -7
- data/vendor/libgit2/src/win32/path_w32.h +18 -0
- data/vendor/libgit2/src/win32/posix_w32.c +24 -43
- data/vendor/libgit2/src/win32/w32_buffer.c +2 -2
- data/vendor/libgit2/src/win32/w32_crtdbg_stacktrace.c +96 -2
- data/vendor/libgit2/src/win32/w32_crtdbg_stacktrace.h +28 -75
- data/vendor/libgit2/src/win32/w32_stack.c +2 -2
- data/vendor/libgit2/src/win32/w32_util.c +1 -69
- data/vendor/libgit2/src/win32/w32_util.h +1 -19
- data/vendor/libgit2/src/worktree.c +75 -54
- data/vendor/libgit2/src/worktree.h +2 -0
- data/vendor/libgit2/src/xdiff/xdiffi.c +7 -5
- data/vendor/libgit2/src/xdiff/xhistogram.c +1 -1
- data/vendor/libgit2/src/xdiff/xmerge.c +15 -15
- data/vendor/libgit2/src/zstream.c +4 -4
- metadata +33 -7
- data/vendor/libgit2/src/config_file.h +0 -73
- data/vendor/libgit2/src/streams/curl.c +0 -385
data/vendor/libgit2/src/odb.h
CHANGED
@@ -28,7 +28,7 @@ extern bool git_odb__strict_hash_verification;
|
|
28
28
|
typedef struct {
|
29
29
|
void *data; /**< Raw, decompressed object data. */
|
30
30
|
size_t len; /**< Total number of bytes in data. */
|
31
|
-
|
31
|
+
git_object_t type; /**< Type of this object. */
|
32
32
|
} git_rawobj;
|
33
33
|
|
34
34
|
/* EXPORT */
|
@@ -70,7 +70,7 @@ int git_odb__hashobj(git_oid *id, git_rawobj *obj);
|
|
70
70
|
/*
|
71
71
|
* Format the object header such as it would appear in the on-disk object
|
72
72
|
*/
|
73
|
-
int git_odb__format_object_header(size_t *out_len, char *hdr, size_t hdr_size, git_off_t obj_len,
|
73
|
+
int git_odb__format_object_header(size_t *out_len, char *hdr, size_t hdr_size, git_off_t obj_len, git_object_t obj_type);
|
74
74
|
/*
|
75
75
|
* Hash an open file descriptor.
|
76
76
|
* This is a performance call when the contents of a fd need to be hashed,
|
@@ -81,22 +81,22 @@ int git_odb__format_object_header(size_t *out_len, char *hdr, size_t hdr_size, g
|
|
81
81
|
* The fd is never closed, not even on error. It must be opened and closed
|
82
82
|
* by the caller
|
83
83
|
*/
|
84
|
-
int git_odb__hashfd(git_oid *out, git_file fd, size_t size,
|
84
|
+
int git_odb__hashfd(git_oid *out, git_file fd, size_t size, git_object_t type);
|
85
85
|
|
86
86
|
/*
|
87
87
|
* Hash an open file descriptor applying an array of filters
|
88
88
|
* Acts just like git_odb__hashfd with the addition of filters...
|
89
89
|
*/
|
90
90
|
int git_odb__hashfd_filtered(
|
91
|
-
git_oid *out, git_file fd, size_t len,
|
91
|
+
git_oid *out, git_file fd, size_t len, git_object_t type, git_filter_list *fl);
|
92
92
|
|
93
93
|
/*
|
94
94
|
* Hash a `path`, assuming it could be a POSIX symlink: if the path is a
|
95
95
|
* symlink, then the raw contents of the symlink will be hashed. Otherwise,
|
96
96
|
* this will fallback to `git_odb__hashfd`.
|
97
97
|
*
|
98
|
-
* The hash type for this call is always `
|
99
|
-
* only point to blobs.
|
98
|
+
* The hash type for this call is always `GIT_OBJIECT_BLOB` because
|
99
|
+
* symlinks may only point to blobs.
|
100
100
|
*/
|
101
101
|
int git_odb__hashlink(git_oid *out, const char *path);
|
102
102
|
|
@@ -122,7 +122,7 @@ int git_odb__error_ambiguous(const char *message);
|
|
122
122
|
* not be read.
|
123
123
|
*/
|
124
124
|
int git_odb__read_header_or_object(
|
125
|
-
git_odb_object **out, size_t *len_p,
|
125
|
+
git_odb_object **out, size_t *len_p, git_object_t *type_p,
|
126
126
|
git_odb *db, const git_oid *id);
|
127
127
|
|
128
128
|
/* freshen an entry in the object database */
|
@@ -25,7 +25,7 @@
|
|
25
25
|
#define MAX_HEADER_LEN 64
|
26
26
|
|
27
27
|
typedef struct { /* object header data */
|
28
|
-
|
28
|
+
git_object_t type; /* object type */
|
29
29
|
size_t size; /* object size */
|
30
30
|
} obj_hdr;
|
31
31
|
|
@@ -81,8 +81,8 @@ static int object_file_name(
|
|
81
81
|
size_t alloclen;
|
82
82
|
|
83
83
|
/* expand length for object root + 40 hex sha1 chars + 2 * '/' + '\0' */
|
84
|
-
|
85
|
-
|
84
|
+
GIT_ERROR_CHECK_ALLOC_ADD(&alloclen, be->objects_dirlen, GIT_OID_HEXSZ);
|
85
|
+
GIT_ERROR_CHECK_ALLOC_ADD(&alloclen, alloclen, 3);
|
86
86
|
if (git_buf_grow(name, alloclen) < 0)
|
87
87
|
return -1;
|
88
88
|
|
@@ -138,7 +138,7 @@ static int parse_header_packlike(
|
|
138
138
|
return 0;
|
139
139
|
|
140
140
|
on_error:
|
141
|
-
|
141
|
+
git_error_set(GIT_ERROR_OBJECT, "failed to parse loose object: invalid header");
|
142
142
|
return -1;
|
143
143
|
}
|
144
144
|
|
@@ -179,11 +179,11 @@ static int parse_header(
|
|
179
179
|
goto on_error;
|
180
180
|
|
181
181
|
if ((uint64_t)size > SIZE_MAX) {
|
182
|
-
|
182
|
+
git_error_set(GIT_ERROR_OBJECT, "object is larger than available memory");
|
183
183
|
return -1;
|
184
184
|
}
|
185
185
|
|
186
|
-
out->size = size;
|
186
|
+
out->size = (size_t)size;
|
187
187
|
|
188
188
|
if (GIT_ADD_SIZET_OVERFLOW(out_len, i, 1))
|
189
189
|
goto on_error;
|
@@ -191,7 +191,7 @@ static int parse_header(
|
|
191
191
|
return 0;
|
192
192
|
|
193
193
|
on_error:
|
194
|
-
|
194
|
+
git_error_set(GIT_ERROR_OBJECT, "failed to parse loose object: invalid header");
|
195
195
|
return -1;
|
196
196
|
}
|
197
197
|
|
@@ -241,7 +241,7 @@ static int read_loose_packlike(git_rawobj *out, git_buf *obj)
|
|
241
241
|
goto done;
|
242
242
|
|
243
243
|
if (!git_object_typeisloose(hdr.type) || head_len > obj_len) {
|
244
|
-
|
244
|
+
git_error_set(GIT_ERROR_ODB, "failed to inflate loose object");
|
245
245
|
error = -1;
|
246
246
|
goto done;
|
247
247
|
}
|
@@ -266,7 +266,7 @@ static int read_loose_packlike(git_rawobj *out, git_buf *obj)
|
|
266
266
|
out->data = git_buf_detach(&body);
|
267
267
|
|
268
268
|
done:
|
269
|
-
|
269
|
+
git_buf_dispose(&body);
|
270
270
|
return error;
|
271
271
|
}
|
272
272
|
|
@@ -294,7 +294,7 @@ static int read_loose_standard(git_rawobj *out, git_buf *obj)
|
|
294
294
|
goto done;
|
295
295
|
|
296
296
|
if (!git_object_typeisloose(hdr.type)) {
|
297
|
-
|
297
|
+
git_error_set(GIT_ERROR_ODB, "failed to inflate disk object");
|
298
298
|
error = -1;
|
299
299
|
goto done;
|
300
300
|
}
|
@@ -320,7 +320,7 @@ static int read_loose_standard(git_rawobj *out, git_buf *obj)
|
|
320
320
|
goto done;
|
321
321
|
|
322
322
|
if (!git_zstream_done(&zstream)) {
|
323
|
-
|
323
|
+
git_error_set(GIT_ERROR_ZLIB, "failed to finish zlib inflation: stream aborted prematurely");
|
324
324
|
error = -1;
|
325
325
|
goto done;
|
326
326
|
}
|
@@ -351,7 +351,7 @@ static int read_loose(git_rawobj *out, git_buf *loc)
|
|
351
351
|
|
352
352
|
out->data = NULL;
|
353
353
|
out->len = 0;
|
354
|
-
out->type =
|
354
|
+
out->type = GIT_OBJECT_INVALID;
|
355
355
|
|
356
356
|
if ((error = git_futils_readbuffer(&obj, loc->ptr)) < 0)
|
357
357
|
goto done;
|
@@ -362,7 +362,7 @@ static int read_loose(git_rawobj *out, git_buf *loc)
|
|
362
362
|
error = read_loose_standard(out, &obj);
|
363
363
|
|
364
364
|
done:
|
365
|
-
|
365
|
+
git_buf_dispose(&obj);
|
366
366
|
return error;
|
367
367
|
}
|
368
368
|
|
@@ -427,7 +427,7 @@ static int read_header_loose(git_rawobj *out, git_buf *loc)
|
|
427
427
|
error = read_header_loose_standard(out, obj, (size_t)obj_len);
|
428
428
|
|
429
429
|
if (!error && !git_object_typeisloose(out->type)) {
|
430
|
-
|
430
|
+
git_error_set(GIT_ERROR_ZLIB, "failed to read loose object header");
|
431
431
|
error = -1;
|
432
432
|
goto done;
|
433
433
|
}
|
@@ -496,8 +496,8 @@ static int locate_object_short_oid(
|
|
496
496
|
int error;
|
497
497
|
|
498
498
|
/* prealloc memory for OBJ_DIR/xx/xx..38x..xx */
|
499
|
-
|
500
|
-
|
499
|
+
GIT_ERROR_CHECK_ALLOC_ADD(&alloc_len, dir_len, GIT_OID_HEXSZ);
|
500
|
+
GIT_ERROR_CHECK_ALLOC_ADD(&alloc_len, alloc_len, 3);
|
501
501
|
if (git_buf_grow(object_location, alloc_len) < 0)
|
502
502
|
return -1;
|
503
503
|
|
@@ -543,8 +543,8 @@ static int locate_object_short_oid(
|
|
543
543
|
return error;
|
544
544
|
|
545
545
|
/* Update the location according to the oid obtained */
|
546
|
-
|
547
|
-
|
546
|
+
GIT_ERROR_CHECK_ALLOC_ADD(&alloc_len, dir_len, GIT_OID_HEXSZ);
|
547
|
+
GIT_ERROR_CHECK_ALLOC_ADD(&alloc_len, alloc_len, 2);
|
548
548
|
|
549
549
|
git_buf_truncate(object_location, dir_len);
|
550
550
|
if (git_buf_grow(object_location, alloc_len) < 0)
|
@@ -574,7 +574,7 @@ static int locate_object_short_oid(
|
|
574
574
|
*
|
575
575
|
***********************************************************/
|
576
576
|
|
577
|
-
static int loose_backend__read_header(size_t *len_p,
|
577
|
+
static int loose_backend__read_header(size_t *len_p, git_object_t *type_p, git_odb_backend *backend, const git_oid *oid)
|
578
578
|
{
|
579
579
|
git_buf object_path = GIT_BUF_INIT;
|
580
580
|
git_rawobj raw;
|
@@ -583,7 +583,7 @@ static int loose_backend__read_header(size_t *len_p, git_otype *type_p, git_odb_
|
|
583
583
|
assert(backend && oid);
|
584
584
|
|
585
585
|
raw.len = 0;
|
586
|
-
raw.type =
|
586
|
+
raw.type = GIT_OBJECT_INVALID;
|
587
587
|
|
588
588
|
if (locate_object(&object_path, (loose_backend *)backend, oid) < 0) {
|
589
589
|
error = git_odb__error_notfound("no matching loose object",
|
@@ -593,12 +593,12 @@ static int loose_backend__read_header(size_t *len_p, git_otype *type_p, git_odb_
|
|
593
593
|
*type_p = raw.type;
|
594
594
|
}
|
595
595
|
|
596
|
-
|
596
|
+
git_buf_dispose(&object_path);
|
597
597
|
|
598
598
|
return error;
|
599
599
|
}
|
600
600
|
|
601
|
-
static int loose_backend__read(void **buffer_p, size_t *len_p,
|
601
|
+
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)
|
602
602
|
{
|
603
603
|
git_buf object_path = GIT_BUF_INIT;
|
604
604
|
git_rawobj raw;
|
@@ -615,7 +615,7 @@ static int loose_backend__read(void **buffer_p, size_t *len_p, git_otype *type_p
|
|
615
615
|
*type_p = raw.type;
|
616
616
|
}
|
617
617
|
|
618
|
-
|
618
|
+
git_buf_dispose(&object_path);
|
619
619
|
|
620
620
|
return error;
|
621
621
|
}
|
@@ -624,7 +624,7 @@ static int loose_backend__read_prefix(
|
|
624
624
|
git_oid *out_oid,
|
625
625
|
void **buffer_p,
|
626
626
|
size_t *len_p,
|
627
|
-
|
627
|
+
git_object_t *type_p,
|
628
628
|
git_odb_backend *backend,
|
629
629
|
const git_oid *short_oid,
|
630
630
|
size_t len)
|
@@ -653,7 +653,7 @@ static int loose_backend__read_prefix(
|
|
653
653
|
*type_p = raw.type;
|
654
654
|
}
|
655
655
|
|
656
|
-
|
656
|
+
git_buf_dispose(&object_path);
|
657
657
|
}
|
658
658
|
|
659
659
|
return error;
|
@@ -668,7 +668,7 @@ static int loose_backend__exists(git_odb_backend *backend, const git_oid *oid)
|
|
668
668
|
|
669
669
|
error = locate_object(&object_path, (loose_backend *)backend, oid);
|
670
670
|
|
671
|
-
|
671
|
+
git_buf_dispose(&object_path);
|
672
672
|
|
673
673
|
return !error;
|
674
674
|
}
|
@@ -684,7 +684,7 @@ static int loose_backend__exists_prefix(
|
|
684
684
|
error = locate_object_short_oid(
|
685
685
|
&object_path, out, (loose_backend *)backend, short_id, len);
|
686
686
|
|
687
|
-
|
687
|
+
git_buf_dispose(&object_path);
|
688
688
|
|
689
689
|
return error;
|
690
690
|
}
|
@@ -731,7 +731,7 @@ static int foreach_object_dir_cb(void *_state, git_buf *path)
|
|
731
731
|
if (filename_to_oid(&oid, path->ptr + state->dir_len) < 0)
|
732
732
|
return 0;
|
733
733
|
|
734
|
-
return
|
734
|
+
return git_error_set_after_callback_function(
|
735
735
|
state->cb(&oid, state->data), "git_odb_foreach");
|
736
736
|
}
|
737
737
|
|
@@ -770,7 +770,7 @@ static int loose_backend__foreach(git_odb_backend *_backend, git_odb_foreach_cb
|
|
770
770
|
|
771
771
|
error = git_path_direach(&buf, 0, foreach_cb, &state);
|
772
772
|
|
773
|
-
|
773
|
+
git_buf_dispose(&buf);
|
774
774
|
|
775
775
|
return error;
|
776
776
|
}
|
@@ -789,7 +789,7 @@ static int loose_backend__writestream_finalize(git_odb_stream *_stream, const gi
|
|
789
789
|
error = git_filebuf_commit_at(
|
790
790
|
&stream->fbuf, final_path.ptr);
|
791
791
|
|
792
|
-
|
792
|
+
git_buf_dispose(&final_path);
|
793
793
|
|
794
794
|
return error;
|
795
795
|
}
|
@@ -819,7 +819,7 @@ static int filebuf_flags(loose_backend *backend)
|
|
819
819
|
return flags;
|
820
820
|
}
|
821
821
|
|
822
|
-
static int loose_backend__writestream(git_odb_stream **stream_out, git_odb_backend *_backend, git_off_t length,
|
822
|
+
static int loose_backend__writestream(git_odb_stream **stream_out, git_odb_backend *_backend, git_off_t length, git_object_t type)
|
823
823
|
{
|
824
824
|
loose_backend *backend;
|
825
825
|
loose_writestream *stream = NULL;
|
@@ -838,7 +838,7 @@ static int loose_backend__writestream(git_odb_stream **stream_out, git_odb_backe
|
|
838
838
|
return error;
|
839
839
|
|
840
840
|
stream = git__calloc(1, sizeof(loose_writestream));
|
841
|
-
|
841
|
+
GIT_ERROR_CHECK_ALLOC(stream);
|
842
842
|
|
843
843
|
stream->stream.backend = _backend;
|
844
844
|
stream->stream.read = NULL; /* read only */
|
@@ -856,7 +856,7 @@ static int loose_backend__writestream(git_odb_stream **stream_out, git_odb_backe
|
|
856
856
|
git__free(stream);
|
857
857
|
stream = NULL;
|
858
858
|
}
|
859
|
-
|
859
|
+
git_buf_dispose(&tmp_path);
|
860
860
|
*stream_out = (git_odb_stream *)stream;
|
861
861
|
|
862
862
|
return !stream ? -1 : 0;
|
@@ -926,7 +926,7 @@ static int loose_backend__readstream_packlike(
|
|
926
926
|
return error;
|
927
927
|
|
928
928
|
if (!git_object_typeisloose(hdr->type)) {
|
929
|
-
|
929
|
+
git_error_set(GIT_ERROR_ODB, "failed to inflate loose object");
|
930
930
|
return -1;
|
931
931
|
}
|
932
932
|
|
@@ -958,7 +958,7 @@ static int loose_backend__readstream_standard(
|
|
958
958
|
return error;
|
959
959
|
|
960
960
|
if (!git_object_typeisloose(hdr->type)) {
|
961
|
-
|
961
|
+
git_error_set(GIT_ERROR_ODB, "failed to inflate disk object");
|
962
962
|
return -1;
|
963
963
|
}
|
964
964
|
|
@@ -973,7 +973,7 @@ static int loose_backend__readstream_standard(
|
|
973
973
|
static int loose_backend__readstream(
|
974
974
|
git_odb_stream **stream_out,
|
975
975
|
size_t *len_out,
|
976
|
-
|
976
|
+
git_object_t *type_out,
|
977
977
|
git_odb_backend *_backend,
|
978
978
|
const git_oid *oid)
|
979
979
|
{
|
@@ -989,7 +989,7 @@ static int loose_backend__readstream(
|
|
989
989
|
backend = (loose_backend *)_backend;
|
990
990
|
*stream_out = NULL;
|
991
991
|
*len_out = 0;
|
992
|
-
*type_out =
|
992
|
+
*type_out = GIT_OBJECT_INVALID;
|
993
993
|
|
994
994
|
if (locate_object(&object_path, backend, oid) < 0) {
|
995
995
|
error = git_odb__error_notfound("no matching loose object",
|
@@ -998,10 +998,10 @@ static int loose_backend__readstream(
|
|
998
998
|
}
|
999
999
|
|
1000
1000
|
stream = git__calloc(1, sizeof(loose_readstream));
|
1001
|
-
|
1001
|
+
GIT_ERROR_CHECK_ALLOC(stream);
|
1002
1002
|
|
1003
1003
|
hash_ctx = git__malloc(sizeof(git_hash_ctx));
|
1004
|
-
|
1004
|
+
GIT_ERROR_CHECK_ALLOC(hash_ctx);
|
1005
1005
|
|
1006
1006
|
if ((error = git_hash_ctx_init(hash_ctx)) < 0 ||
|
1007
1007
|
(error = git_futils_mmap_ro_file(&stream->map, object_path.ptr)) < 0 ||
|
@@ -1039,11 +1039,11 @@ done:
|
|
1039
1039
|
}
|
1040
1040
|
}
|
1041
1041
|
|
1042
|
-
|
1042
|
+
git_buf_dispose(&object_path);
|
1043
1043
|
return error;
|
1044
1044
|
}
|
1045
1045
|
|
1046
|
-
static int loose_backend__write(git_odb_backend *_backend, const git_oid *oid, const void *data, size_t len,
|
1046
|
+
static int loose_backend__write(git_odb_backend *_backend, const git_oid *oid, const void *data, size_t len, git_object_t type)
|
1047
1047
|
{
|
1048
1048
|
int error = 0;
|
1049
1049
|
git_buf final_path = GIT_BUF_INIT;
|
@@ -1078,7 +1078,7 @@ static int loose_backend__write(git_odb_backend *_backend, const git_oid *oid, c
|
|
1078
1078
|
cleanup:
|
1079
1079
|
if (error < 0)
|
1080
1080
|
git_filebuf_cleanup(&fbuf);
|
1081
|
-
|
1081
|
+
git_buf_dispose(&final_path);
|
1082
1082
|
return error;
|
1083
1083
|
}
|
1084
1084
|
|
@@ -1094,7 +1094,7 @@ static int loose_backend__freshen(
|
|
1094
1094
|
return -1;
|
1095
1095
|
|
1096
1096
|
error = git_futils_touch(path.ptr, NULL);
|
1097
|
-
|
1097
|
+
git_buf_dispose(&path);
|
1098
1098
|
|
1099
1099
|
return error;
|
1100
1100
|
}
|
@@ -1123,10 +1123,10 @@ int git_odb_backend_loose(
|
|
1123
1123
|
|
1124
1124
|
objects_dirlen = strlen(objects_dir);
|
1125
1125
|
|
1126
|
-
|
1127
|
-
|
1126
|
+
GIT_ERROR_CHECK_ALLOC_ADD(&alloclen, sizeof(loose_backend), objects_dirlen);
|
1127
|
+
GIT_ERROR_CHECK_ALLOC_ADD(&alloclen, alloclen, 2);
|
1128
1128
|
backend = git__calloc(1, alloclen);
|
1129
|
-
|
1129
|
+
GIT_ERROR_CHECK_ALLOC(backend);
|
1130
1130
|
|
1131
1131
|
backend->parent.version = GIT_ODB_BACKEND_VERSION;
|
1132
1132
|
backend->objects_dirlen = objects_dirlen;
|
@@ -23,7 +23,7 @@
|
|
23
23
|
struct memobject {
|
24
24
|
git_oid oid;
|
25
25
|
size_t len;
|
26
|
-
|
26
|
+
git_object_t type;
|
27
27
|
char data[GIT_FLEX_ARRAY];
|
28
28
|
};
|
29
29
|
|
@@ -33,11 +33,11 @@ struct memory_packer_db {
|
|
33
33
|
git_array_t(struct memobject *) commits;
|
34
34
|
};
|
35
35
|
|
36
|
-
static int impl__write(git_odb_backend *_backend, const git_oid *oid, const void *data, size_t len,
|
36
|
+
static int impl__write(git_odb_backend *_backend, const git_oid *oid, const void *data, size_t len, git_object_t type)
|
37
37
|
{
|
38
38
|
struct memory_packer_db *db = (struct memory_packer_db *)_backend;
|
39
|
-
struct memobject *obj = NULL;
|
40
|
-
|
39
|
+
struct memobject *obj = NULL;
|
40
|
+
size_t pos;
|
41
41
|
size_t alloc_len;
|
42
42
|
int rval;
|
43
43
|
|
@@ -48,9 +48,9 @@ static int impl__write(git_odb_backend *_backend, const git_oid *oid, const void
|
|
48
48
|
if (rval == 0)
|
49
49
|
return 0;
|
50
50
|
|
51
|
-
|
51
|
+
GIT_ERROR_CHECK_ALLOC_ADD(&alloc_len, sizeof(struct memobject), len);
|
52
52
|
obj = git__malloc(alloc_len);
|
53
|
-
|
53
|
+
GIT_ERROR_CHECK_ALLOC(obj);
|
54
54
|
|
55
55
|
memcpy(obj->data, data, len);
|
56
56
|
git_oid_cpy(&obj->oid, oid);
|
@@ -60,9 +60,9 @@ static int impl__write(git_odb_backend *_backend, const git_oid *oid, const void
|
|
60
60
|
git_oidmap_set_key_at(db->objects, pos, &obj->oid);
|
61
61
|
git_oidmap_set_value_at(db->objects, pos, obj);
|
62
62
|
|
63
|
-
if (type ==
|
63
|
+
if (type == GIT_OBJECT_COMMIT) {
|
64
64
|
struct memobject **store = git_array_alloc(db->commits);
|
65
|
-
|
65
|
+
GIT_ERROR_CHECK_ALLOC(store);
|
66
66
|
*store = obj;
|
67
67
|
}
|
68
68
|
|
@@ -76,11 +76,11 @@ static int impl__exists(git_odb_backend *backend, const git_oid *oid)
|
|
76
76
|
return git_oidmap_exists(db->objects, oid);
|
77
77
|
}
|
78
78
|
|
79
|
-
static int impl__read(void **buffer_p, size_t *len_p,
|
79
|
+
static int impl__read(void **buffer_p, size_t *len_p, git_object_t *type_p, git_odb_backend *backend, const git_oid *oid)
|
80
80
|
{
|
81
81
|
struct memory_packer_db *db = (struct memory_packer_db *)backend;
|
82
82
|
struct memobject *obj = NULL;
|
83
|
-
|
83
|
+
size_t pos;
|
84
84
|
|
85
85
|
pos = git_oidmap_lookup_index(db->objects, oid);
|
86
86
|
if (!git_oidmap_valid_index(db->objects, pos))
|
@@ -91,17 +91,17 @@ static int impl__read(void **buffer_p, size_t *len_p, git_otype *type_p, git_odb
|
|
91
91
|
*len_p = obj->len;
|
92
92
|
*type_p = obj->type;
|
93
93
|
*buffer_p = git__malloc(obj->len);
|
94
|
-
|
94
|
+
GIT_ERROR_CHECK_ALLOC(*buffer_p);
|
95
95
|
|
96
96
|
memcpy(*buffer_p, obj->data, obj->len);
|
97
97
|
return 0;
|
98
98
|
}
|
99
99
|
|
100
|
-
static int impl__read_header(size_t *len_p,
|
100
|
+
static int impl__read_header(size_t *len_p, git_object_t *type_p, git_odb_backend *backend, const git_oid *oid)
|
101
101
|
{
|
102
102
|
struct memory_packer_db *db = (struct memory_packer_db *)backend;
|
103
103
|
struct memobject *obj = NULL;
|
104
|
-
|
104
|
+
size_t pos;
|
105
105
|
|
106
106
|
pos = git_oidmap_lookup_index(db->objects, oid);
|
107
107
|
if (!git_oidmap_valid_index(db->objects, pos))
|
@@ -169,7 +169,7 @@ int git_mempack_new(git_odb_backend **out)
|
|
169
169
|
assert(out);
|
170
170
|
|
171
171
|
db = git__calloc(1, sizeof(struct memory_packer_db));
|
172
|
-
|
172
|
+
GIT_ERROR_CHECK_ALLOC(db);
|
173
173
|
|
174
174
|
db->objects = git_oidmap_alloc();
|
175
175
|
|