line |
true |
false |
branch |
24
|
0 |
27 |
if (!delta) |
30
|
27 |
0 |
if (d->old_file.path != NULL) { |
32
|
0 |
27 |
if (delta->old_file.path == NULL) |
36
|
0 |
27 |
if (d->new_file.path != d->old_file.path && d->new_file.path != NULL) { |
|
0 |
0 |
if (d->new_file.path != d->old_file.path && d->new_file.path != NULL) { |
38
|
0 |
0 |
if (delta->new_file.path == NULL) |
71
|
0 |
3 |
if (b->status == GIT_DELTA_CONFLICTED) |
73
|
0 |
3 |
if (a->status == GIT_DELTA_CONFLICTED) |
77
|
3 |
0 |
if (b->status == GIT_DELTA_UNMODIFIED || a->status == GIT_DELTA_DELETED) |
|
0 |
3 |
if (b->status == GIT_DELTA_UNMODIFIED || a->status == GIT_DELTA_DELETED) |
81
|
0 |
3 |
if ((dup = git_diff__delta_dup(b, pool)) == NULL) |
85
|
3 |
0 |
if (a->status == GIT_DELTA_UNMODIFIED || |
|
3 |
0 |
if (a->status == GIT_DELTA_UNMODIFIED || |
86
|
0 |
3 |
a->status == GIT_DELTA_UNTRACKED || |
90
|
0 |
3 |
assert(b->status != GIT_DELTA_UNMODIFIED); |
95
|
0 |
3 |
if (dup->status == GIT_DELTA_DELETED) { |
96
|
0 |
0 |
if (a->status == GIT_DELTA_ADDED) { |
124
|
6 |
0 |
assert(onto && from); |
|
0 |
6 |
assert(onto && from); |
126
|
2 |
4 |
if (!from->deltas.length) |
132
|
4 |
0 |
if (ignore_case != ((from->opts.flags & GIT_DIFF_IGNORE_CASE) != 0) || |
|
0 |
4 |
if (ignore_case != ((from->opts.flags & GIT_DIFF_IGNORE_CASE) != 0) || |
143
|
18 |
13 |
for (i = 0, j = 0; i < onto->deltas.length || j < from->deltas.length; ) { |
|
9 |
4 |
for (i = 0, j = 0; i < onto->deltas.length || j < from->deltas.length; ) { |
144
|
18 |
9 |
git_diff_delta *o = GIT_VECTOR_GET(&onto->deltas, i); |
145
|
27 |
0 |
const git_diff_delta *f = GIT_VECTOR_GET(&from->deltas, j); |
146
|
27 |
0 |
int cmp = !f ? -1 : !o ? 1 : |
|
18 |
9 |
int cmp = !f ? -1 : !o ? 1 : |
147
|
0 |
18 |
STRCMP_CASESELECT(ignore_case, o->old_file.path, f->old_file.path); |
149
|
0 |
27 |
if (cmp < 0) { |
152
|
24 |
3 |
} else if (cmp > 0) { |
156
|
0 |
3 |
const git_diff_delta *left = reversed ? f : o; |
157
|
0 |
3 |
const git_diff_delta *right = reversed ? o : f; |
167
|
27 |
0 |
if (delta && git_diff_delta__should_skip(&onto->opts, delta)) { |
|
0 |
27 |
if (delta && git_diff_delta__should_skip(&onto->opts, delta)) { |
172
|
27 |
0 |
if ((error = !delta ? -1 : git_vector_insert(&onto_new, delta)) < 0) |
|
0 |
27 |
if ((error = !delta ? -1 : git_vector_insert(&onto_new, delta)) < 0) |
176
|
4 |
0 |
if (!error) { |
180
|
0 |
4 |
if ((onto->opts.flags & GIT_DIFF_REVERSE) != 0) |
234
|
0 |
7 |
if (error < 0) |
253
|
0 |
11 |
GIT_ERROR_CHECK_VERSION(given, GIT_DIFF_FIND_OPTIONS_VERSION, "git_diff_find_options"); |
259
|
11 |
0 |
if (given) |
262
|
11 |
0 |
if (!given || |
|
2 |
9 |
if (!given || |
265
|
2 |
0 |
if (cfg) { |
270
|
2 |
0 |
if (!git__parse_bool(&boolval, rule) && !boolval) |
|
0 |
2 |
if (!git__parse_bool(&boolval, rule) && !boolval) |
272
|
2 |
0 |
else if (!strcasecmp(rule, "copies") || !strcasecmp(rule, "copy")) |
|
0 |
2 |
else if (!strcasecmp(rule, "copies") || !strcasecmp(rule, "copy")) |
286
|
0 |
11 |
if (opts->flags & GIT_DIFF_FIND_EXACT_MATCH_ONLY) { |
296
|
0 |
11 |
if (opts->flags & GIT_DIFF_FIND_RENAMES_FROM_REWRITES) |
299
|
0 |
11 |
if (opts->flags & GIT_DIFF_FIND_COPIES_FROM_UNMODIFIED) |
302
|
1 |
10 |
if (opts->flags & GIT_DIFF_BREAK_REWRITES) |
307
|
1 |
10 |
if (USE_DEFAULT(opts->rename_threshold)) |
|
0 |
1 |
if (USE_DEFAULT(opts->rename_threshold)) |
310
|
1 |
10 |
if (USE_DEFAULT(opts->rename_from_rewrite_threshold)) |
|
0 |
1 |
if (USE_DEFAULT(opts->rename_from_rewrite_threshold)) |
313
|
1 |
10 |
if (USE_DEFAULT(opts->copy_threshold)) |
|
0 |
1 |
if (USE_DEFAULT(opts->copy_threshold)) |
316
|
1 |
10 |
if (USE_DEFAULT(opts->break_rewrite_threshold)) |
|
0 |
1 |
if (USE_DEFAULT(opts->break_rewrite_threshold)) |
321
|
10 |
1 |
if (!opts->rename_limit) { |
322
|
10 |
0 |
if (cfg) { |
327
|
0 |
10 |
if (opts->rename_limit <= 0) |
332
|
11 |
0 |
if (!opts->metric) { |
334
|
0 |
11 |
GIT_ERROR_CHECK_ALLOC(opts->metric); |
341
|
1 |
10 |
if (opts->flags & GIT_DIFF_FIND_IGNORE_WHITESPACE) |
343
|
0 |
10 |
else if (opts->flags & GIT_DIFF_FIND_DONT_IGNORE_WHITESPACE) |
359
|
0 |
0 |
GIT_ERROR_CHECK_ALLOC(deleted); |
377
|
0 |
6 |
if (git_vector_init(&onto, expected_size, git_diff_delta__cmp) < 0) |
381
|
15 |
6 |
git_vector_foreach(&diff->deltas, i, delta) { |
382
|
6 |
9 |
if ((delta->flags & GIT_DIFF_FLAG__TO_DELETE) != 0) |
385
|
0 |
9 |
if ((delta->flags & GIT_DIFF_FLAG__TO_SPLIT) != 0 && actually_split) { |
|
0 |
0 |
if ((delta->flags & GIT_DIFF_FLAG__TO_SPLIT) != 0 && actually_split) { |
388
|
0 |
0 |
if (insert_delete_side_of_split(diff, &onto, delta) < 0) |
391
|
0 |
0 |
if (diff->new_src == GIT_ITERATOR_WORKDIR) |
404
|
9 |
0 |
if (delta->status != GIT_DELTA_COPIED && |
|
3 |
6 |
if (delta->status != GIT_DELTA_COPIED && |
405
|
0 |
3 |
delta->status != GIT_DELTA_RENAMED && |
406
|
0 |
0 |
(delta->status != GIT_DELTA_MODIFIED || actually_split)) |
410
|
0 |
9 |
if (git_vector_insert(&onto, delta) < 0) |
417
|
15 |
6 |
git_vector_foreach(&diff->deltas, i, delta) { |
418
|
6 |
9 |
if ((delta->flags & GIT_DIFF_FLAG__TO_DELETE) != 0) |
438
|
17 |
14 |
return (idx & 1) ? &delta->new_file : &delta->old_file; |
455
|
7 |
4 |
info->src = (file_idx & 1) ? diff->new_src : diff->old_src; |
462
|
4 |
7 |
if (info->file->size > 0 || info->src == GIT_ITERATOR_WORKDIR) |
|
0 |
4 |
if (info->file->size > 0 || info->src == GIT_ITERATOR_WORKDIR) |
477
|
5 |
6 |
if (info->src == GIT_ITERATOR_WORKDIR) { |
478
|
0 |
5 |
if ((error = git_buf_joinpath( |
483
|
0 |
5 |
if (!git_path_isfile(info->data.ptr)) |
495
|
0 |
6 |
if (info->odb_obj != NULL) |
502
|
0 |
6 |
if (error < 0) { |
509
|
0 |
6 |
if (file->size != git_blob_rawsize(info->blob)) |
512
|
6 |
0 |
sz = git__is_sizet(file->size) ? (size_t)file->size : (size_t)-1; |
525
|
0 |
14 |
if (info->odb_obj) |
528
|
6 |
8 |
if (info->blob) |
557
|
10 |
0 |
if (!GIT_MODE_ISBLOB(a_file->mode) || !GIT_MODE_ISBLOB(b_file->mode)) |
|
0 |
10 |
if (!GIT_MODE_ISBLOB(a_file->mode) || !GIT_MODE_ISBLOB(b_file->mode)) |
561
|
0 |
10 |
if (exact_match) { |
562
|
0 |
0 |
if (git_oid_is_zero(&a_file->id) && |
|
0 |
0 |
if (git_oid_is_zero(&a_file->id) && |
563
|
0 |
0 |
diff->old_src == GIT_ITERATOR_WORKDIR && |
568
|
0 |
0 |
if (git_oid_is_zero(&b_file->id) && |
|
0 |
0 |
if (git_oid_is_zero(&b_file->id) && |
569
|
0 |
0 |
diff->new_src == GIT_ITERATOR_WORKDIR && |
576
|
3 |
7 |
if (git_oid__cmp(&a_file->id, &b_file->id) == 0) { |
582
|
0 |
7 |
if (exact_match) { |
591
|
4 |
3 |
if (!cache[a_idx] && (error = similarity_init(&a_info, diff, a_idx)) < 0) |
|
0 |
4 |
if (!cache[a_idx] && (error = similarity_init(&a_info, diff, a_idx)) < 0) |
593
|
7 |
0 |
if (!cache[b_idx] && (error = similarity_init(&b_info, diff, b_idx)) < 0) |
|
0 |
7 |
if (!cache[b_idx] && (error = similarity_init(&b_info, diff, b_idx)) < 0) |
597
|
0 |
7 |
if (a_file->size > 127 && |
|
0 |
0 |
if (a_file->size > 127 && |
598
|
0 |
0 |
b_file->size > 127 && |
599
|
0 |
0 |
(a_file->size > (b_file->size << 3) || |
604
|
4 |
3 |
if (!cache[a_idx]) { |
605
|
0 |
4 |
if ((error = similarity_sig(&a_info, opts, cache)) < 0) |
608
|
7 |
0 |
if (!cache[b_idx]) { |
609
|
0 |
7 |
if ((error = similarity_sig(&b_info, opts, cache)) < 0) |
616
|
7 |
0 |
if (cache[a_idx] && cache[b_idx]) |
|
7 |
0 |
if (cache[a_idx] && cache[b_idx]) |
634
|
0 |
0 |
git_diff_delta *delta = GIT_VECTOR_GET(&diff->deltas, delta_idx); |
636
|
0 |
0 |
if ((delta->flags & GIT_DIFF_FLAG__HAS_SELF_SIMILARITY) != 0) |
641
|
0 |
0 |
if (error < 0) |
644
|
0 |
0 |
if (similarity >= 0) { |
658
|
25 |
0 |
git_diff_delta *delta = GIT_VECTOR_GET(&diff->deltas, delta_idx); |
661
|
10 |
15 |
if (!GIT_MODE_ISBLOB(delta->new_file.mode)) |
675
|
2 |
0 |
if (!FLAG_SET(opts, GIT_DIFF_FIND_REWRITES) && |
|
2 |
0 |
if (!FLAG_SET(opts, GIT_DIFF_FIND_REWRITES) && |
679
|
0 |
0 |
if (calc_self_similarity(diff, opts, delta_idx, cache) < 0) |
682
|
0 |
0 |
if (FLAG_SET(opts, GIT_DIFF_BREAK_REWRITES) && |
|
0 |
0 |
if (FLAG_SET(opts, GIT_DIFF_BREAK_REWRITES) && |
687
|
0 |
0 |
if (FLAG_SET(opts, GIT_DIFF_FIND_RENAMES_FROM_REWRITES) && |
|
0 |
0 |
if (FLAG_SET(opts, GIT_DIFF_FIND_RENAMES_FROM_REWRITES) && |
696
|
0 |
7 |
if (!FLAG_SET(opts, GIT_DIFF_FIND_FOR_UNTRACKED)) |
714
|
25 |
0 |
git_diff_delta *delta = GIT_VECTOR_GET(&diff->deltas, delta_idx); |
717
|
16 |
9 |
if (!GIT_MODE_ISBLOB(delta->old_file.mode)) |
733
|
0 |
0 |
if (!FLAG_SET(opts, GIT_DIFF_FIND_COPIES_FROM_UNMODIFIED)) |
735
|
0 |
0 |
if (FLAG_SET(opts, GIT_DIFF_FIND_REMOVE_UNMODIFIED)) |
741
|
0 |
2 |
if (FLAG_SET(opts, GIT_DIFF_FIND_COPIES)) |
745
|
2 |
0 |
if (!FLAG_SET(opts, GIT_DIFF_FIND_REWRITES) && |
|
2 |
0 |
if (!FLAG_SET(opts, GIT_DIFF_FIND_REWRITES) && |
749
|
0 |
0 |
if (calc_self_similarity(diff, opts, delta_idx, cache) < 0) |
752
|
0 |
0 |
if (FLAG_SET(opts, GIT_DIFF_BREAK_REWRITES) && |
|
0 |
0 |
if (FLAG_SET(opts, GIT_DIFF_BREAK_REWRITES) && |
758
|
0 |
0 |
if (FLAG_SET(opts, GIT_DIFF_FIND_RENAMES_FROM_REWRITES) && |
|
0 |
0 |
if (FLAG_SET(opts, GIT_DIFF_FIND_RENAMES_FROM_REWRITES) && |
771
|
0 |
0 |
return (delta->status == GIT_DELTA_TYPECHANGE || |
|
0 |
0 |
return (delta->status == GIT_DELTA_TYPECHANGE || |
777
|
0 |
1 |
return (delta->status == GIT_DELTA_ADDED || |
778
|
0 |
0 |
delta->status == GIT_DELTA_UNTRACKED || |
779
|
1 |
5 |
delta->status == GIT_DELTA_UNREADABLE || |
|
0 |
0 |
delta->status == GIT_DELTA_UNREADABLE || |
818
|
0 |
11 |
assert(diff); |
820
|
0 |
11 |
if ((error = normalize_find_opts(diff, &opts, given_opts)) < 0) |
826
|
11 |
0 |
if (!num_deltas || !git__is_uint32(num_deltas)) |
|
11 |
0 |
if (!num_deltas || !git__is_uint32(num_deltas)) |
830
|
0 |
11 |
if ((opts.flags & GIT_DIFF_FIND_ALL) == 0) |
833
|
0 |
11 |
GIT_ERROR_CHECK_ALLOC_MULTIPLY(&sigcache_size, num_deltas, 2); |
|
0 |
11 |
GIT_ERROR_CHECK_ALLOC_MULTIPLY(&sigcache_size, num_deltas, 2); |
835
|
0 |
11 |
GIT_ERROR_CHECK_ALLOC(sigcache); |
842
|
25 |
11 |
git_vector_foreach(&diff->deltas, t, tgt) { |
843
|
7 |
18 |
if (is_rename_source(diff, &opts, t, sigcache)) |
846
|
13 |
12 |
if (is_rename_target(diff, &opts, t, sigcache)) |
849
|
0 |
25 |
if ((tgt->flags & GIT_DIFF_FLAG__TO_SPLIT) != 0) |
854
|
7 |
4 |
if (!num_srcs || !num_tgts) |
|
7 |
0 |
if (!num_srcs || !num_tgts) |
858
|
0 |
7 |
GIT_ERROR_CHECK_ALLOC(src2tgt); |
860
|
0 |
7 |
GIT_ERROR_CHECK_ALLOC(tgt2src); |
862
|
0 |
7 |
if (FLAG_SET(&opts, GIT_DIFF_FIND_COPIES)) { |
864
|
0 |
0 |
GIT_ERROR_CHECK_ALLOC(tgt2src_copy); |
874
|
17 |
0 |
git_vector_foreach(&diff->deltas, t, tgt) { |
876
|
7 |
10 |
if ((tgt->flags & GIT_DIFF_FLAG__IS_RENAME_TARGET) == 0) |
881
|
17 |
0 |
git_vector_foreach(&diff->deltas, s, src) { |
883
|
7 |
10 |
if ((src->flags & GIT_DIFF_FLAG__IS_RENAME_SOURCE) == 0) |
887
|
0 |
10 |
if (s == t) |
889
|
0 |
10 |
else if ((error = similarity_measure( |
893
|
0 |
10 |
if (result < 0) |
898
|
6 |
4 |
if (tgt2src[t].similarity < similarity && |
|
6 |
0 |
if (tgt2src[t].similarity < similarity && |
902
|
0 |
6 |
if (src2tgt[s].similarity > 0) { |
906
|
0 |
6 |
if (tgt2src[t].similarity > 0) { |
919
|
0 |
10 |
if (tgt2src_copy != NULL && |
|
0 |
0 |
if (tgt2src_copy != NULL && |
926
|
10 |
0 |
if (++tried_srcs >= num_srcs) |
930
|
0 |
0 |
if (tried_srcs > opts.rename_limit) |
934
|
7 |
3 |
if (++tried_tgts >= num_tgts) |
938
|
0 |
7 |
if (num_bumped > 0) /* try again if we bumped some items */ |
945
|
19 |
7 |
git_vector_foreach(&diff->deltas, t, tgt) { |
947
|
9 |
10 |
if ((tgt->flags & GIT_DIFF_FLAG__IS_RENAME_TARGET) == 0) |
951
|
6 |
4 |
if (tgt2src[t].similarity) |
953
|
0 |
4 |
else if (tgt2src_copy && tgt2src_copy[t].similarity) |
|
0 |
0 |
else if (tgt2src_copy && tgt2src_copy[t].similarity) |
959
|
6 |
0 |
src = GIT_VECTOR_GET(&diff->deltas, s); |
969
|
6 |
0 |
if (src->status == GIT_DELTA_DELETED) { |
971
|
6 |
0 |
if (delta_is_new_only(tgt)) { |
973
|
0 |
6 |
if (best_match->similarity < opts.rename_threshold) |
981
|
0 |
0 |
assert(delta_is_split(tgt)); |
983
|
0 |
0 |
if (best_match->similarity < opts.rename_from_rewrite_threshold) |
991
|
0 |
0 |
assert(src->status == GIT_DELTA_DELETED); |
999
|
0 |
0 |
if (src2tgt[t].similarity > 0 && src2tgt[t].idx > t) { |
|
0 |
0 |
if (src2tgt[t].similarity > 0 && src2tgt[t].idx > t) { |
1006
|
0 |
0 |
else if (delta_is_split(src)) { |
1008
|
0 |
0 |
if (delta_is_new_only(tgt)) { |
1010
|
0 |
0 |
if (best_match->similarity < opts.rename_threshold) |
1015
|
0 |
0 |
src->status = (diff->new_src == GIT_ITERATOR_WORKDIR) ? |
1027
|
0 |
0 |
assert(delta_is_split(src)); |
1029
|
0 |
0 |
if (best_match->similarity < opts.rename_from_rewrite_threshold) |
1043
|
0 |
0 |
if (tgt2src[s].idx == t && |
|
0 |
0 |
if (tgt2src[s].idx == t && |
1053
|
0 |
0 |
else if (src2tgt[t].similarity > 0 && src2tgt[t].idx > t) { |
|
0 |
0 |
else if (src2tgt[t].similarity > 0 && src2tgt[t].idx > t) { |
1062
|
0 |
0 |
else if (FLAG_SET(&opts, GIT_DIFF_FIND_COPIES)) { |
1063
|
0 |
0 |
if (tgt2src_copy[t].similarity < opts.copy_threshold) |
1068
|
0 |
0 |
src = GIT_VECTOR_GET(&diff->deltas, best_match->idx); |
1070
|
0 |
0 |
if (delta_is_split(tgt)) { |
1072
|
0 |
0 |
if (error < 0) |
1077
|
0 |
0 |
if (!delta_is_split(tgt) && !delta_is_new_only(tgt)) |
|
0 |
0 |
if (!delta_is_split(tgt) && !delta_is_new_only(tgt)) |
1094
|
1 |
6 |
if (num_rewrites > 0 || num_updates > 0) |
|
0 |
1 |
if (num_rewrites > 0 || num_updates > 0) |
1097
|
1 |
5 |
FLAG_SET(&opts, GIT_DIFF_BREAK_REWRITES) && |
|
1 |
0 |
FLAG_SET(&opts, GIT_DIFF_BREAK_REWRITES) && |
1105
|
11 |
0 |
if (sigcache) { |
1106
|
50 |
11 |
for (t = 0; t < num_deltas * 2; ++t) { |
1107
|
11 |
39 |
if (sigcache[t] != NULL) |
1113
|
11 |
0 |
if (!given_opts || !given_opts->metric) |
|
11 |
0 |
if (!given_opts || !given_opts->metric) |