| line |
true |
false |
branch |
|
71
|
0 |
1818 |
if ((error = git_mutex_lock(&b->values_mutex)) < 0) { |
|
89
|
0 |
96 |
if (file == NULL) |
|
92
|
0 |
96 |
git_array_foreach(file->includes, i, include) { |
|
|
0 |
0 |
git_array_foreach(file->includes, i, include) { |
|
108
|
0 |
96 |
if ((res = git_config_entries_new(&b->entries)) < 0) |
|
111
|
47 |
49 |
if (!git_path_exists(b->file.path)) |
|
114
|
49 |
0 |
if (res < 0 || (res = config_file_read(b->entries, repo, &b->file, level, 0)) < 0) { |
|
|
0 |
49 |
if (res < 0 || (res = config_file_read(b->entries, repo, &b->file, level, 0)) < 0) { |
|
132
|
897 |
866 |
if (!git_futils_filestamp_check(&file->stamp, file->path)) |
|
135
|
847 |
19 |
if ((error = git_futils_readbuffer(&buf, file->path)) < 0) |
|
138
|
0 |
19 |
if ((error = git_hash_buf(&hash, buf.ptr, buf.size)) < 0) |
|
141
|
19 |
0 |
if (!git_oid_equal(&hash, &file->checksum)) { |
|
147
|
0 |
897 |
git_array_foreach(file->includes, i, include) { |
|
|
0 |
0 |
git_array_foreach(file->includes, i, include) { |
|
148
|
0 |
0 |
if ((error = config_file_is_modified(modified, include)) < 0 || *modified) |
|
|
0 |
0 |
if ((error = config_file_is_modified(modified, include)) < 0 || *modified) |
|
166
|
0 |
68 |
if (b->parent.readonly) { |
|
171
|
0 |
68 |
git_array_foreach(b->file.includes, i, include) |
|
|
0 |
0 |
git_array_foreach(b->file.includes, i, include) |
|
175
|
0 |
68 |
if ((error = git_mutex_lock(&b->values_mutex)) < 0) { |
|
196
|
49 |
0 |
if ((error = git_config_entries_new(&entries)) < 0 || |
|
|
49 |
0 |
if ((error = git_config_entries_new(&entries)) < 0 || |
|
198
|
49 |
0 |
b->level, 0, buf, buflen)) < 0 || |
|
214
|
0 |
1763 |
if (cfg->readonly) |
|
217
|
847 |
916 |
if ((error = config_file_is_modified(&modified, &b->file)) < 0 && error != GIT_ENOTFOUND) |
|
|
0 |
847 |
if ((error = config_file_is_modified(&modified, &b->file)) < 0 && error != GIT_ENOTFOUND) |
|
220
|
1744 |
19 |
if (!modified) |
|
223
|
19 |
0 |
if ((error = git_config_entries_new(&entries)) < 0 || |
|
|
19 |
0 |
if ((error = git_config_entries_new(&entries)) < 0 || |
|
224
|
19 |
0 |
(error = config_file_read(entries, b->repo, &b->file, b->level, 0)) < 0 || |
|
232
|
19 |
0 |
return (error == GIT_ENOTFOUND) ? 0 : error; |
|
239
|
0 |
96 |
if (backend == NULL) |
|
256
|
994 |
0 |
if ((error = config_file_refresh(backend)) < 0 || |
|
|
994 |
0 |
if ((error = config_file_refresh(backend)) < 0 || |
|
257
|
994 |
0 |
(error = config_file_entries_take(&entries, b)) < 0 || |
|
282
|
0 |
40 |
if ((error = git_config__normalize_name(name, &key)) < 0) |
|
285
|
0 |
40 |
if ((error = config_file_entries_take(&entries, b)) < 0) |
|
289
|
36 |
4 |
if ((error = git_config_entries_get_unique(&existing, entries, key)) < 0) { |
|
290
|
0 |
36 |
if (error != GIT_ENOTFOUND) |
|
293
|
0 |
4 |
} else if ((!existing->value && !value) || |
|
|
0 |
0 |
} else if ((!existing->value && !value) || |
|
|
4 |
0 |
} else if ((!existing->value && !value) || |
|
294
|
4 |
0 |
(existing->value && value && !strcmp(existing->value, value))) { |
|
|
1 |
3 |
(existing->value && value && !strcmp(existing->value, value))) { |
|
301
|
39 |
0 |
if (value) { |
|
303
|
0 |
39 |
GIT_ERROR_CHECK_ALLOC(esc_value); |
|
306
|
0 |
39 |
if ((error = config_file_write(b, name, key, NULL, esc_value)) < 0) |
|
333
|
769 |
0 |
if (!h->parent.readonly && ((error = config_file_refresh(cfg)) < 0)) |
|
|
0 |
769 |
if (!h->parent.readonly && ((error = config_file_refresh(cfg)) < 0)) |
|
336
|
0 |
769 |
if ((error = config_file_entries_take(&entries, h)) < 0) |
|
339
|
700 |
69 |
if ((error = (git_config_entries_get(&entry, entries, key))) < 0) { |
|
359
|
0 |
5 |
assert(regexp); |
|
361
|
0 |
5 |
if ((result = git_config__normalize_name(name, &key)) < 0) |
|
364
|
0 |
5 |
if ((result = git_regexp_compile(&preg, regexp, 0)) < 0) |
|
368
|
0 |
5 |
if ((result = config_file_write(b, name, key, &preg, value)) < 0) |
|
386
|
0 |
15 |
if ((error = git_config__normalize_name(name, &key)) < 0) |
|
389
|
0 |
15 |
if ((error = config_file_entries_take(&entries, b)) < 0) |
|
393
|
10 |
5 |
if ((error = git_config_entries_get_unique(&entry, entries, key)) < 0) { |
|
394
|
10 |
0 |
if (error == GIT_ENOTFOUND) |
|
399
|
0 |
5 |
if ((error = config_file_write(b, name, entry->name, NULL, NULL)) < 0) |
|
417
|
0 |
0 |
if ((result = git_config__normalize_name(name, &key)) < 0) |
|
420
|
0 |
0 |
if ((result = config_file_entries_take(&entries, b)) < 0) |
|
423
|
0 |
0 |
if ((result = git_config_entries_get(&entry, entries, key)) < 0) { |
|
424
|
0 |
0 |
if (result == GIT_ENOTFOUND) |
|
429
|
0 |
0 |
if ((result = git_regexp_compile(&preg, regexp, 0)) < 0) |
|
432
|
0 |
0 |
if ((result = config_file_write(b, name, key, &preg, NULL)) < 0) |
|
447
|
0 |
0 |
if ((error = git_filebuf_open(&cfg->locked_buf, cfg->file.path, 0, GIT_CONFIG_FILE_MODE)) < 0) |
|
451
|
0 |
0 |
if (error < 0 && error != GIT_ENOTFOUND) { |
|
|
0 |
0 |
if (error < 0 && error != GIT_ENOTFOUND) { |
|
466
|
0 |
0 |
if (success) { |
|
483
|
0 |
96 |
GIT_ERROR_CHECK_ALLOC(backend); |
|
489
|
0 |
96 |
GIT_ERROR_CHECK_ALLOC(backend->file.path); |
|
512
|
0 |
0 |
if (path[0] == '~' && path[1] == '/') |
|
|
0 |
0 |
if (path[0] == '~' && path[1] == '/') |
|
525
|
0 |
43 |
assert(ptr); |
|
528
|
0 |
43 |
if (!len) |
|
531
|
0 |
43 |
if (git_buf_init(&buf, len) < 0) |
|
534
|
550 |
43 |
while (*ptr != '\0') { |
|
535
|
0 |
550 |
if ((esc = strchr(git_config_escaped, *ptr)) != NULL) { |
|
544
|
0 |
43 |
if (git_buf_oom(&buf)) |
|
557
|
0 |
0 |
if (!file) |
|
560
|
0 |
0 |
if ((result = git_path_dirname_r(&path, parse_data->file->path)) < 0) |
|
567
|
0 |
0 |
if (result < 0) |
|
570
|
0 |
0 |
include = git_array_alloc(parse_data->file->includes); |
|
|
0 |
0 |
include = git_array_alloc(parse_data->file->includes); |
|
571
|
0 |
0 |
GIT_ERROR_CHECK_ALLOC(include); |
|
579
|
0 |
0 |
if (result == GIT_ENOTFOUND) { |
|
597
|
0 |
0 |
if (condition[0] == '.' && git_path_is_dirsep(condition[1])) { |
|
|
0 |
0 |
if (condition[0] == '.' && git_path_is_dirsep(condition[1])) { |
|
600
|
0 |
0 |
} else if (condition[0] == '~' && git_path_is_dirsep(condition[1])) |
|
|
0 |
0 |
} else if (condition[0] == '~' && git_path_is_dirsep(condition[1])) |
|
602
|
0 |
0 |
else if (!git_path_is_absolute(condition)) |
|
607
|
0 |
0 |
if (git_path_is_dirsep(condition[strlen(condition) - 1])) |
|
610
|
0 |
0 |
if (git_buf_oom(&pattern)) { |
|
615
|
0 |
0 |
if ((error = git_repository_item_path(&gitdir, repo, GIT_REPOSITORY_ITEM_GITDIR)) < 0) |
|
618
|
0 |
0 |
if (git_path_is_dirsep(gitdir.ptr[gitdir.size - 1])) |
|
666
|
0 |
0 |
if ((error = git_buf_joinpath(&buf, git_repository_path(repo), GIT_HEAD_FILE)) < 0 || |
|
|
0 |
0 |
if ((error = git_buf_joinpath(&buf, git_repository_path(repo), GIT_HEAD_FILE)) < 0 || |
|
671
|
0 |
0 |
if (git__strncmp(reference.ptr, GIT_SYMREF, strlen(GIT_SYMREF))) |
|
675
|
0 |
0 |
if (git__strncmp(reference.ptr, GIT_REFS_HEADS_DIR, strlen(GIT_REFS_HEADS_DIR))) |
|
683
|
0 |
0 |
if ((error = git_buf_sets(&buf, condition)) < 0) |
|
685
|
0 |
0 |
if (git_path_is_dirsep(condition[strlen(condition) - 1]) && |
|
|
0 |
0 |
if (git_path_is_dirsep(condition[strlen(condition) - 1]) && |
|
713
|
0 |
0 |
if (!parse_data->repo || !file) |
|
|
0 |
0 |
if (!parse_data->repo || !file) |
|
719
|
0 |
0 |
for (i = 0; i < ARRAY_SIZE(conditions); i++) { |
|
720
|
0 |
0 |
if (git__prefixcmp(condition, conditions[i].prefix)) |
|
723
|
0 |
0 |
if ((error = conditions[i].matches(&matches, |
|
729
|
0 |
0 |
if (matches) |
|
758
|
1216 |
0 |
if (current_section) { |
|
767
|
8866 |
1216 |
for (c = var_name; *c; c++) |
|
770
|
0 |
1216 |
if (git_buf_oom(&buf)) |
|
774
|
0 |
1216 |
GIT_ERROR_CHECK_ALLOC(entry); |
|
776
|
1216 |
0 |
entry->value = var_value ? git__strdup(var_value) : NULL; |
|
780
|
0 |
1216 |
if ((result = git_config_entries_append(parse_data->entries, entry)) < 0) |
|
786
|
0 |
1216 |
if (!git__strcmp(entry->name, "include.path")) |
|
808
|
0 |
117 |
if (depth >= MAX_INCLUDE_DEPTH) { |
|
818
|
117 |
0 |
if (!reader.ctx.content || *reader.ctx.content == '\0') { |
|
|
5 |
112 |
if (!reader.ctx.content || *reader.ctx.content == '\0') { |
|
846
|
0 |
68 |
if (p_stat(file->path, &st) < 0) { |
|
851
|
0 |
68 |
if ((error = git_futils_readbuffer(&contents, file->path)) < 0) |
|
855
|
0 |
68 |
if ((error = git_hash_buf(&file->checksum, contents.ptr, contents.size)) < 0) |
|
858
|
0 |
68 |
if ((error = config_file_read_buffer(entries, repo, file, level, depth, |
|
876
|
12 |
4 |
if (dot == NULL) { |
|
882
|
0 |
4 |
GIT_ERROR_CHECK_ALLOC(escaped); |
|
888
|
0 |
16 |
if (git_buf_oom(&buf)) |
|
901
|
44 |
0 |
if (value[0] == ' ' || value[0] == '\0') |
|
|
0 |
44 |
if (value[0] == ' ' || value[0] == '\0') |
|
904
|
632 |
44 |
for (ptr = value; *ptr; ++ptr) { |
|
905
|
632 |
0 |
if (*ptr == ';' || *ptr == '#') |
|
|
0 |
632 |
if (*ptr == ';' || *ptr == '#') |
|
909
|
0 |
44 |
if (ptr[-1] == ' ') |
|
932
|
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') |
|
956
|
39 |
5 |
if (!write_data->preg) |
|
979
|
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) |
|
987
|
178 |
0 |
if (!result) { |
|
992
|
178 |
0 |
if (!result) |
|
1017
|
0 |
401 |
if ((error = git_buf_put(write_data->buf, write_data->buffered_comment.ptr, write_data->buffered_comment.size)) < 0) |
|
1023
|
61 |
340 |
if (write_data->in_section && |
|
|
9 |
52 |
if (write_data->in_section && |
|
1028
|
9 |
392 |
if (has_matched && write_data->preg != NULL) |
|
|
1 |
8 |
if (has_matched && write_data->preg != NULL) |
|
1034
|
393 |
8 |
if (!has_matched) |
|
1040
|
5 |
3 |
if (!write_data->value) |
|
1067
|
0 |
49 |
if ((result = git_buf_put(write_data->buf, write_data->buffered_comment.ptr, write_data->buffered_comment.size)) < 0) |
|
1075
|
5 |
44 |
if ((!write_data->preg || !write_data->preg_replaced) && write_data->value) { |
|
|
5 |
0 |
if ((!write_data->preg || !write_data->preg_replaced) && write_data->value) { |
|
|
39 |
10 |
if ((!write_data->preg || !write_data->preg_replaced) && write_data->value) { |
|
1077
|
33 |
6 |
if (!current_section || strcmp(current_section, write_data->section)) |
|
|
10 |
23 |
if (!current_section || strcmp(current_section, write_data->section)) |
|
1080
|
39 |
0 |
if (!result) |
|
1102
|
0 |
49 |
if (cfg->locked) { |
|
1103
|
0 |
0 |
error = git_buf_puts(&contents, git_buf_cstr(&cfg->locked_content) == NULL ? "" : git_buf_cstr(&cfg->locked_content)); |
|
1105
|
0 |
49 |
if ((error = git_filebuf_open(&file, cfg->file.path, GIT_FILEBUF_HASH_CONTENTS, |
|
1112
|
1 |
48 |
if (error < 0 && error != GIT_ENOTFOUND) |
|
|
0 |
1 |
if (error < 0 && error != GIT_ENOTFOUND) |
|
1115
|
0 |
49 |
if ((git_config_parser_init(&parser, cfg->file.path, contents.ptr, contents.size)) < 0) |
|
1121
|
0 |
49 |
GIT_ERROR_CHECK_ALLOC(section); |
|
1126
|
0 |
49 |
GIT_ERROR_CHECK_ALLOC(orig_section); |
|
1136
|
0 |
49 |
if ((error = git_config_parse(&parser, write_on_section, write_on_variable, |
|
1140
|
0 |
49 |
if (cfg->locked) { |
|
1148
|
0 |
49 |
if ((error = git_filebuf_commit(&file)) < 0) |
|
1151
|
0 |
49 |
if ((error = config_file_refresh_from_buffer(&cfg->parent, buf.ptr, buf.size)) < 0) |