rugged 1.0.1 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/ext/rugged/rugged_commit.c +1 -1
- data/lib/rugged/commit.rb +16 -2
- data/lib/rugged/version.rb +1 -1
- data/vendor/libgit2/CMakeLists.txt +31 -69
- data/vendor/libgit2/cmake/{Modules/AddCFlagIfSupported.cmake → AddCFlagIfSupported.cmake} +0 -0
- data/vendor/libgit2/cmake/{Modules/EnableWarnings.cmake → EnableWarnings.cmake} +0 -0
- data/vendor/libgit2/cmake/{Modules/FindCoreFoundation.cmake → FindCoreFoundation.cmake} +0 -0
- data/vendor/libgit2/cmake/{Modules/FindGSSAPI.cmake → FindGSSAPI.cmake} +0 -0
- data/vendor/libgit2/cmake/{Modules/FindGSSFramework.cmake → FindGSSFramework.cmake} +0 -0
- data/vendor/libgit2/cmake/{Modules/FindHTTP_Parser.cmake → FindHTTP_Parser.cmake} +0 -0
- data/vendor/libgit2/cmake/{Modules/FindIconv.cmake → FindIconv.cmake} +0 -0
- data/vendor/libgit2/cmake/{Modules/FindPCRE.cmake → FindPCRE.cmake} +0 -0
- data/vendor/libgit2/cmake/{Modules/FindPCRE2.cmake → FindPCRE2.cmake} +0 -0
- data/vendor/libgit2/cmake/{Modules/FindPkgLibraries.cmake → FindPkgLibraries.cmake} +0 -0
- data/vendor/libgit2/cmake/{Modules/FindSecurity.cmake → FindSecurity.cmake} +0 -0
- data/vendor/libgit2/cmake/{Modules/FindStatNsec.cmake → FindStatNsec.cmake} +0 -0
- data/vendor/libgit2/cmake/{Modules/FindmbedTLS.cmake → FindmbedTLS.cmake} +0 -0
- data/vendor/libgit2/cmake/{Modules/IdeSplitSources.cmake → IdeSplitSources.cmake} +0 -0
- data/vendor/libgit2/cmake/{Modules/PkgBuildConfig.cmake → PkgBuildConfig.cmake} +0 -0
- data/vendor/libgit2/cmake/{Modules/SanitizeBool.cmake → SanitizeBool.cmake} +0 -0
- data/vendor/libgit2/cmake/{Modules/SelectGSSAPI.cmake → SelectGSSAPI.cmake} +18 -26
- data/vendor/libgit2/cmake/{Modules/SelectHTTPSBackend.cmake → SelectHTTPSBackend.cmake} +25 -32
- data/vendor/libgit2/cmake/{Modules/SelectHashes.cmake → SelectHashes.cmake} +20 -28
- data/vendor/libgit2/deps/http-parser/CMakeLists.txt +4 -3
- data/vendor/libgit2/deps/ntlmclient/CMakeLists.txt +6 -5
- data/vendor/libgit2/deps/ntlmclient/compat.h +8 -1
- data/vendor/libgit2/deps/ntlmclient/ntlm.c +8 -11
- data/vendor/libgit2/deps/pcre/LICENCE +93 -0
- data/vendor/libgit2/deps/pcre/pcre.h +2 -2
- data/vendor/libgit2/deps/pcre/pcre_compile.c +29 -17
- data/vendor/libgit2/deps/pcre/pcre_jit_compile.c +4 -4
- data/vendor/libgit2/deps/pcre/pcreposix.c +2 -3
- data/vendor/libgit2/deps/zlib/CMakeLists.txt +6 -5
- data/vendor/libgit2/deps/zlib/deflate.c +1 -0
- data/vendor/libgit2/include/git2/annotated_commit.h +1 -1
- data/vendor/libgit2/include/git2/blame.h +2 -0
- data/vendor/libgit2/include/git2/common.h +15 -3
- data/vendor/libgit2/include/git2/deprecated.h +42 -2
- data/vendor/libgit2/include/git2/errors.h +2 -1
- data/vendor/libgit2/include/git2/index.h +1 -2
- data/vendor/libgit2/include/git2/pack.h +1 -1
- data/vendor/libgit2/include/git2/strarray.h +6 -10
- data/vendor/libgit2/include/git2/version.h +4 -4
- data/vendor/libgit2/src/CMakeLists.txt +53 -41
- data/vendor/libgit2/src/apply.c +5 -1
- data/vendor/libgit2/src/assert_safe.h +58 -0
- data/vendor/libgit2/src/attr_file.c +8 -3
- data/vendor/libgit2/src/attrcache.c +2 -3
- data/vendor/libgit2/src/blame.c +2 -0
- data/vendor/libgit2/src/blame_git.c +6 -3
- data/vendor/libgit2/src/blob.c +2 -0
- data/vendor/libgit2/src/branch.c +19 -21
- data/vendor/libgit2/src/buffer.c +6 -3
- data/vendor/libgit2/src/cache.c +1 -22
- data/vendor/libgit2/src/checkout.c +49 -72
- data/vendor/libgit2/src/cherrypick.c +2 -0
- data/vendor/libgit2/src/clone.c +78 -18
- data/vendor/libgit2/src/common.h +1 -0
- data/vendor/libgit2/src/config.c +3 -7
- data/vendor/libgit2/src/config_entries.c +35 -27
- data/vendor/libgit2/src/config_parse.c +1 -1
- data/vendor/libgit2/src/config_snapshot.c +2 -1
- data/vendor/libgit2/src/describe.c +5 -1
- data/vendor/libgit2/src/diff.c +12 -11
- data/vendor/libgit2/src/diff_file.c +3 -1
- data/vendor/libgit2/src/diff_generate.c +10 -11
- data/vendor/libgit2/src/diff_parse.c +2 -3
- data/vendor/libgit2/src/diff_print.c +63 -60
- data/vendor/libgit2/src/diff_stats.c +12 -11
- data/vendor/libgit2/src/diff_tform.c +2 -3
- data/vendor/libgit2/src/errors.c +2 -0
- data/vendor/libgit2/src/fetch.c +2 -0
- data/vendor/libgit2/src/filter.c +3 -3
- data/vendor/libgit2/src/futils.c +3 -3
- data/vendor/libgit2/src/futils.h +3 -3
- data/vendor/libgit2/src/global.c +3 -1
- data/vendor/libgit2/src/idxmap.c +0 -22
- data/vendor/libgit2/src/index.c +12 -7
- data/vendor/libgit2/src/indexer.c +10 -4
- data/vendor/libgit2/src/iterator.c +4 -4
- data/vendor/libgit2/src/merge.c +13 -7
- data/vendor/libgit2/src/merge_file.c +4 -6
- data/vendor/libgit2/src/midx.c +418 -0
- data/vendor/libgit2/src/midx.h +83 -0
- data/vendor/libgit2/src/mwindow.c +124 -51
- data/vendor/libgit2/src/net.c +6 -1
- data/vendor/libgit2/src/object.c +2 -1
- data/vendor/libgit2/src/odb.c +9 -6
- data/vendor/libgit2/src/odb_loose.c +3 -3
- data/vendor/libgit2/src/odb_mempack.c +2 -0
- data/vendor/libgit2/src/oid.c +2 -0
- data/vendor/libgit2/src/pack-objects.c +29 -21
- data/vendor/libgit2/src/pack.c +47 -28
- data/vendor/libgit2/src/pack.h +19 -2
- data/vendor/libgit2/src/patch_generate.c +1 -3
- data/vendor/libgit2/src/patch_parse.c +4 -2
- data/vendor/libgit2/src/path.c +4 -4
- data/vendor/libgit2/src/pathspec.c +4 -3
- data/vendor/libgit2/src/pool.c +21 -15
- data/vendor/libgit2/src/pool.h +9 -1
- data/vendor/libgit2/src/proxy.c +2 -0
- data/vendor/libgit2/src/push.c +2 -0
- data/vendor/libgit2/src/rebase.c +2 -0
- data/vendor/libgit2/src/refdb.c +135 -0
- data/vendor/libgit2/src/refdb.h +69 -0
- data/vendor/libgit2/src/refdb_fs.c +19 -81
- data/vendor/libgit2/src/reflog.c +2 -6
- data/vendor/libgit2/src/refs.c +60 -188
- data/vendor/libgit2/src/refs.h +1 -19
- data/vendor/libgit2/src/regexp.c +2 -2
- data/vendor/libgit2/src/remote.c +32 -17
- data/vendor/libgit2/src/repository.c +168 -79
- data/vendor/libgit2/src/repository.h +10 -27
- data/vendor/libgit2/src/revert.c +2 -0
- data/vendor/libgit2/src/revparse.c +5 -4
- data/vendor/libgit2/src/revwalk.c +3 -5
- data/vendor/libgit2/src/settings.c +9 -0
- data/vendor/libgit2/src/sortedcache.c +2 -3
- data/vendor/libgit2/src/stash.c +2 -0
- data/vendor/libgit2/src/status.c +2 -0
- data/vendor/libgit2/src/strarray.c +63 -0
- data/vendor/libgit2/src/streams/openssl.c +12 -6
- data/vendor/libgit2/src/streams/registry.c +5 -3
- data/vendor/libgit2/src/submodule.c +6 -4
- data/vendor/libgit2/src/sysdir.c +4 -20
- data/vendor/libgit2/src/sysdir.h +0 -11
- data/vendor/libgit2/src/tag.c +2 -0
- data/vendor/libgit2/src/thread-utils.h +139 -21
- data/vendor/libgit2/src/transaction.c +2 -1
- data/vendor/libgit2/src/transports/credential.c +2 -0
- data/vendor/libgit2/src/transports/credential_helpers.c +2 -0
- data/vendor/libgit2/src/transports/httpclient.c +6 -8
- data/vendor/libgit2/src/transports/local.c +2 -2
- data/vendor/libgit2/src/transports/smart.c +2 -2
- data/vendor/libgit2/src/transports/winhttp.c +18 -7
- data/vendor/libgit2/src/unix/posix.h +13 -1
- data/vendor/libgit2/src/util.c +25 -58
- data/vendor/libgit2/src/util.h +2 -2
- data/vendor/libgit2/src/win32/git2.rc +18 -3
- data/vendor/libgit2/src/win32/path_w32.c +2 -2
- data/vendor/libgit2/src/worktree.c +4 -0
- metadata +27 -25
- data/vendor/libgit2/cmake/Modules/CheckPrototypeDefinition.c.in +0 -29
- data/vendor/libgit2/cmake/Modules/CheckPrototypeDefinition.cmake +0 -96
- data/vendor/libgit2/src/refdb_fs.h +0 -19
@@ -110,6 +110,8 @@ int git_mempack_dump(git_buf *pack, git_repository *repo, git_odb_backend *_back
|
|
110
110
|
if (git_packbuilder_new(&packbuilder, repo) < 0)
|
111
111
|
return -1;
|
112
112
|
|
113
|
+
git_packbuilder_set_threads(packbuilder, 0);
|
114
|
+
|
113
115
|
for (i = 0; i < db->commits.size; ++i) {
|
114
116
|
struct memobject *commit = db->commits.ptr[i];
|
115
117
|
|
data/vendor/libgit2/src/oid.c
CHANGED
@@ -253,10 +253,12 @@ int git_oid_is_zero(const git_oid *oid_a)
|
|
253
253
|
return 1;
|
254
254
|
}
|
255
255
|
|
256
|
+
#ifndef GIT_DEPRECATE_HARD
|
256
257
|
int git_oid_iszero(const git_oid *oid_a)
|
257
258
|
{
|
258
259
|
return git_oid_is_zero(oid_a);
|
259
260
|
}
|
261
|
+
#endif
|
260
262
|
|
261
263
|
typedef short node_index;
|
262
264
|
|
@@ -141,14 +141,11 @@ int git_packbuilder_new(git_packbuilder **out, git_repository *repo)
|
|
141
141
|
pb = git__calloc(1, sizeof(*pb));
|
142
142
|
GIT_ERROR_CHECK_ALLOC(pb);
|
143
143
|
|
144
|
-
if (git_oidmap_new(&pb->object_ix) < 0
|
144
|
+
if (git_oidmap_new(&pb->object_ix) < 0 ||
|
145
|
+
git_oidmap_new(&pb->walk_objects) < 0 ||
|
146
|
+
git_pool_init(&pb->object_pool, sizeof(struct walk_object)) < 0)
|
145
147
|
goto on_error;
|
146
148
|
|
147
|
-
if (git_oidmap_new(&pb->walk_objects) < 0)
|
148
|
-
goto on_error;
|
149
|
-
|
150
|
-
git_pool_init(&pb->object_pool, sizeof(struct walk_object));
|
151
|
-
|
152
149
|
pb->repo = repo;
|
153
150
|
pb->nr_threads = 1; /* do not spawn any thread by default */
|
154
151
|
|
@@ -1384,20 +1381,29 @@ int git_packbuilder_write(
|
|
1384
1381
|
git_indexer_progress_cb progress_cb,
|
1385
1382
|
void *progress_cb_payload)
|
1386
1383
|
{
|
1384
|
+
int error = -1;
|
1385
|
+
git_buf object_path = GIT_BUF_INIT;
|
1387
1386
|
git_indexer_options opts = GIT_INDEXER_OPTIONS_INIT;
|
1388
|
-
git_indexer *indexer;
|
1387
|
+
git_indexer *indexer = NULL;
|
1389
1388
|
git_indexer_progress stats;
|
1390
1389
|
struct pack_write_context ctx;
|
1391
1390
|
int t;
|
1392
1391
|
|
1393
1392
|
PREPARE_PACK;
|
1394
1393
|
|
1394
|
+
if (path == NULL) {
|
1395
|
+
if ((error = git_repository_item_path(&object_path, pb->repo, GIT_REPOSITORY_ITEM_OBJECTS)) < 0)
|
1396
|
+
goto cleanup;
|
1397
|
+
if ((error = git_buf_joinpath(&object_path, git_buf_cstr(&object_path), "pack")) < 0)
|
1398
|
+
goto cleanup;
|
1399
|
+
path = git_buf_cstr(&object_path);
|
1400
|
+
}
|
1401
|
+
|
1395
1402
|
opts.progress_cb = progress_cb;
|
1396
1403
|
opts.progress_cb_payload = progress_cb_payload;
|
1397
1404
|
|
1398
|
-
if (git_indexer_new(
|
1399
|
-
|
1400
|
-
return -1;
|
1405
|
+
if ((error = git_indexer_new(&indexer, path, mode, pb->odb, &opts)) < 0)
|
1406
|
+
goto cleanup;
|
1401
1407
|
|
1402
1408
|
if (!git_repository__configmap_lookup(&t, pb->repo, GIT_CONFIGMAP_FSYNCOBJECTFILES) && t)
|
1403
1409
|
git_indexer__set_fsync(indexer, 1);
|
@@ -1405,16 +1411,18 @@ int git_packbuilder_write(
|
|
1405
1411
|
ctx.indexer = indexer;
|
1406
1412
|
ctx.stats = &stats;
|
1407
1413
|
|
1408
|
-
if (git_packbuilder_foreach(pb, write_cb, &ctx) < 0
|
1409
|
-
|
1410
|
-
|
1411
|
-
|
1412
|
-
|
1414
|
+
if ((error = git_packbuilder_foreach(pb, write_cb, &ctx)) < 0)
|
1415
|
+
goto cleanup;
|
1416
|
+
|
1417
|
+
if ((error = git_indexer_commit(indexer, &stats)) < 0)
|
1418
|
+
goto cleanup;
|
1413
1419
|
|
1414
1420
|
git_oid_cpy(&pb->pack_oid, git_indexer_hash(indexer));
|
1415
1421
|
|
1422
|
+
cleanup:
|
1416
1423
|
git_indexer_free(indexer);
|
1417
|
-
|
1424
|
+
git_buf_dispose(&object_path);
|
1425
|
+
return error;
|
1418
1426
|
}
|
1419
1427
|
|
1420
1428
|
#undef PREPARE_PACK
|
@@ -1634,7 +1642,7 @@ static int mark_edges_uninteresting(git_packbuilder *pb, git_commit_list *commit
|
|
1634
1642
|
return 0;
|
1635
1643
|
}
|
1636
1644
|
|
1637
|
-
int
|
1645
|
+
static int pack_objects_insert_tree(git_packbuilder *pb, git_tree *tree)
|
1638
1646
|
{
|
1639
1647
|
size_t i;
|
1640
1648
|
int error;
|
@@ -1661,7 +1669,7 @@ int insert_tree(git_packbuilder *pb, git_tree *tree)
|
|
1661
1669
|
if ((error = git_tree_lookup(&subtree, pb->repo, entry_id)) < 0)
|
1662
1670
|
return error;
|
1663
1671
|
|
1664
|
-
error =
|
1672
|
+
error = pack_objects_insert_tree(pb, subtree);
|
1665
1673
|
git_tree_free(subtree);
|
1666
1674
|
|
1667
1675
|
if (error < 0)
|
@@ -1687,7 +1695,7 @@ int insert_tree(git_packbuilder *pb, git_tree *tree)
|
|
1687
1695
|
return error;
|
1688
1696
|
}
|
1689
1697
|
|
1690
|
-
int
|
1698
|
+
static int pack_objects_insert_commit(git_packbuilder *pb, struct walk_object *obj)
|
1691
1699
|
{
|
1692
1700
|
int error;
|
1693
1701
|
git_commit *commit = NULL;
|
@@ -1704,7 +1712,7 @@ int insert_commit(git_packbuilder *pb, struct walk_object *obj)
|
|
1704
1712
|
if ((error = git_tree_lookup(&tree, pb->repo, git_commit_tree_id(commit))) < 0)
|
1705
1713
|
goto cleanup;
|
1706
1714
|
|
1707
|
-
if ((error =
|
1715
|
+
if ((error = pack_objects_insert_tree(pb, tree)) < 0)
|
1708
1716
|
goto cleanup;
|
1709
1717
|
|
1710
1718
|
cleanup:
|
@@ -1739,7 +1747,7 @@ int git_packbuilder_insert_walk(git_packbuilder *pb, git_revwalk *walk)
|
|
1739
1747
|
if (obj->seen || obj->uninteresting)
|
1740
1748
|
continue;
|
1741
1749
|
|
1742
|
-
if ((error =
|
1750
|
+
if ((error = pack_objects_insert_commit(pb, obj)) < 0)
|
1743
1751
|
return error;
|
1744
1752
|
}
|
1745
1753
|
|
data/vendor/libgit2/src/pack.c
CHANGED
@@ -488,8 +488,12 @@ int git_packfile_resolve_header(
|
|
488
488
|
size_t base_size;
|
489
489
|
git_packfile_stream stream;
|
490
490
|
|
491
|
-
|
491
|
+
error = get_delta_base(&base_offset, p, &w_curs, &curpos, type, offset);
|
492
492
|
git_mwindow_close(&w_curs);
|
493
|
+
|
494
|
+
if (error < 0)
|
495
|
+
return error;
|
496
|
+
|
493
497
|
if ((error = git_packfile_stream_open(&stream, p, curpos)) < 0)
|
494
498
|
return error;
|
495
499
|
error = git_delta_read_header_fromstream(&base_size, size_p, &stream);
|
@@ -508,8 +512,12 @@ int git_packfile_resolve_header(
|
|
508
512
|
return error;
|
509
513
|
if (type != GIT_OBJECT_OFS_DELTA && type != GIT_OBJECT_REF_DELTA)
|
510
514
|
break;
|
511
|
-
|
515
|
+
|
516
|
+
error = get_delta_base(&base_offset, p, &w_curs, &curpos, type, base_offset);
|
512
517
|
git_mwindow_close(&w_curs);
|
518
|
+
|
519
|
+
if (error < 0)
|
520
|
+
return error;
|
513
521
|
}
|
514
522
|
*type_p = type;
|
515
523
|
|
@@ -583,17 +591,11 @@ static int pack_dependency_chain(git_dependency_chain *chain_out,
|
|
583
591
|
if (type != GIT_OBJECT_OFS_DELTA && type != GIT_OBJECT_REF_DELTA)
|
584
592
|
break;
|
585
593
|
|
586
|
-
|
594
|
+
error = get_delta_base(&base_offset, p, &w_curs, &curpos, type, obj_offset);
|
587
595
|
git_mwindow_close(&w_curs);
|
588
596
|
|
589
|
-
if (
|
590
|
-
error = packfile_error("delta offset is zero");
|
591
|
-
goto on_error;
|
592
|
-
}
|
593
|
-
if (base_offset < 0) { /* must actually be an error code */
|
594
|
-
error = (int)base_offset;
|
597
|
+
if (error < 0)
|
595
598
|
goto on_error;
|
596
|
-
}
|
597
599
|
|
598
600
|
/* we need to pass the pos *after* the delta-base bit */
|
599
601
|
elem->offset = curpos;
|
@@ -842,7 +844,10 @@ static int packfile_unpack_compressed(
|
|
842
844
|
unsigned int window_len;
|
843
845
|
unsigned char *in;
|
844
846
|
|
845
|
-
in = pack_window_open(p, mwindow, *position, &window_len)
|
847
|
+
if ((in = pack_window_open(p, mwindow, *position, &window_len)) == NULL) {
|
848
|
+
error = -1;
|
849
|
+
goto out;
|
850
|
+
}
|
846
851
|
|
847
852
|
if ((error = git_zstream_set_input(&zstream, in, window_len)) < 0 ||
|
848
853
|
(error = git_zstream_get_output_chunk(data + total, &bytes, &zstream)) < 0) {
|
@@ -852,9 +857,12 @@ static int packfile_unpack_compressed(
|
|
852
857
|
|
853
858
|
git_mwindow_close(mwindow);
|
854
859
|
|
860
|
+
if (!bytes)
|
861
|
+
break;
|
862
|
+
|
855
863
|
*position += window_len - zstream.in_len;
|
856
864
|
total += bytes;
|
857
|
-
} while (
|
865
|
+
} while (!git_zstream_eos(&zstream));
|
858
866
|
|
859
867
|
if (total != size || !git_zstream_eos(&zstream)) {
|
860
868
|
git_error_set(GIT_ERROR_ZLIB, "error inflating zlib stream");
|
@@ -878,18 +886,21 @@ out:
|
|
878
886
|
* curpos is where the data starts, delta_obj_offset is the where the
|
879
887
|
* header starts
|
880
888
|
*/
|
881
|
-
|
882
|
-
|
883
|
-
|
884
|
-
|
885
|
-
|
886
|
-
|
889
|
+
int get_delta_base(
|
890
|
+
off64_t *delta_base_out,
|
891
|
+
struct git_pack_file *p,
|
892
|
+
git_mwindow **w_curs,
|
893
|
+
off64_t *curpos,
|
894
|
+
git_object_t type,
|
895
|
+
off64_t delta_obj_offset)
|
887
896
|
{
|
888
897
|
unsigned int left = 0;
|
889
898
|
unsigned char *base_info;
|
890
899
|
off64_t base_offset;
|
891
900
|
git_oid unused;
|
892
901
|
|
902
|
+
assert(delta_base_out);
|
903
|
+
|
893
904
|
base_info = pack_window_open(p, w_curs, *curpos, &left);
|
894
905
|
/* Assumption: the only reason this would fail is because the file is too small */
|
895
906
|
if (base_info == NULL)
|
@@ -909,12 +920,12 @@ off64_t get_delta_base(
|
|
909
920
|
return GIT_EBUFS;
|
910
921
|
unsigned_base_offset += 1;
|
911
922
|
if (!unsigned_base_offset || MSB(unsigned_base_offset, 7))
|
912
|
-
return
|
923
|
+
return packfile_error("overflow");
|
913
924
|
c = base_info[used++];
|
914
925
|
unsigned_base_offset = (unsigned_base_offset << 7) + (c & 127);
|
915
926
|
}
|
916
927
|
if (unsigned_base_offset == 0 || (size_t)delta_obj_offset <= unsigned_base_offset)
|
917
|
-
return
|
928
|
+
return packfile_error("out of bounds");
|
918
929
|
base_offset = delta_obj_offset - unsigned_base_offset;
|
919
930
|
*curpos += used;
|
920
931
|
} else if (type == GIT_OBJECT_REF_DELTA) {
|
@@ -925,8 +936,12 @@ off64_t get_delta_base(
|
|
925
936
|
|
926
937
|
git_oid_fromraw(&oid, base_info);
|
927
938
|
if ((entry = git_oidmap_get(p->idx_cache, &oid)) != NULL) {
|
939
|
+
if (entry->offset == 0)
|
940
|
+
return packfile_error("delta offset is zero");
|
941
|
+
|
928
942
|
*curpos += 20;
|
929
|
-
|
943
|
+
*delta_base_out = entry->offset;
|
944
|
+
return 0;
|
930
945
|
} else {
|
931
946
|
/* If we're building an index, don't try to find the pack
|
932
947
|
* entry; we just haven't seen it yet. We'll make
|
@@ -941,9 +956,13 @@ off64_t get_delta_base(
|
|
941
956
|
return packfile_error("base entry delta is not in the same pack");
|
942
957
|
*curpos += 20;
|
943
958
|
} else
|
944
|
-
return
|
959
|
+
return packfile_error("unknown object type");
|
960
|
+
|
961
|
+
if (base_offset == 0)
|
962
|
+
return packfile_error("delta offset is zero");
|
945
963
|
|
946
|
-
|
964
|
+
*delta_base_out = base_offset;
|
965
|
+
return 0;
|
947
966
|
}
|
948
967
|
|
949
968
|
/***********************************************************
|
@@ -1238,14 +1257,14 @@ int git_pack_foreach_entry(
|
|
1238
1257
|
return error;
|
1239
1258
|
}
|
1240
1259
|
|
1241
|
-
|
1242
|
-
|
1260
|
+
int git_pack__lookup_sha1(const void *oid_lookup_table, size_t stride, unsigned lo,
|
1261
|
+
unsigned hi, const unsigned char *oid_prefix)
|
1243
1262
|
{
|
1244
|
-
const unsigned char *base =
|
1263
|
+
const unsigned char *base = oid_lookup_table;
|
1245
1264
|
|
1246
1265
|
while (lo < hi) {
|
1247
1266
|
unsigned mi = (lo + hi) / 2;
|
1248
|
-
int cmp = git_oid__hashcmp(base + mi * stride,
|
1267
|
+
int cmp = git_oid__hashcmp(base + mi * stride, oid_prefix);
|
1249
1268
|
|
1250
1269
|
if (!cmp)
|
1251
1270
|
return mi;
|
@@ -1307,7 +1326,7 @@ static int pack_entry_find_offset(
|
|
1307
1326
|
short_oid->id[0], short_oid->id[1], short_oid->id[2], lo, hi, p->num_objects);
|
1308
1327
|
#endif
|
1309
1328
|
|
1310
|
-
pos =
|
1329
|
+
pos = git_pack__lookup_sha1(index, stride, lo, hi, short_oid->id);
|
1311
1330
|
|
1312
1331
|
if (pos >= 0) {
|
1313
1332
|
/* An object matching exactly the oid was found */
|
data/vendor/libgit2/src/pack.h
CHANGED
@@ -106,6 +106,19 @@ struct git_pack_file {
|
|
106
106
|
char pack_name[GIT_FLEX_ARRAY]; /* more */
|
107
107
|
};
|
108
108
|
|
109
|
+
/**
|
110
|
+
* Return the position where an OID (or a prefix) would be inserted within the
|
111
|
+
* OID Lookup Table of an .idx file. This performs binary search between the lo
|
112
|
+
* and hi indices.
|
113
|
+
*
|
114
|
+
* The stride parameter is provided because .idx files version 1 store the OIDs
|
115
|
+
* interleaved with the 4-byte file offsets of the objects within the .pack
|
116
|
+
* file (stride = 24), whereas files with version 2 store them in a contiguous
|
117
|
+
* flat array (stride = 20).
|
118
|
+
*/
|
119
|
+
int git_pack__lookup_sha1(const void *oid_lookup_table, size_t stride, unsigned lo,
|
120
|
+
unsigned hi, const unsigned char *oid_prefix);
|
121
|
+
|
109
122
|
struct git_pack_entry {
|
110
123
|
off64_t offset;
|
111
124
|
git_oid sha1;
|
@@ -143,8 +156,12 @@ int git_packfile_stream_open(git_packfile_stream *obj, struct git_pack_file *p,
|
|
143
156
|
ssize_t git_packfile_stream_read(git_packfile_stream *obj, void *buffer, size_t len);
|
144
157
|
void git_packfile_stream_dispose(git_packfile_stream *obj);
|
145
158
|
|
146
|
-
|
147
|
-
off64_t *
|
159
|
+
int get_delta_base(
|
160
|
+
off64_t *delta_base_out,
|
161
|
+
struct git_pack_file *p,
|
162
|
+
git_mwindow **w_curs,
|
163
|
+
off64_t *curpos,
|
164
|
+
git_object_t type,
|
148
165
|
off64_t delta_obj_offset);
|
149
166
|
|
150
167
|
void git_packfile_close(struct git_pack_file *p, bool unlink_packfile);
|
@@ -209,9 +209,7 @@ static int patch_generated_load(git_patch_generated *patch, git_patch_generated_
|
|
209
209
|
|
210
210
|
if ((error = git_diff_file_content__load(
|
211
211
|
&patch->ofile, &patch->base.diff_opts)) < 0 ||
|
212
|
-
|
213
|
-
goto cleanup;
|
214
|
-
if ((error = git_diff_file_content__load(
|
212
|
+
(error = git_diff_file_content__load(
|
215
213
|
&patch->nfile, &patch->base.diff_opts)) < 0 ||
|
216
214
|
should_skip_binary(patch, patch->nfile.file))
|
217
215
|
goto cleanup;
|
@@ -198,7 +198,7 @@ static int parse_header_git_index(
|
|
198
198
|
return -1;
|
199
199
|
|
200
200
|
if (git_parse_peek(&c, &ctx->parse_ctx, 0) == 0 && c == ' ') {
|
201
|
-
uint16_t mode;
|
201
|
+
uint16_t mode = 0;
|
202
202
|
|
203
203
|
git_parse_advance_chars(&ctx->parse_ctx, 1);
|
204
204
|
|
@@ -407,10 +407,12 @@ static const parse_header_transition transitions[] = {
|
|
407
407
|
|
408
408
|
{ "--- " , STATE_DIFF, STATE_PATH, parse_header_git_oldpath },
|
409
409
|
{ "--- " , STATE_INDEX, STATE_PATH, parse_header_git_oldpath },
|
410
|
+
{ "--- " , STATE_FILEMODE, STATE_PATH, parse_header_git_oldpath },
|
410
411
|
{ "+++ " , STATE_PATH, STATE_END, parse_header_git_newpath },
|
411
412
|
{ "GIT binary patch" , STATE_INDEX, STATE_END, NULL },
|
412
413
|
{ "Binary files " , STATE_INDEX, STATE_END, NULL },
|
413
414
|
|
415
|
+
{ "similarity index " , STATE_END, STATE_SIMILARITY, parse_header_similarity },
|
414
416
|
{ "similarity index " , STATE_DIFF, STATE_SIMILARITY, parse_header_similarity },
|
415
417
|
{ "dissimilarity index ", STATE_DIFF, STATE_SIMILARITY, parse_header_dissimilarity },
|
416
418
|
{ "rename from " , STATE_SIMILARITY, STATE_RENAME, parse_header_renamefrom },
|
@@ -940,7 +942,7 @@ static int parse_patch_body(
|
|
940
942
|
return parse_patch_hunks(patch, ctx);
|
941
943
|
}
|
942
944
|
|
943
|
-
int check_header_names(
|
945
|
+
static int check_header_names(
|
944
946
|
const char *one,
|
945
947
|
const char *two,
|
946
948
|
const char *old_or_new,
|
data/vendor/libgit2/src/path.c
CHANGED
@@ -322,7 +322,7 @@ int git_path_root(const char *path)
|
|
322
322
|
return -1; /* Not a real error - signals that path is not rooted */
|
323
323
|
}
|
324
324
|
|
325
|
-
void
|
325
|
+
static void path_trim_slashes(git_buf *path)
|
326
326
|
{
|
327
327
|
int ceiling = git_path_root(path->ptr) + 1;
|
328
328
|
assert(ceiling >= 0);
|
@@ -1219,7 +1219,7 @@ int git_path_diriter_init(
|
|
1219
1219
|
if (git_buf_puts(&diriter->path_utf8, path) < 0)
|
1220
1220
|
return -1;
|
1221
1221
|
|
1222
|
-
|
1222
|
+
path_trim_slashes(&diriter->path_utf8);
|
1223
1223
|
|
1224
1224
|
if (diriter->path_utf8.size == 0) {
|
1225
1225
|
git_error_set(GIT_ERROR_FILESYSTEM, "could not open directory '%s'", path);
|
@@ -1368,7 +1368,7 @@ int git_path_diriter_init(
|
|
1368
1368
|
if (git_buf_puts(&diriter->path, path) < 0)
|
1369
1369
|
return -1;
|
1370
1370
|
|
1371
|
-
|
1371
|
+
path_trim_slashes(&diriter->path);
|
1372
1372
|
|
1373
1373
|
if (diriter->path.size == 0) {
|
1374
1374
|
git_error_set(GIT_ERROR_FILESYSTEM, "could not open directory '%s'", path);
|
@@ -2045,7 +2045,7 @@ int git_path_validate_system_file_ownership(const char *path)
|
|
2045
2045
|
git_error_set(GIT_ERROR_INVALID, "programdata configuration file owner is not valid");
|
2046
2046
|
ret = GIT_ERROR;
|
2047
2047
|
}
|
2048
|
-
|
2048
|
+
git__free(info);
|
2049
2049
|
|
2050
2050
|
cleanup:
|
2051
2051
|
if (descriptor)
|
@@ -238,9 +238,9 @@ int git_pathspec__init(git_pathspec *ps, const git_strarray *paths)
|
|
238
238
|
memset(ps, 0, sizeof(*ps));
|
239
239
|
|
240
240
|
ps->prefix = git_pathspec_prefix(paths);
|
241
|
-
git_pool_init(&ps->pool, 1);
|
242
241
|
|
243
|
-
if ((error =
|
242
|
+
if ((error = git_pool_init(&ps->pool, 1)) < 0 ||
|
243
|
+
(error = git_pathspec__vinit(&ps->pathspec, paths, &ps->pool)) < 0)
|
244
244
|
git_pathspec__clear(ps);
|
245
245
|
|
246
246
|
return error;
|
@@ -316,7 +316,8 @@ static git_pathspec_match_list *pathspec_match_alloc(
|
|
316
316
|
if (!m)
|
317
317
|
return NULL;
|
318
318
|
|
319
|
-
git_pool_init(&m->pool, 1)
|
319
|
+
if (git_pool_init(&m->pool, 1) < 0)
|
320
|
+
return NULL;
|
320
321
|
|
321
322
|
/* need to keep reference to pathspec and increment refcount because
|
322
323
|
* failures array stores pointers to the pattern strings of the
|
data/vendor/libgit2/src/pool.c
CHANGED
@@ -21,30 +21,29 @@ struct git_pool_page {
|
|
21
21
|
|
22
22
|
static void *pool_alloc_page(git_pool *pool, size_t size);
|
23
23
|
|
24
|
-
|
25
|
-
{
|
26
|
-
static size_t size = 0;
|
24
|
+
#ifndef GIT_DEBUG_POOL
|
27
25
|
|
28
|
-
|
29
|
-
size_t page_size;
|
30
|
-
if (git__page_size(&page_size) < 0)
|
31
|
-
page_size = 4096;
|
32
|
-
/* allow space for malloc overhead */
|
33
|
-
size = (page_size - (2 * sizeof(void *)) - sizeof(git_pool_page));
|
34
|
-
}
|
26
|
+
static size_t system_page_size = 0;
|
35
27
|
|
36
|
-
|
28
|
+
int git_pool_global_init(void)
|
29
|
+
{
|
30
|
+
if (git__page_size(&system_page_size) < 0)
|
31
|
+
system_page_size = 4096;
|
32
|
+
/* allow space for malloc overhead */
|
33
|
+
system_page_size -= (2 * sizeof(void *)) + sizeof(git_pool_page);
|
34
|
+
return 0;
|
37
35
|
}
|
38
36
|
|
39
|
-
|
40
|
-
void git_pool_init(git_pool *pool, size_t item_size)
|
37
|
+
int git_pool_init(git_pool *pool, size_t item_size)
|
41
38
|
{
|
42
39
|
assert(pool);
|
43
40
|
assert(item_size >= 1);
|
44
41
|
|
45
42
|
memset(pool, 0, sizeof(git_pool));
|
46
43
|
pool->item_size = item_size;
|
47
|
-
pool->page_size =
|
44
|
+
pool->page_size = system_page_size;
|
45
|
+
|
46
|
+
return 0;
|
48
47
|
}
|
49
48
|
|
50
49
|
void git_pool_clear(git_pool *pool)
|
@@ -112,6 +111,11 @@ bool git_pool__ptr_in_pool(git_pool *pool, void *ptr)
|
|
112
111
|
|
113
112
|
#else
|
114
113
|
|
114
|
+
int git_pool_global_init(void)
|
115
|
+
{
|
116
|
+
return 0;
|
117
|
+
}
|
118
|
+
|
115
119
|
static int git_pool__ptr_cmp(const void * a, const void * b)
|
116
120
|
{
|
117
121
|
if(a > b) {
|
@@ -125,7 +129,7 @@ static int git_pool__ptr_cmp(const void * a, const void * b)
|
|
125
129
|
}
|
126
130
|
}
|
127
131
|
|
128
|
-
|
132
|
+
int git_pool_init(git_pool *pool, size_t item_size)
|
129
133
|
{
|
130
134
|
assert(pool);
|
131
135
|
assert(item_size >= 1);
|
@@ -134,6 +138,8 @@ void git_pool_init(git_pool *pool, size_t item_size)
|
|
134
138
|
pool->item_size = item_size;
|
135
139
|
pool->page_size = git_pool__system_page_size();
|
136
140
|
git_vector_init(&pool->allocations, 100, git_pool__ptr_cmp);
|
141
|
+
|
142
|
+
return 0;
|
137
143
|
}
|
138
144
|
|
139
145
|
void git_pool_clear(git_pool *pool)
|