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
@@ -340,7 +340,7 @@ typedef struct {
|
|
340
340
|
* This function updates the file stamp to current data for the given path
|
341
341
|
* and returns 0 if the file is up-to-date relative to the prior setting,
|
342
342
|
* 1 if the file has been changed, or GIT_ENOTFOUND if the file doesn't
|
343
|
-
* exist. This will not call
|
343
|
+
* exist. This will not call git_error_set, so you must set the error if you
|
344
344
|
* plan to return an error.
|
345
345
|
*
|
346
346
|
* @param stamp File stamp to be checked
|
data/vendor/libgit2/src/filter.c
CHANGED
@@ -157,15 +157,15 @@ static int filter_registry_insert(
|
|
157
157
|
if (filter_def_scan_attrs(&attrs, &nattr, &nmatch, filter->attributes) < 0)
|
158
158
|
return -1;
|
159
159
|
|
160
|
-
|
161
|
-
|
162
|
-
|
160
|
+
GIT_ERROR_CHECK_ALLOC_MULTIPLY(&alloc_len, nattr, 2);
|
161
|
+
GIT_ERROR_CHECK_ALLOC_MULTIPLY(&alloc_len, alloc_len, sizeof(char *));
|
162
|
+
GIT_ERROR_CHECK_ALLOC_ADD(&alloc_len, alloc_len, sizeof(git_filter_def));
|
163
163
|
|
164
164
|
fdef = git__calloc(1, alloc_len);
|
165
|
-
|
165
|
+
GIT_ERROR_CHECK_ALLOC(fdef);
|
166
166
|
|
167
167
|
fdef->filter_name = git__strdup(name);
|
168
|
-
|
168
|
+
GIT_ERROR_CHECK_ALLOC(fdef->filter_name);
|
169
169
|
|
170
170
|
fdef->filter = filter;
|
171
171
|
fdef->priority = priority;
|
@@ -269,13 +269,13 @@ int git_filter_register(
|
|
269
269
|
assert(name && filter);
|
270
270
|
|
271
271
|
if (git_rwlock_wrlock(&filter_registry.lock) < 0) {
|
272
|
-
|
272
|
+
git_error_set(GIT_ERROR_OS, "failed to lock filter registry");
|
273
273
|
return -1;
|
274
274
|
}
|
275
275
|
|
276
276
|
if (!filter_registry_find(NULL, name)) {
|
277
|
-
|
278
|
-
|
277
|
+
git_error_set(
|
278
|
+
GIT_ERROR_FILTER, "attempt to reregister existing filter '%s'", name);
|
279
279
|
error = GIT_EEXISTS;
|
280
280
|
goto done;
|
281
281
|
}
|
@@ -297,17 +297,17 @@ int git_filter_unregister(const char *name)
|
|
297
297
|
|
298
298
|
/* cannot unregister default filters */
|
299
299
|
if (!strcmp(GIT_FILTER_CRLF, name) || !strcmp(GIT_FILTER_IDENT, name)) {
|
300
|
-
|
300
|
+
git_error_set(GIT_ERROR_FILTER, "cannot unregister filter '%s'", name);
|
301
301
|
return -1;
|
302
302
|
}
|
303
303
|
|
304
304
|
if (git_rwlock_wrlock(&filter_registry.lock) < 0) {
|
305
|
-
|
305
|
+
git_error_set(GIT_ERROR_OS, "failed to lock filter registry");
|
306
306
|
return -1;
|
307
307
|
}
|
308
308
|
|
309
309
|
if ((fdef = filter_registry_lookup(&pos, name)) == NULL) {
|
310
|
-
|
310
|
+
git_error_set(GIT_ERROR_FILTER, "cannot find filter '%s' to unregister", name);
|
311
311
|
error = GIT_ENOTFOUND;
|
312
312
|
goto done;
|
313
313
|
}
|
@@ -348,7 +348,7 @@ git_filter *git_filter_lookup(const char *name)
|
|
348
348
|
git_filter *filter = NULL;
|
349
349
|
|
350
350
|
if (git_rwlock_rdlock(&filter_registry.lock) < 0) {
|
351
|
-
|
351
|
+
git_error_set(GIT_ERROR_OS, "failed to lock filter registry");
|
352
352
|
return NULL;
|
353
353
|
}
|
354
354
|
|
@@ -404,11 +404,11 @@ static int filter_list_new(
|
|
404
404
|
git_filter_list *fl = NULL;
|
405
405
|
size_t pathlen = src->path ? strlen(src->path) : 0, alloclen;
|
406
406
|
|
407
|
-
|
408
|
-
|
407
|
+
GIT_ERROR_CHECK_ALLOC_ADD(&alloclen, sizeof(git_filter_list), pathlen);
|
408
|
+
GIT_ERROR_CHECK_ALLOC_ADD(&alloclen, alloclen, 1);
|
409
409
|
|
410
410
|
fl = git__calloc(1, alloclen);
|
411
|
-
|
411
|
+
GIT_ERROR_CHECK_ALLOC(fl);
|
412
412
|
|
413
413
|
if (src->path)
|
414
414
|
memcpy(fl->path, src->path, pathlen);
|
@@ -431,14 +431,14 @@ static int filter_list_check_attributes(
|
|
431
431
|
int error;
|
432
432
|
size_t i;
|
433
433
|
const char **strs = git__calloc(fdef->nattrs, sizeof(const char *));
|
434
|
-
|
434
|
+
GIT_ERROR_CHECK_ALLOC(strs);
|
435
435
|
|
436
436
|
error = git_attr_get_many_with_session(
|
437
437
|
strs, repo, attr_session, 0, src->path, fdef->nattrs, fdef->attrs);
|
438
438
|
|
439
439
|
/* if no values were found but no matches are needed, it's okay! */
|
440
440
|
if (error == GIT_ENOTFOUND && !fdef->nmatches) {
|
441
|
-
|
441
|
+
git_error_clear();
|
442
442
|
git__free((void *)strs);
|
443
443
|
return 0;
|
444
444
|
}
|
@@ -499,7 +499,7 @@ int git_filter_list__load_ext(
|
|
499
499
|
git_filter_def *fdef;
|
500
500
|
|
501
501
|
if (git_rwlock_rdlock(&filter_registry.lock) < 0) {
|
502
|
-
|
502
|
+
git_error_set(GIT_ERROR_OS, "failed to lock filter registry");
|
503
503
|
return -1;
|
504
504
|
}
|
505
505
|
|
@@ -551,7 +551,7 @@ int git_filter_list__load_ext(
|
|
551
551
|
}
|
552
552
|
|
553
553
|
fe = git_array_alloc(fl->filters);
|
554
|
-
|
554
|
+
GIT_ERROR_CHECK_ALLOC(fe);
|
555
555
|
|
556
556
|
fe->filter = fdef->filter;
|
557
557
|
fe->filter_name = fdef->filter_name;
|
@@ -634,7 +634,7 @@ int git_filter_list_push(
|
|
634
634
|
assert(fl && filter);
|
635
635
|
|
636
636
|
if (git_rwlock_rdlock(&filter_registry.lock) < 0) {
|
637
|
-
|
637
|
+
git_error_set(GIT_ERROR_OS, "failed to lock filter registry");
|
638
638
|
return -1;
|
639
639
|
}
|
640
640
|
|
@@ -646,7 +646,7 @@ int git_filter_list_push(
|
|
646
646
|
git_rwlock_rdunlock(&filter_registry.lock);
|
647
647
|
|
648
648
|
if (fdef == NULL) {
|
649
|
-
|
649
|
+
git_error_set(GIT_ERROR_FILTER, "cannot use an unregistered filter");
|
650
650
|
return -1;
|
651
651
|
}
|
652
652
|
|
@@ -654,7 +654,7 @@ int git_filter_list_push(
|
|
654
654
|
return error;
|
655
655
|
|
656
656
|
fe = git_array_alloc(fl->filters);
|
657
|
-
|
657
|
+
GIT_ERROR_CHECK_ALLOC(fe);
|
658
658
|
fe->filter = filter;
|
659
659
|
fe->payload = payload;
|
660
660
|
|
@@ -759,7 +759,7 @@ static int buf_from_blob(git_buf *out, git_blob *blob)
|
|
759
759
|
git_off_t rawsize = git_blob_rawsize(blob);
|
760
760
|
|
761
761
|
if (!git__is_sizet(rawsize)) {
|
762
|
-
|
762
|
+
git_error_set(GIT_ERROR_OS, "blob is too large to filter");
|
763
763
|
return -1;
|
764
764
|
}
|
765
765
|
|
@@ -829,9 +829,9 @@ static int proxy_stream_close(git_writestream *s)
|
|
829
829
|
} else {
|
830
830
|
/* close stream before erroring out taking care
|
831
831
|
* to preserve the original error */
|
832
|
-
|
832
|
+
git_error_state_capture(&error_state, error);
|
833
833
|
proxy_stream->target->close(proxy_stream->target);
|
834
|
-
|
834
|
+
git_error_state_restore(&error_state);
|
835
835
|
return error;
|
836
836
|
}
|
837
837
|
|
@@ -847,8 +847,8 @@ static void proxy_stream_free(git_writestream *s)
|
|
847
847
|
struct proxy_stream *proxy_stream = (struct proxy_stream *)s;
|
848
848
|
assert(proxy_stream);
|
849
849
|
|
850
|
-
|
851
|
-
|
850
|
+
git_buf_dispose(&proxy_stream->input);
|
851
|
+
git_buf_dispose(&proxy_stream->temp_buf);
|
852
852
|
git__free(proxy_stream);
|
853
853
|
}
|
854
854
|
|
@@ -861,7 +861,7 @@ static int proxy_stream_init(
|
|
861
861
|
git_writestream *target)
|
862
862
|
{
|
863
863
|
struct proxy_stream *proxy_stream = git__calloc(1, sizeof(struct proxy_stream));
|
864
|
-
|
864
|
+
GIT_ERROR_CHECK_ALLOC(proxy_stream);
|
865
865
|
|
866
866
|
proxy_stream->parent.write = proxy_stream_write;
|
867
867
|
proxy_stream->parent.close = proxy_stream_close;
|
@@ -974,7 +974,7 @@ int git_filter_list_stream_file(
|
|
974
974
|
}
|
975
975
|
|
976
976
|
if (readlen < 0)
|
977
|
-
error =
|
977
|
+
error = -1;
|
978
978
|
|
979
979
|
done:
|
980
980
|
if (initialized)
|
@@ -983,7 +983,7 @@ done:
|
|
983
983
|
if (fd >= 0)
|
984
984
|
p_close(fd);
|
985
985
|
stream_list_free(&filter_streams);
|
986
|
-
|
986
|
+
git_buf_dispose(&abspath);
|
987
987
|
return error;
|
988
988
|
}
|
989
989
|
|
data/vendor/libgit2/src/filter.h
CHANGED
@@ -15,16 +15,6 @@
|
|
15
15
|
/* Amount of file to examine for NUL byte when checking binary-ness */
|
16
16
|
#define GIT_FILTER_BYTES_TO_CHECK_NUL 8000
|
17
17
|
|
18
|
-
/* Possible CRLF values */
|
19
|
-
typedef enum {
|
20
|
-
GIT_CRLF_GUESS = -1,
|
21
|
-
GIT_CRLF_BINARY = 0,
|
22
|
-
GIT_CRLF_TEXT,
|
23
|
-
GIT_CRLF_INPUT,
|
24
|
-
GIT_CRLF_CRLF,
|
25
|
-
GIT_CRLF_AUTO,
|
26
|
-
} git_crlf_t;
|
27
|
-
|
28
18
|
typedef struct {
|
29
19
|
git_attr_session *attr_session;
|
30
20
|
git_buf *temp_buf;
|
data/vendor/libgit2/src/global.c
CHANGED
@@ -7,11 +7,13 @@
|
|
7
7
|
|
8
8
|
#include "global.h"
|
9
9
|
|
10
|
+
#include "alloc.h"
|
10
11
|
#include "hash.h"
|
11
12
|
#include "sysdir.h"
|
12
13
|
#include "filter.h"
|
13
14
|
#include "merge_driver.h"
|
14
|
-
#include "streams/
|
15
|
+
#include "streams/registry.h"
|
16
|
+
#include "streams/mbedtls.h"
|
15
17
|
#include "streams/openssl.h"
|
16
18
|
#include "thread-utils.h"
|
17
19
|
#include "git2/global.h"
|
@@ -24,9 +26,23 @@
|
|
24
26
|
|
25
27
|
git_mutex git__mwindow_mutex;
|
26
28
|
|
27
|
-
|
29
|
+
typedef int (*git_global_init_fn)(void);
|
30
|
+
|
31
|
+
static git_global_init_fn git__init_callbacks[] = {
|
32
|
+
git_allocator_global_init,
|
33
|
+
git_hash_global_init,
|
34
|
+
git_sysdir_global_init,
|
35
|
+
git_filter_global_init,
|
36
|
+
git_merge_driver_global_init,
|
37
|
+
git_transport_ssh_global_init,
|
38
|
+
git_stream_registry_global_init,
|
39
|
+
git_openssl_stream_global_init,
|
40
|
+
git_mbedtls_stream_global_init,
|
41
|
+
git_mwindow_global_init
|
42
|
+
};
|
43
|
+
|
44
|
+
static git_global_shutdown_fn git__shutdown_callbacks[ARRAY_SIZE(git__init_callbacks)];
|
28
45
|
|
29
|
-
static git_global_shutdown_fn git__shutdown_callbacks[MAX_SHUTDOWN_CB];
|
30
46
|
static git_atomic git__n_shutdown_callbacks;
|
31
47
|
static git_atomic git__n_inits;
|
32
48
|
char *git__user_agent;
|
@@ -35,7 +51,7 @@ char *git__ssl_ciphers;
|
|
35
51
|
void git__on_shutdown(git_global_shutdown_fn callback)
|
36
52
|
{
|
37
53
|
int count = git_atomic_inc(&git__n_shutdown_callbacks);
|
38
|
-
assert(count <=
|
54
|
+
assert(count <= (int) ARRAY_SIZE(git__shutdown_callbacks) && count > 0);
|
39
55
|
git__shutdown_callbacks[count - 1] = callback;
|
40
56
|
}
|
41
57
|
|
@@ -50,6 +66,7 @@ static void git__global_state_cleanup(git_global_st *st)
|
|
50
66
|
|
51
67
|
static int init_common(void)
|
52
68
|
{
|
69
|
+
size_t i;
|
53
70
|
int ret;
|
54
71
|
|
55
72
|
/* Initialize the CRT debug allocator first, before our first malloc */
|
@@ -58,15 +75,10 @@ static int init_common(void)
|
|
58
75
|
git_win32__stack_init();
|
59
76
|
#endif
|
60
77
|
|
61
|
-
/* Initialize
|
62
|
-
|
63
|
-
(ret =
|
64
|
-
|
65
|
-
(ret = git_merge_driver_global_init()) == 0 &&
|
66
|
-
(ret = git_transport_ssh_global_init()) == 0 &&
|
67
|
-
(ret = git_openssl_stream_global_init()) == 0 &&
|
68
|
-
(ret = git_curl_stream_global_init()) == 0)
|
69
|
-
ret = git_mwindow_global_init();
|
78
|
+
/* Initialize subsystems that have global state */
|
79
|
+
for (i = 0; i < ARRAY_SIZE(git__init_callbacks); i++)
|
80
|
+
if ((ret = git__init_callbacks[i]()) != 0)
|
81
|
+
break;
|
70
82
|
|
71
83
|
GIT_MEMORY_BARRIER;
|
72
84
|
|
@@ -274,10 +286,10 @@ int git_libgit2_init(void)
|
|
274
286
|
{
|
275
287
|
int ret, err;
|
276
288
|
|
277
|
-
ret = git_atomic_inc(&git__n_inits);
|
278
|
-
|
279
289
|
if ((err = pthread_mutex_lock(&_init_mutex)) != 0)
|
280
290
|
return err;
|
291
|
+
|
292
|
+
ret = git_atomic_inc(&git__n_inits);
|
281
293
|
err = pthread_once(&_once_init, init_once);
|
282
294
|
err |= pthread_mutex_unlock(&_init_mutex);
|
283
295
|
|
@@ -291,13 +303,13 @@ int git_libgit2_shutdown(void)
|
|
291
303
|
{
|
292
304
|
void *ptr = NULL;
|
293
305
|
pthread_once_t new_once = PTHREAD_ONCE_INIT;
|
294
|
-
int ret;
|
306
|
+
int error, ret;
|
295
307
|
|
296
|
-
if ((
|
297
|
-
return
|
308
|
+
if ((error = pthread_mutex_lock(&_init_mutex)) != 0)
|
309
|
+
return error;
|
298
310
|
|
299
|
-
if ((ret =
|
300
|
-
|
311
|
+
if ((ret = git_atomic_dec(&git__n_inits)) != 0)
|
312
|
+
goto out;
|
301
313
|
|
302
314
|
/* Shut down any subsystems that have global state */
|
303
315
|
shutdown_common();
|
@@ -312,10 +324,11 @@ int git_libgit2_shutdown(void)
|
|
312
324
|
git_mutex_free(&git__mwindow_mutex);
|
313
325
|
_once_init = new_once;
|
314
326
|
|
315
|
-
|
316
|
-
|
327
|
+
out:
|
328
|
+
if ((error = pthread_mutex_unlock(&_init_mutex)) != 0)
|
329
|
+
return error;
|
317
330
|
|
318
|
-
return
|
331
|
+
return ret;
|
319
332
|
}
|
320
333
|
|
321
334
|
git_global_st *git__global_state(void)
|
data/vendor/libgit2/src/hash.h
CHANGED
@@ -14,7 +14,6 @@
|
|
14
14
|
typedef struct git_hash_prov git_hash_prov;
|
15
15
|
typedef struct git_hash_ctx git_hash_ctx;
|
16
16
|
|
17
|
-
int git_hash_global_init(void);
|
18
17
|
int git_hash_ctx_init(git_hash_ctx *ctx);
|
19
18
|
void git_hash_ctx_cleanup(git_hash_ctx *ctx);
|
20
19
|
|
@@ -26,10 +25,14 @@ void git_hash_ctx_cleanup(git_hash_ctx *ctx);
|
|
26
25
|
# include "hash/hash_openssl.h"
|
27
26
|
#elif defined(GIT_SHA1_WIN32)
|
28
27
|
# include "hash/hash_win32.h"
|
28
|
+
#elif defined(GIT_SHA1_MBEDTLS)
|
29
|
+
# include "hash/hash_mbedtls.h"
|
29
30
|
#else
|
30
31
|
# include "hash/hash_generic.h"
|
31
32
|
#endif
|
32
33
|
|
34
|
+
int git_hash_global_init(void);
|
35
|
+
|
33
36
|
typedef struct {
|
34
37
|
void *data;
|
35
38
|
size_t len;
|
@@ -15,10 +15,14 @@ struct git_hash_ctx {
|
|
15
15
|
SHA1_CTX c;
|
16
16
|
};
|
17
17
|
|
18
|
-
#define git_hash_global_init() 0
|
19
18
|
#define git_hash_ctx_init(ctx) git_hash_init(ctx)
|
20
19
|
#define git_hash_ctx_cleanup(ctx)
|
21
20
|
|
21
|
+
GIT_INLINE(int) git_hash_global_init(void)
|
22
|
+
{
|
23
|
+
return 0;
|
24
|
+
}
|
25
|
+
|
22
26
|
GIT_INLINE(int) git_hash_init(git_hash_ctx *ctx)
|
23
27
|
{
|
24
28
|
assert(ctx);
|
@@ -37,7 +41,7 @@ GIT_INLINE(int) git_hash_final(git_oid *out, git_hash_ctx *ctx)
|
|
37
41
|
{
|
38
42
|
assert(ctx);
|
39
43
|
if (SHA1DCFinal(out->id, &ctx->c)) {
|
40
|
-
|
44
|
+
git_error_set(GIT_ERROR_SHA1, "SHA1 collision attack detected");
|
41
45
|
return -1;
|
42
46
|
}
|
43
47
|
|
@@ -18,10 +18,14 @@ struct git_hash_ctx {
|
|
18
18
|
|
19
19
|
#define CC_LONG_MAX ((CC_LONG)-1)
|
20
20
|
|
21
|
-
#define git_hash_global_init() 0
|
22
21
|
#define git_hash_ctx_init(ctx) git_hash_init(ctx)
|
23
22
|
#define git_hash_ctx_cleanup(ctx)
|
24
23
|
|
24
|
+
GIT_INLINE(int) git_hash_global_init(void)
|
25
|
+
{
|
26
|
+
return 0;
|
27
|
+
}
|
28
|
+
|
25
29
|
GIT_INLINE(int) git_hash_init(git_hash_ctx *ctx)
|
26
30
|
{
|
27
31
|
assert(ctx);
|
@@ -18,8 +18,12 @@ struct git_hash_ctx {
|
|
18
18
|
unsigned int W[16];
|
19
19
|
};
|
20
20
|
|
21
|
-
#define git_hash_global_init() 0
|
22
21
|
#define git_hash_ctx_init(ctx) git_hash_init(ctx)
|
23
22
|
#define git_hash_ctx_cleanup(ctx)
|
24
23
|
|
24
|
+
GIT_INLINE(int) git_hash_global_init(void)
|
25
|
+
{
|
26
|
+
return 0;
|
27
|
+
}
|
28
|
+
|
25
29
|
#endif
|
@@ -0,0 +1,38 @@
|
|
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
|
+
|
8
|
+
#include "common.h"
|
9
|
+
#include "hash.h"
|
10
|
+
#include "hash/hash_mbedtls.h"
|
11
|
+
|
12
|
+
void git_hash_ctx_cleanup(git_hash_ctx *ctx)
|
13
|
+
{
|
14
|
+
assert(ctx);
|
15
|
+
mbedtls_sha1_free(&ctx->c);
|
16
|
+
}
|
17
|
+
|
18
|
+
int git_hash_init(git_hash_ctx *ctx)
|
19
|
+
{
|
20
|
+
assert(ctx);
|
21
|
+
mbedtls_sha1_init(&ctx->c);
|
22
|
+
mbedtls_sha1_starts(&ctx->c);
|
23
|
+
return 0;
|
24
|
+
}
|
25
|
+
|
26
|
+
int git_hash_update(git_hash_ctx *ctx, const void *data, size_t len)
|
27
|
+
{
|
28
|
+
assert(ctx);
|
29
|
+
mbedtls_sha1_update(&ctx->c, data, len);
|
30
|
+
return 0;
|
31
|
+
}
|
32
|
+
|
33
|
+
int git_hash_final(git_oid *out, git_hash_ctx *ctx)
|
34
|
+
{
|
35
|
+
assert(ctx);
|
36
|
+
mbedtls_sha1_finish(&ctx->c, out->id);
|
37
|
+
return 0;
|
38
|
+
}
|