| line |
true |
false |
branch |
|
72
|
0 |
1980 |
if ((error = git_mutex_lock(&b->values_mutex)) < 0) { |
|
90
|
0 |
140 |
if (file == NULL) |
|
93
|
0 |
140 |
git_array_foreach(file->includes, i, include) { |
|
|
0 |
0 |
git_array_foreach(file->includes, i, include) { |
|
109
|
0 |
140 |
if ((res = git_config_entries_new(&b->entries)) < 0) |
|
112
|
3 |
137 |
if (!git_fs_path_exists(b->file.path)) |
|
121
|
0 |
137 |
if (p_access(b->file.path, R_OK) < 0) |
|
124
|
137 |
0 |
if (res < 0 || (res = config_file_read(b->entries, repo, &b->file, level, 0)) < 0) { |
|
|
0 |
137 |
if (res < 0 || (res = config_file_read(b->entries, repo, &b->file, level, 0)) < 0) { |
|
142
|
1904 |
20 |
if (!git_futils_filestamp_check(&file->stamp, file->path)) |
|
145
|
1 |
19 |
if ((error = git_futils_readbuffer(&buf, file->path)) < 0) |
|
148
|
0 |
19 |
if ((error = git_hash_buf(checksum, buf.ptr, buf.size, GIT_HASH_ALGORITHM_SHA1)) < 0) |
|
151
|
19 |
0 |
if (memcmp(checksum, file->checksum, GIT_HASH_SHA1_SIZE) != 0) { |
|
157
|
0 |
1904 |
git_array_foreach(file->includes, i, include) { |
|
|
0 |
0 |
git_array_foreach(file->includes, i, include) { |
|
158
|
0 |
0 |
if ((error = config_file_is_modified(modified, include)) < 0 || *modified) |
|
|
0 |
0 |
if ((error = config_file_is_modified(modified, include)) < 0 || *modified) |
|
173
|
0 |
69 |
git_array_foreach(cfg->file.includes, i, include) |
|
|
0 |
0 |
git_array_foreach(cfg->file.includes, i, include) |
|
184
|
0 |
69 |
if (b->parent.readonly) { |
|
189
|
0 |
69 |
if ((error = git_mutex_lock(&b->values_mutex)) < 0) { |
|
212
|
50 |
0 |
if ((error = git_config_entries_new(&entries)) < 0 || |
|
|
50 |
0 |
if ((error = git_config_entries_new(&entries)) < 0 || |
|
214
|
50 |
0 |
b->level, 0, buf, buflen)) < 0 || |
|
230
|
0 |
1924 |
if (cfg->readonly) |
|
233
|
1 |
1923 |
if ((error = config_file_is_modified(&modified, &b->file)) < 0 && error != GIT_ENOTFOUND) |
|
|
0 |
1 |
if ((error = config_file_is_modified(&modified, &b->file)) < 0 && error != GIT_ENOTFOUND) |
|
236
|
1905 |
19 |
if (!modified) |
|
241
|
19 |
0 |
if ((error = git_config_entries_new(&entries)) < 0 || |
|
|
19 |
0 |
if ((error = git_config_entries_new(&entries)) < 0 || |
|
242
|
19 |
0 |
(error = config_file_read(entries, b->repo, &b->file, b->level, 0)) < 0 || |
|
250
|
19 |
0 |
return (error == GIT_ENOTFOUND) ? 0 : error; |
|
257
|
0 |
140 |
if (backend == NULL) |
|
274
|
1031 |
0 |
if ((error = config_file_refresh(backend)) < 0 || |
|
|
1031 |
0 |
if ((error = config_file_refresh(backend)) < 0 || |
|
275
|
1031 |
0 |
(error = config_file_entries_take(&entries, b)) < 0 || |
|
300
|
0 |
41 |
if ((error = git_config__normalize_name(name, &key)) < 0) |
|
303
|
0 |
41 |
if ((error = config_file_entries_take(&entries, b)) < 0) |
|
307
|
37 |
4 |
if ((error = git_config_entries_get_unique(&existing, entries, key)) < 0) { |
|
308
|
0 |
37 |
if (error != GIT_ENOTFOUND) |
|
311
|
0 |
4 |
} else if ((!existing->value && !value) || |
|
|
0 |
0 |
} else if ((!existing->value && !value) || |
|
|
4 |
0 |
} else if ((!existing->value && !value) || |
|
312
|
4 |
0 |
(existing->value && value && !strcmp(existing->value, value))) { |
|
|
1 |
3 |
(existing->value && value && !strcmp(existing->value, value))) { |
|
319
|
40 |
0 |
if (value) { |
|
321
|
0 |
40 |
GIT_ERROR_CHECK_ALLOC(esc_value); |
|
324
|
0 |
40 |
if ((error = config_file_write(b, name, key, NULL, esc_value)) < 0) |
|
351
|
893 |
0 |
if (!h->parent.readonly && ((error = config_file_refresh(cfg)) < 0)) |
|
|
0 |
893 |
if (!h->parent.readonly && ((error = config_file_refresh(cfg)) < 0)) |
|
354
|
0 |
893 |
if ((error = config_file_entries_take(&entries, h)) < 0) |
|
357
|
817 |
76 |
if ((error = (git_config_entries_get(&entry, entries, key))) < 0) { |
|
377
|
0 |
5 |
GIT_ASSERT_ARG(regexp); |
|
379
|
0 |
5 |
if ((result = git_config__normalize_name(name, &key)) < 0) |
|
382
|
0 |
5 |
if ((result = git_regexp_compile(&preg, regexp, 0)) < 0) |
|
386
|
0 |
5 |
if ((result = config_file_write(b, name, key, &preg, value)) < 0) |
|
404
|
0 |
15 |
if ((error = git_config__normalize_name(name, &key)) < 0) |
|
407
|
0 |
15 |
if ((error = config_file_entries_take(&entries, b)) < 0) |
|
411
|
10 |
5 |
if ((error = git_config_entries_get_unique(&entry, entries, key)) < 0) { |
|
412
|
10 |
0 |
if (error == GIT_ENOTFOUND) |
|
417
|
0 |
5 |
if ((error = config_file_write(b, name, entry->name, NULL, NULL)) < 0) |
|
435
|
0 |
0 |
if ((result = git_config__normalize_name(name, &key)) < 0) |
|
438
|
0 |
0 |
if ((result = config_file_entries_take(&entries, b)) < 0) |
|
441
|
0 |
0 |
if ((result = git_config_entries_get(&entry, entries, key)) < 0) { |
|
442
|
0 |
0 |
if (result == GIT_ENOTFOUND) |
|
447
|
0 |
0 |
if ((result = git_regexp_compile(&preg, regexp, 0)) < 0) |
|
450
|
0 |
0 |
if ((result = config_file_write(b, name, key, &preg, NULL)) < 0) |
|
465
|
0 |
0 |
if ((error = git_filebuf_open(&cfg->locked_buf, cfg->file.path, 0, GIT_CONFIG_FILE_MODE)) < 0) |
|
469
|
0 |
0 |
if (error < 0 && error != GIT_ENOTFOUND) { |
|
|
0 |
0 |
if (error < 0 && error != GIT_ENOTFOUND) { |
|
484
|
0 |
0 |
if (success) { |
|
501
|
0 |
140 |
GIT_ERROR_CHECK_ALLOC(backend); |
|
507
|
0 |
140 |
GIT_ERROR_CHECK_ALLOC(backend->file.path); |
|
530
|
0 |
0 |
if (path[0] == '~' && path[1] == '/') |
|
|
0 |
0 |
if (path[0] == '~' && path[1] == '/') |
|
543
|
0 |
44 |
GIT_ASSERT_ARG_WITH_RETVAL(ptr, NULL); |
|
546
|
0 |
44 |
if (!len) |
|
549
|
0 |
44 |
if (git_str_init(&buf, len) < 0) |
|
552
|
556 |
44 |
while (*ptr != '\0') { |
|
553
|
0 |
556 |
if ((esc = strchr(git_config_escaped, *ptr)) != NULL) { |
|
562
|
0 |
44 |
if (git_str_oom(&buf)) |
|
575
|
0 |
0 |
if (!file) |
|
578
|
0 |
0 |
if ((result = git_fs_path_dirname_r(&path, parse_data->file->path)) < 0) |
|
585
|
0 |
0 |
if (result < 0) |
|
588
|
0 |
0 |
include = git_array_alloc(parse_data->file->includes); |
|
|
0 |
0 |
include = git_array_alloc(parse_data->file->includes); |
|
589
|
0 |
0 |
GIT_ERROR_CHECK_ALLOC(include); |
|
597
|
0 |
0 |
if (result == GIT_ENOTFOUND) { |
|
615
|
0 |
0 |
if (condition[0] == '.' && git_fs_path_is_dirsep(condition[1])) { |
|
|
0 |
0 |
if (condition[0] == '.' && git_fs_path_is_dirsep(condition[1])) { |
|
618
|
0 |
0 |
} else if (condition[0] == '~' && git_fs_path_is_dirsep(condition[1])) |
|
|
0 |
0 |
} else if (condition[0] == '~' && git_fs_path_is_dirsep(condition[1])) |
|
620
|
0 |
0 |
else if (!git_fs_path_is_absolute(condition)) |
|
625
|
0 |
0 |
if (git_fs_path_is_dirsep(condition[strlen(condition) - 1])) |
|
628
|
0 |
0 |
if (git_str_oom(&pattern)) { |
|
633
|
0 |
0 |
if ((error = git_repository__item_path(&gitdir, repo, GIT_REPOSITORY_ITEM_GITDIR)) < 0) |
|
636
|
0 |
0 |
if (git_fs_path_is_dirsep(gitdir.ptr[gitdir.size - 1])) |
|
684
|
0 |
0 |
if ((error = git_str_joinpath(&buf, git_repository_path(repo), GIT_HEAD_FILE)) < 0 || |
|
|
0 |
0 |
if ((error = git_str_joinpath(&buf, git_repository_path(repo), GIT_HEAD_FILE)) < 0 || |
|
689
|
0 |
0 |
if (git__strncmp(reference.ptr, GIT_SYMREF, strlen(GIT_SYMREF))) |
|
693
|
0 |
0 |
if (git__strncmp(reference.ptr, GIT_REFS_HEADS_DIR, strlen(GIT_REFS_HEADS_DIR))) |
|
701
|
0 |
0 |
if ((error = git_str_sets(&buf, condition)) < 0) |
|
703
|
0 |
0 |
if (git_fs_path_is_dirsep(condition[strlen(condition) - 1]) && |
|
|
0 |
0 |
if (git_fs_path_is_dirsep(condition[strlen(condition) - 1]) && |
|
731
|
0 |
0 |
if (!parse_data->repo || !file) |
|
|
0 |
0 |
if (!parse_data->repo || !file) |
|
740
|
0 |
0 |
if (section_len < CONST_STRLEN("includeIf.") + CONST_STRLEN(".path")) |
|
746
|
0 |
0 |
GIT_ERROR_CHECK_ALLOC(condition); |
|
748
|
0 |
0 |
for (i = 0; i < ARRAY_SIZE(conditions); i++) { |
|
749
|
0 |
0 |
if (git__prefixcmp(condition, conditions[i].prefix)) |
|
752
|
0 |
0 |
if ((error = conditions[i].matches(&matches, |
|
758
|
0 |
0 |
if (matches) |
|
787
|
1561 |
0 |
if (current_section) { |
|
796
|
11779 |
1561 |
for (c = var_name; *c; c++) |
|
799
|
0 |
1561 |
if (git_str_oom(&buf)) |
|
803
|
0 |
1561 |
GIT_ERROR_CHECK_ALLOC(entry); |
|
805
|
1561 |
0 |
entry->value = var_value ? git__strdup(var_value) : NULL; |
|
809
|
0 |
1561 |
if ((result = git_config_entries_append(parse_data->entries, entry)) < 0) |
|
815
|
0 |
1561 |
if (!git__strcmp(entry->name, "include.path")) |
|
837
|
0 |
206 |
if (depth >= MAX_INCLUDE_DEPTH) { |
|
847
|
206 |
0 |
if (!reader.ctx.content || *reader.ctx.content == '\0') { |
|
|
5 |
201 |
if (!reader.ctx.content || *reader.ctx.content == '\0') { |
|
875
|
0 |
156 |
if (p_stat(file->path, &st) < 0) { |
|
880
|
0 |
156 |
if ((error = git_futils_readbuffer(&contents, file->path)) < 0) |
|
884
|
0 |
156 |
if ((error = git_hash_buf(file->checksum, contents.ptr, contents.size, GIT_HASH_ALGORITHM_SHA1)) < 0) |
|
887
|
0 |
156 |
if ((error = config_file_read_buffer(entries, repo, file, level, depth, |
|
905
|
13 |
4 |
if (dot == NULL) { |
|
911
|
0 |
4 |
GIT_ERROR_CHECK_ALLOC(escaped); |
|
917
|
0 |
17 |
if (git_str_oom(&buf)) |
|
930
|
45 |
0 |
if (value[0] == ' ' || value[0] == '\0') |
|
|
0 |
45 |
if (value[0] == ' ' || value[0] == '\0') |
|
933
|
638 |
45 |
for (ptr = value; *ptr; ++ptr) { |
|
934
|
638 |
0 |
if (*ptr == ';' || *ptr == '#') |
|
|
0 |
638 |
if (*ptr == ';' || *ptr == '#') |
|
938
|
0 |
45 |
if (ptr[-1] == ' ') |
|
961
|
571 |
0 |
if (!result && line_len && line[line_len-1] != '\n') |
|
|
571 |
0 |
if (!result && line_len && line[line_len-1] != '\n') |
|
|
0 |
571 |
if (!result && line_len && line[line_len-1] != '\n') |
|
985
|
40 |
5 |
if (!write_data->preg) |
|
1008
|
7 |
171 |
if (write_data->in_section && !write_data->preg && write_data->value) |
|
|
7 |
0 |
if (write_data->in_section && !write_data->preg && write_data->value) |
|
|
2 |
5 |
if (write_data->in_section && !write_data->preg && write_data->value) |
|
1016
|
178 |
0 |
if (!result) { |
|
1021
|
178 |
0 |
if (!result) |
|
1046
|
0 |
401 |
if ((error = git_str_put(write_data->buf, write_data->buffered_comment.ptr, write_data->buffered_comment.size)) < 0) |
|
1052
|
61 |
340 |
if (write_data->in_section && |
|
|
9 |
52 |
if (write_data->in_section && |
|
1057
|
9 |
392 |
if (has_matched && write_data->preg != NULL) |
|
|
1 |
8 |
if (has_matched && write_data->preg != NULL) |
|
1063
|
393 |
8 |
if (!has_matched) |
|
1069
|
5 |
3 |
if (!write_data->value) |
|
1096
|
0 |
50 |
if ((result = git_str_put(write_data->buf, write_data->buffered_comment.ptr, write_data->buffered_comment.size)) < 0) |
|
1104
|
5 |
45 |
if ((!write_data->preg || !write_data->preg_replaced) && write_data->value) { |
|
|
5 |
0 |
if ((!write_data->preg || !write_data->preg_replaced) && write_data->value) { |
|
|
40 |
10 |
if ((!write_data->preg || !write_data->preg_replaced) && write_data->value) { |
|
1106
|
33 |
7 |
if (!current_section || strcmp(current_section, write_data->section)) |
|
|
10 |
23 |
if (!current_section || strcmp(current_section, write_data->section)) |
|
1109
|
40 |
0 |
if (!result) |
|
1131
|
0 |
50 |
if (cfg->locked) { |
|
1132
|
0 |
0 |
error = git_str_puts(&contents, git_str_cstr(&cfg->locked_content) == NULL ? "" : git_str_cstr(&cfg->locked_content)); |
|
1134
|
0 |
50 |
if ((error = git_filebuf_open(&file, cfg->file.path, GIT_FILEBUF_HASH_CONTENTS, |
|
1141
|
2 |
48 |
if (error < 0 && error != GIT_ENOTFOUND) |
|
|
0 |
2 |
if (error < 0 && error != GIT_ENOTFOUND) |
|
1144
|
0 |
50 |
if ((git_config_parser_init(&parser, cfg->file.path, contents.ptr, contents.size)) < 0) |
|
1150
|
0 |
50 |
GIT_ERROR_CHECK_ALLOC(section); |
|
1155
|
0 |
50 |
GIT_ERROR_CHECK_ALLOC(orig_section); |
|
1165
|
0 |
50 |
if ((error = git_config_parse(&parser, write_on_section, write_on_variable, |
|
1169
|
0 |
50 |
if (cfg->locked) { |
|
1177
|
0 |
50 |
if ((error = git_filebuf_commit(&file)) < 0) |
|
1180
|
0 |
50 |
if ((error = config_file_refresh_from_buffer(&cfg->parent, buf.ptr, buf.size)) < 0) |