rebase: rename the two primary rebase backends

Two related changes, with separate rationale for each:

Rename the 'interactive' backend to 'merge' because:
  * 'interactive' as a name caused confusion; this backend has been used
    for many kinds of non-interactive rebases, and will probably be used
    in the future for more non-interactive rebases than interactive ones
    given that we are making it the default.
  * 'interactive' is not the underlying strategy; merging is.
  * the directory where state is stored is not called
    .git/rebase-interactive but .git/rebase-merge.

Rename the 'am' backend to 'apply' because:
  * Few users are familiar with git-am as a reference point.
  * Related to the above, the name 'am' makes sentences in the
    documentation harder for users to read and comprehend (they may read
    it as the verb from "I am"); avoiding this difficult places a large
    burden on anyone writing documentation about this backend to be very
    careful with quoting and sentence structure and often forces
    annoying redundancy to try to avoid such problems.
  * Users stumble over pronunciation ("am" as in "I am a person not a
    backend" or "am" as in "the first and thirteenth letters in the
    alphabet in order are "A-M"); this may drive confusion when one user
    tries to explain to another what they are doing.
  * While "am" is the tool driving this backend, the tool driving git-am
    is git-apply, and since we are driving towards lower-level tools
    for the naming of the merge backend we may as well do so here too.
  * The directory where state is stored has never been called
    .git/rebase-am, it was always called .git/rebase-apply.

For all the reasons listed above:
  * Modify the documentation to refer to the backends with the new names
  * Provide a brief note in the documentation connecting the new names
    to the old names in case users run across the old names anywhere
    (e.g. in old release notes or older versions of the documentation)
  * Change the (new) --am command line flag to --apply
  * Rename some enums, variables, and functions to reinforce the new
    backend names for us as well.

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Elijah Newren 2020-02-15 21:36:41 +00:00 коммит произвёл Junio C Hamano
Родитель 2ac0d6273f
Коммит 10cdb9f38a
18 изменённых файлов: 166 добавлений и 168 удалений

Просмотреть файл

@ -7,11 +7,9 @@ rebase.useBuiltin::
rebase.backend:: rebase.backend::
Default backend to use for rebasing. Possible choices are Default backend to use for rebasing. Possible choices are
'am' or 'merge' (note that the merge backend is sometimes also 'apply' or 'merge'. In the future, if the merge backend gains
refered to as the interactive backend or the interactive all remaining capabilities of the apply backend, this setting
machinery elsewhere in the docs). Also, in the future, if the may become unused.
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

Просмотреть файл

@ -258,10 +258,10 @@ See also INCOMPATIBLE OPTIONS below.
original branch. The index and working tree are also left original branch. The index and working tree are also left
unchanged as a result. unchanged as a result.
--am: --apply:
Use git-am internally to rebase. This option may become a Use applying strategies to rebase (calling `git-am`
no-op in the future once the interactive backend handles internally). This option may become a no-op in the future
everything the am one does. once the merge backend handles everything the apply one does.
+ +
See also INCOMPATIBLE OPTIONS below. See also INCOMPATIBLE OPTIONS below.
@ -385,7 +385,7 @@ See also INCOMPATIBLE OPTIONS below.
Ensure at least <n> lines of surrounding context match before Ensure at least <n> lines of surrounding context match before
and after each change. When fewer lines of surrounding and after each change. When fewer lines of surrounding
context exist they all must match. By default no context is context exist they all must match. By default no context is
ever ignored. Implies --am. ever ignored. Implies --apply.
+ +
See also INCOMPATIBLE OPTIONS below. See also INCOMPATIBLE OPTIONS below.
@ -425,7 +425,7 @@ with `--keep-base` in order to drop those commits from your branch.
--whitespace=<option>:: --whitespace=<option>::
These flags are passed to the 'git apply' program These flags are passed to the 'git apply' program
(see linkgit:git-apply[1]) that applies the patch. (see linkgit:git-apply[1]) that applies the patch.
Implies --am. Implies --apply.
+ +
See also INCOMPATIBLE OPTIONS below. See also INCOMPATIBLE OPTIONS below.
@ -569,7 +569,7 @@ INCOMPATIBLE OPTIONS
The following options: The following options:
* --am * --apply
* --committer-date-is-author-date * --committer-date-is-author-date
* --ignore-date * --ignore-date
* --ignore-whitespace * --ignore-whitespace
@ -604,42 +604,48 @@ In addition, the following pairs of options are incompatible:
BEHAVIORAL DIFFERENCES BEHAVIORAL DIFFERENCES
----------------------- -----------------------
There are some subtle differences how the backends behave. git rebase has two primary backends: apply and merge. (The apply
backend used to known as the 'am' backend, but the name led to
confusion as it looks like a verb instead of a noun. Also, the merge
backend used to be known as the interactive backend, but it is now
used for non-interactive cases as well. Both were renamed based on
lower-level functionality that underpinned each.) There are some
subtle differences in how these two backends behave:
Empty commits Empty commits
~~~~~~~~~~~~~ ~~~~~~~~~~~~~
The am backend unfortunately drops intentionally empty commits, i.e. The apply backend unfortunately drops intentionally empty commits, i.e.
commits that started empty, though these are rare in practice. It commits that started empty, though these are rare in practice. It
also drops commits that become empty and has no option for controlling also drops commits that become empty and has no option for controlling
this behavior. this behavior.
The interactive backend keeps intentionally empty commits. Similar to The merge backend keeps intentionally empty commits. Similar to the
the am backend, by default the interactive backend drops commits that apply backend, by default the merge backend drops commits that become
become empty unless -i/--interactive is specified (in which case it empty unless -i/--interactive is specified (in which case it stops and
stops and asks the user what to do). The interactive backend also has asks the user what to do). The merge backend also has an
an --empty={drop,keep,ask} option for changing the behavior of --empty={drop,keep,ask} option for changing the behavior of handling
handling commits that become empty. commits that become empty.
Directory rename detection Directory rename detection
~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~
Due to the lack of accurate tree information (arising from Due to the lack of accurate tree information (arising from
constructing fake ancestors with the limited information available in constructing fake ancestors with the limited information available in
patches), directory rename detection is disabled in the am backend. patches), directory rename detection is disabled in the apply backend.
Disabled directory rename detection means that if one side of history Disabled directory rename detection means that if one side of history
renames a directory and the other adds new files to the old directory, renames a directory and the other adds new files to the old directory,
then the new files will be left behind in the old directory without then the new files will be left behind in the old directory without
any warning at the time of rebasing that you may want to move these any warning at the time of rebasing that you may want to move these
files into the new directory. files into the new directory.
Directory rename detection works with the merge and interactive Directory rename detection works with the merge backend to provide you
backends to provide you warnings in such cases. warnings in such cases.
Context Context
~~~~~~~ ~~~~~~~
The am backend works by creating a sequence of patches (by calling The apply backend works by creating a sequence of patches (by calling
`format-patch` internally), and then applying the patches in sequence `format-patch` internally), and then applying the patches in sequence
(calling `am` internally). Patches are composed of multiple hunks, (calling `am` internally). Patches are composed of multiple hunks,
each with line numbers, a context region, and the actual changes. The each with line numbers, a context region, and the actual changes. The
@ -654,7 +660,7 @@ Setting diff.context to a larger value may prevent such types of
problems, but increases the chance of spurious conflicts (since it problems, but increases the chance of spurious conflicts (since it
will require more lines of matching context to apply). will require more lines of matching context to apply).
The interactive backend works with a full copy of each relevant file, The merge backend works with a full copy of each relevant file,
insulating it from these types of problems. insulating it from these types of problems.
Labelling of conflicts markers Labelling of conflicts markers
@ -662,34 +668,33 @@ Labelling of conflicts markers
When there are content conflicts, the merge machinery tries to When there are content conflicts, the merge machinery tries to
annotate each side's conflict markers with the commits where the annotate each side's conflict markers with the commits where the
content came from. Since the am backend drops the original content came from. Since the apply backend drops the original
information about the rebased commits and their parents (and instead information about the rebased commits and their parents (and instead
generates new fake commits based off limited information in the generates new fake commits based off limited information in the
generated patches), those commits cannot be identified; instead it has generated patches), those commits cannot be identified; instead it has
to fall back to a commit summary. Also, when merge.conflictStyle is to fall back to a commit summary. Also, when merge.conflictStyle is
set to diff3, the am backend will use "constructed merge base" to set to diff3, the apply backend will use "constructed merge base" to
label the content from the merge base, and thus provide no information label the content from the merge base, and thus provide no information
about the merge base commit whatsoever. about the merge base commit whatsoever.
The interactive backend works with the full commits on both sides of The merge backend works with the full commits on both sides of history
history and thus has no such limitations. and thus has no such limitations.
Hooks Hooks
~~~~~ ~~~~~
The am backend has not traditionally called the post-commit hook, The apply backend has not traditionally called the post-commit hook,
while the merge/interactive backend has. However, this was by while the merge backend has. However, this was by accident of
accident of implementation rather than by design. Both backends implementation rather than by design. Both backends should have the
should have the same behavior, though it is not clear which one is same behavior, though it is not clear which one is correct.
correct.
Interruptability Interruptability
~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~
The am backend has safety problems with an ill-timed interrupt; if the The apply backend has safety problems with an ill-timed interrupt; if
user presses Ctrl-C at the wrong time to try to abort the rebase, the the user presses Ctrl-C at the wrong time to try to abort the rebase,
rebase can enter a state where it cannot be aborted with a subsequent the rebase can enter a state where it cannot be aborted with a
`git rebase --abort`. The interactive backend does not appear to subsequent `git rebase --abort`. The merge backend does not appear to
suffer from the same shortcoming. (See suffer from the same shortcoming. (See
https://lore.kernel.org/git/20200207132152.GC2868@szeder.dev/ for https://lore.kernel.org/git/20200207132152.GC2868@szeder.dev/ for
details.) details.)
@ -707,9 +712,9 @@ completeness:
* Progress, informational, and error messages: The two backends * Progress, informational, and error messages: The two backends
provide slightly different progress and informational messages. provide slightly different progress and informational messages.
Also, the am backend writes error messages (such as "Your files Also, the apply backend writes error messages (such as "Your files
would be overwritten...") to stdout, while the interactive backend would be overwritten...") to stdout, while the merge backend writes
writes them to stderr. them to stderr.
* State directories: The two backends keep their state in different * State directories: The two backends keep their state in different
directories under .git/ directories under .git/

