line |
true |
false |
branch |
79
|
34 |
19 |
if (!name) |
87
|
108 |
19 |
while ((c = *name++) != 0) { |
88
|
0 |
108 |
if (git__isspace(c)) |
101
|
0 |
7 |
if ((ret = git_repository_config_snapshot(&config, pb->repo)) < 0) |
119
|
0 |
7 |
config_get("pack.deltaCacheSize", pb->max_delta_cache_size, |
|
0 |
0 |
config_get("pack.deltaCacheSize", pb->max_delta_cache_size, |
|
7 |
0 |
config_get("pack.deltaCacheSize", pb->max_delta_cache_size, |
|
0 |
0 |
config_get("pack.deltaCacheSize", pb->max_delta_cache_size, |
121
|
0 |
7 |
config_get("pack.deltaCacheLimit", pb->cache_max_small_delta_size, |
|
0 |
0 |
config_get("pack.deltaCacheLimit", pb->cache_max_small_delta_size, |
|
7 |
0 |
config_get("pack.deltaCacheLimit", pb->cache_max_small_delta_size, |
|
0 |
0 |
config_get("pack.deltaCacheLimit", pb->cache_max_small_delta_size, |
123
|
0 |
7 |
config_get("pack.deltaCacheSize", pb->big_file_threshold, |
|
0 |
0 |
config_get("pack.deltaCacheSize", pb->big_file_threshold, |
|
7 |
0 |
config_get("pack.deltaCacheSize", pb->big_file_threshold, |
|
0 |
0 |
config_get("pack.deltaCacheSize", pb->big_file_threshold, |
125
|
0 |
7 |
config_get("pack.windowMemory", pb->window_memory_limit, 0); |
|
0 |
0 |
config_get("pack.windowMemory", pb->window_memory_limit, 0); |
|
7 |
0 |
config_get("pack.windowMemory", pb->window_memory_limit, 0); |
|
0 |
0 |
config_get("pack.windowMemory", pb->window_memory_limit, 0); |
142
|
0 |
7 |
GIT_ERROR_CHECK_ALLOC(pb); |
144
|
0 |
7 |
if (git_oidmap_new(&pb->object_ix) < 0) |
147
|
0 |
7 |
if (git_oidmap_new(&pb->walk_objects) < 0) |
156
|
7 |
0 |
git_zstream_init(&pb->zstream, GIT_ZSTREAM_DEFLATE) < 0 || |
157
|
7 |
0 |
git_repository_odb(&pb->odb, repo) < 0 || |
183
|
0 |
3 |
assert(pb); |
189
|
0 |
3 |
assert(1 == pb->nr_threads); |
202
|
0 |
6 |
for (i = 0, po = pb->object_list; i < pb->nr_objects; i++, po++) { |
203
|
0 |
0 |
if (git_oidmap_set(pb->object_ix, &po->id, po) < 0) |
217
|
64 |
0 |
assert(pb && oid); |
|
0 |
64 |
assert(pb && oid); |
221
|
11 |
53 |
if (git_oidmap_exists(pb->object_ix, oid)) |
224
|
6 |
47 |
if (pb->nr_objects >= pb->nr_alloc) { |
225
|
0 |
6 |
GIT_ERROR_CHECK_ALLOC_ADD(&newsize, pb->nr_alloc, 1024); |
|
0 |
6 |
GIT_ERROR_CHECK_ALLOC_ADD(&newsize, pb->nr_alloc, 1024); |
226
|
0 |
6 |
GIT_ERROR_CHECK_ALLOC_MULTIPLY(&newsize, newsize / 2, 3); |
|
0 |
6 |
GIT_ERROR_CHECK_ALLOC_MULTIPLY(&newsize, newsize / 2, 3); |
228
|
0 |
6 |
if (!git__is_uint32(newsize)) { |
237
|
0 |
6 |
GIT_ERROR_CHECK_ALLOC(pb->object_list); |
239
|
0 |
6 |
if (rehash(pb) < 0) |
246
|
0 |
53 |
if ((ret = git_odb_read_header(&po->size, &po->type, pb->odb, oid)) < 0) |
253
|
0 |
53 |
if (git_oidmap_set(pb->object_ix, &po->id, po) < 0) { |
260
|
32 |
21 |
if (pb->progress_cb) { |
264
|
2 |
30 |
if (elapsed >= MIN_PROGRESS_UPDATE_INTERVAL) { |
271
|
0 |
2 |
if (ret) |
297
|
0 |
0 |
if (error < 0 && error != GIT_EBUFS) |
|
0 |
0 |
if (error < 0 && error != GIT_EBUFS) |
300
|
0 |
0 |
if (error == GIT_EBUFS || delta_size != po->delta_size) { |
|
0 |
0 |
if (error == GIT_EBUFS || delta_size != po->delta_size) { |
335
|
3 |
50 |
if (po->delta) { |
336
|
3 |
0 |
if (po->delta_data) |
338
|
0 |
0 |
else if ((error = get_delta(&data, pb->odb, po)) < 0) |
344
|
0 |
50 |
if ((error = git_odb_read(&obj, pb->odb, &po->id)) < 0) |
355
|
53 |
0 |
if ((error = write_cb(hdr, hdr_len, cb_data)) < 0 || |
|
53 |
0 |
if ((error = write_cb(hdr, hdr_len, cb_data)) < 0 || |
359
|
3 |
50 |
if (type == GIT_OBJECT_REF_DELTA) { |
360
|
3 |
0 |
if ((error = write_cb(po->delta->id.id, GIT_OID_RAWSZ, cb_data)) < 0 || |
|
3 |
0 |
if ((error = write_cb(po->delta->id.id, GIT_OID_RAWSZ, cb_data)) < 0 || |
366
|
3 |
50 |
if (po->z_delta_size) { |
369
|
3 |
0 |
if ((error = write_cb(data, data_len, cb_data)) < 0 || |
|
3 |
0 |
if ((error = write_cb(data, data_len, cb_data)) < 0 || |
374
|
0 |
50 |
GIT_ERROR_CHECK_ALLOC(zbuf); |
378
|
0 |
50 |
if ((error = git_zstream_set_input(&pb->zstream, data, data_len)) < 0) |
381
|
50 |
50 |
while (!git_zstream_done(&pb->zstream)) { |
382
|
50 |
0 |
if ((error = git_zstream_get_output(zbuf, &zbuf_len, &pb->zstream)) < 0 || |
|
50 |
0 |
if ((error = git_zstream_get_output(zbuf, &zbuf_len, &pb->zstream)) < 0 || |
383
|
50 |
0 |
(error = write_cb(zbuf, zbuf_len, cb_data)) < 0 || |
398
|
3 |
50 |
if (po->delta) { |
427
|
0 |
56 |
if (po->recursing) { |
430
|
3 |
53 |
} else if (po->written) { |
435
|
3 |
50 |
if (po->delta) { |
438
|
0 |
3 |
if ((error = write_one(status, pb, po->delta, write_cb, cb_data)) < 0) |
442
|
0 |
3 |
if (*status == WRITE_ONE_RECURSIVE) |
456
|
0 |
53 |
if (po->filled) |
466
|
0 |
0 |
while (po) { |
467
|
0 |
0 |
if (add_to_order) { |
472
|
0 |
0 |
for (s = po->delta_sibling; s; s = s->delta_sibling) { |
477
|
0 |
0 |
if (po->delta_child) { |
483
|
0 |
0 |
if (po->delta_sibling) { |
489
|
0 |
0 |
while (po && !po->delta_sibling) { |
|
0 |
0 |
while (po && !po->delta_sibling) { |
494
|
0 |
0 |
if (!po) { |
509
|
0 |
0 |
for (root = po; root->delta; root = root->delta) |
521
|
0 |
0 |
if ((po = git_oidmap_get(pb->object_ix, oid)) == NULL) |
536
|
0 |
7 |
if ((wo = git__mallocarray(pb->nr_objects, sizeof(*wo))) == NULL) |
539
|
53 |
7 |
for (i = 0; i < pb->nr_objects; i++) { |
552
|
53 |
7 |
for (i = pb->nr_objects; i > 0;) { |
554
|
50 |
3 |
if (!po->delta) |
564
|
0 |
7 |
if (git_tag_foreach(pb->repo, &cb_tag_foreach, pb) < 0) { |
573
|
53 |
7 |
for (i = wo_end = 0; i < pb->nr_objects; i++) { |
575
|
0 |
53 |
if (po->tagged) |
584
|
0 |
7 |
for (; i < pb->nr_objects; i++) { |
586
|
0 |
0 |
if (po->tagged) |
593
|
0 |
7 |
for (i = last_untagged; i < pb->nr_objects; i++) { |
595
|
0 |
0 |
if (po->type != GIT_OBJECT_COMMIT && |
|
0 |
0 |
if (po->type != GIT_OBJECT_COMMIT && |
604
|
0 |
7 |
for (i = last_untagged; i < pb->nr_objects; i++) { |
606
|
0 |
0 |
if (po->type != GIT_OBJECT_TREE) |
614
|
0 |
7 |
for (i = last_untagged; i < pb->nr_objects; i++) { |
616
|
0 |
0 |
if (!po->filled) |
620
|
0 |
7 |
if (wo_end != pb->nr_objects) { |
642
|
0 |
7 |
if (write_order == NULL) |
645
|
0 |
7 |
if (!git__is_uint32(pb->nr_objects)) { |
655
|
7 |
0 |
if ((error = write_cb(&ph, sizeof(ph), cb_data)) < 0 || |
|
7 |
0 |
if ((error = write_cb(&ph, sizeof(ph), cb_data)) < 0 || |
662
|
53 |
7 |
for ( ; i < pb->nr_objects; ++i) { |
665
|
0 |
53 |
if ((error = write_one(&status, pb, po, write_cb, cb_data)) < 0) |
670
|
0 |
7 |
} while (pb->nr_remaining && i < pb->nr_objects); |
|
0 |
0 |
} while (pb->nr_remaining && i < pb->nr_objects); |
672
|
0 |
7 |
if ((error = git_hash_final(&entry_oid, &pb->ctx)) < 0) |
679
|
0 |
7 |
for ( ; i < pb->nr_objects; ++i) { |
681
|
0 |
0 |
if (po->delta_data) { |
702
|
9 |
34 |
if (a->type > b->type) |
704
|
17 |
17 |
if (a->type < b->type) |
706
|
0 |
17 |
if (a->hash > b->hash) |
708
|
0 |
17 |
if (a->hash < b->hash) |
718
|
6 |
11 |
if (a->size > b->size) |
720
|
6 |
5 |
if (a->size < b->size) |
722
|
4 |
1 |
return a < b ? -1 : (a > b); /* newest first */ |
733
|
0 |
3 |
if (git__add_sizet_overflow(&new_size, pb->delta_cache_size, delta_size)) |
736
|
3 |
0 |
if (pb->max_delta_cache_size && new_size > pb->max_delta_cache_size) |
|
0 |
3 |
if (pb->max_delta_cache_size && new_size > pb->max_delta_cache_size) |
739
|
3 |
0 |
if (delta_size < pb->cache_max_small_delta_size) |
743
|
0 |
0 |
if ((src_size >> 20) + (trg_size >> 21) > (delta_size >> 10)) |
761
|
13 |
20 |
if (trg_object->type != src_object->type) { |
771
|
0 |
20 |
if (src->depth >= max_depth) |
776
|
20 |
0 |
if (!trg_object->delta) { |
786
|
0 |
20 |
if (max_size == 0) |
790
|
0 |
20 |
sizediff = src_size < trg_size ? trg_size - src_size : 0; |
791
|
0 |
20 |
if (sizediff >= max_size) |
793
|
0 |
20 |
if (trg_size < src_size / 32) |
797
|
12 |
8 |
if (!trg->data) { |
798
|
0 |
12 |
if (git_odb_read(&obj, pb->odb, &trg_object->id) < 0) |
803
|
0 |
12 |
GIT_ERROR_CHECK_ALLOC(trg->data); |
808
|
0 |
12 |
if (sz != trg_size) { |
816
|
6 |
14 |
if (!src->data) { |
819
|
6 |
0 |
if (git_odb_read(&obj, pb->odb, &src_object->id) < 0 || |
|
0 |
6 |
if (git_odb_read(&obj, pb->odb, &src_object->id) < 0 || |
825
|
0 |
6 |
GIT_ERROR_CHECK_ALLOC(src->data); |
830
|
0 |
6 |
if (sz != src_size) { |
838
|
12 |
8 |
if (!src->index) { |
839
|
0 |
12 |
if (git_delta_index_init(&src->index, src->data, src_size) < 0) |
845
|
17 |
3 |
if (git_delta_create_from_index(&delta_buf, &delta_size, src->index, trg->data, trg_size, |
849
|
0 |
3 |
if (trg_object->delta) { |
851
|
0 |
0 |
if (delta_size == trg_object->delta_size && |
|
0 |
0 |
if (delta_size == trg_object->delta_size && |
859
|
0 |
3 |
if (trg_object->delta_data) { |
861
|
0 |
0 |
assert(pb->delta_cache_size >= trg_object->delta_size); |
865
|
3 |
0 |
if (delta_cacheable(pb, src_size, trg_size, delta_size)) { |
871
|
0 |
3 |
if (overflow) { |
877
|
0 |
3 |
GIT_ERROR_CHECK_ALLOC(trg_object->delta_data); |
897
|
0 |
0 |
while (child) { |
899
|
0 |
0 |
if (m < c) |
910
|
0 |
24 |
if (n->index) { |
916
|
0 |
24 |
if (n->data) { |
931
|
19 |
11 |
if (pb->progress_cb) { |
935
|
16 |
3 |
if (force || elapsed >= MIN_PROGRESS_UPDATE_INTERVAL) { |
|
1 |
15 |
if (force || elapsed >= MIN_PROGRESS_UPDATE_INTERVAL) { |
942
|
0 |
4 |
if (ret) |
962
|
0 |
6 |
GIT_ERROR_CHECK_ALLOC(array); |
969
|
6 |
24 |
if (!*list_size) { |
984
|
0 |
24 |
while (pb->window_memory_limit && |
|
0 |
0 |
while (pb->window_memory_limit && |
985
|
0 |
0 |
mem_usage > pb->window_memory_limit && |
998
|
0 |
24 |
if (po->delta_child) { |
1001
|
0 |
0 |
if (delta_limit > max_depth) |
1008
|
44 |
0 |
while (--j > 0) { |
1013
|
33 |
11 |
if (other_idx >= window) |
1017
|
11 |
33 |
if (!m->object) |
1020
|
0 |
33 |
if (try_delta(pb, n, m, max_depth, &mem_usage, &ret) < 0) |
1022
|
13 |
20 |
if (ret < 0) |
1024
|
3 |
17 |
else if (ret > 0) |
1042
|
3 |
21 |
if (po->delta_data) { |
1043
|
0 |
3 |
if (git_zstream_deflatebuf(&zbuf, po->delta_data, po->delta_size) < 0) |
1048
|
0 |
3 |
GIT_ERROR_CHECK_ALLOC(po->delta_data); |
1065
|
3 |
21 |
if (po->delta && max_depth <= n->depth) |
|
0 |
3 |
if (po->delta && max_depth <= n->depth) |
1073
|
3 |
21 |
if (po->delta) { |
1077
|
5 |
3 |
while (dist--) { |
1087
|
24 |
0 |
if (count + 1 < window) |
1089
|
0 |
24 |
if (idx >= window) |
1095
|
66 |
6 |
for (i = 0; i < window; ++i) { |
1319
|
10 |
1 |
if (pb->nr_objects == 0 || pb->done) |
|
4 |
6 |
if (pb->nr_objects == 0 || pb->done) |
1326
|
3 |
3 |
if (pb->progress_cb) |
1330
|
0 |
6 |
GIT_ERROR_CHECK_ALLOC(delta_list); |
1332
|
53 |
6 |
for (i = 0; i < pb->nr_objects; ++i) { |
1336
|
24 |
29 |
if (po->size < 50 || po->size > pb->big_file_threshold) |
|
0 |
24 |
if (po->size < 50 || po->size > pb->big_file_threshold) |
1342
|
6 |
0 |
if (n > 1) { |
1344
|
0 |
6 |
if (ll_find_deltas(pb, delta_list, n, |
1363
|
0 |
4 |
PREPARE_PACK; |
1369
|
0 |
3 |
PREPARE_PACK; |
1393
|
0 |
4 |
PREPARE_PACK; |
1398
|
0 |
4 |
if (git_indexer_new( |
1402
|
4 |
0 |
if (!git_repository__configmap_lookup(&t, pb->repo, GIT_CONFIGMAP_FSYNCOBJECTFILES) && t) |
|
0 |
4 |
if (!git_repository__configmap_lookup(&t, pb->repo, GIT_CONFIGMAP_FSYNCOBJECTFILES) && t) |
1435
|
0 |
11 |
if (git_tree_entry_type(entry) == GIT_OBJECT_COMMIT) |
1438
|
11 |
0 |
if (!(error = git_buf_sets(&ctx->buf, root)) && |
|
11 |
0 |
if (!(error = git_buf_sets(&ctx->buf, root)) && |
1454
|
0 |
4 |
if (git_packbuilder_insert_tree(pb, git_commit_tree_id(commit)) < 0) |
1467
|
4 |
0 |
if (!(error = git_tree_lookup(&tree, pb->repo, oid)) && |
|
4 |
0 |
if (!(error = git_tree_lookup(&tree, pb->repo, oid)) && |
1481
|
1 |
0 |
assert(pb && id); |
|
0 |
1 |
assert(pb && id); |
1483
|
0 |
1 |
if ((error = git_object_lookup(&obj, pb->repo, id, GIT_OBJECT_ANY)) < 0) |
1497
|
0 |
0 |
if ((error = git_packbuilder_insert(pb, id, name)) < 0) |
1527
|
0 |
36 |
if (!obj) { |
1543
|
36 |
8 |
if ((obj = git_oidmap_get(pb->walk_objects, id)) == NULL) { |
1544
|
0 |
36 |
if ((error = lookup_walk_object(&obj, pb, id)) < 0) |
1547
|
0 |
36 |
if ((error = git_oidmap_set(pb->walk_objects, &obj->id, obj)) < 0) |
1560
|
0 |
0 |
if ((error = retrieve_object(&obj, pb, id)) < 0) |
1575
|
0 |
0 |
if ((error = retrieve_object(&obj, pb, id)) < 0) |
1578
|
0 |
0 |
if (obj->uninteresting) |
1583
|
0 |
0 |
if ((error = git_tree_lookup(&tree, pb->repo, id)) < 0) |
1586
|
0 |
0 |
for (i = 0; i < git_tree_entrycount(tree); i++) { |
1591
|
0 |
0 |
if ((error = mark_tree_uninteresting(pb, entry_id)) < 0) |
1595
|
0 |
0 |
if ((error = mark_blob_uninteresting(pb, entry_id)) < 0) |
1620
|
3 |
3 |
for (list = commits; list; list = list->next) { |
1621
|
3 |
0 |
if (!list->item->uninteresting) |
1624
|
0 |
0 |
if ((error = git_commit_lookup(&commit, pb->repo, &list->item->oid)) < 0) |
1630
|
0 |
0 |
if (error < 0) |
1645
|
0 |
17 |
if ((error = retrieve_object(&obj, pb, git_tree_id(tree))) < 0) |
1648
|
17 |
0 |
if (obj->seen || obj->uninteresting) |
|
0 |
17 |
if (obj->seen || obj->uninteresting) |
1653
|
0 |
17 |
if ((error = git_packbuilder_insert(pb, &obj->id, NULL))) |
1656
|
26 |
17 |
for (i = 0; i < git_tree_entrycount(tree); i++) { |
1661
|
0 |
8 |
if ((error = git_tree_lookup(&subtree, pb->repo, entry_id)) < 0) |
1667
|
0 |
8 |
if (error < 0) |
1672
|
0 |
18 |
if ((error = retrieve_object(&obj, pb, entry_id)) < 0) |
1674
|
0 |
18 |
if (obj->uninteresting) |
1677
|
0 |
18 |
if ((error = git_packbuilder_insert(pb, entry_id, name)) < 0) |
1698
|
0 |
9 |
if ((error = git_packbuilder_insert(pb, &obj->id, NULL)) < 0) |
1701
|
0 |
9 |
if ((error = git_commit_lookup(&commit, pb->repo, &obj->id)) < 0) |
1704
|
0 |
9 |
if ((error = git_tree_lookup(&tree, pb->repo, git_commit_tree_id(commit))) < 0) |
1707
|
0 |
9 |
if ((error = insert_tree(pb, tree)) < 0) |
1722
|
3 |
0 |
assert(pb && walk); |
|
0 |
3 |
assert(pb && walk); |
1724
|
0 |
3 |
if ((error = mark_edges_uninteresting(pb, walk->user_input)) < 0) |
1735
|
9 |
3 |
while ((error = git_revwalk_next(&id, walk)) == 0) { |
1736
|
0 |
9 |
if ((error = retrieve_object(&obj, pb, &id)) < 0) |
1739
|
9 |
0 |
if (obj->seen || obj->uninteresting) |
|
0 |
9 |
if (obj->seen || obj->uninteresting) |
1742
|
0 |
9 |
if ((error = insert_commit(pb, obj)) < 0) |
1746
|
3 |
0 |
if (error == GIT_ITEROVER) |
1754
|
0 |
3 |
if (!pb) |
1765
|
0 |
7 |
if (pb == NULL) |
1776
|
7 |
0 |
if (pb->odb) |
1779
|
7 |
0 |
if (pb->object_ix) |
1782
|
6 |
1 |
if (pb->object_list) |