+20
-8
index 5e54453f79..7e5b12323e 100644
--- a/apply.c
+++ b/apply.c
int p_value;
};
-static void git_apply_config(void)
+static void git_apply_config(struct repository *repo)
{
- repo_config_get_string(the_repository, "apply.whitespace", &apply_default_whitespace);
- repo_config_get_string(the_repository, "apply.ignorewhitespace", &apply_default_ignorewhitespace);
- repo_config(the_repository, git_xmerge_config, NULL);
+ struct repo_config_values *cfg = repo_config_values(repo);
+
+ FREE_AND_NULL(cfg->apply_default_whitespace);
+ repo_config_get_string(repo, "apply.whitespace",
+ &cfg->apply_default_whitespace);
+ FREE_AND_NULL(cfg->apply_default_ignorewhitespace);
+ repo_config_get_string(repo, "apply.ignorewhitespace",
+ &cfg->apply_default_ignorewhitespace);
+ repo_config(repo, git_xmerge_config, NULL);
}
static int parse_whitespace_option(struct apply_state *state, const char *option)
struct repository *repo,
const char *prefix)
{
+ struct repo_config_values *cfg = repo_config_values(repo);
+
memset(state, 0, sizeof(*state));
state->prefix = prefix;
state->repo = repo;
strset_init(&state->kept_symlinks);
strbuf_init(&state->root, 0);
- git_apply_config();
- if (apply_default_whitespace && parse_whitespace_option(state, apply_default_whitespace))
+ git_apply_config(repo);
+
+ if (cfg->apply_default_whitespace &&
+ parse_whitespace_option(state, cfg->apply_default_whitespace))
return -1;
- if (apply_default_ignorewhitespace && parse_ignorewhitespace_option(state, apply_default_ignorewhitespace))
+ if (cfg->apply_default_ignorewhitespace &&
+ parse_ignorewhitespace_option(state, cfg->apply_default_ignorewhitespace))
return -1;
return 0;
}
static void set_default_whitespace_mode(struct apply_state *state)
{
- if (!state->whitespace_option && !apply_default_whitespace)
+ if (!state->whitespace_option &&
+ !repo_config_values(state->repo)->apply_default_whitespace)
state->ws_error_action = (state->apply ? warn_on_ws_error : nowarn_ws_error);
}