line |
true |
false |
branch |
27
|
2082 |
892 |
if (!entry) |
54
|
1144 |
579 |
for (i = 0; i < cfg->backends.length; ++i) { |
56
|
1144 |
0 |
GIT_REFCOUNT_DEC(internal, backend_internal_free); |
|
1144 |
0 |
GIT_REFCOUNT_DEC(internal, backend_internal_free); |
67
|
5 |
594 |
if (cfg == NULL) |
70
|
579 |
15 |
GIT_REFCOUNT_DEC(cfg, config_free); |
|
579 |
0 |
GIT_REFCOUNT_DEC(cfg, config_free); |
86
|
0 |
579 |
GIT_ERROR_CHECK_ALLOC(cfg); |
90
|
0 |
579 |
if (git_vector_init(&cfg->backends, 3, config_backend_cmp) < 0) { |
111
|
0 |
140 |
GIT_ASSERT_ARG(cfg); |
112
|
0 |
140 |
GIT_ASSERT_ARG(path); |
115
|
3 |
137 |
if (res < 0 && errno != ENOENT && errno != ENOTDIR) { |
|
0 |
3 |
if (res < 0 && errno != ENOENT && errno != ENOTDIR) { |
|
0 |
0 |
if (res < 0 && errno != ENOENT && errno != ENOTDIR) { |
120
|
0 |
140 |
if (git_config_backend_from_file(&file, path) < 0) |
123
|
0 |
140 |
if ((res = git_config_add_backend(cfg, file, level, repo, force)) < 0) { |
142
|
0 |
5 |
if (git_config_new(&config) < 0) |
145
|
0 |
5 |
if ((error = git_config_add_file_ondisk(config, path, GIT_CONFIG_LEVEL_LOCAL, NULL, 0)) < 0) |
162
|
0 |
502 |
if (git_config_new(&config) < 0) |
165
|
1004 |
502 |
git_vector_foreach(&in->backends, i, internal) { |
168
|
0 |
1004 |
if ((error = internal->backend->snapshot(&b, internal->backend)) < 0) |
171
|
0 |
1004 |
if ((error = git_config_add_backend(config, b, internal->level, NULL, 0)) < 0) { |
177
|
0 |
502 |
if (error < 0) |
199
|
0 |
0 |
if (level == GIT_CONFIG_HIGHEST_LEVEL) { |
202
|
0 |
0 |
git_vector_foreach(&cfg->backends, i, internal) { |
203
|
0 |
0 |
if (internal->level == level) |
208
|
0 |
0 |
if (pos == -1) { |
237
|
0 |
0 |
git_vector_foreach(&cfg->backends, i, internal) { |
238
|
0 |
0 |
if (internal->level == level) |
242
|
0 |
0 |
if (pos == -1) |
247
|
0 |
0 |
if (git_vector_remove(&cfg->backends, pos) < 0) |
250
|
0 |
0 |
GIT_REFCOUNT_DEC(internal, backend_internal_free); |
|
0 |
0 |
GIT_REFCOUNT_DEC(internal, backend_internal_free); |
262
|
0 |
1144 |
if (force) |
265
|
0 |
1144 |
if ((result = git_vector_insert_sorted(&cfg->backends, |
279
|
0 |
0 |
if (!git_config_open_level(cfg_out, cfg, GIT_CONFIG_LEVEL_XDG)) |
294
|
0 |
0 |
if ((res = find_backend_by_level(&internal, cfg_parent, level)) < 0) |
297
|
0 |
0 |
if ((res = git_config_new(&cfg)) < 0) |
300
|
0 |
0 |
if ((res = git_config__add_internal(cfg, internal, level, true)) < 0) { |
320
|
0 |
1144 |
GIT_ASSERT_ARG(cfg); |
321
|
0 |
1144 |
GIT_ASSERT_ARG(backend); |
323
|
0 |
1144 |
GIT_ERROR_CHECK_VERSION(backend, GIT_CONFIG_BACKEND_VERSION, "git_config_backend"); |
325
|
0 |
1144 |
if ((result = backend->open(backend, level, repo)) < 0) |
329
|
0 |
1144 |
GIT_ERROR_CHECK_ALLOC(internal); |
336
|
0 |
1144 |
if ((result = git_config__add_internal(cfg, internal, level, force)) < 0) { |
360
|
133 |
66 |
for (; i > 0; --i) { |
362
|
133 |
0 |
if (!internal || !internal->backend) |
|
0 |
133 |
if (!internal || !internal->backend) |
380
|
1177 |
67 |
if (iter->current != NULL && |
|
1045 |
132 |
if (iter->current != NULL && |
385
|
132 |
67 |
if (error < 0 && error != GIT_ITEROVER) |
|
0 |
132 |
if (error < 0 && error != GIT_ITEROVER) |
389
|
66 |
133 |
if (find_next_backend(&i, iter->cfg, iter->i) < 0) |
396
|
66 |
67 |
if (iter->current) |
401
|
0 |
133 |
if (error == GIT_ENOTFOUND) |
404
|
0 |
133 |
if (error < 0) |
409
|
0 |
133 |
if (error == GIT_ITEROVER) |
428
|
752 |
41 |
while ((error = all_iter_next(entry, _iter)) == 0) { |
430
|
738 |
14 |
if (git_regexp_match(&iter->regex, (*entry)->name) != 0) |
444
|
67 |
0 |
if (iter->current) |
463
|
0 |
26 |
GIT_ERROR_CHECK_ALLOC(iter); |
481
|
2 |
41 |
if (regexp == NULL) |
485
|
0 |
41 |
GIT_ERROR_CHECK_ALLOC(iter); |
487
|
0 |
41 |
if ((result = git_regexp_compile(&iter->regex, regexp, 0)) < 0) { |
519
|
0 |
0 |
GIT_ASSERT_ARG(backend); |
520
|
0 |
0 |
GIT_ASSERT_ARG(cb); |
522
|
0 |
0 |
if (regexp && git_regexp_compile(®ex, regexp, 0) < 0) |
|
0 |
0 |
if (regexp && git_regexp_compile(®ex, regexp, 0) < 0) |
525
|
0 |
0 |
if ((error = backend->iterator(&iter, backend)) < 0) { |
530
|
0 |
0 |
while (!(iter->next(&entry, iter) < 0)) { |
532
|
0 |
0 |
if (regexp && git_regexp_match(®ex, entry->name) != 0) |
|
0 |
0 |
if (regexp && git_regexp_match(®ex, entry->name) != 0) |
536
|
0 |
0 |
if ((error = cb(entry, payload)) != 0) { |
542
|
0 |
0 |
if (regexp != NULL) |
560
|
0 |
9 |
if ((error = git_config_iterator_glob_new(&iter, cfg, regexp)) < 0) |
563
|
27 |
8 |
while (!(error = git_config_next(&entry, iter))) { |
564
|
1 |
26 |
if ((error = cb(entry, payload)) != 0) { |
572
|
8 |
1 |
if (error == GIT_ITEROVER) |
600
|
0 |
61 |
if (git_vector_length(&cfg->backends) == 0) { |
607
|
61 |
0 |
git_vector_foreach(&cfg->backends, i, backend) { |
608
|
61 |
0 |
if (!backend->backend->readonly) { |
624
|
0 |
15 |
if (get_backend_for_use(&backend, cfg, name, BACKEND_USE_DELETE) < 0) |
644
|
12 |
5 |
return git_config_set_string(cfg, name, value ? "true" : "false"); |
652
|
0 |
41 |
if (!value) { |
657
|
0 |
41 |
if (get_backend_for_use(&backend, cfg, name, BACKEND_USE_SET) < 0) |
662
|
41 |
0 |
if (!error && GIT_REFCOUNT_OWNER(cfg) != NULL) |
|
21 |
20 |
if (!error && GIT_REFCOUNT_OWNER(cfg) != NULL) |
678
|
0 |
0 |
if ((error = git_config__lookup_entry(&ce, config, key, false)) < 0) |
681
|
0 |
0 |
if (!ce && only_if_existing) /* entry doesn't exist */ |
|
0 |
0 |
if (!ce && only_if_existing) /* entry doesn't exist */ |
683
|
0 |
0 |
if (ce && !overwrite_existing) /* entry would be overwritten */ |
|
0 |
0 |
if (ce && !overwrite_existing) /* entry would be overwritten */ |
685
|
0 |
0 |
if (value && ce && ce->value && !strcmp(ce->value, value)) /* no change */ |
|
0 |
0 |
if (value && ce && ce->value && !strcmp(ce->value, value)) /* no change */ |
|
0 |
0 |
if (value && ce && ce->value && !strcmp(ce->value, value)) /* no change */ |
|
0 |
0 |
if (value && ce && ce->value && !strcmp(ce->value, value)) /* no change */ |
687
|
0 |
0 |
if (!value && (!ce || !ce->value)) /* asked to delete absent entry */ |
|
0 |
0 |
if (!value && (!ce || !ce->value)) /* asked to delete absent entry */ |
|
0 |
0 |
if (!value && (!ce || !ce->value)) /* asked to delete absent entry */ |
690
|
0 |
0 |
if (!value) |
730
|
507 |
2526 |
if (normalize_name) { |
731
|
0 |
507 |
if ((res = git_config__normalize_name(name, &normalized)) < 0) |
737
|
5175 |
2141 |
git_vector_foreach(&cfg->backends, i, internal) { |
738
|
5175 |
0 |
if (!internal || !internal->backend) |
|
0 |
5175 |
if (!internal || !internal->backend) |
742
|
892 |
4283 |
if (res != GIT_ENOTFOUND) |
749
|
2141 |
892 |
if (res == GIT_ENOTFOUND) |
750
|
174 |
1967 |
res = (want_errors > GET_ALL_ERRORS) ? 0 : config_error_notfound(name); |
751
|
0 |
892 |
else if (res && (want_errors == GET_NO_ERRORS)) { |
|
0 |
0 |
else if (res && (want_errors == GET_NO_ERRORS)) { |
771
|
280 |
1598 |
return get_entry( |
785
|
0 |
0 |
if ((ret = get_entry(&entry, cfg, name, true, GET_ALL_ERRORS)) < 0) |
799
|
28 |
0 |
if ((ret = get_entry(&entry, cfg, name, true, GET_ALL_ERRORS)) < 0) |
813
|
1 |
64 |
if ((ret = get_entry(&entry, cfg, name, true, GET_ALL_ERRORS)) < 0) |
827
|
30 |
65 |
if ((ret = get_entry(&entry, cfg, name, true, GET_ALL_ERRORS)) < 0) |
841
|
404 |
202 |
git_vector_foreach(&cfg->backends, i, internal) { |
842
|
404 |
0 |
if (!internal || !internal->backend) |
|
0 |
404 |
if (!internal || !internal->backend) |
845
|
0 |
404 |
if (!internal->backend->readonly) |
854
|
0 |
0 |
GIT_ASSERT_ARG(out); |
855
|
0 |
0 |
GIT_ASSERT_ARG(value); |
857
|
0 |
0 |
if (value[0] == '~') { |
858
|
0 |
0 |
if (value[1] != '\0' && value[1] != '/') { |
|
0 |
0 |
if (value[1] != '\0' && value[1] != '/') { |
863
|
0 |
0 |
return git_sysdir_expand_global_file(out, value[1] ? &value[2] : NULL); |
871
|
0 |
0 |
GIT_BUF_WRAP_PRIVATE(out, git_config__parse_path, value); |
|
0 |
0 |
GIT_BUF_WRAP_PRIVATE(out, git_config__parse_path, value); |
879
|
0 |
0 |
GIT_BUF_WRAP_PRIVATE(out, git_config__get_path, cfg, name); |
|
0 |
0 |
GIT_BUF_WRAP_PRIVATE(out, git_config__get_path, cfg, name); |
890
|
0 |
0 |
if ((error = get_entry(&entry, cfg, name, true, GET_ALL_ERRORS)) < 0) |
905
|
0 |
202 |
if (!is_readonly(cfg)) { |
911
|
171 |
31 |
*out = !ret ? (entry->value ? entry->value : "") : NULL; |
|
171 |
0 |
*out = !ret ? (entry->value ? entry->value : "") : NULL; |
921
|
18 |
0 |
GIT_BUF_WRAP_PRIVATE(out, git_config__get_string_buf, cfg, name); |
|
15 |
3 |
GIT_BUF_WRAP_PRIVATE(out, git_config__get_string_buf, cfg, name); |
931
|
0 |
40 |
GIT_ASSERT_ARG(out); |
932
|
0 |
40 |
GIT_ASSERT_ARG(cfg); |
935
|
20 |
20 |
str = !ret ? (entry->value ? entry->value : "") : NULL; |
|
20 |
0 |
str = !ret ? (entry->value ? entry->value : "") : NULL; |
937
|
20 |
20 |
if (str) |
952
|
0 |
2 |
ret = (entry && entry->value) ? git__strdup(entry->value) : fallback_value ? git__strdup(fallback_value) : NULL; |
|
0 |
0 |
ret = (entry && entry->value) ? git__strdup(entry->value) : fallback_value ? git__strdup(fallback_value) : NULL; |
|
2 |
0 |
ret = (entry && entry->value) ? git__strdup(entry->value) : fallback_value ? git__strdup(fallback_value) : NULL; |
966
|
221 |
369 |
if (entry && git_config_parse_bool(&val, entry->value) < 0) |
|
0 |
221 |
if (entry && git_config_parse_bool(&val, entry->value) < 0) |
981
|
0 |
56 |
if (entry && git_config_parse_int32(&val, entry->value) < 0) |
|
0 |
0 |
if (entry && git_config_parse_int32(&val, entry->value) < 0) |
996
|
0 |
20 |
if ((err = git_config_multivar_iterator_new(&iter, cfg, name, regexp)) < 0) |
1000
|
10 |
20 |
while ((err = iter->next(&entry, iter)) == 0) { |
1003
|
0 |
10 |
if ((err = cb(entry, payload)) != 0) { |
1010
|
20 |
0 |
if (err == GIT_ITEROVER) |
1013
|
10 |
10 |
if (found == 0 && err == 0) |
|
10 |
0 |
if (found == 0 && err == 0) |
1032
|
413 |
24 |
while ((error = iter->iter->next(entry, iter->iter)) == 0) { |
1033
|
398 |
15 |
if (git__strcmp(iter->name, (*entry)->name)) |
1036
|
15 |
0 |
if (!iter->have_regex) |
1039
|
0 |
0 |
if (git_regexp_match(&iter->regex, (*entry)->value) == 0) |
1053
|
0 |
24 |
if (iter->have_regex) |
1064
|
0 |
24 |
if ((error = git_config_iterator_new(&inner, cfg)) < 0) |
1068
|
0 |
24 |
GIT_ERROR_CHECK_ALLOC(iter); |
1070
|
0 |
24 |
if ((error = git_config__normalize_name(name, &iter->name)) < 0) |
1073
|
0 |
24 |
if (regexp != NULL) { |
1074
|
0 |
0 |
if ((error = git_regexp_compile(&iter->regex, regexp, 0)) < 0) |
1099
|
0 |
5 |
if (get_backend_for_use(&backend, cfg, name, BACKEND_USE_DELETE) < 0) |
1109
|
0 |
0 |
if (get_backend_for_use(&backend, cfg, name, BACKEND_USE_DELETE) < 0) |
1122
|
0 |
1051 |
if (iter == NULL) |
1130
|
0 |
0 |
GIT_BUF_WRAP_PRIVATE(path, git_sysdir_find_global_file, GIT_CONFIG_FILENAME_GLOBAL); |
|
0 |
0 |
GIT_BUF_WRAP_PRIVATE(path, git_sysdir_find_global_file, GIT_CONFIG_FILENAME_GLOBAL); |
1140
|
0 |
0 |
GIT_BUF_WRAP_PRIVATE(path, git_sysdir_find_xdg_file, GIT_CONFIG_FILENAME_XDG); |
|
0 |
0 |
GIT_BUF_WRAP_PRIVATE(path, git_sysdir_find_xdg_file, GIT_CONFIG_FILENAME_XDG); |
1150
|
0 |
0 |
GIT_BUF_WRAP_PRIVATE(path, git_sysdir_find_system_file, GIT_CONFIG_FILENAME_SYSTEM); |
|
0 |
0 |
GIT_BUF_WRAP_PRIVATE(path, git_sysdir_find_system_file, GIT_CONFIG_FILENAME_SYSTEM); |
1163
|
0 |
0 |
if ((error = git_buf_tostr(&str, path)) == 0 && |
|
0 |
0 |
if ((error = git_buf_tostr(&str, path)) == 0 && |
1182
|
0 |
0 |
if (!is_safe) { |
1195
|
0 |
1 |
if (git_sysdir_get(&paths, GIT_SYSDIR_GLOBAL) < 0) |
1199
|
1 |
0 |
if (!paths || !git_str_len(paths)) |
|
0 |
1 |
if (!paths || !git_str_len(paths)) |
1203
|
5 |
1 |
for (sep = start = git_str_cstr(paths); *sep; ++sep) { |
1204
|
0 |
5 |
if (*sep == GIT_PATH_LIST_SEPARATOR && |
|
0 |
0 |
if (*sep == GIT_PATH_LIST_SEPARATOR && |
1205
|
0 |
0 |
(sep <= start || sep[-1] != '\\')) |
1209
|
0 |
1 |
if (git_str_set(buf, start, (size_t)(sep - start)) < 0) |
1221
|
0 |
7 |
if ((error = git_config_new(&cfg)) < 0) |
1230
|
7 |
0 |
if (!error && !git_config__find_xdg(&buf)) |
|
0 |
7 |
if (!error && !git_config__find_xdg(&buf)) |
1234
|
7 |
0 |
if (!error && !git_config__find_system(&buf)) |
|
0 |
7 |
if (!error && !git_config__find_system(&buf)) |
1238
|
7 |
0 |
if (!error && !git_config__find_programdata(&buf)) |
|
0 |
7 |
if (!error && !git_config__find_programdata(&buf)) |
1244
|
0 |
7 |
if (error) { |
1260
|
0 |
0 |
GIT_ASSERT_ARG(cfg); |
1263
|
0 |
0 |
if (!internal || !internal->backend) { |
|
0 |
0 |
if (!internal || !internal->backend) { |
1269
|
0 |
0 |
if ((error = backend->lock(backend)) < 0) |
1280
|
0 |
0 |
GIT_ASSERT_ARG(cfg); |
1283
|
0 |
0 |
if (!internal || !internal->backend) { |
|
0 |
0 |
if (!internal || !internal->backend) { |
1305
|
53 |
0 |
for (i = 0; i < map_n; ++i) { |
1313
|
32 |
14 |
if (git_config_parse_bool(&bool_val, value) == 0 && |
|
16 |
16 |
if (git_config_parse_bool(&bool_val, value) == 0 && |
1322
|
0 |
0 |
if (git_config_parse_int32(out, value) == 0) |
1327
|
7 |
0 |
if (value && strcasecmp(value, m->str_match) == 0) { |
|
7 |
0 |
if (value && strcasecmp(value, m->str_match) == 0) { |
1344
|
0 |
0 |
for (i = 0; i < map_n; i++) { |
1347
|
0 |
0 |
if (m->map_value != enum_val) |
1361
|
633 |
14 |
if (git__parse_bool(out, value) == 0) |
1364
|
0 |
14 |
if (git_config_parse_int32(out, value) == 0) { |
1378
|
78 |
0 |
if (!value || git__strntol64(&num, value, strlen(value), &num_end, 0) < 0) |
|
64 |
14 |
if (!value || git__strntol64(&num, value, strlen(value), &num_end, 0) < 0) |
1398
|
0 |
0 |
if (num_end[1] != '\0') |
1412
|
14 |
0 |
git_error_set(GIT_ERROR_CONFIG, "failed to parse '%s' as an integer", value ? value : "(null)"); |
1421
|
14 |
64 |
if (git_config_parse_int64(&tmp, value) < 0) |
1425
|
0 |
64 |
if (truncate != tmp) |
1432
|
14 |
0 |
git_error_set(GIT_ERROR_CONFIG, "failed to parse '%s' as a 32-bit integer", value ? value : "(null)"); |
1440
|
0 |
1186 |
if (start == end) |
1444
|
8177 |
592 |
for (scan = start; *scan; ++scan) { |
1445
|
3236 |
4941 |
if (end && scan >= end) |
|
594 |
2642 |
if (end && scan >= end) |
1447
|
7583 |
0 |
if (isalnum(*scan)) |
1449
|
0 |
0 |
else if (*scan != '-' || scan == start) |
|
0 |
0 |
else if (*scan != '-' || scan == start) |
1453
|
0 |
1186 |
if (scan == start) |
1465
|
0 |
592 |
GIT_ASSERT_ARG(in); |
1466
|
0 |
592 |
GIT_ASSERT_ARG(out); |
1469
|
0 |
592 |
GIT_ERROR_CHECK_ALLOC(name); |
1474
|
592 |
0 |
if (fdot == NULL || fdot == name || ldot == NULL || !ldot[1]) |
|
592 |
0 |
if (fdot == NULL || fdot == name || ldot == NULL || !ldot[1]) |
|
592 |
0 |
if (fdot == NULL || fdot == name || ldot == NULL || !ldot[1]) |
|
592 |
0 |
if (fdot == NULL || fdot == name || ldot == NULL || !ldot[1]) |
1483
|
792 |
592 |
while (fdot < ldot) |
1484
|
0 |
792 |
if (*fdot++ == '\n') |
1510
|
2 |
2 |
if (base_len > 0 && |
|
2 |
0 |
if (base_len > 0 && |
1519
|
4 |
0 |
if (!error) |
1537
|
0 |
3 |
if ((error = git_str_puts(&pattern, "\\..+")) < 0) |
1540
|
0 |
3 |
if ((error = git_repository_config__weakptr(&config, repo)) < 0) |
1547
|
0 |
3 |
if ((error = git_str_join(&replace, '.', new_section_name, "")) < 0) |
1550
|
2 |
1 |
if (new_section_name != NULL && |
|
0 |
2 |
if (new_section_name != NULL && |
1570
|
0 |
0 |
GIT_INIT_STRUCTURE_FROM_TEMPLATE( |