Просмотреть файл

@ -44,9 +44,8 @@ static GIT_PATH_FUNC(merge_dir, "rebase-merge")
enum rebase_type { enum rebase_type {
REBASE_UNSPECIFIED = -1, REBASE_UNSPECIFIED = -1,
REBASE_AM, REBASE_APPLY,
REBASE_MERGE, REBASE_MERGE,
REBASE_INTERACTIVE,
REBASE_PRESERVE_MERGES REBASE_PRESERVE_MERGES
}; };
@ -380,7 +379,7 @@ static int do_interactive_rebase(struct rebase_options *opts, unsigned flags)
return ret; return ret;
} }
static int run_rebase_interactive(struct rebase_options *opts, static int run_sequencer_rebase(struct rebase_options *opts,
enum action command) enum action command)
{ {
unsigned flags = 0; unsigned flags = 0;
@ -462,7 +461,7 @@ static int parse_opt_keep_empty(const struct option *opt, const char *arg,
* If we ever want to remap --keep-empty to --empty=keep, insert: * If we ever want to remap --keep-empty to --empty=keep, insert:
* opts->empty = unset ? EMPTY_UNSPECIFIED : EMPTY_KEEP; * opts->empty = unset ? EMPTY_UNSPECIFIED : EMPTY_KEEP;
*/ */
opts->type = REBASE_INTERACTIVE; opts->type = REBASE_MERGE;
return 0; return 0;
} }
@ -555,28 +554,26 @@ int cmd_rebase__interactive(int argc, const char **argv, const char *prefix)
warning(_("--[no-]rebase-cousins has no effect without " warning(_("--[no-]rebase-cousins has no effect without "
"--rebase-merges")); "--rebase-merges"));
return !!run_rebase_interactive(&opts, command); return !!run_sequencer_rebase(&opts, command);
} }
static int is_interactive(struct rebase_options *opts) static int is_merge(struct rebase_options *opts)
{ {
return opts->type == REBASE_INTERACTIVE || return opts->type == REBASE_MERGE ||
opts->type == REBASE_PRESERVE_MERGES; opts->type == REBASE_PRESERVE_MERGES;
} }
static void imply_interactive(struct rebase_options *opts, const char *option) static void imply_merge(struct rebase_options *opts, const char *option)
{ {
switch (opts->type) { switch (opts->type) {
case REBASE_AM: case REBASE_APPLY:
die(_("%s requires an interactive rebase"), option); die(_("%s requires an interactive rebase"), option);
break; break;
case REBASE_INTERACTIVE: case REBASE_MERGE:
case REBASE_PRESERVE_MERGES: case REBASE_PRESERVE_MERGES:
break; break;
case REBASE_MERGE:
/* we now implement --merge via --interactive */
default: default:
opts->type = REBASE_INTERACTIVE; /* implied */ opts->type = REBASE_MERGE; /* implied */
break; break;
} }
} }
@ -785,7 +782,7 @@ static int finish_rebase(struct rebase_options *opts)
* user should see them. * user should see them.
*/ */
run_command_v_opt(argv_gc_auto, RUN_GIT_CMD); run_command_v_opt(argv_gc_auto, RUN_GIT_CMD);
if (opts->type == REBASE_INTERACTIVE) { if (opts->type == REBASE_MERGE) {
struct replay_opts replay = REPLAY_OPTS_INIT; struct replay_opts replay = REPLAY_OPTS_INIT;
replay.action = REPLAY_INTERACTIVE_REBASE; replay.action = REPLAY_INTERACTIVE_REBASE;
@ -1118,8 +1115,8 @@ static int run_specific_rebase(struct rebase_options *opts, enum action action)
int status; int status;
const char *backend, *backend_func; const char *backend, *backend_func;
if (opts->type == REBASE_INTERACTIVE) { if (opts->type == REBASE_MERGE) {
/* Run builtin interactive rebase */ /* Run sequencer-based rebase */
setenv("GIT_CHERRY_PICK_HELP", resolvemsg, 1); setenv("GIT_CHERRY_PICK_HELP", resolvemsg, 1);
if (!(opts->flags & REBASE_INTERACTIVE_EXPLICIT)) { if (!(opts->flags & REBASE_INTERACTIVE_EXPLICIT)) {
setenv("GIT_SEQUENCE_EDITOR", ":", 1); setenv("GIT_SEQUENCE_EDITOR", ":", 1);
@ -1132,11 +1129,11 @@ static int run_specific_rebase(struct rebase_options *opts, enum action action)
opts->gpg_sign_opt = tmp; opts->gpg_sign_opt = tmp;
} }
status = run_rebase_interactive(opts, action); status = run_sequencer_rebase(opts, action);
goto finished_rebase; goto finished_rebase;
} }
if (opts->type == REBASE_AM) { if (opts->type == REBASE_APPLY) {
status = run_am(opts); status = run_am(opts);
goto finished_rebase; goto finished_rebase;
} }
@ -1190,7 +1187,7 @@ static int run_specific_rebase(struct rebase_options *opts, enum action action)
add_var(&script_snippet, "git_format_patch_opt", add_var(&script_snippet, "git_format_patch_opt",
opts->git_format_patch_opt.buf); opts->git_format_patch_opt.buf);
if (is_interactive(opts) && if (is_merge(opts) &&
!(opts->flags & REBASE_INTERACTIVE_EXPLICIT)) { !(opts->flags & REBASE_INTERACTIVE_EXPLICIT)) {
strbuf_addstr(&script_snippet, strbuf_addstr(&script_snippet,
"GIT_SEQUENCE_EDITOR=:; export GIT_SEQUENCE_EDITOR; "); "GIT_SEQUENCE_EDITOR=:; export GIT_SEQUENCE_EDITOR; ");
@ -1215,8 +1212,8 @@ static int run_specific_rebase(struct rebase_options *opts, enum action action)
finished_rebase: finished_rebase:
if (opts->dont_finish_rebase) if (opts->dont_finish_rebase)
; /* do nothing */ ; /* do nothing */
else if (opts->type == REBASE_INTERACTIVE) else if (opts->type == REBASE_MERGE)
; /* interactive rebase cleans up after itself */ ; /* merge backend cleans up after itself */
else if (status == 0) { else if (status == 0) {
if (!file_exists(state_dir_path("stopped-sha", opts))) if (!file_exists(state_dir_path("stopped-sha", opts)))
finish_rebase(opts); finish_rebase(opts);
@ -1348,7 +1345,7 @@ static int parse_opt_am(const struct option *opt, const char *arg, int unset)
BUG_ON_OPT_NEG(unset); BUG_ON_OPT_NEG(unset);
BUG_ON_OPT_ARG(arg); BUG_ON_OPT_ARG(arg);
opts->type = REBASE_AM; opts->type = REBASE_APPLY;
return 0; return 0;
} }
@ -1361,7 +1358,7 @@ static int parse_opt_merge(const struct option *opt, const char *arg, int unset)
BUG_ON_OPT_NEG(unset); BUG_ON_OPT_NEG(unset);
BUG_ON_OPT_ARG(arg); BUG_ON_OPT_ARG(arg);
if (!is_interactive(opts)) if (!is_merge(opts))
opts->type = REBASE_MERGE; opts->type = REBASE_MERGE;
return 0; return 0;
@ -1376,7 +1373,7 @@ static int parse_opt_interactive(const struct option *opt, const char *arg,
BUG_ON_OPT_NEG(unset); BUG_ON_OPT_NEG(unset);
BUG_ON_OPT_ARG(arg); BUG_ON_OPT_ARG(arg);
opts->type = REBASE_INTERACTIVE; opts->type = REBASE_MERGE;
opts->flags |= REBASE_INTERACTIVE_EXPLICIT; opts->flags |= REBASE_INTERACTIVE_EXPLICIT;
return 0; return 0;
@ -1440,7 +1437,7 @@ static void set_reflog_action(struct rebase_options *options)
const char *env; const char *env;
struct strbuf buf = STRBUF_INIT; struct strbuf buf = STRBUF_INIT;
if (!is_interactive(options)) if (!is_merge(options))
return; return;
env = getenv(GIT_REFLOG_ACTION_ENVIRONMENT); env = getenv(GIT_REFLOG_ACTION_ENVIRONMENT);
@ -1537,8 +1534,8 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
OPT_CMDMODE(0, "show-current-patch", &action, OPT_CMDMODE(0, "show-current-patch", &action,
N_("show the patch file being applied or merged"), N_("show the patch file being applied or merged"),
ACTION_SHOW_CURRENT_PATCH), ACTION_SHOW_CURRENT_PATCH),
{ OPTION_CALLBACK, 0, "am", &options, NULL, { OPTION_CALLBACK, 0, "apply", &options, NULL,
N_("use apply-mail strategies to rebase"), N_("use apply strategies to rebase"),
PARSE_OPT_NOARG | PARSE_OPT_NONEG, PARSE_OPT_NOARG | PARSE_OPT_NONEG,
parse_opt_am }, parse_opt_am },
{ OPTION_CALLBACK, 'm', "merge", &options, NULL, { OPTION_CALLBACK, 'm', "merge", &options, NULL,
@ -1615,7 +1612,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
die(_("It looks like 'git am' is in progress. Cannot rebase.")); die(_("It looks like 'git am' is in progress. Cannot rebase."));
if (is_directory(apply_dir())) { if (is_directory(apply_dir())) {
options.type = REBASE_AM; options.type = REBASE_APPLY;
options.state_dir = apply_dir(); options.state_dir = apply_dir();
} else if (is_directory(merge_dir())) { } else if (is_directory(merge_dir())) {
strbuf_reset(&buf); strbuf_reset(&buf);
@ -1627,7 +1624,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
strbuf_reset(&buf); strbuf_reset(&buf);
strbuf_addf(&buf, "%s/interactive", merge_dir()); strbuf_addf(&buf, "%s/interactive", merge_dir());
if(file_exists(buf.buf)) { if(file_exists(buf.buf)) {
options.type = REBASE_INTERACTIVE; options.type = REBASE_MERGE;
options.flags |= REBASE_INTERACTIVE_EXPLICIT; options.flags |= REBASE_INTERACTIVE_EXPLICIT;
} else } else
options.type = REBASE_MERGE; options.type = REBASE_MERGE;
@ -1667,12 +1664,12 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
die(_("No rebase in progress?")); die(_("No rebase in progress?"));
setenv(GIT_REFLOG_ACTION_ENVIRONMENT, "rebase", 0); setenv(GIT_REFLOG_ACTION_ENVIRONMENT, "rebase", 0);
if (action == ACTION_EDIT_TODO && !is_interactive(&options)) if (action == ACTION_EDIT_TODO && !is_merge(&options))
die(_("The --edit-todo action can only be used during " die(_("The --edit-todo action can only be used during "
"interactive rebase.")); "interactive rebase."));
if (trace2_is_enabled()) { if (trace2_is_enabled()) {
if (is_interactive(&options)) if (is_merge(&options))
trace2_cmd_mode("interactive"); trace2_cmd_mode("interactive");
else if (exec.nr) else if (exec.nr)
trace2_cmd_mode("interactive-exec"); trace2_cmd_mode("interactive-exec");
@ -1748,7 +1745,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
goto cleanup; goto cleanup;
} }
case ACTION_QUIT: { case ACTION_QUIT: {
if (options.type == REBASE_INTERACTIVE) { if (options.type == REBASE_MERGE) {
struct replay_opts replay = REPLAY_OPTS_INIT; struct replay_opts replay = REPLAY_OPTS_INIT;
replay.action = REPLAY_INTERACTIVE_REBASE; replay.action = REPLAY_INTERACTIVE_REBASE;
@ -1831,7 +1828,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
argv_array_push(&options.git_am_opts, "-q"); argv_array_push(&options.git_am_opts, "-q");
if (options.empty != EMPTY_UNSPECIFIED) if (options.empty != EMPTY_UNSPECIFIED)
imply_interactive(&options, "--empty"); imply_merge(&options, "--empty");
if (gpg_sign) { if (gpg_sign) {
free(options.gpg_sign_opt); free(options.gpg_sign_opt);
@ -1841,7 +1838,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
if (exec.nr) { if (exec.nr) {
int i; int i;
imply_interactive(&options, "--exec"); imply_merge(&options, "--exec");
strbuf_reset(&buf); strbuf_reset(&buf);
for (i = 0; i < exec.nr; i++) for (i = 0; i < exec.nr; i++)
@ -1857,7 +1854,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
else if (strcmp("no-rebase-cousins", rebase_merges)) else if (strcmp("no-rebase-cousins", rebase_merges))
die(_("Unknown mode: %s"), rebase_merges); die(_("Unknown mode: %s"), rebase_merges);
options.rebase_merges = 1; options.rebase_merges = 1;
imply_interactive(&options, "--rebase-merges"); imply_merge(&options, "--rebase-merges");
} }
if (strategy_options.nr) { if (strategy_options.nr) {
@ -1876,10 +1873,9 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
if (options.strategy) { if (options.strategy) {
options.strategy = xstrdup(options.strategy); options.strategy = xstrdup(options.strategy);
switch (options.type) { switch (options.type) {
case REBASE_AM: case REBASE_APPLY:
die(_("--strategy requires --merge or --interactive")); die(_("--strategy requires --merge or --interactive"));
case REBASE_MERGE: case REBASE_MERGE:
case REBASE_INTERACTIVE:
case REBASE_PRESERVE_MERGES: case REBASE_PRESERVE_MERGES:
/* compatible */ /* compatible */
break; break;
@ -1892,34 +1888,34 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
} }
if (options.type == REBASE_MERGE) if (options.type == REBASE_MERGE)
imply_interactive(&options, "--merge"); imply_merge(&options, "--merge");
if (options.root && !options.onto_name) if (options.root && !options.onto_name)
imply_interactive(&options, "--root without --onto"); imply_merge(&options, "--root without --onto");
if (isatty(2) && options.flags & REBASE_NO_QUIET) if (isatty(2) && options.flags & REBASE_NO_QUIET)
strbuf_addstr(&options.git_format_patch_opt, " --progress"); strbuf_addstr(&options.git_format_patch_opt, " --progress");
if (options.git_am_opts.argc || options.type == REBASE_AM) { if (options.git_am_opts.argc || options.type == REBASE_APPLY) {
/* all am options except -q are compatible only with --am */ /* all am options except -q are compatible only with --apply */
for (i = options.git_am_opts.argc - 1; i >= 0; i--) for (i = options.git_am_opts.argc - 1; i >= 0; i--)
if (strcmp(options.git_am_opts.argv[i], "-q")) if (strcmp(options.git_am_opts.argv[i], "-q"))
break; break;
if (i >= 0) { if (i >= 0) {
if (is_interactive(&options)) if (is_merge(&options))
die(_("cannot combine am options with either " die(_("cannot combine apply options with "
"interactive or merge options")); "merge options"));
else else
options.type = REBASE_AM; options.type = REBASE_APPLY;
} }
} }
if (options.type == REBASE_UNSPECIFIED) { if (options.type == REBASE_UNSPECIFIED) {
if (!strcmp(options.default_backend, "merge")) if (!strcmp(options.default_backend, "merge"))
imply_interactive(&options, "--merge"); imply_merge(&options, "--merge");
else if (!strcmp(options.default_backend, "am")) else if (!strcmp(options.default_backend, "apply"))
options.type = REBASE_AM; options.type = REBASE_APPLY;
else else
die(_("Unknown rebase backend: %s"), die(_("Unknown rebase backend: %s"),
options.default_backend); options.default_backend);
@ -1927,11 +1923,10 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
switch (options.type) { switch (options.type) {
case REBASE_MERGE: case REBASE_MERGE:
case REBASE_INTERACTIVE:
case REBASE_PRESERVE_MERGES: case REBASE_PRESERVE_MERGES:
options.state_dir = merge_dir(); options.state_dir = merge_dir();
break; break;
case REBASE_AM: case REBASE_APPLY:
options.state_dir = apply_dir(); options.state_dir = apply_dir();
break; break;
default: default:
@ -1946,7 +1941,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
else else
options.empty = EMPTY_DROP; options.empty = EMPTY_DROP;
} }
if (reschedule_failed_exec > 0 && !is_interactive(&options)) if (reschedule_failed_exec > 0 && !is_merge(&options))
die(_("--reschedule-failed-exec requires " die(_("--reschedule-failed-exec requires "
"--exec or --interactive")); "--exec or --interactive"));
if (reschedule_failed_exec >= 0) if (reschedule_failed_exec >= 0)
@ -2247,7 +2242,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
diff_flush(&opts); diff_flush(&opts);
} }
if (is_interactive(&options)) if (is_merge(&options))
goto run_rebase; goto run_rebase;
/* Detach HEAD and reset the tree */ /* Detach HEAD and reset the tree */

Просмотреть файл

@ -183,19 +183,19 @@ test_expect_success 'default to common base in @{upstream}s reflog if no upstrea
test_cmp expect actual test_cmp expect actual
' '
test_expect_success 'default to common base in @{upstream}s reflog if no upstream arg (--am)' ' test_expect_success 'default to common base in @{upstream}s reflog if no upstream arg (--apply)' '
git checkout -B default-base master && git checkout -B default-base master &&
git checkout -B default topic && git checkout -B default topic &&
git config branch.default.remote . && git config branch.default.remote . &&
git config branch.default.merge refs/heads/default-base && git config branch.default.merge refs/heads/default-base &&
git rebase --am && git rebase --apply &&
git rev-parse --verify default-base >expect && git rev-parse --verify default-base >expect &&
git rev-parse default~1 >actual && git rev-parse default~1 >actual &&
test_cmp expect actual && test_cmp expect actual &&
git checkout default-base && git checkout default-base &&
git reset --hard HEAD^ && git reset --hard HEAD^ &&
git checkout default && git checkout default &&
git rebase --am && git rebase --apply &&
git rev-parse --verify default-base >expect && git rev-parse --verify default-base >expect &&
git rev-parse default~1 >actual && git rev-parse default~1 >actual &&
test_cmp expect actual test_cmp expect actual
@ -224,9 +224,9 @@ test_expect_success 'cherry-picked commits and fork-point work together' '
test_cmp expect D test_cmp expect D
' '
test_expect_success 'rebase --am -q is quiet' ' test_expect_success 'rebase --apply -q is quiet' '
git checkout -b quiet topic && git checkout -b quiet topic &&
git rebase --am -q master >output.out 2>&1 && git rebase --apply -q master >output.out 2>&1 &&
test_must_be_empty output.out test_must_be_empty output.out
' '
@ -315,7 +315,7 @@ EOF
test_cmp From_.msg out test_cmp From_.msg out
' '
test_expect_success 'rebase --am and --show-current-patch' ' test_expect_success 'rebase --apply and --show-current-patch' '
test_create_repo conflict-apply && test_create_repo conflict-apply &&
( (
cd conflict-apply && cd conflict-apply &&
@ -325,13 +325,13 @@ test_expect_success 'rebase --am and --show-current-patch' '
echo two >>init.t && echo two >>init.t &&
git commit -a -m two && git commit -a -m two &&
git tag two && git tag two &&
test_must_fail git rebase --am -f --onto init HEAD^ && test_must_fail git rebase --apply -f --onto init HEAD^ &&
GIT_TRACE=1 git rebase --show-current-patch >/dev/null 2>stderr && GIT_TRACE=1 git rebase --show-current-patch >/dev/null 2>stderr &&
grep "show.*$(git rev-parse two)" stderr grep "show.*$(git rev-parse two)" stderr
) )
' '
test_expect_success 'rebase --am and .gitattributes' ' test_expect_success 'rebase --apply and .gitattributes' '
test_create_repo attributes && test_create_repo attributes &&
( (
cd attributes && cd attributes &&

Просмотреть файл

@ -52,13 +52,13 @@ test_expect_success 'rebase --interactive: directory rename detected' '
) )
' '
test_expect_failure 'rebase --am: directory rename detected' ' test_expect_failure 'rebase --apply: directory rename detected' '
( (
cd dir-rename && cd dir-rename &&
git checkout B^0 && git checkout B^0 &&
git -c merge.directoryRenames=true rebase --am A && git -c merge.directoryRenames=true rebase --apply A &&
git ls-files -s >out && git ls-files -s >out &&
test_line_count = 5 out && test_line_count = 5 out &&

Просмотреть файл

@ -1138,7 +1138,7 @@ test_expect_success C_LOCALE_OUTPUT 'rebase --edit-todo does not work on non-int
git checkout conflict-branch && git checkout conflict-branch &&
( (
set_fake_editor && set_fake_editor &&
test_must_fail git rebase -f --am --onto HEAD~2 HEAD~ && test_must_fail git rebase -f --apply --onto HEAD~2 HEAD~ &&
test_must_fail git rebase --edit-todo test_must_fail git rebase --edit-todo
) && ) &&
git rebase --abort git rebase --abort

Просмотреть файл

@ -23,24 +23,24 @@ test_expect_success 'rebase -m' '
' '
test_expect_success 'rebase against master twice' ' test_expect_success 'rebase against master twice' '
git rebase --am master >out && git rebase --apply master >out &&
test_i18ngrep "Current branch topic is up to date" out test_i18ngrep "Current branch topic is up to date" out
' '
test_expect_success 'rebase against master twice with --force' ' test_expect_success 'rebase against master twice with --force' '
git rebase --force-rebase --am master >out && git rebase --force-rebase --apply master >out &&
test_i18ngrep "Current branch topic is up to date, rebase forced" out test_i18ngrep "Current branch topic is up to date, rebase forced" out
' '
test_expect_success 'rebase against master twice from another branch' ' test_expect_success 'rebase against master twice from another branch' '
git checkout topic^ && git checkout topic^ &&
git rebase --am master topic >out && git rebase --apply master topic >out &&
test_i18ngrep "Current branch topic is up to date" out test_i18ngrep "Current branch topic is up to date" out
' '
test_expect_success 'rebase fast-forward to master' ' test_expect_success 'rebase fast-forward to master' '
git checkout topic^ && git checkout topic^ &&
git rebase --am topic >out && git rebase --apply topic >out &&
test_i18ngrep "Fast-forwarded HEAD to topic" out test_i18ngrep "Fast-forwarded HEAD to topic" out
' '
@ -89,7 +89,7 @@ test_expect_success 'GIT_REFLOG_ACTION' '
git checkout -b reflog-topic start && git checkout -b reflog-topic start &&
test_commit reflog-to-rebase && test_commit reflog-to-rebase &&
git rebase --am reflog-onto && git rebase --apply reflog-onto &&
git log -g --format=%gs -3 >actual && git log -g --format=%gs -3 >actual &&
cat >expect <<-\EOF && cat >expect <<-\EOF &&
rebase finished: returning to refs/heads/reflog-topic rebase finished: returning to refs/heads/reflog-topic
@ -99,7 +99,7 @@ test_expect_success 'GIT_REFLOG_ACTION' '
test_cmp expect actual && test_cmp expect actual &&
git checkout -b reflog-prefix reflog-to-rebase && git checkout -b reflog-prefix reflog-to-rebase &&
GIT_REFLOG_ACTION=change-the-reflog git rebase --am reflog-onto && GIT_REFLOG_ACTION=change-the-reflog git rebase --apply reflog-onto &&
git log -g --format=%gs -3 >actual && git log -g --format=%gs -3 >actual &&
cat >expect <<-\EOF && cat >expect <<-\EOF &&
rebase finished: returning to refs/heads/reflog-prefix rebase finished: returning to refs/heads/reflog-prefix

Просмотреть файл

@ -96,14 +96,14 @@ testrebase() {
' '
} }
testrebase " --am" .git/rebase-apply testrebase " --apply" .git/rebase-apply
testrebase " --merge" .git/rebase-merge testrebase " --merge" .git/rebase-merge
test_expect_success 'rebase --am --quit' ' test_expect_success 'rebase --apply --quit' '
cd "$work_dir" && cd "$work_dir" &&
# Clean up the state from the previous one # Clean up the state from the previous one
git reset --hard pre-rebase && git reset --hard pre-rebase &&
test_must_fail git rebase --am master && test_must_fail git rebase --apply master &&
test_path_is_dir .git/rebase-apply && test_path_is_dir .git/rebase-apply &&
head_before=$(git rev-parse HEAD) && head_before=$(git rev-parse HEAD) &&
git rebase --quit && git rebase --quit &&

Просмотреть файл

@ -34,7 +34,7 @@ test_expect_success setup '
remove_progress_re="$(printf "s/.*\\r//")" remove_progress_re="$(printf "s/.*\\r//")"
' '
create_expected_success_am () { create_expected_success_apply () {
cat >expected <<-EOF cat >expected <<-EOF
$(grep "^Created autostash: [0-9a-f][0-9a-f]*\$" actual) $(grep "^Created autostash: [0-9a-f][0-9a-f]*\$" actual)
First, rewinding head to replay your work on top of it... First, rewinding head to replay your work on top of it...
@ -44,7 +44,7 @@ create_expected_success_am () {
EOF EOF
} }
create_expected_success_interactive () { create_expected_success_merge () {
q_to_cr >expected <<-EOF q_to_cr >expected <<-EOF
$(grep "^Created autostash: [0-9a-f][0-9a-f]*\$" actual) $(grep "^Created autostash: [0-9a-f][0-9a-f]*\$" actual)
Applied autostash. Applied autostash.
@ -52,7 +52,7 @@ create_expected_success_interactive () {
EOF EOF
} }
create_expected_failure_am () { create_expected_failure_apply () {
cat >expected <<-EOF cat >expected <<-EOF
$(grep "^Created autostash: [0-9a-f][0-9a-f]*\$" actual) $(grep "^Created autostash: [0-9a-f][0-9a-f]*\$" actual)
First, rewinding head to replay your work on top of it... First, rewinding head to replay your work on top of it...
@ -64,7 +64,7 @@ create_expected_failure_am () {
EOF EOF
} }
create_expected_failure_interactive () { create_expected_failure_merge () {
cat >expected <<-EOF cat >expected <<-EOF
$(grep "^Created autostash: [0-9a-f][0-9a-f]*\$" actual) $(grep "^Created autostash: [0-9a-f][0-9a-f]*\$" actual)
Applying autostash resulted in conflicts. Applying autostash resulted in conflicts.
@ -101,9 +101,9 @@ testrebase () {
test_expect_success "rebase$type --autostash: check output" ' test_expect_success "rebase$type --autostash: check output" '
test_when_finished git branch -D rebased-feature-branch && test_when_finished git branch -D rebased-feature-branch &&
suffix=${type#\ --} && suffix=${suffix:-am} && suffix=${type#\ --} && suffix=${suffix:-apply} &&
if test ${suffix} = "merge"; then if test ${suffix} = "interactive"; then
suffix=interactive suffix=merge
fi && fi &&
create_expected_success_$suffix && create_expected_success_$suffix &&
sed "$remove_progress_re" <actual >actual2 && sed "$remove_progress_re" <actual >actual2 &&
@ -202,9 +202,9 @@ testrebase () {
test_expect_success "rebase$type: check output with conflicting stash" ' test_expect_success "rebase$type: check output with conflicting stash" '
test_when_finished git branch -D rebased-feature-branch && test_when_finished git branch -D rebased-feature-branch &&
suffix=${type#\ --} && suffix=${suffix:-am} && suffix=${type#\ --} && suffix=${suffix:-apply} &&
if test ${suffix} = "merge"; then if test ${suffix} = "interactive"; then
suffix=interactive suffix=merge
fi && fi &&
create_expected_failure_$suffix && create_expected_failure_$suffix &&
sed "$remove_progress_re" <actual >actual2 && sed "$remove_progress_re" <actual >actual2 &&
@ -234,7 +234,7 @@ test_expect_success "rebase: noop rebase" '
git checkout feature-branch git checkout feature-branch
' '
testrebase " --am" .git/rebase-apply testrebase " --apply" .git/rebase-apply
testrebase " --merge" .git/rebase-merge testrebase " --merge" .git/rebase-merge
testrebase " --interactive" .git/rebase-merge testrebase " --interactive" .git/rebase-merge

Просмотреть файл

@ -26,7 +26,7 @@ test_run_rebase () {
test_linear_range 'd e' c.. test_linear_range 'd e' c..
" "
} }
test_run_rebase success --am test_run_rebase success --apply
test_run_rebase success -m test_run_rebase success -m
test_run_rebase success -i test_run_rebase success -i
test_have_prereq !REBASE_P || test_run_rebase success -p test_have_prereq !REBASE_P || test_run_rebase success -p
@ -50,7 +50,7 @@ test_run_rebase () {
test_cmp_rev e HEAD test_cmp_rev e HEAD
" "
} }
test_run_rebase success --am test_run_rebase success --apply
test_run_rebase success -m test_run_rebase success -m
test_run_rebase success -i test_run_rebase success -i
test_have_prereq !REBASE_P || test_run_rebase success -p test_have_prereq !REBASE_P || test_run_rebase success -p
@ -66,7 +66,7 @@ test_run_rebase () {
test_linear_range 'd e' b.. test_linear_range 'd e' b..
" "
} }
test_run_rebase success --am test_run_rebase success --apply
test_run_rebase success --fork-point test_run_rebase success --fork-point
test_run_rebase success -m test_run_rebase success -m
test_run_rebase success -i test_run_rebase success -i
@ -83,7 +83,7 @@ test_run_rebase () {
test_linear_range 'd e' branch-b.. test_linear_range 'd e' branch-b..
" "
} }
test_run_rebase success --am test_run_rebase success --apply
test_run_rebase success --fork-point test_run_rebase success --fork-point
test_run_rebase success -m test_run_rebase success -m
test_run_rebase success -i test_run_rebase success -i
@ -98,7 +98,7 @@ test_run_rebase () {
test_cmp_rev e HEAD test_cmp_rev e HEAD
" "
} }
test_run_rebase success --am test_run_rebase success --apply
test_run_rebase success --fork-point test_run_rebase success --fork-point
test_run_rebase success -m test_run_rebase success -m
test_run_rebase success -i test_run_rebase success -i
@ -139,7 +139,7 @@ test_run_rebase () {
test_linear_range 'd i' h.. test_linear_range 'd i' h..
" "
} }
test_run_rebase success --am test_run_rebase success --apply
test_run_rebase success -m test_run_rebase success -m
test_run_rebase success -i test_run_rebase success -i
test_have_prereq !REBASE_P || test_run_rebase success -p test_have_prereq !REBASE_P || test_run_rebase success -p
@ -154,7 +154,7 @@ test_run_rebase () {
test_linear_range 'd' h.. test_linear_range 'd' h..
" "
} }
test_run_rebase success --am test_run_rebase success --apply
test_run_rebase success -m test_run_rebase success -m
test_run_rebase success -i test_run_rebase success -i
test_have_prereq !REBASE_P || test_run_rebase success -p test_have_prereq !REBASE_P || test_run_rebase success -p
@ -169,7 +169,7 @@ test_run_rebase () {
test_linear_range 'd i' f.. test_linear_range 'd i' f..
" "
} }
test_run_rebase success --am test_run_rebase success --apply
test_run_rebase success -m test_run_rebase success -m
test_run_rebase success -i test_run_rebase success -i
test_have_prereq !REBASE_P || test_run_rebase success -p test_have_prereq !REBASE_P || test_run_rebase success -p
@ -184,7 +184,7 @@ test_run_rebase () {
test_linear_range 'd gp i' h.. test_linear_range 'd gp i' h..
" "
} }
test_run_rebase success --am test_run_rebase success --apply
test_run_rebase success -m test_run_rebase success -m
test_run_rebase success -i test_run_rebase success -i
test_have_prereq !REBASE_P || test_run_rebase success -p test_have_prereq !REBASE_P || test_run_rebase success -p
@ -212,7 +212,7 @@ test_run_rebase () {
test_linear_range 'j d k l' c.. test_linear_range 'j d k l' c..
" "
} }
test_run_rebase failure --am test_run_rebase failure --apply
test_run_rebase success -m test_run_rebase success -m
test_run_rebase success -i test_run_rebase success -i
test_have_prereq !REBASE_P || test_run_rebase failure -p test_have_prereq !REBASE_P || test_run_rebase failure -p
@ -227,7 +227,7 @@ test_run_rebase () {
test_linear_range 'd k l' c.. test_linear_range 'd k l' c..
" "
} }
test_run_rebase success --am test_run_rebase success --apply
test_run_rebase success -m test_run_rebase success -m
test_run_rebase success -i test_run_rebase success -i
test_have_prereq !REBASE_P || test_run_rebase success -p test_have_prereq !REBASE_P || test_run_rebase success -p
@ -242,7 +242,7 @@ test_run_rebase () {
test_linear_range 'd k l' j.. test_linear_range 'd k l' j..
" "
} }
test_run_rebase success --am test_run_rebase success --apply
test_run_rebase success -m test_run_rebase success -m
test_run_rebase success -i test_run_rebase success -i
test_have_prereq !REBASE_P || test_run_rebase success -p test_have_prereq !REBASE_P || test_run_rebase success -p
@ -282,7 +282,7 @@ test_run_rebase () {
test_linear_range 'x y' c.. test_linear_range 'x y' c..
" "
} }
test_run_rebase success --am test_run_rebase success --apply
test_run_rebase success -m test_run_rebase success -m
test_run_rebase success -i test_run_rebase success -i
test_have_prereq !REBASE_P || test_run_rebase success -p test_have_prereq !REBASE_P || test_run_rebase success -p
@ -297,7 +297,7 @@ test_run_rebase () {
test_linear_range 'x y' c.. test_linear_range 'x y' c..
" "
} }
test_run_rebase success --am test_run_rebase success --apply
test_run_rebase success -m test_run_rebase success -m
test_run_rebase success -i test_run_rebase success -i
test_have_prereq !REBASE_P || test_run_rebase failure -p test_have_prereq !REBASE_P || test_run_rebase failure -p
@ -312,7 +312,7 @@ test_run_rebase () {
test_linear_range 'x y' m.. test_linear_range 'x y' m..
" "
} }
test_run_rebase success --am test_run_rebase success --apply
test_run_rebase success -m test_run_rebase success -m
test_run_rebase success -i test_run_rebase success -i
test_have_prereq !REBASE_P || test_run_rebase success -p test_have_prereq !REBASE_P || test_run_rebase success -p
@ -328,7 +328,7 @@ test_run_rebase () {
" "
} }
test_run_rebase success --am test_run_rebase success --apply
test_run_rebase success -m test_run_rebase success -m
test_run_rebase success -i test_run_rebase success -i
test_have_prereq !REBASE_P || test_run_rebase failure -p test_have_prereq !REBASE_P || test_run_rebase failure -p
@ -343,7 +343,7 @@ test_run_rebase () {
test_linear_range 'x y' m.. test_linear_range 'x y' m..
" "
} }
test_run_rebase success --am test_run_rebase success --apply
test_run_rebase success -m test_run_rebase success -m
test_run_rebase success -i test_run_rebase success -i
test_have_prereq !REBASE_P || test_run_rebase failure -p test_have_prereq !REBASE_P || test_run_rebase failure -p

Просмотреть файл

@ -34,11 +34,11 @@ test_expect_success 'setup test repository' '
git commit -m "Five letters ought to be enough for anybody" git commit -m "Five letters ought to be enough for anybody"
' '
test_expect_failure 'rebase (am-backend)' ' test_expect_failure 'rebase (apply-backend)' '
test_when_finished "git rebase --abort" && test_when_finished "git rebase --abort" &&
git checkout -B testing localmods && git checkout -B testing localmods &&
# rebase (--am) should not drop commits that start empty # rebase (--apply) should not drop commits that start empty
git rebase upstream && git rebase --apply upstream &&
test_write_lines D C B A >expect && test_write_lines D C B A >expect &&
git log --format=%s >actual && git log --format=%s >actual &&

Просмотреть файл

@ -54,7 +54,7 @@ test_run_rebase () {
test_linear_range 'n o' e.. test_linear_range 'n o' e..
" "
} }
test_run_rebase success --am test_run_rebase success --apply
test_run_rebase success -m test_run_rebase success -m
test_run_rebase success -i test_run_rebase success -i
@ -70,7 +70,7 @@ test_run_rebase () {
test_linear_range "\'"$expected"\'" d.. test_linear_range "\'"$expected"\'" d..
" "
} }
test_run_rebase success 'n o e' --am test_run_rebase success 'n o e' --apply
test_run_rebase success 'n o e' -m test_run_rebase success 'n o e' -m
test_run_rebase success 'n o e' -i test_run_rebase success 'n o e' -i
@ -86,7 +86,7 @@ test_run_rebase () {
test_linear_range "\'"$expected"\'" c.. test_linear_range "\'"$expected"\'" c..
" "
} }
test_run_rebase success 'd n o e' --am test_run_rebase success 'd n o e' --apply
test_run_rebase success 'd n o e' -m test_run_rebase success 'd n o e' -m
test_run_rebase success 'd n o e' -i test_run_rebase success 'd n o e' -i
@ -102,7 +102,7 @@ test_run_rebase () {
test_linear_range "\'"$expected"\'" c.. test_linear_range "\'"$expected"\'" c..
" "
} }
test_run_rebase success 'd n o e' --am test_run_rebase success 'd n o e' --apply
test_run_rebase success 'd n o e' -m test_run_rebase success 'd n o e' -m
test_run_rebase success 'd n o e' -i test_run_rebase success 'd n o e' -i

Просмотреть файл

@ -28,8 +28,8 @@ test_rebase_same_head () {
shift && shift &&
cmp_f="$1" && cmp_f="$1" &&
shift && shift &&
test_rebase_same_head_ $status_n $what_n $cmp_n " --am" "$*" && test_rebase_same_head_ $status_n $what_n $cmp_n " --apply" "$*" &&
test_rebase_same_head_ $status_f $what_f $cmp_f " --am --no-ff" "$*" test_rebase_same_head_ $status_f $what_f $cmp_f " --apply --no-ff" "$*"
test_rebase_same_head_ $status_n $what_n $cmp_n " --merge" "$*" && test_rebase_same_head_ $status_n $what_n $cmp_n " --merge" "$*" &&
test_rebase_same_head_ $status_f $what_f $cmp_f " --merge --no-ff" "$*" test_rebase_same_head_ $status_f $what_f $cmp_f " --merge --no-ff" "$*"
} }

Просмотреть файл

@ -53,10 +53,10 @@ test_expect_success 'git commit --amend --no-post-rewrite' '
test ! -f post-rewrite.data test ! -f post-rewrite.data
' '
test_expect_success 'git rebase --am' ' test_expect_success 'git rebase --apply' '
git reset --hard D && git reset --hard D &&
clear_hook_input && clear_hook_input &&
test_must_fail git rebase --am --onto A B && test_must_fail git rebase --apply --onto A B &&
echo C > foo && echo C > foo &&
git add foo && git add foo &&
git rebase --continue && git rebase --continue &&
@ -68,10 +68,10 @@ test_expect_success 'git rebase --am' '
verify_hook_input verify_hook_input
' '
test_expect_success 'git rebase --am --skip' ' test_expect_success 'git rebase --apply --skip' '
git reset --hard D && git reset --hard D &&
clear_hook_input && clear_hook_input &&
test_must_fail git rebase --am --onto A B && test_must_fail git rebase --apply --onto A B &&
test_must_fail git rebase --skip && test_must_fail git rebase --skip &&
echo D > foo && echo D > foo &&
git add foo && git add foo &&
@ -84,10 +84,10 @@ test_expect_success 'git rebase --am --skip' '
verify_hook_input verify_hook_input
' '
test_expect_success 'git rebase --am --skip the last one' ' test_expect_success 'git rebase --apply --skip the last one' '
git reset --hard F && git reset --hard F &&
clear_hook_input && clear_hook_input &&
test_must_fail git rebase --am --onto D A && test_must_fail git rebase --apply --onto D A &&
git rebase --skip && git rebase --skip &&
echo rebase >expected.args && echo rebase >expected.args &&
cat >expected.data <<-EOF && cat >expected.data <<-EOF &&
@ -128,7 +128,7 @@ test_expect_success 'git rebase -m --skip' '
verify_hook_input verify_hook_input
' '
test_expect_success 'git rebase with implicit use of interactive backend' ' test_expect_success 'git rebase with implicit use of merge backend' '
git reset --hard D && git reset --hard D &&
clear_hook_input && clear_hook_input &&
test_must_fail git rebase --keep-empty --onto A B && test_must_fail git rebase --keep-empty --onto A B &&
@ -143,7 +143,7 @@ test_expect_success 'git rebase with implicit use of interactive backend' '
verify_hook_input verify_hook_input
' '
test_expect_success 'git rebase --skip with implicit use of interactive backend' ' test_expect_success 'git rebase --skip with implicit use of merge backend' '
git reset --hard D && git reset --hard D &&
clear_hook_input && clear_hook_input &&
test_must_fail git rebase --keep-empty --onto A B && test_must_fail git rebase --keep-empty --onto A B &&

Просмотреть файл

@ -297,7 +297,7 @@ test_expect_success '--rebase (merge) fast forward' '
test_expect_success '--rebase (am) fast forward' ' test_expect_success '--rebase (am) fast forward' '
git reset --hard before-rebase && git reset --hard before-rebase &&
git -c rebase.backend=am pull --rebase . ff && git -c rebase.backend=apply pull --rebase . ff &&
test_cmp_rev HEAD ff && test_cmp_rev HEAD ff &&
# The above only validates the result. Did we actually bypass rebase? # The above only validates the result. Did we actually bypass rebase?

Просмотреть файл

@ -199,11 +199,11 @@ test_expect_success 'rebase --merge describes parent of commit being picked' '
) )
' '
test_expect_success 'rebase --am describes fake ancestor base' ' test_expect_success 'rebase --apply describes fake ancestor base' '
( (
cd rebase && cd rebase &&
git rebase --abort && git rebase --abort &&
test_must_fail git -c merge.conflictstyle=diff3 rebase --am master && test_must_fail git -c merge.conflictstyle=diff3 rebase --apply master &&
grep "||||||| constructed merge base" file grep "||||||| constructed merge base" file
) )
' '

Просмотреть файл

@ -71,10 +71,10 @@ test_expect_success 'prepare for rebase conflicts' '
' '
test_expect_success 'status when rebase --am in progress before resolving conflicts' ' test_expect_success 'status when rebase --apply in progress before resolving conflicts' '
test_when_finished "git rebase --abort" && test_when_finished "git rebase --abort" &&
ONTO=$(git rev-parse --short HEAD^^) && ONTO=$(git rev-parse --short HEAD^^) &&
test_must_fail git rebase --am HEAD^ --onto HEAD^^ && test_must_fail git rebase --apply HEAD^ --onto HEAD^^ &&
cat >expected <<EOF && cat >expected <<EOF &&
rebase in progress; onto $ONTO rebase in progress; onto $ONTO
You are currently rebasing branch '\''rebase_conflicts'\'' on '\''$ONTO'\''. You are currently rebasing branch '\''rebase_conflicts'\'' on '\''$ONTO'\''.
@ -94,11 +94,11 @@ EOF
' '
test_expect_success 'status when rebase --am in progress before rebase --continue' ' test_expect_success 'status when rebase --apply in progress before rebase --continue' '
git reset --hard rebase_conflicts && git reset --hard rebase_conflicts &&
test_when_finished "git rebase --abort" && test_when_finished "git rebase --abort" &&
ONTO=$(git rev-parse --short HEAD^^) && ONTO=$(git rev-parse --short HEAD^^) &&
test_must_fail git rebase --am HEAD^ --onto HEAD^^ && test_must_fail git rebase --apply HEAD^ --onto HEAD^^ &&
echo three >main.txt && echo three >main.txt &&
git add main.txt && git add main.txt &&
cat >expected <<EOF && cat >expected <<EOF &&
@ -688,7 +688,7 @@ EOF
' '
test_expect_success 'status when rebase --am conflicts with statushints disabled' ' test_expect_success 'status when rebase --apply conflicts with statushints disabled' '
git reset --hard master && git reset --hard master &&
git checkout -b statushints_disabled && git checkout -b statushints_disabled &&
test_when_finished "git config --local advice.statushints true" && test_when_finished "git config --local advice.statushints true" &&
@ -698,7 +698,7 @@ test_expect_success 'status when rebase --am conflicts with statushints disabled
test_commit three_statushints main.txt three && test_commit three_statushints main.txt three &&
test_when_finished "git rebase --abort" && test_when_finished "git rebase --abort" &&
ONTO=$(git rev-parse --short HEAD^^) && ONTO=$(git rev-parse --short HEAD^^) &&
test_must_fail git rebase --am HEAD^ --onto HEAD^^ && test_must_fail git rebase --apply HEAD^ --onto HEAD^^ &&
cat >expected <<EOF && cat >expected <<EOF &&
rebase in progress; onto $ONTO rebase in progress; onto $ONTO
You are currently rebasing branch '\''statushints_disabled'\'' on '\''$ONTO'\''. You are currently rebasing branch '\''statushints_disabled'\'' on '\''$ONTO'\''.

Просмотреть файл

@ -193,7 +193,7 @@ test_expect_success 'prompt - rebase am' '
printf " (b2|REBASE 1/3)" >expected && printf " (b2|REBASE 1/3)" >expected &&
git checkout b2 && git checkout b2 &&
test_when_finished "git checkout master" && test_when_finished "git checkout master" &&
test_must_fail git rebase --am b1 b2 && test_must_fail git rebase --apply b1 b2 &&
test_when_finished "git rebase --abort" && test_when_finished "git rebase --abort" &&
__git_ps1 >"$actual" && __git_ps1 >"$actual" &&
test_cmp expected "$actual" test_cmp expected "$actual"