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
@@ -131,7 +131,7 @@ int git_diff__merge(
|
|
131
131
|
|
132
132
|
if (ignore_case != ((from->opts.flags & GIT_DIFF_IGNORE_CASE) != 0) ||
|
133
133
|
reversed != ((from->opts.flags & GIT_DIFF_REVERSE) != 0)) {
|
134
|
-
|
134
|
+
git_error_set(GIT_ERROR_INVALID,
|
135
135
|
"attempt to merge diffs created with conflicting options");
|
136
136
|
return -1;
|
137
137
|
}
|
@@ -251,7 +251,7 @@ static int normalize_find_opts(
|
|
251
251
|
git_config *cfg = NULL;
|
252
252
|
git_hashsig_option_t hashsig_opts;
|
253
253
|
|
254
|
-
|
254
|
+
GIT_ERROR_CHECK_VERSION(given, GIT_DIFF_FIND_OPTIONS_VERSION, "git_diff_find_options");
|
255
255
|
|
256
256
|
if (diff->repo != NULL &&
|
257
257
|
git_repository_config__weakptr(&cfg, diff->repo) < 0)
|
@@ -332,7 +332,7 @@ static int normalize_find_opts(
|
|
332
332
|
/* assign the internal metric with whitespace flag as payload */
|
333
333
|
if (!opts->metric) {
|
334
334
|
opts->metric = git__malloc(sizeof(git_diff_similarity_metric));
|
335
|
-
|
335
|
+
GIT_ERROR_CHECK_ALLOC(opts->metric);
|
336
336
|
|
337
337
|
opts->metric->file_signature = git_diff_find_similar__hashsig_for_file;
|
338
338
|
opts->metric->buffer_signature = git_diff_find_similar__hashsig_for_buf;
|
@@ -357,7 +357,7 @@ static int insert_delete_side_of_split(
|
|
357
357
|
{
|
358
358
|
/* make new record for DELETED side of split */
|
359
359
|
git_diff_delta *deleted = git_diff__delta_dup(delta, &diff->pool);
|
360
|
-
|
360
|
+
GIT_ERROR_CHECK_ALLOC(deleted);
|
361
361
|
|
362
362
|
deleted->status = GIT_DELTA_DELETED;
|
363
363
|
deleted->nfiles = 1;
|
@@ -496,13 +496,13 @@ static int similarity_sig(
|
|
496
496
|
if (info->odb_obj != NULL)
|
497
497
|
error = git_object__from_odb_object(
|
498
498
|
(git_object **)&info->blob, info->repo,
|
499
|
-
info->odb_obj,
|
499
|
+
info->odb_obj, GIT_OBJECT_BLOB);
|
500
500
|
else
|
501
501
|
error = git_blob_lookup(&info->blob, info->repo, &file->id);
|
502
502
|
|
503
503
|
if (error < 0) {
|
504
504
|
/* if lookup fails, just skip this item in similarity calc */
|
505
|
-
|
505
|
+
git_error_clear();
|
506
506
|
} else {
|
507
507
|
size_t sz;
|
508
508
|
|
@@ -529,7 +529,7 @@ static void similarity_unload(similarity_info *info)
|
|
529
529
|
if (info->blob)
|
530
530
|
git_blob_free(info->blob);
|
531
531
|
else
|
532
|
-
|
532
|
+
git_buf_dispose(&info->data);
|
533
533
|
}
|
534
534
|
|
535
535
|
#define FLAG_SET(opts,flag_name) (((opts)->flags & flag_name) != 0)
|
@@ -831,9 +831,9 @@ int git_diff_find_similar(
|
|
831
831
|
if ((opts.flags & GIT_DIFF_FIND_ALL) == 0)
|
832
832
|
goto cleanup;
|
833
833
|
|
834
|
-
|
834
|
+
GIT_ERROR_CHECK_ALLOC_MULTIPLY(&sigcache_size, num_deltas, 2);
|
835
835
|
sigcache = git__calloc(sigcache_size, sizeof(void *));
|
836
|
-
|
836
|
+
GIT_ERROR_CHECK_ALLOC(sigcache);
|
837
837
|
|
838
838
|
/* Label rename sources and targets
|
839
839
|
*
|
@@ -856,13 +856,13 @@ int git_diff_find_similar(
|
|
856
856
|
goto cleanup;
|
857
857
|
|
858
858
|
src2tgt = git__calloc(num_deltas, sizeof(diff_find_match));
|
859
|
-
|
859
|
+
GIT_ERROR_CHECK_ALLOC(src2tgt);
|
860
860
|
tgt2src = git__calloc(num_deltas, sizeof(diff_find_match));
|
861
|
-
|
861
|
+
GIT_ERROR_CHECK_ALLOC(tgt2src);
|
862
862
|
|
863
863
|
if (FLAG_SET(&opts, GIT_DIFF_FIND_COPIES)) {
|
864
864
|
tgt2src_copy = git__calloc(num_deltas, sizeof(diff_find_match));
|
865
|
-
|
865
|
+
GIT_ERROR_CHECK_ALLOC(tgt2src_copy);
|
866
866
|
}
|
867
867
|
|
868
868
|
/*
|
@@ -6,6 +6,7 @@
|
|
6
6
|
*/
|
7
7
|
|
8
8
|
#include "diff_xdiff.h"
|
9
|
+
#include "util.h"
|
9
10
|
|
10
11
|
#include "git2/errors.h"
|
11
12
|
#include "diff.h"
|
@@ -51,7 +52,7 @@ static int git_xdiff_parse_hunk(git_diff_hunk *hunk, const char *header)
|
|
51
52
|
return 0;
|
52
53
|
|
53
54
|
fail:
|
54
|
-
|
55
|
+
git_error_set(GIT_ERROR_INVALID, "malformed hunk header from xdiff");
|
55
56
|
return -1;
|
56
57
|
}
|
57
58
|
|
@@ -100,7 +101,7 @@ static int diff_update_lines(
|
|
100
101
|
info->new_lineno += (int)line->num_lines;
|
101
102
|
break;
|
102
103
|
default:
|
103
|
-
|
104
|
+
git_error_set(GIT_ERROR_INVALID, "unknown diff line origin %02x",
|
104
105
|
(unsigned int)line->origin);
|
105
106
|
return -1;
|
106
107
|
}
|
@@ -115,6 +116,7 @@ static int git_xdiff_cb(void *priv, mmbuffer_t *bufs, int len)
|
|
115
116
|
const git_diff_delta *delta = patch->base.delta;
|
116
117
|
git_patch_generated_output *output = &info->xo->output;
|
117
118
|
git_diff_line line;
|
119
|
+
size_t buffer_len;
|
118
120
|
|
119
121
|
if (len == 1) {
|
120
122
|
output->error = git_xdiff_parse_hunk(&info->hunk, bufs[0].ptr);
|
@@ -124,6 +126,16 @@ static int git_xdiff_cb(void *priv, mmbuffer_t *bufs, int len)
|
|
124
126
|
info->hunk.header_len = bufs[0].size;
|
125
127
|
if (info->hunk.header_len >= sizeof(info->hunk.header))
|
126
128
|
info->hunk.header_len = sizeof(info->hunk.header) - 1;
|
129
|
+
|
130
|
+
/* Sanitize the hunk header in case there is invalid Unicode */
|
131
|
+
buffer_len = git__utf8_valid_buf_length((const uint8_t *) bufs[0].ptr, info->hunk.header_len);
|
132
|
+
/* Sanitizing the hunk header may delete the newline, so add it back again if there is room */
|
133
|
+
if (buffer_len < info->hunk.header_len) {
|
134
|
+
bufs[0].ptr[buffer_len] = '\n';
|
135
|
+
buffer_len += 1;
|
136
|
+
info->hunk.header_len = buffer_len;
|
137
|
+
}
|
138
|
+
|
127
139
|
memcpy(info->hunk.header, bufs[0].ptr, info->hunk.header_len);
|
128
140
|
info->hunk.header[info->hunk.header_len] = '\0';
|
129
141
|
|
@@ -212,7 +224,7 @@ static int git_xdiff(git_patch_generated_output *output, git_patch_generated *pa
|
|
212
224
|
|
213
225
|
if (info.xd_old_data.size > GIT_XDIFF_MAX_SIZE ||
|
214
226
|
info.xd_new_data.size > GIT_XDIFF_MAX_SIZE) {
|
215
|
-
|
227
|
+
git_error_set(GIT_ERROR_INVALID, "files too large for diff");
|
216
228
|
return -1;
|
217
229
|
}
|
218
230
|
|
data/vendor/libgit2/src/errors.c
CHANGED
@@ -17,7 +17,7 @@
|
|
17
17
|
|
18
18
|
static git_error g_git_oom_error = {
|
19
19
|
"Out of memory",
|
20
|
-
|
20
|
+
GIT_ERROR_NOMEMORY
|
21
21
|
};
|
22
22
|
|
23
23
|
static void set_error_from_buffer(int error_class)
|
@@ -44,18 +44,18 @@ static void set_error(int error_class, char *string)
|
|
44
44
|
set_error_from_buffer(error_class);
|
45
45
|
}
|
46
46
|
|
47
|
-
void
|
47
|
+
void git_error_set_oom(void)
|
48
48
|
{
|
49
49
|
GIT_GLOBAL->last_error = &g_git_oom_error;
|
50
50
|
}
|
51
51
|
|
52
|
-
void
|
52
|
+
void git_error_set(int error_class, const char *string, ...)
|
53
53
|
{
|
54
54
|
va_list arglist;
|
55
55
|
#ifdef GIT_WIN32
|
56
|
-
DWORD win32_error_code = (error_class ==
|
56
|
+
DWORD win32_error_code = (error_class == GIT_ERROR_OS) ? GetLastError() : 0;
|
57
57
|
#endif
|
58
|
-
int error_code = (error_class ==
|
58
|
+
int error_code = (error_class == GIT_ERROR_OS) ? errno : 0;
|
59
59
|
git_buf *buf = &GIT_GLOBAL->error_buf;
|
60
60
|
|
61
61
|
git_buf_clear(buf);
|
@@ -64,11 +64,11 @@ void giterr_set(int error_class, const char *string, ...)
|
|
64
64
|
git_buf_vprintf(buf, string, arglist);
|
65
65
|
va_end(arglist);
|
66
66
|
|
67
|
-
if (error_class ==
|
67
|
+
if (error_class == GIT_ERROR_OS)
|
68
68
|
git_buf_PUTS(buf, ": ");
|
69
69
|
}
|
70
70
|
|
71
|
-
if (error_class ==
|
71
|
+
if (error_class == GIT_ERROR_OS) {
|
72
72
|
#ifdef GIT_WIN32
|
73
73
|
char * win32_error = git_win32_get_error_message(win32_error_code);
|
74
74
|
if (win32_error) {
|
@@ -90,7 +90,7 @@ void giterr_set(int error_class, const char *string, ...)
|
|
90
90
|
set_error_from_buffer(error_class);
|
91
91
|
}
|
92
92
|
|
93
|
-
void
|
93
|
+
void git_error_set_str(int error_class, const char *string)
|
94
94
|
{
|
95
95
|
git_buf *buf = &GIT_GLOBAL->error_buf;
|
96
96
|
|
@@ -105,14 +105,14 @@ void giterr_set_str(int error_class, const char *string)
|
|
105
105
|
set_error_from_buffer(error_class);
|
106
106
|
}
|
107
107
|
|
108
|
-
int
|
108
|
+
int git_error_set_regex(const regex_t *regex, int error_code)
|
109
109
|
{
|
110
110
|
char error_buf[1024];
|
111
111
|
|
112
112
|
assert(error_code);
|
113
113
|
|
114
114
|
regerror(error_code, regex, error_buf, sizeof(error_buf));
|
115
|
-
|
115
|
+
git_error_set_str(GIT_ERROR_REGEX, error_buf);
|
116
116
|
|
117
117
|
if (error_code == REG_NOMATCH)
|
118
118
|
return GIT_ENOTFOUND;
|
@@ -120,7 +120,7 @@ int giterr_set_regex(const regex_t *regex, int error_code)
|
|
120
120
|
return GIT_EINVALIDSPEC;
|
121
121
|
}
|
122
122
|
|
123
|
-
void
|
123
|
+
void git_error_clear(void)
|
124
124
|
{
|
125
125
|
if (GIT_GLOBAL->last_error != NULL) {
|
126
126
|
set_error(0, NULL);
|
@@ -133,12 +133,12 @@ void giterr_clear(void)
|
|
133
133
|
#endif
|
134
134
|
}
|
135
135
|
|
136
|
-
const git_error *
|
136
|
+
const git_error *git_error_last(void)
|
137
137
|
{
|
138
138
|
return GIT_GLOBAL->last_error;
|
139
139
|
}
|
140
140
|
|
141
|
-
int
|
141
|
+
int git_error_state_capture(git_error_state *state, int error_code)
|
142
142
|
{
|
143
143
|
git_error *error = GIT_GLOBAL->last_error;
|
144
144
|
git_buf *error_buf = &GIT_GLOBAL->error_buf;
|
@@ -160,19 +160,19 @@ int giterr_state_capture(git_error_state *state, int error_code)
|
|
160
160
|
state->error_msg.message = git_buf_detach(error_buf);
|
161
161
|
}
|
162
162
|
|
163
|
-
|
163
|
+
git_error_clear();
|
164
164
|
return error_code;
|
165
165
|
}
|
166
166
|
|
167
|
-
int
|
167
|
+
int git_error_state_restore(git_error_state *state)
|
168
168
|
{
|
169
169
|
int ret = 0;
|
170
170
|
|
171
|
-
|
171
|
+
git_error_clear();
|
172
172
|
|
173
173
|
if (state && state->error_msg.message) {
|
174
174
|
if (state->oom)
|
175
|
-
|
175
|
+
git_error_set_oom();
|
176
176
|
else
|
177
177
|
set_error(state->error_msg.klass, state->error_msg.message);
|
178
178
|
|
@@ -183,7 +183,7 @@ int giterr_state_restore(git_error_state *state)
|
|
183
183
|
return ret;
|
184
184
|
}
|
185
185
|
|
186
|
-
void
|
186
|
+
void git_error_state_free(git_error_state *state)
|
187
187
|
{
|
188
188
|
if (!state)
|
189
189
|
return;
|
@@ -194,7 +194,7 @@ void giterr_state_free(git_error_state *state)
|
|
194
194
|
memset(state, 0, sizeof(git_error_state));
|
195
195
|
}
|
196
196
|
|
197
|
-
int
|
197
|
+
int git_error_system_last(void)
|
198
198
|
{
|
199
199
|
#ifdef GIT_WIN32
|
200
200
|
return GetLastError();
|
@@ -203,7 +203,7 @@ int giterr_system_last(void)
|
|
203
203
|
#endif
|
204
204
|
}
|
205
205
|
|
206
|
-
void
|
206
|
+
void git_error_system_set(int code)
|
207
207
|
{
|
208
208
|
#ifdef GIT_WIN32
|
209
209
|
SetLastError(code);
|
@@ -211,3 +211,25 @@ void giterr_system_set(int code)
|
|
211
211
|
errno = code;
|
212
212
|
#endif
|
213
213
|
}
|
214
|
+
|
215
|
+
/* Deprecated error values and functions */
|
216
|
+
|
217
|
+
const git_error *giterr_last(void)
|
218
|
+
{
|
219
|
+
return git_error_last();
|
220
|
+
}
|
221
|
+
|
222
|
+
void giterr_clear(void)
|
223
|
+
{
|
224
|
+
git_error_clear();
|
225
|
+
}
|
226
|
+
|
227
|
+
void giterr_set_str(int error_class, const char *string)
|
228
|
+
{
|
229
|
+
git_error_set_str(error_class, string);
|
230
|
+
}
|
231
|
+
|
232
|
+
void giterr_set_oom(void)
|
233
|
+
{
|
234
|
+
git_error_set_oom();
|
235
|
+
}
|
@@ -22,15 +22,16 @@
|
|
22
22
|
|
23
23
|
#cmakedefine GIT_GSSAPI 1
|
24
24
|
#cmakedefine GIT_WINHTTP 1
|
25
|
-
#cmakedefine GIT_CURL 1
|
26
25
|
|
27
26
|
#cmakedefine GIT_HTTPS 1
|
28
27
|
#cmakedefine GIT_OPENSSL 1
|
29
28
|
#cmakedefine GIT_SECURE_TRANSPORT 1
|
29
|
+
#cmakedefine GIT_MBEDTLS 1
|
30
30
|
|
31
31
|
#cmakedefine GIT_SHA1_COLLISIONDETECT 1
|
32
32
|
#cmakedefine GIT_SHA1_WIN32 1
|
33
33
|
#cmakedefine GIT_SHA1_COMMON_CRYPTO 1
|
34
34
|
#cmakedefine GIT_SHA1_OPENSSL 1
|
35
|
+
#cmakedefine GIT_SHA1_MBEDTLS 1
|
35
36
|
|
36
37
|
#endif
|
data/vendor/libgit2/src/fetch.c
CHANGED
@@ -78,7 +78,7 @@ static int filter_wants(git_remote *remote, const git_fetch_options *opts)
|
|
78
78
|
goto cleanup;
|
79
79
|
|
80
80
|
error = git_refspec__dwim_one(&remote->active_refspecs, &head, &remote->refs);
|
81
|
-
|
81
|
+
git_refspec__dispose(&head);
|
82
82
|
|
83
83
|
if (error < 0)
|
84
84
|
goto cleanup;
|
@@ -96,7 +96,7 @@ static int filter_wants(git_remote *remote, const git_fetch_options *opts)
|
|
96
96
|
}
|
97
97
|
|
98
98
|
cleanup:
|
99
|
-
|
99
|
+
git_refspec__dispose(&tagspec);
|
100
100
|
|
101
101
|
return error;
|
102
102
|
}
|
@@ -113,7 +113,7 @@ int git_fetch_negotiate(git_remote *remote, const git_fetch_options *opts)
|
|
113
113
|
remote->need_pack = 0;
|
114
114
|
|
115
115
|
if (filter_wants(remote, opts) < 0) {
|
116
|
-
|
116
|
+
git_error_set(GIT_ERROR_NET, "failed to filter the reference list for wants");
|
117
117
|
return -1;
|
118
118
|
}
|
119
119
|
|
@@ -50,7 +50,7 @@ int git_fetchhead_ref_create(
|
|
50
50
|
*out = NULL;
|
51
51
|
|
52
52
|
fetchhead_ref = git__malloc(sizeof(git_fetchhead_ref));
|
53
|
-
|
53
|
+
GIT_ERROR_CHECK_ALLOC(fetchhead_ref);
|
54
54
|
|
55
55
|
memset(fetchhead_ref, 0x0, sizeof(git_fetchhead_ref));
|
56
56
|
|
@@ -119,11 +119,11 @@ int git_fetchhead_write(git_repository *repo, git_vector *fetchhead_refs)
|
|
119
119
|
return -1;
|
120
120
|
|
121
121
|
if (git_filebuf_open(&file, path.ptr, GIT_FILEBUF_APPEND, GIT_REFS_FILE_MODE) < 0) {
|
122
|
-
|
122
|
+
git_buf_dispose(&path);
|
123
123
|
return -1;
|
124
124
|
}
|
125
125
|
|
126
|
-
|
126
|
+
git_buf_dispose(&path);
|
127
127
|
|
128
128
|
git_vector_sort(fetchhead_refs);
|
129
129
|
|
@@ -148,7 +148,7 @@ static int fetchhead_ref_parse(
|
|
148
148
|
*remote_url = NULL;
|
149
149
|
|
150
150
|
if (!*line) {
|
151
|
-
|
151
|
+
git_error_set(GIT_ERROR_FETCHHEAD,
|
152
152
|
"empty line in FETCH_HEAD line %"PRIuZ, line_num);
|
153
153
|
return -1;
|
154
154
|
}
|
@@ -162,16 +162,16 @@ static int fetchhead_ref_parse(
|
|
162
162
|
}
|
163
163
|
|
164
164
|
if (strlen(oid_str) != GIT_OID_HEXSZ) {
|
165
|
-
|
165
|
+
git_error_set(GIT_ERROR_FETCHHEAD,
|
166
166
|
"invalid object ID in FETCH_HEAD line %"PRIuZ, line_num);
|
167
167
|
return -1;
|
168
168
|
}
|
169
169
|
|
170
170
|
if (git_oid_fromstr(oid, oid_str) < 0) {
|
171
|
-
const git_error *oid_err =
|
171
|
+
const git_error *oid_err = git_error_last();
|
172
172
|
const char *err_msg = oid_err ? oid_err->message : "invalid object ID";
|
173
173
|
|
174
|
-
|
174
|
+
git_error_set(GIT_ERROR_FETCHHEAD, "%s in FETCH_HEAD line %"PRIuZ,
|
175
175
|
err_msg, line_num);
|
176
176
|
return -1;
|
177
177
|
}
|
@@ -179,7 +179,7 @@ static int fetchhead_ref_parse(
|
|
179
179
|
/* Parse new data from newer git clients */
|
180
180
|
if (*line) {
|
181
181
|
if ((is_merge_str = git__strsep(&line, "\t")) == NULL) {
|
182
|
-
|
182
|
+
git_error_set(GIT_ERROR_FETCHHEAD,
|
183
183
|
"invalid description data in FETCH_HEAD line %"PRIuZ, line_num);
|
184
184
|
return -1;
|
185
185
|
}
|
@@ -189,13 +189,13 @@ static int fetchhead_ref_parse(
|
|
189
189
|
else if (strcmp(is_merge_str, "not-for-merge") == 0)
|
190
190
|
*is_merge = 0;
|
191
191
|
else {
|
192
|
-
|
192
|
+
git_error_set(GIT_ERROR_FETCHHEAD,
|
193
193
|
"invalid for-merge entry in FETCH_HEAD line %"PRIuZ, line_num);
|
194
194
|
return -1;
|
195
195
|
}
|
196
196
|
|
197
197
|
if ((desc = line) == NULL) {
|
198
|
-
|
198
|
+
git_error_set(GIT_ERROR_FETCHHEAD,
|
199
199
|
"invalid description in FETCH_HEAD line %"PRIuZ, line_num);
|
200
200
|
return -1;
|
201
201
|
}
|
@@ -212,7 +212,7 @@ static int fetchhead_ref_parse(
|
|
212
212
|
if (name) {
|
213
213
|
if ((desc = strstr(name, "' ")) == NULL ||
|
214
214
|
git__prefixcmp(desc, "' of ") != 0) {
|
215
|
-
|
215
|
+
git_error_set(GIT_ERROR_FETCHHEAD,
|
216
216
|
"invalid description in FETCH_HEAD line %"PRIuZ, line_num);
|
217
217
|
return -1;
|
218
218
|
}
|
@@ -271,21 +271,21 @@ int git_repository_fetchhead_foreach(git_repository *repo,
|
|
271
271
|
|
272
272
|
error = cb(ref_name, remote_url, &oid, is_merge, payload);
|
273
273
|
if (error) {
|
274
|
-
|
274
|
+
git_error_set_after_callback(error);
|
275
275
|
goto done;
|
276
276
|
}
|
277
277
|
}
|
278
278
|
|
279
279
|
if (*buffer) {
|
280
|
-
|
280
|
+
git_error_set(GIT_ERROR_FETCHHEAD, "no EOL at line %"PRIuZ, line_num+1);
|
281
281
|
error = -1;
|
282
282
|
goto done;
|
283
283
|
}
|
284
284
|
|
285
285
|
done:
|
286
|
-
|
287
|
-
|
288
|
-
|
286
|
+
git_buf_dispose(&file);
|
287
|
+
git_buf_dispose(&path);
|
288
|
+
git_buf_dispose(&name);
|
289
289
|
|
290
290
|
return error;
|
291
291
|
}
|