line |
true |
false |
branch |
25
|
2426 |
0 |
if (unlock) |
39
|
0 |
2426 |
GIT_ERROR_CHECK_ALLOC(attrs); |
41
|
0 |
2426 |
if (git_mutex_init(&attrs->lock) < 0) { |
46
|
0 |
2426 |
if (git_pool_init(&attrs->pool, 1) < 0) |
65
|
0 |
2426 |
if (need_lock && git_mutex_lock(&file->lock) < 0) { |
|
0 |
0 |
if (need_lock && git_mutex_lock(&file->lock) < 0) { |
70
|
44 |
2426 |
git_vector_foreach(&file->rules, i, rule) |
74
|
0 |
2426 |
if (need_lock) |
82
|
649 |
7895 |
if (!file) |
84
|
2426 |
5469 |
GIT_REFCOUNT_DEC(file, attr_file_free); |
|
2426 |
0 |
GIT_REFCOUNT_DEC(file, attr_file_free); |
95
|
1272 |
0 |
if ((error = git_repository_index__weakptr(&idx, repo)) < 0 || |
|
1272 |
0 |
if ((error = git_repository_index__weakptr(&idx, repo)) < 0 || |
99
|
0 |
0 |
if (!(entry = git_index_get_byindex(idx, pos))) |
137
|
0 |
1272 |
if ((error = attr_file_oid_from_index(&id, repo, entry->path)) < 0 || |
|
0 |
0 |
if ((error = attr_file_oid_from_index(&id, repo, entry->path)) < 0 || |
145
|
0 |
0 |
GIT_ERROR_CHECK_BLOBSIZE(blobsize); |
155
|
15 |
2397 |
if (p_stat(entry->fullpath, &st) < 0 || |
|
15 |
0 |
if (p_stat(entry->fullpath, &st) < 0 || |
156
|
15 |
0 |
S_ISDIR(st.st_mode) || |
157
|
0 |
15 |
(fd = git_futils_open_ro(entry->fullpath)) < 0 || |
161
|
15 |
2397 |
if (fd >= 0) |
168
|
0 |
0 |
if (source->type == GIT_ATTR_FILE_SOURCE_COMMIT) { |
169
|
0 |
0 |
if ((error = git_commit_lookup(&commit, repo, source->commit_id)) < 0 || |
|
0 |
0 |
if ((error = git_commit_lookup(&commit, repo, source->commit_id)) < 0 || |
173
|
0 |
0 |
if ((error = git_repository_head_tree(&tree, repo)) < 0) |
177
|
0 |
0 |
if ((error = git_tree_entry_bypath(&tree_entry, tree, entry->path)) < 0) { |
183
|
0 |
0 |
if (error == GIT_ENOTFOUND) { |
191
|
0 |
0 |
if ((error = git_blob_lookup(&blob, repo, git_tree_entry_id(tree_entry))) < 0) |
200
|
0 |
0 |
GIT_ERROR_CHECK_BLOBSIZE(blobsize); |
201
|
0 |
0 |
if ((error = git_str_put(&content, |
212
|
0 |
2426 |
if ((error = git_attr_file__new(&file, entry, source)) < 0) |
219
|
0 |
2426 |
if (bom == GIT_STR_BOM_UTF8) |
225
|
117 |
2309 |
if (attr_session) |
228
|
2412 |
14 |
if (parser && (error = parser(repo, file, content_str, allow_macros)) < 0) { |
|
0 |
2412 |
if (parser && (error = parser(repo, file, content_str, allow_macros)) < 0) { |
234
|
2397 |
29 |
if (nonexistent) |
236
|
0 |
29 |
else if (source->type == GIT_ATTR_FILE_SOURCE_INDEX) |
238
|
0 |
29 |
else if (source->type == GIT_ATTR_FILE_SOURCE_HEAD) |
240
|
0 |
29 |
else if (source->type == GIT_ATTR_FILE_SOURCE_COMMIT) |
242
|
15 |
14 |
else if (source->type == GIT_ATTR_FILE_SOURCE_FILE) |
264
|
0 |
3043 |
if (!file) |
270
|
465 |
2578 |
if (attr_session && attr_session->key == file->session_key) |
|
361 |
104 |
if (attr_session && attr_session->key == file->session_key) |
272
|
2325 |
357 |
else if (file->nonexistent) |
287
|
0 |
0 |
if ((error = attr_file_oid_from_index( |
298
|
0 |
0 |
if (error < 0) |
312
|
0 |
0 |
if ((error = git_commit_lookup(&commit, repo, source->commit_id)) < 0) |
318
|
0 |
0 |
if (error < 0) |
348
|
2059 |
0 |
if (attrs->entry && git_fs_path_root(attrs->entry->path) < 0 && |
352
|
0 |
2059 |
if (git_mutex_lock(&attrs->lock) < 0) { |
357
|
2059 |
0 |
while (!error && *scan) { |
|
0 |
2059 |
while (!error && *scan) { |
359
|
0 |
0 |
if (!rule) { |
361
|
0 |
0 |
GIT_ERROR_CHECK_ALLOC(rule); |
368
|
0 |
0 |
if ((error = git_attr_fnmatch__parse(&rule->match, &attrs->pool, context, &scan)) < 0 || |
|
0 |
0 |
if ((error = git_attr_fnmatch__parse(&rule->match, &attrs->pool, context, &scan)) < 0 || |
371
|
0 |
0 |
if (error != GIT_ENOTFOUND) |
377
|
0 |
0 |
if (rule->match.flags & GIT_ATTR_FNMATCH_MACRO) { |
379
|
0 |
0 |
if (!allow_macros) |
381
|
0 |
0 |
if ((error = git_attr_cache__insert_macro(repo, rule)) < 0) |
383
|
0 |
0 |
} else if ((error = git_vector_insert(&attrs->rules, rule)) < 0) |
401
|
0 |
4 |
GIT_ASSERT_ARG(name); |
403
|
20 |
4 |
while ((c = (int)*name++) != 0) |
423
|
0 |
0 |
git_attr_file__foreach_matching_rule(file, path, i, rule) { |
|
0 |
0 |
git_attr_file__foreach_matching_rule(file, path, i, rule) { |
426
|
0 |
0 |
if (!git_vector_bsearch(&pos, &rule->assigns, &name)) { |
443
|
0 |
0 |
if ((error = git_futils_readbuffer(&content, path)) < 0) |
451
|
0 |
0 |
if ((error = git_attr_file__new(&file, NULL, &source)) < 0 || |
|
0 |
0 |
if ((error = git_attr_file__new(&file, NULL, &source)) < 0 || |
452
|
0 |
0 |
(error = git_attr_file__parse_buffer(NULL, file, content.ptr, true)) < 0 || |
458
|
0 |
0 |
if (error < 0) |
478
|
0 |
2330 |
if (match->containing_dir) { |
479
|
0 |
0 |
if (match->flags & GIT_ATTR_FNMATCH_ICASE) { |
480
|
0 |
0 |
if (git__strncasecmp(path->path, match->containing_dir, match->containing_dir_length)) |
483
|
0 |
0 |
if (git__prefixcmp(path->path, match->containing_dir)) |
490
|
0 |
2330 |
if (match->flags & GIT_ATTR_FNMATCH_ICASE) |
493
|
0 |
2330 |
if (match->flags & GIT_ATTR_FNMATCH_FULLPATH) { |
500
|
0 |
2330 |
if ((match->flags & GIT_ATTR_FNMATCH_DIRECTORY) && !path->is_dir) { |
|
0 |
0 |
if ((match->flags & GIT_ATTR_FNMATCH_DIRECTORY) && !path->is_dir) { |
508
|
0 |
0 |
if (!(match->flags & GIT_ATTR_FNMATCH_IGNORE) || |
|
0 |
0 |
if (!(match->flags & GIT_ATTR_FNMATCH_IGNORE) || |
514
|
0 |
0 |
!strcasecmp(match->pattern, relpath) : |
517
|
0 |
0 |
if (samename) |
532
|
0 |
0 |
if (rule->match.flags & GIT_ATTR_FNMATCH_NEGATIVE) |
546
|
0 |
0 |
if (git_vector_bsearch(&pos, &rule->assigns, &key)) |
563
|
0 |
1394 |
if (git_fs_path_join_unrooted(&info->full, path, base, &root) < 0) |
569
|
1911 |
0 |
while (info->full.size > 0) { |
570
|
1394 |
517 |
if (info->full.ptr[info->full.size - 1] != '/') |
577
|
0 |
1394 |
while (*info->path == '/') |
582
|
249 |
1145 |
if (info->basename) |
584
|
249 |
1145 |
if (!info->basename || !*info->basename) |
|
0 |
249 |
if (!info->basename || !*info->basename) |
652
|
128 |
0 |
for (n = len; n; n--) { |
653
|
128 |
0 |
if (p[n-1] != ' ' && p[n-1] != '\t') |
|
128 |
0 |
if (p[n-1] != ' ' && p[n-1] != '\t') |
664
|
0 |
0 |
while (i > 1 && p[i-2] == '\\') |
|
0 |
0 |
while (i > 1 && p[i-2] == '\\') |
666
|
0 |
0 |
if ((n - i) % 2) |
677
|
0 |
128 |
if (!str) |
680
|
637 |
128 |
for (scan = str; *scan; scan++) { |
681
|
637 |
0 |
if (!escaped && *scan == '\\') { |
|
0 |
637 |
if (!escaped && *scan == '\\') { |
687
|
0 |
637 |
if (escaped && !git__isspace(*scan)) |
|
0 |
0 |
if (escaped && !git__isspace(*scan)) |
694
|
0 |
128 |
if (pos != scan) |
715
|
0 |
156 |
GIT_ASSERT_ARG(spec); |
716
|
156 |
0 |
GIT_ASSERT_ARG(base && *base); |
|
0 |
156 |
GIT_ASSERT_ARG(base && *base); |
718
|
0 |
156 |
if (parse_optimized_patterns(spec, pool, *base)) |
726
|
0 |
156 |
while (!allow_space && git__isspace(*pattern)) |
|
0 |
0 |
while (!allow_space && git__isspace(*pattern)) |
729
|
156 |
0 |
if (!*pattern || *pattern == '#' || *pattern == '\n' || |
|
128 |
28 |
if (!*pattern || *pattern == '#' || *pattern == '\n' || |
|
128 |
0 |
if (!*pattern || *pattern == '#' || *pattern == '\n' || |
|
0 |
128 |
if (!*pattern || *pattern == '#' || *pattern == '\n' || |
730
|
0 |
0 |
(*pattern == '\r' && *(pattern + 1) == '\n')) { |
735
|
0 |
128 |
if (*pattern == '[' && (spec->flags & GIT_ATTR_FNMATCH_ALLOWMACRO) != 0) { |
|
0 |
0 |
if (*pattern == '[' && (spec->flags & GIT_ATTR_FNMATCH_ALLOWMACRO) != 0) { |
736
|
0 |
0 |
if (strncmp(pattern, "[attr]", 6) == 0) { |
743
|
0 |
128 |
if (*pattern == '!' && (spec->flags & GIT_ATTR_FNMATCH_ALLOWNEG) != 0) { |
|
0 |
0 |
if (*pattern == '!' && (spec->flags & GIT_ATTR_FNMATCH_ALLOWNEG) != 0) { |
751
|
683 |
84 |
for (scan = pattern; *scan != '\0'; ++scan) { |
754
|
0 |
683 |
if (c == '\\' && !escaped) { |
|
0 |
0 |
if (c == '\\' && !escaped) { |
757
|
44 |
639 |
} else if (git__isspace(c) && !escaped) { |
|
44 |
0 |
} else if (git__isspace(c) && !escaped) { |
758
|
44 |
0 |
if (!allow_space || (c != ' ' && c != '\t' && c != '\r')) |
|
44 |
0 |
if (!allow_space || (c != ' ' && c != '\t' && c != '\r')) |
|
44 |
0 |
if (!allow_space || (c != ' ' && c != '\t' && c != '\r')) |
|
0 |
44 |
if (!allow_space || (c != ' ' && c != '\t' && c != '\r')) |
760
|
11 |
628 |
} else if (c == '/') { |
764
|
5 |
6 |
if (slash_count == 1 && pattern == scan) |
|
0 |
5 |
if (slash_count == 1 && pattern == scan) |
766
|
16 |
612 |
} else if (git__iswildcard(c) && !escaped) { |
|
16 |
0 |
} else if (git__iswildcard(c) && !escaped) { |
776
|
0 |
128 |
if ((spec->length = scan - pattern) == 0) |
784
|
0 |
128 |
if (pattern[spec->length - 1] == '\r') |
785
|
0 |
0 |
if (--spec->length == 0) |
791
|
0 |
128 |
if (spec->length == 0) |
794
|
2 |
126 |
if (pattern[spec->length - 1] == '/') { |
797
|
2 |
0 |
if (--slash_count <= 0) |
801
|
0 |
128 |
if (context) { |
804
|
0 |
0 |
if (slash) { |
814
|
0 |
128 |
if (!spec->pattern) { |
830
|
0 |
156 |
if (!pattern[1] && (pattern[0] == '*' || pattern[0] == '.')) { |
|
0 |
0 |
if (!pattern[1] && (pattern[0] == '*' || pattern[0] == '.')) { |
|
0 |
0 |
if (!pattern[1] && (pattern[0] == '*' || pattern[0] == '.')) { |
846
|
32 |
32 |
if (b->name_hash < a->name_hash) |
848
|
32 |
0 |
else if (b->name_hash > a->name_hash) |
869
|
0 |
0 |
GIT_REFCOUNT_DEC(*old, git_attr_assignment__free); |
|
0 |
0 |
GIT_REFCOUNT_DEC(*old, git_attr_assignment__free); |
884
|
16 |
0 |
GIT_ASSERT_ARG(assigns && !assigns->length); |
|
0 |
16 |
GIT_ASSERT_ARG(assigns && !assigns->length); |
888
|
64 |
16 |
while (*scan && *scan != '\n') { |
|
64 |
0 |
while (*scan && *scan != '\n') { |
892
|
48 |
64 |
while (git__isspace(*scan) && *scan != '\n') scan++; |
|
48 |
0 |
while (git__isspace(*scan) && *scan != '\n') scan++; |
895
|
64 |
0 |
if (!assign) { |
897
|
0 |
64 |
GIT_ERROR_CHECK_ALLOC(assign); |
905
|
64 |
0 |
if (*scan == '-') { |
908
|
0 |
0 |
} else if (*scan == '!') { |
911
|
0 |
0 |
} else if (*scan == '#') /* comment rest of line */ |
916
|
320 |
16 |
while (*scan && !git__isspace(*scan) && *scan != '=') { |
|
272 |
48 |
while (*scan && !git__isspace(*scan) && *scan != '=') { |
|
272 |
0 |
while (*scan && !git__isspace(*scan) && *scan != '=') { |
921
|
0 |
64 |
if (scan == name_start) { |
925
|
0 |
0 |
while (*scan && !git__isspace(*scan)) scan++; |
|
0 |
0 |
while (*scan && !git__isspace(*scan)) scan++; |
931
|
0 |
64 |
GIT_ERROR_CHECK_ALLOC(assign->name); |
934
|
0 |
64 |
if (*scan == '=') { |
935
|
0 |
0 |
for (value_start = ++scan; *scan && !git__isspace(*scan); ++scan); |
|
0 |
0 |
for (value_start = ++scan; *scan && !git__isspace(*scan); ++scan); |
938
|
0 |
0 |
if (scan > value_start) { |
940
|
0 |
0 |
GIT_ERROR_CHECK_ALLOC(assign->value); |
945
|
64 |
0 |
if (repo != NULL && assign->value == git_attr__true) { |
|
0 |
64 |
if (repo != NULL && assign->value == git_attr__true) { |
949
|
0 |
0 |
if (macro != NULL) { |
953
|
0 |
0 |
git_vector_foreach(¯o->assigns, i, massign) { |
958
|
0 |
0 |
if (error < 0 && error != GIT_EEXISTS) { |
|
0 |
0 |
if (error < 0 && error != GIT_EEXISTS) { |
968
|
0 |
64 |
if (error < 0 && error != GIT_EEXISTS) |
|
0 |
0 |
if (error < 0 && error != GIT_EEXISTS) |
975
|
0 |
16 |
if (assign != NULL) |
980
|
0 |
16 |
return (assigns->length == 0) ? GIT_ENOTFOUND : 0; |
988
|
2059 |
60 |
if (!rule) |
991
|
16 |
44 |
if (!(rule->match.flags & GIT_ATTR_FNMATCH_IGNORE)) { |
992
|
64 |
16 |
git_vector_foreach(&rule->assigns, i, assign) |
993
|
64 |
0 |
GIT_REFCOUNT_DEC(assign, git_attr_assignment__free); |
|
64 |
0 |
GIT_REFCOUNT_DEC(assign, git_attr_assignment__free); |
1010
|
0 |
351 |
GIT_ASSERT_ARG(repo); |
1020
|
0 |
351 |
if (!session) |