Git fork

Merge branch 'ps/config-wo-the-repository'

The config API had a set of convenience wrapper functions that
implicitly use the_repository instance; they have been removed and
inlined at the calling sites.

* ps/config-wo-the-repository: (21 commits)
config: fix sign comparison warnings
config: move Git config parsing into "environment.c"
config: remove unused `the_repository` wrappers
config: drop `git_config_set_multivar()` wrapper
config: drop `git_config_get_multivar_gently()` wrapper
config: drop `git_config_set_multivar_in_file_gently()` wrapper
config: drop `git_config_set_in_file_gently()` wrapper
config: drop `git_config_set()` wrapper
config: drop `git_config_set_gently()` wrapper
config: drop `git_config_set_in_file()` wrapper
config: drop `git_config_get_bool()` wrapper
config: drop `git_config_get_ulong()` wrapper
config: drop `git_config_get_int()` wrapper
config: drop `git_config_get_string()` wrapper
config: drop `git_config_get_string()` wrapper
config: drop `git_config_get_string_multi()` wrapper
config: drop `git_config_get_value()` wrapper
config: drop `git_config_get_value()` wrapper
config: drop `git_config_get()` wrapper
config: drop `git_config_clear()` wrapper
...

+1015 -1099
+1 -1
Documentation/user-manual.adoc
··· 4270 4270 it does. 4271 4271 4272 4272 ------------------------------------------------------------------ 4273 - git_config(git_default_config); 4273 + repo_config(the_repository, git_default_config); 4274 4274 if (argc != 3) 4275 4275 usage("git cat-file [-t|-s|-e|-p|<type>] <sha1>"); 4276 4276 if (get_sha1(argv[2], sha1))
+3 -3
apply.c
··· 48 48 49 49 static void git_apply_config(void) 50 50 { 51 - git_config_get_string("apply.whitespace", &apply_default_whitespace); 52 - git_config_get_string("apply.ignorewhitespace", &apply_default_ignorewhitespace); 53 - git_config(git_xmerge_config, NULL); 51 + repo_config_get_string(the_repository, "apply.whitespace", &apply_default_whitespace); 52 + repo_config_get_string(the_repository, "apply.ignorewhitespace", &apply_default_ignorewhitespace); 53 + repo_config(the_repository, git_xmerge_config, NULL); 54 54 } 55 55 56 56 static int parse_whitespace_option(struct apply_state *state, const char *option)
+1 -1
archive-tar.c
··· 537 537 tar_filter_config("tar.tgz.remote", "true", NULL); 538 538 tar_filter_config("tar.tar.gz.command", internal_gzip_command, NULL); 539 539 tar_filter_config("tar.tar.gz.remote", "true", NULL); 540 - git_config(git_tar_config, NULL); 540 + repo_config(the_repository, git_tar_config, NULL); 541 541 for (i = 0; i < nr_tar_filters; i++) { 542 542 /* omit any filters that never had a command configured */ 543 543 if (tar_filters[i]->filter_command)
+1 -1
archive-zip.c
··· 632 632 { 633 633 int err; 634 634 635 - git_config(archive_zip_config, NULL); 635 + repo_config(the_repository, archive_zip_config, NULL); 636 636 637 637 dos_time(&args->time, &zip_date, &zip_time); 638 638
+2 -2
archive.c
··· 760 760 const char **argv_copy; 761 761 int rc; 762 762 763 - git_config_get_bool("uploadarchive.allowunreachable", &remote_allow_unreachable); 764 - git_config(git_default_config, NULL); 763 + repo_config_get_bool(the_repository, "uploadarchive.allowunreachable", &remote_allow_unreachable); 764 + repo_config(the_repository, git_default_config, NULL); 765 765 766 766 describe_status.max_invocations = 1; 767 767 ctx.date_mode.type = DATE_NORMAL;
+5 -5
branch.c
··· 116 116 } 117 117 118 118 strbuf_addf(&key, "branch.%s.remote", local); 119 - if (git_config_set_gently(key.buf, origin ? origin : ".") < 0) 119 + if (repo_config_set_gently(the_repository, key.buf, origin ? origin : ".") < 0) 120 120 goto out_err; 121 121 122 122 strbuf_reset(&key); ··· 127 127 * more than one is provided, use CONFIG_REGEX_NONE to preserve what 128 128 * we've written so far. 129 129 */ 130 - if (git_config_set_gently(key.buf, NULL) < 0) 130 + if (repo_config_set_gently(the_repository, key.buf, NULL) < 0) 131 131 goto out_err; 132 132 for_each_string_list_item(item, remotes) 133 - if (git_config_set_multivar_gently(key.buf, item->string, CONFIG_REGEX_NONE, 0) < 0) 133 + if (repo_config_set_multivar_gently(the_repository, key.buf, item->string, CONFIG_REGEX_NONE, 0) < 0) 134 134 goto out_err; 135 135 136 136 if (rebasing) { 137 137 strbuf_reset(&key); 138 138 strbuf_addf(&key, "branch.%s.rebase", local); 139 - if (git_config_set_gently(key.buf, "true") < 0) 139 + if (repo_config_set_gently(the_repository, key.buf, "true") < 0) 140 140 goto out_err; 141 141 } 142 142 strbuf_release(&key); ··· 355 355 char *v = NULL; 356 356 struct strbuf name = STRBUF_INIT; 357 357 strbuf_addf(&name, "branch.%s.description", branch_name); 358 - if (git_config_get_string(name.buf, &v)) { 358 + if (repo_config_get_string(the_repository, name.buf, &v)) { 359 359 strbuf_release(&name); 360 360 return -1; 361 361 }
+1
builtin/add.c
··· 7 7 #include "builtin.h" 8 8 #include "advice.h" 9 9 #include "config.h" 10 + #include "environment.h" 10 11 #include "lockfile.h" 11 12 #include "editor.h" 12 13 #include "dir.h"
+5 -5
builtin/am.c
··· 162 162 163 163 state->prec = 4; 164 164 165 - git_config_get_bool("am.threeway", &state->threeway); 165 + repo_config_get_bool(the_repository, "am.threeway", &state->threeway); 166 166 167 167 state->utf8 = 1; 168 168 169 - git_config_get_bool("am.messageid", &state->message_id); 169 + repo_config_get_bool(the_repository, "am.messageid", &state->message_id); 170 170 171 171 state->scissors = SCISSORS_UNSET; 172 172 state->quoted_cr = quoted_cr_unset; 173 173 174 174 strvec_init(&state->git_apply_opts); 175 175 176 - if (!git_config_get_bool("commit.gpgsign", &gpgsign)) 176 + if (!repo_config_get_bool(the_repository, "commit.gpgsign", &gpgsign)) 177 177 state->sign_commit = gpgsign ? "" : NULL; 178 178 } 179 179 ··· 965 965 { 966 966 if (keep_cr < 0) { 967 967 keep_cr = 0; 968 - git_config_get_bool("am.keepcr", &keep_cr); 968 + repo_config_get_bool(the_repository, "am.keepcr", &keep_cr); 969 969 } 970 970 971 971 switch (patch_format) { ··· 2445 2445 2446 2446 show_usage_with_options_if_asked(argc, argv, usage, options); 2447 2447 2448 - git_config(git_default_config, NULL); 2448 + repo_config(the_repository, git_default_config, NULL); 2449 2449 2450 2450 am_state_init(&state); 2451 2451
+1 -1
builtin/blame.c
··· 940 940 const char *const *opt_usage = cmd_is_annotate ? annotate_opt_usage : blame_opt_usage; 941 941 942 942 setup_default_color_by_age(); 943 - git_config(git_blame_config, &output_option); 943 + repo_config(the_repository, git_blame_config, &output_option); 944 944 repo_init_revisions(the_repository, &revs, NULL); 945 945 revs.date_mode = blame_date_mode; 946 946 revs.diffopt.flags.allow_textconv = 1;
+4 -4
builtin/branch.c
··· 699 699 700 700 strbuf_addf(&name, "branch.%s.description", branch_name); 701 701 if (buf.len || exists) 702 - git_config_set(name.buf, buf.len ? buf.buf : NULL); 702 + repo_config_set(the_repository, name.buf, buf.len ? buf.buf : NULL); 703 703 strbuf_release(&name); 704 704 strbuf_release(&buf); 705 705 ··· 791 791 * Try to set sort keys from config. If config does not set any, 792 792 * fall back on default (refname) sorting. 793 793 */ 794 - git_config(git_branch_config, &sorting_options); 794 + repo_config(the_repository, git_branch_config, &sorting_options); 795 795 if (!sorting_options.nr) 796 796 string_list_append(&sorting_options, "refname"); 797 797 ··· 987 987 988 988 strbuf_reset(&buf); 989 989 strbuf_addf(&buf, "branch.%s.remote", branch->name); 990 - git_config_set_multivar(buf.buf, NULL, NULL, CONFIG_FLAGS_MULTI_REPLACE); 990 + repo_config_set_multivar(the_repository, buf.buf, NULL, NULL, CONFIG_FLAGS_MULTI_REPLACE); 991 991 strbuf_reset(&buf); 992 992 strbuf_addf(&buf, "branch.%s.merge", branch->name); 993 - git_config_set_multivar(buf.buf, NULL, NULL, CONFIG_FLAGS_MULTI_REPLACE); 993 + repo_config_set_multivar(the_repository, buf.buf, NULL, NULL, CONFIG_FLAGS_MULTI_REPLACE); 994 994 strbuf_release(&buf); 995 995 } else if (!noncreate_actions && argc > 0 && argc <= 2) { 996 996 const char *branch_name = argv[0];
+1 -1
builtin/cat-file.c
··· 1095 1095 OPT_END() 1096 1096 }; 1097 1097 1098 - git_config(git_cat_file_config, NULL); 1098 + repo_config(the_repository, git_cat_file_config, NULL); 1099 1099 1100 1100 batch.buffer_output = -1; 1101 1101
+1 -1
builtin/check-attr.c
··· 119 119 if (!is_bare_repository()) 120 120 setup_work_tree(); 121 121 122 - git_config(git_default_config, NULL); 122 + repo_config(the_repository, git_default_config, NULL); 123 123 124 124 argc = parse_options(argc, argv, prefix, check_attr_options, 125 125 check_attr_usage, PARSE_OPT_KEEP_DASHDASH);
+2 -1
builtin/check-ignore.c
··· 2 2 #include "builtin.h" 3 3 #include "config.h" 4 4 #include "dir.h" 5 + #include "environment.h" 5 6 #include "gettext.h" 6 7 #include "quote.h" 7 8 #include "pathspec.h" ··· 159 160 int num_ignored; 160 161 struct dir_struct dir = DIR_INIT; 161 162 162 - git_config(git_default_config, NULL); 163 + repo_config(the_repository, git_default_config, NULL); 163 164 164 165 argc = parse_options(argc, argv, prefix, check_ignore_options, 165 166 check_ignore_usage, 0);
+2 -1
builtin/check-mailmap.c
··· 1 1 #define USE_THE_REPOSITORY_VARIABLE 2 2 #include "builtin.h" 3 3 #include "config.h" 4 + #include "environment.h" 4 5 #include "gettext.h" 5 6 #include "ident.h" 6 7 #include "mailmap.h" ··· 56 57 int i; 57 58 struct string_list mailmap = STRING_LIST_INIT_NODUP; 58 59 59 - git_config(git_default_config, NULL); 60 + repo_config(the_repository, git_default_config, NULL); 60 61 argc = parse_options(argc, argv, prefix, check_mailmap_options, 61 62 check_mailmap_usage, 0); 62 63 if (argc == 0 && !use_stdin)
+2 -1
builtin/checkout--worker.c
··· 4 4 #include "builtin.h" 5 5 #include "config.h" 6 6 #include "entry.h" 7 + #include "environment.h" 7 8 #include "gettext.h" 8 9 #include "parallel-checkout.h" 9 10 #include "parse-options.h" ··· 132 133 checkout_worker_usage, 133 134 checkout_worker_options); 134 135 135 - git_config(git_default_config, NULL); 136 + repo_config(the_repository, git_default_config, NULL); 136 137 argc = parse_options(argc, argv, prefix, checkout_worker_options, 137 138 checkout_worker_usage, 0); 138 139 if (argc > 0)
+1
builtin/checkout-index.c
··· 9 9 10 10 #include "builtin.h" 11 11 #include "config.h" 12 + #include "environment.h" 12 13 #include "gettext.h" 13 14 #include "lockfile.h" 14 15 #include "quote.h"
+2 -2
builtin/checkout.c
··· 291 291 read_mmblob(&ours, &threeway[1]); 292 292 read_mmblob(&theirs, &threeway[2]); 293 293 294 - git_config_get_bool("merge.renormalize", &renormalize); 294 + repo_config_get_bool(the_repository, "merge.renormalize", &renormalize); 295 295 ll_opts.renormalize = renormalize; 296 296 ll_opts.conflict_style = conflict_style; 297 297 merge_status = ll_merge(&result_buf, path, &ancestor, "base", ··· 1764 1764 opts->prefix = prefix; 1765 1765 opts->show_progress = -1; 1766 1766 1767 - git_config(git_checkout_config, opts); 1767 + repo_config(the_repository, git_checkout_config, opts); 1768 1768 if (the_repository->gitdir) { 1769 1769 prepare_repo_settings(the_repository); 1770 1770 the_repository->settings.command_requires_full_index = 0;
+2 -1
builtin/clean.c
··· 13 13 #include "abspath.h" 14 14 #include "config.h" 15 15 #include "dir.h" 16 + #include "environment.h" 16 17 #include "gettext.h" 17 18 #include "parse-options.h" 18 19 #include "path.h" ··· 949 950 OPT_END() 950 951 }; 951 952 952 - git_config(git_clean_config, NULL); 953 + repo_config(the_repository, git_clean_config, NULL); 953 954 954 955 argc = parse_options(argc, argv, prefix, options, builtin_clean_usage, 955 956 0);
+13 -13
builtin/clone.c
··· 762 762 { 763 763 /* 764 764 * give git_clone_config a chance to write config values back to the 765 - * environment, since git_config_set_multivar_gently only deals with 765 + * environment, since repo_config_set_multivar_gently only deals with 766 766 * config-file writes 767 767 */ 768 768 int apply_failed = git_clone_config(key, value, ctx, data); 769 769 if (apply_failed) 770 770 return apply_failed; 771 771 772 - return git_config_set_multivar_gently(key, 773 - value ? value : "true", 774 - CONFIG_REGEX_NONE, 0); 772 + return repo_config_set_multivar_gently(the_repository, key, 773 + value ? value : "true", 774 + CONFIG_REGEX_NONE, 0); 775 775 } 776 776 777 777 static void write_config(struct string_list *config) ··· 822 822 /* Configure the remote */ 823 823 if (value.len) { 824 824 strbuf_addf(&key, "remote.%s.fetch", remote_name); 825 - git_config_set_multivar(key.buf, value.buf, "^$", 0); 825 + repo_config_set_multivar(the_repository, key.buf, value.buf, "^$", 0); 826 826 strbuf_reset(&key); 827 827 828 828 if (option_mirror) { 829 829 strbuf_addf(&key, "remote.%s.mirror", remote_name); 830 - git_config_set(key.buf, "true"); 830 + repo_config_set(the_repository, key.buf, "true"); 831 831 strbuf_reset(&key); 832 832 } 833 833 } ··· 1001 1001 1002 1002 packet_trace_identity("clone"); 1003 1003 1004 - git_config(git_clone_config, NULL); 1004 + repo_config(the_repository, git_clone_config, NULL); 1005 1005 1006 1006 argc = parse_options(argc, argv, prefix, builtin_clone_options, 1007 1007 builtin_clone_usage, 0); ··· 1150 1150 strbuf_reset(&sb); 1151 1151 } 1152 1152 1153 - if (!git_config_get_bool("submodule.stickyRecursiveClone", &val) && 1153 + if (!repo_config_get_bool(the_repository, "submodule.stickyRecursiveClone", &val) && 1154 1154 val) 1155 1155 string_list_append(&option_config, "submodule.recurse=true"); 1156 1156 ··· 1242 1242 * re-read config after init_db and write_config to pick up any config 1243 1243 * injected by --template and --config, respectively. 1244 1244 */ 1245 - git_config(git_clone_config, NULL); 1245 + repo_config(the_repository, git_clone_config, NULL); 1246 1246 1247 1247 /* 1248 1248 * If option_reject_shallow is specified from CLI option, ··· 1294 1294 src_ref_prefix = "refs/"; 1295 1295 strbuf_addstr(&branch_top, src_ref_prefix); 1296 1296 1297 - git_config_set("core.bare", "true"); 1297 + repo_config_set(the_repository, "core.bare", "true"); 1298 1298 } else if (!option_rev) { 1299 1299 strbuf_addf(&branch_top, "refs/remotes/%s/", remote_name); 1300 1300 } 1301 1301 1302 1302 strbuf_addf(&key, "remote.%s.url", remote_name); 1303 - git_config_set(key.buf, repo); 1303 + repo_config_set(the_repository, key.buf, repo); 1304 1304 strbuf_reset(&key); 1305 1305 1306 1306 if (!option_tags) { 1307 1307 strbuf_addf(&key, "remote.%s.tagOpt", remote_name); 1308 - git_config_set(key.buf, "--no-tags"); 1308 + repo_config_set(the_repository, key.buf, "--no-tags"); 1309 1309 strbuf_reset(&key); 1310 1310 } 1311 1311 ··· 1467 1467 warning(_("failed to fetch objects from bundle URI '%s'"), 1468 1468 bundle_uri); 1469 1469 else if (has_heuristic) 1470 - git_config_set_gently("fetch.bundleuri", bundle_uri); 1470 + repo_config_set_gently(the_repository, "fetch.bundleuri", bundle_uri); 1471 1471 1472 1472 remote_state_clear(the_repository->remote_state); 1473 1473 free(the_repository->remote_state);
+2 -2
builtin/column.c
··· 42 42 /* This one is special and must be the first one */ 43 43 if (argc > 1 && starts_with(argv[1], "--command=")) { 44 44 command = argv[1] + 10; 45 - git_config(column_config, (void *)command); 45 + repo_config(the_repository, column_config, (void *)command); 46 46 } else 47 - git_config(column_config, NULL); 47 + repo_config(the_repository, column_config, NULL); 48 48 49 49 memset(&copts, 0, sizeof(copts)); 50 50 copts.padding = 1;
+3 -2
builtin/commit-graph.c
··· 2 2 #include "builtin.h" 3 3 #include "commit.h" 4 4 #include "config.h" 5 + #include "environment.h" 5 6 #include "gettext.h" 6 7 #include "hex.h" 7 8 #include "parse-options.h" ··· 265 266 266 267 trace2_cmd_mode("write"); 267 268 268 - git_config(git_commit_graph_write_config, &opts); 269 + repo_config(the_repository, git_commit_graph_write_config, &opts); 269 270 270 271 argc = parse_options(argc, argv, prefix, 271 272 options, ··· 347 348 }; 348 349 struct option *options = parse_options_concat(builtin_commit_graph_options, common_opts); 349 350 350 - git_config(git_default_config, NULL); 351 + repo_config(the_repository, git_default_config, NULL); 351 352 352 353 disable_replace_refs(); 353 354 save_commit_buffer = 0;
+2 -1
builtin/commit-tree.c
··· 6 6 #define USE_THE_REPOSITORY_VARIABLE 7 7 #include "builtin.h" 8 8 #include "config.h" 9 + #include "environment.h" 9 10 #include "gettext.h" 10 11 #include "hex.h" 11 12 #include "object-name.h" ··· 125 126 }; 126 127 int ret; 127 128 128 - git_config(git_default_config, NULL); 129 + repo_config(the_repository, git_default_config, NULL); 129 130 130 131 show_usage_with_options_if_asked(argc, argv, 131 132 commit_tree_usage, options);
+2 -2
builtin/commit.c
··· 207 207 { 208 208 wt_status_prepare(the_repository, s); 209 209 init_diff_ui_defaults(); 210 - git_config(fn, s); 210 + repo_config(the_repository, fn, s); 211 211 determine_whence(s); 212 - s->hints = advice_enabled(ADVICE_STATUS_HINTS); /* must come after git_config() */ 212 + s->hints = advice_enabled(ADVICE_STATUS_HINTS); /* must come after repo_config() */ 213 213 } 214 214 215 215 static void rollback_index_files(void)
+30 -30
builtin/config.c
··· 966 966 value = normalize_value(argv[0], argv[1], type, &default_kvi); 967 967 968 968 if ((flags & CONFIG_FLAGS_MULTI_REPLACE) || value_pattern) { 969 - ret = git_config_set_multivar_in_file_gently(location_opts.source.file, 970 - argv[0], value, value_pattern, 971 - comment, flags); 969 + ret = repo_config_set_multivar_in_file_gently(the_repository, location_opts.source.file, 970 + argv[0], value, value_pattern, 971 + comment, flags); 972 972 } else { 973 - ret = git_config_set_in_file_gently(location_opts.source.file, 974 - argv[0], comment, value); 973 + ret = repo_config_set_in_file_gently(the_repository, location_opts.source.file, 974 + argv[0], comment, value); 975 975 if (ret == CONFIG_NOTHING_SET) 976 976 error(_("cannot overwrite multiple values with a single value\n" 977 977 " Use a regexp, --add or --replace-all to change %s."), argv[0]); ··· 1010 1010 check_write(&location_opts.source); 1011 1011 1012 1012 if ((flags & CONFIG_FLAGS_MULTI_REPLACE) || value_pattern) 1013 - ret = git_config_set_multivar_in_file_gently(location_opts.source.file, 1014 - argv[0], NULL, value_pattern, 1015 - NULL, flags); 1013 + ret = repo_config_set_multivar_in_file_gently(the_repository, location_opts.source.file, 1014 + argv[0], NULL, value_pattern, 1015 + NULL, flags); 1016 1016 else 1017 - ret = git_config_set_in_file_gently(location_opts.source.file, argv[0], 1018 - NULL, NULL); 1017 + ret = repo_config_set_in_file_gently(the_repository, location_opts.source.file, argv[0], 1018 + NULL, NULL); 1019 1019 1020 1020 location_options_release(&location_opts); 1021 1021 return ret; ··· 1091 1091 die(_("editing stdin is not supported")); 1092 1092 if (opts->source.blob) 1093 1093 die(_("editing blobs is not supported")); 1094 - git_config(git_default_config, NULL); 1094 + repo_config(the_repository, git_default_config, NULL); 1095 1095 config_file = opts->source.file ? 1096 1096 xstrdup(opts->source.file) : 1097 1097 repo_git_path(the_repository, "config"); ··· 1296 1296 check_write(&location_opts.source); 1297 1297 check_argc(argc, 2, 2); 1298 1298 value = normalize_value(argv[0], argv[1], display_opts.type, &default_kvi); 1299 - ret = git_config_set_in_file_gently(location_opts.source.file, argv[0], comment, value); 1299 + ret = repo_config_set_in_file_gently(the_repository, location_opts.source.file, argv[0], comment, value); 1300 1300 if (ret == CONFIG_NOTHING_SET) 1301 1301 error(_("cannot overwrite multiple values with a single value\n" 1302 1302 " Use a regexp, --add or --replace-all to change %s."), argv[0]); ··· 1305 1305 check_write(&location_opts.source); 1306 1306 check_argc(argc, 2, 3); 1307 1307 value = normalize_value(argv[0], argv[1], display_opts.type, &default_kvi); 1308 - ret = git_config_set_multivar_in_file_gently(location_opts.source.file, 1309 - argv[0], value, argv[2], 1310 - comment, flags); 1308 + ret = repo_config_set_multivar_in_file_gently(the_repository, location_opts.source.file, 1309 + argv[0], value, argv[2], 1310 + comment, flags); 1311 1311 } 1312 1312 else if (actions == ACTION_ADD) { 1313 1313 check_write(&location_opts.source); 1314 1314 check_argc(argc, 2, 2); 1315 1315 value = normalize_value(argv[0], argv[1], display_opts.type, &default_kvi); 1316 - ret = git_config_set_multivar_in_file_gently(location_opts.source.file, 1317 - argv[0], value, 1318 - CONFIG_REGEX_NONE, 1319 - comment, flags); 1316 + ret = repo_config_set_multivar_in_file_gently(the_repository, location_opts.source.file, 1317 + argv[0], value, 1318 + CONFIG_REGEX_NONE, 1319 + comment, flags); 1320 1320 } 1321 1321 else if (actions == ACTION_REPLACE_ALL) { 1322 1322 check_write(&location_opts.source); 1323 1323 check_argc(argc, 2, 3); 1324 1324 value = normalize_value(argv[0], argv[1], display_opts.type, &default_kvi); 1325 - ret = git_config_set_multivar_in_file_gently(location_opts.source.file, 1326 - argv[0], value, argv[2], 1327 - comment, flags | CONFIG_FLAGS_MULTI_REPLACE); 1325 + ret = repo_config_set_multivar_in_file_gently(the_repository, location_opts.source.file, 1326 + argv[0], value, argv[2], 1327 + comment, flags | CONFIG_FLAGS_MULTI_REPLACE); 1328 1328 } 1329 1329 else if (actions == ACTION_GET) { 1330 1330 check_argc(argc, 1, 2); ··· 1350 1350 check_write(&location_opts.source); 1351 1351 check_argc(argc, 1, 2); 1352 1352 if (argc == 2) 1353 - ret = git_config_set_multivar_in_file_gently(location_opts.source.file, 1354 - argv[0], NULL, argv[1], 1355 - NULL, flags); 1353 + ret = repo_config_set_multivar_in_file_gently(the_repository, location_opts.source.file, 1354 + argv[0], NULL, argv[1], 1355 + NULL, flags); 1356 1356 else 1357 - ret = git_config_set_in_file_gently(location_opts.source.file, 1358 - argv[0], NULL, NULL); 1357 + ret = repo_config_set_in_file_gently(the_repository, location_opts.source.file, 1358 + argv[0], NULL, NULL); 1359 1359 } 1360 1360 else if (actions == ACTION_UNSET_ALL) { 1361 1361 check_write(&location_opts.source); 1362 1362 check_argc(argc, 1, 2); 1363 - ret = git_config_set_multivar_in_file_gently(location_opts.source.file, 1364 - argv[0], NULL, argv[1], 1365 - NULL, flags | CONFIG_FLAGS_MULTI_REPLACE); 1363 + ret = repo_config_set_multivar_in_file_gently(the_repository, location_opts.source.file, 1364 + argv[0], NULL, argv[1], 1365 + NULL, flags | CONFIG_FLAGS_MULTI_REPLACE); 1366 1366 } 1367 1367 else if (actions == ACTION_RENAME_SECTION) { 1368 1368 check_write(&location_opts.source);
+2 -1
builtin/count-objects.c
··· 7 7 #include "builtin.h" 8 8 #include "config.h" 9 9 #include "dir.h" 10 + #include "environment.h" 10 11 #include "gettext.h" 11 12 #include "path.h" 12 13 #include "parse-options.h" ··· 106 107 OPT_END(), 107 108 }; 108 109 109 - git_config(git_default_config, NULL); 110 + repo_config(the_repository, git_default_config, NULL); 110 111 111 112 argc = parse_options(argc, argv, prefix, opts, count_objects_usage, 0); 112 113 /* we do not take arguments other than flags for now */
+1 -1
builtin/credential-cache--daemon.c
··· 307 307 OPT_END() 308 308 }; 309 309 310 - git_config_get_bool("credentialcache.ignoresighup", &ignore_sighup); 310 + repo_config_get_bool(the_repository, "credentialcache.ignoresighup", &ignore_sighup); 311 311 312 312 argc = parse_options(argc, argv, prefix, options, usage, 0); 313 313 socket_path = argv[0];
+1 -1
builtin/credential-store.c
··· 66 66 { 67 67 int timeout_ms = 1000; 68 68 69 - git_config_get_int("credentialstore.locktimeoutms", &timeout_ms); 69 + repo_config_get_int(the_repository, "credentialstore.locktimeoutms", &timeout_ms); 70 70 if (hold_lock_file_for_update_timeout(&credential_lock, fn, 0, timeout_ms) < 0) 71 71 die_errno(_("unable to get credential storage lock in %d ms"), timeout_ms); 72 72 if (extra)
+2 -1
builtin/credential.c
··· 3 3 #include "git-compat-util.h" 4 4 #include "credential.h" 5 5 #include "builtin.h" 6 + #include "environment.h" 6 7 #include "config.h" 7 8 8 9 static const char usage_msg[] = ··· 16 17 const char *op; 17 18 struct credential c = CREDENTIAL_INIT; 18 19 19 - git_config(git_default_config, NULL); 20 + repo_config(the_repository, git_default_config, NULL); 20 21 21 22 show_usage_if_asked(argc, argv, usage_msg); 22 23 if (argc != 2)
+1 -1
builtin/describe.c
··· 623 623 OPT_END(), 624 624 }; 625 625 626 - git_config(git_default_config, NULL); 626 + repo_config(the_repository, git_default_config, NULL); 627 627 argc = parse_options(argc, argv, prefix, options, describe_usage, 0); 628 628 if (abbrev < 0) 629 629 abbrev = DEFAULT_ABBREV;
+1 -1
builtin/diff-files.c
··· 31 31 32 32 show_usage_if_asked(argc, argv, diff_files_usage); 33 33 34 - git_config(git_diff_basic_config, NULL); /* no "diff" UI options */ 34 + repo_config(the_repository, git_diff_basic_config, NULL); /* no "diff" UI options */ 35 35 36 36 prepare_repo_settings(the_repository); 37 37 the_repository->settings.command_requires_full_index = 0;
+1 -1
builtin/diff-index.c
··· 28 28 29 29 show_usage_if_asked(argc, argv, diff_cache_usage); 30 30 31 - git_config(git_diff_basic_config, NULL); /* no "diff" UI options */ 31 + repo_config(the_repository, git_diff_basic_config, NULL); /* no "diff" UI options */ 32 32 33 33 prepare_repo_settings(the_repository); 34 34 the_repository->settings.command_requires_full_index = 0;
+1 -1
builtin/diff-tree.c
··· 124 124 125 125 show_usage_if_asked(argc, argv, diff_tree_usage); 126 126 127 - git_config(git_diff_basic_config, NULL); /* no "diff" UI options */ 127 + repo_config(the_repository, git_diff_basic_config, NULL); /* no "diff" UI options */ 128 128 129 129 prepare_repo_settings(the_repository); 130 130 the_repository->settings.command_requires_full_index = 0;
+1 -1
builtin/diff.c
··· 486 486 repo_set_hash_algo(the_repository, GIT_HASH_DEFAULT); 487 487 488 488 init_diff_ui_defaults(); 489 - git_config(git_diff_ui_config, NULL); 489 + repo_config(the_repository, git_diff_ui_config, NULL); 490 490 prefix = precompose_argv_prefix(argc, argv, prefix); 491 491 492 492 repo_init_revisions(the_repository, &rev, prefix);
+2 -1
builtin/fast-export.c
··· 9 9 10 10 #include "builtin.h" 11 11 #include "config.h" 12 + #include "environment.h" 12 13 #include "gettext.h" 13 14 #include "hex.h" 14 15 #include "refs.h" ··· 1361 1362 usage_with_options (fast_export_usage, options); 1362 1363 1363 1364 /* we handle encodings */ 1364 - git_config(git_default_config, NULL); 1365 + repo_config(the_repository, git_default_config, NULL); 1365 1366 1366 1367 repo_init_revisions(the_repository, &revs, prefix); 1367 1368 init_revision_sources(&revision_sources);
+6 -6
builtin/fast-import.c
··· 3592 3592 int limit; 3593 3593 unsigned long packsizelimit_value; 3594 3594 3595 - if (!git_config_get_ulong("pack.depth", &max_depth)) { 3595 + if (!repo_config_get_ulong(the_repository, "pack.depth", &max_depth)) { 3596 3596 if (max_depth > MAX_DEPTH) 3597 3597 max_depth = MAX_DEPTH; 3598 3598 } 3599 - if (!git_config_get_int("pack.indexversion", &indexversion_value)) { 3599 + if (!repo_config_get_int(the_repository, "pack.indexversion", &indexversion_value)) { 3600 3600 pack_idx_opts.version = indexversion_value; 3601 3601 if (pack_idx_opts.version > 2) 3602 3602 git_die_config(the_repository, "pack.indexversion", 3603 3603 "bad pack.indexVersion=%"PRIu32, pack_idx_opts.version); 3604 3604 } 3605 - if (!git_config_get_ulong("pack.packsizelimit", &packsizelimit_value)) 3605 + if (!repo_config_get_ulong(the_repository, "pack.packsizelimit", &packsizelimit_value)) 3606 3606 max_packsize = packsizelimit_value; 3607 3607 3608 - if (!git_config_get_int("fastimport.unpacklimit", &limit)) 3608 + if (!repo_config_get_int(the_repository, "fastimport.unpacklimit", &limit)) 3609 3609 unpack_limit = limit; 3610 - else if (!git_config_get_int("transfer.unpacklimit", &limit)) 3610 + else if (!repo_config_get_int(the_repository, "transfer.unpacklimit", &limit)) 3611 3611 unpack_limit = limit; 3612 3612 3613 - git_config(git_default_config, NULL); 3613 + repo_config(the_repository, git_default_config, NULL); 3614 3614 } 3615 3615 3616 3616 static const char fast_import_usage[] =
+5 -5
builtin/fetch.c
··· 1995 1995 struct remote_group_data g; 1996 1996 g.name = name; g.list = list; 1997 1997 1998 - git_config(get_remote_group, &g); 1998 + repo_config(the_repository, get_remote_group, &g); 1999 1999 if (list->nr == prev_nr) { 2000 2000 struct remote *remote = remote_get(name); 2001 2001 if (!remote_is_configured(remote, 0)) ··· 2417 2417 free(anon); 2418 2418 } 2419 2419 2420 - git_config(git_fetch_config, &config); 2420 + repo_config(the_repository, git_fetch_config, &config); 2421 2421 if (the_repository->gitdir) { 2422 2422 prepare_repo_settings(the_repository); 2423 2423 the_repository->settings.command_requires_full_index = 0; ··· 2508 2508 if (!max_jobs) 2509 2509 max_jobs = online_cpus(); 2510 2510 2511 - if (!git_config_get_string_tmp("fetch.bundleuri", &bundle_uri) && 2511 + if (!repo_config_get_string_tmp(the_repository, "fetch.bundleuri", &bundle_uri) && 2512 2512 fetch_bundle_uri(the_repository, bundle_uri, NULL)) 2513 2513 warning(_("failed to fetch bundles from '%s'"), bundle_uri); 2514 2514 ··· 2683 2683 * but respect config settings disabling it. 2684 2684 */ 2685 2685 int opt_val; 2686 - if (git_config_get_int("gc.autopacklimit", &opt_val)) 2686 + if (repo_config_get_int(the_repository, "gc.autopacklimit", &opt_val)) 2687 2687 opt_val = -1; 2688 2688 if (opt_val != 0) 2689 2689 git_config_push_parameter("gc.autoPackLimit=1"); 2690 2690 2691 - if (git_config_get_int("maintenance.incremental-repack.auto", &opt_val)) 2691 + if (repo_config_get_int(the_repository, "maintenance.incremental-repack.auto", &opt_val)) 2692 2692 opt_val = -1; 2693 2693 if (opt_val != 0) 2694 2694 git_config_push_parameter("maintenance.incremental-repack.auto=-1");
+1 -1
builtin/fmt-merge-msg.c
··· 53 53 int ret; 54 54 struct fmt_merge_msg_opts opts; 55 55 56 - git_config(fmt_merge_msg_config, NULL); 56 + repo_config(the_repository, fmt_merge_msg_config, NULL); 57 57 argc = parse_options(argc, argv, prefix, options, fmt_merge_msg_usage, 58 58 0); 59 59 if (argc > 0)
+1
builtin/for-each-ref.c
··· 1 1 #include "builtin.h" 2 2 #include "commit.h" 3 3 #include "config.h" 4 + #include "environment.h" 4 5 #include "gettext.h" 5 6 #include "object.h" 6 7 #include "parse-options.h"
+1 -1
builtin/fsck.c
··· 987 987 if (name_objects) 988 988 fsck_enable_object_names(&fsck_walk_options); 989 989 990 - git_config(git_fsck_config, &fsck_obj_options); 990 + repo_config(the_repository, git_fsck_config, &fsck_obj_options); 991 991 prepare_repo_settings(the_repository); 992 992 993 993 if (check_references)
+2 -1
builtin/fsmonitor--daemon.c
··· 5 5 #include "abspath.h" 6 6 #include "config.h" 7 7 #include "dir.h" 8 + #include "environment.h" 8 9 #include "gettext.h" 9 10 #include "parse-options.h" 10 11 #include "fsmonitor-ll.h" ··· 1547 1548 OPT_END() 1548 1549 }; 1549 1550 1550 - git_config(fsmonitor_config, NULL); 1551 + repo_config(the_repository, fsmonitor_config, NULL); 1551 1552 1552 1553 argc = parse_options(argc, argv, prefix, options, 1553 1554 builtin_fsmonitor__daemon_usage, 0);
+35 -35
builtin/gc.c
··· 114 114 const char *value; 115 115 timestamp_t expire; 116 116 117 - if (!git_config_get_value(var, &value) && value) { 117 + if (!repo_config_get_value(the_repository, var, &value) && value) { 118 118 if (parse_expiry_date(value, &expire)) 119 119 die(_("failed to parse '%s' value '%s'"), var, value); 120 120 return expire == 0; ··· 178 178 char *owned = NULL; 179 179 unsigned long ulongval; 180 180 181 - if (!git_config_get_value("gc.packrefs", &value)) { 181 + if (!repo_config_get_value(the_repository, "gc.packrefs", &value)) { 182 182 if (value && !strcmp(value, "notbare")) 183 183 cfg->pack_refs = -1; 184 184 else ··· 189 189 gc_config_is_timestamp_never("gc.reflogexpireunreachable")) 190 190 cfg->prune_reflogs = 0; 191 191 192 - git_config_get_int("gc.aggressivewindow", &cfg->aggressive_window); 193 - git_config_get_int("gc.aggressivedepth", &cfg->aggressive_depth); 194 - git_config_get_int("gc.auto", &cfg->gc_auto_threshold); 195 - git_config_get_int("gc.autopacklimit", &cfg->gc_auto_pack_limit); 196 - git_config_get_bool("gc.autodetach", &cfg->detach_auto); 197 - git_config_get_bool("gc.cruftpacks", &cfg->cruft_packs); 198 - git_config_get_ulong("gc.maxcruftsize", &cfg->max_cruft_size); 192 + repo_config_get_int(the_repository, "gc.aggressivewindow", &cfg->aggressive_window); 193 + repo_config_get_int(the_repository, "gc.aggressivedepth", &cfg->aggressive_depth); 194 + repo_config_get_int(the_repository, "gc.auto", &cfg->gc_auto_threshold); 195 + repo_config_get_int(the_repository, "gc.autopacklimit", &cfg->gc_auto_pack_limit); 196 + repo_config_get_bool(the_repository, "gc.autodetach", &cfg->detach_auto); 197 + repo_config_get_bool(the_repository, "gc.cruftpacks", &cfg->cruft_packs); 198 + repo_config_get_ulong(the_repository, "gc.maxcruftsize", &cfg->max_cruft_size); 199 199 200 200 if (!repo_config_get_expiry(the_repository, "gc.pruneexpire", &owned)) { 201 201 free(cfg->prune_expire); ··· 212 212 cfg->gc_log_expire = owned; 213 213 } 214 214 215 - git_config_get_ulong("gc.bigpackthreshold", &cfg->big_pack_threshold); 216 - git_config_get_ulong("pack.deltacachesize", &cfg->max_delta_cache_size); 215 + repo_config_get_ulong(the_repository, "gc.bigpackthreshold", &cfg->big_pack_threshold); 216 + repo_config_get_ulong(the_repository, "pack.deltacachesize", &cfg->max_delta_cache_size); 217 217 218 - if (!git_config_get_ulong("core.deltabasecachelimit", &ulongval)) 218 + if (!repo_config_get_ulong(the_repository, "core.deltabasecachelimit", &ulongval)) 219 219 cfg->delta_base_cache_limit = ulongval; 220 220 221 - if (!git_config_get_string("gc.repackfilter", &owned)) { 221 + if (!repo_config_get_string(the_repository, "gc.repackfilter", &owned)) { 222 222 free(cfg->repack_filter); 223 223 cfg->repack_filter = owned; 224 224 } 225 225 226 - if (!git_config_get_string("gc.repackfilterto", &owned)) { 226 + if (!repo_config_get_string(the_repository, "gc.repackfilterto", &owned)) { 227 227 free(cfg->repack_filter_to); 228 228 cfg->repack_filter_to = owned; 229 229 } 230 230 231 - git_config(git_default_config, NULL); 231 + repo_config(the_repository, git_default_config, NULL); 232 232 } 233 233 234 234 enum schedule_priority { ··· 332 332 }; 333 333 int limit = 100; 334 334 335 - git_config_get_int("maintenance.reflog-expire.auto", &limit); 335 + repo_config_get_int(the_repository, "maintenance.reflog-expire.auto", &limit); 336 336 if (!limit) 337 337 return 0; 338 338 if (limit < 0) ··· 379 379 struct dirent *d; 380 380 DIR *dir = NULL; 381 381 382 - git_config_get_int("maintenance.worktree-prune.auto", &limit); 382 + repo_config_get_int(the_repository, "maintenance.worktree-prune.auto", &limit); 383 383 if (limit <= 0) { 384 384 should_prune = limit < 0; 385 385 goto out; ··· 424 424 int should_gc = 0, limit = 1; 425 425 DIR *dir = NULL; 426 426 427 - git_config_get_int("maintenance.rerere-gc.auto", &limit); 427 + repo_config_get_int(the_repository, "maintenance.rerere-gc.auto", &limit); 428 428 if (limit <= 0) { 429 429 should_gc = limit < 0; 430 430 goto out; ··· 1162 1162 1163 1163 data.num_not_in_graph = 0; 1164 1164 data.limit = 100; 1165 - git_config_get_int("maintenance.commit-graph.auto", 1166 - &data.limit); 1165 + repo_config_get_int(the_repository, "maintenance.commit-graph.auto", 1166 + &data.limit); 1167 1167 1168 1168 if (!data.limit) 1169 1169 return 0; ··· 1301 1301 { 1302 1302 int count = 0; 1303 1303 1304 - git_config_get_int("maintenance.loose-objects.auto", 1305 - &loose_object_auto_limit); 1304 + repo_config_get_int(the_repository, "maintenance.loose-objects.auto", 1305 + &loose_object_auto_limit); 1306 1306 1307 1307 if (!loose_object_auto_limit) 1308 1308 return 0; ··· 1416 1416 if (!the_repository->settings.core_multi_pack_index) 1417 1417 return 0; 1418 1418 1419 - git_config_get_int("maintenance.incremental-repack.auto", 1420 - &incremental_repack_auto_limit); 1419 + repo_config_get_int(the_repository, "maintenance.incremental-repack.auto", 1420 + &incremental_repack_auto_limit); 1421 1421 1422 1422 if (!incremental_repack_auto_limit) 1423 1423 return 0; ··· 1766 1766 if (opts->schedule) { 1767 1767 strategy = none_strategy; 1768 1768 1769 - if (!git_config_get_string_tmp("maintenance.strategy", &config_str)) { 1769 + if (!repo_config_get_string_tmp(the_repository, "maintenance.strategy", &config_str)) { 1770 1770 if (!strcasecmp(config_str, "incremental")) 1771 1771 strategy = incremental_strategy; 1772 1772 } ··· 1780 1780 strbuf_reset(&config_name); 1781 1781 strbuf_addf(&config_name, "maintenance.%s.enabled", 1782 1782 tasks[i].name); 1783 - if (!git_config_get_bool(config_name.buf, &config_value)) 1783 + if (!repo_config_get_bool(the_repository, config_name.buf, &config_value)) 1784 1784 strategy.tasks[i].enabled = config_value; 1785 1785 if (!strategy.tasks[i].enabled) 1786 1786 continue; ··· 1789 1789 strbuf_reset(&config_name); 1790 1790 strbuf_addf(&config_name, "maintenance.%s.schedule", 1791 1791 tasks[i].name); 1792 - if (!git_config_get_string_tmp(config_name.buf, &config_str)) 1792 + if (!repo_config_get_string_tmp(the_repository, config_name.buf, &config_str)) 1793 1793 strategy.tasks[i].schedule = parse_schedule(config_str); 1794 1794 if (strategy.tasks[i].schedule < opts->schedule) 1795 1795 continue; ··· 1914 1914 options); 1915 1915 1916 1916 /* Disable foreground maintenance */ 1917 - git_config_set("maintenance.auto", "false"); 1917 + repo_config_set(the_repository, "maintenance.auto", "false"); 1918 1918 1919 1919 /* Set maintenance strategy, if unset */ 1920 - if (git_config_get("maintenance.strategy")) 1921 - git_config_set("maintenance.strategy", "incremental"); 1920 + if (repo_config_get(the_repository, "maintenance.strategy")) 1921 + repo_config_set(the_repository, "maintenance.strategy", "incremental"); 1922 1922 1923 - if (!git_config_get_string_multi(key, &list)) { 1923 + if (!repo_config_get_string_multi(the_repository, key, &list)) { 1924 1924 for_each_string_list_item(item, list) { 1925 1925 if (!strcmp(maintpath, item->string)) { 1926 1926 found = 1; ··· 1939 1939 } 1940 1940 if (!config_file) 1941 1941 die(_("$HOME not set")); 1942 - rc = git_config_set_multivar_in_file_gently( 1942 + rc = repo_config_set_multivar_in_file_gently(the_repository, 1943 1943 config_file, "maintenance.repo", maintpath, 1944 1944 CONFIG_REGEX_NONE, NULL, 0); 1945 1945 free(global_config_file); ··· 1989 1989 } 1990 1990 if (!(config_file 1991 1991 ? git_configset_get_string_multi(&cs, key, &list) 1992 - : git_config_get_string_multi(key, &list))) { 1992 + : repo_config_get_string_multi(the_repository, key, &list))) { 1993 1993 for_each_string_list_item(item, list) { 1994 1994 if (!strcmp(maintpath, item->string)) { 1995 1995 found = 1; ··· 2008 2008 } 2009 2009 if (!config_file) 2010 2010 die(_("$HOME not set")); 2011 - rc = git_config_set_multivar_in_file_gently( 2011 + rc = repo_config_set_multivar_in_file_gently(the_repository, 2012 2012 config_file, key, NULL, maintpath, NULL, 2013 2013 CONFIG_FLAGS_MULTI_REPLACE | CONFIG_FLAGS_FIXED_VALUE); 2014 2014 free(global_config_file); ··· 2345 2345 die(_("failed to create directories for '%s'"), filename); 2346 2346 2347 2347 if ((long)lock_file_timeout_ms < 0 && 2348 - git_config_get_ulong("gc.launchctlplistlocktimeoutms", 2348 + repo_config_get_ulong(the_repository, "gc.launchctlplistlocktimeoutms", 2349 2349 &lock_file_timeout_ms)) 2350 2350 lock_file_timeout_ms = 150; 2351 2351
+3 -2
builtin/grep.c
··· 9 9 10 10 #include "builtin.h" 11 11 #include "abspath.h" 12 + #include "environment.h" 12 13 #include "gettext.h" 13 14 #include "hex.h" 14 15 #include "config.h" ··· 1035 1036 grep_prefix = prefix; 1036 1037 1037 1038 grep_init(&opt, the_repository); 1038 - git_config(grep_cmd_config, &opt); 1039 + repo_config(the_repository, grep_cmd_config, &opt); 1039 1040 1040 1041 /* 1041 1042 * If there is no -- then the paths must exist in the working ··· 1058 1059 1059 1060 if (use_index && !startup_info->have_repository) { 1060 1061 int fallback = 0; 1061 - git_config_get_bool("grep.fallbacktonoindex", &fallback); 1062 + repo_config_get_bool(the_repository, "grep.fallbacktonoindex", &fallback); 1062 1063 if (fallback) 1063 1064 use_index = 0; 1064 1065 else
+2 -1
builtin/hash-object.c
··· 8 8 #include "builtin.h" 9 9 #include "abspath.h" 10 10 #include "config.h" 11 + #include "environment.h" 11 12 #include "gettext.h" 12 13 #include "hex.h" 13 14 #include "object-file.h" ··· 111 112 vpath = vpath_free; 112 113 } 113 114 114 - git_config(git_default_config, NULL); 115 + repo_config(the_repository, git_default_config, NULL); 115 116 116 117 if (stdin_paths) { 117 118 if (hashstdin)
+3 -2
builtin/help.c
··· 6 6 7 7 #include "builtin.h" 8 8 #include "config.h" 9 + #include "environment.h" 9 10 #include "exec-cmd.h" 10 11 #include "gettext.h" 11 12 #include "pager.h" ··· 210 211 if (!strcmp(format, "web") || !strcmp(format, "html")) 211 212 return HELP_FORMAT_WEB; 212 213 /* 213 - * Please update _git_config() in git-completion.bash when you 214 + * Please update _repo_config() in git-completion.bash when you 214 215 * add new help formats. 215 216 */ 216 217 die(_("unrecognized help format '%s'"), format); ··· 706 707 } 707 708 708 709 setup_git_directory_gently(&nongit); 709 - git_config(git_help_config, NULL); 710 + repo_config(the_repository, git_help_config, NULL); 710 711 711 712 if (parsed_help_format != HELP_FORMAT_NONE) 712 713 help_format = parsed_help_format;
+2 -1
builtin/hook.c
··· 1 1 #define USE_THE_REPOSITORY_VARIABLE 2 2 #include "builtin.h" 3 3 #include "config.h" 4 + #include "environment.h" 4 5 #include "gettext.h" 5 6 #include "hook.h" 6 7 #include "parse-options.h" ··· 55 56 strvec_push(&opt.args, argv[i]); 56 57 57 58 /* Need to take into account core.hooksPath */ 58 - git_config(git_default_config, NULL); 59 + repo_config(the_repository, git_default_config, NULL); 59 60 60 61 hook_name = argv[0]; 61 62 if (!ignore_missing)
+1 -1
builtin/index-pack.c
··· 1917 1917 1918 1918 reset_pack_idx_option(&opts); 1919 1919 opts.flags |= WRITE_REV; 1920 - git_config(git_index_pack_config, &opts); 1920 + repo_config(the_repository, git_index_pack_config, &opts); 1921 1921 if (prefix && chdir(prefix)) 1922 1922 die(_("Cannot come back to cwd")); 1923 1923
+2 -1
builtin/interpret-trailers.c
··· 6 6 */ 7 7 #define USE_THE_REPOSITORY_VARIABLE 8 8 #include "builtin.h" 9 + #include "environment.h" 9 10 #include "gettext.h" 10 11 #include "parse-options.h" 11 12 #include "string-list.h" ··· 220 221 OPT_END() 221 222 }; 222 223 223 - git_config(git_default_config, NULL); 224 + repo_config(the_repository, git_default_config, NULL); 224 225 225 226 argc = parse_options(argc, argv, prefix, options, 226 227 git_interpret_trailers_usage, 0);
+12 -12
builtin/log.c
··· 221 221 struct string_list *include = decoration_filter->include_ref_pattern; 222 222 const struct string_list *config_exclude; 223 223 224 - if (!git_config_get_string_multi("log.excludeDecoration", 224 + if (!repo_config_get_string_multi(the_repository, "log.excludeDecoration", 225 225 &config_exclude)) { 226 226 struct string_list_item *item; 227 227 for_each_string_list_item(item, config_exclude) ··· 235 235 * since the command-line takes precedent. 236 236 */ 237 237 if (use_default_decoration_filter && 238 - !git_config_get_string("log.initialdecorationset", &value) && 238 + !repo_config_get_string(the_repository, "log.initialdecorationset", &value) && 239 239 !strcmp("all", value)) 240 240 use_default_decoration_filter = 0; 241 241 free(value); ··· 530 530 531 531 log_config_init(&cfg); 532 532 init_diff_ui_defaults(); 533 - git_config(git_log_config, &cfg); 533 + repo_config(the_repository, git_log_config, &cfg); 534 534 535 535 repo_init_revisions(the_repository, &rev, prefix); 536 - git_config(grep_config, &rev.grep_filter); 536 + repo_config(the_repository, grep_config, &rev.grep_filter); 537 537 538 538 rev.diff = 1; 539 539 rev.simplify_history = 0; ··· 661 661 662 662 log_config_init(&cfg); 663 663 init_diff_ui_defaults(); 664 - git_config(git_log_config, &cfg); 664 + repo_config(the_repository, git_log_config, &cfg); 665 665 666 666 if (the_repository->gitdir) { 667 667 prepare_repo_settings(the_repository); ··· 670 670 671 671 memset(&match_all, 0, sizeof(match_all)); 672 672 repo_init_revisions(the_repository, &rev, prefix); 673 - git_config(grep_config, &rev.grep_filter); 673 + repo_config(the_repository, grep_config, &rev.grep_filter); 674 674 675 675 rev.diff = 1; 676 676 rev.always_show_header = 1; ··· 778 778 779 779 log_config_init(&cfg); 780 780 init_diff_ui_defaults(); 781 - git_config(git_log_config, &cfg); 781 + repo_config(the_repository, git_log_config, &cfg); 782 782 783 783 repo_init_revisions(the_repository, &rev, prefix); 784 784 init_reflog_walk(&rev.reflog_info); 785 - git_config(grep_config, &rev.grep_filter); 785 + repo_config(the_repository, grep_config, &rev.grep_filter); 786 786 787 787 rev.verbose_header = 1; 788 788 memset(&opt, 0, sizeof(opt)); ··· 823 823 824 824 log_config_init(&cfg); 825 825 init_diff_ui_defaults(); 826 - git_config(git_log_config, &cfg); 826 + repo_config(the_repository, git_log_config, &cfg); 827 827 828 828 repo_init_revisions(the_repository, &rev, prefix); 829 - git_config(grep_config, &rev.grep_filter); 829 + repo_config(the_repository, grep_config, &rev.grep_filter); 830 830 831 831 rev.always_show_header = 1; 832 832 memset(&opt, 0, sizeof(opt)); ··· 2029 2029 format_config_init(&cfg); 2030 2030 init_diff_ui_defaults(); 2031 2031 init_display_notes(&cfg.notes_opt); 2032 - git_config(git_format_config, &cfg); 2032 + repo_config(the_repository, git_format_config, &cfg); 2033 2033 repo_init_revisions(the_repository, &rev, prefix); 2034 - git_config(grep_config, &rev.grep_filter); 2034 + repo_config(the_repository, grep_config, &rev.grep_filter); 2035 2035 2036 2036 rev.show_notes = cfg.show_notes; 2037 2037 memcpy(&rev.notes_opt, &cfg.notes_opt, sizeof(cfg.notes_opt));
+1
builtin/ls-files.c
··· 11 11 #include "builtin.h" 12 12 #include "config.h" 13 13 #include "convert.h" 14 + #include "environment.h" 14 15 #include "quote.h" 15 16 #include "dir.h" 16 17 #include "gettext.h"
+2 -1
builtin/ls-tree.c
··· 7 7 #include "builtin.h" 8 8 9 9 #include "config.h" 10 + #include "environment.h" 10 11 #include "gettext.h" 11 12 #include "hex.h" 12 13 #include "object-name.h" ··· 375 376 struct object_context obj_context = {0}; 376 377 int ret; 377 378 378 - git_config(git_default_config, NULL); 379 + repo_config(the_repository, git_default_config, NULL); 379 380 380 381 argc = parse_options(argc, argv, prefix, ls_tree_options, 381 382 ls_tree_usage, 0);
+2 -1
builtin/merge-base.c
··· 2 2 #include "builtin.h" 3 3 #include "config.h" 4 4 #include "commit.h" 5 + #include "environment.h" 5 6 #include "gettext.h" 6 7 #include "hex.h" 7 8 #include "object-name.h" ··· 167 168 OPT_END() 168 169 }; 169 170 170 - git_config(git_default_config, NULL); 171 + repo_config(the_repository, git_default_config, NULL); 171 172 argc = parse_options(argc, argv, prefix, options, merge_base_usage, 0); 172 173 173 174 if (cmdmode == 'a') {
+1 -1
builtin/merge-file.c
··· 97 97 98 98 if (startup_info->have_repository) { 99 99 /* Read the configuration file */ 100 - git_config(git_xmerge_config, NULL); 100 + repo_config(the_repository, git_xmerge_config, NULL); 101 101 if (0 <= git_xmerge_style) 102 102 xmp.style = git_xmerge_style; 103 103 }
+2 -1
builtin/merge-tree.c
··· 1 1 #define USE_THE_REPOSITORY_VARIABLE 2 2 3 3 #include "builtin.h" 4 + #include "environment.h" 4 5 #include "tree-walk.h" 5 6 #include "xdiff-interface.h" 6 7 #include "help.h" ··· 683 684 if (argc != expected_remaining_argc) 684 685 usage_with_options(merge_tree_usage, mt_options); 685 686 686 - git_config(git_default_config, NULL); 687 + repo_config(the_repository, git_default_config, NULL); 687 688 688 689 /* Do the relevant type of merge */ 689 690 if (o.mode == MODE_REAL)
+1 -1
builtin/merge.c
··· 1392 1392 skip_prefix(branch, "refs/heads/", &branch); 1393 1393 1394 1394 init_diff_ui_defaults(); 1395 - git_config(git_merge_config, NULL); 1395 + repo_config(the_repository, git_merge_config, NULL); 1396 1396 1397 1397 if (!branch || is_null_oid(&head_oid)) 1398 1398 head_commit = NULL;
+1 -1
builtin/mktag.c
··· 98 98 fsck_set_msg_type_from_ids(&fsck_options, FSCK_MSG_EXTRA_HEADER_ENTRY, 99 99 FSCK_WARN); 100 100 /* config might set fsck.extraHeaderEntry=* again */ 101 - git_config(git_fsck_config, &fsck_options); 101 + repo_config(the_repository, git_fsck_config, &fsck_options); 102 102 if (fsck_tag_standalone(NULL, buf.buf, buf.len, &fsck_options, 103 103 &tagged_oid, &tagged_type)) 104 104 die(_("tag on stdin did not pass our strict fsck check"));
+3 -2
builtin/multi-pack-index.c
··· 2 2 #include "builtin.h" 3 3 #include "abspath.h" 4 4 #include "config.h" 5 + #include "environment.h" 5 6 #include "gettext.h" 6 7 #include "parse-options.h" 7 8 #include "midx.h" ··· 143 144 144 145 opts.flags |= MIDX_WRITE_BITMAP_HASH_CACHE; 145 146 146 - git_config(git_multi_pack_index_write_config, NULL); 147 + repo_config(the_repository, git_multi_pack_index_write_config, NULL); 147 148 148 149 options = add_common_options(builtin_multi_pack_index_write_options); 149 150 ··· 290 291 291 292 disable_replace_refs(); 292 293 293 - git_config(git_default_config, NULL); 294 + repo_config(the_repository, git_default_config, NULL); 294 295 295 296 if (the_repository && 296 297 the_repository->objects &&
+1 -1
builtin/mv.c
··· 239 239 struct strbuf pathbuf = STRBUF_INIT; 240 240 int ret; 241 241 242 - git_config(git_default_config, NULL); 242 + repo_config(the_repository, git_default_config, NULL); 243 243 244 244 argc = parse_options(argc, argv, prefix, builtin_mv_options, 245 245 builtin_mv_usage, 0);
+1 -1
builtin/name-rev.c
··· 600 600 601 601 mem_pool_init(&string_pool, 0); 602 602 init_commit_rev_name(&rev_names); 603 - git_config(git_default_config, NULL); 603 + repo_config(the_repository, git_default_config, NULL); 604 604 argc = parse_options(argc, argv, prefix, opts, name_rev_usage, 0); 605 605 606 606 #ifndef WITH_BREAKING_CHANGES
+2 -2
builtin/notes.c
··· 873 873 { 874 874 char *value; 875 875 876 - if (git_config_get_string(key, &value)) 876 + if (repo_config_get_string(the_repository, key, &value)) 877 877 return 1; 878 878 if (parse_notes_merge_strategy(value, strategy)) 879 879 git_die_config(the_repository, key, _("unknown notes merge strategy %s"), value); ··· 1145 1145 OPT_END() 1146 1146 }; 1147 1147 1148 - git_config(git_default_config, NULL); 1148 + repo_config(the_repository, git_default_config, NULL); 1149 1149 argc = parse_options(argc, argv, prefix, options, git_notes_usage, 1150 1150 PARSE_OPT_SUBCOMMAND_OPTIONAL); 1151 1151 if (!fn) {
+1 -1
builtin/pack-objects.c
··· 4985 4985 4986 4986 reset_pack_idx_option(&pack_idx_opts); 4987 4987 pack_idx_opts.flags |= WRITE_REV; 4988 - git_config(git_pack_config, NULL); 4988 + repo_config(the_repository, git_pack_config, NULL); 4989 4989 if (git_env_bool(GIT_TEST_NO_WRITE_REV_INDEX, 0)) 4990 4990 pack_idx_opts.flags &= ~WRITE_REV; 4991 4991
+1
builtin/pack-refs.c
··· 1 1 #include "builtin.h" 2 2 #include "config.h" 3 + #include "environment.h" 3 4 #include "gettext.h" 4 5 #include "parse-options.h" 5 6 #include "refs.h"
+2 -1
builtin/patch-id.c
··· 3 3 #include "builtin.h" 4 4 #include "config.h" 5 5 #include "diff.h" 6 + #include "environment.h" 6 7 #include "gettext.h" 7 8 #include "hash.h" 8 9 #include "hex.h" ··· 235 236 OPT_END() 236 237 }; 237 238 238 - git_config(git_patch_id_config, &config); 239 + repo_config(the_repository, git_patch_id_config, &config); 239 240 240 241 /* verbatim implies stable */ 241 242 if (config.verbatim)
+5 -4
builtin/pull.c
··· 11 11 #include "builtin.h" 12 12 #include "advice.h" 13 13 #include "config.h" 14 + #include "environment.h" 14 15 #include "gettext.h" 15 16 #include "hex.h" 16 17 #include "merge.h" ··· 313 314 { 314 315 const char *value; 315 316 316 - if (git_config_get_value("pull.ff", &value)) 317 + if (repo_config_get_value(the_repository, "pull.ff", &value)) 317 318 return NULL; 318 319 319 320 switch (git_parse_maybe_bool(value)) { ··· 344 345 if (curr_branch) { 345 346 char *key = xstrfmt("branch.%s.rebase", curr_branch->name); 346 347 347 - if (!git_config_get_value(key, &value)) { 348 + if (!repo_config_get_value(the_repository, key, &value)) { 348 349 enum rebase_type ret = parse_config_rebase(key, value, 1); 349 350 free(key); 350 351 return ret; ··· 353 354 free(key); 354 355 } 355 356 356 - if (!git_config_get_value("pull.rebase", &value)) 357 + if (!repo_config_get_value(the_repository, "pull.rebase", &value)) 357 358 return parse_config_rebase("pull.rebase", value, 1); 358 359 359 360 *rebase_unspecified = 1; ··· 1011 1012 if (!getenv("GIT_REFLOG_ACTION")) 1012 1013 set_reflog_message(argc, argv); 1013 1014 1014 - git_config(git_pull_config, NULL); 1015 + repo_config(the_repository, git_pull_config, NULL); 1015 1016 if (the_repository->gitdir) { 1016 1017 prepare_repo_settings(the_repository); 1017 1018 the_repository->settings.command_requires_full_index = 0;
+1 -1
builtin/push.c
··· 598 598 }; 599 599 600 600 packet_trace_identity("push"); 601 - git_config(git_push_config, &flags); 601 + repo_config(the_repository, git_push_config, &flags); 602 602 argc = parse_options(argc, argv, prefix, options, push_usage, 0); 603 603 push_options = (push_options_cmdline.nr 604 604 ? &push_options_cmdline
+1 -1
builtin/range-diff.c
··· 54 54 struct object_id oid; 55 55 const char *three_dots = NULL; 56 56 57 - git_config(git_diff_ui_config, NULL); 57 + repo_config(the_repository, git_diff_ui_config, NULL); 58 58 59 59 repo_diff_setup(the_repository, &diffopt); 60 60
+2 -1
builtin/read-tree.c
··· 6 6 #define USE_THE_REPOSITORY_VARIABLE 7 7 #include "builtin.h" 8 8 #include "config.h" 9 + #include "environment.h" 9 10 #include "gettext.h" 10 11 #include "hex.h" 11 12 #include "lockfile.h" ··· 168 169 opts.src_index = the_repository->index; 169 170 opts.dst_index = the_repository->index; 170 171 171 - git_config(git_read_tree_config, NULL); 172 + repo_config(the_repository, git_read_tree_config, NULL); 172 173 173 174 argc = parse_options(argc, argv, cmd_prefix, read_tree_options, 174 175 read_tree_usage, 0);
+2 -2
builtin/rebase.c
··· 340 340 unsigned flags = 0; 341 341 int abbreviate_commands = 0, ret = 0; 342 342 343 - git_config_get_bool("rebase.abbreviatecommands", &abbreviate_commands); 343 + repo_config_get_bool(the_repository, "rebase.abbreviatecommands", &abbreviate_commands); 344 344 345 345 flags |= opts->keep_empty ? TODO_LIST_KEEP_EMPTY : 0; 346 346 flags |= abbreviate_commands ? TODO_LIST_ABBREVIATE_CMDS : 0; ··· 1245 1245 prepare_repo_settings(the_repository); 1246 1246 the_repository->settings.command_requires_full_index = 0; 1247 1247 1248 - git_config(rebase_config, &options); 1248 + repo_config(the_repository, rebase_config, &options); 1249 1249 /* options.gpg_sign_opt will be either "-S" or NULL */ 1250 1250 gpg_sign = options.gpg_sign_opt ? "" : NULL; 1251 1251 FREE_AND_NULL(options.gpg_sign_opt);
+1 -1
builtin/receive-pack.c
··· 2613 2613 if (!enter_repo(service_dir, 0)) 2614 2614 die("'%s' does not appear to be a git repository", service_dir); 2615 2615 2616 - git_config(receive_pack_config, NULL); 2616 + repo_config(the_repository, receive_pack_config, NULL); 2617 2617 if (cert_nonce_seed) 2618 2618 push_cert_nonce = prepare_push_cert_nonce(service_dir, time(NULL)); 2619 2619
+1 -1
builtin/reflog.c
··· 202 202 OPT_END() 203 203 }; 204 204 205 - git_config(reflog_expire_config, &opts); 205 + repo_config(the_repository, reflog_expire_config, &opts); 206 206 207 207 save_commit_buffer = 0; 208 208 do_all = status = 0;
+1 -1
builtin/refs.c
··· 88 88 if (argc) 89 89 usage(_("'git refs verify' takes no arguments")); 90 90 91 - git_config(git_fsck_config, &fsck_refs_options); 91 + repo_config(the_repository, git_fsck_config, &fsck_refs_options); 92 92 prepare_repo_settings(the_repository); 93 93 94 94 worktrees = get_worktrees_without_reading_head();
+28 -28
builtin/remote.c
··· 132 132 else 133 133 strbuf_addf(tmp, "refs/heads/%s:refs/remotes/%s/%s", 134 134 branchname, remotename, branchname); 135 - git_config_set_multivar(key, tmp->buf, "^$", 0); 135 + repo_config_set_multivar(the_repository, key, tmp->buf, "^$", 0); 136 136 } 137 137 138 138 static const char mirror_advice[] = ··· 226 226 for_each_remote(check_remote_collision, (void *)name); 227 227 228 228 strbuf_addf(&buf, "remote.%s.url", name); 229 - git_config_set(buf.buf, url); 229 + repo_config_set(the_repository, buf.buf, url); 230 230 231 231 if (!mirror || mirror & MIRROR_FETCH) { 232 232 strbuf_reset(&buf); ··· 242 242 if (mirror & MIRROR_PUSH) { 243 243 strbuf_reset(&buf); 244 244 strbuf_addf(&buf, "remote.%s.mirror", name); 245 - git_config_set(buf.buf, "true"); 245 + repo_config_set(the_repository, buf.buf, "true"); 246 246 } 247 247 248 248 if (fetch_tags != TAGS_DEFAULT) { 249 249 strbuf_reset(&buf); 250 250 strbuf_addf(&buf, "remote.%s.tagOpt", name); 251 - git_config_set(buf.buf, 252 - fetch_tags == TAGS_SET ? "--tags" : "--no-tags"); 251 + repo_config_set(the_repository, buf.buf, 252 + fetch_tags == TAGS_SET ? "--tags" : "--no-tags"); 253 253 } 254 254 255 255 if (fetch && fetch_remote(name)) { ··· 370 370 { 371 371 if (branch_list.nr) 372 372 return; 373 - git_config(config_read_branches, NULL); 373 + repo_config(the_repository, config_read_branches, NULL); 374 374 } 375 375 376 376 struct ref_states { ··· 651 651 652 652 strbuf_addf(&buf, "remote.%s.url", remote->name); 653 653 for (i = 0; i < remote->url.nr; i++) 654 - git_config_set_multivar(buf.buf, remote->url.v[i], "^$", 0); 654 + repo_config_set_multivar(the_repository, buf.buf, remote->url.v[i], "^$", 0); 655 655 strbuf_reset(&buf); 656 656 strbuf_addf(&buf, "remote.%s.push", remote->name); 657 657 for (i = 0; i < remote->push.nr; i++) 658 - git_config_set_multivar(buf.buf, remote->push.items[i].raw, "^$", 0); 658 + repo_config_set_multivar(the_repository, buf.buf, remote->push.items[i].raw, "^$", 0); 659 659 strbuf_reset(&buf); 660 660 strbuf_addf(&buf, "remote.%s.fetch", remote->name); 661 661 for (i = 0; i < remote->fetch.nr; i++) 662 - git_config_set_multivar(buf.buf, remote->fetch.items[i].raw, "^$", 0); 662 + repo_config_set_multivar(the_repository, buf.buf, remote->fetch.items[i].raw, "^$", 0); 663 663 #ifndef WITH_BREAKING_CHANGES 664 664 if (remote->origin == REMOTE_REMOTES) 665 665 unlink_or_warn(repo_git_path_replace(the_repository, &buf, ··· 707 707 .origin = STRBUF_INIT, 708 708 .linenr = -1, 709 709 }; 710 - git_config(config_read_push_default, &push_default); 710 + repo_config(the_repository, config_read_push_default, &push_default); 711 711 if (push_default.scope >= CONFIG_SCOPE_COMMAND) 712 712 ; /* pass */ 713 713 else if (push_default.scope >= CONFIG_SCOPE_LOCAL) { 714 - int result = git_config_set_gently("remote.pushDefault", 715 - new_name); 714 + int result = repo_config_set_gently(the_repository, "remote.pushDefault", 715 + new_name); 716 716 if (new_name && result && result != CONFIG_NOTHING_SET) 717 717 die(_("could not set '%s'"), "remote.pushDefault"); 718 718 else if (!new_name && result && result != CONFIG_NOTHING_SET) ··· 788 788 if (oldremote->fetch.nr) { 789 789 strbuf_reset(&buf); 790 790 strbuf_addf(&buf, "remote.%s.fetch", rename.new_name); 791 - git_config_set_multivar(buf.buf, NULL, NULL, CONFIG_FLAGS_MULTI_REPLACE); 791 + repo_config_set_multivar(the_repository, buf.buf, NULL, NULL, CONFIG_FLAGS_MULTI_REPLACE); 792 792 strbuf_addf(&old_remote_context, ":refs/remotes/%s/", rename.old_name); 793 793 for (i = 0; i < oldremote->fetch.nr; i++) { 794 794 char *ptr; ··· 808 808 "\tPlease update the configuration manually if necessary."), 809 809 buf2.buf); 810 810 811 - git_config_set_multivar(buf.buf, buf2.buf, "^$", 0); 811 + repo_config_set_multivar(the_repository, buf.buf, buf2.buf, "^$", 0); 812 812 } 813 813 } 814 814 ··· 819 819 if (info->remote_name && !strcmp(info->remote_name, rename.old_name)) { 820 820 strbuf_reset(&buf); 821 821 strbuf_addf(&buf, "branch.%s.remote", item->string); 822 - git_config_set(buf.buf, rename.new_name); 822 + repo_config_set(the_repository, buf.buf, rename.new_name); 823 823 } 824 824 if (info->push_remote_name && !strcmp(info->push_remote_name, rename.old_name)) { 825 825 strbuf_reset(&buf); 826 826 strbuf_addf(&buf, "branch.%s.pushRemote", item->string); 827 - git_config_set(buf.buf, rename.new_name); 827 + repo_config_set(the_repository, buf.buf, rename.new_name); 828 828 } 829 829 } 830 830 ··· 951 951 strbuf_reset(&buf); 952 952 strbuf_addf(&buf, "branch.%s.%s", 953 953 item->string, *k); 954 - result = git_config_set_gently(buf.buf, NULL); 954 + result = repo_config_set_gently(the_repository, buf.buf, NULL); 955 955 if (result && result != CONFIG_NOTHING_SET) 956 956 die(_("could not unset '%s'"), buf.buf); 957 957 } ··· 959 959 if (info->push_remote_name && !strcmp(info->push_remote_name, remote->name)) { 960 960 strbuf_reset(&buf); 961 961 strbuf_addf(&buf, "branch.%s.pushremote", item->string); 962 - result = git_config_set_gently(buf.buf, NULL); 962 + result = repo_config_set_gently(the_repository, buf.buf, NULL); 963 963 if (result && result != CONFIG_NOTHING_SET) 964 964 die(_("could not unset '%s'"), buf.buf); 965 965 } ··· 1285 1285 1286 1286 strbuf_addf(&promisor_config, "remote.%s.partialclonefilter", remote->name); 1287 1287 strbuf_addf(&remote_info_buf, "%s (fetch)", remote->url.v[0]); 1288 - if (!git_config_get_string_tmp(promisor_config.buf, &partial_clone_filter)) 1288 + if (!repo_config_get_string_tmp(the_repository, promisor_config.buf, &partial_clone_filter)) 1289 1289 strbuf_addf(&remote_info_buf, " [%s]", partial_clone_filter); 1290 1290 1291 1291 strbuf_release(&promisor_config); ··· 1520 1520 struct strbuf config_name = STRBUF_INIT; 1521 1521 strbuf_addf(&config_name, 1522 1522 "remote.%s.followremotehead", remote->name); 1523 - git_config_set(config_name.buf, "warn"); 1523 + repo_config_set(the_repository, config_name.buf, "warn"); 1524 1524 strbuf_release(&config_name); 1525 1525 } 1526 1526 ··· 1637 1637 strvec_push(&cmd.args, argv[i]); 1638 1638 1639 1639 if (strcmp(cmd.args.v[cmd.args.nr-1], "default") == 0) { 1640 - git_config(get_remote_default, &default_defined); 1640 + repo_config(the_repository, get_remote_default, &default_defined); 1641 1641 if (!default_defined) { 1642 1642 strvec_pop(&cmd.args); 1643 1643 strvec_push(&cmd.args, "--all"); ··· 1650 1650 1651 1651 static int remove_all_fetch_refspecs(const char *key) 1652 1652 { 1653 - return git_config_set_multivar_gently(key, NULL, NULL, 1654 - CONFIG_FLAGS_MULTI_REPLACE); 1653 + return repo_config_set_multivar_gently(the_repository, key, NULL, NULL, 1654 + CONFIG_FLAGS_MULTI_REPLACE); 1655 1655 } 1656 1656 1657 1657 static void add_branches(struct remote *remote, const char **branches, ··· 1807 1807 /* Special cases that add new entry. */ 1808 1808 if ((!oldurl && !delete_mode) || add_mode) { 1809 1809 if (add_mode) 1810 - git_config_set_multivar(name_buf.buf, newurl, 1810 + repo_config_set_multivar(the_repository, name_buf.buf, newurl, 1811 1811 "^$", 0); 1812 1812 else 1813 - git_config_set(name_buf.buf, newurl); 1813 + repo_config_set(the_repository, name_buf.buf, newurl); 1814 1814 goto out; 1815 1815 } 1816 1816 ··· 1831 1831 regfree(&old_regex); 1832 1832 1833 1833 if (!delete_mode) 1834 - git_config_set_multivar(name_buf.buf, newurl, oldurl, 0); 1834 + repo_config_set_multivar(the_repository, name_buf.buf, newurl, oldurl, 0); 1835 1835 else 1836 - git_config_set_multivar(name_buf.buf, NULL, oldurl, 1837 - CONFIG_FLAGS_MULTI_REPLACE); 1836 + repo_config_set_multivar(the_repository, name_buf.buf, NULL, oldurl, 1837 + CONFIG_FLAGS_MULTI_REPLACE); 1838 1838 out: 1839 1839 strbuf_release(&name_buf); 1840 1840 return 0;
+1 -1
builtin/repack.c
··· 1340 1340 1341 1341 list_objects_filter_init(&po_args.filter_options); 1342 1342 1343 - git_config(repack_config, &cruft_po_args); 1343 + repo_config(the_repository, repack_config, &cruft_po_args); 1344 1344 1345 1345 argc = parse_options(argc, argv, prefix, builtin_repack_options, 1346 1346 git_repack_usage, 0);
+2 -1
builtin/replace.c
··· 11 11 #include "builtin.h" 12 12 #include "config.h" 13 13 #include "editor.h" 14 + #include "environment.h" 14 15 #include "gettext.h" 15 16 #include "hex.h" 16 17 #include "refs.h" ··· 574 575 }; 575 576 576 577 disable_replace_refs(); 577 - git_config(git_default_config, NULL); 578 + repo_config(the_repository, git_default_config, NULL); 578 579 579 580 argc = parse_options(argc, argv, prefix, options, git_replace_usage, 0); 580 581
+1 -1
builtin/rerere.c
··· 66 66 67 67 argc = parse_options(argc, argv, prefix, options, rerere_usage, 0); 68 68 69 - git_config(git_xmerge_config, NULL); 69 + repo_config(the_repository, git_xmerge_config, NULL); 70 70 71 71 if (autoupdate == 1) 72 72 flags = RERERE_AUTOUPDATE;
+1 -1
builtin/reset.c
··· 377 377 OPT_END() 378 378 }; 379 379 380 - git_config(git_reset_config, NULL); 380 + repo_config(the_repository, git_reset_config, NULL); 381 381 382 382 argc = parse_options(argc, argv, prefix, options, git_reset_usage, 383 383 PARSE_OPT_KEEP_DASHDASH);
+1 -1
builtin/rev-list.c
··· 644 644 645 645 show_usage_if_asked(argc, argv, rev_list_usage); 646 646 647 - git_config(git_default_config, NULL); 647 + repo_config(the_repository, git_default_config, NULL); 648 648 repo_init_revisions(the_repository, &revs, prefix); 649 649 revs.abbrev = DEFAULT_ABBREV; 650 650 revs.commit_format = CMIT_FMT_UNSPECIFIED;
+2 -2
builtin/rev-parse.c
··· 734 734 /* No options; just report on whether we're in a git repo or not. */ 735 735 if (argc == 1) { 736 736 setup_git_directory(); 737 - git_config(git_default_config, NULL); 737 + repo_config(the_repository, git_default_config, NULL); 738 738 return 0; 739 739 } 740 740 ··· 769 769 /* The rest of the options require a git repository. */ 770 770 if (!did_repo_setup) { 771 771 prefix = setup_git_directory(); 772 - git_config(git_default_config, NULL); 772 + repo_config(the_repository, git_default_config, NULL); 773 773 did_repo_setup = 1; 774 774 775 775 prepare_repo_settings(the_repository);
+2 -1
builtin/rm.c
··· 9 9 #include "builtin.h" 10 10 #include "advice.h" 11 11 #include "config.h" 12 + #include "environment.h" 12 13 #include "lockfile.h" 13 14 #include "dir.h" 14 15 #include "gettext.h" ··· 271 272 struct pathspec pathspec; 272 273 char *seen; 273 274 274 - git_config(git_default_config, NULL); 275 + repo_config(the_repository, git_default_config, NULL); 275 276 276 277 argc = parse_options(argc, argv, prefix, builtin_rm_options, 277 278 builtin_rm_usage, 0);
+1
builtin/send-pack.c
··· 1 1 #include "builtin.h" 2 2 #include "config.h" 3 + #include "environment.h" 3 4 #include "hex.h" 4 5 #include "pkt-line.h" 5 6 #include "run-command.h"
+1 -1
builtin/shortlog.c
··· 421 421 if (nongit && !the_hash_algo) 422 422 repo_set_hash_algo(the_repository, GIT_HASH_DEFAULT); 423 423 424 - git_config(git_default_config, NULL); 424 + repo_config(the_repository, git_default_config, NULL); 425 425 shortlog_init(&log); 426 426 repo_init_revisions(the_repository, &rev, prefix); 427 427 parse_options_start(&ctx, argc, argv, prefix, options,
+1 -1
builtin/show-branch.c
··· 710 710 711 711 init_commit_name_slab(&name_slab); 712 712 713 - git_config(git_show_branch_config, NULL); 713 + repo_config(the_repository, git_show_branch_config, NULL); 714 714 715 715 /* If nothing is specified, try the default first */ 716 716 if (ac == 1 && default_args.nr) {
+2 -1
builtin/show-ref.c
··· 1 1 #define USE_THE_REPOSITORY_VARIABLE 2 2 #include "builtin.h" 3 3 #include "config.h" 4 + #include "environment.h" 4 5 #include "gettext.h" 5 6 #include "hex.h" 6 7 #include "refs/refs-internal.h" ··· 324 325 OPT_END() 325 326 }; 326 327 327 - git_config(git_default_config, NULL); 328 + repo_config(the_repository, git_default_config, NULL); 328 329 329 330 argc = parse_options(argc, argv, prefix, show_ref_options, 330 331 show_ref_usage, 0);
+1 -1
builtin/sparse-checkout.c
··· 1082 1082 builtin_sparse_checkout_options, 1083 1083 builtin_sparse_checkout_usage, 0); 1084 1084 1085 - git_config(git_default_config, NULL); 1085 + repo_config(the_repository, git_default_config, NULL); 1086 1086 1087 1087 prepare_repo_settings(the_repository); 1088 1088 the_repository->settings.command_requires_full_index = 0;
+2 -2
builtin/stash.c
··· 979 979 int do_usage = 0; 980 980 981 981 init_diff_ui_defaults(); 982 - git_config(git_diff_ui_config, NULL); 982 + repo_config(the_repository, git_diff_ui_config, NULL); 983 983 repo_init_revisions(the_repository, &rev, prefix); 984 984 985 985 argc = parse_options(argc, argv, prefix, options, git_stash_show_usage, ··· 2358 2358 const char **args_copy; 2359 2359 int ret; 2360 2360 2361 - git_config(git_stash_config, NULL); 2361 + repo_config(the_repository, git_stash_config, NULL); 2362 2362 2363 2363 argc = parse_options(argc, argv, prefix, options, git_stash_usage, 2364 2364 PARSE_OPT_SUBCOMMAND_OPTIONAL |
+1 -1
builtin/stripspace.c
··· 55 55 56 56 if (mode == STRIP_COMMENTS || mode == COMMENT_LINES) { 57 57 setup_git_directory_gently(&nongit); 58 - git_config(git_default_config, NULL); 58 + repo_config(the_repository, git_default_config, NULL); 59 59 } 60 60 61 61 if (strbuf_read(&buf, 0, 1024) < 0)
+28 -28
builtin/submodule--helper.c
··· 53 53 struct strbuf remotesb = STRBUF_INIT; 54 54 55 55 strbuf_addf(&remotesb, "remote.%s.url", remote); 56 - if (git_config_get_string(remotesb.buf, &remoteurl)) { 56 + if (repo_config_get_string(the_repository, remotesb.buf, &remoteurl)) { 57 57 if (!quiet) 58 58 warning(_("could not look up configuration '%s'. " 59 59 "Assuming this repository is its own " ··· 458 458 */ 459 459 if (!is_submodule_active(the_repository, path)) { 460 460 strbuf_addf(&sb, "submodule.%s.active", sub->name); 461 - git_config_set_gently(sb.buf, "true"); 461 + repo_config_set_gently(the_repository, sb.buf, "true"); 462 462 strbuf_reset(&sb); 463 463 } 464 464 ··· 468 468 * .gitmodules, so look it up directly. 469 469 */ 470 470 strbuf_addf(&sb, "submodule.%s.url", sub->name); 471 - if (git_config_get_string(sb.buf, &url)) { 471 + if (repo_config_get_string(the_repository, sb.buf, &url)) { 472 472 if (!sub->url) 473 473 die(_("No url found for submodule path '%s' in .gitmodules"), 474 474 displaypath); ··· 484 484 free(oldurl); 485 485 } 486 486 487 - if (git_config_set_gently(sb.buf, url)) 487 + if (repo_config_set_gently(the_repository, sb.buf, url)) 488 488 die(_("Failed to register url for submodule path '%s'"), 489 489 displaypath); 490 490 if (!(flags & OPT_QUIET)) ··· 496 496 497 497 /* Copy "update" setting when it is not set yet */ 498 498 strbuf_addf(&sb, "submodule.%s.update", sub->name); 499 - if (git_config_get_string_tmp(sb.buf, &upd) && 499 + if (repo_config_get_string_tmp(the_repository, sb.buf, &upd) && 500 500 sub->update_strategy.type != SM_UPDATE_UNSPECIFIED) { 501 501 if (sub->update_strategy.type == SM_UPDATE_COMMAND) { 502 502 fprintf(stderr, _("warning: command update mode suggested for submodule '%s'\n"), ··· 506 506 upd = submodule_update_type_to_string(sub->update_strategy.type); 507 507 } 508 508 509 - if (git_config_set_gently(sb.buf, upd)) 509 + if (repo_config_set_gently(the_repository, sb.buf, upd)) 510 510 die(_("Failed to register update mode for submodule path '%s'"), displaypath); 511 511 } 512 512 strbuf_release(&sb); ··· 549 549 * If there are no path args and submodule.active is set then, 550 550 * by default, only initialize 'active' modules. 551 551 */ 552 - if (!argc && !git_config_get("submodule.active")) 552 + if (!argc && !repo_config_get(the_repository, "submodule.active")) 553 553 module_list_active(&list); 554 554 555 555 info.prefix = prefix; ··· 649 649 "--ignore-submodules=dirty", "--quiet", "--", 650 650 path, NULL); 651 651 652 - git_config(git_diff_basic_config, NULL); 652 + repo_config(the_repository, git_diff_basic_config, NULL); 653 653 654 654 repo_init_revisions(the_repository, &rev, NULL); 655 655 rev.abbrev = 0; ··· 1034 1034 1035 1035 config_key = xstrfmt("submodule.%s.ignore", 1036 1036 sub->name); 1037 - if (!git_config_get_string_tmp(config_key, &value)) 1037 + if (!repo_config_get_string_tmp(the_repository, config_key, &value)) 1038 1038 ignore_all = !strcmp(value, "all"); 1039 1039 else if (sub->ignore) 1040 1040 ignore_all = !strcmp(sub->ignore, "all"); ··· 1108 1108 if (info->argc) 1109 1109 strvec_pushv(&diff_args, info->argv); 1110 1110 1111 - git_config(git_diff_basic_config, NULL); 1111 + repo_config(the_repository, git_diff_basic_config, NULL); 1112 1112 repo_init_revisions(the_repository, &rev, info->prefix); 1113 1113 rev.abbrev = 0; 1114 1114 precompose_argv_prefix(diff_args.nr, diff_args.v, NULL); ··· 1262 1262 1263 1263 strbuf_reset(&sb); 1264 1264 strbuf_addf(&sb, "submodule.%s.url", sub->name); 1265 - if (git_config_set_gently(sb.buf, super_config_url)) 1265 + if (repo_config_set_gently(the_repository, sb.buf, super_config_url)) 1266 1266 die(_("failed to register url for submodule path '%s'"), 1267 1267 displaypath); 1268 1268 ··· 1280 1280 submodule_to_gitdir(the_repository, &sb, path); 1281 1281 strbuf_addstr(&sb, "/config"); 1282 1282 1283 - if (git_config_set_in_file_gently(sb.buf, remote_key, NULL, sub_origin_url)) 1283 + if (repo_config_set_in_file_gently(the_repository, sb.buf, remote_key, NULL, sub_origin_url)) 1284 1284 die(_("failed to update remote for submodule '%s'"), 1285 1285 path); 1286 1286 ··· 1623 1623 char *sm_alternate = NULL, *error_strategy = NULL; 1624 1624 struct submodule_alternate_setup sas = SUBMODULE_ALTERNATE_SETUP_INIT; 1625 1625 1626 - git_config_get_string("submodule.alternateLocation", &sm_alternate); 1626 + repo_config_get_string(the_repository, "submodule.alternateLocation", &sm_alternate); 1627 1627 if (!sm_alternate) 1628 1628 return; 1629 1629 1630 - git_config_get_string("submodule.alternateErrorStrategy", &error_strategy); 1630 + repo_config_get_string(the_repository, "submodule.alternateErrorStrategy", &error_strategy); 1631 1631 1632 1632 if (!error_strategy) 1633 1633 error_strategy = xstrdup("die"); ··· 1808 1808 die(_("could not get submodule directory for '%s'"), clone_data_path); 1809 1809 1810 1810 /* setup alternateLocation and alternateErrorStrategy in the cloned submodule if needed */ 1811 - git_config_get_string("submodule.alternateLocation", &sm_alternate); 1811 + repo_config_get_string(the_repository, "submodule.alternateLocation", &sm_alternate); 1812 1812 if (sm_alternate) 1813 - git_config_set_in_file(p, "submodule.alternateLocation", 1814 - sm_alternate); 1815 - git_config_get_string("submodule.alternateErrorStrategy", &error_strategy); 1813 + repo_config_set_in_file(the_repository, p, "submodule.alternateLocation", 1814 + sm_alternate); 1815 + repo_config_get_string(the_repository, "submodule.alternateErrorStrategy", &error_strategy); 1816 1816 if (error_strategy) 1817 - git_config_set_in_file(p, "submodule.alternateErrorStrategy", 1818 - error_strategy); 1817 + repo_config_set_in_file(the_repository, p, "submodule.alternateErrorStrategy", 1818 + error_strategy); 1819 1819 1820 1820 free(sm_alternate); 1821 1821 free(error_strategy); ··· 2522 2522 abs_path = absolute_pathdup(path); 2523 2523 rel_path = relative_path(abs_path, subrepo.gitdir, &sb); 2524 2524 2525 - git_config_set_in_file(cfg_file, "core.worktree", rel_path); 2525 + repo_config_set_in_file(the_repository, cfg_file, "core.worktree", rel_path); 2526 2526 2527 2527 free(cfg_file); 2528 2528 free(abs_path); ··· 2830 2830 }; 2831 2831 2832 2832 update_clone_config_from_gitmodules(&opt.max_jobs); 2833 - git_config(git_update_clone_config, &opt.max_jobs); 2833 + repo_config(the_repository, git_update_clone_config, &opt.max_jobs); 2834 2834 2835 2835 argc = parse_options(argc, argv, prefix, module_update_options, 2836 2836 git_submodule_helper_usage, 0); ··· 2878 2878 * If there are no path args and submodule.active is set then, 2879 2879 * by default, only initialize 'active' modules. 2880 2880 */ 2881 - if (!argc && !git_config_get("submodule.active")) 2881 + if (!argc && !repo_config_get(the_repository, "submodule.active")) 2882 2882 module_list_active(&list); 2883 2883 2884 2884 info.prefix = opt.prefix; ··· 3128 3128 NULL 3129 3129 }; 3130 3130 3131 - git_config(git_default_config, NULL); 3131 + repo_config(the_repository, git_default_config, NULL); 3132 3132 track = git_branch_track; 3133 3133 argc = parse_options(argc, argv, prefix, options, usage, 0); 3134 3134 ··· 3309 3309 struct child_process add_gitmodules = CHILD_PROCESS_INIT; 3310 3310 3311 3311 key = xstrfmt("submodule.%s.url", add_data->sm_name); 3312 - git_config_set_gently(key, add_data->realrepo); 3312 + repo_config_set_gently(the_repository, key, add_data->realrepo); 3313 3313 free(key); 3314 3314 3315 3315 add_submod.git_cmd = 1; ··· 3349 3349 * is_submodule_active(), since that function needs to find 3350 3350 * out the value of "submodule.active" again anyway. 3351 3351 */ 3352 - if (!git_config_get("submodule.active")) { 3352 + if (!repo_config_get(the_repository, "submodule.active")) { 3353 3353 /* 3354 3354 * If the submodule being added isn't already covered by the 3355 3355 * current configured pathspec, set the submodule's active flag 3356 3356 */ 3357 3357 if (!is_submodule_active(the_repository, add_data->sm_path)) { 3358 3358 key = xstrfmt("submodule.%s.active", add_data->sm_name); 3359 - git_config_set_gently(key, "true"); 3359 + repo_config_set_gently(the_repository, key, "true"); 3360 3360 free(key); 3361 3361 } 3362 3362 } else { 3363 3363 key = xstrfmt("submodule.%s.active", add_data->sm_name); 3364 - git_config_set_gently(key, "true"); 3364 + repo_config_set_gently(the_repository, key, "true"); 3365 3365 free(key); 3366 3366 } 3367 3367 }
+2 -1
builtin/symbolic-ref.c
··· 1 1 #define USE_THE_REPOSITORY_VARIABLE 2 2 #include "builtin.h" 3 3 #include "config.h" 4 + #include "environment.h" 4 5 #include "gettext.h" 5 6 #include "refs.h" 6 7 #include "parse-options.h" ··· 59 60 OPT_END(), 60 61 }; 61 62 62 - git_config(git_default_config, NULL); 63 + repo_config(the_repository, git_default_config, NULL); 63 64 argc = parse_options(argc, argv, prefix, options, 64 65 git_symbolic_ref_usage, 0); 65 66 if (msg && !*msg)
+1 -1
builtin/tag.c
··· 546 546 * Try to set sort keys from config. If config does not set any, 547 547 * fall back on default (refname) sorting. 548 548 */ 549 - git_config(git_tag_config, &sorting_options); 549 + repo_config(the_repository, git_tag_config, &sorting_options); 550 550 if (!sorting_options.nr) 551 551 string_list_append(&sorting_options, "refname"); 552 552
+2 -1
builtin/unpack-file.c
··· 1 1 #define USE_THE_REPOSITORY_VARIABLE 2 2 #include "builtin.h" 3 3 #include "config.h" 4 + #include "environment.h" 4 5 #include "hex.h" 5 6 #include "object-file.h" 6 7 #include "object-name.h" ··· 43 44 if (repo_get_oid(the_repository, argv[1], &oid)) 44 45 die("Not a valid object name %s", argv[1]); 45 46 46 - git_config(git_default_config, NULL); 47 + repo_config(the_repository, git_default_config, NULL); 47 48 48 49 puts(create_temp_file(&oid)); 49 50 return 0;
+1 -1
builtin/unpack-objects.c
··· 621 621 622 622 disable_replace_refs(); 623 623 624 - git_config(git_default_config, NULL); 624 + repo_config(the_repository, git_default_config, NULL); 625 625 626 626 quiet = !isatty(2); 627 627
+1 -1
builtin/update-index.c
··· 1103 1103 show_usage_with_options_if_asked(argc, argv, 1104 1104 update_index_usage, options); 1105 1105 1106 - git_config(git_default_config, NULL); 1106 + repo_config(the_repository, git_default_config, NULL); 1107 1107 1108 1108 prepare_repo_settings(r); 1109 1109 the_repository->settings.command_requires_full_index = 0;
+2 -1
builtin/update-ref.c
··· 3 3 4 4 #include "builtin.h" 5 5 #include "config.h" 6 + #include "environment.h" 6 7 #include "gettext.h" 7 8 #include "hash.h" 8 9 #include "hex.h" ··· 769 770 OPT_END(), 770 771 }; 771 772 772 - git_config(git_default_config, NULL); 773 + repo_config(the_repository, git_default_config, NULL); 773 774 argc = parse_options(argc, argv, prefix, options, git_update_ref_usage, 774 775 0); 775 776 if (msg && !*msg)
+1
builtin/update-server-info.c
··· 1 1 #include "builtin.h" 2 2 #include "config.h" 3 + #include "environment.h" 3 4 #include "gettext.h" 4 5 #include "parse-options.h" 5 6 #include "server-info.h"
+3 -2
builtin/var.c
··· 11 11 #include "attr.h" 12 12 #include "config.h" 13 13 #include "editor.h" 14 + #include "environment.h" 14 15 #include "ident.h" 15 16 #include "pager.h" 16 17 #include "refs.h" ··· 226 227 usage(var_usage); 227 228 228 229 if (strcmp(argv[1], "-l") == 0) { 229 - git_config(show_config, NULL); 230 + repo_config(the_repository, show_config, NULL); 230 231 list_vars(); 231 232 return 0; 232 233 } 233 - git_config(git_default_config, NULL); 234 + repo_config(the_repository, git_default_config, NULL); 234 235 235 236 git_var = get_git_var(argv[1]); 236 237 if (!git_var)
+1
builtin/verify-commit.c
··· 7 7 */ 8 8 #include "builtin.h" 9 9 #include "config.h" 10 + #include "environment.h" 10 11 #include "gettext.h" 11 12 #include "object-name.h" 12 13 #include "commit.h"
+2 -1
builtin/verify-pack.c
··· 1 1 #define USE_THE_REPOSITORY_VARIABLE 2 2 #include "builtin.h" 3 3 #include "config.h" 4 + #include "environment.h" 4 5 #include "gettext.h" 5 6 #include "run-command.h" 6 7 #include "parse-options.h" ··· 81 82 OPT_END() 82 83 }; 83 84 84 - git_config(git_default_config, NULL); 85 + repo_config(the_repository, git_default_config, NULL); 85 86 argc = parse_options(argc, argv, prefix, verify_pack_options, 86 87 verify_pack_usage, 0); 87 88 if (argc < 1)
+1
builtin/verify-tag.c
··· 7 7 */ 8 8 #include "builtin.h" 9 9 #include "config.h" 10 + #include "environment.h" 10 11 #include "gettext.h" 11 12 #include "tag.h" 12 13 #include "object-name.h"
+4 -4
builtin/worktree.c
··· 379 379 380 380 if (!git_configset_get_bool(&cs, "core.bare", &bare) && 381 381 bare && 382 - git_config_set_multivar_in_file_gently( 382 + repo_config_set_multivar_in_file_gently(the_repository, 383 383 to_file, "core.bare", NULL, "true", NULL, 0)) 384 384 error(_("failed to unset '%s' in '%s'"), 385 385 "core.bare", to_file); 386 386 if (!git_configset_get(&cs, "core.worktree") && 387 - git_config_set_in_file_gently(to_file, 388 - "core.worktree", NULL, NULL)) 387 + repo_config_set_in_file_gently(the_repository, to_file, 388 + "core.worktree", NULL, NULL)) 389 389 error(_("failed to unset '%s' in '%s'"), 390 390 "core.worktree", to_file); 391 391 ··· 1448 1448 OPT_END() 1449 1449 }; 1450 1450 1451 - git_config(git_worktree_config, NULL); 1451 + repo_config(the_repository, git_worktree_config, NULL); 1452 1452 1453 1453 if (!prefix) 1454 1454 prefix = "";
+2 -1
builtin/write-tree.c
··· 6 6 #define USE_THE_REPOSITORY_VARIABLE 7 7 #include "builtin.h" 8 8 #include "config.h" 9 + #include "environment.h" 9 10 #include "gettext.h" 10 11 #include "hex.h" 11 12 #include "tree.h" ··· 43 44 OPT_END() 44 45 }; 45 46 46 - git_config(git_default_config, NULL); 47 + repo_config(the_repository, git_default_config, NULL); 47 48 argc = parse_options(argc, argv, cmd_prefix, write_tree_options, 48 49 write_tree_usage, 0); 49 50
+1 -1
checkout.c
··· 52 52 { 53 53 struct tracking_name_data cb_data = TRACKING_NAME_DATA_INIT; 54 54 const char *default_remote = NULL; 55 - if (!git_config_get_string_tmp("checkout.defaultremote", &default_remote)) 55 + if (!repo_config_get_string_tmp(the_repository, "checkout.defaultremote", &default_remote)) 56 56 cb_data.default_remote = default_remote; 57 57 cb_data.src_ref = xstrfmt("refs/heads/%s", name); 58 58 cb_data.dst_oid = oid;
+1
commit-graph.c
··· 4 4 #include "git-compat-util.h" 5 5 #include "config.h" 6 6 #include "csum-file.h" 7 + #include "environment.h" 7 8 #include "gettext.h" 8 9 #include "hex.h" 9 10 #include "lockfile.h"
+3 -3
compat/precompose_utf8.c
··· 56 56 close(output_fd); 57 57 repo_git_path_replace(the_repository, &path, "%s", auml_nfd); 58 58 precomposed_unicode = access(path.buf, R_OK) ? 0 : 1; 59 - git_config_set("core.precomposeunicode", 60 - precomposed_unicode ? "true" : "false"); 59 + repo_config_set(the_repository, "core.precomposeunicode", 60 + precomposed_unicode ? "true" : "false"); 61 61 repo_git_path_replace(the_repository, &path, "%s", auml_nfc); 62 62 if (unlink(path.buf)) 63 63 die_errno(_("failed to unlink '%s'"), path.buf); ··· 75 75 iconv_t ic_prec; 76 76 char *out; 77 77 if (precomposed_unicode < 0) 78 - git_config_get_bool("core.precomposeunicode", &precomposed_unicode); 78 + repo_config_get_bool(the_repository, "core.precomposeunicode", &precomposed_unicode); 79 79 if (precomposed_unicode != 1) 80 80 return in; 81 81 ic_prec = iconv_open(repo_encoding, path_encoding);
+22 -533
config.c
··· 6 6 * 7 7 */ 8 8 9 - #define USE_THE_REPOSITORY_VARIABLE 10 - #define DISABLE_SIGN_COMPARE_WARNINGS 11 - 12 9 #include "git-compat-util.h" 13 10 #include "abspath.h" 14 - #include "advice.h" 15 11 #include "date.h" 16 12 #include "branch.h" 17 13 #include "config.h" ··· 20 16 #include "environment.h" 21 17 #include "gettext.h" 22 18 #include "git-zlib.h" 23 - #include "ident.h" 24 19 #include "repository.h" 25 20 #include "lockfile.h" 26 - #include "mailmap.h" 27 - #include "attr.h" 28 21 #include "exec-cmd.h" 29 22 #include "strbuf.h" 30 23 #include "quote.h" ··· 32 25 #include "string-list.h" 33 26 #include "object-name.h" 34 27 #include "odb.h" 35 - #include "pager.h" 36 28 #include "path.h" 37 29 #include "utf8.h" 38 30 #include "color.h" ··· 41 33 #include "strvec.h" 42 34 #include "trace2.h" 43 35 #include "wildmatch.h" 44 - #include "ws.h" 45 36 #include "write-or-die.h" 46 37 47 38 struct config_source { ··· 69 60 long (*do_ftell)(struct config_source *c); 70 61 }; 71 62 #define CONFIG_SOURCE_INIT { 0 } 72 - 73 - static int pack_compression_seen; 74 - static int zlib_compression_seen; 75 63 76 64 /* 77 65 * Config that comes from trusted scopes, namely: ··· 207 195 } 208 196 209 197 static int prepare_include_condition_pattern(const struct key_value_info *kvi, 210 - struct strbuf *pat) 198 + struct strbuf *pat, 199 + size_t *out) 211 200 { 212 201 struct strbuf path = STRBUF_INIT; 213 202 char *expanded; 214 - int prefix = 0; 203 + size_t prefix = 0; 215 204 216 205 expanded = interpolate_path(pat->buf, 1); 217 206 if (expanded) { ··· 238 227 239 228 add_trailing_starstar_for_dir(pat); 240 229 230 + *out = prefix; 231 + 241 232 strbuf_release(&path); 242 - return prefix; 233 + return 0; 243 234 } 244 235 245 236 static int include_by_gitdir(const struct key_value_info *kvi, ··· 248 239 { 249 240 struct strbuf text = STRBUF_INIT; 250 241 struct strbuf pattern = STRBUF_INIT; 251 - int ret = 0, prefix; 242 + size_t prefix; 243 + int ret = 0; 252 244 const char *git_dir; 253 245 int already_tried_absolute = 0; 254 246 ··· 259 251 260 252 strbuf_realpath(&text, git_dir, 1); 261 253 strbuf_add(&pattern, cond, cond_len); 262 - prefix = prepare_include_condition_pattern(kvi, &pattern); 254 + ret = prepare_include_condition_pattern(kvi, &pattern, &prefix); 255 + if (ret < 0) 256 + goto done; 263 257 264 258 again: 265 - if (prefix < 0) 266 - goto done; 267 - 268 259 if (prefix > 0) { 269 260 /* 270 261 * perform literal matching on the prefix part so that ··· 732 723 if (env) { 733 724 unsigned long count; 734 725 char *endp; 735 - int i; 736 726 737 727 count = strtoul(env, &endp, 10); 738 728 if (*endp) { ··· 744 734 goto out; 745 735 } 746 736 747 - for (i = 0; i < count; i++) { 737 + for (unsigned long i = 0; i < count; i++) { 748 738 const char *key, *value; 749 739 750 - strbuf_addf(&envvar, "GIT_CONFIG_KEY_%d", i); 740 + strbuf_addf(&envvar, "GIT_CONFIG_KEY_%lu", i); 751 741 key = getenv_safe(&to_free, envvar.buf); 752 742 if (!key) { 753 743 ret = error(_("missing config key %s"), envvar.buf); ··· 755 745 } 756 746 strbuf_reset(&envvar); 757 747 758 - strbuf_addf(&envvar, "GIT_CONFIG_VALUE_%d", i); 748 + strbuf_addf(&envvar, "GIT_CONFIG_VALUE_%lu", i); 759 749 value = getenv_safe(&to_free, envvar.buf); 760 750 if (!value) { 761 751 ret = error(_("missing config value %s"), envvar.buf); ··· 1259 1249 return ret; 1260 1250 } 1261 1251 1262 - static const struct fsync_component_name { 1263 - const char *name; 1264 - enum fsync_component component_bits; 1265 - } fsync_component_names[] = { 1266 - { "loose-object", FSYNC_COMPONENT_LOOSE_OBJECT }, 1267 - { "pack", FSYNC_COMPONENT_PACK }, 1268 - { "pack-metadata", FSYNC_COMPONENT_PACK_METADATA }, 1269 - { "commit-graph", FSYNC_COMPONENT_COMMIT_GRAPH }, 1270 - { "index", FSYNC_COMPONENT_INDEX }, 1271 - { "objects", FSYNC_COMPONENTS_OBJECTS }, 1272 - { "reference", FSYNC_COMPONENT_REFERENCE }, 1273 - { "derived-metadata", FSYNC_COMPONENTS_DERIVED_METADATA }, 1274 - { "committed", FSYNC_COMPONENTS_COMMITTED }, 1275 - { "added", FSYNC_COMPONENTS_ADDED }, 1276 - { "all", FSYNC_COMPONENTS_ALL }, 1277 - }; 1278 - 1279 - static enum fsync_component parse_fsync_components(const char *var, const char *string) 1280 - { 1281 - enum fsync_component current = FSYNC_COMPONENTS_PLATFORM_DEFAULT; 1282 - enum fsync_component positive = 0, negative = 0; 1283 - 1284 - while (string) { 1285 - int i; 1286 - size_t len; 1287 - const char *ep; 1288 - int negated = 0; 1289 - int found = 0; 1290 - 1291 - string = string + strspn(string, ", \t\n\r"); 1292 - ep = strchrnul(string, ','); 1293 - len = ep - string; 1294 - if (!strcmp(string, "none")) { 1295 - current = FSYNC_COMPONENT_NONE; 1296 - goto next_name; 1297 - } 1298 - 1299 - if (*string == '-') { 1300 - negated = 1; 1301 - string++; 1302 - len--; 1303 - if (!len) 1304 - warning(_("invalid value for variable %s"), var); 1305 - } 1306 - 1307 - if (!len) 1308 - break; 1309 - 1310 - for (i = 0; i < ARRAY_SIZE(fsync_component_names); ++i) { 1311 - const struct fsync_component_name *n = &fsync_component_names[i]; 1312 - 1313 - if (strncmp(n->name, string, len)) 1314 - continue; 1315 - 1316 - found = 1; 1317 - if (negated) 1318 - negative |= n->component_bits; 1319 - else 1320 - positive |= n->component_bits; 1321 - } 1322 - 1323 - if (!found) { 1324 - char *component = xstrndup(string, len); 1325 - warning(_("ignoring unknown core.fsync component '%s'"), component); 1326 - free(component); 1327 - } 1328 - 1329 - next_name: 1330 - string = ep; 1331 - } 1332 - 1333 - return (current & ~negative) | positive; 1334 - } 1335 - 1336 1252 int git_config_bool_or_int(const char *name, const char *value, 1337 1253 const struct key_value_info *kvi, int *is_bool) 1338 1254 { ··· 1390 1306 return 0; 1391 1307 } 1392 1308 1393 - static int git_default_core_config(const char *var, const char *value, 1394 - const struct config_context *ctx, void *cb) 1395 - { 1396 - /* This needs a better name */ 1397 - if (!strcmp(var, "core.filemode")) { 1398 - trust_executable_bit = git_config_bool(var, value); 1399 - return 0; 1400 - } 1401 - if (!strcmp(var, "core.trustctime")) { 1402 - trust_ctime = git_config_bool(var, value); 1403 - return 0; 1404 - } 1405 - if (!strcmp(var, "core.checkstat")) { 1406 - if (!value) 1407 - return config_error_nonbool(var); 1408 - if (!strcasecmp(value, "default")) 1409 - check_stat = 1; 1410 - else if (!strcasecmp(value, "minimal")) 1411 - check_stat = 0; 1412 - else 1413 - return error(_("invalid value for '%s': '%s'"), 1414 - var, value); 1415 - } 1416 - 1417 - if (!strcmp(var, "core.quotepath")) { 1418 - quote_path_fully = git_config_bool(var, value); 1419 - return 0; 1420 - } 1421 - 1422 - if (!strcmp(var, "core.symlinks")) { 1423 - has_symlinks = git_config_bool(var, value); 1424 - return 0; 1425 - } 1426 - 1427 - if (!strcmp(var, "core.ignorecase")) { 1428 - ignore_case = git_config_bool(var, value); 1429 - return 0; 1430 - } 1431 - 1432 - if (!strcmp(var, "core.attributesfile")) { 1433 - FREE_AND_NULL(git_attributes_file); 1434 - return git_config_pathname(&git_attributes_file, var, value); 1435 - } 1436 - 1437 - if (!strcmp(var, "core.bare")) { 1438 - is_bare_repository_cfg = git_config_bool(var, value); 1439 - return 0; 1440 - } 1441 - 1442 - if (!strcmp(var, "core.ignorestat")) { 1443 - assume_unchanged = git_config_bool(var, value); 1444 - return 0; 1445 - } 1446 - 1447 - if (!strcmp(var, "core.abbrev")) { 1448 - if (!value) 1449 - return config_error_nonbool(var); 1450 - if (!strcasecmp(value, "auto")) 1451 - default_abbrev = -1; 1452 - else if (!git_parse_maybe_bool_text(value)) 1453 - default_abbrev = GIT_MAX_HEXSZ; 1454 - else { 1455 - int abbrev = git_config_int(var, value, ctx->kvi); 1456 - if (abbrev < minimum_abbrev) 1457 - return error(_("abbrev length out of range: %d"), abbrev); 1458 - default_abbrev = abbrev; 1459 - } 1460 - return 0; 1461 - } 1462 - 1463 - if (!strcmp(var, "core.disambiguate")) 1464 - return set_disambiguate_hint_config(var, value); 1465 - 1466 - if (!strcmp(var, "core.loosecompression")) { 1467 - int level = git_config_int(var, value, ctx->kvi); 1468 - if (level == -1) 1469 - level = Z_DEFAULT_COMPRESSION; 1470 - else if (level < 0 || level > Z_BEST_COMPRESSION) 1471 - die(_("bad zlib compression level %d"), level); 1472 - zlib_compression_level = level; 1473 - zlib_compression_seen = 1; 1474 - return 0; 1475 - } 1476 - 1477 - if (!strcmp(var, "core.compression")) { 1478 - int level = git_config_int(var, value, ctx->kvi); 1479 - if (level == -1) 1480 - level = Z_DEFAULT_COMPRESSION; 1481 - else if (level < 0 || level > Z_BEST_COMPRESSION) 1482 - die(_("bad zlib compression level %d"), level); 1483 - if (!zlib_compression_seen) 1484 - zlib_compression_level = level; 1485 - if (!pack_compression_seen) 1486 - pack_compression_level = level; 1487 - return 0; 1488 - } 1489 - 1490 - if (!strcmp(var, "core.autocrlf")) { 1491 - if (value && !strcasecmp(value, "input")) { 1492 - auto_crlf = AUTO_CRLF_INPUT; 1493 - return 0; 1494 - } 1495 - auto_crlf = git_config_bool(var, value); 1496 - return 0; 1497 - } 1498 - 1499 - if (!strcmp(var, "core.safecrlf")) { 1500 - int eol_rndtrp_die; 1501 - if (value && !strcasecmp(value, "warn")) { 1502 - global_conv_flags_eol = CONV_EOL_RNDTRP_WARN; 1503 - return 0; 1504 - } 1505 - eol_rndtrp_die = git_config_bool(var, value); 1506 - global_conv_flags_eol = eol_rndtrp_die ? 1507 - CONV_EOL_RNDTRP_DIE : 0; 1508 - return 0; 1509 - } 1510 - 1511 - if (!strcmp(var, "core.eol")) { 1512 - if (value && !strcasecmp(value, "lf")) 1513 - core_eol = EOL_LF; 1514 - else if (value && !strcasecmp(value, "crlf")) 1515 - core_eol = EOL_CRLF; 1516 - else if (value && !strcasecmp(value, "native")) 1517 - core_eol = EOL_NATIVE; 1518 - else 1519 - core_eol = EOL_UNSET; 1520 - return 0; 1521 - } 1522 - 1523 - if (!strcmp(var, "core.checkroundtripencoding")) { 1524 - FREE_AND_NULL(check_roundtrip_encoding); 1525 - return git_config_string(&check_roundtrip_encoding, var, value); 1526 - } 1527 - 1528 - if (!strcmp(var, "core.editor")) { 1529 - FREE_AND_NULL(editor_program); 1530 - return git_config_string(&editor_program, var, value); 1531 - } 1532 - 1533 - if (!strcmp(var, "core.commentchar") || 1534 - !strcmp(var, "core.commentstring")) { 1535 - if (!value) 1536 - return config_error_nonbool(var); 1537 - else if (!strcasecmp(value, "auto")) { 1538 - auto_comment_line_char = 1; 1539 - FREE_AND_NULL(comment_line_str_to_free); 1540 - comment_line_str = "#"; 1541 - } else if (value[0]) { 1542 - if (strchr(value, '\n')) 1543 - return error(_("%s cannot contain newline"), var); 1544 - comment_line_str = value; 1545 - FREE_AND_NULL(comment_line_str_to_free); 1546 - auto_comment_line_char = 0; 1547 - } else 1548 - return error(_("%s must have at least one character"), var); 1549 - return 0; 1550 - } 1551 - 1552 - if (!strcmp(var, "core.askpass")) { 1553 - FREE_AND_NULL(askpass_program); 1554 - return git_config_string(&askpass_program, var, value); 1555 - } 1556 - 1557 - if (!strcmp(var, "core.excludesfile")) { 1558 - FREE_AND_NULL(excludes_file); 1559 - return git_config_pathname(&excludes_file, var, value); 1560 - } 1561 - 1562 - if (!strcmp(var, "core.whitespace")) { 1563 - if (!value) 1564 - return config_error_nonbool(var); 1565 - whitespace_rule_cfg = parse_whitespace_rule(value); 1566 - return 0; 1567 - } 1568 - 1569 - if (!strcmp(var, "core.fsync")) { 1570 - if (!value) 1571 - return config_error_nonbool(var); 1572 - fsync_components = parse_fsync_components(var, value); 1573 - return 0; 1574 - } 1575 - 1576 - if (!strcmp(var, "core.fsyncmethod")) { 1577 - if (!value) 1578 - return config_error_nonbool(var); 1579 - if (!strcmp(value, "fsync")) 1580 - fsync_method = FSYNC_METHOD_FSYNC; 1581 - else if (!strcmp(value, "writeout-only")) 1582 - fsync_method = FSYNC_METHOD_WRITEOUT_ONLY; 1583 - else if (!strcmp(value, "batch")) 1584 - fsync_method = FSYNC_METHOD_BATCH; 1585 - else 1586 - warning(_("ignoring unknown core.fsyncMethod value '%s'"), value); 1587 - 1588 - } 1589 - 1590 - if (!strcmp(var, "core.fsyncobjectfiles")) { 1591 - if (fsync_object_files < 0) 1592 - warning(_("core.fsyncObjectFiles is deprecated; use core.fsync instead")); 1593 - fsync_object_files = git_config_bool(var, value); 1594 - return 0; 1595 - } 1596 - 1597 - if (!strcmp(var, "core.createobject")) { 1598 - if (!value) 1599 - return config_error_nonbool(var); 1600 - if (!strcmp(value, "rename")) 1601 - object_creation_mode = OBJECT_CREATION_USES_RENAMES; 1602 - else if (!strcmp(value, "link")) 1603 - object_creation_mode = OBJECT_CREATION_USES_HARDLINKS; 1604 - else 1605 - die(_("invalid mode for object creation: %s"), value); 1606 - return 0; 1607 - } 1608 - 1609 - if (!strcmp(var, "core.sparsecheckout")) { 1610 - core_apply_sparse_checkout = git_config_bool(var, value); 1611 - return 0; 1612 - } 1613 - 1614 - if (!strcmp(var, "core.sparsecheckoutcone")) { 1615 - core_sparse_checkout_cone = git_config_bool(var, value); 1616 - return 0; 1617 - } 1618 - 1619 - if (!strcmp(var, "core.precomposeunicode")) { 1620 - precomposed_unicode = git_config_bool(var, value); 1621 - return 0; 1622 - } 1623 - 1624 - if (!strcmp(var, "core.protecthfs")) { 1625 - protect_hfs = git_config_bool(var, value); 1626 - return 0; 1627 - } 1628 - 1629 - if (!strcmp(var, "core.protectntfs")) { 1630 - protect_ntfs = git_config_bool(var, value); 1631 - return 0; 1632 - } 1633 - 1634 - if (!strcmp(var, "core.maxtreedepth")) { 1635 - max_allowed_tree_depth = git_config_int(var, value, ctx->kvi); 1636 - return 0; 1637 - } 1638 - 1639 - /* Add other config variables here and to Documentation/config.adoc. */ 1640 - return platform_core_config(var, value, ctx, cb); 1641 - } 1642 - 1643 - static int git_default_sparse_config(const char *var, const char *value) 1644 - { 1645 - if (!strcmp(var, "sparse.expectfilesoutsideofpatterns")) { 1646 - sparse_expect_files_outside_of_patterns = git_config_bool(var, value); 1647 - return 0; 1648 - } 1649 - 1650 - /* Add other config variables here and to Documentation/config/sparse.adoc. */ 1651 - return 0; 1652 - } 1653 - 1654 - static int git_default_i18n_config(const char *var, const char *value) 1655 - { 1656 - if (!strcmp(var, "i18n.commitencoding")) { 1657 - FREE_AND_NULL(git_commit_encoding); 1658 - return git_config_string(&git_commit_encoding, var, value); 1659 - } 1660 - 1661 - if (!strcmp(var, "i18n.logoutputencoding")) { 1662 - FREE_AND_NULL(git_log_output_encoding); 1663 - return git_config_string(&git_log_output_encoding, var, value); 1664 - } 1665 - 1666 - /* Add other config variables here and to Documentation/config.adoc. */ 1667 - return 0; 1668 - } 1669 - 1670 - static int git_default_branch_config(const char *var, const char *value) 1671 - { 1672 - if (!strcmp(var, "branch.autosetupmerge")) { 1673 - if (value && !strcmp(value, "always")) { 1674 - git_branch_track = BRANCH_TRACK_ALWAYS; 1675 - return 0; 1676 - } else if (value && !strcmp(value, "inherit")) { 1677 - git_branch_track = BRANCH_TRACK_INHERIT; 1678 - return 0; 1679 - } else if (value && !strcmp(value, "simple")) { 1680 - git_branch_track = BRANCH_TRACK_SIMPLE; 1681 - return 0; 1682 - } 1683 - git_branch_track = git_config_bool(var, value); 1684 - return 0; 1685 - } 1686 - if (!strcmp(var, "branch.autosetuprebase")) { 1687 - if (!value) 1688 - return config_error_nonbool(var); 1689 - else if (!strcmp(value, "never")) 1690 - autorebase = AUTOREBASE_NEVER; 1691 - else if (!strcmp(value, "local")) 1692 - autorebase = AUTOREBASE_LOCAL; 1693 - else if (!strcmp(value, "remote")) 1694 - autorebase = AUTOREBASE_REMOTE; 1695 - else if (!strcmp(value, "always")) 1696 - autorebase = AUTOREBASE_ALWAYS; 1697 - else 1698 - return error(_("malformed value for %s"), var); 1699 - return 0; 1700 - } 1701 - 1702 - /* Add other config variables here and to Documentation/config.adoc. */ 1703 - return 0; 1704 - } 1705 - 1706 - static int git_default_push_config(const char *var, const char *value) 1707 - { 1708 - if (!strcmp(var, "push.default")) { 1709 - if (!value) 1710 - return config_error_nonbool(var); 1711 - else if (!strcmp(value, "nothing")) 1712 - push_default = PUSH_DEFAULT_NOTHING; 1713 - else if (!strcmp(value, "matching")) 1714 - push_default = PUSH_DEFAULT_MATCHING; 1715 - else if (!strcmp(value, "simple")) 1716 - push_default = PUSH_DEFAULT_SIMPLE; 1717 - else if (!strcmp(value, "upstream")) 1718 - push_default = PUSH_DEFAULT_UPSTREAM; 1719 - else if (!strcmp(value, "tracking")) /* deprecated */ 1720 - push_default = PUSH_DEFAULT_UPSTREAM; 1721 - else if (!strcmp(value, "current")) 1722 - push_default = PUSH_DEFAULT_CURRENT; 1723 - else { 1724 - error(_("malformed value for %s: %s"), var, value); 1725 - return error(_("must be one of nothing, matching, simple, " 1726 - "upstream or current")); 1727 - } 1728 - return 0; 1729 - } 1730 - 1731 - /* Add other config variables here and to Documentation/config.adoc. */ 1732 - return 0; 1733 - } 1734 - 1735 - static int git_default_mailmap_config(const char *var, const char *value) 1736 - { 1737 - if (!strcmp(var, "mailmap.file")) { 1738 - FREE_AND_NULL(git_mailmap_file); 1739 - return git_config_pathname(&git_mailmap_file, var, value); 1740 - } 1741 - 1742 - if (!strcmp(var, "mailmap.blob")) { 1743 - FREE_AND_NULL(git_mailmap_blob); 1744 - return git_config_string(&git_mailmap_blob, var, value); 1745 - } 1746 - 1747 - /* Add other config variables here and to Documentation/config.adoc. */ 1748 - return 0; 1749 - } 1750 - 1751 - static int git_default_attr_config(const char *var, const char *value) 1752 - { 1753 - if (!strcmp(var, "attr.tree")) { 1754 - FREE_AND_NULL(git_attr_tree); 1755 - return git_config_string(&git_attr_tree, var, value); 1756 - } 1757 - 1758 - /* 1759 - * Add other attribute related config variables here and to 1760 - * Documentation/config/attr.adoc. 1761 - */ 1762 - return 0; 1763 - } 1764 - 1765 - int git_default_config(const char *var, const char *value, 1766 - const struct config_context *ctx, void *cb) 1767 - { 1768 - if (starts_with(var, "core.")) 1769 - return git_default_core_config(var, value, ctx, cb); 1770 - 1771 - if (starts_with(var, "user.") || 1772 - starts_with(var, "author.") || 1773 - starts_with(var, "committer.")) 1774 - return git_ident_config(var, value, ctx, cb); 1775 - 1776 - if (starts_with(var, "i18n.")) 1777 - return git_default_i18n_config(var, value); 1778 - 1779 - if (starts_with(var, "branch.")) 1780 - return git_default_branch_config(var, value); 1781 - 1782 - if (starts_with(var, "push.")) 1783 - return git_default_push_config(var, value); 1784 - 1785 - if (starts_with(var, "mailmap.")) 1786 - return git_default_mailmap_config(var, value); 1787 - 1788 - if (starts_with(var, "attr.")) 1789 - return git_default_attr_config(var, value); 1790 - 1791 - if (starts_with(var, "advice.") || starts_with(var, "color.advice")) 1792 - return git_default_advice_config(var, value); 1793 - 1794 - if (!strcmp(var, "pager.color") || !strcmp(var, "color.pager")) { 1795 - pager_use_color = git_config_bool(var,value); 1796 - return 0; 1797 - } 1798 - 1799 - if (!strcmp(var, "pack.packsizelimit")) { 1800 - pack_size_limit_cfg = git_config_ulong(var, value, ctx->kvi); 1801 - return 0; 1802 - } 1803 - 1804 - if (!strcmp(var, "pack.compression")) { 1805 - int level = git_config_int(var, value, ctx->kvi); 1806 - if (level == -1) 1807 - level = Z_DEFAULT_COMPRESSION; 1808 - else if (level < 0 || level > Z_BEST_COMPRESSION) 1809 - die(_("bad pack compression level %d"), level); 1810 - pack_compression_level = level; 1811 - pack_compression_seen = 1; 1812 - return 0; 1813 - } 1814 - 1815 - if (starts_with(var, "sparse.")) 1816 - return git_default_sparse_config(var, value); 1817 - 1818 - /* Add other config variables here and to Documentation/config.adoc. */ 1819 - return 0; 1820 - } 1821 - 1822 1309 /* 1823 1310 * All source specific fields in the union, die_on_error, name and the callbacks 1824 1311 * fgetc, ungetc, ftell of top need to be initialized before calling ··· 2125 1612 2126 1613 static void configset_iter(struct config_set *set, config_fn_t fn, void *data) 2127 1614 { 2128 - int i, value_index; 1615 + int value_index; 2129 1616 struct string_list *values; 2130 1617 struct config_set_element *entry; 2131 1618 struct configset_list *list = &set->list; 2132 1619 struct config_context ctx = CONFIG_CONTEXT_INIT; 2133 1620 2134 - for (i = 0; i < list->nr; i++) { 1621 + for (size_t i = 0; i < list->nr; i++) { 2135 1622 entry = list->items[i].e; 2136 1623 value_index = list->items[i].value_index; 2137 1624 values = &entry->value_list; ··· 2748 2235 } 2749 2236 2750 2237 /* 2751 - * Find all the stuff for git_config_set() below. 2238 + * Find all the stuff for repo_config_set() below. 2752 2239 */ 2753 2240 2754 2241 struct config_store_data { ··· 2981 2468 */ 2982 2469 static void maybe_remove_section(struct config_store_data *store, 2983 2470 size_t *begin_offset, size_t *end_offset, 2984 - int *seen_ptr) 2471 + unsigned *seen_ptr) 2985 2472 { 2986 2473 size_t begin; 2987 - int i, seen, section_seen = 0; 2474 + int section_seen = 0; 2475 + unsigned int i, seen; 2988 2476 2989 2477 /* 2990 2478 * First, ensure that this is the first key, and that there are no ··· 3227 2715 } else { 3228 2716 struct stat st; 3229 2717 size_t copy_begin, copy_end; 3230 - int i, new_line = 0; 2718 + unsigned i; 2719 + int new_line = 0; 3231 2720 struct config_options opts; 3232 2721 3233 2722 if (!value_pattern)
-139
config.h
··· 163 163 typedef int (*config_fn_t)(const char *, const char *, 164 164 const struct config_context *, void *); 165 165 166 - int git_default_config(const char *, const char *, 167 - const struct config_context *, void *); 168 - 169 166 /** 170 167 * Read a specific file in git-config format. 171 168 * This function takes the same callback and data parameters as `repo_config`. ··· 715 712 #define LOOKUP_CONFIG(mapping, var) \ 716 713 lookup_config(mapping, ARRAY_SIZE(mapping), var) 717 714 int lookup_config(const char **mapping, int nr_mapping, const char *var); 718 - 719 - # ifdef USE_THE_REPOSITORY_VARIABLE 720 - static inline void git_config(config_fn_t fn, void *data) 721 - { 722 - repo_config(the_repository, fn, data); 723 - } 724 - 725 - static inline void git_config_clear(void) 726 - { 727 - repo_config_clear(the_repository); 728 - } 729 - 730 - static inline int git_config_get(const char *key) 731 - { 732 - return repo_config_get(the_repository, key); 733 - } 734 - 735 - static inline int git_config_get_value(const char *key, const char **value) 736 - { 737 - return repo_config_get_value(the_repository, key, value); 738 - } 739 - 740 - static inline int git_config_get_value_multi(const char *key, const struct string_list **dest) 741 - { 742 - return repo_config_get_value_multi(the_repository, key, dest); 743 - } 744 - 745 - static inline int git_config_get_string_multi(const char *key, 746 - const struct string_list **dest) 747 - { 748 - return repo_config_get_string_multi(the_repository, key, dest); 749 - } 750 - 751 - static inline int git_config_get_string(const char *key, char **dest) 752 - { 753 - return repo_config_get_string(the_repository, key, dest); 754 - } 755 - 756 - static inline int git_config_get_string_tmp(const char *key, const char **dest) 757 - { 758 - return repo_config_get_string_tmp(the_repository, key, dest); 759 - } 760 - 761 - static inline int git_config_get_int(const char *key, int *dest) 762 - { 763 - return repo_config_get_int(the_repository, key, dest); 764 - } 765 - 766 - static inline int git_config_get_ulong(const char *key, unsigned long *dest) 767 - { 768 - return repo_config_get_ulong(the_repository, key, dest); 769 - } 770 - 771 - static inline int git_config_get_bool(const char *key, int *dest) 772 - { 773 - return repo_config_get_bool(the_repository, key, dest); 774 - } 775 - 776 - static inline int git_config_get_bool_or_int(const char *key, int *is_bool, int *dest) 777 - { 778 - return repo_config_get_bool_or_int(the_repository, key, is_bool, dest); 779 - } 780 - 781 - static inline int git_config_get_maybe_bool(const char *key, int *dest) 782 - { 783 - return repo_config_get_maybe_bool(the_repository, key, dest); 784 - } 785 - 786 - static inline int git_config_get_pathname(const char *key, char **dest) 787 - { 788 - return repo_config_get_pathname(the_repository, key, dest); 789 - } 790 - 791 - static inline void git_config_set_in_file(const char *config_filename, 792 - const char *key, const char *value) 793 - { 794 - repo_config_set_in_file(the_repository, config_filename, key, value); 795 - } 796 - 797 - static inline int git_config_set_gently(const char *key, const char *value) 798 - { 799 - return repo_config_set_gently(the_repository, key, value); 800 - } 801 - 802 - static inline void git_config_set(const char *key, const char *value) 803 - { 804 - repo_config_set(the_repository, key, value); 805 - } 806 - 807 - static inline int git_config_set_in_file_gently( 808 - const char *config_filename, 809 - const char *key, 810 - const char *comment, 811 - const char *value) 812 - { 813 - return repo_config_set_in_file_gently(the_repository, config_filename, 814 - key, comment, value); 815 - } 816 - 817 - static inline int git_config_set_multivar_in_file_gently( 818 - const char *config_filename, 819 - const char *key, const char *value, 820 - const char *value_pattern, 821 - const char *comment, 822 - unsigned flags) 823 - { 824 - return repo_config_set_multivar_in_file_gently(the_repository, config_filename, 825 - key, value, value_pattern, 826 - comment, flags); 827 - } 828 - 829 - static inline void git_config_set_multivar_in_file( 830 - const char *config_filename, 831 - const char *key, 832 - const char *value, 833 - const char *value_pattern, 834 - unsigned flags) 835 - { 836 - repo_config_set_multivar_in_file(the_repository, config_filename, 837 - key, value, value_pattern, flags); 838 - } 839 - 840 - static inline int git_config_set_multivar_gently(const char *key, const char *value, 841 - const char *value_pattern, unsigned flags) 842 - { 843 - return repo_config_set_multivar_gently(the_repository, key, value, 844 - value_pattern, flags); 845 - } 846 - 847 - static inline void git_config_set_multivar(const char *key, const char *value, 848 - const char *value_pattern, unsigned flags) 849 - { 850 - repo_config_set_multivar(the_repository, key, value, 851 - value_pattern, flags); 852 - } 853 - # endif /* USE_THE_REPOSITORY_VARIABLE */ 854 715 855 716 #endif /* CONFIG_H */
+3 -3
connect.c
··· 1028 1028 static int git_use_proxy(const char *host) 1029 1029 { 1030 1030 git_proxy_command = getenv("GIT_PROXY_COMMAND"); 1031 - git_config(git_proxy_command_options, (void*)host); 1031 + repo_config(the_repository, git_proxy_command_options, (void*)host); 1032 1032 return (git_proxy_command && *git_proxy_command); 1033 1033 } 1034 1034 ··· 1154 1154 if ((ssh = getenv("GIT_SSH_COMMAND"))) 1155 1155 return ssh; 1156 1156 1157 - if (!git_config_get_string_tmp("core.sshcommand", &ssh)) 1157 + if (!repo_config_get_string_tmp(the_repository, "core.sshcommand", &ssh)) 1158 1158 return ssh; 1159 1159 1160 1160 return NULL; ··· 1173 1173 { 1174 1174 const char *variant = getenv("GIT_SSH_VARIANT"); 1175 1175 1176 - if (!variant && git_config_get_string_tmp("ssh.variant", &variant)) 1176 + if (!variant && repo_config_get_string_tmp(the_repository, "ssh.variant", &variant)) 1177 1177 return; 1178 1178 1179 1179 if (!strcmp(variant, "auto"))
+1 -1
contrib/coccinelle/config_fn_ctx.pending.cocci
··· 83 83 84 84 85 85 // The previous rules don't catch all callbacks, especially if they're defined 86 - // in a separate file from the git_config() call. Fix these manually. 86 + // in a separate file from the repo_config() call. Fix these manually. 87 87 @@ 88 88 identifier C1, C2, D; 89 89 attribute name UNUSED;
+1 -1
convert.c
··· 1326 1326 "eol", "text", "working-tree-encoding", 1327 1327 NULL); 1328 1328 user_convert_tail = &user_convert; 1329 - git_config(read_convert_config, NULL); 1329 + repo_config(the_repository, read_convert_config, NULL); 1330 1330 } 1331 1331 1332 1332 git_check_attr(istate, path, check);
+1 -1
daemon.c
··· 402 402 403 403 if (service->overridable) { 404 404 strbuf_addf(&var, "daemon.%s", service->config_name); 405 - git_config_get_bool(var.buf, &enabled); 405 + repo_config_get_bool(the_repository, var.buf, &enabled); 406 406 strbuf_release(&var); 407 407 } 408 408 if (!enabled) {
+2 -2
dir.c
··· 4091 4091 write_file(gitfile_sb.buf, "gitdir: %s", 4092 4092 relative_path(git_dir, work_tree, &rel_path)); 4093 4093 /* Update core.worktree setting */ 4094 - git_config_set_in_file(cfg_sb.buf, "core.worktree", 4095 - relative_path(work_tree, git_dir, &rel_path)); 4094 + repo_config_set_in_file(the_repository, cfg_sb.buf, "core.worktree", 4095 + relative_path(work_tree, git_dir, &rel_path)); 4096 4096 4097 4097 strbuf_release(&gitfile_sb); 4098 4098 strbuf_release(&cfg_sb);
+1 -1
editor.c
··· 50 50 const char *editor = getenv("GIT_SEQUENCE_EDITOR"); 51 51 52 52 if (!editor) 53 - git_config_get_string_tmp("sequence.editor", &editor); 53 + repo_config_get_string_tmp(the_repository, "sequence.editor", &editor); 54 54 if (!editor) 55 55 editor = git_editor(); 56 56
+512
environment.c
··· 12 12 13 13 #include "git-compat-util.h" 14 14 #include "abspath.h" 15 + #include "advice.h" 16 + #include "attr.h" 15 17 #include "branch.h" 18 + #include "color.h" 16 19 #include "convert.h" 17 20 #include "environment.h" 18 21 #include "gettext.h" 19 22 #include "git-zlib.h" 23 + #include "ident.h" 24 + #include "mailmap.h" 25 + #include "object-name.h" 20 26 #include "repository.h" 21 27 #include "config.h" 22 28 #include "refs.h" 23 29 #include "fmt-merge-msg.h" 24 30 #include "commit.h" 25 31 #include "strvec.h" 32 + #include "pager.h" 26 33 #include "path.h" 34 + #include "quote.h" 27 35 #include "chdir-notify.h" 28 36 #include "setup.h" 37 + #include "ws.h" 29 38 #include "write-or-die.h" 39 + 40 + static int pack_compression_seen; 41 + static int zlib_compression_seen; 30 42 31 43 int trust_executable_bit = 1; 32 44 int trust_ctime = 1; ··· 231 243 } 232 244 return cached_result; 233 245 } 246 + 247 + static const struct fsync_component_name { 248 + const char *name; 249 + enum fsync_component component_bits; 250 + } fsync_component_names[] = { 251 + { "loose-object", FSYNC_COMPONENT_LOOSE_OBJECT }, 252 + { "pack", FSYNC_COMPONENT_PACK }, 253 + { "pack-metadata", FSYNC_COMPONENT_PACK_METADATA }, 254 + { "commit-graph", FSYNC_COMPONENT_COMMIT_GRAPH }, 255 + { "index", FSYNC_COMPONENT_INDEX }, 256 + { "objects", FSYNC_COMPONENTS_OBJECTS }, 257 + { "reference", FSYNC_COMPONENT_REFERENCE }, 258 + { "derived-metadata", FSYNC_COMPONENTS_DERIVED_METADATA }, 259 + { "committed", FSYNC_COMPONENTS_COMMITTED }, 260 + { "added", FSYNC_COMPONENTS_ADDED }, 261 + { "all", FSYNC_COMPONENTS_ALL }, 262 + }; 263 + 264 + static enum fsync_component parse_fsync_components(const char *var, const char *string) 265 + { 266 + enum fsync_component current = FSYNC_COMPONENTS_PLATFORM_DEFAULT; 267 + enum fsync_component positive = 0, negative = 0; 268 + 269 + while (string) { 270 + size_t len; 271 + const char *ep; 272 + int negated = 0; 273 + int found = 0; 274 + 275 + string = string + strspn(string, ", \t\n\r"); 276 + ep = strchrnul(string, ','); 277 + len = ep - string; 278 + if (!strcmp(string, "none")) { 279 + current = FSYNC_COMPONENT_NONE; 280 + goto next_name; 281 + } 282 + 283 + if (*string == '-') { 284 + negated = 1; 285 + string++; 286 + len--; 287 + if (!len) 288 + warning(_("invalid value for variable %s"), var); 289 + } 290 + 291 + if (!len) 292 + break; 293 + 294 + for (size_t i = 0; i < ARRAY_SIZE(fsync_component_names); ++i) { 295 + const struct fsync_component_name *n = &fsync_component_names[i]; 296 + 297 + if (strncmp(n->name, string, len)) 298 + continue; 299 + 300 + found = 1; 301 + if (negated) 302 + negative |= n->component_bits; 303 + else 304 + positive |= n->component_bits; 305 + } 306 + 307 + if (!found) { 308 + char *component = xstrndup(string, len); 309 + warning(_("ignoring unknown core.fsync component '%s'"), component); 310 + free(component); 311 + } 312 + 313 + next_name: 314 + string = ep; 315 + } 316 + 317 + return (current & ~negative) | positive; 318 + } 319 + 320 + static int git_default_core_config(const char *var, const char *value, 321 + const struct config_context *ctx, void *cb) 322 + { 323 + /* This needs a better name */ 324 + if (!strcmp(var, "core.filemode")) { 325 + trust_executable_bit = git_config_bool(var, value); 326 + return 0; 327 + } 328 + if (!strcmp(var, "core.trustctime")) { 329 + trust_ctime = git_config_bool(var, value); 330 + return 0; 331 + } 332 + if (!strcmp(var, "core.checkstat")) { 333 + if (!value) 334 + return config_error_nonbool(var); 335 + if (!strcasecmp(value, "default")) 336 + check_stat = 1; 337 + else if (!strcasecmp(value, "minimal")) 338 + check_stat = 0; 339 + else 340 + return error(_("invalid value for '%s': '%s'"), 341 + var, value); 342 + } 343 + 344 + if (!strcmp(var, "core.quotepath")) { 345 + quote_path_fully = git_config_bool(var, value); 346 + return 0; 347 + } 348 + 349 + if (!strcmp(var, "core.symlinks")) { 350 + has_symlinks = git_config_bool(var, value); 351 + return 0; 352 + } 353 + 354 + if (!strcmp(var, "core.ignorecase")) { 355 + ignore_case = git_config_bool(var, value); 356 + return 0; 357 + } 358 + 359 + if (!strcmp(var, "core.attributesfile")) { 360 + FREE_AND_NULL(git_attributes_file); 361 + return git_config_pathname(&git_attributes_file, var, value); 362 + } 363 + 364 + if (!strcmp(var, "core.bare")) { 365 + is_bare_repository_cfg = git_config_bool(var, value); 366 + return 0; 367 + } 368 + 369 + if (!strcmp(var, "core.ignorestat")) { 370 + assume_unchanged = git_config_bool(var, value); 371 + return 0; 372 + } 373 + 374 + if (!strcmp(var, "core.abbrev")) { 375 + if (!value) 376 + return config_error_nonbool(var); 377 + if (!strcasecmp(value, "auto")) 378 + default_abbrev = -1; 379 + else if (!git_parse_maybe_bool_text(value)) 380 + default_abbrev = GIT_MAX_HEXSZ; 381 + else { 382 + int abbrev = git_config_int(var, value, ctx->kvi); 383 + if (abbrev < minimum_abbrev) 384 + return error(_("abbrev length out of range: %d"), abbrev); 385 + default_abbrev = abbrev; 386 + } 387 + return 0; 388 + } 389 + 390 + if (!strcmp(var, "core.disambiguate")) 391 + return set_disambiguate_hint_config(var, value); 392 + 393 + if (!strcmp(var, "core.loosecompression")) { 394 + int level = git_config_int(var, value, ctx->kvi); 395 + if (level == -1) 396 + level = Z_DEFAULT_COMPRESSION; 397 + else if (level < 0 || level > Z_BEST_COMPRESSION) 398 + die(_("bad zlib compression level %d"), level); 399 + zlib_compression_level = level; 400 + zlib_compression_seen = 1; 401 + return 0; 402 + } 403 + 404 + if (!strcmp(var, "core.compression")) { 405 + int level = git_config_int(var, value, ctx->kvi); 406 + if (level == -1) 407 + level = Z_DEFAULT_COMPRESSION; 408 + else if (level < 0 || level > Z_BEST_COMPRESSION) 409 + die(_("bad zlib compression level %d"), level); 410 + if (!zlib_compression_seen) 411 + zlib_compression_level = level; 412 + if (!pack_compression_seen) 413 + pack_compression_level = level; 414 + return 0; 415 + } 416 + 417 + if (!strcmp(var, "core.autocrlf")) { 418 + if (value && !strcasecmp(value, "input")) { 419 + auto_crlf = AUTO_CRLF_INPUT; 420 + return 0; 421 + } 422 + auto_crlf = git_config_bool(var, value); 423 + return 0; 424 + } 425 + 426 + if (!strcmp(var, "core.safecrlf")) { 427 + int eol_rndtrp_die; 428 + if (value && !strcasecmp(value, "warn")) { 429 + global_conv_flags_eol = CONV_EOL_RNDTRP_WARN; 430 + return 0; 431 + } 432 + eol_rndtrp_die = git_config_bool(var, value); 433 + global_conv_flags_eol = eol_rndtrp_die ? 434 + CONV_EOL_RNDTRP_DIE : 0; 435 + return 0; 436 + } 437 + 438 + if (!strcmp(var, "core.eol")) { 439 + if (value && !strcasecmp(value, "lf")) 440 + core_eol = EOL_LF; 441 + else if (value && !strcasecmp(value, "crlf")) 442 + core_eol = EOL_CRLF; 443 + else if (value && !strcasecmp(value, "native")) 444 + core_eol = EOL_NATIVE; 445 + else 446 + core_eol = EOL_UNSET; 447 + return 0; 448 + } 449 + 450 + if (!strcmp(var, "core.checkroundtripencoding")) { 451 + FREE_AND_NULL(check_roundtrip_encoding); 452 + return git_config_string(&check_roundtrip_encoding, var, value); 453 + } 454 + 455 + if (!strcmp(var, "core.editor")) { 456 + FREE_AND_NULL(editor_program); 457 + return git_config_string(&editor_program, var, value); 458 + } 459 + 460 + if (!strcmp(var, "core.commentchar") || 461 + !strcmp(var, "core.commentstring")) { 462 + if (!value) 463 + return config_error_nonbool(var); 464 + else if (!strcasecmp(value, "auto")) 465 + auto_comment_line_char = 1; 466 + else if (value[0]) { 467 + if (strchr(value, '\n')) 468 + return error(_("%s cannot contain newline"), var); 469 + comment_line_str = value; 470 + FREE_AND_NULL(comment_line_str_to_free); 471 + auto_comment_line_char = 0; 472 + } else 473 + return error(_("%s must have at least one character"), var); 474 + return 0; 475 + } 476 + 477 + if (!strcmp(var, "core.askpass")) { 478 + FREE_AND_NULL(askpass_program); 479 + return git_config_string(&askpass_program, var, value); 480 + } 481 + 482 + if (!strcmp(var, "core.excludesfile")) { 483 + FREE_AND_NULL(excludes_file); 484 + return git_config_pathname(&excludes_file, var, value); 485 + } 486 + 487 + if (!strcmp(var, "core.whitespace")) { 488 + if (!value) 489 + return config_error_nonbool(var); 490 + whitespace_rule_cfg = parse_whitespace_rule(value); 491 + return 0; 492 + } 493 + 494 + if (!strcmp(var, "core.fsync")) { 495 + if (!value) 496 + return config_error_nonbool(var); 497 + fsync_components = parse_fsync_components(var, value); 498 + return 0; 499 + } 500 + 501 + if (!strcmp(var, "core.fsyncmethod")) { 502 + if (!value) 503 + return config_error_nonbool(var); 504 + if (!strcmp(value, "fsync")) 505 + fsync_method = FSYNC_METHOD_FSYNC; 506 + else if (!strcmp(value, "writeout-only")) 507 + fsync_method = FSYNC_METHOD_WRITEOUT_ONLY; 508 + else if (!strcmp(value, "batch")) 509 + fsync_method = FSYNC_METHOD_BATCH; 510 + else 511 + warning(_("ignoring unknown core.fsyncMethod value '%s'"), value); 512 + 513 + } 514 + 515 + if (!strcmp(var, "core.fsyncobjectfiles")) { 516 + if (fsync_object_files < 0) 517 + warning(_("core.fsyncObjectFiles is deprecated; use core.fsync instead")); 518 + fsync_object_files = git_config_bool(var, value); 519 + return 0; 520 + } 521 + 522 + if (!strcmp(var, "core.createobject")) { 523 + if (!value) 524 + return config_error_nonbool(var); 525 + if (!strcmp(value, "rename")) 526 + object_creation_mode = OBJECT_CREATION_USES_RENAMES; 527 + else if (!strcmp(value, "link")) 528 + object_creation_mode = OBJECT_CREATION_USES_HARDLINKS; 529 + else 530 + die(_("invalid mode for object creation: %s"), value); 531 + return 0; 532 + } 533 + 534 + if (!strcmp(var, "core.sparsecheckout")) { 535 + core_apply_sparse_checkout = git_config_bool(var, value); 536 + return 0; 537 + } 538 + 539 + if (!strcmp(var, "core.sparsecheckoutcone")) { 540 + core_sparse_checkout_cone = git_config_bool(var, value); 541 + return 0; 542 + } 543 + 544 + if (!strcmp(var, "core.precomposeunicode")) { 545 + precomposed_unicode = git_config_bool(var, value); 546 + return 0; 547 + } 548 + 549 + if (!strcmp(var, "core.protecthfs")) { 550 + protect_hfs = git_config_bool(var, value); 551 + return 0; 552 + } 553 + 554 + if (!strcmp(var, "core.protectntfs")) { 555 + protect_ntfs = git_config_bool(var, value); 556 + return 0; 557 + } 558 + 559 + if (!strcmp(var, "core.maxtreedepth")) { 560 + max_allowed_tree_depth = git_config_int(var, value, ctx->kvi); 561 + return 0; 562 + } 563 + 564 + /* Add other config variables here and to Documentation/config.adoc. */ 565 + return platform_core_config(var, value, ctx, cb); 566 + } 567 + 568 + static int git_default_sparse_config(const char *var, const char *value) 569 + { 570 + if (!strcmp(var, "sparse.expectfilesoutsideofpatterns")) { 571 + sparse_expect_files_outside_of_patterns = git_config_bool(var, value); 572 + return 0; 573 + } 574 + 575 + /* Add other config variables here and to Documentation/config/sparse.adoc. */ 576 + return 0; 577 + } 578 + 579 + static int git_default_i18n_config(const char *var, const char *value) 580 + { 581 + if (!strcmp(var, "i18n.commitencoding")) { 582 + FREE_AND_NULL(git_commit_encoding); 583 + return git_config_string(&git_commit_encoding, var, value); 584 + } 585 + 586 + if (!strcmp(var, "i18n.logoutputencoding")) { 587 + FREE_AND_NULL(git_log_output_encoding); 588 + return git_config_string(&git_log_output_encoding, var, value); 589 + } 590 + 591 + /* Add other config variables here and to Documentation/config.adoc. */ 592 + return 0; 593 + } 594 + 595 + static int git_default_branch_config(const char *var, const char *value) 596 + { 597 + if (!strcmp(var, "branch.autosetupmerge")) { 598 + if (value && !strcmp(value, "always")) { 599 + git_branch_track = BRANCH_TRACK_ALWAYS; 600 + return 0; 601 + } else if (value && !strcmp(value, "inherit")) { 602 + git_branch_track = BRANCH_TRACK_INHERIT; 603 + return 0; 604 + } else if (value && !strcmp(value, "simple")) { 605 + git_branch_track = BRANCH_TRACK_SIMPLE; 606 + return 0; 607 + } 608 + git_branch_track = git_config_bool(var, value); 609 + return 0; 610 + } 611 + if (!strcmp(var, "branch.autosetuprebase")) { 612 + if (!value) 613 + return config_error_nonbool(var); 614 + else if (!strcmp(value, "never")) 615 + autorebase = AUTOREBASE_NEVER; 616 + else if (!strcmp(value, "local")) 617 + autorebase = AUTOREBASE_LOCAL; 618 + else if (!strcmp(value, "remote")) 619 + autorebase = AUTOREBASE_REMOTE; 620 + else if (!strcmp(value, "always")) 621 + autorebase = AUTOREBASE_ALWAYS; 622 + else 623 + return error(_("malformed value for %s"), var); 624 + return 0; 625 + } 626 + 627 + /* Add other config variables here and to Documentation/config.adoc. */ 628 + return 0; 629 + } 630 + 631 + static int git_default_push_config(const char *var, const char *value) 632 + { 633 + if (!strcmp(var, "push.default")) { 634 + if (!value) 635 + return config_error_nonbool(var); 636 + else if (!strcmp(value, "nothing")) 637 + push_default = PUSH_DEFAULT_NOTHING; 638 + else if (!strcmp(value, "matching")) 639 + push_default = PUSH_DEFAULT_MATCHING; 640 + else if (!strcmp(value, "simple")) 641 + push_default = PUSH_DEFAULT_SIMPLE; 642 + else if (!strcmp(value, "upstream")) 643 + push_default = PUSH_DEFAULT_UPSTREAM; 644 + else if (!strcmp(value, "tracking")) /* deprecated */ 645 + push_default = PUSH_DEFAULT_UPSTREAM; 646 + else if (!strcmp(value, "current")) 647 + push_default = PUSH_DEFAULT_CURRENT; 648 + else { 649 + error(_("malformed value for %s: %s"), var, value); 650 + return error(_("must be one of nothing, matching, simple, " 651 + "upstream or current")); 652 + } 653 + return 0; 654 + } 655 + 656 + /* Add other config variables here and to Documentation/config.adoc. */ 657 + return 0; 658 + } 659 + 660 + static int git_default_mailmap_config(const char *var, const char *value) 661 + { 662 + if (!strcmp(var, "mailmap.file")) { 663 + FREE_AND_NULL(git_mailmap_file); 664 + return git_config_pathname(&git_mailmap_file, var, value); 665 + } 666 + 667 + if (!strcmp(var, "mailmap.blob")) { 668 + FREE_AND_NULL(git_mailmap_blob); 669 + return git_config_string(&git_mailmap_blob, var, value); 670 + } 671 + 672 + /* Add other config variables here and to Documentation/config.adoc. */ 673 + return 0; 674 + } 675 + 676 + static int git_default_attr_config(const char *var, const char *value) 677 + { 678 + if (!strcmp(var, "attr.tree")) { 679 + FREE_AND_NULL(git_attr_tree); 680 + return git_config_string(&git_attr_tree, var, value); 681 + } 682 + 683 + /* 684 + * Add other attribute related config variables here and to 685 + * Documentation/config/attr.adoc. 686 + */ 687 + return 0; 688 + } 689 + 690 + int git_default_config(const char *var, const char *value, 691 + const struct config_context *ctx, void *cb) 692 + { 693 + if (starts_with(var, "core.")) 694 + return git_default_core_config(var, value, ctx, cb); 695 + 696 + if (starts_with(var, "user.") || 697 + starts_with(var, "author.") || 698 + starts_with(var, "committer.")) 699 + return git_ident_config(var, value, ctx, cb); 700 + 701 + if (starts_with(var, "i18n.")) 702 + return git_default_i18n_config(var, value); 703 + 704 + if (starts_with(var, "branch.")) 705 + return git_default_branch_config(var, value); 706 + 707 + if (starts_with(var, "push.")) 708 + return git_default_push_config(var, value); 709 + 710 + if (starts_with(var, "mailmap.")) 711 + return git_default_mailmap_config(var, value); 712 + 713 + if (starts_with(var, "attr.")) 714 + return git_default_attr_config(var, value); 715 + 716 + if (starts_with(var, "advice.") || starts_with(var, "color.advice")) 717 + return git_default_advice_config(var, value); 718 + 719 + if (!strcmp(var, "pager.color") || !strcmp(var, "color.pager")) { 720 + pager_use_color = git_config_bool(var,value); 721 + return 0; 722 + } 723 + 724 + if (!strcmp(var, "pack.packsizelimit")) { 725 + pack_size_limit_cfg = git_config_ulong(var, value, ctx->kvi); 726 + return 0; 727 + } 728 + 729 + if (!strcmp(var, "pack.compression")) { 730 + int level = git_config_int(var, value, ctx->kvi); 731 + if (level == -1) 732 + level = Z_DEFAULT_COMPRESSION; 733 + else if (level < 0 || level > Z_BEST_COMPRESSION) 734 + die(_("bad pack compression level %d"), level); 735 + pack_compression_level = level; 736 + pack_compression_seen = 1; 737 + return 0; 738 + } 739 + 740 + if (starts_with(var, "sparse.")) 741 + return git_default_sparse_config(var, value); 742 + 743 + /* Add other config variables here and to Documentation/config.adoc. */ 744 + return 0; 745 + }
+3
environment.h
··· 104 104 const char *get_git_namespace(void); 105 105 const char *strip_namespace(const char *namespaced_ref); 106 106 107 + int git_default_config(const char *, const char *, 108 + const struct config_context *, void *); 109 + 107 110 /* 108 111 * TODO: All the below state either explicitly or implicitly relies on 109 112 * `the_repository`. We should eventually get rid of these and make the
+8 -8
fetch-pack.c
··· 1904 1904 1905 1905 static void fetch_pack_config(void) 1906 1906 { 1907 - git_config_get_int("fetch.unpacklimit", &fetch_unpack_limit); 1908 - git_config_get_int("transfer.unpacklimit", &transfer_unpack_limit); 1909 - git_config_get_bool("repack.usedeltabaseoffset", &prefer_ofs_delta); 1910 - git_config_get_bool("fetch.fsckobjects", &fetch_fsck_objects); 1911 - git_config_get_bool("transfer.fsckobjects", &transfer_fsck_objects); 1912 - git_config_get_bool("transfer.advertisesid", &advertise_sid); 1907 + repo_config_get_int(the_repository, "fetch.unpacklimit", &fetch_unpack_limit); 1908 + repo_config_get_int(the_repository, "transfer.unpacklimit", &transfer_unpack_limit); 1909 + repo_config_get_bool(the_repository, "repack.usedeltabaseoffset", &prefer_ofs_delta); 1910 + repo_config_get_bool(the_repository, "fetch.fsckobjects", &fetch_fsck_objects); 1911 + repo_config_get_bool(the_repository, "transfer.fsckobjects", &transfer_fsck_objects); 1912 + repo_config_get_bool(the_repository, "transfer.advertisesid", &advertise_sid); 1913 1913 if (!uri_protocols.nr) { 1914 1914 char *str; 1915 1915 1916 - if (!git_config_get_string("fetch.uriprotocols", &str) && str) { 1916 + if (!repo_config_get_string(the_repository, "fetch.uriprotocols", &str) && str) { 1917 1917 string_list_split(&uri_protocols, str, ',', -1); 1918 1918 free(str); 1919 1919 } 1920 1920 } 1921 1921 1922 - git_config(fetch_pack_config_cb, NULL); 1922 + repo_config(the_repository, fetch_pack_config_cb, NULL); 1923 1923 } 1924 1924 1925 1925 static void fetch_pack_setup(void)
+1
fsck.c
··· 3 3 #include "git-compat-util.h" 4 4 #include "date.h" 5 5 #include "dir.h" 6 + #include "environment.h" 6 7 #include "hex.h" 7 8 #include "odb.h" 8 9 #include "path.h"
+1 -1
fsck.h
··· 287 287 288 288 struct key_value_info; 289 289 /* 290 - * git_config() callback for use by fsck-y tools that want to support 290 + * repo_config() callback for use by fsck-y tools that want to support 291 291 * fsck.<msg> fsck.skipList etc. 292 292 */ 293 293 int git_fsck_config(const char *var, const char *value,
+1 -1
fsmonitor.c
··· 43 43 { 44 44 int hook_version; 45 45 46 - if (git_config_get_int("core.fsmonitorhookversion", &hook_version)) 46 + if (repo_config_get_int(the_repository, "core.fsmonitorhookversion", &hook_version)) 47 47 return -1; 48 48 49 49 if (hook_version == HOOK_INTERFACE_VERSION1 ||
+1 -1
gpg-interface.c
··· 25 25 if (done) 26 26 return; 27 27 done = 1; 28 - git_config(git_gpg_config, NULL); 28 + repo_config(the_repository, git_gpg_config, NULL); 29 29 } 30 30 31 31 static char *configured_signing_key;
+3 -3
help.c
··· 332 332 void list_commands(struct cmdnames *main_cmds, struct cmdnames *other_cmds) 333 333 { 334 334 unsigned int colopts = 0; 335 - git_config(get_colopts, &colopts); 335 + repo_config(the_repository, get_colopts, &colopts); 336 336 337 337 if (main_cmds->cnt) { 338 338 const char *exec_path = git_exec_path(); ··· 417 417 { 418 418 const char *cmd_list; 419 419 420 - if (git_config_get_string_tmp("completion.commands", &cmd_list)) 420 + if (repo_config_get_string_tmp(the_repository, "completion.commands", &cmd_list)) 421 421 return; 422 422 423 423 string_list_sort(list); ··· 502 502 struct cmdname_help *aliases; 503 503 int i; 504 504 505 - git_config(get_alias, &alias_list); 505 + repo_config(the_repository, get_alias, &alias_list); 506 506 string_list_sort(&alias_list); 507 507 508 508 for (i = 0; i < alias_list.nr; i++) {
+3 -3
http-backend.c
··· 246 246 int i, value = 0; 247 247 struct strbuf var = STRBUF_INIT; 248 248 249 - git_config_get_bool("http.getanyfile", &getanyfile); 250 - git_config_get_ulong("http.maxrequestbuffer", &max_request_buffer); 249 + repo_config_get_bool(the_repository, "http.getanyfile", &getanyfile); 250 + repo_config_get_ulong(the_repository, "http.maxrequestbuffer", &max_request_buffer); 251 251 252 252 for (i = 0; i < ARRAY_SIZE(rpc_service); i++) { 253 253 struct rpc_service *svc = &rpc_service[i]; 254 254 strbuf_addf(&var, "http.%s", svc->config_name); 255 - if (!git_config_get_bool(var.buf, &value)) 255 + if (!repo_config_get_bool(the_repository, var.buf, &value)) 256 256 svc->enabled = value; 257 257 strbuf_reset(&var); 258 258 }
+2 -1
http-fetch.c
··· 2 2 3 3 #include "git-compat-util.h" 4 4 #include "config.h" 5 + #include "environment.h" 5 6 #include "gettext.h" 6 7 #include "hex.h" 7 8 #include "http.h" ··· 150 151 151 152 trace2_cmd_name("http-fetch"); 152 153 153 - git_config(git_default_config, NULL); 154 + repo_config(the_repository, git_default_config, NULL); 154 155 155 156 if (packfile) { 156 157 if (!index_pack_args.nr)
+2 -1
http.c
··· 3 3 4 4 #include "git-compat-util.h" 5 5 #include "git-curl-compat.h" 6 + #include "environment.h" 6 7 #include "hex.h" 7 8 #include "http.h" 8 9 #include "config.h" ··· 1315 1316 http_is_verbose = 0; 1316 1317 normalized_url = url_normalize(url, &config.url); 1317 1318 1318 - git_config(urlmatch_config_entry, &config); 1319 + repo_config(the_repository, urlmatch_config_entry, &config); 1319 1320 free(normalized_url); 1320 1321 string_list_clear(&config.vars, 1); 1321 1322
+2 -1
imap-send.c
··· 28 28 #include "advice.h" 29 29 #include "config.h" 30 30 #include "credential.h" 31 + #include "environment.h" 31 32 #include "gettext.h" 32 33 #include "run-command.h" 33 34 #include "parse-options.h" ··· 1776 1777 int ret; 1777 1778 1778 1779 setup_git_directory_gently(&nongit_ok); 1779 - git_config(git_imap_config, &server); 1780 + repo_config(the_repository, git_imap_config, &server); 1780 1781 1781 1782 argc = parse_options(argc, (const char **)argv, "", imap_send_options, imap_send_usage, 0); 1782 1783
+3 -3
list-objects-filter-options.c
··· 350 350 351 351 /* Add promisor config for the remote */ 352 352 cfg_name = xstrfmt("remote.%s.promisor", remote); 353 - git_config_set(cfg_name, "true"); 353 + repo_config_set(the_repository, cfg_name, "true"); 354 354 free(cfg_name); 355 355 } 356 356 ··· 360 360 */ 361 361 filter_name = xstrfmt("remote.%s.partialclonefilter", remote); 362 362 /* NEEDSWORK: 'expand' result leaking??? */ 363 - git_config_set(filter_name, 364 - expand_list_objects_filter_spec(filter_options)); 363 + repo_config_set(the_repository, filter_name, 364 + expand_list_objects_filter_spec(filter_options)); 365 365 free(filter_name); 366 366 367 367 /* Make sure the config info are reset */
+1 -1
ls-refs.c
··· 159 159 strbuf_init(&data.buf, 0); 160 160 strvec_init(&data.hidden_refs); 161 161 162 - git_config(ls_refs_config, &data); 162 + repo_config(the_repository, ls_refs_config, &data); 163 163 164 164 while (packet_reader_read(request) == PACKET_READ_NORMAL) { 165 165 const char *arg = request->line;
+1
mailinfo.c
··· 2 2 3 3 #include "git-compat-util.h" 4 4 #include "config.h" 5 + #include "environment.h" 5 6 #include "gettext.h" 6 7 #include "hex-ll.h" 7 8 #include "utf8.h"
+1 -1
merge-ll.c
··· 357 357 if (ll_user_merge_tail) 358 358 return; 359 359 ll_user_merge_tail = &ll_user_merge; 360 - git_config(read_merge_config, NULL); 360 + repo_config(the_repository, read_merge_config, NULL); 361 361 } 362 362 363 363 static const struct ll_merge_driver *find_ll_merge_driver(const char *merge_attr)
+9 -9
merge-ort.c
··· 5353 5353 { 5354 5354 char *value = NULL; 5355 5355 int renormalize = 0; 5356 - git_config_get_int("merge.verbosity", &opt->verbosity); 5357 - git_config_get_int("diff.renamelimit", &opt->rename_limit); 5358 - git_config_get_int("merge.renamelimit", &opt->rename_limit); 5359 - git_config_get_bool("merge.renormalize", &renormalize); 5356 + repo_config_get_int(the_repository, "merge.verbosity", &opt->verbosity); 5357 + repo_config_get_int(the_repository, "diff.renamelimit", &opt->rename_limit); 5358 + repo_config_get_int(the_repository, "merge.renamelimit", &opt->rename_limit); 5359 + repo_config_get_bool(the_repository, "merge.renormalize", &renormalize); 5360 5360 opt->renormalize = renormalize; 5361 - if (!git_config_get_string("diff.renames", &value)) { 5361 + if (!repo_config_get_string(the_repository, "diff.renames", &value)) { 5362 5362 opt->detect_renames = git_config_rename("diff.renames", value); 5363 5363 free(value); 5364 5364 } 5365 - if (!git_config_get_string("merge.renames", &value)) { 5365 + if (!repo_config_get_string(the_repository, "merge.renames", &value)) { 5366 5366 opt->detect_renames = git_config_rename("merge.renames", value); 5367 5367 free(value); 5368 5368 } 5369 - if (!git_config_get_string("merge.directoryrenames", &value)) { 5369 + if (!repo_config_get_string(the_repository, "merge.directoryrenames", &value)) { 5370 5370 int boolval = git_parse_maybe_bool(value); 5371 5371 if (0 <= boolval) { 5372 5372 opt->detect_directory_renames = boolval ? ··· 5379 5379 free(value); 5380 5380 } 5381 5381 if (ui) { 5382 - if (!git_config_get_string("diff.algorithm", &value)) { 5382 + if (!repo_config_get_string(the_repository, "diff.algorithm", &value)) { 5383 5383 long diff_algorithm = parse_algorithm_value(value); 5384 5384 if (diff_algorithm < 0) 5385 5385 die(_("unknown value for config '%s': %s"), "diff.algorithm", value); ··· 5387 5387 free(value); 5388 5388 } 5389 5389 } 5390 - git_config(git_xmerge_config, NULL); 5390 + repo_config(the_repository, git_xmerge_config, NULL); 5391 5391 } 5392 5392 5393 5393 static void init_merge_options(struct merge_options *opt,
+1 -1
notes-utils.c
··· 162 162 c->refs_from_env = 1; 163 163 string_list_add_refs_from_colon_sep(c->refs, rewrite_refs_env); 164 164 } 165 - git_config(notes_rewrite_config, c); 165 + repo_config(the_repository, notes_rewrite_config, c); 166 166 if (!c->enabled || !c->refs->nr) { 167 167 string_list_clear(c->refs, 0); 168 168 free(c->refs);
+1 -1
notes.c
··· 1123 1123 load_config_refs = 1; 1124 1124 } 1125 1125 1126 - git_config(notes_display_config, &load_config_refs); 1126 + repo_config(the_repository, notes_display_config, &load_config_refs); 1127 1127 1128 1128 if (opt) { 1129 1129 struct string_list_item *item;
+2 -2
parallel-checkout.c
··· 57 57 return; 58 58 } 59 59 60 - if (git_config_get_int("checkout.workers", num_workers)) 60 + if (repo_config_get_int(the_repository, "checkout.workers", num_workers)) 61 61 *num_workers = DEFAULT_NUM_WORKERS; 62 62 else if (*num_workers < 1) 63 63 *num_workers = online_cpus(); 64 64 65 - if (git_config_get_int("checkout.thresholdForParallelism", threshold)) 65 + if (repo_config_get_int(the_repository, "checkout.thresholdForParallelism", threshold)) 66 66 *threshold = DEFAULT_THRESHOLD_FOR_PARALLELISM; 67 67 } 68 68
+1 -1
pretty.c
··· 141 141 COPY_ARRAY(commit_formats, builtin_formats, 142 142 ARRAY_SIZE(builtin_formats)); 143 143 144 - git_config(git_pretty_formats_config, NULL); 144 + repo_config(the_repository, git_pretty_formats_config, NULL); 145 145 } 146 146 147 147 static struct cmt_fmt_map *find_commit_format_recursive(const char *sought,
+4 -4
promisor-remote.c
··· 46 46 "fetch", remote_name, "--no-tags", 47 47 "--no-write-fetch-head", "--recurse-submodules=no", 48 48 "--filter=blob:none", "--stdin", NULL); 49 - if (!git_config_get_bool("promisor.quiet", &quiet) && quiet) 49 + if (!repo_config_get_bool(the_repository, "promisor.quiet", &quiet) && quiet) 50 50 strvec_push(&child.args, "--quiet"); 51 51 if (start_command(&child)) 52 52 die(_("promisor-remote: unable to fork off fetch subprocess")); ··· 327 327 char *url_key = xstrfmt("remote.%s.url", r->name); 328 328 329 329 /* Only add remotes with a non empty URL */ 330 - if (!git_config_get_string_tmp(url_key, &url) && *url) { 330 + if (!repo_config_get_string_tmp(the_repository, url_key, &url) && *url) { 331 331 strvec_push(names, r->name); 332 332 strvec_push(urls, url); 333 333 } ··· 343 343 struct strvec names = STRVEC_INIT; 344 344 struct strvec urls = STRVEC_INIT; 345 345 346 - git_config_get_bool("promisor.advertise", &advertise_promisors); 346 + repo_config_get_bool(the_repository, "promisor.advertise", &advertise_promisors); 347 347 348 348 if (!advertise_promisors) 349 349 return NULL; ··· 433 433 struct strvec names = STRVEC_INIT; 434 434 struct strvec urls = STRVEC_INIT; 435 435 436 - if (!git_config_get_string_tmp("promisor.acceptfromserver", &accept_str)) { 436 + if (!repo_config_get_string_tmp(the_repository, "promisor.acceptfromserver", &accept_str)) { 437 437 if (!*accept_str || !strcasecmp("None", accept_str)) 438 438 accept = ACCEPT_NONE; 439 439 else if (!strcasecmp("KnownUrl", accept_str))
+1 -1
protocol.c
··· 24 24 const char *git_test_k = "GIT_TEST_PROTOCOL_VERSION"; 25 25 const char *git_test_v; 26 26 27 - if (!git_config_get_string_tmp("protocol.version", &value)) { 27 + if (!repo_config_get_string_tmp(the_repository, "protocol.version", &value)) { 28 28 enum protocol_version version = parse_protocol_version(value); 29 29 30 30 if (version == protocol_unknown_version)
+1 -1
reachable.c
··· 170 170 171 171 data->extra_recent_oids_loaded = 1; 172 172 173 - if (git_config_get_string_multi("gc.recentobjectshook", &programs)) 173 + if (repo_config_get_string_multi(the_repository, "gc.recentobjectshook", &programs)) 174 174 return; 175 175 176 176 for (i = 0; i < programs->nr; i++) {
+2 -2
read-cache.c
··· 2755 2755 { 2756 2756 int val; 2757 2757 2758 - if (!git_config_get_bool("index.recordendofindexentries", &val)) 2758 + if (!repo_config_get_bool(the_repository, "index.recordendofindexentries", &val)) 2759 2759 return val; 2760 2760 2761 2761 /* ··· 2770 2770 { 2771 2771 int val; 2772 2772 2773 - if (!git_config_get_bool("index.recordoffsettable", &val)) 2773 + if (!repo_config_get_bool(the_repository, "index.recordoffsettable", &val)) 2774 2774 return val; 2775 2775 2776 2776 /*
+1 -1
rebase-interactive.c
··· 30 30 { 31 31 const char *value; 32 32 33 - if (git_config_get_value("rebase.missingcommitscheck", &value) || 33 + if (repo_config_get_value(the_repository, "rebase.missingcommitscheck", &value) || 34 34 !strcasecmp("ignore", value)) 35 35 return MISSING_COMMIT_CHECK_IGNORE; 36 36 if (!strcasecmp("warn", value))
+1
reflog.c
··· 3 3 4 4 #include "git-compat-util.h" 5 5 #include "config.h" 6 + #include "environment.h" 6 7 #include "gettext.h" 7 8 #include "parse-options.h" 8 9 #include "odb.h"
+1 -1
refs.c
··· 945 945 static int timeout_ms = 100; 946 946 947 947 if (!configured) { 948 - git_config_get_int("core.filesreflocktimeout", &timeout_ms); 948 + repo_config_get_int(the_repository, "core.filesreflocktimeout", &timeout_ms); 949 949 configured = 1; 950 950 } 951 951
+1 -1
refs/packed-backend.c
··· 1233 1233 static int timeout_value = 1000; 1234 1234 1235 1235 if (!timeout_configured) { 1236 - git_config_get_int("core.packedrefstimeout", &timeout_value); 1236 + repo_config_get_int(the_repository, "core.packedrefstimeout", &timeout_value); 1237 1237 timeout_configured = 1; 1238 1238 } 1239 1239
+1 -1
refs/reftable-backend.c
··· 386 386 refs->write_options.lock_timeout_ms = 100; 387 387 refs->write_options.fsync = reftable_be_fsync; 388 388 389 - git_config(reftable_be_config, &refs->write_options); 389 + repo_config(the_repository, reftable_be_config, &refs->write_options); 390 390 391 391 /* 392 392 * It is somewhat unfortunate that we have to mirror the default block
+1 -1
remote.c
··· 734 734 struct strbuf redacted = STRBUF_INIT; 735 735 int warn_not_die; 736 736 737 - if (git_config_get_string_tmp("transfer.credentialsinurl", &value)) 737 + if (repo_config_get_string_tmp(the_repository, "transfer.credentialsinurl", &value)) 738 738 return; 739 739 740 740 if (!strcmp("warn", value))
+5 -4
rerere.c
··· 5 5 #include "abspath.h" 6 6 #include "config.h" 7 7 #include "copy.h" 8 + #include "environment.h" 8 9 #include "gettext.h" 9 10 #include "hex.h" 10 11 #include "lockfile.h" ··· 877 878 878 879 static void git_rerere_config(void) 879 880 { 880 - git_config_get_bool("rerere.enabled", &rerere_enabled); 881 - git_config_get_bool("rerere.autoupdate", &rerere_autoupdate); 882 - git_config(git_default_config, NULL); 881 + repo_config_get_bool(the_repository, "rerere.enabled", &rerere_enabled); 882 + repo_config_get_bool(the_repository, "rerere.autoupdate", &rerere_autoupdate); 883 + repo_config(the_repository, git_default_config, NULL); 883 884 } 884 885 885 886 static GIT_PATH_FUNC(git_path_rr_cache, "rr-cache") ··· 1247 1248 &cutoff_resolve, now); 1248 1249 repo_config_get_expiry_in_days(the_repository, "gc.rerereunresolved", 1249 1250 &cutoff_noresolve, now); 1250 - git_config(git_default_config, NULL); 1251 + repo_config(the_repository, git_default_config, NULL); 1251 1252 dir = opendir(repo_git_path_replace(the_repository, &buf, "rr-cache")); 1252 1253 if (!dir) 1253 1254 die_errno(_("unable to open rr-cache directory"));
+1 -1
revision.c
··· 1620 1620 cb.exclusions = exclusions; 1621 1621 cb.section = section; 1622 1622 1623 - git_config(hide_refs_config, &cb); 1623 + repo_config(the_repository, hide_refs_config, &cb); 1624 1624 } 1625 1625 1626 1626 struct all_refs_cb {
+3 -3
run-command.c
··· 1817 1817 { 1818 1818 int enabled, auto_detach; 1819 1819 1820 - if (!git_config_get_bool("maintenance.auto", &enabled) && 1820 + if (!repo_config_get_bool(the_repository, "maintenance.auto", &enabled) && 1821 1821 !enabled) 1822 1822 return 0; 1823 1823 ··· 1826 1826 * honoring `gc.autoDetach`. This is somewhat weird, but required to 1827 1827 * retain behaviour from when we used to run git-gc(1) here. 1828 1828 */ 1829 - if (git_config_get_bool("maintenance.autodetach", &auto_detach) && 1830 - git_config_get_bool("gc.autodetach", &auto_detach)) 1829 + if (repo_config_get_bool(the_repository, "maintenance.autodetach", &auto_detach) && 1830 + repo_config_get_bool(the_repository, "gc.autodetach", &auto_detach)) 1831 1831 auto_detach = 1; 1832 1832 1833 1833 maint->git_cmd = 1;
+9 -9
scalar.c
··· 101 101 int res; 102 102 103 103 if ((reconfigure && config->overwrite_on_reconfigure) || 104 - git_config_get_string(config->key, &value)) { 104 + repo_config_get_string(the_repository, config->key, &value)) { 105 105 trace2_data_string("scalar", the_repository, config->key, "created"); 106 - res = git_config_set_gently(config->key, config->value); 106 + res = repo_config_set_gently(the_repository, config->key, config->value); 107 107 } else { 108 108 trace2_data_string("scalar", the_repository, config->key, "exists"); 109 109 res = 0; ··· 193 193 * The `log.excludeDecoration` setting is special because it allows 194 194 * for multiple values. 195 195 */ 196 - if (git_config_get_string("log.excludeDecoration", &value)) { 196 + if (repo_config_get_string(the_repository, "log.excludeDecoration", &value)) { 197 197 trace2_data_string("scalar", the_repository, 198 198 "log.excludeDecoration", "created"); 199 - if (git_config_set_multivar_gently("log.excludeDecoration", 200 - "refs/prefetch/*", 201 - CONFIG_REGEX_NONE, 0)) 199 + if (repo_config_set_multivar_gently(the_repository, "log.excludeDecoration", 200 + "refs/prefetch/*", 201 + CONFIG_REGEX_NONE, 0)) 202 202 return error(_("could not configure " 203 203 "log.excludeDecoration")); 204 204 } else { ··· 322 322 value = strchr(buf.buf, '='); 323 323 if (value) 324 324 *(value++) = '\0'; 325 - res = git_config_set_gently(buf.buf, value); 325 + res = repo_config_set_gently(the_repository, buf.buf, value); 326 326 strbuf_release(&buf); 327 327 328 328 return res; ··· 713 713 maintenance_str); 714 714 } 715 715 716 - git_config(get_scalar_repos, &scalar_repos); 716 + repo_config(the_repository, get_scalar_repos, &scalar_repos); 717 717 718 718 for (size_t i = 0; i < scalar_repos.nr; i++) { 719 719 int succeeded = 0; ··· 763 763 break; 764 764 } 765 765 766 - git_config_clear(); 766 + repo_config_clear(the_repository); 767 767 768 768 if (repo_init(&r, gitdir.buf, commondir.buf)) 769 769 goto loop_end;
+18 -18
sequencer.c
··· 327 327 void sequencer_init_config(struct replay_opts *opts) 328 328 { 329 329 opts->default_msg_cleanup = COMMIT_MSG_CLEANUP_NONE; 330 - git_config(git_sequencer_config, opts); 330 + repo_config(the_repository, git_sequencer_config, opts); 331 331 } 332 332 333 333 static inline int is_rebase_i(const struct replay_opts *opts) ··· 3650 3650 int res = 0; 3651 3651 3652 3652 if (opts->no_commit) 3653 - res |= git_config_set_in_file_gently(opts_file, 3653 + res |= repo_config_set_in_file_gently(the_repository, opts_file, 3654 3654 "options.no-commit", NULL, "true"); 3655 3655 if (opts->edit >= 0) 3656 - res |= git_config_set_in_file_gently(opts_file, "options.edit", NULL, 3656 + res |= repo_config_set_in_file_gently(the_repository, opts_file, "options.edit", NULL, 3657 3657 opts->edit ? "true" : "false"); 3658 3658 if (opts->allow_empty) 3659 - res |= git_config_set_in_file_gently(opts_file, 3659 + res |= repo_config_set_in_file_gently(the_repository, opts_file, 3660 3660 "options.allow-empty", NULL, "true"); 3661 3661 if (opts->allow_empty_message) 3662 - res |= git_config_set_in_file_gently(opts_file, 3662 + res |= repo_config_set_in_file_gently(the_repository, opts_file, 3663 3663 "options.allow-empty-message", NULL, "true"); 3664 3664 if (opts->drop_redundant_commits) 3665 - res |= git_config_set_in_file_gently(opts_file, 3665 + res |= repo_config_set_in_file_gently(the_repository, opts_file, 3666 3666 "options.drop-redundant-commits", NULL, "true"); 3667 3667 if (opts->keep_redundant_commits) 3668 - res |= git_config_set_in_file_gently(opts_file, 3668 + res |= repo_config_set_in_file_gently(the_repository, opts_file, 3669 3669 "options.keep-redundant-commits", NULL, "true"); 3670 3670 if (opts->signoff) 3671 - res |= git_config_set_in_file_gently(opts_file, 3671 + res |= repo_config_set_in_file_gently(the_repository, opts_file, 3672 3672 "options.signoff", NULL, "true"); 3673 3673 if (opts->record_origin) 3674 - res |= git_config_set_in_file_gently(opts_file, 3674 + res |= repo_config_set_in_file_gently(the_repository, opts_file, 3675 3675 "options.record-origin", NULL, "true"); 3676 3676 if (opts->allow_ff) 3677 - res |= git_config_set_in_file_gently(opts_file, 3677 + res |= repo_config_set_in_file_gently(the_repository, opts_file, 3678 3678 "options.allow-ff", NULL, "true"); 3679 3679 if (opts->mainline) { 3680 3680 struct strbuf buf = STRBUF_INIT; 3681 3681 strbuf_addf(&buf, "%d", opts->mainline); 3682 - res |= git_config_set_in_file_gently(opts_file, 3682 + res |= repo_config_set_in_file_gently(the_repository, opts_file, 3683 3683 "options.mainline", NULL, buf.buf); 3684 3684 strbuf_release(&buf); 3685 3685 } 3686 3686 if (opts->strategy) 3687 - res |= git_config_set_in_file_gently(opts_file, 3687 + res |= repo_config_set_in_file_gently(the_repository, opts_file, 3688 3688 "options.strategy", NULL, opts->strategy); 3689 3689 if (opts->gpg_sign) 3690 - res |= git_config_set_in_file_gently(opts_file, 3690 + res |= repo_config_set_in_file_gently(the_repository, opts_file, 3691 3691 "options.gpg-sign", NULL, opts->gpg_sign); 3692 3692 for (size_t i = 0; i < opts->xopts.nr; i++) 3693 - res |= git_config_set_multivar_in_file_gently(opts_file, 3693 + res |= repo_config_set_multivar_in_file_gently(the_repository, opts_file, 3694 3694 "options.strategy-option", 3695 3695 opts->xopts.v[i], "^$", NULL, 0); 3696 3696 if (opts->allow_rerere_auto) 3697 - res |= git_config_set_in_file_gently(opts_file, 3697 + res |= repo_config_set_in_file_gently(the_repository, opts_file, 3698 3698 "options.allow-rerere-auto", NULL, 3699 3699 opts->allow_rerere_auto == RERERE_AUTOUPDATE ? 3700 3700 "true" : "false"); 3701 3701 3702 3702 if (opts->explicit_cleanup) 3703 - res |= git_config_set_in_file_gently(opts_file, 3703 + res |= repo_config_set_in_file_gently(the_repository, opts_file, 3704 3704 "options.default-msg-cleanup", NULL, 3705 3705 describe_cleanup_mode(opts->default_msg_cleanup)); 3706 3706 return res; ··· 5834 5834 *cmd_reset = abbr ? "t" : "reset", 5835 5835 *cmd_merge = abbr ? "m" : "merge"; 5836 5836 5837 - git_config_get_int("rebase.maxlabellength", &state.max_label_length); 5837 + repo_config_get_int(the_repository, "rebase.maxlabellength", &state.max_label_length); 5838 5838 5839 5839 oidmap_init(&commit2todo, 0); 5840 5840 oidmap_init(&state.commit2label, 0); ··· 6089 6089 revs.topo_order = 1; 6090 6090 6091 6091 revs.pretty_given = 1; 6092 - git_config_get_string("rebase.instructionFormat", &format); 6092 + repo_config_get_string(the_repository, "rebase.instructionFormat", &format); 6093 6093 if (!format || !*format) { 6094 6094 free(format); 6095 6095 format = xstrdup("# %s");
+22 -22
setup.c
··· 815 815 } 816 816 817 817 strbuf_addf(&repo_version, "%d", target_version); 818 - git_config_set("core.repositoryformatversion", repo_version.buf); 818 + repo_config_set(the_repository, "core.repositoryformatversion", repo_version.buf); 819 819 820 820 ret = 1; 821 821 ··· 1741 1741 * configuration (including the per-repo config file that we 1742 1742 * ignored previously). 1743 1743 */ 1744 - git_config_clear(); 1744 + repo_config_clear(the_repository); 1745 1745 1746 1746 /* 1747 1747 * Let's assume that we are in a git repository. ··· 1877 1877 * the core.precomposeunicode configuration, this 1878 1878 * has to happen after the above block that finds 1879 1879 * out where the repository is, i.e. a preparation 1880 - * for calling git_config_get_bool(). 1880 + * for calling repo_config_get_bool(). 1881 1881 */ 1882 1882 if (prefix) { 1883 1883 prefix = precompose_string_if_needed(prefix); ··· 2233 2233 target_version = GIT_REPO_VERSION_READ; 2234 2234 2235 2235 if (hash_algo != GIT_HASH_SHA1_LEGACY && hash_algo != GIT_HASH_UNKNOWN) 2236 - git_config_set("extensions.objectformat", 2237 - hash_algos[hash_algo].name); 2236 + repo_config_set(the_repository, "extensions.objectformat", 2237 + hash_algos[hash_algo].name); 2238 2238 else if (reinit) 2239 - git_config_set_gently("extensions.objectformat", NULL); 2239 + repo_config_set_gently(the_repository, "extensions.objectformat", NULL); 2240 2240 2241 2241 if (ref_storage_format != REF_STORAGE_FORMAT_FILES) 2242 - git_config_set("extensions.refstorage", 2243 - ref_storage_format_to_name(ref_storage_format)); 2242 + repo_config_set(the_repository, "extensions.refstorage", 2243 + ref_storage_format_to_name(ref_storage_format)); 2244 2244 else if (reinit) 2245 - git_config_set_gently("extensions.refstorage", NULL); 2245 + repo_config_set_gently(the_repository, "extensions.refstorage", NULL); 2246 2246 2247 2247 if (reinit) { 2248 2248 struct strbuf config = STRBUF_INIT; ··· 2259 2259 } 2260 2260 2261 2261 strbuf_addf(&repo_version, "%d", target_version); 2262 - git_config_set("core.repositoryformatversion", repo_version.buf); 2262 + repo_config_set(the_repository, "core.repositoryformatversion", repo_version.buf); 2263 2263 2264 2264 strbuf_release(&repo_version); 2265 2265 } ··· 2337 2337 * disk). 2338 2338 */ 2339 2339 copy_templates(template_path); 2340 - git_config_clear(); 2340 + repo_config_clear(the_repository); 2341 2341 repo_settings_reset_shared_repository(the_repository); 2342 - git_config(git_default_config, NULL); 2342 + repo_config(the_repository, git_default_config, NULL); 2343 2343 2344 2344 reinit = is_reinit(); 2345 2345 ··· 2375 2375 if (filemode && !reinit && (st1.st_mode & S_IXUSR)) 2376 2376 filemode = 0; 2377 2377 } 2378 - git_config_set("core.filemode", filemode ? "true" : "false"); 2378 + repo_config_set(the_repository, "core.filemode", filemode ? "true" : "false"); 2379 2379 2380 2380 if (is_bare_repository()) 2381 - git_config_set("core.bare", "true"); 2381 + repo_config_set(the_repository, "core.bare", "true"); 2382 2382 else { 2383 - git_config_set("core.bare", "false"); 2383 + repo_config_set(the_repository, "core.bare", "false"); 2384 2384 /* allow template config file to override the default */ 2385 2385 if (repo_settings_get_log_all_ref_updates(the_repository) == LOG_REFS_UNSET) 2386 - git_config_set("core.logallrefupdates", "true"); 2386 + repo_config_set(the_repository, "core.logallrefupdates", "true"); 2387 2387 if (needs_work_tree_config(original_git_dir, work_tree)) 2388 - git_config_set("core.worktree", work_tree); 2388 + repo_config_set(the_repository, "core.worktree", work_tree); 2389 2389 } 2390 2390 2391 2391 if (!reinit) { ··· 2398 2398 S_ISLNK(st1.st_mode)) 2399 2399 unlink(path.buf); /* good */ 2400 2400 else 2401 - git_config_set("core.symlinks", "false"); 2401 + repo_config_set(the_repository, "core.symlinks", "false"); 2402 2402 2403 2403 /* Check if the filesystem is case-insensitive */ 2404 2404 repo_git_path_replace(the_repository, &path, "CoNfIg"); 2405 2405 if (!access(path.buf, F_OK)) 2406 - git_config_set("core.ignorecase", "true"); 2406 + repo_config_set(the_repository, "core.ignorecase", "true"); 2407 2407 probe_utf8_pathname_composition(); 2408 2408 } 2409 2409 ··· 2610 2610 * have set up the repository format such that we can evaluate 2611 2611 * includeIf conditions correctly in the case of re-initialization. 2612 2612 */ 2613 - git_config(platform_core_config, NULL); 2613 + repo_config(the_repository, platform_core_config, NULL); 2614 2614 2615 2615 safe_create_dir(the_repository, git_dir, 0); 2616 2616 ··· 2639 2639 xsnprintf(buf, sizeof(buf), "%d", OLD_PERM_EVERYBODY); 2640 2640 else 2641 2641 BUG("invalid value for shared_repository"); 2642 - git_config_set("core.sharedrepository", buf); 2643 - git_config_set("receive.denyNonFastforwards", "true"); 2642 + repo_config_set(the_repository, "core.sharedrepository", buf); 2643 + repo_config_set(the_repository, "receive.denyNonFastforwards", "true"); 2644 2644 } 2645 2645 2646 2646 if (!(flags & INIT_DB_QUIET)) {
+3 -3
sideband.c
··· 39 39 if (use_sideband_colors_cached >= 0) 40 40 return use_sideband_colors_cached; 41 41 42 - if (!git_config_get_string_tmp(key, &value)) 42 + if (!repo_config_get_string_tmp(the_repository, key, &value)) 43 43 use_sideband_colors_cached = git_config_colorbool(key, value); 44 - else if (!git_config_get_string_tmp("color.ui", &value)) 44 + else if (!repo_config_get_string_tmp(the_repository, "color.ui", &value)) 45 45 use_sideband_colors_cached = git_config_colorbool("color.ui", value); 46 46 else 47 47 use_sideband_colors_cached = GIT_COLOR_AUTO; ··· 49 49 for (i = 0; i < ARRAY_SIZE(keywords); i++) { 50 50 strbuf_reset(&sb); 51 51 strbuf_addf(&sb, "%s.%s", key, keywords[i].keyword); 52 - if (git_config_get_string_tmp(sb.buf, &value)) 52 + if (repo_config_get_string_tmp(the_repository, sb.buf, &value)) 53 53 continue; 54 54 color_parse(value, keywords[i].color); 55 55 }
+1 -1
submodule-config.c
··· 983 983 { 984 984 int ret; 985 985 986 - ret = git_config_set_in_file_gently(GITMODULES_FILE, key, NULL, value); 986 + ret = repo_config_set_in_file_gently(the_repository, GITMODULES_FILE, key, NULL, value); 987 987 if (ret < 0) 988 988 /* Maybe the user already did that, don't error out here */ 989 989 warning(_("Could not update .gitmodules entry %s"), key);
+1 -1
submodule.c
··· 2058 2058 submodule_name_to_gitdir(&config_path, the_repository, sub->name); 2059 2059 strbuf_addstr(&config_path, "/config"); 2060 2060 2061 - if (git_config_set_in_file_gently(config_path.buf, "core.worktree", NULL, NULL)) 2061 + if (repo_config_set_in_file_gently(the_repository, config_path.buf, "core.worktree", NULL, NULL)) 2062 2062 warning(_("Could not unset core.worktree setting in submodule '%s'"), 2063 2063 sub->path); 2064 2064
+2 -1
t/helper/test-advise.c
··· 3 3 #include "test-tool.h" 4 4 #include "advice.h" 5 5 #include "config.h" 6 + #include "environment.h" 6 7 #include "setup.h" 7 8 8 9 int cmd__advise_if_enabled(int argc, const char **argv) ··· 11 12 die("usage: %s <advice>", argv[0]); 12 13 13 14 setup_git_directory(); 14 - git_config(git_default_config, NULL); 15 + repo_config(the_repository, git_default_config, NULL); 15 16 16 17 /* 17 18 * Any advice type can be used for testing, but NESTED_TAG was
+10 -10
t/helper/test-config.c
··· 32 32 * ascending order of priority from a config_set 33 33 * constructed from files entered as arguments. 34 34 * 35 - * iterate -> iterate over all values using git_config(), and print some 35 + * iterate -> iterate over all values using repo_config(), and print some 36 36 * data for each 37 37 * 38 - * git_config_int -> iterate over all values using git_config() and print the 38 + * git_config_int -> iterate over all values using repo_config() and print the 39 39 * integer value for the entered key or die 40 40 * 41 41 * Examples: ··· 110 110 fprintf(stderr, "Please, provide a command name on the command-line\n"); 111 111 goto exit1; 112 112 } else if (argc == 3 && !strcmp(argv[1], "get_value")) { 113 - if (!git_config_get_value(argv[2], &v)) { 113 + if (!repo_config_get_value(the_repository, argv[2], &v)) { 114 114 if (!v) 115 115 printf("(NULL)\n"); 116 116 else ··· 121 121 goto exit1; 122 122 } 123 123 } else if (argc == 3 && !strcmp(argv[1], "get_value_multi")) { 124 - if (!git_config_get_value_multi(argv[2], &strptr)) { 124 + if (!repo_config_get_value_multi(the_repository, argv[2], &strptr)) { 125 125 for (i = 0; i < strptr->nr; i++) { 126 126 v = strptr->items[i].string; 127 127 if (!v) ··· 137 137 } else if (argc == 3 && !strcmp(argv[1], "get")) { 138 138 int ret; 139 139 140 - if (!(ret = git_config_get(argv[2]))) 140 + if (!(ret = repo_config_get(the_repository, argv[2]))) 141 141 goto exit0; 142 142 else if (ret == 1) 143 143 printf("Value not found for \"%s\"\n", argv[2]); ··· 155 155 BUG("Key \"%s\" has unknown return %d", argv[2], ret); 156 156 goto exit1; 157 157 } else if (argc == 3 && !strcmp(argv[1], "get_int")) { 158 - if (!git_config_get_int(argv[2], &val)) { 158 + if (!repo_config_get_int(the_repository, argv[2], &val)) { 159 159 printf("%d\n", val); 160 160 goto exit0; 161 161 } else { ··· 163 163 goto exit1; 164 164 } 165 165 } else if (argc == 3 && !strcmp(argv[1], "get_bool")) { 166 - if (!git_config_get_bool(argv[2], &val)) { 166 + if (!repo_config_get_bool(the_repository, argv[2], &val)) { 167 167 printf("%d\n", val); 168 168 goto exit0; 169 169 } else { ··· 171 171 goto exit1; 172 172 } 173 173 } else if (argc == 3 && !strcmp(argv[1], "get_string")) { 174 - if (!git_config_get_string_tmp(argv[2], &v)) { 174 + if (!repo_config_get_string_tmp(the_repository, argv[2], &v)) { 175 175 printf("%s\n", v); 176 176 goto exit0; 177 177 } else { ··· 218 218 goto exit1; 219 219 } 220 220 } else if (!strcmp(argv[1], "iterate")) { 221 - git_config(iterate_cb, NULL); 221 + repo_config(the_repository, iterate_cb, NULL); 222 222 goto exit0; 223 223 } else if (argc == 3 && !strcmp(argv[1], "git_config_int")) { 224 - git_config(parse_int_cb, (void *) argv[2]); 224 + repo_config(the_repository, parse_int_cb, (void *) argv[2]); 225 225 goto exit0; 226 226 } 227 227
+2 -1
t/helper/test-read-cache.c
··· 2 2 3 3 #include "test-tool.h" 4 4 #include "config.h" 5 + #include "environment.h" 5 6 #include "read-cache-ll.h" 6 7 #include "repository.h" 7 8 #include "setup.h" ··· 19 20 if (argc == 2) 20 21 cnt = strtol(argv[1], NULL, 0); 21 22 setup_git_directory(); 22 - git_config(git_default_config, NULL); 23 + repo_config(the_repository, git_default_config, NULL); 23 24 24 25 for (i = 0; i < cnt; i++) { 25 26 repo_read_index(the_repository);
+1 -1
t/helper/test-userdiff.c
··· 41 41 42 42 if (want & USERDIFF_DRIVER_TYPE_CUSTOM) { 43 43 setup_git_directory(); 44 - git_config(cmd__userdiff_config, NULL); 44 + repo_config(the_repository, cmd__userdiff_config, NULL); 45 45 } 46 46 47 47 for_each_userdiff_driver(driver_cb, &want);
+1 -1
t/t4256/1/mailinfo.c
··· 1214 1214 mi->header_stage = 1; 1215 1215 mi->use_inbody_headers = 1; 1216 1216 mi->content_top = mi->content; 1217 - git_config(git_mailinfo_config, mi); 1217 + repo_config(the_repository, git_mailinfo_config, mi); 1218 1218 } 1219 1219 1220 1220 void clear_mailinfo(struct mailinfo *mi)
+1 -1
t/t4256/1/mailinfo.c.orig
··· 1154 1154 mi->header_stage = 1; 1155 1155 mi->use_inbody_headers = 1; 1156 1156 mi->content_top = mi->content; 1157 - git_config(git_mailinfo_config, mi); 1157 + repo_config(the_repository, git_mailinfo_config, mi); 1158 1158 } 1159 1159 1160 1160 void clear_mailinfo(struct mailinfo *mi)
+2 -2
trailer.c
··· 595 595 default_conf_info.where = WHERE_END; 596 596 default_conf_info.if_exists = EXISTS_ADD_IF_DIFFERENT_NEIGHBOR; 597 597 default_conf_info.if_missing = MISSING_ADD; 598 - git_config(git_trailer_default_config, NULL); 599 - git_config(git_trailer_config, NULL); 598 + repo_config(the_repository, git_trailer_default_config, NULL); 599 + repo_config(the_repository, git_trailer_config, NULL); 600 600 configured = 1; 601 601 } 602 602
+6 -6
transport.c
··· 54 54 return 0; 55 55 initialized = 1; 56 56 57 - if (!git_config_get_string(key, &value)) 57 + if (!repo_config_get_string(the_repository, key, &value)) 58 58 transport_use_color = git_config_colorbool(key, value); 59 59 60 60 if (!want_color_stderr(transport_use_color)) 61 61 return 0; 62 62 63 63 for (size_t i = 0; i < ARRAY_SIZE(keys); i++) 64 - if (!git_config_get_string(keys[i], &value)) { 64 + if (!repo_config_get_string(the_repository, keys[i], &value)) { 65 65 if (!value) 66 66 return config_error_nonbool(keys[i]); 67 67 if (color_parse(value, transport_colors[i]) < 0) ··· 202 202 if (!data->get_refs_from_bundle_called) 203 203 get_refs_from_bundle_inner(transport); 204 204 205 - git_config(fetch_fsck_config_cb, &msg_types); 205 + repo_config(the_repository, fetch_fsck_config_cb, &msg_types); 206 206 opts.fsck_msg_types = msg_types.buf; 207 207 208 208 ret = unbundle(the_repository, &data->header, data->fd, ··· 1078 1078 char *value; 1079 1079 1080 1080 /* first check the per-protocol config */ 1081 - if (!git_config_get_string(key, &value)) { 1081 + if (!repo_config_get_string(the_repository, key, &value)) { 1082 1082 enum protocol_allow_config ret = 1083 1083 parse_protocol_config(key, value); 1084 1084 free(key); ··· 1088 1088 free(key); 1089 1089 1090 1090 /* if defined, fallback to user-defined default for unknown protocols */ 1091 - if (!git_config_get_string("protocol.allow", &value)) { 1091 + if (!repo_config_get_string(the_repository, "protocol.allow", &value)) { 1092 1092 enum protocol_allow_config ret = 1093 1093 parse_protocol_config("protocol.allow", value); 1094 1094 free(value); ··· 1602 1602 * Don't request bundle-uri from the server unless configured to 1603 1603 * do so by the transfer.bundleURI=true config option. 1604 1604 */ 1605 - if (git_config_get_bool("transfer.bundleuri", &value) || !value) 1605 + if (repo_config_get_bool(the_repository, "transfer.bundleuri", &value) || !value) 1606 1606 return 0; 1607 1607 1608 1608 if (!transport->bundles->baseURI)
+2 -2
versioncmp.c
··· 167 167 const char *const oldk = "versionsort.prereleasesuffix"; 168 168 const struct string_list *newl; 169 169 const struct string_list *oldl; 170 - int new = git_config_get_string_multi(newk, &newl); 171 - int old = git_config_get_string_multi(oldk, &oldl); 170 + int new = repo_config_get_string_multi(the_repository, newk, &newl); 171 + int old = repo_config_get_string_multi(the_repository, oldk, &oldl); 172 172 173 173 if (!new && !old) 174 174 warning("ignoring %s because %s is set", oldk, newk);
+4 -4
worktree.c
··· 991 991 static int move_config_setting(const char *key, const char *value, 992 992 const char *from_file, const char *to_file) 993 993 { 994 - if (git_config_set_in_file_gently(to_file, key, NULL, value)) 994 + if (repo_config_set_in_file_gently(the_repository, to_file, key, NULL, value)) 995 995 return error(_("unable to set %s in '%s'"), key, to_file); 996 - if (git_config_set_in_file_gently(from_file, key, NULL, NULL)) 996 + if (repo_config_set_in_file_gently(the_repository, from_file, key, NULL, NULL)) 997 997 return error(_("unable to unset %s in '%s'"), key, from_file); 998 998 return 0; 999 999 } ··· 1013 1013 */ 1014 1014 if (r->repository_format_worktree_config) 1015 1015 return 0; 1016 - if ((res = git_config_set_gently("extensions.worktreeConfig", "true"))) 1016 + if ((res = repo_config_set_gently(the_repository, "extensions.worktreeConfig", "true"))) 1017 1017 return error(_("failed to set extensions.worktreeConfig setting")); 1018 1018 1019 1019 common_config_file = xstrfmt("%s/config", r->commondir); ··· 1077 1077 if (use_relative_paths && !the_repository->repository_format_relative_worktrees) { 1078 1078 if (upgrade_repository_format(1) < 0) 1079 1079 die(_("unable to upgrade repository format to support relative worktrees")); 1080 - if (git_config_set_gently("extensions.relativeWorktrees", "true")) 1080 + if (repo_config_set_gently(the_repository, "extensions.relativeWorktrees", "true")) 1081 1081 die(_("unable to set extensions.relativeWorktrees setting")); 1082 1082 the_repository->repository_format_relative_worktrees = 1; 1083 1083 }
+1
xdiff-interface.c
··· 2 2 #define DISABLE_SIGN_COMPARE_WARNINGS 3 3 4 4 #include "git-compat-util.h" 5 + #include "environment.h" 5 6 #include "gettext.h" 6 7 #include "config.h" 7 8 #include "hex.h"