rebase: make the backend configurable via config setting
Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>maint
parent
76340c8107
commit
8295ed690b
|
@ -5,6 +5,14 @@ rebase.useBuiltin::
|
||||||
is always used. Setting this will emit a warning, to alert any
|
is always used. Setting this will emit a warning, to alert any
|
||||||
remaining users that setting this now does nothing.
|
remaining users that setting this now does nothing.
|
||||||
|
|
||||||
|
rebase.backend::
|
||||||
|
Default backend to use for rebasing. Possible choices are
|
||||||
|
'am' or 'merge' (note that the merge backend is sometimes also
|
||||||
|
refered to as the interactive backend or the interactive
|
||||||
|
machinery elsewhere in the docs). Also, in the future, if the
|
||||||
|
merge backend gains all remaining capabilities of the am
|
||||||
|
backend, this setting may become unused.
|
||||||
|
|
||||||
rebase.stat::
|
rebase.stat::
|
||||||
Whether to show a diffstat of what changed upstream since the last
|
Whether to show a diffstat of what changed upstream since the last
|
||||||
rebase. False by default.
|
rebase. False by default.
|
||||||
|
|
|
@ -60,6 +60,7 @@ enum empty_type {
|
||||||
struct rebase_options {
|
struct rebase_options {
|
||||||
enum rebase_type type;
|
enum rebase_type type;
|
||||||
enum empty_type empty;
|
enum empty_type empty;
|
||||||
|
const char *default_backend;
|
||||||
const char *state_dir;
|
const char *state_dir;
|
||||||
struct commit *upstream;
|
struct commit *upstream;
|
||||||
const char *upstream_name;
|
const char *upstream_name;
|
||||||
|
@ -100,6 +101,7 @@ struct rebase_options {
|
||||||
#define REBASE_OPTIONS_INIT { \
|
#define REBASE_OPTIONS_INIT { \
|
||||||
.type = REBASE_UNSPECIFIED, \
|
.type = REBASE_UNSPECIFIED, \
|
||||||
.empty = EMPTY_UNSPECIFIED, \
|
.empty = EMPTY_UNSPECIFIED, \
|
||||||
|
.default_backend = "am", \
|
||||||
.flags = REBASE_NO_QUIET, \
|
.flags = REBASE_NO_QUIET, \
|
||||||
.git_am_opts = ARGV_ARRAY_INIT, \
|
.git_am_opts = ARGV_ARRAY_INIT, \
|
||||||
.git_format_patch_opt = STRBUF_INIT \
|
.git_format_patch_opt = STRBUF_INIT \
|
||||||
|
@ -1272,6 +1274,10 @@ static int rebase_config(const char *var, const char *value, void *data)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!strcmp(var, "rebase.backend")) {
|
||||||
|
return git_config_string(&opts->default_backend, var, value);
|
||||||
|
}
|
||||||
|
|
||||||
return git_default_config(var, value, data);
|
return git_default_config(var, value, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1900,9 +1906,23 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
|
||||||
if (strcmp(options.git_am_opts.argv[i], "-q"))
|
if (strcmp(options.git_am_opts.argv[i], "-q"))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (is_interactive(&options) && i >= 0)
|
if (i >= 0) {
|
||||||
die(_("cannot combine am options with either "
|
if (is_interactive(&options))
|
||||||
"interactive or merge options"));
|
die(_("cannot combine am options with either "
|
||||||
|
"interactive or merge options"));
|
||||||
|
else
|
||||||
|
options.type = REBASE_AM;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (options.type == REBASE_UNSPECIFIED) {
|
||||||
|
if (!strcmp(options.default_backend, "merge"))
|
||||||
|
options.type = REBASE_MERGE;
|
||||||
|
else if (!strcmp(options.default_backend, "am"))
|
||||||
|
options.type = REBASE_AM;
|
||||||
|
else
|
||||||
|
die(_("Unknown rebase backend: %s"),
|
||||||
|
options.default_backend);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (options.type) {
|
switch (options.type) {
|
||||||
|
@ -1915,10 +1935,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
|
||||||
options.state_dir = apply_dir();
|
options.state_dir = apply_dir();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
/* the default rebase backend is `--am` */
|
BUG("options.type was just set above; should be unreachable.");
|
||||||
options.type = REBASE_AM;
|
|
||||||
options.state_dir = apply_dir();
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (options.empty == EMPTY_UNSPECIFIED) {
|
if (options.empty == EMPTY_UNSPECIFIED) {
|
||||||
|
|
Loading…
Reference in New Issue