mirror of
https://github.com/git-for-windows/git.git
synced 2026-03-16 10:59:54 -05:00
config: FSMonitor is repository-specific
This commit refactors `git_config_get_fsmonitor()` into the `repo_*()` form that takes a parameter `struct repository *r`. That change prepares for the upcoming `core.useBuiltinFSMonitor` flag which will be stored in the `repo_settings` struct. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This commit is contained in:
@@ -1216,14 +1216,14 @@ int cmd_update_index(int argc, const char **argv, const char *prefix)
|
||||
}
|
||||
|
||||
if (fsmonitor > 0) {
|
||||
if (git_config_get_fsmonitor() == 0)
|
||||
if (repo_config_get_fsmonitor(r) == 0)
|
||||
warning(_("core.fsmonitor is unset; "
|
||||
"set it if you really want to "
|
||||
"enable fsmonitor"));
|
||||
add_fsmonitor(&the_index);
|
||||
report(_("fsmonitor enabled"));
|
||||
} else if (!fsmonitor) {
|
||||
if (git_config_get_fsmonitor() == 1)
|
||||
if (repo_config_get_fsmonitor(r) == 1)
|
||||
warning(_("core.fsmonitor is set; "
|
||||
"remove it if you really want to "
|
||||
"disable fsmonitor"));
|
||||
|
||||
4
config.c
4
config.c
@@ -2516,9 +2516,9 @@ int git_config_get_max_percent_split_change(void)
|
||||
return -1; /* default value */
|
||||
}
|
||||
|
||||
int git_config_get_fsmonitor(void)
|
||||
int repo_config_get_fsmonitor(struct repository *r)
|
||||
{
|
||||
if (git_config_get_pathname("core.fsmonitor", &core_fsmonitor))
|
||||
if (repo_config_get_pathname(r, "core.fsmonitor", &core_fsmonitor))
|
||||
core_fsmonitor = getenv("GIT_TEST_FSMONITOR");
|
||||
|
||||
if (core_fsmonitor && !*core_fsmonitor)
|
||||
|
||||
2
config.h
2
config.h
@@ -609,7 +609,7 @@ int git_config_get_index_threads(int *dest);
|
||||
int git_config_get_untracked_cache(void);
|
||||
int git_config_get_split_index(void);
|
||||
int git_config_get_max_percent_split_change(void);
|
||||
int git_config_get_fsmonitor(void);
|
||||
int repo_config_get_fsmonitor(struct repository *r);
|
||||
|
||||
/* This dies if the configured or default date is in the future */
|
||||
int git_config_get_expiry(const char *key, const char **output);
|
||||
|
||||
@@ -411,7 +411,7 @@ void remove_fsmonitor(struct index_state *istate)
|
||||
void tweak_fsmonitor(struct index_state *istate)
|
||||
{
|
||||
unsigned int i;
|
||||
int fsmonitor_enabled = git_config_get_fsmonitor();
|
||||
int fsmonitor_enabled = repo_config_get_fsmonitor(istate->repo ? istate->repo : the_repository);
|
||||
|
||||
if (istate->fsmonitor_dirty) {
|
||||
if (fsmonitor_enabled) {
|
||||
|
||||
Reference in New Issue
Block a user