MCPcopy Create free account
hub / github.com/git/git / check_apply_state

Function check_apply_state

apply.c:153–191  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

151}
152
153int check_apply_state(struct apply_state *state, int force_apply)
154{
155 int is_not_gitdir = !startup_info->have_repository;
156
157 if (state->apply_with_reject && state->threeway)
158 return error(_("options '%s' and '%s' cannot be used together"), "--reject", "--3way");
159 if (state->threeway) {
160 if (is_not_gitdir)
161 return error(_("'%s' outside a repository"), "--3way");
162 state->check_index = 1;
163 }
164 if (state->apply_with_reject) {
165 state->apply = 1;
166 if (state->apply_verbosity == verbosity_normal)
167 state->apply_verbosity = verbosity_verbose;
168 }
169 if (!force_apply && (state->diffstat || state->numstat || state->summary || state->check || state->fake_ancestor))
170 state->apply = 0;
171 if (state->check_index && is_not_gitdir)
172 return error(_("'%s' outside a repository"), "--index");
173 if (state->cached) {
174 if (is_not_gitdir)
175 return error(_("'%s' outside a repository"), "--cached");
176 state->check_index = 1;
177 }
178 if (state->ita_only && (state->check_index || is_not_gitdir))
179 state->ita_only = 0;
180 if (state->check_index)
181 state->unsafe_paths = 0;
182
183 if (state->apply_verbosity <= verbosity_silent) {
184 state->saved_error_routine = get_error_routine();
185 state->saved_warn_routine = get_warn_routine();
186 set_error_routine(mute_routine);
187 set_warn_routine(mute_routine);
188 }
189
190 return 0;
191}
192
193static void set_default_whitespace_mode(struct apply_state *state)
194{

Callers 2

run_applyFunction · 0.85
cmd_applyFunction · 0.85

Calls 5

errorFunction · 0.85
get_error_routineFunction · 0.85
get_warn_routineFunction · 0.85
set_error_routineFunction · 0.85
set_warn_routineFunction · 0.85

Tested by

no test coverage detected