Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2023-06-21 01:53:13 +0300
committerJunio C Hamano <gitster@pobox.com>2023-06-21 01:53:13 +0300
commit7cb4274d2606775b0d5b373756f76f386a31bb64 (patch)
tree4b3ddb8b70ec60ca3ff8402c9924ef547f717a65 /builtin
parent9cd234e6465ab2bea5c402f0d9ee1495501250ef (diff)
parent3867f6d650c89230ae7393e2d57160ccc14758c7 (diff)
Merge branch 'vd/worktree-config-is-per-repository'
The value of config.worktree is per-repository, but has been kept in a singleton global variable per process. This has been OK as most Git operations interacted with a single repository at a time, but not right for operations like recursive "grep" that want to access multiple repositories from a single process without forking. The global variable has been eliminated and made into a member in the per-repository data structure. * vd/worktree-config-is-per-repository: repository: move 'repository_format_worktree_config' to repo scope config: pass 'repo' directly to 'config_with_options()' config: use gitdir to get worktree config
Diffstat (limited to 'builtin')
-rw-r--r--builtin/config.c17
-rw-r--r--builtin/worktree.c2
2 files changed, 12 insertions, 7 deletions
diff --git a/builtin/config.c b/builtin/config.c
index ff2fe8ef12..d40fddb042 100644
--- a/builtin/config.c
+++ b/builtin/config.c
@@ -5,6 +5,7 @@
#include "color.h"
#include "editor.h"
#include "environment.h"
+#include "repository.h"
#include "gettext.h"
#include "ident.h"
#include "parse-options.h"
@@ -375,7 +376,8 @@ static int get_value(const char *key_, const char *regex_, unsigned flags)
}
config_with_options(collect_config, &values,
- &given_config_source, &config_options);
+ &given_config_source, the_repository,
+ &config_options);
if (!values.nr && default_value) {
struct strbuf *item;
@@ -486,7 +488,8 @@ static void get_color(const char *var, const char *def_color)
get_color_found = 0;
parsed_color[0] = '\0';
config_with_options(git_get_color_config, NULL,
- &given_config_source, &config_options);
+ &given_config_source, the_repository,
+ &config_options);
if (!get_color_found && def_color) {
if (color_parse(def_color, parsed_color) < 0)
@@ -518,7 +521,8 @@ static int get_colorbool(const char *var, int print)
get_diff_color_found = -1;
get_color_ui_found = -1;
config_with_options(git_get_colorbool_config, NULL,
- &given_config_source, &config_options);
+ &given_config_source, the_repository,
+ &config_options);
if (get_colorbool_found < 0) {
if (!strcmp(get_colorbool_slot, "color.diff"))
@@ -607,7 +611,8 @@ static int get_urlmatch(const char *var, const char *url)
}
config_with_options(urlmatch_config_entry, &config,
- &given_config_source, &config_options);
+ &given_config_source, the_repository,
+ &config_options);
ret = !values.nr;
@@ -713,7 +718,7 @@ int cmd_config(int argc, const char **argv, const char *prefix)
given_config_source.scope = CONFIG_SCOPE_LOCAL;
} else if (use_worktree_config) {
struct worktree **worktrees = get_worktrees();
- if (repository_format_worktree_config)
+ if (the_repository->repository_format_worktree_config)
given_config_source.file = git_pathdup("config.worktree");
else if (worktrees[0] && worktrees[1])
die(_("--worktree cannot be used with multiple "
@@ -827,7 +832,7 @@ int cmd_config(int argc, const char **argv, const char *prefix)
if (actions == ACTION_LIST) {
check_argc(argc, 0, 0);
if (config_with_options(show_all_config, NULL,
- &given_config_source,
+ &given_config_source, the_repository,
&config_options) < 0) {
if (given_config_source.file)
die_errno(_("unable to read config file '%s'"),
diff --git a/builtin/worktree.c b/builtin/worktree.c
index f3180463be..60e389aaed 100644
--- a/builtin/worktree.c
+++ b/builtin/worktree.c
@@ -483,7 +483,7 @@ static int add_worktree(const char *path, const char *refname,
* values from the current worktree into the new one, that way the
* new worktree behaves the same as this one.
*/
- if (repository_format_worktree_config)
+ if (the_repository->repository_format_worktree_config)
copy_filtered_worktree_config(sb_repo.buf);
strvec_pushf(&child_env, "%s=%s", GIT_DIR_ENVIRONMENT, sb_git.buf);