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
@@ -161,7 +161,7 @@ int git_diff_file_content__init_from_src(
|
|
161
161
|
fc->flags |= GIT_DIFF_FLAG__FREE_BLOB;
|
162
162
|
} else {
|
163
163
|
fc->file->size = src->buflen;
|
164
|
-
git_odb_hash(&fc->file->id, src->buf, src->buflen,
|
164
|
+
git_odb_hash(&fc->file->id, src->buf, src->buflen, GIT_OBJECT_BLOB);
|
165
165
|
fc->file->id_abbrev = GIT_OID_HEXSZ;
|
166
166
|
|
167
167
|
fc->map.len = src->buflen;
|
@@ -188,7 +188,7 @@ static int diff_file_content_commit_to_str(
|
|
188
188
|
if ((error = git_submodule_lookup(&sm, fc->repo, fc->file->path)) < 0) {
|
189
189
|
/* GIT_EEXISTS means a "submodule" that has not been git added */
|
190
190
|
if (error == GIT_EEXISTS) {
|
191
|
-
|
191
|
+
git_error_clear();
|
192
192
|
error = 0;
|
193
193
|
}
|
194
194
|
return error;
|
@@ -251,7 +251,7 @@ static int diff_file_content_load_blob(
|
|
251
251
|
|
252
252
|
if (odb_obj != NULL) {
|
253
253
|
error = git_object__from_odb_object(
|
254
|
-
(git_object **)&fc->blob, fc->repo, odb_obj,
|
254
|
+
(git_object **)&fc->blob, fc->repo, odb_obj, GIT_OBJECT_BLOB);
|
255
255
|
git_odb_object_free(odb_obj);
|
256
256
|
} else {
|
257
257
|
error = git_blob_lookup(
|
@@ -280,7 +280,7 @@ static int diff_file_content_load_workdir_symlink_fake(
|
|
280
280
|
fc->map.data = git_buf_detach(&target);
|
281
281
|
fc->flags |= GIT_DIFF_FLAG__FREE_DATA;
|
282
282
|
|
283
|
-
|
283
|
+
git_buf_dispose(&target);
|
284
284
|
return error;
|
285
285
|
}
|
286
286
|
|
@@ -303,13 +303,13 @@ static int diff_file_content_load_workdir_symlink(
|
|
303
303
|
alloc_len = (ssize_t)(fc->file->size * 2) + 1;
|
304
304
|
|
305
305
|
fc->map.data = git__calloc(alloc_len, sizeof(char));
|
306
|
-
|
306
|
+
GIT_ERROR_CHECK_ALLOC(fc->map.data);
|
307
307
|
|
308
308
|
fc->flags |= GIT_DIFF_FLAG__FREE_DATA;
|
309
309
|
|
310
310
|
read_len = p_readlink(git_buf_cstr(path), fc->map.data, alloc_len);
|
311
311
|
if (read_len < 0) {
|
312
|
-
|
312
|
+
git_error_set(GIT_ERROR_OS, "failed to read symlink '%s'", fc->file->path);
|
313
313
|
return -1;
|
314
314
|
}
|
315
315
|
|
@@ -352,7 +352,7 @@ static int diff_file_content_load_workdir_file(
|
|
352
352
|
}
|
353
353
|
|
354
354
|
/* if mmap failed, fall through to try readbuffer below */
|
355
|
-
|
355
|
+
git_error_clear();
|
356
356
|
}
|
357
357
|
|
358
358
|
if (!(error = git_futils_readbuffer_fd(&raw, fd, (size_t)fc->file->size))) {
|
@@ -361,7 +361,7 @@ static int diff_file_content_load_workdir_file(
|
|
361
361
|
error = git_filter_list_apply_to_data(&out, fl, &raw);
|
362
362
|
|
363
363
|
if (out.ptr != raw.ptr)
|
364
|
-
|
364
|
+
git_buf_dispose(&raw);
|
365
365
|
|
366
366
|
if (!error) {
|
367
367
|
fc->map.len = out.size;
|
@@ -402,11 +402,11 @@ static int diff_file_content_load_workdir(
|
|
402
402
|
/* once data is loaded, update OID if we didn't have it previously */
|
403
403
|
if (!error && (fc->file->flags & GIT_DIFF_FLAG_VALID_ID) == 0) {
|
404
404
|
error = git_odb_hash(
|
405
|
-
&fc->file->id, fc->map.data, fc->map.len,
|
405
|
+
&fc->file->id, fc->map.data, fc->map.len, GIT_OBJECT_BLOB);
|
406
406
|
fc->file->flags |= GIT_DIFF_FLAG_VALID_ID;
|
407
407
|
}
|
408
408
|
|
409
|
-
|
409
|
+
git_buf_dispose(&path);
|
410
410
|
return error;
|
411
411
|
}
|
412
412
|
|
@@ -81,7 +81,7 @@ static int diff_insert_delta(
|
|
81
81
|
if (error > 0) /* positive value means to skip this delta */
|
82
82
|
return 0;
|
83
83
|
else /* negative value means to cancel diff */
|
84
|
-
return
|
84
|
+
return git_error_set_after_callback_function(error, "git_diff");
|
85
85
|
}
|
86
86
|
}
|
87
87
|
|
@@ -138,7 +138,7 @@ static int diff_delta__from_one(
|
|
138
138
|
if (DIFF_FLAG_IS_SET(diff, GIT_DIFF_REVERSE))
|
139
139
|
has_old = !has_old;
|
140
140
|
|
141
|
-
if ((entry->flags &
|
141
|
+
if ((entry->flags & GIT_INDEX_ENTRY_VALID) != 0)
|
142
142
|
return 0;
|
143
143
|
|
144
144
|
if (status == GIT_DELTA_IGNORED &&
|
@@ -157,7 +157,7 @@ static int diff_delta__from_one(
|
|
157
157
|
return 0;
|
158
158
|
|
159
159
|
delta = diff_delta__alloc(diff, status, entry->path);
|
160
|
-
|
160
|
+
GIT_ERROR_CHECK_ALLOC(delta);
|
161
161
|
|
162
162
|
/* This fn is just for single-sided diffs */
|
163
163
|
assert(status != GIT_DELTA_MODIFIED);
|
@@ -220,7 +220,7 @@ static int diff_delta__from_two(
|
|
220
220
|
}
|
221
221
|
|
222
222
|
delta = diff_delta__alloc(diff, status, canonical_path);
|
223
|
-
|
223
|
+
GIT_ERROR_CHECK_ALLOC(delta);
|
224
224
|
delta->nfiles = 2;
|
225
225
|
|
226
226
|
if (!git_index_entry_is_conflict(old_entry)) {
|
@@ -273,7 +273,8 @@ static git_diff_delta *diff_delta__last_for_item(
|
|
273
273
|
break;
|
274
274
|
case GIT_DELTA_MODIFIED:
|
275
275
|
if (git_oid__cmp(&delta->old_file.id, &item->id) == 0 ||
|
276
|
-
|
276
|
+
(delta->new_file.mode == item->mode &&
|
277
|
+
git_oid__cmp(&delta->new_file.id, &item->id) == 0))
|
277
278
|
return delta;
|
278
279
|
break;
|
279
280
|
default:
|
@@ -516,7 +517,7 @@ static int diff_generated_apply_options(
|
|
516
517
|
|
517
518
|
if (entry && git_submodule_parse_ignore(
|
518
519
|
&diff->base.opts.ignore_submodules, entry->value) < 0)
|
519
|
-
|
520
|
+
git_error_clear();
|
520
521
|
git_config_entry_free(entry);
|
521
522
|
}
|
522
523
|
|
@@ -563,9 +564,14 @@ int git_diff__oid_for_file(
|
|
563
564
|
{
|
564
565
|
git_index_entry entry;
|
565
566
|
|
567
|
+
if (size < 0 || size > UINT32_MAX) {
|
568
|
+
git_error_set(GIT_ERROR_NOMEMORY, "file size overflow (for 32-bits) on '%s'", path);
|
569
|
+
return -1;
|
570
|
+
}
|
571
|
+
|
566
572
|
memset(&entry, 0, sizeof(entry));
|
567
573
|
entry.mode = mode;
|
568
|
-
entry.file_size = size;
|
574
|
+
entry.file_size = (uint32_t)size;
|
569
575
|
entry.path = (char *)path;
|
570
576
|
|
571
577
|
return git_diff__oid_for_entry(out, diff, &entry, mode, NULL);
|
@@ -600,7 +606,7 @@ int git_diff__oid_for_entry(
|
|
600
606
|
|
601
607
|
if (p_stat(full_path.ptr, &st) < 0) {
|
602
608
|
error = git_path_set_error(errno, entry.path, "stat");
|
603
|
-
|
609
|
+
git_buf_dispose(&full_path);
|
604
610
|
return error;
|
605
611
|
}
|
606
612
|
|
@@ -621,13 +627,13 @@ int git_diff__oid_for_entry(
|
|
621
627
|
/* if submodule lookup failed probably just in an intermediate
|
622
628
|
* state where some init hasn't happened, so ignore the error
|
623
629
|
*/
|
624
|
-
|
630
|
+
git_error_clear();
|
625
631
|
}
|
626
632
|
} else if (S_ISLNK(mode)) {
|
627
633
|
error = git_odb__hashlink(out, full_path.ptr);
|
628
634
|
diff->base.perf.oid_calculations++;
|
629
635
|
} else if (!git__is_sizet(entry.file_size)) {
|
630
|
-
|
636
|
+
git_error_set(GIT_ERROR_NOMEMORY, "file size overflow (for 32-bits) on '%s'",
|
631
637
|
entry.path);
|
632
638
|
error = -1;
|
633
639
|
} else if (!(error = git_filter_list_load(&fl,
|
@@ -639,7 +645,7 @@ int git_diff__oid_for_entry(
|
|
639
645
|
error = fd;
|
640
646
|
else {
|
641
647
|
error = git_odb__hashfd_filtered(
|
642
|
-
out, fd, (size_t)entry.file_size,
|
648
|
+
out, fd, (size_t)entry.file_size, GIT_OBJECT_BLOB, fl);
|
643
649
|
p_close(fd);
|
644
650
|
diff->base.perf.oid_calculations++;
|
645
651
|
}
|
@@ -663,7 +669,7 @@ int git_diff__oid_for_entry(
|
|
663
669
|
}
|
664
670
|
}
|
665
671
|
|
666
|
-
|
672
|
+
git_buf_dispose(&full_path);
|
667
673
|
return error;
|
668
674
|
}
|
669
675
|
|
@@ -699,7 +705,7 @@ static int maybe_modified_submodule(
|
|
699
705
|
|
700
706
|
/* GIT_EEXISTS means dir with .git in it was found - ignore it */
|
701
707
|
if (error == GIT_EEXISTS) {
|
702
|
-
|
708
|
+
git_error_clear();
|
703
709
|
error = 0;
|
704
710
|
}
|
705
711
|
return error;
|
@@ -763,11 +769,11 @@ static int maybe_modified(
|
|
763
769
|
status = GIT_DELTA_CONFLICTED;
|
764
770
|
|
765
771
|
/* support "assume unchanged" (poorly, b/c we still stat everything) */
|
766
|
-
} else if ((oitem->flags &
|
772
|
+
} else if ((oitem->flags & GIT_INDEX_ENTRY_VALID) != 0) {
|
767
773
|
status = GIT_DELTA_UNMODIFIED;
|
768
774
|
|
769
775
|
/* support "skip worktree" index bit */
|
770
|
-
} else if ((oitem->flags_extended &
|
776
|
+
} else if ((oitem->flags_extended & GIT_INDEX_ENTRY_SKIP_WORKTREE) != 0) {
|
771
777
|
status = GIT_DELTA_UNMODIFIED;
|
772
778
|
|
773
779
|
/* if basic type of file changed, then split into delete and add */
|
@@ -1059,7 +1065,7 @@ static int handle_unmatched_new_item(
|
|
1059
1065
|
|
1060
1066
|
/* if directory is empty, can't advance into it, so skip it */
|
1061
1067
|
if (error == GIT_ENOTFOUND) {
|
1062
|
-
|
1068
|
+
git_error_clear();
|
1063
1069
|
error = iterator_advance(&info->nitem, info->new_iter);
|
1064
1070
|
}
|
1065
1071
|
|
@@ -1081,7 +1087,7 @@ static int handle_unmatched_new_item(
|
|
1081
1087
|
else if (nitem->mode == GIT_FILEMODE_COMMIT) {
|
1082
1088
|
/* ignore things that are not actual submodules */
|
1083
1089
|
if (git_submodule_lookup(NULL, info->repo, nitem->path) != 0) {
|
1084
|
-
|
1090
|
+
git_error_clear();
|
1085
1091
|
delta_type = GIT_DELTA_IGNORED;
|
1086
1092
|
|
1087
1093
|
/* if this contains a tracked item, treat as normal TREE */
|
@@ -1090,7 +1096,7 @@ static int handle_unmatched_new_item(
|
|
1090
1096
|
if (error != GIT_ENOTFOUND)
|
1091
1097
|
return error;
|
1092
1098
|
|
1093
|
-
|
1099
|
+
git_error_clear();
|
1094
1100
|
return iterator_advance(&info->nitem, info->new_iter);
|
1095
1101
|
}
|
1096
1102
|
}
|
@@ -1191,7 +1197,7 @@ int git_diff__from_iterators(
|
|
1191
1197
|
*out = NULL;
|
1192
1198
|
|
1193
1199
|
diff = diff_generated_alloc(repo, old_iter, new_iter);
|
1194
|
-
|
1200
|
+
GIT_ERROR_CHECK_ALLOC(diff);
|
1195
1201
|
|
1196
1202
|
info.repo = repo;
|
1197
1203
|
info.old_iter = old_iter;
|
@@ -1268,7 +1274,7 @@ cleanup:
|
|
1268
1274
|
b_opts.flags = FLAGS_SECOND; \
|
1269
1275
|
b_opts.start = pfx; \
|
1270
1276
|
b_opts.end = pfx; \
|
1271
|
-
|
1277
|
+
GIT_ERROR_CHECK_VERSION(opts, GIT_DIFF_OPTIONS_VERSION, "git_diff_options"); \
|
1272
1278
|
if (opts && (opts->flags & GIT_DIFF_DISABLE_PATHSPEC_MATCH)) { \
|
1273
1279
|
a_opts.pathlist.strings = opts->pathspec.strings; \
|
1274
1280
|
a_opts.pathlist.count = opts->pathspec.count; \
|
@@ -1319,7 +1325,7 @@ static int diff_load_index(git_index **index, git_repository *repo)
|
|
1319
1325
|
|
1320
1326
|
/* reload the repository index when user did not pass one in */
|
1321
1327
|
if (!error && git_index_read(*index, false) < 0)
|
1322
|
-
|
1328
|
+
git_error_clear();
|
1323
1329
|
|
1324
1330
|
return error;
|
1325
1331
|
}
|
@@ -1551,7 +1557,7 @@ int git_diff__paired_foreach(
|
|
1551
1557
|
}
|
1552
1558
|
|
1553
1559
|
if ((error = cb(h2i, i2w, payload)) != 0) {
|
1554
|
-
|
1560
|
+
git_error_set_after_callback(error);
|
1555
1561
|
break;
|
1556
1562
|
}
|
1557
1563
|
}
|
@@ -1590,7 +1596,7 @@ int git_diff__commit(
|
|
1590
1596
|
char commit_oidstr[GIT_OID_HEXSZ + 1];
|
1591
1597
|
|
1592
1598
|
error = -1;
|
1593
|
-
|
1599
|
+
git_error_set(GIT_ERROR_INVALID, "commit %s is a merge commit",
|
1594
1600
|
git_oid_tostr(commit_oidstr, GIT_OID_HEXSZ + 1, git_commit_id(commit)));
|
1595
1601
|
goto on_error;
|
1596
1602
|
}
|
@@ -78,10 +78,10 @@ int git_diff_from_buffer(
|
|
78
78
|
*out = NULL;
|
79
79
|
|
80
80
|
diff = diff_parsed_alloc();
|
81
|
-
|
81
|
+
GIT_ERROR_CHECK_ALLOC(diff);
|
82
82
|
|
83
83
|
ctx = git_patch_parse_ctx_init(content, content_len, NULL);
|
84
|
-
|
84
|
+
GIT_ERROR_CHECK_ALLOC(ctx);
|
85
85
|
|
86
86
|
while (ctx->parse_ctx.remain_len) {
|
87
87
|
if ((error = git_patch_parse(&patch, ctx)) < 0)
|
@@ -92,7 +92,7 @@ int git_diff_from_buffer(
|
|
92
92
|
}
|
93
93
|
|
94
94
|
if (error == GIT_ENOTFOUND && git_vector_length(&diff->patches) > 0) {
|
95
|
-
|
95
|
+
git_error_clear();
|
96
96
|
error = 0;
|
97
97
|
}
|
98
98
|
|
@@ -224,7 +224,7 @@ static int diff_print_one_raw(
|
|
224
224
|
delta->new_file.id_abbrev;
|
225
225
|
|
226
226
|
if (pi->id_strlen > id_abbrev) {
|
227
|
-
|
227
|
+
git_error_set(GIT_ERROR_PATCH,
|
228
228
|
"the patch input contains %d id characters (cannot print %d)",
|
229
229
|
id_abbrev, pi->id_strlen);
|
230
230
|
return -1;
|
@@ -275,7 +275,7 @@ static int diff_print_oid_range(
|
|
275
275
|
|
276
276
|
if (delta->old_file.mode &&
|
277
277
|
id_strlen > delta->old_file.id_abbrev) {
|
278
|
-
|
278
|
+
git_error_set(GIT_ERROR_PATCH,
|
279
279
|
"the patch input contains %d id characters (cannot print %d)",
|
280
280
|
delta->old_file.id_abbrev, id_strlen);
|
281
281
|
return -1;
|
@@ -283,7 +283,7 @@ static int diff_print_oid_range(
|
|
283
283
|
|
284
284
|
if ((delta->new_file.mode &&
|
285
285
|
id_strlen > delta->new_file.id_abbrev)) {
|
286
|
-
|
286
|
+
git_error_set(GIT_ERROR_PATCH,
|
287
287
|
"the patch input contains %d id characters (cannot print %d)",
|
288
288
|
delta->new_file.id_abbrev, id_strlen);
|
289
289
|
return -1;
|
@@ -343,7 +343,7 @@ int diff_delta_format_similarity_header(
|
|
343
343
|
int error = 0;
|
344
344
|
|
345
345
|
if (delta->similarity > 100) {
|
346
|
-
|
346
|
+
git_error_set(GIT_ERROR_PATCH, "invalid similarity %d", delta->similarity);
|
347
347
|
error = -1;
|
348
348
|
goto done;
|
349
349
|
}
|
@@ -373,8 +373,8 @@ int diff_delta_format_similarity_header(
|
|
373
373
|
error = -1;
|
374
374
|
|
375
375
|
done:
|
376
|
-
|
377
|
-
|
376
|
+
git_buf_dispose(&old_path);
|
377
|
+
git_buf_dispose(&new_path);
|
378
378
|
|
379
379
|
return error;
|
380
380
|
}
|
@@ -446,8 +446,8 @@ int git_diff_delta__format_file_header(
|
|
446
446
|
error = -1;
|
447
447
|
|
448
448
|
done:
|
449
|
-
|
450
|
-
|
449
|
+
git_buf_dispose(&old_path);
|
450
|
+
git_buf_dispose(&new_path);
|
451
451
|
|
452
452
|
return error;
|
453
453
|
}
|
@@ -509,8 +509,8 @@ static int diff_print_patch_file_binary_noshow(
|
|
509
509
|
old_path.ptr, new_path.ptr);
|
510
510
|
|
511
511
|
done:
|
512
|
-
|
513
|
-
|
512
|
+
git_buf_dispose(&old_path);
|
513
|
+
git_buf_dispose(&new_path);
|
514
514
|
|
515
515
|
return error;
|
516
516
|
}
|
@@ -540,7 +540,7 @@ static int diff_print_patch_file_binary(
|
|
540
540
|
binary->old_file.datalen, binary->old_file.inflatedlen)) < 0) {
|
541
541
|
|
542
542
|
if (error == GIT_EBUFS) {
|
543
|
-
|
543
|
+
git_error_clear();
|
544
544
|
git_buf_truncate(pi->buf, pre_binary_size);
|
545
545
|
|
546
546
|
return diff_print_patch_file_binary_noshow(
|
@@ -683,7 +683,7 @@ int git_diff_print(
|
|
683
683
|
print_file = diff_print_one_name_status;
|
684
684
|
break;
|
685
685
|
default:
|
686
|
-
|
686
|
+
git_error_set(GIT_ERROR_INVALID, "unknown diff output format (%d)", format);
|
687
687
|
return -1;
|
688
688
|
}
|
689
689
|
|
@@ -693,10 +693,10 @@ int git_diff_print(
|
|
693
693
|
diff, print_file, print_binary, print_hunk, print_line, &pi);
|
694
694
|
|
695
695
|
if (error) /* make sure error message is set */
|
696
|
-
|
696
|
+
git_error_set_after_callback_function(error, "git_diff_print");
|
697
697
|
}
|
698
698
|
|
699
|
-
|
699
|
+
git_buf_dispose(&buf);
|
700
700
|
|
701
701
|
return error;
|
702
702
|
}
|
@@ -711,7 +711,7 @@ int git_diff_print_callback__to_buf(
|
|
711
711
|
GIT_UNUSED(delta); GIT_UNUSED(hunk);
|
712
712
|
|
713
713
|
if (!output) {
|
714
|
-
|
714
|
+
git_error_set(GIT_ERROR_INVALID, "buffer pointer must be provided");
|
715
715
|
return -1;
|
716
716
|
}
|
717
717
|
|
@@ -773,10 +773,10 @@ int git_patch_print(
|
|
773
773
|
&pi);
|
774
774
|
|
775
775
|
if (error) /* make sure error message is set */
|
776
|
-
|
776
|
+
git_error_set_after_callback_function(error, "git_patch_print");
|
777
777
|
}
|
778
778
|
|
779
|
-
|
779
|
+
git_buf_dispose(&temp);
|
780
780
|
|
781
781
|
return error;
|
782
782
|
}
|
@@ -54,22 +54,37 @@ int git_diff_file_stats__full_to_buf(
|
|
54
54
|
size_t width)
|
55
55
|
{
|
56
56
|
const char *old_path = NULL, *new_path = NULL;
|
57
|
-
size_t padding
|
57
|
+
size_t padding;
|
58
|
+
git_off_t old_size, new_size;
|
58
59
|
|
59
60
|
old_path = delta->old_file.path;
|
60
61
|
new_path = delta->new_file.path;
|
61
62
|
old_size = delta->old_file.size;
|
62
63
|
new_size = delta->new_file.size;
|
63
64
|
|
64
|
-
if (git_buf_printf(out, " %s", old_path) < 0)
|
65
|
-
goto on_error;
|
66
|
-
|
67
65
|
if (strcmp(old_path, new_path) != 0) {
|
66
|
+
size_t common_dirlen;
|
67
|
+
int error;
|
68
|
+
|
68
69
|
padding = stats->max_name - strlen(old_path) - strlen(new_path);
|
69
70
|
|
70
|
-
if (
|
71
|
+
if ((common_dirlen = git_path_common_dirlen(old_path, new_path)) &&
|
72
|
+
common_dirlen <= INT_MAX) {
|
73
|
+
error = git_buf_printf(out, " %.*s{%s"DIFF_RENAME_FILE_SEPARATOR"%s}",
|
74
|
+
(int) common_dirlen, old_path,
|
75
|
+
old_path + common_dirlen,
|
76
|
+
new_path + common_dirlen);
|
77
|
+
} else {
|
78
|
+
error = git_buf_printf(out, " %s" DIFF_RENAME_FILE_SEPARATOR "%s",
|
79
|
+
old_path, new_path);
|
80
|
+
}
|
81
|
+
|
82
|
+
if (error < 0)
|
71
83
|
goto on_error;
|
72
84
|
} else {
|
85
|
+
if (git_buf_printf(out, " %s", old_path) < 0)
|
86
|
+
goto on_error;
|
87
|
+
|
73
88
|
padding = stats->max_name - strlen(old_path);
|
74
89
|
|
75
90
|
if (stats->renames > 0)
|
@@ -82,7 +97,7 @@ int git_diff_file_stats__full_to_buf(
|
|
82
97
|
|
83
98
|
if (delta->flags & GIT_DIFF_FLAG_BINARY) {
|
84
99
|
if (git_buf_printf(out,
|
85
|
-
"Bin %"
|
100
|
+
"Bin %" PRId64 " -> %" PRId64 " bytes", old_size, new_size) < 0)
|
86
101
|
goto on_error;
|
87
102
|
}
|
88
103
|
else {
|
@@ -170,7 +185,7 @@ int git_diff_get_stats(
|
|
170
185
|
assert(out && diff);
|
171
186
|
|
172
187
|
stats = git__calloc(1, sizeof(git_diff_stats));
|
173
|
-
|
188
|
+
GIT_ERROR_CHECK_ALLOC(stats);
|
174
189
|
|
175
190
|
deltas = git_diff_num_deltas(diff);
|
176
191
|
|