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 ...maint
commit
540aaa607c
|
@ -4270,7 +4270,7 @@ So, look into `builtin/cat-file.c`, search for `cmd_cat_file()` and look what
|
||||||
it does.
|
it does.
|
||||||
|
|
||||||
------------------------------------------------------------------
|
------------------------------------------------------------------
|
||||||
git_config(git_default_config);
|
repo_config(the_repository, git_default_config);
|
||||||
if (argc != 3)
|
if (argc != 3)
|
||||||
usage("git cat-file [-t|-s|-e|-p|<type>] <sha1>");
|
usage("git cat-file [-t|-s|-e|-p|<type>] <sha1>");
|
||||||
if (get_sha1(argv[2], sha1))
|
if (get_sha1(argv[2], sha1))
|
||||||
|
|
6
apply.c
6
apply.c
|
@ -48,9 +48,9 @@ struct gitdiff_data {
|
||||||
|
|
||||||
static void git_apply_config(void)
|
static void git_apply_config(void)
|
||||||
{
|
{
|
||||||
git_config_get_string("apply.whitespace", &apply_default_whitespace);
|
repo_config_get_string(the_repository, "apply.whitespace", &apply_default_whitespace);
|
||||||
git_config_get_string("apply.ignorewhitespace", &apply_default_ignorewhitespace);
|
repo_config_get_string(the_repository, "apply.ignorewhitespace", &apply_default_ignorewhitespace);
|
||||||
git_config(git_xmerge_config, NULL);
|
repo_config(the_repository, git_xmerge_config, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int parse_whitespace_option(struct apply_state *state, const char *option)
|
static int parse_whitespace_option(struct apply_state *state, const char *option)
|
||||||
|
|
|
@ -537,7 +537,7 @@ void init_tar_archiver(void)
|
||||||
tar_filter_config("tar.tgz.remote", "true", NULL);
|
tar_filter_config("tar.tgz.remote", "true", NULL);
|
||||||
tar_filter_config("tar.tar.gz.command", internal_gzip_command, NULL);
|
tar_filter_config("tar.tar.gz.command", internal_gzip_command, NULL);
|
||||||
tar_filter_config("tar.tar.gz.remote", "true", NULL);
|
tar_filter_config("tar.tar.gz.remote", "true", NULL);
|
||||||
git_config(git_tar_config, NULL);
|
repo_config(the_repository, git_tar_config, NULL);
|
||||||
for (i = 0; i < nr_tar_filters; i++) {
|
for (i = 0; i < nr_tar_filters; i++) {
|
||||||
/* omit any filters that never had a command configured */
|
/* omit any filters that never had a command configured */
|
||||||
if (tar_filters[i]->filter_command)
|
if (tar_filters[i]->filter_command)
|
||||||
|
|
|
@ -632,7 +632,7 @@ static int write_zip_archive(const struct archiver *ar UNUSED,
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
git_config(archive_zip_config, NULL);
|
repo_config(the_repository, archive_zip_config, NULL);
|
||||||
|
|
||||||
dos_time(&args->time, &zip_date, &zip_time);
|
dos_time(&args->time, &zip_date, &zip_time);
|
||||||
|
|
||||||
|
|
|
@ -760,8 +760,8 @@ int write_archive(int argc, const char **argv, const char *prefix,
|
||||||
const char **argv_copy;
|
const char **argv_copy;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
git_config_get_bool("uploadarchive.allowunreachable", &remote_allow_unreachable);
|
repo_config_get_bool(the_repository, "uploadarchive.allowunreachable", &remote_allow_unreachable);
|
||||||
git_config(git_default_config, NULL);
|
repo_config(the_repository, git_default_config, NULL);
|
||||||
|
|
||||||
describe_status.max_invocations = 1;
|
describe_status.max_invocations = 1;
|
||||||
ctx.date_mode.type = DATE_NORMAL;
|
ctx.date_mode.type = DATE_NORMAL;
|
||||||
|
|
10
branch.c
10
branch.c
|
@ -116,7 +116,7 @@ static int install_branch_config_multiple_remotes(int flag, const char *local,
|
||||||
}
|
}
|
||||||
|
|
||||||
strbuf_addf(&key, "branch.%s.remote", local);
|
strbuf_addf(&key, "branch.%s.remote", local);
|
||||||
if (git_config_set_gently(key.buf, origin ? origin : ".") < 0)
|
if (repo_config_set_gently(the_repository, key.buf, origin ? origin : ".") < 0)
|
||||||
goto out_err;
|
goto out_err;
|
||||||
|
|
||||||
strbuf_reset(&key);
|
strbuf_reset(&key);
|
||||||
|
@ -127,16 +127,16 @@ static int install_branch_config_multiple_remotes(int flag, const char *local,
|
||||||
* more than one is provided, use CONFIG_REGEX_NONE to preserve what
|
* more than one is provided, use CONFIG_REGEX_NONE to preserve what
|
||||||
* we've written so far.
|
* we've written so far.
|
||||||
*/
|
*/
|
||||||
if (git_config_set_gently(key.buf, NULL) < 0)
|
if (repo_config_set_gently(the_repository, key.buf, NULL) < 0)
|
||||||
goto out_err;
|
goto out_err;
|
||||||
for_each_string_list_item(item, remotes)
|
for_each_string_list_item(item, remotes)
|
||||||
if (git_config_set_multivar_gently(key.buf, item->string, CONFIG_REGEX_NONE, 0) < 0)
|
if (repo_config_set_multivar_gently(the_repository, key.buf, item->string, CONFIG_REGEX_NONE, 0) < 0)
|
||||||
goto out_err;
|
goto out_err;
|
||||||
|
|
||||||
if (rebasing) {
|
if (rebasing) {
|
||||||
strbuf_reset(&key);
|
strbuf_reset(&key);
|
||||||
strbuf_addf(&key, "branch.%s.rebase", local);
|
strbuf_addf(&key, "branch.%s.rebase", local);
|
||||||
if (git_config_set_gently(key.buf, "true") < 0)
|
if (repo_config_set_gently(the_repository, key.buf, "true") < 0)
|
||||||
goto out_err;
|
goto out_err;
|
||||||
}
|
}
|
||||||
strbuf_release(&key);
|
strbuf_release(&key);
|
||||||
|
@ -355,7 +355,7 @@ int read_branch_desc(struct strbuf *buf, const char *branch_name)
|
||||||
char *v = NULL;
|
char *v = NULL;
|
||||||
struct strbuf name = STRBUF_INIT;
|
struct strbuf name = STRBUF_INIT;
|
||||||
strbuf_addf(&name, "branch.%s.description", branch_name);
|
strbuf_addf(&name, "branch.%s.description", branch_name);
|
||||||
if (git_config_get_string(name.buf, &v)) {
|
if (repo_config_get_string(the_repository, name.buf, &v)) {
|
||||||
strbuf_release(&name);
|
strbuf_release(&name);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
#include "builtin.h"
|
#include "builtin.h"
|
||||||
#include "advice.h"
|
#include "advice.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
#include "environment.h"
|
||||||
#include "lockfile.h"
|
#include "lockfile.h"
|
||||||
#include "editor.h"
|
#include "editor.h"
|
||||||
#include "dir.h"
|
#include "dir.h"
|
||||||
|
|
10
builtin/am.c
10
builtin/am.c
|
@ -162,18 +162,18 @@ static void am_state_init(struct am_state *state)
|
||||||
|
|
||||||
state->prec = 4;
|
state->prec = 4;
|
||||||
|
|
||||||
git_config_get_bool("am.threeway", &state->threeway);
|
repo_config_get_bool(the_repository, "am.threeway", &state->threeway);
|
||||||
|
|
||||||
state->utf8 = 1;
|
state->utf8 = 1;
|
||||||
|
|
||||||
git_config_get_bool("am.messageid", &state->message_id);
|
repo_config_get_bool(the_repository, "am.messageid", &state->message_id);
|
||||||
|
|
||||||
state->scissors = SCISSORS_UNSET;
|
state->scissors = SCISSORS_UNSET;
|
||||||
state->quoted_cr = quoted_cr_unset;
|
state->quoted_cr = quoted_cr_unset;
|
||||||
|
|
||||||
strvec_init(&state->git_apply_opts);
|
strvec_init(&state->git_apply_opts);
|
||||||
|
|
||||||
if (!git_config_get_bool("commit.gpgsign", &gpgsign))
|
if (!repo_config_get_bool(the_repository, "commit.gpgsign", &gpgsign))
|
||||||
state->sign_commit = gpgsign ? "" : NULL;
|
state->sign_commit = gpgsign ? "" : NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -965,7 +965,7 @@ static int split_mail(struct am_state *state, enum patch_format patch_format,
|
||||||
{
|
{
|
||||||
if (keep_cr < 0) {
|
if (keep_cr < 0) {
|
||||||
keep_cr = 0;
|
keep_cr = 0;
|
||||||
git_config_get_bool("am.keepcr", &keep_cr);
|
repo_config_get_bool(the_repository, "am.keepcr", &keep_cr);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (patch_format) {
|
switch (patch_format) {
|
||||||
|
@ -2445,7 +2445,7 @@ int cmd_am(int argc,
|
||||||
|
|
||||||
show_usage_with_options_if_asked(argc, argv, usage, options);
|
show_usage_with_options_if_asked(argc, argv, usage, options);
|
||||||
|
|
||||||
git_config(git_default_config, NULL);
|
repo_config(the_repository, git_default_config, NULL);
|
||||||
|
|
||||||
am_state_init(&state);
|
am_state_init(&state);
|
||||||
|
|
||||||
|
|
|
@ -940,7 +940,7 @@ int cmd_blame(int argc,
|
||||||
const char *const *opt_usage = cmd_is_annotate ? annotate_opt_usage : blame_opt_usage;
|
const char *const *opt_usage = cmd_is_annotate ? annotate_opt_usage : blame_opt_usage;
|
||||||
|
|
||||||
setup_default_color_by_age();
|
setup_default_color_by_age();
|
||||||
git_config(git_blame_config, &output_option);
|
repo_config(the_repository, git_blame_config, &output_option);
|
||||||
repo_init_revisions(the_repository, &revs, NULL);
|
repo_init_revisions(the_repository, &revs, NULL);
|
||||||
revs.date_mode = blame_date_mode;
|
revs.date_mode = blame_date_mode;
|
||||||
revs.diffopt.flags.allow_textconv = 1;
|
revs.diffopt.flags.allow_textconv = 1;
|
||||||
|
|
|
@ -699,7 +699,7 @@ static int edit_branch_description(const char *branch_name)
|
||||||
|
|
||||||
strbuf_addf(&name, "branch.%s.description", branch_name);
|
strbuf_addf(&name, "branch.%s.description", branch_name);
|
||||||
if (buf.len || exists)
|
if (buf.len || exists)
|
||||||
git_config_set(name.buf, buf.len ? buf.buf : NULL);
|
repo_config_set(the_repository, name.buf, buf.len ? buf.buf : NULL);
|
||||||
strbuf_release(&name);
|
strbuf_release(&name);
|
||||||
strbuf_release(&buf);
|
strbuf_release(&buf);
|
||||||
|
|
||||||
|
@ -791,7 +791,7 @@ int cmd_branch(int argc,
|
||||||
* Try to set sort keys from config. If config does not set any,
|
* Try to set sort keys from config. If config does not set any,
|
||||||
* fall back on default (refname) sorting.
|
* fall back on default (refname) sorting.
|
||||||
*/
|
*/
|
||||||
git_config(git_branch_config, &sorting_options);
|
repo_config(the_repository, git_branch_config, &sorting_options);
|
||||||
if (!sorting_options.nr)
|
if (!sorting_options.nr)
|
||||||
string_list_append(&sorting_options, "refname");
|
string_list_append(&sorting_options, "refname");
|
||||||
|
|
||||||
|
@ -987,10 +987,10 @@ int cmd_branch(int argc,
|
||||||
|
|
||||||
strbuf_reset(&buf);
|
strbuf_reset(&buf);
|
||||||
strbuf_addf(&buf, "branch.%s.remote", branch->name);
|
strbuf_addf(&buf, "branch.%s.remote", branch->name);
|
||||||
git_config_set_multivar(buf.buf, NULL, NULL, CONFIG_FLAGS_MULTI_REPLACE);
|
repo_config_set_multivar(the_repository, buf.buf, NULL, NULL, CONFIG_FLAGS_MULTI_REPLACE);
|
||||||
strbuf_reset(&buf);
|
strbuf_reset(&buf);
|
||||||
strbuf_addf(&buf, "branch.%s.merge", branch->name);
|
strbuf_addf(&buf, "branch.%s.merge", branch->name);
|
||||||
git_config_set_multivar(buf.buf, NULL, NULL, CONFIG_FLAGS_MULTI_REPLACE);
|
repo_config_set_multivar(the_repository, buf.buf, NULL, NULL, CONFIG_FLAGS_MULTI_REPLACE);
|
||||||
strbuf_release(&buf);
|
strbuf_release(&buf);
|
||||||
} else if (!noncreate_actions && argc > 0 && argc <= 2) {
|
} else if (!noncreate_actions && argc > 0 && argc <= 2) {
|
||||||
const char *branch_name = argv[0];
|
const char *branch_name = argv[0];
|
||||||
|
|
|
@ -1095,7 +1095,7 @@ int cmd_cat_file(int argc,
|
||||||
OPT_END()
|
OPT_END()
|
||||||
};
|
};
|
||||||
|
|
||||||
git_config(git_cat_file_config, NULL);
|
repo_config(the_repository, git_cat_file_config, NULL);
|
||||||
|
|
||||||
batch.buffer_output = -1;
|
batch.buffer_output = -1;
|
||||||
|
|
||||||
|
|
|
@ -119,7 +119,7 @@ int cmd_check_attr(int argc,
|
||||||
if (!is_bare_repository())
|
if (!is_bare_repository())
|
||||||
setup_work_tree();
|
setup_work_tree();
|
||||||
|
|
||||||
git_config(git_default_config, NULL);
|
repo_config(the_repository, git_default_config, NULL);
|
||||||
|
|
||||||
argc = parse_options(argc, argv, prefix, check_attr_options,
|
argc = parse_options(argc, argv, prefix, check_attr_options,
|
||||||
check_attr_usage, PARSE_OPT_KEEP_DASHDASH);
|
check_attr_usage, PARSE_OPT_KEEP_DASHDASH);
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
#include "builtin.h"
|
#include "builtin.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "dir.h"
|
#include "dir.h"
|
||||||
|
#include "environment.h"
|
||||||
#include "gettext.h"
|
#include "gettext.h"
|
||||||
#include "quote.h"
|
#include "quote.h"
|
||||||
#include "pathspec.h"
|
#include "pathspec.h"
|
||||||
|
@ -159,7 +160,7 @@ int cmd_check_ignore(int argc,
|
||||||
int num_ignored;
|
int num_ignored;
|
||||||
struct dir_struct dir = DIR_INIT;
|
struct dir_struct dir = DIR_INIT;
|
||||||
|
|
||||||
git_config(git_default_config, NULL);
|
repo_config(the_repository, git_default_config, NULL);
|
||||||
|
|
||||||
argc = parse_options(argc, argv, prefix, check_ignore_options,
|
argc = parse_options(argc, argv, prefix, check_ignore_options,
|
||||||
check_ignore_usage, 0);
|
check_ignore_usage, 0);
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#define USE_THE_REPOSITORY_VARIABLE
|
#define USE_THE_REPOSITORY_VARIABLE
|
||||||
#include "builtin.h"
|
#include "builtin.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
#include "environment.h"
|
||||||
#include "gettext.h"
|
#include "gettext.h"
|
||||||
#include "ident.h"
|
#include "ident.h"
|
||||||
#include "mailmap.h"
|
#include "mailmap.h"
|
||||||
|
@ -56,7 +57,7 @@ int cmd_check_mailmap(int argc,
|
||||||
int i;
|
int i;
|
||||||
struct string_list mailmap = STRING_LIST_INIT_NODUP;
|
struct string_list mailmap = STRING_LIST_INIT_NODUP;
|
||||||
|
|
||||||
git_config(git_default_config, NULL);
|
repo_config(the_repository, git_default_config, NULL);
|
||||||
argc = parse_options(argc, argv, prefix, check_mailmap_options,
|
argc = parse_options(argc, argv, prefix, check_mailmap_options,
|
||||||
check_mailmap_usage, 0);
|
check_mailmap_usage, 0);
|
||||||
if (argc == 0 && !use_stdin)
|
if (argc == 0 && !use_stdin)
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
#include "builtin.h"
|
#include "builtin.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "entry.h"
|
#include "entry.h"
|
||||||
|
#include "environment.h"
|
||||||
#include "gettext.h"
|
#include "gettext.h"
|
||||||
#include "parallel-checkout.h"
|
#include "parallel-checkout.h"
|
||||||
#include "parse-options.h"
|
#include "parse-options.h"
|
||||||
|
@ -132,7 +133,7 @@ int cmd_checkout__worker(int argc,
|
||||||
checkout_worker_usage,
|
checkout_worker_usage,
|
||||||
checkout_worker_options);
|
checkout_worker_options);
|
||||||
|
|
||||||
git_config(git_default_config, NULL);
|
repo_config(the_repository, git_default_config, NULL);
|
||||||
argc = parse_options(argc, argv, prefix, checkout_worker_options,
|
argc = parse_options(argc, argv, prefix, checkout_worker_options,
|
||||||
checkout_worker_usage, 0);
|
checkout_worker_usage, 0);
|
||||||
if (argc > 0)
|
if (argc > 0)
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
|
|
||||||
#include "builtin.h"
|
#include "builtin.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
#include "environment.h"
|
||||||
#include "gettext.h"
|
#include "gettext.h"
|
||||||
#include "lockfile.h"
|
#include "lockfile.h"
|
||||||
#include "quote.h"
|
#include "quote.h"
|
||||||
|
|
|
@ -291,7 +291,7 @@ static int checkout_merged(int pos, const struct checkout *state,
|
||||||
read_mmblob(&ours, &threeway[1]);
|
read_mmblob(&ours, &threeway[1]);
|
||||||
read_mmblob(&theirs, &threeway[2]);
|
read_mmblob(&theirs, &threeway[2]);
|
||||||
|
|
||||||
git_config_get_bool("merge.renormalize", &renormalize);
|
repo_config_get_bool(the_repository, "merge.renormalize", &renormalize);
|
||||||
ll_opts.renormalize = renormalize;
|
ll_opts.renormalize = renormalize;
|
||||||
ll_opts.conflict_style = conflict_style;
|
ll_opts.conflict_style = conflict_style;
|
||||||
merge_status = ll_merge(&result_buf, path, &ancestor, "base",
|
merge_status = ll_merge(&result_buf, path, &ancestor, "base",
|
||||||
|
@ -1764,7 +1764,7 @@ static int checkout_main(int argc, const char **argv, const char *prefix,
|
||||||
opts->prefix = prefix;
|
opts->prefix = prefix;
|
||||||
opts->show_progress = -1;
|
opts->show_progress = -1;
|
||||||
|
|
||||||
git_config(git_checkout_config, opts);
|
repo_config(the_repository, git_checkout_config, opts);
|
||||||
if (the_repository->gitdir) {
|
if (the_repository->gitdir) {
|
||||||
prepare_repo_settings(the_repository);
|
prepare_repo_settings(the_repository);
|
||||||
the_repository->settings.command_requires_full_index = 0;
|
the_repository->settings.command_requires_full_index = 0;
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
#include "abspath.h"
|
#include "abspath.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "dir.h"
|
#include "dir.h"
|
||||||
|
#include "environment.h"
|
||||||
#include "gettext.h"
|
#include "gettext.h"
|
||||||
#include "parse-options.h"
|
#include "parse-options.h"
|
||||||
#include "path.h"
|
#include "path.h"
|
||||||
|
@ -949,7 +950,7 @@ int cmd_clean(int argc,
|
||||||
OPT_END()
|
OPT_END()
|
||||||
};
|
};
|
||||||
|
|
||||||
git_config(git_clean_config, NULL);
|
repo_config(the_repository, git_clean_config, NULL);
|
||||||
|
|
||||||
argc = parse_options(argc, argv, prefix, options, builtin_clean_usage,
|
argc = parse_options(argc, argv, prefix, options, builtin_clean_usage,
|
||||||
0);
|
0);
|
||||||
|
|
|
@ -762,16 +762,16 @@ static int write_one_config(const char *key, const char *value,
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* give git_clone_config a chance to write config values back to the
|
* give git_clone_config a chance to write config values back to the
|
||||||
* environment, since git_config_set_multivar_gently only deals with
|
* environment, since repo_config_set_multivar_gently only deals with
|
||||||
* config-file writes
|
* config-file writes
|
||||||
*/
|
*/
|
||||||
int apply_failed = git_clone_config(key, value, ctx, data);
|
int apply_failed = git_clone_config(key, value, ctx, data);
|
||||||
if (apply_failed)
|
if (apply_failed)
|
||||||
return apply_failed;
|
return apply_failed;
|
||||||
|
|
||||||
return git_config_set_multivar_gently(key,
|
return repo_config_set_multivar_gently(the_repository, key,
|
||||||
value ? value : "true",
|
value ? value : "true",
|
||||||
CONFIG_REGEX_NONE, 0);
|
CONFIG_REGEX_NONE, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void write_config(struct string_list *config)
|
static void write_config(struct string_list *config)
|
||||||
|
@ -822,12 +822,12 @@ static void write_refspec_config(const char *src_ref_prefix,
|
||||||
/* Configure the remote */
|
/* Configure the remote */
|
||||||
if (value.len) {
|
if (value.len) {
|
||||||
strbuf_addf(&key, "remote.%s.fetch", remote_name);
|
strbuf_addf(&key, "remote.%s.fetch", remote_name);
|
||||||
git_config_set_multivar(key.buf, value.buf, "^$", 0);
|
repo_config_set_multivar(the_repository, key.buf, value.buf, "^$", 0);
|
||||||
strbuf_reset(&key);
|
strbuf_reset(&key);
|
||||||
|
|
||||||
if (option_mirror) {
|
if (option_mirror) {
|
||||||
strbuf_addf(&key, "remote.%s.mirror", remote_name);
|
strbuf_addf(&key, "remote.%s.mirror", remote_name);
|
||||||
git_config_set(key.buf, "true");
|
repo_config_set(the_repository, key.buf, "true");
|
||||||
strbuf_reset(&key);
|
strbuf_reset(&key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1001,7 +1001,7 @@ int cmd_clone(int argc,
|
||||||
|
|
||||||
packet_trace_identity("clone");
|
packet_trace_identity("clone");
|
||||||
|
|
||||||
git_config(git_clone_config, NULL);
|
repo_config(the_repository, git_clone_config, NULL);
|
||||||
|
|
||||||
argc = parse_options(argc, argv, prefix, builtin_clone_options,
|
argc = parse_options(argc, argv, prefix, builtin_clone_options,
|
||||||
builtin_clone_usage, 0);
|
builtin_clone_usage, 0);
|
||||||
|
@ -1150,7 +1150,7 @@ int cmd_clone(int argc,
|
||||||
strbuf_reset(&sb);
|
strbuf_reset(&sb);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!git_config_get_bool("submodule.stickyRecursiveClone", &val) &&
|
if (!repo_config_get_bool(the_repository, "submodule.stickyRecursiveClone", &val) &&
|
||||||
val)
|
val)
|
||||||
string_list_append(&option_config, "submodule.recurse=true");
|
string_list_append(&option_config, "submodule.recurse=true");
|
||||||
|
|
||||||
|
@ -1242,7 +1242,7 @@ int cmd_clone(int argc,
|
||||||
* re-read config after init_db and write_config to pick up any config
|
* re-read config after init_db and write_config to pick up any config
|
||||||
* injected by --template and --config, respectively.
|
* injected by --template and --config, respectively.
|
||||||
*/
|
*/
|
||||||
git_config(git_clone_config, NULL);
|
repo_config(the_repository, git_clone_config, NULL);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If option_reject_shallow is specified from CLI option,
|
* If option_reject_shallow is specified from CLI option,
|
||||||
|
@ -1294,18 +1294,18 @@ int cmd_clone(int argc,
|
||||||
src_ref_prefix = "refs/";
|
src_ref_prefix = "refs/";
|
||||||
strbuf_addstr(&branch_top, src_ref_prefix);
|
strbuf_addstr(&branch_top, src_ref_prefix);
|
||||||
|
|
||||||
git_config_set("core.bare", "true");
|
repo_config_set(the_repository, "core.bare", "true");
|
||||||
} else if (!option_rev) {
|
} else if (!option_rev) {
|
||||||
strbuf_addf(&branch_top, "refs/remotes/%s/", remote_name);
|
strbuf_addf(&branch_top, "refs/remotes/%s/", remote_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
strbuf_addf(&key, "remote.%s.url", remote_name);
|
strbuf_addf(&key, "remote.%s.url", remote_name);
|
||||||
git_config_set(key.buf, repo);
|
repo_config_set(the_repository, key.buf, repo);
|
||||||
strbuf_reset(&key);
|
strbuf_reset(&key);
|
||||||
|
|
||||||
if (!option_tags) {
|
if (!option_tags) {
|
||||||
strbuf_addf(&key, "remote.%s.tagOpt", remote_name);
|
strbuf_addf(&key, "remote.%s.tagOpt", remote_name);
|
||||||
git_config_set(key.buf, "--no-tags");
|
repo_config_set(the_repository, key.buf, "--no-tags");
|
||||||
strbuf_reset(&key);
|
strbuf_reset(&key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1467,7 +1467,7 @@ int cmd_clone(int argc,
|
||||||
warning(_("failed to fetch objects from bundle URI '%s'"),
|
warning(_("failed to fetch objects from bundle URI '%s'"),
|
||||||
bundle_uri);
|
bundle_uri);
|
||||||
else if (has_heuristic)
|
else if (has_heuristic)
|
||||||
git_config_set_gently("fetch.bundleuri", bundle_uri);
|
repo_config_set_gently(the_repository, "fetch.bundleuri", bundle_uri);
|
||||||
|
|
||||||
remote_state_clear(the_repository->remote_state);
|
remote_state_clear(the_repository->remote_state);
|
||||||
free(the_repository->remote_state);
|
free(the_repository->remote_state);
|
||||||
|
|
|
@ -42,9 +42,9 @@ int cmd_column(int argc,
|
||||||
/* This one is special and must be the first one */
|
/* This one is special and must be the first one */
|
||||||
if (argc > 1 && starts_with(argv[1], "--command=")) {
|
if (argc > 1 && starts_with(argv[1], "--command=")) {
|
||||||
command = argv[1] + 10;
|
command = argv[1] + 10;
|
||||||
git_config(column_config, (void *)command);
|
repo_config(the_repository, column_config, (void *)command);
|
||||||
} else
|
} else
|
||||||
git_config(column_config, NULL);
|
repo_config(the_repository, column_config, NULL);
|
||||||
|
|
||||||
memset(&copts, 0, sizeof(copts));
|
memset(&copts, 0, sizeof(copts));
|
||||||
copts.padding = 1;
|
copts.padding = 1;
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
#include "builtin.h"
|
#include "builtin.h"
|
||||||
#include "commit.h"
|
#include "commit.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
#include "environment.h"
|
||||||
#include "gettext.h"
|
#include "gettext.h"
|
||||||
#include "hex.h"
|
#include "hex.h"
|
||||||
#include "parse-options.h"
|
#include "parse-options.h"
|
||||||
|
@ -265,7 +266,7 @@ static int graph_write(int argc, const char **argv, const char *prefix,
|
||||||
|
|
||||||
trace2_cmd_mode("write");
|
trace2_cmd_mode("write");
|
||||||
|
|
||||||
git_config(git_commit_graph_write_config, &opts);
|
repo_config(the_repository, git_commit_graph_write_config, &opts);
|
||||||
|
|
||||||
argc = parse_options(argc, argv, prefix,
|
argc = parse_options(argc, argv, prefix,
|
||||||
options,
|
options,
|
||||||
|
@ -347,7 +348,7 @@ int cmd_commit_graph(int argc,
|
||||||
};
|
};
|
||||||
struct option *options = parse_options_concat(builtin_commit_graph_options, common_opts);
|
struct option *options = parse_options_concat(builtin_commit_graph_options, common_opts);
|
||||||
|
|
||||||
git_config(git_default_config, NULL);
|
repo_config(the_repository, git_default_config, NULL);
|
||||||
|
|
||||||
disable_replace_refs();
|
disable_replace_refs();
|
||||||
save_commit_buffer = 0;
|
save_commit_buffer = 0;
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
#define USE_THE_REPOSITORY_VARIABLE
|
#define USE_THE_REPOSITORY_VARIABLE
|
||||||
#include "builtin.h"
|
#include "builtin.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
#include "environment.h"
|
||||||
#include "gettext.h"
|
#include "gettext.h"
|
||||||
#include "hex.h"
|
#include "hex.h"
|
||||||
#include "object-name.h"
|
#include "object-name.h"
|
||||||
|
@ -125,7 +126,7 @@ int cmd_commit_tree(int argc,
|
||||||
};
|
};
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
git_config(git_default_config, NULL);
|
repo_config(the_repository, git_default_config, NULL);
|
||||||
|
|
||||||
show_usage_with_options_if_asked(argc, argv,
|
show_usage_with_options_if_asked(argc, argv,
|
||||||
commit_tree_usage, options);
|
commit_tree_usage, options);
|
||||||
|
|
|
@ -207,9 +207,9 @@ static void status_init_config(struct wt_status *s, config_fn_t fn)
|
||||||
{
|
{
|
||||||
wt_status_prepare(the_repository, s);
|
wt_status_prepare(the_repository, s);
|
||||||
init_diff_ui_defaults();
|
init_diff_ui_defaults();
|
||||||
git_config(fn, s);
|
repo_config(the_repository, fn, s);
|
||||||
determine_whence(s);
|
determine_whence(s);
|
||||||
s->hints = advice_enabled(ADVICE_STATUS_HINTS); /* must come after git_config() */
|
s->hints = advice_enabled(ADVICE_STATUS_HINTS); /* must come after repo_config() */
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rollback_index_files(void)
|
static void rollback_index_files(void)
|
||||||
|
|
|
@ -966,12 +966,12 @@ static int cmd_config_set(int argc, const char **argv, const char *prefix,
|
||||||
value = normalize_value(argv[0], argv[1], type, &default_kvi);
|
value = normalize_value(argv[0], argv[1], type, &default_kvi);
|
||||||
|
|
||||||
if ((flags & CONFIG_FLAGS_MULTI_REPLACE) || value_pattern) {
|
if ((flags & CONFIG_FLAGS_MULTI_REPLACE) || value_pattern) {
|
||||||
ret = git_config_set_multivar_in_file_gently(location_opts.source.file,
|
ret = repo_config_set_multivar_in_file_gently(the_repository, location_opts.source.file,
|
||||||
argv[0], value, value_pattern,
|
argv[0], value, value_pattern,
|
||||||
comment, flags);
|
comment, flags);
|
||||||
} else {
|
} else {
|
||||||
ret = git_config_set_in_file_gently(location_opts.source.file,
|
ret = repo_config_set_in_file_gently(the_repository, location_opts.source.file,
|
||||||
argv[0], comment, value);
|
argv[0], comment, value);
|
||||||
if (ret == CONFIG_NOTHING_SET)
|
if (ret == CONFIG_NOTHING_SET)
|
||||||
error(_("cannot overwrite multiple values with a single value\n"
|
error(_("cannot overwrite multiple values with a single value\n"
|
||||||
" Use a regexp, --add or --replace-all to change %s."), argv[0]);
|
" Use a regexp, --add or --replace-all to change %s."), argv[0]);
|
||||||
|
@ -1010,12 +1010,12 @@ static int cmd_config_unset(int argc, const char **argv, const char *prefix,
|
||||||
check_write(&location_opts.source);
|
check_write(&location_opts.source);
|
||||||
|
|
||||||
if ((flags & CONFIG_FLAGS_MULTI_REPLACE) || value_pattern)
|
if ((flags & CONFIG_FLAGS_MULTI_REPLACE) || value_pattern)
|
||||||
ret = git_config_set_multivar_in_file_gently(location_opts.source.file,
|
ret = repo_config_set_multivar_in_file_gently(the_repository, location_opts.source.file,
|
||||||
argv[0], NULL, value_pattern,
|
argv[0], NULL, value_pattern,
|
||||||
NULL, flags);
|
NULL, flags);
|
||||||
else
|
else
|
||||||
ret = git_config_set_in_file_gently(location_opts.source.file, argv[0],
|
ret = repo_config_set_in_file_gently(the_repository, location_opts.source.file, argv[0],
|
||||||
NULL, NULL);
|
NULL, NULL);
|
||||||
|
|
||||||
location_options_release(&location_opts);
|
location_options_release(&location_opts);
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -1091,7 +1091,7 @@ static int show_editor(struct config_location_options *opts)
|
||||||
die(_("editing stdin is not supported"));
|
die(_("editing stdin is not supported"));
|
||||||
if (opts->source.blob)
|
if (opts->source.blob)
|
||||||
die(_("editing blobs is not supported"));
|
die(_("editing blobs is not supported"));
|
||||||
git_config(git_default_config, NULL);
|
repo_config(the_repository, git_default_config, NULL);
|
||||||
config_file = opts->source.file ?
|
config_file = opts->source.file ?
|
||||||
xstrdup(opts->source.file) :
|
xstrdup(opts->source.file) :
|
||||||
repo_git_path(the_repository, "config");
|
repo_git_path(the_repository, "config");
|
||||||
|
@ -1296,7 +1296,7 @@ static int cmd_config_actions(int argc, const char **argv, const char *prefix)
|
||||||
check_write(&location_opts.source);
|
check_write(&location_opts.source);
|
||||||
check_argc(argc, 2, 2);
|
check_argc(argc, 2, 2);
|
||||||
value = normalize_value(argv[0], argv[1], display_opts.type, &default_kvi);
|
value = normalize_value(argv[0], argv[1], display_opts.type, &default_kvi);
|
||||||
ret = git_config_set_in_file_gently(location_opts.source.file, argv[0], comment, value);
|
ret = repo_config_set_in_file_gently(the_repository, location_opts.source.file, argv[0], comment, value);
|
||||||
if (ret == CONFIG_NOTHING_SET)
|
if (ret == CONFIG_NOTHING_SET)
|
||||||
error(_("cannot overwrite multiple values with a single value\n"
|
error(_("cannot overwrite multiple values with a single value\n"
|
||||||
" Use a regexp, --add or --replace-all to change %s."), argv[0]);
|
" Use a regexp, --add or --replace-all to change %s."), argv[0]);
|
||||||
|
@ -1305,26 +1305,26 @@ static int cmd_config_actions(int argc, const char **argv, const char *prefix)
|
||||||
check_write(&location_opts.source);
|
check_write(&location_opts.source);
|
||||||
check_argc(argc, 2, 3);
|
check_argc(argc, 2, 3);
|
||||||
value = normalize_value(argv[0], argv[1], display_opts.type, &default_kvi);
|
value = normalize_value(argv[0], argv[1], display_opts.type, &default_kvi);
|
||||||
ret = git_config_set_multivar_in_file_gently(location_opts.source.file,
|
ret = repo_config_set_multivar_in_file_gently(the_repository, location_opts.source.file,
|
||||||
argv[0], value, argv[2],
|
argv[0], value, argv[2],
|
||||||
comment, flags);
|
comment, flags);
|
||||||
}
|
}
|
||||||
else if (actions == ACTION_ADD) {
|
else if (actions == ACTION_ADD) {
|
||||||
check_write(&location_opts.source);
|
check_write(&location_opts.source);
|
||||||
check_argc(argc, 2, 2);
|
check_argc(argc, 2, 2);
|
||||||
value = normalize_value(argv[0], argv[1], display_opts.type, &default_kvi);
|
value = normalize_value(argv[0], argv[1], display_opts.type, &default_kvi);
|
||||||
ret = git_config_set_multivar_in_file_gently(location_opts.source.file,
|
ret = repo_config_set_multivar_in_file_gently(the_repository, location_opts.source.file,
|
||||||
argv[0], value,
|
argv[0], value,
|
||||||
CONFIG_REGEX_NONE,
|
CONFIG_REGEX_NONE,
|
||||||
comment, flags);
|
comment, flags);
|
||||||
}
|
}
|
||||||
else if (actions == ACTION_REPLACE_ALL) {
|
else if (actions == ACTION_REPLACE_ALL) {
|
||||||
check_write(&location_opts.source);
|
check_write(&location_opts.source);
|
||||||
check_argc(argc, 2, 3);
|
check_argc(argc, 2, 3);
|
||||||
value = normalize_value(argv[0], argv[1], display_opts.type, &default_kvi);
|
value = normalize_value(argv[0], argv[1], display_opts.type, &default_kvi);
|
||||||
ret = git_config_set_multivar_in_file_gently(location_opts.source.file,
|
ret = repo_config_set_multivar_in_file_gently(the_repository, location_opts.source.file,
|
||||||
argv[0], value, argv[2],
|
argv[0], value, argv[2],
|
||||||
comment, flags | CONFIG_FLAGS_MULTI_REPLACE);
|
comment, flags | CONFIG_FLAGS_MULTI_REPLACE);
|
||||||
}
|
}
|
||||||
else if (actions == ACTION_GET) {
|
else if (actions == ACTION_GET) {
|
||||||
check_argc(argc, 1, 2);
|
check_argc(argc, 1, 2);
|
||||||
|
@ -1350,19 +1350,19 @@ static int cmd_config_actions(int argc, const char **argv, const char *prefix)
|
||||||
check_write(&location_opts.source);
|
check_write(&location_opts.source);
|
||||||
check_argc(argc, 1, 2);
|
check_argc(argc, 1, 2);
|
||||||
if (argc == 2)
|
if (argc == 2)
|
||||||
ret = git_config_set_multivar_in_file_gently(location_opts.source.file,
|
ret = repo_config_set_multivar_in_file_gently(the_repository, location_opts.source.file,
|
||||||
argv[0], NULL, argv[1],
|
argv[0], NULL, argv[1],
|
||||||
NULL, flags);
|
NULL, flags);
|
||||||
else
|
else
|
||||||
ret = git_config_set_in_file_gently(location_opts.source.file,
|
ret = repo_config_set_in_file_gently(the_repository, location_opts.source.file,
|
||||||
argv[0], NULL, NULL);
|
argv[0], NULL, NULL);
|
||||||
}
|
}
|
||||||
else if (actions == ACTION_UNSET_ALL) {
|
else if (actions == ACTION_UNSET_ALL) {
|
||||||
check_write(&location_opts.source);
|
check_write(&location_opts.source);
|
||||||
check_argc(argc, 1, 2);
|
check_argc(argc, 1, 2);
|
||||||
ret = git_config_set_multivar_in_file_gently(location_opts.source.file,
|
ret = repo_config_set_multivar_in_file_gently(the_repository, location_opts.source.file,
|
||||||
argv[0], NULL, argv[1],
|
argv[0], NULL, argv[1],
|
||||||
NULL, flags | CONFIG_FLAGS_MULTI_REPLACE);
|
NULL, flags | CONFIG_FLAGS_MULTI_REPLACE);
|
||||||
}
|
}
|
||||||
else if (actions == ACTION_RENAME_SECTION) {
|
else if (actions == ACTION_RENAME_SECTION) {
|
||||||
check_write(&location_opts.source);
|
check_write(&location_opts.source);
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
#include "builtin.h"
|
#include "builtin.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "dir.h"
|
#include "dir.h"
|
||||||
|
#include "environment.h"
|
||||||
#include "gettext.h"
|
#include "gettext.h"
|
||||||
#include "path.h"
|
#include "path.h"
|
||||||
#include "parse-options.h"
|
#include "parse-options.h"
|
||||||
|
@ -106,7 +107,7 @@ int cmd_count_objects(int argc,
|
||||||
OPT_END(),
|
OPT_END(),
|
||||||
};
|
};
|
||||||
|
|
||||||
git_config(git_default_config, NULL);
|
repo_config(the_repository, git_default_config, NULL);
|
||||||
|
|
||||||
argc = parse_options(argc, argv, prefix, opts, count_objects_usage, 0);
|
argc = parse_options(argc, argv, prefix, opts, count_objects_usage, 0);
|
||||||
/* we do not take arguments other than flags for now */
|
/* we do not take arguments other than flags for now */
|
||||||
|
|
|
@ -307,7 +307,7 @@ int cmd_credential_cache_daemon(int argc,
|
||||||
OPT_END()
|
OPT_END()
|
||||||
};
|
};
|
||||||
|
|
||||||
git_config_get_bool("credentialcache.ignoresighup", &ignore_sighup);
|
repo_config_get_bool(the_repository, "credentialcache.ignoresighup", &ignore_sighup);
|
||||||
|
|
||||||
argc = parse_options(argc, argv, prefix, options, usage, 0);
|
argc = parse_options(argc, argv, prefix, options, usage, 0);
|
||||||
socket_path = argv[0];
|
socket_path = argv[0];
|
||||||
|
|
|
@ -66,7 +66,7 @@ static void rewrite_credential_file(const char *fn, struct credential *c,
|
||||||
{
|
{
|
||||||
int timeout_ms = 1000;
|
int timeout_ms = 1000;
|
||||||
|
|
||||||
git_config_get_int("credentialstore.locktimeoutms", &timeout_ms);
|
repo_config_get_int(the_repository, "credentialstore.locktimeoutms", &timeout_ms);
|
||||||
if (hold_lock_file_for_update_timeout(&credential_lock, fn, 0, timeout_ms) < 0)
|
if (hold_lock_file_for_update_timeout(&credential_lock, fn, 0, timeout_ms) < 0)
|
||||||
die_errno(_("unable to get credential storage lock in %d ms"), timeout_ms);
|
die_errno(_("unable to get credential storage lock in %d ms"), timeout_ms);
|
||||||
if (extra)
|
if (extra)
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
#include "git-compat-util.h"
|
#include "git-compat-util.h"
|
||||||
#include "credential.h"
|
#include "credential.h"
|
||||||
#include "builtin.h"
|
#include "builtin.h"
|
||||||
|
#include "environment.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
static const char usage_msg[] =
|
static const char usage_msg[] =
|
||||||
|
@ -16,7 +17,7 @@ int cmd_credential(int argc,
|
||||||
const char *op;
|
const char *op;
|
||||||
struct credential c = CREDENTIAL_INIT;
|
struct credential c = CREDENTIAL_INIT;
|
||||||
|
|
||||||
git_config(git_default_config, NULL);
|
repo_config(the_repository, git_default_config, NULL);
|
||||||
|
|
||||||
show_usage_if_asked(argc, argv, usage_msg);
|
show_usage_if_asked(argc, argv, usage_msg);
|
||||||
if (argc != 2)
|
if (argc != 2)
|
||||||
|
|
|
@ -623,7 +623,7 @@ int cmd_describe(int argc,
|
||||||
OPT_END(),
|
OPT_END(),
|
||||||
};
|
};
|
||||||
|
|
||||||
git_config(git_default_config, NULL);
|
repo_config(the_repository, git_default_config, NULL);
|
||||||
argc = parse_options(argc, argv, prefix, options, describe_usage, 0);
|
argc = parse_options(argc, argv, prefix, options, describe_usage, 0);
|
||||||
if (abbrev < 0)
|
if (abbrev < 0)
|
||||||
abbrev = DEFAULT_ABBREV;
|
abbrev = DEFAULT_ABBREV;
|
||||||
|
|
|
@ -31,7 +31,7 @@ int cmd_diff_files(int argc,
|
||||||
|
|
||||||
show_usage_if_asked(argc, argv, diff_files_usage);
|
show_usage_if_asked(argc, argv, diff_files_usage);
|
||||||
|
|
||||||
git_config(git_diff_basic_config, NULL); /* no "diff" UI options */
|
repo_config(the_repository, git_diff_basic_config, NULL); /* no "diff" UI options */
|
||||||
|
|
||||||
prepare_repo_settings(the_repository);
|
prepare_repo_settings(the_repository);
|
||||||
the_repository->settings.command_requires_full_index = 0;
|
the_repository->settings.command_requires_full_index = 0;
|
||||||
|
|
|
@ -28,7 +28,7 @@ int cmd_diff_index(int argc,
|
||||||
|
|
||||||
show_usage_if_asked(argc, argv, diff_cache_usage);
|
show_usage_if_asked(argc, argv, diff_cache_usage);
|
||||||
|
|
||||||
git_config(git_diff_basic_config, NULL); /* no "diff" UI options */
|
repo_config(the_repository, git_diff_basic_config, NULL); /* no "diff" UI options */
|
||||||
|
|
||||||
prepare_repo_settings(the_repository);
|
prepare_repo_settings(the_repository);
|
||||||
the_repository->settings.command_requires_full_index = 0;
|
the_repository->settings.command_requires_full_index = 0;
|
||||||
|
|
|
@ -124,7 +124,7 @@ int cmd_diff_tree(int argc,
|
||||||
|
|
||||||
show_usage_if_asked(argc, argv, diff_tree_usage);
|
show_usage_if_asked(argc, argv, diff_tree_usage);
|
||||||
|
|
||||||
git_config(git_diff_basic_config, NULL); /* no "diff" UI options */
|
repo_config(the_repository, git_diff_basic_config, NULL); /* no "diff" UI options */
|
||||||
|
|
||||||
prepare_repo_settings(the_repository);
|
prepare_repo_settings(the_repository);
|
||||||
the_repository->settings.command_requires_full_index = 0;
|
the_repository->settings.command_requires_full_index = 0;
|
||||||
|
|
|
@ -486,7 +486,7 @@ int cmd_diff(int argc,
|
||||||
repo_set_hash_algo(the_repository, GIT_HASH_DEFAULT);
|
repo_set_hash_algo(the_repository, GIT_HASH_DEFAULT);
|
||||||
|
|
||||||
init_diff_ui_defaults();
|
init_diff_ui_defaults();
|
||||||
git_config(git_diff_ui_config, NULL);
|
repo_config(the_repository, git_diff_ui_config, NULL);
|
||||||
prefix = precompose_argv_prefix(argc, argv, prefix);
|
prefix = precompose_argv_prefix(argc, argv, prefix);
|
||||||
|
|
||||||
repo_init_revisions(the_repository, &rev, prefix);
|
repo_init_revisions(the_repository, &rev, prefix);
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
|
|
||||||
#include "builtin.h"
|
#include "builtin.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
#include "environment.h"
|
||||||
#include "gettext.h"
|
#include "gettext.h"
|
||||||
#include "hex.h"
|
#include "hex.h"
|
||||||
#include "refs.h"
|
#include "refs.h"
|
||||||
|
@ -1361,7 +1362,7 @@ int cmd_fast_export(int argc,
|
||||||
usage_with_options (fast_export_usage, options);
|
usage_with_options (fast_export_usage, options);
|
||||||
|
|
||||||
/* we handle encodings */
|
/* we handle encodings */
|
||||||
git_config(git_default_config, NULL);
|
repo_config(the_repository, git_default_config, NULL);
|
||||||
|
|
||||||
repo_init_revisions(the_repository, &revs, prefix);
|
repo_init_revisions(the_repository, &revs, prefix);
|
||||||
init_revision_sources(&revision_sources);
|
init_revision_sources(&revision_sources);
|
||||||
|
|
|
@ -3592,25 +3592,25 @@ static void git_pack_config(void)
|
||||||
int limit;
|
int limit;
|
||||||
unsigned long packsizelimit_value;
|
unsigned long packsizelimit_value;
|
||||||
|
|
||||||
if (!git_config_get_ulong("pack.depth", &max_depth)) {
|
if (!repo_config_get_ulong(the_repository, "pack.depth", &max_depth)) {
|
||||||
if (max_depth > MAX_DEPTH)
|
if (max_depth > MAX_DEPTH)
|
||||||
max_depth = MAX_DEPTH;
|
max_depth = MAX_DEPTH;
|
||||||
}
|
}
|
||||||
if (!git_config_get_int("pack.indexversion", &indexversion_value)) {
|
if (!repo_config_get_int(the_repository, "pack.indexversion", &indexversion_value)) {
|
||||||
pack_idx_opts.version = indexversion_value;
|
pack_idx_opts.version = indexversion_value;
|
||||||
if (pack_idx_opts.version > 2)
|
if (pack_idx_opts.version > 2)
|
||||||
git_die_config(the_repository, "pack.indexversion",
|
git_die_config(the_repository, "pack.indexversion",
|
||||||
"bad pack.indexVersion=%"PRIu32, pack_idx_opts.version);
|
"bad pack.indexVersion=%"PRIu32, pack_idx_opts.version);
|
||||||
}
|
}
|
||||||
if (!git_config_get_ulong("pack.packsizelimit", &packsizelimit_value))
|
if (!repo_config_get_ulong(the_repository, "pack.packsizelimit", &packsizelimit_value))
|
||||||
max_packsize = packsizelimit_value;
|
max_packsize = packsizelimit_value;
|
||||||
|
|
||||||
if (!git_config_get_int("fastimport.unpacklimit", &limit))
|
if (!repo_config_get_int(the_repository, "fastimport.unpacklimit", &limit))
|
||||||
unpack_limit = limit;
|
unpack_limit = limit;
|
||||||
else if (!git_config_get_int("transfer.unpacklimit", &limit))
|
else if (!repo_config_get_int(the_repository, "transfer.unpacklimit", &limit))
|
||||||
unpack_limit = limit;
|
unpack_limit = limit;
|
||||||
|
|
||||||
git_config(git_default_config, NULL);
|
repo_config(the_repository, git_default_config, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char fast_import_usage[] =
|
static const char fast_import_usage[] =
|
||||||
|
|
|
@ -1995,7 +1995,7 @@ static int add_remote_or_group(const char *name, struct string_list *list)
|
||||||
struct remote_group_data g;
|
struct remote_group_data g;
|
||||||
g.name = name; g.list = list;
|
g.name = name; g.list = list;
|
||||||
|
|
||||||
git_config(get_remote_group, &g);
|
repo_config(the_repository, get_remote_group, &g);
|
||||||
if (list->nr == prev_nr) {
|
if (list->nr == prev_nr) {
|
||||||
struct remote *remote = remote_get(name);
|
struct remote *remote = remote_get(name);
|
||||||
if (!remote_is_configured(remote, 0))
|
if (!remote_is_configured(remote, 0))
|
||||||
|
@ -2417,7 +2417,7 @@ int cmd_fetch(int argc,
|
||||||
free(anon);
|
free(anon);
|
||||||
}
|
}
|
||||||
|
|
||||||
git_config(git_fetch_config, &config);
|
repo_config(the_repository, git_fetch_config, &config);
|
||||||
if (the_repository->gitdir) {
|
if (the_repository->gitdir) {
|
||||||
prepare_repo_settings(the_repository);
|
prepare_repo_settings(the_repository);
|
||||||
the_repository->settings.command_requires_full_index = 0;
|
the_repository->settings.command_requires_full_index = 0;
|
||||||
|
@ -2508,7 +2508,7 @@ int cmd_fetch(int argc,
|
||||||
if (!max_jobs)
|
if (!max_jobs)
|
||||||
max_jobs = online_cpus();
|
max_jobs = online_cpus();
|
||||||
|
|
||||||
if (!git_config_get_string_tmp("fetch.bundleuri", &bundle_uri) &&
|
if (!repo_config_get_string_tmp(the_repository, "fetch.bundleuri", &bundle_uri) &&
|
||||||
fetch_bundle_uri(the_repository, bundle_uri, NULL))
|
fetch_bundle_uri(the_repository, bundle_uri, NULL))
|
||||||
warning(_("failed to fetch bundles from '%s'"), bundle_uri);
|
warning(_("failed to fetch bundles from '%s'"), bundle_uri);
|
||||||
|
|
||||||
|
@ -2683,12 +2683,12 @@ int cmd_fetch(int argc,
|
||||||
* but respect config settings disabling it.
|
* but respect config settings disabling it.
|
||||||
*/
|
*/
|
||||||
int opt_val;
|
int opt_val;
|
||||||
if (git_config_get_int("gc.autopacklimit", &opt_val))
|
if (repo_config_get_int(the_repository, "gc.autopacklimit", &opt_val))
|
||||||
opt_val = -1;
|
opt_val = -1;
|
||||||
if (opt_val != 0)
|
if (opt_val != 0)
|
||||||
git_config_push_parameter("gc.autoPackLimit=1");
|
git_config_push_parameter("gc.autoPackLimit=1");
|
||||||
|
|
||||||
if (git_config_get_int("maintenance.incremental-repack.auto", &opt_val))
|
if (repo_config_get_int(the_repository, "maintenance.incremental-repack.auto", &opt_val))
|
||||||
opt_val = -1;
|
opt_val = -1;
|
||||||
if (opt_val != 0)
|
if (opt_val != 0)
|
||||||
git_config_push_parameter("maintenance.incremental-repack.auto=-1");
|
git_config_push_parameter("maintenance.incremental-repack.auto=-1");
|
||||||
|
|
|
@ -53,7 +53,7 @@ int cmd_fmt_merge_msg(int argc,
|
||||||
int ret;
|
int ret;
|
||||||
struct fmt_merge_msg_opts opts;
|
struct fmt_merge_msg_opts opts;
|
||||||
|
|
||||||
git_config(fmt_merge_msg_config, NULL);
|
repo_config(the_repository, fmt_merge_msg_config, NULL);
|
||||||
argc = parse_options(argc, argv, prefix, options, fmt_merge_msg_usage,
|
argc = parse_options(argc, argv, prefix, options, fmt_merge_msg_usage,
|
||||||
0);
|
0);
|
||||||
if (argc > 0)
|
if (argc > 0)
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include "builtin.h"
|
#include "builtin.h"
|
||||||
#include "commit.h"
|
#include "commit.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
#include "environment.h"
|
||||||
#include "gettext.h"
|
#include "gettext.h"
|
||||||
#include "object.h"
|
#include "object.h"
|
||||||
#include "parse-options.h"
|
#include "parse-options.h"
|
||||||
|
|
|
@ -987,7 +987,7 @@ int cmd_fsck(int argc,
|
||||||
if (name_objects)
|
if (name_objects)
|
||||||
fsck_enable_object_names(&fsck_walk_options);
|
fsck_enable_object_names(&fsck_walk_options);
|
||||||
|
|
||||||
git_config(git_fsck_config, &fsck_obj_options);
|
repo_config(the_repository, git_fsck_config, &fsck_obj_options);
|
||||||
prepare_repo_settings(the_repository);
|
prepare_repo_settings(the_repository);
|
||||||
|
|
||||||
if (check_references)
|
if (check_references)
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#include "abspath.h"
|
#include "abspath.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "dir.h"
|
#include "dir.h"
|
||||||
|
#include "environment.h"
|
||||||
#include "gettext.h"
|
#include "gettext.h"
|
||||||
#include "parse-options.h"
|
#include "parse-options.h"
|
||||||
#include "fsmonitor-ll.h"
|
#include "fsmonitor-ll.h"
|
||||||
|
@ -1547,7 +1548,7 @@ int cmd_fsmonitor__daemon(int argc,
|
||||||
OPT_END()
|
OPT_END()
|
||||||
};
|
};
|
||||||
|
|
||||||
git_config(fsmonitor_config, NULL);
|
repo_config(the_repository, fsmonitor_config, NULL);
|
||||||
|
|
||||||
argc = parse_options(argc, argv, prefix, options,
|
argc = parse_options(argc, argv, prefix, options,
|
||||||
builtin_fsmonitor__daemon_usage, 0);
|
builtin_fsmonitor__daemon_usage, 0);
|
||||||
|
|
70
builtin/gc.c
70
builtin/gc.c
|
@ -114,7 +114,7 @@ static int gc_config_is_timestamp_never(const char *var)
|
||||||
const char *value;
|
const char *value;
|
||||||
timestamp_t expire;
|
timestamp_t expire;
|
||||||
|
|
||||||
if (!git_config_get_value(var, &value) && value) {
|
if (!repo_config_get_value(the_repository, var, &value) && value) {
|
||||||
if (parse_expiry_date(value, &expire))
|
if (parse_expiry_date(value, &expire))
|
||||||
die(_("failed to parse '%s' value '%s'"), var, value);
|
die(_("failed to parse '%s' value '%s'"), var, value);
|
||||||
return expire == 0;
|
return expire == 0;
|
||||||
|
@ -178,7 +178,7 @@ static void gc_config(struct gc_config *cfg)
|
||||||
char *owned = NULL;
|
char *owned = NULL;
|
||||||
unsigned long ulongval;
|
unsigned long ulongval;
|
||||||
|
|
||||||
if (!git_config_get_value("gc.packrefs", &value)) {
|
if (!repo_config_get_value(the_repository, "gc.packrefs", &value)) {
|
||||||
if (value && !strcmp(value, "notbare"))
|
if (value && !strcmp(value, "notbare"))
|
||||||
cfg->pack_refs = -1;
|
cfg->pack_refs = -1;
|
||||||
else
|
else
|
||||||
|
@ -189,13 +189,13 @@ static void gc_config(struct gc_config *cfg)
|
||||||
gc_config_is_timestamp_never("gc.reflogexpireunreachable"))
|
gc_config_is_timestamp_never("gc.reflogexpireunreachable"))
|
||||||
cfg->prune_reflogs = 0;
|
cfg->prune_reflogs = 0;
|
||||||
|
|
||||||
git_config_get_int("gc.aggressivewindow", &cfg->aggressive_window);
|
repo_config_get_int(the_repository, "gc.aggressivewindow", &cfg->aggressive_window);
|
||||||
git_config_get_int("gc.aggressivedepth", &cfg->aggressive_depth);
|
repo_config_get_int(the_repository, "gc.aggressivedepth", &cfg->aggressive_depth);
|
||||||
git_config_get_int("gc.auto", &cfg->gc_auto_threshold);
|
repo_config_get_int(the_repository, "gc.auto", &cfg->gc_auto_threshold);
|
||||||
git_config_get_int("gc.autopacklimit", &cfg->gc_auto_pack_limit);
|
repo_config_get_int(the_repository, "gc.autopacklimit", &cfg->gc_auto_pack_limit);
|
||||||
git_config_get_bool("gc.autodetach", &cfg->detach_auto);
|
repo_config_get_bool(the_repository, "gc.autodetach", &cfg->detach_auto);
|
||||||
git_config_get_bool("gc.cruftpacks", &cfg->cruft_packs);
|
repo_config_get_bool(the_repository, "gc.cruftpacks", &cfg->cruft_packs);
|
||||||
git_config_get_ulong("gc.maxcruftsize", &cfg->max_cruft_size);
|
repo_config_get_ulong(the_repository, "gc.maxcruftsize", &cfg->max_cruft_size);
|
||||||
|
|
||||||
if (!repo_config_get_expiry(the_repository, "gc.pruneexpire", &owned)) {
|
if (!repo_config_get_expiry(the_repository, "gc.pruneexpire", &owned)) {
|
||||||
free(cfg->prune_expire);
|
free(cfg->prune_expire);
|
||||||
|
@ -212,23 +212,23 @@ static void gc_config(struct gc_config *cfg)
|
||||||
cfg->gc_log_expire = owned;
|
cfg->gc_log_expire = owned;
|
||||||
}
|
}
|
||||||
|
|
||||||
git_config_get_ulong("gc.bigpackthreshold", &cfg->big_pack_threshold);
|
repo_config_get_ulong(the_repository, "gc.bigpackthreshold", &cfg->big_pack_threshold);
|
||||||
git_config_get_ulong("pack.deltacachesize", &cfg->max_delta_cache_size);
|
repo_config_get_ulong(the_repository, "pack.deltacachesize", &cfg->max_delta_cache_size);
|
||||||
|
|
||||||
if (!git_config_get_ulong("core.deltabasecachelimit", &ulongval))
|
if (!repo_config_get_ulong(the_repository, "core.deltabasecachelimit", &ulongval))
|
||||||
cfg->delta_base_cache_limit = ulongval;
|
cfg->delta_base_cache_limit = ulongval;
|
||||||
|
|
||||||
if (!git_config_get_string("gc.repackfilter", &owned)) {
|
if (!repo_config_get_string(the_repository, "gc.repackfilter", &owned)) {
|
||||||
free(cfg->repack_filter);
|
free(cfg->repack_filter);
|
||||||
cfg->repack_filter = owned;
|
cfg->repack_filter = owned;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!git_config_get_string("gc.repackfilterto", &owned)) {
|
if (!repo_config_get_string(the_repository, "gc.repackfilterto", &owned)) {
|
||||||
free(cfg->repack_filter_to);
|
free(cfg->repack_filter_to);
|
||||||
cfg->repack_filter_to = owned;
|
cfg->repack_filter_to = owned;
|
||||||
}
|
}
|
||||||
|
|
||||||
git_config(git_default_config, NULL);
|
repo_config(the_repository, git_default_config, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
enum schedule_priority {
|
enum schedule_priority {
|
||||||
|
@ -332,7 +332,7 @@ static int reflog_expire_condition(struct gc_config *cfg UNUSED)
|
||||||
};
|
};
|
||||||
int limit = 100;
|
int limit = 100;
|
||||||
|
|
||||||
git_config_get_int("maintenance.reflog-expire.auto", &limit);
|
repo_config_get_int(the_repository, "maintenance.reflog-expire.auto", &limit);
|
||||||
if (!limit)
|
if (!limit)
|
||||||
return 0;
|
return 0;
|
||||||
if (limit < 0)
|
if (limit < 0)
|
||||||
|
@ -379,7 +379,7 @@ static int worktree_prune_condition(struct gc_config *cfg)
|
||||||
struct dirent *d;
|
struct dirent *d;
|
||||||
DIR *dir = NULL;
|
DIR *dir = NULL;
|
||||||
|
|
||||||
git_config_get_int("maintenance.worktree-prune.auto", &limit);
|
repo_config_get_int(the_repository, "maintenance.worktree-prune.auto", &limit);
|
||||||
if (limit <= 0) {
|
if (limit <= 0) {
|
||||||
should_prune = limit < 0;
|
should_prune = limit < 0;
|
||||||
goto out;
|
goto out;
|
||||||
|
@ -424,7 +424,7 @@ static int rerere_gc_condition(struct gc_config *cfg UNUSED)
|
||||||
int should_gc = 0, limit = 1;
|
int should_gc = 0, limit = 1;
|
||||||
DIR *dir = NULL;
|
DIR *dir = NULL;
|
||||||
|
|
||||||
git_config_get_int("maintenance.rerere-gc.auto", &limit);
|
repo_config_get_int(the_repository, "maintenance.rerere-gc.auto", &limit);
|
||||||
if (limit <= 0) {
|
if (limit <= 0) {
|
||||||
should_gc = limit < 0;
|
should_gc = limit < 0;
|
||||||
goto out;
|
goto out;
|
||||||
|
@ -1162,8 +1162,8 @@ static int should_write_commit_graph(struct gc_config *cfg UNUSED)
|
||||||
|
|
||||||
data.num_not_in_graph = 0;
|
data.num_not_in_graph = 0;
|
||||||
data.limit = 100;
|
data.limit = 100;
|
||||||
git_config_get_int("maintenance.commit-graph.auto",
|
repo_config_get_int(the_repository, "maintenance.commit-graph.auto",
|
||||||
&data.limit);
|
&data.limit);
|
||||||
|
|
||||||
if (!data.limit)
|
if (!data.limit)
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1301,8 +1301,8 @@ static int loose_object_auto_condition(struct gc_config *cfg UNUSED)
|
||||||
{
|
{
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
|
||||||
git_config_get_int("maintenance.loose-objects.auto",
|
repo_config_get_int(the_repository, "maintenance.loose-objects.auto",
|
||||||
&loose_object_auto_limit);
|
&loose_object_auto_limit);
|
||||||
|
|
||||||
if (!loose_object_auto_limit)
|
if (!loose_object_auto_limit)
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1416,8 +1416,8 @@ static int incremental_repack_auto_condition(struct gc_config *cfg UNUSED)
|
||||||
if (!the_repository->settings.core_multi_pack_index)
|
if (!the_repository->settings.core_multi_pack_index)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
git_config_get_int("maintenance.incremental-repack.auto",
|
repo_config_get_int(the_repository, "maintenance.incremental-repack.auto",
|
||||||
&incremental_repack_auto_limit);
|
&incremental_repack_auto_limit);
|
||||||
|
|
||||||
if (!incremental_repack_auto_limit)
|
if (!incremental_repack_auto_limit)
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1766,7 +1766,7 @@ static void initialize_task_config(struct maintenance_run_opts *opts,
|
||||||
if (opts->schedule) {
|
if (opts->schedule) {
|
||||||
strategy = none_strategy;
|
strategy = none_strategy;
|
||||||
|
|
||||||
if (!git_config_get_string_tmp("maintenance.strategy", &config_str)) {
|
if (!repo_config_get_string_tmp(the_repository, "maintenance.strategy", &config_str)) {
|
||||||
if (!strcasecmp(config_str, "incremental"))
|
if (!strcasecmp(config_str, "incremental"))
|
||||||
strategy = incremental_strategy;
|
strategy = incremental_strategy;
|
||||||
}
|
}
|
||||||
|
@ -1780,7 +1780,7 @@ static void initialize_task_config(struct maintenance_run_opts *opts,
|
||||||
strbuf_reset(&config_name);
|
strbuf_reset(&config_name);
|
||||||
strbuf_addf(&config_name, "maintenance.%s.enabled",
|
strbuf_addf(&config_name, "maintenance.%s.enabled",
|
||||||
tasks[i].name);
|
tasks[i].name);
|
||||||
if (!git_config_get_bool(config_name.buf, &config_value))
|
if (!repo_config_get_bool(the_repository, config_name.buf, &config_value))
|
||||||
strategy.tasks[i].enabled = config_value;
|
strategy.tasks[i].enabled = config_value;
|
||||||
if (!strategy.tasks[i].enabled)
|
if (!strategy.tasks[i].enabled)
|
||||||
continue;
|
continue;
|
||||||
|
@ -1789,7 +1789,7 @@ static void initialize_task_config(struct maintenance_run_opts *opts,
|
||||||
strbuf_reset(&config_name);
|
strbuf_reset(&config_name);
|
||||||
strbuf_addf(&config_name, "maintenance.%s.schedule",
|
strbuf_addf(&config_name, "maintenance.%s.schedule",
|
||||||
tasks[i].name);
|
tasks[i].name);
|
||||||
if (!git_config_get_string_tmp(config_name.buf, &config_str))
|
if (!repo_config_get_string_tmp(the_repository, config_name.buf, &config_str))
|
||||||
strategy.tasks[i].schedule = parse_schedule(config_str);
|
strategy.tasks[i].schedule = parse_schedule(config_str);
|
||||||
if (strategy.tasks[i].schedule < opts->schedule)
|
if (strategy.tasks[i].schedule < opts->schedule)
|
||||||
continue;
|
continue;
|
||||||
|
@ -1914,13 +1914,13 @@ static int maintenance_register(int argc, const char **argv, const char *prefix,
|
||||||
options);
|
options);
|
||||||
|
|
||||||
/* Disable foreground maintenance */
|
/* Disable foreground maintenance */
|
||||||
git_config_set("maintenance.auto", "false");
|
repo_config_set(the_repository, "maintenance.auto", "false");
|
||||||
|
|
||||||
/* Set maintenance strategy, if unset */
|
/* Set maintenance strategy, if unset */
|
||||||
if (git_config_get("maintenance.strategy"))
|
if (repo_config_get(the_repository, "maintenance.strategy"))
|
||||||
git_config_set("maintenance.strategy", "incremental");
|
repo_config_set(the_repository, "maintenance.strategy", "incremental");
|
||||||
|
|
||||||
if (!git_config_get_string_multi(key, &list)) {
|
if (!repo_config_get_string_multi(the_repository, key, &list)) {
|
||||||
for_each_string_list_item(item, list) {
|
for_each_string_list_item(item, list) {
|
||||||
if (!strcmp(maintpath, item->string)) {
|
if (!strcmp(maintpath, item->string)) {
|
||||||
found = 1;
|
found = 1;
|
||||||
|
@ -1939,7 +1939,7 @@ static int maintenance_register(int argc, const char **argv, const char *prefix,
|
||||||
}
|
}
|
||||||
if (!config_file)
|
if (!config_file)
|
||||||
die(_("$HOME not set"));
|
die(_("$HOME not set"));
|
||||||
rc = git_config_set_multivar_in_file_gently(
|
rc = repo_config_set_multivar_in_file_gently(the_repository,
|
||||||
config_file, "maintenance.repo", maintpath,
|
config_file, "maintenance.repo", maintpath,
|
||||||
CONFIG_REGEX_NONE, NULL, 0);
|
CONFIG_REGEX_NONE, NULL, 0);
|
||||||
free(global_config_file);
|
free(global_config_file);
|
||||||
|
@ -1989,7 +1989,7 @@ static int maintenance_unregister(int argc, const char **argv, const char *prefi
|
||||||
}
|
}
|
||||||
if (!(config_file
|
if (!(config_file
|
||||||
? git_configset_get_string_multi(&cs, key, &list)
|
? git_configset_get_string_multi(&cs, key, &list)
|
||||||
: git_config_get_string_multi(key, &list))) {
|
: repo_config_get_string_multi(the_repository, key, &list))) {
|
||||||
for_each_string_list_item(item, list) {
|
for_each_string_list_item(item, list) {
|
||||||
if (!strcmp(maintpath, item->string)) {
|
if (!strcmp(maintpath, item->string)) {
|
||||||
found = 1;
|
found = 1;
|
||||||
|
@ -2008,7 +2008,7 @@ static int maintenance_unregister(int argc, const char **argv, const char *prefi
|
||||||
}
|
}
|
||||||
if (!config_file)
|
if (!config_file)
|
||||||
die(_("$HOME not set"));
|
die(_("$HOME not set"));
|
||||||
rc = git_config_set_multivar_in_file_gently(
|
rc = repo_config_set_multivar_in_file_gently(the_repository,
|
||||||
config_file, key, NULL, maintpath, NULL,
|
config_file, key, NULL, maintpath, NULL,
|
||||||
CONFIG_FLAGS_MULTI_REPLACE | CONFIG_FLAGS_FIXED_VALUE);
|
CONFIG_FLAGS_MULTI_REPLACE | CONFIG_FLAGS_FIXED_VALUE);
|
||||||
free(global_config_file);
|
free(global_config_file);
|
||||||
|
@ -2345,7 +2345,7 @@ static int launchctl_schedule_plist(const char *exec_path, enum schedule_priorit
|
||||||
die(_("failed to create directories for '%s'"), filename);
|
die(_("failed to create directories for '%s'"), filename);
|
||||||
|
|
||||||
if ((long)lock_file_timeout_ms < 0 &&
|
if ((long)lock_file_timeout_ms < 0 &&
|
||||||
git_config_get_ulong("gc.launchctlplistlocktimeoutms",
|
repo_config_get_ulong(the_repository, "gc.launchctlplistlocktimeoutms",
|
||||||
&lock_file_timeout_ms))
|
&lock_file_timeout_ms))
|
||||||
lock_file_timeout_ms = 150;
|
lock_file_timeout_ms = 150;
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
|
|
||||||
#include "builtin.h"
|
#include "builtin.h"
|
||||||
#include "abspath.h"
|
#include "abspath.h"
|
||||||
|
#include "environment.h"
|
||||||
#include "gettext.h"
|
#include "gettext.h"
|
||||||
#include "hex.h"
|
#include "hex.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
@ -1035,7 +1036,7 @@ int cmd_grep(int argc,
|
||||||
grep_prefix = prefix;
|
grep_prefix = prefix;
|
||||||
|
|
||||||
grep_init(&opt, the_repository);
|
grep_init(&opt, the_repository);
|
||||||
git_config(grep_cmd_config, &opt);
|
repo_config(the_repository, grep_cmd_config, &opt);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If there is no -- then the paths must exist in the working
|
* If there is no -- then the paths must exist in the working
|
||||||
|
@ -1058,7 +1059,7 @@ int cmd_grep(int argc,
|
||||||
|
|
||||||
if (use_index && !startup_info->have_repository) {
|
if (use_index && !startup_info->have_repository) {
|
||||||
int fallback = 0;
|
int fallback = 0;
|
||||||
git_config_get_bool("grep.fallbacktonoindex", &fallback);
|
repo_config_get_bool(the_repository, "grep.fallbacktonoindex", &fallback);
|
||||||
if (fallback)
|
if (fallback)
|
||||||
use_index = 0;
|
use_index = 0;
|
||||||
else
|
else
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
#include "builtin.h"
|
#include "builtin.h"
|
||||||
#include "abspath.h"
|
#include "abspath.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
#include "environment.h"
|
||||||
#include "gettext.h"
|
#include "gettext.h"
|
||||||
#include "hex.h"
|
#include "hex.h"
|
||||||
#include "object-file.h"
|
#include "object-file.h"
|
||||||
|
@ -111,7 +112,7 @@ int cmd_hash_object(int argc,
|
||||||
vpath = vpath_free;
|
vpath = vpath_free;
|
||||||
}
|
}
|
||||||
|
|
||||||
git_config(git_default_config, NULL);
|
repo_config(the_repository, git_default_config, NULL);
|
||||||
|
|
||||||
if (stdin_paths) {
|
if (stdin_paths) {
|
||||||
if (hashstdin)
|
if (hashstdin)
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
|
|
||||||
#include "builtin.h"
|
#include "builtin.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
#include "environment.h"
|
||||||
#include "exec-cmd.h"
|
#include "exec-cmd.h"
|
||||||
#include "gettext.h"
|
#include "gettext.h"
|
||||||
#include "pager.h"
|
#include "pager.h"
|
||||||
|
@ -210,7 +211,7 @@ static enum help_format parse_help_format(const char *format)
|
||||||
if (!strcmp(format, "web") || !strcmp(format, "html"))
|
if (!strcmp(format, "web") || !strcmp(format, "html"))
|
||||||
return HELP_FORMAT_WEB;
|
return HELP_FORMAT_WEB;
|
||||||
/*
|
/*
|
||||||
* Please update _git_config() in git-completion.bash when you
|
* Please update _repo_config() in git-completion.bash when you
|
||||||
* add new help formats.
|
* add new help formats.
|
||||||
*/
|
*/
|
||||||
die(_("unrecognized help format '%s'"), format);
|
die(_("unrecognized help format '%s'"), format);
|
||||||
|
@ -706,7 +707,7 @@ int cmd_help(int argc,
|
||||||
}
|
}
|
||||||
|
|
||||||
setup_git_directory_gently(&nongit);
|
setup_git_directory_gently(&nongit);
|
||||||
git_config(git_help_config, NULL);
|
repo_config(the_repository, git_help_config, NULL);
|
||||||
|
|
||||||
if (parsed_help_format != HELP_FORMAT_NONE)
|
if (parsed_help_format != HELP_FORMAT_NONE)
|
||||||
help_format = parsed_help_format;
|
help_format = parsed_help_format;
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#define USE_THE_REPOSITORY_VARIABLE
|
#define USE_THE_REPOSITORY_VARIABLE
|
||||||
#include "builtin.h"
|
#include "builtin.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
#include "environment.h"
|
||||||
#include "gettext.h"
|
#include "gettext.h"
|
||||||
#include "hook.h"
|
#include "hook.h"
|
||||||
#include "parse-options.h"
|
#include "parse-options.h"
|
||||||
|
@ -55,7 +56,7 @@ static int run(int argc, const char **argv, const char *prefix,
|
||||||
strvec_push(&opt.args, argv[i]);
|
strvec_push(&opt.args, argv[i]);
|
||||||
|
|
||||||
/* Need to take into account core.hooksPath */
|
/* Need to take into account core.hooksPath */
|
||||||
git_config(git_default_config, NULL);
|
repo_config(the_repository, git_default_config, NULL);
|
||||||
|
|
||||||
hook_name = argv[0];
|
hook_name = argv[0];
|
||||||
if (!ignore_missing)
|
if (!ignore_missing)
|
||||||
|
|
|
@ -1917,7 +1917,7 @@ int cmd_index_pack(int argc,
|
||||||
|
|
||||||
reset_pack_idx_option(&opts);
|
reset_pack_idx_option(&opts);
|
||||||
opts.flags |= WRITE_REV;
|
opts.flags |= WRITE_REV;
|
||||||
git_config(git_index_pack_config, &opts);
|
repo_config(the_repository, git_index_pack_config, &opts);
|
||||||
if (prefix && chdir(prefix))
|
if (prefix && chdir(prefix))
|
||||||
die(_("Cannot come back to cwd"));
|
die(_("Cannot come back to cwd"));
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
*/
|
*/
|
||||||
#define USE_THE_REPOSITORY_VARIABLE
|
#define USE_THE_REPOSITORY_VARIABLE
|
||||||
#include "builtin.h"
|
#include "builtin.h"
|
||||||
|
#include "environment.h"
|
||||||
#include "gettext.h"
|
#include "gettext.h"
|
||||||
#include "parse-options.h"
|
#include "parse-options.h"
|
||||||
#include "string-list.h"
|
#include "string-list.h"
|
||||||
|
@ -220,7 +221,7 @@ int cmd_interpret_trailers(int argc,
|
||||||
OPT_END()
|
OPT_END()
|
||||||
};
|
};
|
||||||
|
|
||||||
git_config(git_default_config, NULL);
|
repo_config(the_repository, git_default_config, NULL);
|
||||||
|
|
||||||
argc = parse_options(argc, argv, prefix, options,
|
argc = parse_options(argc, argv, prefix, options,
|
||||||
git_interpret_trailers_usage, 0);
|
git_interpret_trailers_usage, 0);
|
||||||
|
|
|
@ -221,7 +221,7 @@ static void set_default_decoration_filter(struct decoration_filter *decoration_f
|
||||||
struct string_list *include = decoration_filter->include_ref_pattern;
|
struct string_list *include = decoration_filter->include_ref_pattern;
|
||||||
const struct string_list *config_exclude;
|
const struct string_list *config_exclude;
|
||||||
|
|
||||||
if (!git_config_get_string_multi("log.excludeDecoration",
|
if (!repo_config_get_string_multi(the_repository, "log.excludeDecoration",
|
||||||
&config_exclude)) {
|
&config_exclude)) {
|
||||||
struct string_list_item *item;
|
struct string_list_item *item;
|
||||||
for_each_string_list_item(item, config_exclude)
|
for_each_string_list_item(item, config_exclude)
|
||||||
|
@ -235,7 +235,7 @@ static void set_default_decoration_filter(struct decoration_filter *decoration_f
|
||||||
* since the command-line takes precedent.
|
* since the command-line takes precedent.
|
||||||
*/
|
*/
|
||||||
if (use_default_decoration_filter &&
|
if (use_default_decoration_filter &&
|
||||||
!git_config_get_string("log.initialdecorationset", &value) &&
|
!repo_config_get_string(the_repository, "log.initialdecorationset", &value) &&
|
||||||
!strcmp("all", value))
|
!strcmp("all", value))
|
||||||
use_default_decoration_filter = 0;
|
use_default_decoration_filter = 0;
|
||||||
free(value);
|
free(value);
|
||||||
|
@ -530,10 +530,10 @@ int cmd_whatchanged(int argc,
|
||||||
|
|
||||||
log_config_init(&cfg);
|
log_config_init(&cfg);
|
||||||
init_diff_ui_defaults();
|
init_diff_ui_defaults();
|
||||||
git_config(git_log_config, &cfg);
|
repo_config(the_repository, git_log_config, &cfg);
|
||||||
|
|
||||||
repo_init_revisions(the_repository, &rev, prefix);
|
repo_init_revisions(the_repository, &rev, prefix);
|
||||||
git_config(grep_config, &rev.grep_filter);
|
repo_config(the_repository, grep_config, &rev.grep_filter);
|
||||||
|
|
||||||
rev.diff = 1;
|
rev.diff = 1;
|
||||||
rev.simplify_history = 0;
|
rev.simplify_history = 0;
|
||||||
|
@ -661,7 +661,7 @@ int cmd_show(int argc,
|
||||||
|
|
||||||
log_config_init(&cfg);
|
log_config_init(&cfg);
|
||||||
init_diff_ui_defaults();
|
init_diff_ui_defaults();
|
||||||
git_config(git_log_config, &cfg);
|
repo_config(the_repository, git_log_config, &cfg);
|
||||||
|
|
||||||
if (the_repository->gitdir) {
|
if (the_repository->gitdir) {
|
||||||
prepare_repo_settings(the_repository);
|
prepare_repo_settings(the_repository);
|
||||||
|
@ -670,7 +670,7 @@ int cmd_show(int argc,
|
||||||
|
|
||||||
memset(&match_all, 0, sizeof(match_all));
|
memset(&match_all, 0, sizeof(match_all));
|
||||||
repo_init_revisions(the_repository, &rev, prefix);
|
repo_init_revisions(the_repository, &rev, prefix);
|
||||||
git_config(grep_config, &rev.grep_filter);
|
repo_config(the_repository, grep_config, &rev.grep_filter);
|
||||||
|
|
||||||
rev.diff = 1;
|
rev.diff = 1;
|
||||||
rev.always_show_header = 1;
|
rev.always_show_header = 1;
|
||||||
|
@ -778,11 +778,11 @@ int cmd_log_reflog(int argc,
|
||||||
|
|
||||||
log_config_init(&cfg);
|
log_config_init(&cfg);
|
||||||
init_diff_ui_defaults();
|
init_diff_ui_defaults();
|
||||||
git_config(git_log_config, &cfg);
|
repo_config(the_repository, git_log_config, &cfg);
|
||||||
|
|
||||||
repo_init_revisions(the_repository, &rev, prefix);
|
repo_init_revisions(the_repository, &rev, prefix);
|
||||||
init_reflog_walk(&rev.reflog_info);
|
init_reflog_walk(&rev.reflog_info);
|
||||||
git_config(grep_config, &rev.grep_filter);
|
repo_config(the_repository, grep_config, &rev.grep_filter);
|
||||||
|
|
||||||
rev.verbose_header = 1;
|
rev.verbose_header = 1;
|
||||||
memset(&opt, 0, sizeof(opt));
|
memset(&opt, 0, sizeof(opt));
|
||||||
|
@ -823,10 +823,10 @@ int cmd_log(int argc,
|
||||||
|
|
||||||
log_config_init(&cfg);
|
log_config_init(&cfg);
|
||||||
init_diff_ui_defaults();
|
init_diff_ui_defaults();
|
||||||
git_config(git_log_config, &cfg);
|
repo_config(the_repository, git_log_config, &cfg);
|
||||||
|
|
||||||
repo_init_revisions(the_repository, &rev, prefix);
|
repo_init_revisions(the_repository, &rev, prefix);
|
||||||
git_config(grep_config, &rev.grep_filter);
|
repo_config(the_repository, grep_config, &rev.grep_filter);
|
||||||
|
|
||||||
rev.always_show_header = 1;
|
rev.always_show_header = 1;
|
||||||
memset(&opt, 0, sizeof(opt));
|
memset(&opt, 0, sizeof(opt));
|
||||||
|
@ -2029,9 +2029,9 @@ int cmd_format_patch(int argc,
|
||||||
format_config_init(&cfg);
|
format_config_init(&cfg);
|
||||||
init_diff_ui_defaults();
|
init_diff_ui_defaults();
|
||||||
init_display_notes(&cfg.notes_opt);
|
init_display_notes(&cfg.notes_opt);
|
||||||
git_config(git_format_config, &cfg);
|
repo_config(the_repository, git_format_config, &cfg);
|
||||||
repo_init_revisions(the_repository, &rev, prefix);
|
repo_init_revisions(the_repository, &rev, prefix);
|
||||||
git_config(grep_config, &rev.grep_filter);
|
repo_config(the_repository, grep_config, &rev.grep_filter);
|
||||||
|
|
||||||
rev.show_notes = cfg.show_notes;
|
rev.show_notes = cfg.show_notes;
|
||||||
memcpy(&rev.notes_opt, &cfg.notes_opt, sizeof(cfg.notes_opt));
|
memcpy(&rev.notes_opt, &cfg.notes_opt, sizeof(cfg.notes_opt));
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
#include "builtin.h"
|
#include "builtin.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "convert.h"
|
#include "convert.h"
|
||||||
|
#include "environment.h"
|
||||||
#include "quote.h"
|
#include "quote.h"
|
||||||
#include "dir.h"
|
#include "dir.h"
|
||||||
#include "gettext.h"
|
#include "gettext.h"
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
#include "builtin.h"
|
#include "builtin.h"
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
#include "environment.h"
|
||||||
#include "gettext.h"
|
#include "gettext.h"
|
||||||
#include "hex.h"
|
#include "hex.h"
|
||||||
#include "object-name.h"
|
#include "object-name.h"
|
||||||
|
@ -375,7 +376,7 @@ int cmd_ls_tree(int argc,
|
||||||
struct object_context obj_context = {0};
|
struct object_context obj_context = {0};
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
git_config(git_default_config, NULL);
|
repo_config(the_repository, git_default_config, NULL);
|
||||||
|
|
||||||
argc = parse_options(argc, argv, prefix, ls_tree_options,
|
argc = parse_options(argc, argv, prefix, ls_tree_options,
|
||||||
ls_tree_usage, 0);
|
ls_tree_usage, 0);
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
#include "builtin.h"
|
#include "builtin.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "commit.h"
|
#include "commit.h"
|
||||||
|
#include "environment.h"
|
||||||
#include "gettext.h"
|
#include "gettext.h"
|
||||||
#include "hex.h"
|
#include "hex.h"
|
||||||
#include "object-name.h"
|
#include "object-name.h"
|
||||||
|
@ -167,7 +168,7 @@ int cmd_merge_base(int argc,
|
||||||
OPT_END()
|
OPT_END()
|
||||||
};
|
};
|
||||||
|
|
||||||
git_config(git_default_config, NULL);
|
repo_config(the_repository, git_default_config, NULL);
|
||||||
argc = parse_options(argc, argv, prefix, options, merge_base_usage, 0);
|
argc = parse_options(argc, argv, prefix, options, merge_base_usage, 0);
|
||||||
|
|
||||||
if (cmdmode == 'a') {
|
if (cmdmode == 'a') {
|
||||||
|
|
|
@ -97,7 +97,7 @@ int cmd_merge_file(int argc,
|
||||||
|
|
||||||
if (startup_info->have_repository) {
|
if (startup_info->have_repository) {
|
||||||
/* Read the configuration file */
|
/* Read the configuration file */
|
||||||
git_config(git_xmerge_config, NULL);
|
repo_config(the_repository, git_xmerge_config, NULL);
|
||||||
if (0 <= git_xmerge_style)
|
if (0 <= git_xmerge_style)
|
||||||
xmp.style = git_xmerge_style;
|
xmp.style = git_xmerge_style;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#define USE_THE_REPOSITORY_VARIABLE
|
#define USE_THE_REPOSITORY_VARIABLE
|
||||||
|
|
||||||
#include "builtin.h"
|
#include "builtin.h"
|
||||||
|
#include "environment.h"
|
||||||
#include "tree-walk.h"
|
#include "tree-walk.h"
|
||||||
#include "xdiff-interface.h"
|
#include "xdiff-interface.h"
|
||||||
#include "help.h"
|
#include "help.h"
|
||||||
|
@ -683,7 +684,7 @@ int cmd_merge_tree(int argc,
|
||||||
if (argc != expected_remaining_argc)
|
if (argc != expected_remaining_argc)
|
||||||
usage_with_options(merge_tree_usage, mt_options);
|
usage_with_options(merge_tree_usage, mt_options);
|
||||||
|
|
||||||
git_config(git_default_config, NULL);
|
repo_config(the_repository, git_default_config, NULL);
|
||||||
|
|
||||||
/* Do the relevant type of merge */
|
/* Do the relevant type of merge */
|
||||||
if (o.mode == MODE_REAL)
|
if (o.mode == MODE_REAL)
|
||||||
|
|
|
@ -1392,7 +1392,7 @@ int cmd_merge(int argc,
|
||||||
skip_prefix(branch, "refs/heads/", &branch);
|
skip_prefix(branch, "refs/heads/", &branch);
|
||||||
|
|
||||||
init_diff_ui_defaults();
|
init_diff_ui_defaults();
|
||||||
git_config(git_merge_config, NULL);
|
repo_config(the_repository, git_merge_config, NULL);
|
||||||
|
|
||||||
if (!branch || is_null_oid(&head_oid))
|
if (!branch || is_null_oid(&head_oid))
|
||||||
head_commit = NULL;
|
head_commit = NULL;
|
||||||
|
|
|
@ -98,7 +98,7 @@ int cmd_mktag(int argc,
|
||||||
fsck_set_msg_type_from_ids(&fsck_options, FSCK_MSG_EXTRA_HEADER_ENTRY,
|
fsck_set_msg_type_from_ids(&fsck_options, FSCK_MSG_EXTRA_HEADER_ENTRY,
|
||||||
FSCK_WARN);
|
FSCK_WARN);
|
||||||
/* config might set fsck.extraHeaderEntry=* again */
|
/* config might set fsck.extraHeaderEntry=* again */
|
||||||
git_config(git_fsck_config, &fsck_options);
|
repo_config(the_repository, git_fsck_config, &fsck_options);
|
||||||
if (fsck_tag_standalone(NULL, buf.buf, buf.len, &fsck_options,
|
if (fsck_tag_standalone(NULL, buf.buf, buf.len, &fsck_options,
|
||||||
&tagged_oid, &tagged_type))
|
&tagged_oid, &tagged_type))
|
||||||
die(_("tag on stdin did not pass our strict fsck check"));
|
die(_("tag on stdin did not pass our strict fsck check"));
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
#include "builtin.h"
|
#include "builtin.h"
|
||||||
#include "abspath.h"
|
#include "abspath.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
#include "environment.h"
|
||||||
#include "gettext.h"
|
#include "gettext.h"
|
||||||
#include "parse-options.h"
|
#include "parse-options.h"
|
||||||
#include "midx.h"
|
#include "midx.h"
|
||||||
|
@ -143,7 +144,7 @@ static int cmd_multi_pack_index_write(int argc, const char **argv,
|
||||||
|
|
||||||
opts.flags |= MIDX_WRITE_BITMAP_HASH_CACHE;
|
opts.flags |= MIDX_WRITE_BITMAP_HASH_CACHE;
|
||||||
|
|
||||||
git_config(git_multi_pack_index_write_config, NULL);
|
repo_config(the_repository, git_multi_pack_index_write_config, NULL);
|
||||||
|
|
||||||
options = add_common_options(builtin_multi_pack_index_write_options);
|
options = add_common_options(builtin_multi_pack_index_write_options);
|
||||||
|
|
||||||
|
@ -290,7 +291,7 @@ int cmd_multi_pack_index(int argc,
|
||||||
|
|
||||||
disable_replace_refs();
|
disable_replace_refs();
|
||||||
|
|
||||||
git_config(git_default_config, NULL);
|
repo_config(the_repository, git_default_config, NULL);
|
||||||
|
|
||||||
if (the_repository &&
|
if (the_repository &&
|
||||||
the_repository->objects &&
|
the_repository->objects &&
|
||||||
|
|
|
@ -239,7 +239,7 @@ int cmd_mv(int argc,
|
||||||
struct strbuf pathbuf = STRBUF_INIT;
|
struct strbuf pathbuf = STRBUF_INIT;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
git_config(git_default_config, NULL);
|
repo_config(the_repository, git_default_config, NULL);
|
||||||
|
|
||||||
argc = parse_options(argc, argv, prefix, builtin_mv_options,
|
argc = parse_options(argc, argv, prefix, builtin_mv_options,
|
||||||
builtin_mv_usage, 0);
|
builtin_mv_usage, 0);
|
||||||
|
|
|
@ -600,7 +600,7 @@ int cmd_name_rev(int argc,
|
||||||
|
|
||||||
mem_pool_init(&string_pool, 0);
|
mem_pool_init(&string_pool, 0);
|
||||||
init_commit_rev_name(&rev_names);
|
init_commit_rev_name(&rev_names);
|
||||||
git_config(git_default_config, NULL);
|
repo_config(the_repository, git_default_config, NULL);
|
||||||
argc = parse_options(argc, argv, prefix, opts, name_rev_usage, 0);
|
argc = parse_options(argc, argv, prefix, opts, name_rev_usage, 0);
|
||||||
|
|
||||||
#ifndef WITH_BREAKING_CHANGES
|
#ifndef WITH_BREAKING_CHANGES
|
||||||
|
|
|
@ -873,7 +873,7 @@ static int git_config_get_notes_strategy(const char *key,
|
||||||
{
|
{
|
||||||
char *value;
|
char *value;
|
||||||
|
|
||||||
if (git_config_get_string(key, &value))
|
if (repo_config_get_string(the_repository, key, &value))
|
||||||
return 1;
|
return 1;
|
||||||
if (parse_notes_merge_strategy(value, strategy))
|
if (parse_notes_merge_strategy(value, strategy))
|
||||||
git_die_config(the_repository, key, _("unknown notes merge strategy %s"), value);
|
git_die_config(the_repository, key, _("unknown notes merge strategy %s"), value);
|
||||||
|
@ -1145,7 +1145,7 @@ int cmd_notes(int argc,
|
||||||
OPT_END()
|
OPT_END()
|
||||||
};
|
};
|
||||||
|
|
||||||
git_config(git_default_config, NULL);
|
repo_config(the_repository, git_default_config, NULL);
|
||||||
argc = parse_options(argc, argv, prefix, options, git_notes_usage,
|
argc = parse_options(argc, argv, prefix, options, git_notes_usage,
|
||||||
PARSE_OPT_SUBCOMMAND_OPTIONAL);
|
PARSE_OPT_SUBCOMMAND_OPTIONAL);
|
||||||
if (!fn) {
|
if (!fn) {
|
||||||
|
|
|
@ -4985,7 +4985,7 @@ int cmd_pack_objects(int argc,
|
||||||
|
|
||||||
reset_pack_idx_option(&pack_idx_opts);
|
reset_pack_idx_option(&pack_idx_opts);
|
||||||
pack_idx_opts.flags |= WRITE_REV;
|
pack_idx_opts.flags |= WRITE_REV;
|
||||||
git_config(git_pack_config, NULL);
|
repo_config(the_repository, git_pack_config, NULL);
|
||||||
if (git_env_bool(GIT_TEST_NO_WRITE_REV_INDEX, 0))
|
if (git_env_bool(GIT_TEST_NO_WRITE_REV_INDEX, 0))
|
||||||
pack_idx_opts.flags &= ~WRITE_REV;
|
pack_idx_opts.flags &= ~WRITE_REV;
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#include "builtin.h"
|
#include "builtin.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
#include "environment.h"
|
||||||
#include "gettext.h"
|
#include "gettext.h"
|
||||||
#include "parse-options.h"
|
#include "parse-options.h"
|
||||||
#include "refs.h"
|
#include "refs.h"
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
#include "builtin.h"
|
#include "builtin.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "diff.h"
|
#include "diff.h"
|
||||||
|
#include "environment.h"
|
||||||
#include "gettext.h"
|
#include "gettext.h"
|
||||||
#include "hash.h"
|
#include "hash.h"
|
||||||
#include "hex.h"
|
#include "hex.h"
|
||||||
|
@ -235,7 +236,7 @@ int cmd_patch_id(int argc,
|
||||||
OPT_END()
|
OPT_END()
|
||||||
};
|
};
|
||||||
|
|
||||||
git_config(git_patch_id_config, &config);
|
repo_config(the_repository, git_patch_id_config, &config);
|
||||||
|
|
||||||
/* verbatim implies stable */
|
/* verbatim implies stable */
|
||||||
if (config.verbatim)
|
if (config.verbatim)
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
#include "builtin.h"
|
#include "builtin.h"
|
||||||
#include "advice.h"
|
#include "advice.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
#include "environment.h"
|
||||||
#include "gettext.h"
|
#include "gettext.h"
|
||||||
#include "hex.h"
|
#include "hex.h"
|
||||||
#include "merge.h"
|
#include "merge.h"
|
||||||
|
@ -313,7 +314,7 @@ static const char *config_get_ff(void)
|
||||||
{
|
{
|
||||||
const char *value;
|
const char *value;
|
||||||
|
|
||||||
if (git_config_get_value("pull.ff", &value))
|
if (repo_config_get_value(the_repository, "pull.ff", &value))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
switch (git_parse_maybe_bool(value)) {
|
switch (git_parse_maybe_bool(value)) {
|
||||||
|
@ -344,7 +345,7 @@ static enum rebase_type config_get_rebase(int *rebase_unspecified)
|
||||||
if (curr_branch) {
|
if (curr_branch) {
|
||||||
char *key = xstrfmt("branch.%s.rebase", curr_branch->name);
|
char *key = xstrfmt("branch.%s.rebase", curr_branch->name);
|
||||||
|
|
||||||
if (!git_config_get_value(key, &value)) {
|
if (!repo_config_get_value(the_repository, key, &value)) {
|
||||||
enum rebase_type ret = parse_config_rebase(key, value, 1);
|
enum rebase_type ret = parse_config_rebase(key, value, 1);
|
||||||
free(key);
|
free(key);
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -353,7 +354,7 @@ static enum rebase_type config_get_rebase(int *rebase_unspecified)
|
||||||
free(key);
|
free(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!git_config_get_value("pull.rebase", &value))
|
if (!repo_config_get_value(the_repository, "pull.rebase", &value))
|
||||||
return parse_config_rebase("pull.rebase", value, 1);
|
return parse_config_rebase("pull.rebase", value, 1);
|
||||||
|
|
||||||
*rebase_unspecified = 1;
|
*rebase_unspecified = 1;
|
||||||
|
@ -1011,7 +1012,7 @@ int cmd_pull(int argc,
|
||||||
if (!getenv("GIT_REFLOG_ACTION"))
|
if (!getenv("GIT_REFLOG_ACTION"))
|
||||||
set_reflog_message(argc, argv);
|
set_reflog_message(argc, argv);
|
||||||
|
|
||||||
git_config(git_pull_config, NULL);
|
repo_config(the_repository, git_pull_config, NULL);
|
||||||
if (the_repository->gitdir) {
|
if (the_repository->gitdir) {
|
||||||
prepare_repo_settings(the_repository);
|
prepare_repo_settings(the_repository);
|
||||||
the_repository->settings.command_requires_full_index = 0;
|
the_repository->settings.command_requires_full_index = 0;
|
||||||
|
|
|
@ -598,7 +598,7 @@ int cmd_push(int argc,
|
||||||
};
|
};
|
||||||
|
|
||||||
packet_trace_identity("push");
|
packet_trace_identity("push");
|
||||||
git_config(git_push_config, &flags);
|
repo_config(the_repository, git_push_config, &flags);
|
||||||
argc = parse_options(argc, argv, prefix, options, push_usage, 0);
|
argc = parse_options(argc, argv, prefix, options, push_usage, 0);
|
||||||
push_options = (push_options_cmdline.nr
|
push_options = (push_options_cmdline.nr
|
||||||
? &push_options_cmdline
|
? &push_options_cmdline
|
||||||
|
|
|
@ -54,7 +54,7 @@ int cmd_range_diff(int argc,
|
||||||
struct object_id oid;
|
struct object_id oid;
|
||||||
const char *three_dots = NULL;
|
const char *three_dots = NULL;
|
||||||
|
|
||||||
git_config(git_diff_ui_config, NULL);
|
repo_config(the_repository, git_diff_ui_config, NULL);
|
||||||
|
|
||||||
repo_diff_setup(the_repository, &diffopt);
|
repo_diff_setup(the_repository, &diffopt);
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
#define USE_THE_REPOSITORY_VARIABLE
|
#define USE_THE_REPOSITORY_VARIABLE
|
||||||
#include "builtin.h"
|
#include "builtin.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
#include "environment.h"
|
||||||
#include "gettext.h"
|
#include "gettext.h"
|
||||||
#include "hex.h"
|
#include "hex.h"
|
||||||
#include "lockfile.h"
|
#include "lockfile.h"
|
||||||
|
@ -168,7 +169,7 @@ int cmd_read_tree(int argc,
|
||||||
opts.src_index = the_repository->index;
|
opts.src_index = the_repository->index;
|
||||||
opts.dst_index = the_repository->index;
|
opts.dst_index = the_repository->index;
|
||||||
|
|
||||||
git_config(git_read_tree_config, NULL);
|
repo_config(the_repository, git_read_tree_config, NULL);
|
||||||
|
|
||||||
argc = parse_options(argc, argv, cmd_prefix, read_tree_options,
|
argc = parse_options(argc, argv, cmd_prefix, read_tree_options,
|
||||||
read_tree_usage, 0);
|
read_tree_usage, 0);
|
||||||
|
|
|
@ -340,7 +340,7 @@ static int run_sequencer_rebase(struct rebase_options *opts)
|
||||||
unsigned flags = 0;
|
unsigned flags = 0;
|
||||||
int abbreviate_commands = 0, ret = 0;
|
int abbreviate_commands = 0, ret = 0;
|
||||||
|
|
||||||
git_config_get_bool("rebase.abbreviatecommands", &abbreviate_commands);
|
repo_config_get_bool(the_repository, "rebase.abbreviatecommands", &abbreviate_commands);
|
||||||
|
|
||||||
flags |= opts->keep_empty ? TODO_LIST_KEEP_EMPTY : 0;
|
flags |= opts->keep_empty ? TODO_LIST_KEEP_EMPTY : 0;
|
||||||
flags |= abbreviate_commands ? TODO_LIST_ABBREVIATE_CMDS : 0;
|
flags |= abbreviate_commands ? TODO_LIST_ABBREVIATE_CMDS : 0;
|
||||||
|
@ -1245,7 +1245,7 @@ int cmd_rebase(int argc,
|
||||||
prepare_repo_settings(the_repository);
|
prepare_repo_settings(the_repository);
|
||||||
the_repository->settings.command_requires_full_index = 0;
|
the_repository->settings.command_requires_full_index = 0;
|
||||||
|
|
||||||
git_config(rebase_config, &options);
|
repo_config(the_repository, rebase_config, &options);
|
||||||
/* options.gpg_sign_opt will be either "-S" or NULL */
|
/* options.gpg_sign_opt will be either "-S" or NULL */
|
||||||
gpg_sign = options.gpg_sign_opt ? "" : NULL;
|
gpg_sign = options.gpg_sign_opt ? "" : NULL;
|
||||||
FREE_AND_NULL(options.gpg_sign_opt);
|
FREE_AND_NULL(options.gpg_sign_opt);
|
||||||
|
|
|
@ -2613,7 +2613,7 @@ int cmd_receive_pack(int argc,
|
||||||
if (!enter_repo(service_dir, 0))
|
if (!enter_repo(service_dir, 0))
|
||||||
die("'%s' does not appear to be a git repository", service_dir);
|
die("'%s' does not appear to be a git repository", service_dir);
|
||||||
|
|
||||||
git_config(receive_pack_config, NULL);
|
repo_config(the_repository, receive_pack_config, NULL);
|
||||||
if (cert_nonce_seed)
|
if (cert_nonce_seed)
|
||||||
push_cert_nonce = prepare_push_cert_nonce(service_dir, time(NULL));
|
push_cert_nonce = prepare_push_cert_nonce(service_dir, time(NULL));
|
||||||
|
|
||||||
|
|
|
@ -202,7 +202,7 @@ static int cmd_reflog_expire(int argc, const char **argv, const char *prefix,
|
||||||
OPT_END()
|
OPT_END()
|
||||||
};
|
};
|
||||||
|
|
||||||
git_config(reflog_expire_config, &opts);
|
repo_config(the_repository, reflog_expire_config, &opts);
|
||||||
|
|
||||||
save_commit_buffer = 0;
|
save_commit_buffer = 0;
|
||||||
do_all = status = 0;
|
do_all = status = 0;
|
||||||
|
|
|
@ -88,7 +88,7 @@ static int cmd_refs_verify(int argc, const char **argv, const char *prefix,
|
||||||
if (argc)
|
if (argc)
|
||||||
usage(_("'git refs verify' takes no arguments"));
|
usage(_("'git refs verify' takes no arguments"));
|
||||||
|
|
||||||
git_config(git_fsck_config, &fsck_refs_options);
|
repo_config(the_repository, git_fsck_config, &fsck_refs_options);
|
||||||
prepare_repo_settings(the_repository);
|
prepare_repo_settings(the_repository);
|
||||||
|
|
||||||
worktrees = get_worktrees_without_reading_head();
|
worktrees = get_worktrees_without_reading_head();
|
||||||
|
|
|
@ -132,7 +132,7 @@ static void add_branch(const char *key, const char *branchname,
|
||||||
else
|
else
|
||||||
strbuf_addf(tmp, "refs/heads/%s:refs/remotes/%s/%s",
|
strbuf_addf(tmp, "refs/heads/%s:refs/remotes/%s/%s",
|
||||||
branchname, remotename, branchname);
|
branchname, remotename, branchname);
|
||||||
git_config_set_multivar(key, tmp->buf, "^$", 0);
|
repo_config_set_multivar(the_repository, key, tmp->buf, "^$", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char mirror_advice[] =
|
static const char mirror_advice[] =
|
||||||
|
@ -226,7 +226,7 @@ static int add(int argc, const char **argv, const char *prefix,
|
||||||
for_each_remote(check_remote_collision, (void *)name);
|
for_each_remote(check_remote_collision, (void *)name);
|
||||||
|
|
||||||
strbuf_addf(&buf, "remote.%s.url", name);
|
strbuf_addf(&buf, "remote.%s.url", name);
|
||||||
git_config_set(buf.buf, url);
|
repo_config_set(the_repository, buf.buf, url);
|
||||||
|
|
||||||
if (!mirror || mirror & MIRROR_FETCH) {
|
if (!mirror || mirror & MIRROR_FETCH) {
|
||||||
strbuf_reset(&buf);
|
strbuf_reset(&buf);
|
||||||
|
@ -242,14 +242,14 @@ static int add(int argc, const char **argv, const char *prefix,
|
||||||
if (mirror & MIRROR_PUSH) {
|
if (mirror & MIRROR_PUSH) {
|
||||||
strbuf_reset(&buf);
|
strbuf_reset(&buf);
|
||||||
strbuf_addf(&buf, "remote.%s.mirror", name);
|
strbuf_addf(&buf, "remote.%s.mirror", name);
|
||||||
git_config_set(buf.buf, "true");
|
repo_config_set(the_repository, buf.buf, "true");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fetch_tags != TAGS_DEFAULT) {
|
if (fetch_tags != TAGS_DEFAULT) {
|
||||||
strbuf_reset(&buf);
|
strbuf_reset(&buf);
|
||||||
strbuf_addf(&buf, "remote.%s.tagOpt", name);
|
strbuf_addf(&buf, "remote.%s.tagOpt", name);
|
||||||
git_config_set(buf.buf,
|
repo_config_set(the_repository, buf.buf,
|
||||||
fetch_tags == TAGS_SET ? "--tags" : "--no-tags");
|
fetch_tags == TAGS_SET ? "--tags" : "--no-tags");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fetch && fetch_remote(name)) {
|
if (fetch && fetch_remote(name)) {
|
||||||
|
@ -370,7 +370,7 @@ static void read_branches(void)
|
||||||
{
|
{
|
||||||
if (branch_list.nr)
|
if (branch_list.nr)
|
||||||
return;
|
return;
|
||||||
git_config(config_read_branches, NULL);
|
repo_config(the_repository, config_read_branches, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct ref_states {
|
struct ref_states {
|
||||||
|
@ -651,15 +651,15 @@ static int migrate_file(struct remote *remote)
|
||||||
|
|
||||||
strbuf_addf(&buf, "remote.%s.url", remote->name);
|
strbuf_addf(&buf, "remote.%s.url", remote->name);
|
||||||
for (i = 0; i < remote->url.nr; i++)
|
for (i = 0; i < remote->url.nr; i++)
|
||||||
git_config_set_multivar(buf.buf, remote->url.v[i], "^$", 0);
|
repo_config_set_multivar(the_repository, buf.buf, remote->url.v[i], "^$", 0);
|
||||||
strbuf_reset(&buf);
|
strbuf_reset(&buf);
|
||||||
strbuf_addf(&buf, "remote.%s.push", remote->name);
|
strbuf_addf(&buf, "remote.%s.push", remote->name);
|
||||||
for (i = 0; i < remote->push.nr; i++)
|
for (i = 0; i < remote->push.nr; i++)
|
||||||
git_config_set_multivar(buf.buf, remote->push.items[i].raw, "^$", 0);
|
repo_config_set_multivar(the_repository, buf.buf, remote->push.items[i].raw, "^$", 0);
|
||||||
strbuf_reset(&buf);
|
strbuf_reset(&buf);
|
||||||
strbuf_addf(&buf, "remote.%s.fetch", remote->name);
|
strbuf_addf(&buf, "remote.%s.fetch", remote->name);
|
||||||
for (i = 0; i < remote->fetch.nr; i++)
|
for (i = 0; i < remote->fetch.nr; i++)
|
||||||
git_config_set_multivar(buf.buf, remote->fetch.items[i].raw, "^$", 0);
|
repo_config_set_multivar(the_repository, buf.buf, remote->fetch.items[i].raw, "^$", 0);
|
||||||
#ifndef WITH_BREAKING_CHANGES
|
#ifndef WITH_BREAKING_CHANGES
|
||||||
if (remote->origin == REMOTE_REMOTES)
|
if (remote->origin == REMOTE_REMOTES)
|
||||||
unlink_or_warn(repo_git_path_replace(the_repository, &buf,
|
unlink_or_warn(repo_git_path_replace(the_repository, &buf,
|
||||||
|
@ -707,12 +707,12 @@ static void handle_push_default(const char* old_name, const char* new_name)
|
||||||
.origin = STRBUF_INIT,
|
.origin = STRBUF_INIT,
|
||||||
.linenr = -1,
|
.linenr = -1,
|
||||||
};
|
};
|
||||||
git_config(config_read_push_default, &push_default);
|
repo_config(the_repository, config_read_push_default, &push_default);
|
||||||
if (push_default.scope >= CONFIG_SCOPE_COMMAND)
|
if (push_default.scope >= CONFIG_SCOPE_COMMAND)
|
||||||
; /* pass */
|
; /* pass */
|
||||||
else if (push_default.scope >= CONFIG_SCOPE_LOCAL) {
|
else if (push_default.scope >= CONFIG_SCOPE_LOCAL) {
|
||||||
int result = git_config_set_gently("remote.pushDefault",
|
int result = repo_config_set_gently(the_repository, "remote.pushDefault",
|
||||||
new_name);
|
new_name);
|
||||||
if (new_name && result && result != CONFIG_NOTHING_SET)
|
if (new_name && result && result != CONFIG_NOTHING_SET)
|
||||||
die(_("could not set '%s'"), "remote.pushDefault");
|
die(_("could not set '%s'"), "remote.pushDefault");
|
||||||
else if (!new_name && result && result != CONFIG_NOTHING_SET)
|
else if (!new_name && result && result != CONFIG_NOTHING_SET)
|
||||||
|
@ -788,7 +788,7 @@ static int mv(int argc, const char **argv, const char *prefix,
|
||||||
if (oldremote->fetch.nr) {
|
if (oldremote->fetch.nr) {
|
||||||
strbuf_reset(&buf);
|
strbuf_reset(&buf);
|
||||||
strbuf_addf(&buf, "remote.%s.fetch", rename.new_name);
|
strbuf_addf(&buf, "remote.%s.fetch", rename.new_name);
|
||||||
git_config_set_multivar(buf.buf, NULL, NULL, CONFIG_FLAGS_MULTI_REPLACE);
|
repo_config_set_multivar(the_repository, buf.buf, NULL, NULL, CONFIG_FLAGS_MULTI_REPLACE);
|
||||||
strbuf_addf(&old_remote_context, ":refs/remotes/%s/", rename.old_name);
|
strbuf_addf(&old_remote_context, ":refs/remotes/%s/", rename.old_name);
|
||||||
for (i = 0; i < oldremote->fetch.nr; i++) {
|
for (i = 0; i < oldremote->fetch.nr; i++) {
|
||||||
char *ptr;
|
char *ptr;
|
||||||
|
@ -808,7 +808,7 @@ static int mv(int argc, const char **argv, const char *prefix,
|
||||||
"\tPlease update the configuration manually if necessary."),
|
"\tPlease update the configuration manually if necessary."),
|
||||||
buf2.buf);
|
buf2.buf);
|
||||||
|
|
||||||
git_config_set_multivar(buf.buf, buf2.buf, "^$", 0);
|
repo_config_set_multivar(the_repository, buf.buf, buf2.buf, "^$", 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -819,12 +819,12 @@ static int mv(int argc, const char **argv, const char *prefix,
|
||||||
if (info->remote_name && !strcmp(info->remote_name, rename.old_name)) {
|
if (info->remote_name && !strcmp(info->remote_name, rename.old_name)) {
|
||||||
strbuf_reset(&buf);
|
strbuf_reset(&buf);
|
||||||
strbuf_addf(&buf, "branch.%s.remote", item->string);
|
strbuf_addf(&buf, "branch.%s.remote", item->string);
|
||||||
git_config_set(buf.buf, rename.new_name);
|
repo_config_set(the_repository, buf.buf, rename.new_name);
|
||||||
}
|
}
|
||||||
if (info->push_remote_name && !strcmp(info->push_remote_name, rename.old_name)) {
|
if (info->push_remote_name && !strcmp(info->push_remote_name, rename.old_name)) {
|
||||||
strbuf_reset(&buf);
|
strbuf_reset(&buf);
|
||||||
strbuf_addf(&buf, "branch.%s.pushRemote", item->string);
|
strbuf_addf(&buf, "branch.%s.pushRemote", item->string);
|
||||||
git_config_set(buf.buf, rename.new_name);
|
repo_config_set(the_repository, buf.buf, rename.new_name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -951,7 +951,7 @@ static int rm(int argc, const char **argv, const char *prefix,
|
||||||
strbuf_reset(&buf);
|
strbuf_reset(&buf);
|
||||||
strbuf_addf(&buf, "branch.%s.%s",
|
strbuf_addf(&buf, "branch.%s.%s",
|
||||||
item->string, *k);
|
item->string, *k);
|
||||||
result = git_config_set_gently(buf.buf, NULL);
|
result = repo_config_set_gently(the_repository, buf.buf, NULL);
|
||||||
if (result && result != CONFIG_NOTHING_SET)
|
if (result && result != CONFIG_NOTHING_SET)
|
||||||
die(_("could not unset '%s'"), buf.buf);
|
die(_("could not unset '%s'"), buf.buf);
|
||||||
}
|
}
|
||||||
|
@ -959,7 +959,7 @@ static int rm(int argc, const char **argv, const char *prefix,
|
||||||
if (info->push_remote_name && !strcmp(info->push_remote_name, remote->name)) {
|
if (info->push_remote_name && !strcmp(info->push_remote_name, remote->name)) {
|
||||||
strbuf_reset(&buf);
|
strbuf_reset(&buf);
|
||||||
strbuf_addf(&buf, "branch.%s.pushremote", item->string);
|
strbuf_addf(&buf, "branch.%s.pushremote", item->string);
|
||||||
result = git_config_set_gently(buf.buf, NULL);
|
result = repo_config_set_gently(the_repository, buf.buf, NULL);
|
||||||
if (result && result != CONFIG_NOTHING_SET)
|
if (result && result != CONFIG_NOTHING_SET)
|
||||||
die(_("could not unset '%s'"), buf.buf);
|
die(_("could not unset '%s'"), buf.buf);
|
||||||
}
|
}
|
||||||
|
@ -1285,7 +1285,7 @@ static int get_one_entry(struct remote *remote, void *priv)
|
||||||
|
|
||||||
strbuf_addf(&promisor_config, "remote.%s.partialclonefilter", remote->name);
|
strbuf_addf(&promisor_config, "remote.%s.partialclonefilter", remote->name);
|
||||||
strbuf_addf(&remote_info_buf, "%s (fetch)", remote->url.v[0]);
|
strbuf_addf(&remote_info_buf, "%s (fetch)", remote->url.v[0]);
|
||||||
if (!git_config_get_string_tmp(promisor_config.buf, &partial_clone_filter))
|
if (!repo_config_get_string_tmp(the_repository, promisor_config.buf, &partial_clone_filter))
|
||||||
strbuf_addf(&remote_info_buf, " [%s]", partial_clone_filter);
|
strbuf_addf(&remote_info_buf, " [%s]", partial_clone_filter);
|
||||||
|
|
||||||
strbuf_release(&promisor_config);
|
strbuf_release(&promisor_config);
|
||||||
|
@ -1520,7 +1520,7 @@ static int set_head(int argc, const char **argv, const char *prefix,
|
||||||
struct strbuf config_name = STRBUF_INIT;
|
struct strbuf config_name = STRBUF_INIT;
|
||||||
strbuf_addf(&config_name,
|
strbuf_addf(&config_name,
|
||||||
"remote.%s.followremotehead", remote->name);
|
"remote.%s.followremotehead", remote->name);
|
||||||
git_config_set(config_name.buf, "warn");
|
repo_config_set(the_repository, config_name.buf, "warn");
|
||||||
strbuf_release(&config_name);
|
strbuf_release(&config_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1637,7 +1637,7 @@ static int update(int argc, const char **argv, const char *prefix,
|
||||||
strvec_push(&cmd.args, argv[i]);
|
strvec_push(&cmd.args, argv[i]);
|
||||||
|
|
||||||
if (strcmp(cmd.args.v[cmd.args.nr-1], "default") == 0) {
|
if (strcmp(cmd.args.v[cmd.args.nr-1], "default") == 0) {
|
||||||
git_config(get_remote_default, &default_defined);
|
repo_config(the_repository, get_remote_default, &default_defined);
|
||||||
if (!default_defined) {
|
if (!default_defined) {
|
||||||
strvec_pop(&cmd.args);
|
strvec_pop(&cmd.args);
|
||||||
strvec_push(&cmd.args, "--all");
|
strvec_push(&cmd.args, "--all");
|
||||||
|
@ -1650,8 +1650,8 @@ static int update(int argc, const char **argv, const char *prefix,
|
||||||
|
|
||||||
static int remove_all_fetch_refspecs(const char *key)
|
static int remove_all_fetch_refspecs(const char *key)
|
||||||
{
|
{
|
||||||
return git_config_set_multivar_gently(key, NULL, NULL,
|
return repo_config_set_multivar_gently(the_repository, key, NULL, NULL,
|
||||||
CONFIG_FLAGS_MULTI_REPLACE);
|
CONFIG_FLAGS_MULTI_REPLACE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void add_branches(struct remote *remote, const char **branches,
|
static void add_branches(struct remote *remote, const char **branches,
|
||||||
|
@ -1807,10 +1807,10 @@ static int set_url(int argc, const char **argv, const char *prefix,
|
||||||
/* Special cases that add new entry. */
|
/* Special cases that add new entry. */
|
||||||
if ((!oldurl && !delete_mode) || add_mode) {
|
if ((!oldurl && !delete_mode) || add_mode) {
|
||||||
if (add_mode)
|
if (add_mode)
|
||||||
git_config_set_multivar(name_buf.buf, newurl,
|
repo_config_set_multivar(the_repository, name_buf.buf, newurl,
|
||||||
"^$", 0);
|
"^$", 0);
|
||||||
else
|
else
|
||||||
git_config_set(name_buf.buf, newurl);
|
repo_config_set(the_repository, name_buf.buf, newurl);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1831,10 +1831,10 @@ static int set_url(int argc, const char **argv, const char *prefix,
|
||||||
regfree(&old_regex);
|
regfree(&old_regex);
|
||||||
|
|
||||||
if (!delete_mode)
|
if (!delete_mode)
|
||||||
git_config_set_multivar(name_buf.buf, newurl, oldurl, 0);
|
repo_config_set_multivar(the_repository, name_buf.buf, newurl, oldurl, 0);
|
||||||
else
|
else
|
||||||
git_config_set_multivar(name_buf.buf, NULL, oldurl,
|
repo_config_set_multivar(the_repository, name_buf.buf, NULL, oldurl,
|
||||||
CONFIG_FLAGS_MULTI_REPLACE);
|
CONFIG_FLAGS_MULTI_REPLACE);
|
||||||
out:
|
out:
|
||||||
strbuf_release(&name_buf);
|
strbuf_release(&name_buf);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -1340,7 +1340,7 @@ int cmd_repack(int argc,
|
||||||
|
|
||||||
list_objects_filter_init(&po_args.filter_options);
|
list_objects_filter_init(&po_args.filter_options);
|
||||||
|
|
||||||
git_config(repack_config, &cruft_po_args);
|
repo_config(the_repository, repack_config, &cruft_po_args);
|
||||||
|
|
||||||
argc = parse_options(argc, argv, prefix, builtin_repack_options,
|
argc = parse_options(argc, argv, prefix, builtin_repack_options,
|
||||||
git_repack_usage, 0);
|
git_repack_usage, 0);
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
#include "builtin.h"
|
#include "builtin.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "editor.h"
|
#include "editor.h"
|
||||||
|
#include "environment.h"
|
||||||
#include "gettext.h"
|
#include "gettext.h"
|
||||||
#include "hex.h"
|
#include "hex.h"
|
||||||
#include "refs.h"
|
#include "refs.h"
|
||||||
|
@ -574,7 +575,7 @@ int cmd_replace(int argc,
|
||||||
};
|
};
|
||||||
|
|
||||||
disable_replace_refs();
|
disable_replace_refs();
|
||||||
git_config(git_default_config, NULL);
|
repo_config(the_repository, git_default_config, NULL);
|
||||||
|
|
||||||
argc = parse_options(argc, argv, prefix, options, git_replace_usage, 0);
|
argc = parse_options(argc, argv, prefix, options, git_replace_usage, 0);
|
||||||
|
|
||||||
|
|
|
@ -66,7 +66,7 @@ int cmd_rerere(int argc,
|
||||||
|
|
||||||
argc = parse_options(argc, argv, prefix, options, rerere_usage, 0);
|
argc = parse_options(argc, argv, prefix, options, rerere_usage, 0);
|
||||||
|
|
||||||
git_config(git_xmerge_config, NULL);
|
repo_config(the_repository, git_xmerge_config, NULL);
|
||||||
|
|
||||||
if (autoupdate == 1)
|
if (autoupdate == 1)
|
||||||
flags = RERERE_AUTOUPDATE;
|
flags = RERERE_AUTOUPDATE;
|
||||||
|
|
|
@ -377,7 +377,7 @@ int cmd_reset(int argc,
|
||||||
OPT_END()
|
OPT_END()
|
||||||
};
|
};
|
||||||
|
|
||||||
git_config(git_reset_config, NULL);
|
repo_config(the_repository, git_reset_config, NULL);
|
||||||
|
|
||||||
argc = parse_options(argc, argv, prefix, options, git_reset_usage,
|
argc = parse_options(argc, argv, prefix, options, git_reset_usage,
|
||||||
PARSE_OPT_KEEP_DASHDASH);
|
PARSE_OPT_KEEP_DASHDASH);
|
||||||
|
|
|
@ -644,7 +644,7 @@ int cmd_rev_list(int argc,
|
||||||
|
|
||||||
show_usage_if_asked(argc, argv, rev_list_usage);
|
show_usage_if_asked(argc, argv, rev_list_usage);
|
||||||
|
|
||||||
git_config(git_default_config, NULL);
|
repo_config(the_repository, git_default_config, NULL);
|
||||||
repo_init_revisions(the_repository, &revs, prefix);
|
repo_init_revisions(the_repository, &revs, prefix);
|
||||||
revs.abbrev = DEFAULT_ABBREV;
|
revs.abbrev = DEFAULT_ABBREV;
|
||||||
revs.commit_format = CMIT_FMT_UNSPECIFIED;
|
revs.commit_format = CMIT_FMT_UNSPECIFIED;
|
||||||
|
|
|
@ -734,7 +734,7 @@ int cmd_rev_parse(int argc,
|
||||||
/* No options; just report on whether we're in a git repo or not. */
|
/* No options; just report on whether we're in a git repo or not. */
|
||||||
if (argc == 1) {
|
if (argc == 1) {
|
||||||
setup_git_directory();
|
setup_git_directory();
|
||||||
git_config(git_default_config, NULL);
|
repo_config(the_repository, git_default_config, NULL);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -769,7 +769,7 @@ int cmd_rev_parse(int argc,
|
||||||
/* The rest of the options require a git repository. */
|
/* The rest of the options require a git repository. */
|
||||||
if (!did_repo_setup) {
|
if (!did_repo_setup) {
|
||||||
prefix = setup_git_directory();
|
prefix = setup_git_directory();
|
||||||
git_config(git_default_config, NULL);
|
repo_config(the_repository, git_default_config, NULL);
|
||||||
did_repo_setup = 1;
|
did_repo_setup = 1;
|
||||||
|
|
||||||
prepare_repo_settings(the_repository);
|
prepare_repo_settings(the_repository);
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
#include "builtin.h"
|
#include "builtin.h"
|
||||||
#include "advice.h"
|
#include "advice.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
#include "environment.h"
|
||||||
#include "lockfile.h"
|
#include "lockfile.h"
|
||||||
#include "dir.h"
|
#include "dir.h"
|
||||||
#include "gettext.h"
|
#include "gettext.h"
|
||||||
|
@ -271,7 +272,7 @@ int cmd_rm(int argc,
|
||||||
struct pathspec pathspec;
|
struct pathspec pathspec;
|
||||||
char *seen;
|
char *seen;
|
||||||
|
|
||||||
git_config(git_default_config, NULL);
|
repo_config(the_repository, git_default_config, NULL);
|
||||||
|
|
||||||
argc = parse_options(argc, argv, prefix, builtin_rm_options,
|
argc = parse_options(argc, argv, prefix, builtin_rm_options,
|
||||||
builtin_rm_usage, 0);
|
builtin_rm_usage, 0);
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#include "builtin.h"
|
#include "builtin.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
#include "environment.h"
|
||||||
#include "hex.h"
|
#include "hex.h"
|
||||||
#include "pkt-line.h"
|
#include "pkt-line.h"
|
||||||
#include "run-command.h"
|
#include "run-command.h"
|
||||||
|
|
|
@ -421,7 +421,7 @@ int cmd_shortlog(int argc,
|
||||||
if (nongit && !the_hash_algo)
|
if (nongit && !the_hash_algo)
|
||||||
repo_set_hash_algo(the_repository, GIT_HASH_DEFAULT);
|
repo_set_hash_algo(the_repository, GIT_HASH_DEFAULT);
|
||||||
|
|
||||||
git_config(git_default_config, NULL);
|
repo_config(the_repository, git_default_config, NULL);
|
||||||
shortlog_init(&log);
|
shortlog_init(&log);
|
||||||
repo_init_revisions(the_repository, &rev, prefix);
|
repo_init_revisions(the_repository, &rev, prefix);
|
||||||
parse_options_start(&ctx, argc, argv, prefix, options,
|
parse_options_start(&ctx, argc, argv, prefix, options,
|
||||||
|
|
|
@ -710,7 +710,7 @@ int cmd_show_branch(int ac,
|
||||||
|
|
||||||
init_commit_name_slab(&name_slab);
|
init_commit_name_slab(&name_slab);
|
||||||
|
|
||||||
git_config(git_show_branch_config, NULL);
|
repo_config(the_repository, git_show_branch_config, NULL);
|
||||||
|
|
||||||
/* If nothing is specified, try the default first */
|
/* If nothing is specified, try the default first */
|
||||||
if (ac == 1 && default_args.nr) {
|
if (ac == 1 && default_args.nr) {
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#define USE_THE_REPOSITORY_VARIABLE
|
#define USE_THE_REPOSITORY_VARIABLE
|
||||||
#include "builtin.h"
|
#include "builtin.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
#include "environment.h"
|
||||||
#include "gettext.h"
|
#include "gettext.h"
|
||||||
#include "hex.h"
|
#include "hex.h"
|
||||||
#include "refs/refs-internal.h"
|
#include "refs/refs-internal.h"
|
||||||
|
@ -324,7 +325,7 @@ struct repository *repo UNUSED)
|
||||||
OPT_END()
|
OPT_END()
|
||||||
};
|
};
|
||||||
|
|
||||||
git_config(git_default_config, NULL);
|
repo_config(the_repository, git_default_config, NULL);
|
||||||
|
|
||||||
argc = parse_options(argc, argv, prefix, show_ref_options,
|
argc = parse_options(argc, argv, prefix, show_ref_options,
|
||||||
show_ref_usage, 0);
|
show_ref_usage, 0);
|
||||||
|
|
|
@ -1082,7 +1082,7 @@ int cmd_sparse_checkout(int argc,
|
||||||
builtin_sparse_checkout_options,
|
builtin_sparse_checkout_options,
|
||||||
builtin_sparse_checkout_usage, 0);
|
builtin_sparse_checkout_usage, 0);
|
||||||
|
|
||||||
git_config(git_default_config, NULL);
|
repo_config(the_repository, git_default_config, NULL);
|
||||||
|
|
||||||
prepare_repo_settings(the_repository);
|
prepare_repo_settings(the_repository);
|
||||||
the_repository->settings.command_requires_full_index = 0;
|
the_repository->settings.command_requires_full_index = 0;
|
||||||
|
|
|
@ -979,7 +979,7 @@ static int show_stash(int argc, const char **argv, const char *prefix,
|
||||||
int do_usage = 0;
|
int do_usage = 0;
|
||||||
|
|
||||||
init_diff_ui_defaults();
|
init_diff_ui_defaults();
|
||||||
git_config(git_diff_ui_config, NULL);
|
repo_config(the_repository, git_diff_ui_config, NULL);
|
||||||
repo_init_revisions(the_repository, &rev, prefix);
|
repo_init_revisions(the_repository, &rev, prefix);
|
||||||
|
|
||||||
argc = parse_options(argc, argv, prefix, options, git_stash_show_usage,
|
argc = parse_options(argc, argv, prefix, options, git_stash_show_usage,
|
||||||
|
@ -2358,7 +2358,7 @@ int cmd_stash(int argc,
|
||||||
const char **args_copy;
|
const char **args_copy;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
git_config(git_stash_config, NULL);
|
repo_config(the_repository, git_stash_config, NULL);
|
||||||
|
|
||||||
argc = parse_options(argc, argv, prefix, options, git_stash_usage,
|
argc = parse_options(argc, argv, prefix, options, git_stash_usage,
|
||||||
PARSE_OPT_SUBCOMMAND_OPTIONAL |
|
PARSE_OPT_SUBCOMMAND_OPTIONAL |
|
||||||
|
|
|
@ -55,7 +55,7 @@ int cmd_stripspace(int argc,
|
||||||
|
|
||||||
if (mode == STRIP_COMMENTS || mode == COMMENT_LINES) {
|
if (mode == STRIP_COMMENTS || mode == COMMENT_LINES) {
|
||||||
setup_git_directory_gently(&nongit);
|
setup_git_directory_gently(&nongit);
|
||||||
git_config(git_default_config, NULL);
|
repo_config(the_repository, git_default_config, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strbuf_read(&buf, 0, 1024) < 0)
|
if (strbuf_read(&buf, 0, 1024) < 0)
|
||||||
|
|
|
@ -53,7 +53,7 @@ static char *resolve_relative_url(const char *rel_url, const char *up_path, int
|
||||||
struct strbuf remotesb = STRBUF_INIT;
|
struct strbuf remotesb = STRBUF_INIT;
|
||||||
|
|
||||||
strbuf_addf(&remotesb, "remote.%s.url", remote);
|
strbuf_addf(&remotesb, "remote.%s.url", remote);
|
||||||
if (git_config_get_string(remotesb.buf, &remoteurl)) {
|
if (repo_config_get_string(the_repository, remotesb.buf, &remoteurl)) {
|
||||||
if (!quiet)
|
if (!quiet)
|
||||||
warning(_("could not look up configuration '%s'. "
|
warning(_("could not look up configuration '%s'. "
|
||||||
"Assuming this repository is its own "
|
"Assuming this repository is its own "
|
||||||
|
@ -458,7 +458,7 @@ static void init_submodule(const char *path, const char *prefix,
|
||||||
*/
|
*/
|
||||||
if (!is_submodule_active(the_repository, path)) {
|
if (!is_submodule_active(the_repository, path)) {
|
||||||
strbuf_addf(&sb, "submodule.%s.active", sub->name);
|
strbuf_addf(&sb, "submodule.%s.active", sub->name);
|
||||||
git_config_set_gently(sb.buf, "true");
|
repo_config_set_gently(the_repository, sb.buf, "true");
|
||||||
strbuf_reset(&sb);
|
strbuf_reset(&sb);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -468,7 +468,7 @@ static void init_submodule(const char *path, const char *prefix,
|
||||||
* .gitmodules, so look it up directly.
|
* .gitmodules, so look it up directly.
|
||||||
*/
|
*/
|
||||||
strbuf_addf(&sb, "submodule.%s.url", sub->name);
|
strbuf_addf(&sb, "submodule.%s.url", sub->name);
|
||||||
if (git_config_get_string(sb.buf, &url)) {
|
if (repo_config_get_string(the_repository, sb.buf, &url)) {
|
||||||
if (!sub->url)
|
if (!sub->url)
|
||||||
die(_("No url found for submodule path '%s' in .gitmodules"),
|
die(_("No url found for submodule path '%s' in .gitmodules"),
|
||||||
displaypath);
|
displaypath);
|
||||||
|
@ -484,7 +484,7 @@ static void init_submodule(const char *path, const char *prefix,
|
||||||
free(oldurl);
|
free(oldurl);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (git_config_set_gently(sb.buf, url))
|
if (repo_config_set_gently(the_repository, sb.buf, url))
|
||||||
die(_("Failed to register url for submodule path '%s'"),
|
die(_("Failed to register url for submodule path '%s'"),
|
||||||
displaypath);
|
displaypath);
|
||||||
if (!(flags & OPT_QUIET))
|
if (!(flags & OPT_QUIET))
|
||||||
|
@ -496,7 +496,7 @@ static void init_submodule(const char *path, const char *prefix,
|
||||||
|
|
||||||
/* Copy "update" setting when it is not set yet */
|
/* Copy "update" setting when it is not set yet */
|
||||||
strbuf_addf(&sb, "submodule.%s.update", sub->name);
|
strbuf_addf(&sb, "submodule.%s.update", sub->name);
|
||||||
if (git_config_get_string_tmp(sb.buf, &upd) &&
|
if (repo_config_get_string_tmp(the_repository, sb.buf, &upd) &&
|
||||||
sub->update_strategy.type != SM_UPDATE_UNSPECIFIED) {
|
sub->update_strategy.type != SM_UPDATE_UNSPECIFIED) {
|
||||||
if (sub->update_strategy.type == SM_UPDATE_COMMAND) {
|
if (sub->update_strategy.type == SM_UPDATE_COMMAND) {
|
||||||
fprintf(stderr, _("warning: command update mode suggested for submodule '%s'\n"),
|
fprintf(stderr, _("warning: command update mode suggested for submodule '%s'\n"),
|
||||||
|
@ -506,7 +506,7 @@ static void init_submodule(const char *path, const char *prefix,
|
||||||
upd = submodule_update_type_to_string(sub->update_strategy.type);
|
upd = submodule_update_type_to_string(sub->update_strategy.type);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (git_config_set_gently(sb.buf, upd))
|
if (repo_config_set_gently(the_repository, sb.buf, upd))
|
||||||
die(_("Failed to register update mode for submodule path '%s'"), displaypath);
|
die(_("Failed to register update mode for submodule path '%s'"), displaypath);
|
||||||
}
|
}
|
||||||
strbuf_release(&sb);
|
strbuf_release(&sb);
|
||||||
|
@ -549,7 +549,7 @@ static int module_init(int argc, const char **argv, const char *prefix,
|
||||||
* If there are no path args and submodule.active is set then,
|
* If there are no path args and submodule.active is set then,
|
||||||
* by default, only initialize 'active' modules.
|
* by default, only initialize 'active' modules.
|
||||||
*/
|
*/
|
||||||
if (!argc && !git_config_get("submodule.active"))
|
if (!argc && !repo_config_get(the_repository, "submodule.active"))
|
||||||
module_list_active(&list);
|
module_list_active(&list);
|
||||||
|
|
||||||
info.prefix = prefix;
|
info.prefix = prefix;
|
||||||
|
@ -649,7 +649,7 @@ static void status_submodule(const char *path, const struct object_id *ce_oid,
|
||||||
"--ignore-submodules=dirty", "--quiet", "--",
|
"--ignore-submodules=dirty", "--quiet", "--",
|
||||||
path, NULL);
|
path, NULL);
|
||||||
|
|
||||||
git_config(git_diff_basic_config, NULL);
|
repo_config(the_repository, git_diff_basic_config, NULL);
|
||||||
|
|
||||||
repo_init_revisions(the_repository, &rev, NULL);
|
repo_init_revisions(the_repository, &rev, NULL);
|
||||||
rev.abbrev = 0;
|
rev.abbrev = 0;
|
||||||
|
@ -1034,7 +1034,7 @@ static void prepare_submodule_summary(struct summary_cb *info,
|
||||||
|
|
||||||
config_key = xstrfmt("submodule.%s.ignore",
|
config_key = xstrfmt("submodule.%s.ignore",
|
||||||
sub->name);
|
sub->name);
|
||||||
if (!git_config_get_string_tmp(config_key, &value))
|
if (!repo_config_get_string_tmp(the_repository, config_key, &value))
|
||||||
ignore_all = !strcmp(value, "all");
|
ignore_all = !strcmp(value, "all");
|
||||||
else if (sub->ignore)
|
else if (sub->ignore)
|
||||||
ignore_all = !strcmp(sub->ignore, "all");
|
ignore_all = !strcmp(sub->ignore, "all");
|
||||||
|
@ -1108,7 +1108,7 @@ static int compute_summary_module_list(struct object_id *head_oid,
|
||||||
if (info->argc)
|
if (info->argc)
|
||||||
strvec_pushv(&diff_args, info->argv);
|
strvec_pushv(&diff_args, info->argv);
|
||||||
|
|
||||||
git_config(git_diff_basic_config, NULL);
|
repo_config(the_repository, git_diff_basic_config, NULL);
|
||||||
repo_init_revisions(the_repository, &rev, info->prefix);
|
repo_init_revisions(the_repository, &rev, info->prefix);
|
||||||
rev.abbrev = 0;
|
rev.abbrev = 0;
|
||||||
precompose_argv_prefix(diff_args.nr, diff_args.v, NULL);
|
precompose_argv_prefix(diff_args.nr, diff_args.v, NULL);
|
||||||
|
@ -1262,7 +1262,7 @@ static void sync_submodule(const char *path, const char *prefix,
|
||||||
|
|
||||||
strbuf_reset(&sb);
|
strbuf_reset(&sb);
|
||||||
strbuf_addf(&sb, "submodule.%s.url", sub->name);
|
strbuf_addf(&sb, "submodule.%s.url", sub->name);
|
||||||
if (git_config_set_gently(sb.buf, super_config_url))
|
if (repo_config_set_gently(the_repository, sb.buf, super_config_url))
|
||||||
die(_("failed to register url for submodule path '%s'"),
|
die(_("failed to register url for submodule path '%s'"),
|
||||||
displaypath);
|
displaypath);
|
||||||
|
|
||||||
|
@ -1280,7 +1280,7 @@ static void sync_submodule(const char *path, const char *prefix,
|
||||||
submodule_to_gitdir(the_repository, &sb, path);
|
submodule_to_gitdir(the_repository, &sb, path);
|
||||||
strbuf_addstr(&sb, "/config");
|
strbuf_addstr(&sb, "/config");
|
||||||
|
|
||||||
if (git_config_set_in_file_gently(sb.buf, remote_key, NULL, sub_origin_url))
|
if (repo_config_set_in_file_gently(the_repository, sb.buf, remote_key, NULL, sub_origin_url))
|
||||||
die(_("failed to update remote for submodule '%s'"),
|
die(_("failed to update remote for submodule '%s'"),
|
||||||
path);
|
path);
|
||||||
|
|
||||||
|
@ -1623,11 +1623,11 @@ static void prepare_possible_alternates(const char *sm_name,
|
||||||
char *sm_alternate = NULL, *error_strategy = NULL;
|
char *sm_alternate = NULL, *error_strategy = NULL;
|
||||||
struct submodule_alternate_setup sas = SUBMODULE_ALTERNATE_SETUP_INIT;
|
struct submodule_alternate_setup sas = SUBMODULE_ALTERNATE_SETUP_INIT;
|
||||||
|
|
||||||
git_config_get_string("submodule.alternateLocation", &sm_alternate);
|
repo_config_get_string(the_repository, "submodule.alternateLocation", &sm_alternate);
|
||||||
if (!sm_alternate)
|
if (!sm_alternate)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
git_config_get_string("submodule.alternateErrorStrategy", &error_strategy);
|
repo_config_get_string(the_repository, "submodule.alternateErrorStrategy", &error_strategy);
|
||||||
|
|
||||||
if (!error_strategy)
|
if (!error_strategy)
|
||||||
error_strategy = xstrdup("die");
|
error_strategy = xstrdup("die");
|
||||||
|
@ -1808,14 +1808,14 @@ static int clone_submodule(const struct module_clone_data *clone_data,
|
||||||
die(_("could not get submodule directory for '%s'"), clone_data_path);
|
die(_("could not get submodule directory for '%s'"), clone_data_path);
|
||||||
|
|
||||||
/* setup alternateLocation and alternateErrorStrategy in the cloned submodule if needed */
|
/* setup alternateLocation and alternateErrorStrategy in the cloned submodule if needed */
|
||||||
git_config_get_string("submodule.alternateLocation", &sm_alternate);
|
repo_config_get_string(the_repository, "submodule.alternateLocation", &sm_alternate);
|
||||||
if (sm_alternate)
|
if (sm_alternate)
|
||||||
git_config_set_in_file(p, "submodule.alternateLocation",
|
repo_config_set_in_file(the_repository, p, "submodule.alternateLocation",
|
||||||
sm_alternate);
|
sm_alternate);
|
||||||
git_config_get_string("submodule.alternateErrorStrategy", &error_strategy);
|
repo_config_get_string(the_repository, "submodule.alternateErrorStrategy", &error_strategy);
|
||||||
if (error_strategy)
|
if (error_strategy)
|
||||||
git_config_set_in_file(p, "submodule.alternateErrorStrategy",
|
repo_config_set_in_file(the_repository, p, "submodule.alternateErrorStrategy",
|
||||||
error_strategy);
|
error_strategy);
|
||||||
|
|
||||||
free(sm_alternate);
|
free(sm_alternate);
|
||||||
free(error_strategy);
|
free(error_strategy);
|
||||||
|
@ -2522,7 +2522,7 @@ static int ensure_core_worktree(const char *path)
|
||||||
abs_path = absolute_pathdup(path);
|
abs_path = absolute_pathdup(path);
|
||||||
rel_path = relative_path(abs_path, subrepo.gitdir, &sb);
|
rel_path = relative_path(abs_path, subrepo.gitdir, &sb);
|
||||||
|
|
||||||
git_config_set_in_file(cfg_file, "core.worktree", rel_path);
|
repo_config_set_in_file(the_repository, cfg_file, "core.worktree", rel_path);
|
||||||
|
|
||||||
free(cfg_file);
|
free(cfg_file);
|
||||||
free(abs_path);
|
free(abs_path);
|
||||||
|
@ -2830,7 +2830,7 @@ static int module_update(int argc, const char **argv, const char *prefix,
|
||||||
};
|
};
|
||||||
|
|
||||||
update_clone_config_from_gitmodules(&opt.max_jobs);
|
update_clone_config_from_gitmodules(&opt.max_jobs);
|
||||||
git_config(git_update_clone_config, &opt.max_jobs);
|
repo_config(the_repository, git_update_clone_config, &opt.max_jobs);
|
||||||
|
|
||||||
argc = parse_options(argc, argv, prefix, module_update_options,
|
argc = parse_options(argc, argv, prefix, module_update_options,
|
||||||
git_submodule_helper_usage, 0);
|
git_submodule_helper_usage, 0);
|
||||||
|
@ -2878,7 +2878,7 @@ static int module_update(int argc, const char **argv, const char *prefix,
|
||||||
* If there are no path args and submodule.active is set then,
|
* If there are no path args and submodule.active is set then,
|
||||||
* by default, only initialize 'active' modules.
|
* by default, only initialize 'active' modules.
|
||||||
*/
|
*/
|
||||||
if (!argc && !git_config_get("submodule.active"))
|
if (!argc && !repo_config_get(the_repository, "submodule.active"))
|
||||||
module_list_active(&list);
|
module_list_active(&list);
|
||||||
|
|
||||||
info.prefix = opt.prefix;
|
info.prefix = opt.prefix;
|
||||||
|
@ -3128,7 +3128,7 @@ static int module_create_branch(int argc, const char **argv, const char *prefix,
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
git_config(git_default_config, NULL);
|
repo_config(the_repository, git_default_config, NULL);
|
||||||
track = git_branch_track;
|
track = git_branch_track;
|
||||||
argc = parse_options(argc, argv, prefix, options, usage, 0);
|
argc = parse_options(argc, argv, prefix, options, usage, 0);
|
||||||
|
|
||||||
|
@ -3309,7 +3309,7 @@ static void configure_added_submodule(struct add_data *add_data)
|
||||||
struct child_process add_gitmodules = CHILD_PROCESS_INIT;
|
struct child_process add_gitmodules = CHILD_PROCESS_INIT;
|
||||||
|
|
||||||
key = xstrfmt("submodule.%s.url", add_data->sm_name);
|
key = xstrfmt("submodule.%s.url", add_data->sm_name);
|
||||||
git_config_set_gently(key, add_data->realrepo);
|
repo_config_set_gently(the_repository, key, add_data->realrepo);
|
||||||
free(key);
|
free(key);
|
||||||
|
|
||||||
add_submod.git_cmd = 1;
|
add_submod.git_cmd = 1;
|
||||||
|
@ -3349,19 +3349,19 @@ static void configure_added_submodule(struct add_data *add_data)
|
||||||
* is_submodule_active(), since that function needs to find
|
* is_submodule_active(), since that function needs to find
|
||||||
* out the value of "submodule.active" again anyway.
|
* out the value of "submodule.active" again anyway.
|
||||||
*/
|
*/
|
||||||
if (!git_config_get("submodule.active")) {
|
if (!repo_config_get(the_repository, "submodule.active")) {
|
||||||
/*
|
/*
|
||||||
* If the submodule being added isn't already covered by the
|
* If the submodule being added isn't already covered by the
|
||||||
* current configured pathspec, set the submodule's active flag
|
* current configured pathspec, set the submodule's active flag
|
||||||
*/
|
*/
|
||||||
if (!is_submodule_active(the_repository, add_data->sm_path)) {
|
if (!is_submodule_active(the_repository, add_data->sm_path)) {
|
||||||
key = xstrfmt("submodule.%s.active", add_data->sm_name);
|
key = xstrfmt("submodule.%s.active", add_data->sm_name);
|
||||||
git_config_set_gently(key, "true");
|
repo_config_set_gently(the_repository, key, "true");
|
||||||
free(key);
|
free(key);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
key = xstrfmt("submodule.%s.active", add_data->sm_name);
|
key = xstrfmt("submodule.%s.active", add_data->sm_name);
|
||||||
git_config_set_gently(key, "true");
|
repo_config_set_gently(the_repository, key, "true");
|
||||||
free(key);
|
free(key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#define USE_THE_REPOSITORY_VARIABLE
|
#define USE_THE_REPOSITORY_VARIABLE
|
||||||
#include "builtin.h"
|
#include "builtin.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
#include "environment.h"
|
||||||
#include "gettext.h"
|
#include "gettext.h"
|
||||||
#include "refs.h"
|
#include "refs.h"
|
||||||
#include "parse-options.h"
|
#include "parse-options.h"
|
||||||
|
@ -59,7 +60,7 @@ int cmd_symbolic_ref(int argc,
|
||||||
OPT_END(),
|
OPT_END(),
|
||||||
};
|
};
|
||||||
|
|
||||||
git_config(git_default_config, NULL);
|
repo_config(the_repository, git_default_config, NULL);
|
||||||
argc = parse_options(argc, argv, prefix, options,
|
argc = parse_options(argc, argv, prefix, options,
|
||||||
git_symbolic_ref_usage, 0);
|
git_symbolic_ref_usage, 0);
|
||||||
if (msg && !*msg)
|
if (msg && !*msg)
|
||||||
|
|
|
@ -546,7 +546,7 @@ int cmd_tag(int argc,
|
||||||
* Try to set sort keys from config. If config does not set any,
|
* Try to set sort keys from config. If config does not set any,
|
||||||
* fall back on default (refname) sorting.
|
* fall back on default (refname) sorting.
|
||||||
*/
|
*/
|
||||||
git_config(git_tag_config, &sorting_options);
|
repo_config(the_repository, git_tag_config, &sorting_options);
|
||||||
if (!sorting_options.nr)
|
if (!sorting_options.nr)
|
||||||
string_list_append(&sorting_options, "refname");
|
string_list_append(&sorting_options, "refname");
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#define USE_THE_REPOSITORY_VARIABLE
|
#define USE_THE_REPOSITORY_VARIABLE
|
||||||
#include "builtin.h"
|
#include "builtin.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
#include "environment.h"
|
||||||
#include "hex.h"
|
#include "hex.h"
|
||||||
#include "object-file.h"
|
#include "object-file.h"
|
||||||
#include "object-name.h"
|
#include "object-name.h"
|
||||||
|
@ -43,7 +44,7 @@ int cmd_unpack_file(int argc,
|
||||||
if (repo_get_oid(the_repository, argv[1], &oid))
|
if (repo_get_oid(the_repository, argv[1], &oid))
|
||||||
die("Not a valid object name %s", argv[1]);
|
die("Not a valid object name %s", argv[1]);
|
||||||
|
|
||||||
git_config(git_default_config, NULL);
|
repo_config(the_repository, git_default_config, NULL);
|
||||||
|
|
||||||
puts(create_temp_file(&oid));
|
puts(create_temp_file(&oid));
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -621,7 +621,7 @@ int cmd_unpack_objects(int argc,
|
||||||
|
|
||||||
disable_replace_refs();
|
disable_replace_refs();
|
||||||
|
|
||||||
git_config(git_default_config, NULL);
|
repo_config(the_repository, git_default_config, NULL);
|
||||||
|
|
||||||
quiet = !isatty(2);
|
quiet = !isatty(2);
|
||||||
|
|
||||||
|
|
|
@ -1103,7 +1103,7 @@ int cmd_update_index(int argc,
|
||||||
show_usage_with_options_if_asked(argc, argv,
|
show_usage_with_options_if_asked(argc, argv,
|
||||||
update_index_usage, options);
|
update_index_usage, options);
|
||||||
|
|
||||||
git_config(git_default_config, NULL);
|
repo_config(the_repository, git_default_config, NULL);
|
||||||
|
|
||||||
prepare_repo_settings(r);
|
prepare_repo_settings(r);
|
||||||
the_repository->settings.command_requires_full_index = 0;
|
the_repository->settings.command_requires_full_index = 0;
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
#include "builtin.h"
|
#include "builtin.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
#include "environment.h"
|
||||||
#include "gettext.h"
|
#include "gettext.h"
|
||||||
#include "hash.h"
|
#include "hash.h"
|
||||||
#include "hex.h"
|
#include "hex.h"
|
||||||
|
@ -769,7 +770,7 @@ int cmd_update_ref(int argc,
|
||||||
OPT_END(),
|
OPT_END(),
|
||||||
};
|
};
|
||||||
|
|
||||||
git_config(git_default_config, NULL);
|
repo_config(the_repository, git_default_config, NULL);
|
||||||
argc = parse_options(argc, argv, prefix, options, git_update_ref_usage,
|
argc = parse_options(argc, argv, prefix, options, git_update_ref_usage,
|
||||||
0);
|
0);
|
||||||
if (msg && !*msg)
|
if (msg && !*msg)
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#include "builtin.h"
|
#include "builtin.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
#include "environment.h"
|
||||||
#include "gettext.h"
|
#include "gettext.h"
|
||||||
#include "parse-options.h"
|
#include "parse-options.h"
|
||||||
#include "server-info.h"
|
#include "server-info.h"
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
#include "attr.h"
|
#include "attr.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "editor.h"
|
#include "editor.h"
|
||||||
|
#include "environment.h"
|
||||||
#include "ident.h"
|
#include "ident.h"
|
||||||
#include "pager.h"
|
#include "pager.h"
|
||||||
#include "refs.h"
|
#include "refs.h"
|
||||||
|
@ -226,11 +227,11 @@ int cmd_var(int argc,
|
||||||
usage(var_usage);
|
usage(var_usage);
|
||||||
|
|
||||||
if (strcmp(argv[1], "-l") == 0) {
|
if (strcmp(argv[1], "-l") == 0) {
|
||||||
git_config(show_config, NULL);
|
repo_config(the_repository, show_config, NULL);
|
||||||
list_vars();
|
list_vars();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
git_config(git_default_config, NULL);
|
repo_config(the_repository, git_default_config, NULL);
|
||||||
|
|
||||||
git_var = get_git_var(argv[1]);
|
git_var = get_git_var(argv[1]);
|
||||||
if (!git_var)
|
if (!git_var)
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
*/
|
*/
|
||||||
#include "builtin.h"
|
#include "builtin.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
#include "environment.h"
|
||||||
#include "gettext.h"
|
#include "gettext.h"
|
||||||
#include "object-name.h"
|
#include "object-name.h"
|
||||||
#include "commit.h"
|
#include "commit.h"
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#define USE_THE_REPOSITORY_VARIABLE
|
#define USE_THE_REPOSITORY_VARIABLE
|
||||||
#include "builtin.h"
|
#include "builtin.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
#include "environment.h"
|
||||||
#include "gettext.h"
|
#include "gettext.h"
|
||||||
#include "run-command.h"
|
#include "run-command.h"
|
||||||
#include "parse-options.h"
|
#include "parse-options.h"
|
||||||
|
@ -81,7 +82,7 @@ int cmd_verify_pack(int argc,
|
||||||
OPT_END()
|
OPT_END()
|
||||||
};
|
};
|
||||||
|
|
||||||
git_config(git_default_config, NULL);
|
repo_config(the_repository, git_default_config, NULL);
|
||||||
argc = parse_options(argc, argv, prefix, verify_pack_options,
|
argc = parse_options(argc, argv, prefix, verify_pack_options,
|
||||||
verify_pack_usage, 0);
|
verify_pack_usage, 0);
|
||||||
if (argc < 1)
|
if (argc < 1)
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
*/
|
*/
|
||||||
#include "builtin.h"
|
#include "builtin.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
#include "environment.h"
|
||||||
#include "gettext.h"
|
#include "gettext.h"
|
||||||
#include "tag.h"
|
#include "tag.h"
|
||||||
#include "object-name.h"
|
#include "object-name.h"
|
||||||
|
|
|
@ -379,13 +379,13 @@ static void copy_filtered_worktree_config(const char *worktree_git_dir)
|
||||||
|
|
||||||
if (!git_configset_get_bool(&cs, "core.bare", &bare) &&
|
if (!git_configset_get_bool(&cs, "core.bare", &bare) &&
|
||||||
bare &&
|
bare &&
|
||||||
git_config_set_multivar_in_file_gently(
|
repo_config_set_multivar_in_file_gently(the_repository,
|
||||||
to_file, "core.bare", NULL, "true", NULL, 0))
|
to_file, "core.bare", NULL, "true", NULL, 0))
|
||||||
error(_("failed to unset '%s' in '%s'"),
|
error(_("failed to unset '%s' in '%s'"),
|
||||||
"core.bare", to_file);
|
"core.bare", to_file);
|
||||||
if (!git_configset_get(&cs, "core.worktree") &&
|
if (!git_configset_get(&cs, "core.worktree") &&
|
||||||
git_config_set_in_file_gently(to_file,
|
repo_config_set_in_file_gently(the_repository, to_file,
|
||||||
"core.worktree", NULL, NULL))
|
"core.worktree", NULL, NULL))
|
||||||
error(_("failed to unset '%s' in '%s'"),
|
error(_("failed to unset '%s' in '%s'"),
|
||||||
"core.worktree", to_file);
|
"core.worktree", to_file);
|
||||||
|
|
||||||
|
@ -1448,7 +1448,7 @@ int cmd_worktree(int ac,
|
||||||
OPT_END()
|
OPT_END()
|
||||||
};
|
};
|
||||||
|
|
||||||
git_config(git_worktree_config, NULL);
|
repo_config(the_repository, git_worktree_config, NULL);
|
||||||
|
|
||||||
if (!prefix)
|
if (!prefix)
|
||||||
prefix = "";
|
prefix = "";
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
#define USE_THE_REPOSITORY_VARIABLE
|
#define USE_THE_REPOSITORY_VARIABLE
|
||||||
#include "builtin.h"
|
#include "builtin.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
#include "environment.h"
|
||||||
#include "gettext.h"
|
#include "gettext.h"
|
||||||
#include "hex.h"
|
#include "hex.h"
|
||||||
#include "tree.h"
|
#include "tree.h"
|
||||||
|
@ -43,7 +44,7 @@ int cmd_write_tree(int argc,
|
||||||
OPT_END()
|
OPT_END()
|
||||||
};
|
};
|
||||||
|
|
||||||
git_config(git_default_config, NULL);
|
repo_config(the_repository, git_default_config, NULL);
|
||||||
argc = parse_options(argc, argv, cmd_prefix, write_tree_options,
|
argc = parse_options(argc, argv, cmd_prefix, write_tree_options,
|
||||||
write_tree_usage, 0);
|
write_tree_usage, 0);
|
||||||
|
|
||||||
|
|
|
@ -52,7 +52,7 @@ char *unique_tracking_name(const char *name, struct object_id *oid,
|
||||||
{
|
{
|
||||||
struct tracking_name_data cb_data = TRACKING_NAME_DATA_INIT;
|
struct tracking_name_data cb_data = TRACKING_NAME_DATA_INIT;
|
||||||
const char *default_remote = NULL;
|
const char *default_remote = NULL;
|
||||||
if (!git_config_get_string_tmp("checkout.defaultremote", &default_remote))
|
if (!repo_config_get_string_tmp(the_repository, "checkout.defaultremote", &default_remote))
|
||||||
cb_data.default_remote = default_remote;
|
cb_data.default_remote = default_remote;
|
||||||
cb_data.src_ref = xstrfmt("refs/heads/%s", name);
|
cb_data.src_ref = xstrfmt("refs/heads/%s", name);
|
||||||
cb_data.dst_oid = oid;
|
cb_data.dst_oid = oid;
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue