line |
true |
false |
branch |
59
|
4 |
91 |
return (pa < pb) ? -1 : (pa > pb) ? 1 : 0; |
80
|
0 |
178 |
if (!scan) |
83
|
352 |
178 |
while (*scan) { |
84
|
174 |
352 |
while (git__isspace(*scan)) scan++; |
86
|
1669 |
178 |
for (start = scan, has_eq = 0; *scan && !git__isspace(*scan); ++scan) { |
|
1495 |
174 |
for (start = scan, has_eq = 0; *scan && !git__isspace(*scan); ++scan) { |
87
|
0 |
1495 |
if (*scan == '=') |
91
|
352 |
0 |
if (scan > start) { |
93
|
352 |
0 |
if (has_eq || *start == '-' || *start == '+' || *start == '!') |
|
352 |
0 |
if (has_eq || *start == '-' || *start == '+' || *start == '!') |
|
265 |
87 |
if (has_eq || *start == '-' || *start == '+' || *start == '!') |
|
0 |
265 |
if (has_eq || *start == '-' || *start == '+' || *start == '!') |
96
|
0 |
352 |
if (has_eq) |
111
|
352 |
178 |
for (i = 0; i < fdef->nattrs; ++i) { |
117
|
0 |
0 |
for (scan++; *scan != '='; scan++) /* find '=' */; |
141
|
29 |
0 |
fdef ? ((const git_filter_def *)fdef)->filter_name : NULL; |
142
|
29 |
0 |
return name ? git__strcmp(key, name) : -1; |
147
|
0 |
0 |
const void *filter = fdef ? ((const git_filter_def *)fdef)->filter : NULL; |
148
|
0 |
0 |
return (key == filter) ? 0 : -1; |
159
|
0 |
178 |
if (filter_def_scan_attrs(&attrs, &nattr, &nmatch, filter->attributes) < 0) |
162
|
0 |
178 |
GIT_ERROR_CHECK_ALLOC_MULTIPLY(&alloc_len, nattr, 2); |
|
0 |
178 |
GIT_ERROR_CHECK_ALLOC_MULTIPLY(&alloc_len, nattr, 2); |
163
|
0 |
178 |
GIT_ERROR_CHECK_ALLOC_MULTIPLY(&alloc_len, alloc_len, sizeof(char *)); |
|
0 |
178 |
GIT_ERROR_CHECK_ALLOC_MULTIPLY(&alloc_len, alloc_len, sizeof(char *)); |
164
|
0 |
178 |
GIT_ERROR_CHECK_ALLOC_ADD(&alloc_len, alloc_len, sizeof(git_filter_def)); |
|
0 |
178 |
GIT_ERROR_CHECK_ALLOC_ADD(&alloc_len, alloc_len, sizeof(git_filter_def)); |
167
|
0 |
178 |
GIT_ERROR_CHECK_ALLOC(fdef); |
170
|
0 |
178 |
GIT_ERROR_CHECK_ALLOC(fdef->filter_name); |
180
|
0 |
178 |
if (git_vector_insert(&filter_registry.filters, fdef) < 0) { |
196
|
0 |
87 |
if (git_rwlock_init(&filter_registry.lock) < 0) |
199
|
0 |
87 |
if ((error = git_vector_init(&filter_registry.filters, 2, |
205
|
87 |
0 |
GIT_FILTER_CRLF, crlf, GIT_FILTER_CRLF_PRIORITY) < 0 || |
206
|
0 |
87 |
(ident = git_ident_filter_new()) == NULL || |
211
|
87 |
0 |
if (!error) |
215
|
0 |
87 |
if (error) { |
228
|
0 |
0 |
if (git_rwlock_wrlock(&filter_registry.lock) < 0) |
231
|
0 |
0 |
git_vector_foreach(&filter_registry.filters, pos, fdef) { |
232
|
0 |
0 |
if (fdef->filter && fdef->filter->shutdown) { |
|
0 |
0 |
if (fdef->filter && fdef->filter->shutdown) { |
260
|
5 |
3 |
if (!filter_registry_find(pos, name)) |
272
|
0 |
4 |
GIT_ASSERT_ARG(name); |
273
|
0 |
4 |
GIT_ASSERT_ARG(filter); |
275
|
0 |
4 |
if (git_rwlock_wrlock(&filter_registry.lock) < 0) { |
280
|
0 |
4 |
if (!filter_registry_find(NULL, name)) { |
300
|
0 |
4 |
GIT_ASSERT_ARG(name); |
303
|
4 |
0 |
if (!strcmp(GIT_FILTER_CRLF, name) || !strcmp(GIT_FILTER_IDENT, name)) { |
|
0 |
4 |
if (!strcmp(GIT_FILTER_CRLF, name) || !strcmp(GIT_FILTER_IDENT, name)) { |
308
|
0 |
4 |
if (git_rwlock_wrlock(&filter_registry.lock) < 0) { |
313
|
0 |
4 |
if ((fdef = filter_registry_lookup(&pos, name)) == NULL) { |
321
|
4 |
0 |
if (fdef->initialized && fdef->filter && fdef->filter->shutdown) { |
|
4 |
0 |
if (fdef->initialized && fdef->filter && fdef->filter->shutdown) { |
|
2 |
2 |
if (fdef->initialized && fdef->filter && fdef->filter->shutdown) { |
339
|
18 |
0 |
if (!fdef->initialized && fdef->filter && fdef->filter->initialize) { |
|
18 |
0 |
if (!fdef->initialized && fdef->filter && fdef->filter->initialize) { |
|
1 |
17 |
if (!fdef->initialized && fdef->filter && fdef->filter->initialize) { |
340
|
0 |
1 |
if ((error = fdef->filter->initialize(fdef->filter)) < 0) |
354
|
0 |
4 |
if (git_rwlock_rdlock(&filter_registry.lock) < 0) { |
359
|
1 |
3 |
if ((fdef = filter_registry_lookup(&pos, name)) == NULL || |
|
0 |
1 |
if ((fdef = filter_registry_lookup(&pos, name)) == NULL || |
360
|
0 |
0 |
(!fdef->initialized && filter_initialize(fdef) < 0)) |
392
|
0 |
1 |
return git_oid_is_zero(&src->oid) ? NULL : &src->oid; |
409
|
71 |
0 |
size_t pathlen = src->path ? strlen(src->path) : 0, alloclen; |
411
|
0 |
71 |
GIT_ERROR_CHECK_ALLOC_ADD(&alloclen, sizeof(git_filter_list), pathlen); |
|
0 |
71 |
GIT_ERROR_CHECK_ALLOC_ADD(&alloclen, sizeof(git_filter_list), pathlen); |
412
|
0 |
71 |
GIT_ERROR_CHECK_ALLOC_ADD(&alloclen, alloclen, 1); |
|
0 |
71 |
GIT_ERROR_CHECK_ALLOC_ADD(&alloclen, alloclen, 1); |
415
|
0 |
71 |
GIT_ERROR_CHECK_ALLOC(fl); |
417
|
71 |
0 |
if (src->path) |
441
|
0 |
527 |
GIT_ERROR_CHECK_ALLOC(strs); |
443
|
0 |
527 |
if ((src->options.flags & GIT_FILTER_NO_SYSTEM_ATTRIBUTES) != 0) |
446
|
0 |
527 |
if ((src->options.flags & GIT_FILTER_ATTRIBUTES_FROM_HEAD) != 0) |
449
|
0 |
527 |
if ((src->options.flags & GIT_FILTER_ATTRIBUTES_FROM_COMMIT) != 0) { |
453
|
0 |
0 |
if (src->options.commit_id) |
464
|
0 |
527 |
if (error == GIT_ENOTFOUND && !fdef->nmatches) { |
|
0 |
0 |
if (error == GIT_ENOTFOUND && !fdef->nmatches) { |
470
|
1314 |
260 |
for (i = 0; !error && i < fdef->nattrs; ++i) { |
|
1047 |
267 |
for (i = 0; !error && i < fdef->nattrs; ++i) { |
474
|
787 |
260 |
if (!want) |
480
|
260 |
0 |
if (want_type != found_type) |
482
|
0 |
0 |
else if (want_type == GIT_ATTR_VALUE_STRING && |
|
0 |
0 |
else if (want_type == GIT_ATTR_VALUE_STRING && |
483
|
0 |
0 |
strcmp(want, strs[i]) && |
488
|
260 |
267 |
if (error) |
525
|
0 |
260 |
if (git_rwlock_rdlock(&filter_registry.lock) < 0) { |
536
|
31 |
229 |
if (blob) |
539
|
527 |
260 |
git_vector_foreach(&filter_registry.filters, idx, fdef) { |
543
|
527 |
0 |
if (!fdef || !fdef->filter) |
|
0 |
527 |
if (!fdef || !fdef->filter) |
546
|
527 |
0 |
if (fdef->nattrs > 0) { |
551
|
260 |
267 |
if (error == GIT_ENOTFOUND) { |
554
|
0 |
267 |
} else if (error < 0) |
558
|
18 |
249 |
if (!fdef->initialized && (error = filter_initialize(fdef)) < 0) |
|
0 |
18 |
if (!fdef->initialized && (error = filter_initialize(fdef)) < 0) |
561
|
265 |
2 |
if (fdef->filter->check) |
567
|
192 |
75 |
if (error == GIT_PASSTHROUGH) |
569
|
0 |
75 |
else if (error < 0) |
572
|
71 |
4 |
if (!fl) { |
573
|
0 |
71 |
if ((error = filter_list_new(&fl, &src)) < 0) |
579
|
71 |
4 |
fe = git_array_alloc(fl->filters); |
|
71 |
0 |
fe = git_array_alloc(fl->filters); |
580
|
0 |
75 |
GIT_ERROR_CHECK_ALLOC(fe); |
590
|
0 |
260 |
if (error && fl != NULL) { |
|
0 |
0 |
if (error && fl != NULL) { |
610
|
0 |
0 |
if (opts) |
637
|
142 |
71 |
if (!fl) |
640
|
75 |
71 |
for (i = 0; i < git_array_size(fl->filters); ++i) { |
641
|
75 |
0 |
git_filter_entry *fe = git_array_get(fl->filters, i); |
642
|
72 |
3 |
if (fe->filter->cleanup) |
656
|
0 |
0 |
GIT_ASSERT_ARG(name); |
658
|
0 |
0 |
if (!fl) |
661
|
0 |
0 |
for (i = 0; i < fl->filters.size; i++) { |
662
|
0 |
0 |
if (strcmp(fl->filters.ptr[i].filter_name, name) == 0) |
677
|
0 |
0 |
GIT_ASSERT_ARG(fl); |
678
|
0 |
0 |
GIT_ASSERT_ARG(filter); |
680
|
0 |
0 |
if (git_rwlock_rdlock(&filter_registry.lock) < 0) { |
685
|
0 |
0 |
if (git_vector_search2( |
692
|
0 |
0 |
if (fdef == NULL) { |
697
|
0 |
0 |
if (!fdef->initialized && (error = filter_initialize(fdef)) < 0) |
|
0 |
0 |
if (!fdef->initialized && (error = filter_initialize(fdef)) < 0) |
700
|
0 |
0 |
fe = git_array_alloc(fl->filters); |
|
0 |
0 |
fe = git_array_alloc(fl->filters); |
701
|
0 |
0 |
GIT_ERROR_CHECK_ALLOC(fe); |
710
|
40 |
0 |
return fl ? git_array_size(fl->filters) : 0; |
723
|
0 |
63 |
GIT_ASSERT_ARG(buf_stream); |
724
|
0 |
63 |
GIT_ASSERT(buf_stream->complete == 0); |
732
|
0 |
63 |
GIT_ASSERT_ARG(buf_stream); |
734
|
0 |
63 |
GIT_ASSERT(buf_stream->complete == 0); |
763
|
2 |
0 |
GIT_BUF_WRAP_PRIVATE(out, git_filter_list__apply_to_buffer, filters, in, in_len); |
|
2 |
0 |
GIT_BUF_WRAP_PRIVATE(out, git_filter_list__apply_to_buffer, filters, in, in_len); |
777
|
0 |
42 |
if ((error = git_filter_list_stream_buffer(filters, |
781
|
0 |
42 |
GIT_ASSERT(writer.complete); |
792
|
40 |
2 |
if (!filters || git_filter_list_length(filters) == 0) { |
|
0 |
40 |
if (!filters || git_filter_list_length(filters) == 0) { |
801
|
40 |
0 |
if (!error) |
813
|
2 |
0 |
GIT_BUF_WRAP_PRIVATE(out, git_filter_list__apply_to_file, filters, repo, path); |
|
2 |
0 |
GIT_BUF_WRAP_PRIVATE(out, git_filter_list__apply_to_file, filters, repo, path); |
827
|
2 |
17 |
if ((error = git_filter_list_stream_file( |
831
|
0 |
17 |
GIT_ASSERT(writer.complete); |
839
|
0 |
33 |
if (!git__is_sizet(rawsize)) { |
853
|
2 |
0 |
GIT_BUF_WRAP_PRIVATE(out, git_filter_list__apply_to_blob, filters, blob); |
|
2 |
0 |
GIT_BUF_WRAP_PRIVATE(out, git_filter_list__apply_to_blob, filters, blob); |
866
|
0 |
2 |
if ((error = git_filter_list_stream_blob( |
870
|
0 |
2 |
GIT_ASSERT(writer.complete); |
891
|
0 |
77 |
GIT_ASSERT_ARG(buffered_stream); |
914
|
0 |
79 |
GIT_ASSERT_ARG(buffered_stream); |
917
|
4 |
75 |
if (buffered_stream->write_fn == NULL) { |
942
|
69 |
10 |
if (error == GIT_PASSTHROUGH) { |
944
|
8 |
2 |
} else if (error == 0) { |
955
|
77 |
0 |
if ((error = buffered_stream->target->write( |
966
|
79 |
0 |
if (buffered_stream) { |
983
|
0 |
75 |
GIT_ERROR_CHECK_ALLOC(buffered_stream); |
990
|
75 |
0 |
buffered_stream->output = temp_buf ? temp_buf : &buffered_stream->temp_buf; |
995
|
0 |
75 |
if (temp_buf) |
1013
|
0 |
4 |
GIT_ERROR_CHECK_ALLOC(buffered_stream); |
1020
|
3 |
1 |
buffered_stream->output = temp_buf ? temp_buf : &buffered_stream->temp_buf; |
1025
|
1 |
3 |
if (temp_buf) |
1040
|
4 |
75 |
GIT_ASSERT(fe->filter->stream || fe->filter->apply); |
|
0 |
4 |
GIT_ASSERT(fe->filter->stream || fe->filter->apply); |
1046
|
4 |
75 |
if (!fe->filter->stream) { |
1054
|
0 |
75 |
GIT_ASSERT(fe->filter->stream); |
1071
|
19 |
75 |
if (!filters) { |
1077
|
79 |
75 |
for (i = 0; i < git_array_size(filters->filters); ++i) { |
1079
|
17 |
62 |
git_array_size(filters->filters) - 1 - i : i; |
1081
|
79 |
0 |
git_filter_entry *fe = git_array_get(filters->filters, filter_idx); |
1086
|
0 |
79 |
if (error < 0) |
1094
|
0 |
75 |
if (error) |
1107
|
79 |
94 |
git_vector_foreach(streams, i, stream) |
1120
|
19 |
0 |
const char *base = repo ? git_repository_workdir(repo) : NULL; |
1126
|
19 |
0 |
if ((error = stream_list_init( |
1127
|
19 |
0 |
&stream_start, &filter_streams, filters, target)) < 0 || |
1128
|
19 |
0 |
(error = git_fs_path_join_unrooted(&abspath, path, base, NULL)) < 0 || |
1134
|
0 |
19 |
if ((fd = git_futils_open_ro(abspath.ptr)) < 0) { |
1139
|
19 |
19 |
while ((readlen = p_read(fd, buf, sizeof(buf))) > 0) { |
1140
|
0 |
19 |
if ((error = stream_start->write(stream_start, buf, readlen)) < 0) |
1144
|
0 |
19 |
if (readlen < 0) |
1148
|
19 |
0 |
if (initialized) |
1151
|
19 |
0 |
if (fd >= 0) |
1168
|
0 |
75 |
if ((error = stream_list_init(&stream_start, &filter_streams, filters, target)) < 0) |
1172
|
0 |
75 |
if ((error = stream_start->write(stream_start, buffer, len)) < 0) |
1176
|
75 |
0 |
if (initialized) |
1190
|
0 |
33 |
if (buf_from_blob(&in, blob) < 0) |
1193
|
14 |
19 |
if (filters) |
1201
|
0 |
0 |
GIT_INIT_STRUCTURE_FROM_TEMPLATE(filter, version, git_filter, GIT_FILTER_INIT); |