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

Function config_get_rebase

builtin/pull.c:198–221  ·  view source on GitHub ↗

* Returns the default configured value for --rebase. It first looks for the * value of "branch.$curr_branch.rebase", where $curr_branch is the current * branch, and if HEAD is detached or the configuration key does not exist, * looks for the value of "pull.rebase". If both configuration keys do not * exist, returns REBASE_FALSE. */

Source from the content-addressed store, hash-verified

196 * exist, returns REBASE_FALSE.
197 */
198static enum rebase_type config_get_rebase(int *rebase_unspecified)
199{
200 struct branch *curr_branch = branch_get("HEAD");
201 const char *value;
202
203 if (curr_branch) {
204 char *key = xstrfmt("branch.%s.rebase", curr_branch->name);
205
206 if (!repo_config_get_value(the_repository, key, &value)) {
207 enum rebase_type ret = parse_config_rebase(key, value, 1);
208 free(key);
209 return ret;
210 }
211
212 free(key);
213 }
214
215 if (!repo_config_get_value(the_repository, "pull.rebase", &value))
216 return parse_config_rebase("pull.rebase", value, 1);
217
218 *rebase_unspecified = 1;
219
220 return REBASE_FALSE;
221}
222
223/**
224 * Read config variables.

Callers 1

cmd_pullFunction · 0.85

Calls 4

branch_getFunction · 0.85
xstrfmtFunction · 0.85
repo_config_get_valueFunction · 0.85
parse_config_rebaseFunction · 0.85

Tested by

no test coverage detected