@matheusbsbs / matheus-bagliano / commits / 10cdb9f38a
Fork 0

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>

Elijah Newren committed Feb 15, 2020 at 21:36 UTC 10cdb9f38adaa16aad64403bc931405564523985
18 files changed +166 -168
Documentation/config/rebase.txt
+3 -5
@@ -7,11 +7,9 @@ rebase.useBuiltin::
7
8 rebase.backend::
9 Default backend to use for rebasing. Possible choices are
10 - 'am' or 'merge' (note that the merge backend is sometimes also
11 - refered to as the interactive backend or the interactive
12 - machinery elsewhere in the docs). Also, in the future, if the
13 - merge backend gains all remaining capabilities of the am
14 - backend, this setting may become unused.
10 + 'apply' or 'merge'. In the future, if the merge backend gains
11 + all remaining capabilities of the apply backend, this setting
12 + may become unused.
13
14 rebase.stat::
15 Whether to show a diffstat of what changed upstream since the last
Documentation/git-rebase.txt
+41 -36
@@ -258,10 +258,10 @@ See also INCOMPATIBLE OPTIONS below.
258 original branch. The index and working tree are also left
259 unchanged as a result.
260
261 ---am:
262 - Use git-am internally to rebase. This option may become a
263 - no-op in the future once the interactive backend handles
264 - everything the am one does.
261 +--apply:
262 + Use applying strategies to rebase (calling `git-am`
263 + internally). This option may become a no-op in the future
264 + once the merge backend handles everything the apply one does.
265 +
266 See also INCOMPATIBLE OPTIONS below.
267
@@ -385,7 +385,7 @@ See also INCOMPATIBLE OPTIONS below.
385 Ensure at least <n> lines of surrounding context match before
386 and after each change. When fewer lines of surrounding
387 context exist they all must match. By default no context is
388 - ever ignored. Implies --am.
388 + ever ignored. Implies --apply.
389 +
390 See also INCOMPATIBLE OPTIONS below.
391
@@ -425,7 +425,7 @@ with `--keep-base` in order to drop those commits from your branch.
425 --whitespace=<option>::
426 These flags are passed to the 'git apply' program
427 (see linkgit:git-apply[1]) that applies the patch.
428 - Implies --am.
428 + Implies --apply.
429 +
430 See also INCOMPATIBLE OPTIONS below.
431
@@ -569,7 +569,7 @@ INCOMPATIBLE OPTIONS
569
570 The following options:
571
572 - * --am
572 + * --apply
573 * --committer-date-is-author-date
574 * --ignore-date
575 * --ignore-whitespace
@@ -604,42 +604,48 @@ In addition, the following pairs of options are incompatible:
604 BEHAVIORAL DIFFERENCES
605 -----------------------
606
607 -There are some subtle differences how the backends behave.
607 +git rebase has two primary backends: apply and merge. (The apply
608 +backend used to known as the 'am' backend, but the name led to
609 +confusion as it looks like a verb instead of a noun. Also, the merge
610 +backend used to be known as the interactive backend, but it is now
611 +used for non-interactive cases as well. Both were renamed based on
612 +lower-level functionality that underpinned each.) There are some
613 +subtle differences in how these two backends behave:
614
615 Empty commits
616 ~~~~~~~~~~~~~
617
612 -The am backend unfortunately drops intentionally empty commits, i.e.
618 +The apply backend unfortunately drops intentionally empty commits, i.e.
619 commits that started empty, though these are rare in practice. It
620 also drops commits that become empty and has no option for controlling
621 this behavior.
622
617 -The interactive backend keeps intentionally empty commits. Similar to
618 -the am backend, by default the interactive backend drops commits that
619 -become empty unless -i/--interactive is specified (in which case it
620 -stops and asks the user what to do). The interactive backend also has
621 -an --empty={drop,keep,ask} option for changing the behavior of
622 -handling commits that become empty.
623 +The merge backend keeps intentionally empty commits. Similar to the
624 +apply backend, by default the merge backend drops commits that become
625 +empty unless -i/--interactive is specified (in which case it stops and
626 +asks the user what to do). The merge backend also has an
627 +--empty={drop,keep,ask} option for changing the behavior of handling
628 +commits that become empty.
629
630 Directory rename detection
631 ~~~~~~~~~~~~~~~~~~~~~~~~~~
632
633 Due to the lack of accurate tree information (arising from
634 constructing fake ancestors with the limited information available in
629 -patches), directory rename detection is disabled in the am backend.
635 +patches), directory rename detection is disabled in the apply backend.
636 Disabled directory rename detection means that if one side of history
637 renames a directory and the other adds new files to the old directory,
638 then the new files will be left behind in the old directory without
639 any warning at the time of rebasing that you may want to move these
640 files into the new directory.
641
636 -Directory rename detection works with the merge and interactive
637 -backends to provide you warnings in such cases.
642 +Directory rename detection works with the merge backend to provide you
643 +warnings in such cases.
644
645 Context
646 ~~~~~~~
647
642 -The am backend works by creating a sequence of patches (by calling
648 +The apply backend works by creating a sequence of patches (by calling
649 `format-patch` internally), and then applying the patches in sequence
650 (calling `am` internally). Patches are composed of multiple hunks,
651 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
660 problems, but increases the chance of spurious conflicts (since it
661 will require more lines of matching context to apply).
662
657 -The interactive backend works with a full copy of each relevant file,
663 +The merge backend works with a full copy of each relevant file,
664 insulating it from these types of problems.
665
666 Labelling of conflicts markers
@@ -662,34 +668,33 @@ Labelling of conflicts markers
668
669 When there are content conflicts, the merge machinery tries to
670 annotate each side's conflict markers with the commits where the
665 -content came from. Since the am backend drops the original
671 +content came from. Since the apply backend drops the original
672 information about the rebased commits and their parents (and instead
673 generates new fake commits based off limited information in the
674 generated patches), those commits cannot be identified; instead it has
675 to fall back to a commit summary. Also, when merge.conflictStyle is
670 -set to diff3, the am backend will use "constructed merge base" to
676 +set to diff3, the apply backend will use "constructed merge base" to
677 label the content from the merge base, and thus provide no information
678 about the merge base commit whatsoever.
679
674 -The interactive backend works with the full commits on both sides of
675 -history and thus has no such limitations.
680 +The merge backend works with the full commits on both sides of history
681 +and thus has no such limitations.
682
683 Hooks
684 ~~~~~
685
680 -The am backend has not traditionally called the post-commit hook,
681 -while the merge/interactive backend has. However, this was by
682 -accident of implementation rather than by design. Both backends
683 -should have the same behavior, though it is not clear which one is
684 -correct.
686 +The apply backend has not traditionally called the post-commit hook,
687 +while the merge backend has. However, this was by accident of
688 +implementation rather than by design. Both backends should have the
689 +same behavior, though it is not clear which one is correct.
690
691 Interruptability
692 ~~~~~~~~~~~~~~~~
693
689 -The am backend has safety problems with an ill-timed interrupt; if the
690 -user presses Ctrl-C at the wrong time to try to abort the rebase, the
691 -rebase can enter a state where it cannot be aborted with a subsequent
692 -`git rebase --abort`. The interactive backend does not appear to
694 +The apply backend has safety problems with an ill-timed interrupt; if
695 +the user presses Ctrl-C at the wrong time to try to abort the rebase,
696 +the rebase can enter a state where it cannot be aborted with a
697 +subsequent `git rebase --abort`. The merge backend does not appear to
698 suffer from the same shortcoming. (See
699 https://lore.kernel.org/git/20200207132152.GC2868@szeder.dev/ for
700 details.)
@@ -707,9 +712,9 @@ completeness:
712
713 * Progress, informational, and error messages: The two backends
714 provide slightly different progress and informational messages.
710 - Also, the am backend writes error messages (such as "Your files
711 - would be overwritten...") to stdout, while the interactive backend
712 - writes them to stderr.
715 + Also, the apply backend writes error messages (such as "Your files
716 + would be overwritten...") to stdout, while the merge backend writes
717 + them to stderr.
718
719 * State directories: The two backends keep their state in different
720 directories under .git/
builtin/rebase.c
+47 -52
@@ -44,9 +44,8 @@ static GIT_PATH_FUNC(merge_dir, "rebase-merge")
44
45 enum rebase_type {
46 REBASE_UNSPECIFIED = -1,
47 - REBASE_AM,
47 + REBASE_APPLY,
48 REBASE_MERGE,
49 - REBASE_INTERACTIVE,
49 REBASE_PRESERVE_MERGES
50 };
51
@@ -380,7 +379,7 @@ static int do_interactive_rebase(struct rebase_options *opts, unsigned flags)
379 return ret;
380 }
381
383 -static int run_rebase_interactive(struct rebase_options *opts,
382 +static int run_sequencer_rebase(struct rebase_options *opts,
383 enum action command)
384 {
385 unsigned flags = 0;
@@ -462,7 +461,7 @@ static int parse_opt_keep_empty(const struct option *opt, const char *arg,
461 * If we ever want to remap --keep-empty to --empty=keep, insert:
462 * opts->empty = unset ? EMPTY_UNSPECIFIED : EMPTY_KEEP;
463 */
465 - opts->type = REBASE_INTERACTIVE;
464 + opts->type = REBASE_MERGE;
465 return 0;
466 }
467
@@ -555,28 +554,26 @@ int cmd_rebase__interactive(int argc, const char **argv, const char *prefix)
554 warning(_("--[no-]rebase-cousins has no effect without "
555 "--rebase-merges"));
556
558 - return !!run_rebase_interactive(&opts, command);
557 + return !!run_sequencer_rebase(&opts, command);
558 }
559
561 -static int is_interactive(struct rebase_options *opts)
560 +static int is_merge(struct rebase_options *opts)
561 {
563 - return opts->type == REBASE_INTERACTIVE ||
562 + return opts->type == REBASE_MERGE ||
563 opts->type == REBASE_PRESERVE_MERGES;
564 }
565
567 -static void imply_interactive(struct rebase_options *opts, const char *option)
566 +static void imply_merge(struct rebase_options *opts, const char *option)
567 {
568 switch (opts->type) {
570 - case REBASE_AM:
569 + case REBASE_APPLY:
570 die(_("%s requires an interactive rebase"), option);
571 break;
573 - case REBASE_INTERACTIVE:
572 + case REBASE_MERGE:
573 case REBASE_PRESERVE_MERGES:
574 break;
576 - case REBASE_MERGE:
577 - /* we now implement --merge via --interactive */
575 default:
579 - opts->type = REBASE_INTERACTIVE; /* implied */
576 + opts->type = REBASE_MERGE; /* implied */
577 break;
578 }
579 }
@@ -785,7 +782,7 @@ static int finish_rebase(struct rebase_options *opts)
782 * user should see them.
783 */
784 run_command_v_opt(argv_gc_auto, RUN_GIT_CMD);
788 - if (opts->type == REBASE_INTERACTIVE) {
785 + if (opts->type == REBASE_MERGE) {
786 struct replay_opts replay = REPLAY_OPTS_INIT;
787
788 replay.action = REPLAY_INTERACTIVE_REBASE;
@@ -1118,8 +1115,8 @@ static int run_specific_rebase(struct rebase_options *opts, enum action action)
1115 int status;
1116 const char *backend, *backend_func;
1117
1121 - if (opts->type == REBASE_INTERACTIVE) {
1122 - /* Run builtin interactive rebase */
1118 + if (opts->type == REBASE_MERGE) {
1119 + /* Run sequencer-based rebase */
1120 setenv("GIT_CHERRY_PICK_HELP", resolvemsg, 1);
1121 if (!(opts->flags & REBASE_INTERACTIVE_EXPLICIT)) {
1122 setenv("GIT_SEQUENCE_EDITOR", ":", 1);
@@ -1132,11 +1129,11 @@ static int run_specific_rebase(struct rebase_options *opts, enum action action)
1129 opts->gpg_sign_opt = tmp;
1130 }
1131
1135 - status = run_rebase_interactive(opts, action);
1132 + status = run_sequencer_rebase(opts, action);
1133 goto finished_rebase;
1134 }
1135
1139 - if (opts->type == REBASE_AM) {
1136 + if (opts->type == REBASE_APPLY) {
1137 status = run_am(opts);
1138 goto finished_rebase;
1139 }
@@ -1190,7 +1187,7 @@ static int run_specific_rebase(struct rebase_options *opts, enum action action)
1187 add_var(&script_snippet, "git_format_patch_opt",
1188 opts->git_format_patch_opt.buf);
1189
1193 - if (is_interactive(opts) &&
1190 + if (is_merge(opts) &&
1191 !(opts->flags & REBASE_INTERACTIVE_EXPLICIT)) {
1192 strbuf_addstr(&script_snippet,
1193 "GIT_SEQUENCE_EDITOR=:; export GIT_SEQUENCE_EDITOR; ");
@@ -1215,8 +1212,8 @@ static int run_specific_rebase(struct rebase_options *opts, enum action action)
1212 finished_rebase:
1213 if (opts->dont_finish_rebase)
1214 ; /* do nothing */
1218 - else if (opts->type == REBASE_INTERACTIVE)
1219 - ; /* interactive rebase cleans up after itself */
1215 + else if (opts->type == REBASE_MERGE)
1216 + ; /* merge backend cleans up after itself */
1217 else if (status == 0) {
1218 if (!file_exists(state_dir_path("stopped-sha", opts)))
1219 finish_rebase(opts);
@@ -1348,7 +1345,7 @@ static int parse_opt_am(const struct option *opt, const char *arg, int unset)
1345 BUG_ON_OPT_NEG(unset);
1346 BUG_ON_OPT_ARG(arg);
1347
1351 - opts->type = REBASE_AM;
1348 + opts->type = REBASE_APPLY;
1349
1350 return 0;
1351 }
@@ -1361,7 +1358,7 @@ static int parse_opt_merge(const struct option *opt, const char *arg, int unset)
1358 BUG_ON_OPT_NEG(unset);
1359 BUG_ON_OPT_ARG(arg);
1360
1364 - if (!is_interactive(opts))
1361 + if (!is_merge(opts))
1362 opts->type = REBASE_MERGE;
1363
1364 return 0;
@@ -1376,7 +1373,7 @@ static int parse_opt_interactive(const struct option *opt, const char *arg,
1373 BUG_ON_OPT_NEG(unset);
1374 BUG_ON_OPT_ARG(arg);
1375
1379 - opts->type = REBASE_INTERACTIVE;
1376 + opts->type = REBASE_MERGE;
1377 opts->flags |= REBASE_INTERACTIVE_EXPLICIT;
1378
1379 return 0;
@@ -1440,7 +1437,7 @@ static void set_reflog_action(struct rebase_options *options)
1437 const char *env;
1438 struct strbuf buf = STRBUF_INIT;
1439
1443 - if (!is_interactive(options))
1440 + if (!is_merge(options))
1441 return;
1442
1443 env = getenv(GIT_REFLOG_ACTION_ENVIRONMENT);
@@ -1537,8 +1534,8 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
1534 OPT_CMDMODE(0, "show-current-patch", &action,
1535 N_("show the patch file being applied or merged"),
1536 ACTION_SHOW_CURRENT_PATCH),
1540 - { OPTION_CALLBACK, 0, "am", &options, NULL,
1541 - N_("use apply-mail strategies to rebase"),
1537 + { OPTION_CALLBACK, 0, "apply", &options, NULL,
1538 + N_("use apply strategies to rebase"),
1539 PARSE_OPT_NOARG | PARSE_OPT_NONEG,
1540 parse_opt_am },
1541 { OPTION_CALLBACK, 'm', "merge", &options, NULL,
@@ -1615,7 +1612,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
1612 die(_("It looks like 'git am' is in progress. Cannot rebase."));
1613
1614 if (is_directory(apply_dir())) {
1618 - options.type = REBASE_AM;
1615 + options.type = REBASE_APPLY;
1616 options.state_dir = apply_dir();
1617 } else if (is_directory(merge_dir())) {
1618 strbuf_reset(&buf);
@@ -1627,7 +1624,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
1624 strbuf_reset(&buf);
1625 strbuf_addf(&buf, "%s/interactive", merge_dir());
1626 if(file_exists(buf.buf)) {
1630 - options.type = REBASE_INTERACTIVE;
1627 + options.type = REBASE_MERGE;
1628 options.flags |= REBASE_INTERACTIVE_EXPLICIT;
1629 } else
1630 options.type = REBASE_MERGE;
@@ -1667,12 +1664,12 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
1664 die(_("No rebase in progress?"));
1665 setenv(GIT_REFLOG_ACTION_ENVIRONMENT, "rebase", 0);
1666
1670 - if (action == ACTION_EDIT_TODO && !is_interactive(&options))
1667 + if (action == ACTION_EDIT_TODO && !is_merge(&options))
1668 die(_("The --edit-todo action can only be used during "
1669 "interactive rebase."));
1670
1671 if (trace2_is_enabled()) {
1675 - if (is_interactive(&options))
1672 + if (is_merge(&options))
1673 trace2_cmd_mode("interactive");
1674 else if (exec.nr)
1675 trace2_cmd_mode("interactive-exec");
@@ -1748,7 +1745,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
1745 goto cleanup;
1746 }
1747 case ACTION_QUIT: {
1751 - if (options.type == REBASE_INTERACTIVE) {
1748 + if (options.type == REBASE_MERGE) {
1749 struct replay_opts replay = REPLAY_OPTS_INIT;
1750
1751 replay.action = REPLAY_INTERACTIVE_REBASE;
@@ -1831,7 +1828,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
1828 argv_array_push(&options.git_am_opts, "-q");
1829
1830 if (options.empty != EMPTY_UNSPECIFIED)
1834 - imply_interactive(&options, "--empty");
1831 + imply_merge(&options, "--empty");
1832
1833 if (gpg_sign) {
1834 free(options.gpg_sign_opt);
@@ -1841,7 +1838,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
1838 if (exec.nr) {
1839 int i;
1840
1844 - imply_interactive(&options, "--exec");
1841 + imply_merge(&options, "--exec");
1842
1843 strbuf_reset(&buf);
1844 for (i = 0; i < exec.nr; i++)
@@ -1857,7 +1854,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
1854 else if (strcmp("no-rebase-cousins", rebase_merges))
1855 die(_("Unknown mode: %s"), rebase_merges);
1856 options.rebase_merges = 1;
1860 - imply_interactive(&options, "--rebase-merges");
1857 + imply_merge(&options, "--rebase-merges");
1858 }
1859
1860 if (strategy_options.nr) {
@@ -1876,10 +1873,9 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
1873 if (options.strategy) {
1874 options.strategy = xstrdup(options.strategy);
1875 switch (options.type) {
1879 - case REBASE_AM:
1876 + case REBASE_APPLY:
1877 die(_("--strategy requires --merge or --interactive"));
1878 case REBASE_MERGE:
1882 - case REBASE_INTERACTIVE:
1879 case REBASE_PRESERVE_MERGES:
1880 /* compatible */
1881 break;
@@ -1892,34 +1888,34 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
1888 }
1889
1890 if (options.type == REBASE_MERGE)
1895 - imply_interactive(&options, "--merge");
1891 + imply_merge(&options, "--merge");
1892
1893 if (options.root && !options.onto_name)
1898 - imply_interactive(&options, "--root without --onto");
1894 + imply_merge(&options, "--root without --onto");
1895
1896 if (isatty(2) && options.flags & REBASE_NO_QUIET)
1897 strbuf_addstr(&options.git_format_patch_opt, " --progress");
1898
1903 - if (options.git_am_opts.argc || options.type == REBASE_AM) {
1904 - /* all am options except -q are compatible only with --am */
1899 + if (options.git_am_opts.argc || options.type == REBASE_APPLY) {
1900 + /* all am options except -q are compatible only with --apply */
1901 for (i = options.git_am_opts.argc - 1; i >= 0; i--)
1902 if (strcmp(options.git_am_opts.argv[i], "-q"))
1903 break;
1904
1905 if (i >= 0) {
1910 - if (is_interactive(&options))
1911 - die(_("cannot combine am options with either "
1912 - "interactive or merge options"));
1906 + if (is_merge(&options))
1907 + die(_("cannot combine apply options with "
1908 + "merge options"));
1909 else
1914 - options.type = REBASE_AM;
1910 + options.type = REBASE_APPLY;
1911 }
1912 }
1913
1914 if (options.type == REBASE_UNSPECIFIED) {
1915 if (!strcmp(options.default_backend, "merge"))
1920 - imply_interactive(&options, "--merge");
1921 - else if (!strcmp(options.default_backend, "am"))
1922 - options.type = REBASE_AM;
1916 + imply_merge(&options, "--merge");
1917 + else if (!strcmp(options.default_backend, "apply"))
1918 + options.type = REBASE_APPLY;
1919 else
1920 die(_("Unknown rebase backend: %s"),
1921 options.default_backend);
@@ -1927,11 +1923,10 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
1923
1924 switch (options.type) {
1925 case REBASE_MERGE:
1930 - case REBASE_INTERACTIVE:
1926 case REBASE_PRESERVE_MERGES:
1927 options.state_dir = merge_dir();
1928 break;
1934 - case REBASE_AM:
1929 + case REBASE_APPLY:
1930 options.state_dir = apply_dir();
1931 break;
1932 default:
@@ -1946,7 +1941,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
1941 else
1942 options.empty = EMPTY_DROP;
1943 }
1949 - if (reschedule_failed_exec > 0 && !is_interactive(&options))
1944 + if (reschedule_failed_exec > 0 && !is_merge(&options))
1945 die(_("--reschedule-failed-exec requires "
1946 "--exec or --interactive"));
1947 if (reschedule_failed_exec >= 0)
@@ -2247,7 +2242,7 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
2242 diff_flush(&opts);
2243 }
2244
2250 - if (is_interactive(&options))
2245 + if (is_merge(&options))
2246 goto run_rebase;
2247
2248 /* Detach HEAD and reset the tree */
t/t3400-rebase.sh
+8 -8
@@ -183,19 +183,19 @@ test_expect_success 'default to common base in @{upstream}s reflog if no upstrea
183 test_cmp expect actual
184 '
185
186 -test_expect_success 'default to common base in @{upstream}s reflog if no upstream arg (--am)' '
186 +test_expect_success 'default to common base in @{upstream}s reflog if no upstream arg (--apply)' '
187 git checkout -B default-base master &&
188 git checkout -B default topic &&
189 git config branch.default.remote . &&
190 git config branch.default.merge refs/heads/default-base &&
191 - git rebase --am &&
191 + git rebase --apply &&
192 git rev-parse --verify default-base >expect &&
193 git rev-parse default~1 >actual &&
194 test_cmp expect actual &&
195 git checkout default-base &&
196 git reset --hard HEAD^ &&
197 git checkout default &&
198 - git rebase --am &&
198 + git rebase --apply &&
199 git rev-parse --verify default-base >expect &&
200 git rev-parse default~1 >actual &&
201 test_cmp expect actual
@@ -224,9 +224,9 @@ test_expect_success 'cherry-picked commits and fork-point work together' '
224 test_cmp expect D
225 '
226
227 -test_expect_success 'rebase --am -q is quiet' '
227 +test_expect_success 'rebase --apply -q is quiet' '
228 git checkout -b quiet topic &&
229 - git rebase --am -q master >output.out 2>&1 &&
229 + git rebase --apply -q master >output.out 2>&1 &&
230 test_must_be_empty output.out
231 '
232
@@ -315,7 +315,7 @@ EOF
315 test_cmp From_.msg out
316 '
317
318 -test_expect_success 'rebase --am and --show-current-patch' '
318 +test_expect_success 'rebase --apply and --show-current-patch' '
319 test_create_repo conflict-apply &&
320 (
321 cd conflict-apply &&
@@ -325,13 +325,13 @@ test_expect_success 'rebase --am and --show-current-patch' '
325 echo two >>init.t &&
326 git commit -a -m two &&
327 git tag two &&
328 - test_must_fail git rebase --am -f --onto init HEAD^ &&
328 + test_must_fail git rebase --apply -f --onto init HEAD^ &&
329 GIT_TRACE=1 git rebase --show-current-patch >/dev/null 2>stderr &&
330 grep "show.*$(git rev-parse two)" stderr
331 )
332 '
333
334 -test_expect_success 'rebase --am and .gitattributes' '
334 +test_expect_success 'rebase --apply and .gitattributes' '
335 test_create_repo attributes &&
336 (
337 cd attributes &&
t/t3401-rebase-and-am-rename.sh
+2 -2
@@ -52,13 +52,13 @@ test_expect_success 'rebase --interactive: directory rename detected' '
52 )
53 '
54
55 -test_expect_failure 'rebase --am: directory rename detected' '
55 +test_expect_failure 'rebase --apply: directory rename detected' '
56 (
57 cd dir-rename &&
58
59 git checkout B^0 &&
60
61 - git -c merge.directoryRenames=true rebase --am A &&
61 + git -c merge.directoryRenames=true rebase --apply A &&
62
63 git ls-files -s >out &&
64 test_line_count = 5 out &&
t/t3404-rebase-interactive.sh
+1 -1
@@ -1138,7 +1138,7 @@ test_expect_success C_LOCALE_OUTPUT 'rebase --edit-todo does not work on non-int
1138 git checkout conflict-branch &&
1139 (
1140 set_fake_editor &&
1141 - test_must_fail git rebase -f --am --onto HEAD~2 HEAD~ &&
1141 + test_must_fail git rebase -f --apply --onto HEAD~2 HEAD~ &&
1142 test_must_fail git rebase --edit-todo
1143 ) &&
1144 git rebase --abort
t/t3406-rebase-message.sh
+6 -6
@@ -23,24 +23,24 @@ test_expect_success 'rebase -m' '
23 '
24
25 test_expect_success 'rebase against master twice' '
26 - git rebase --am master >out &&
26 + git rebase --apply master >out &&
27 test_i18ngrep "Current branch topic is up to date" out
28 '
29
30 test_expect_success 'rebase against master twice with --force' '
31 - git rebase --force-rebase --am master >out &&
31 + git rebase --force-rebase --apply master >out &&
32 test_i18ngrep "Current branch topic is up to date, rebase forced" out
33 '
34
35 test_expect_success 'rebase against master twice from another branch' '
36 git checkout topic^ &&
37 - git rebase --am master topic >out &&
37 + git rebase --apply master topic >out &&
38 test_i18ngrep "Current branch topic is up to date" out
39 '
40
41 test_expect_success 'rebase fast-forward to master' '
42 git checkout topic^ &&
43 - git rebase --am topic >out &&
43 + git rebase --apply topic >out &&
44 test_i18ngrep "Fast-forwarded HEAD to topic" out
45 '
46
@@ -89,7 +89,7 @@ test_expect_success 'GIT_REFLOG_ACTION' '
89 git checkout -b reflog-topic start &&
90 test_commit reflog-to-rebase &&
91
92 - git rebase --am reflog-onto &&
92 + git rebase --apply reflog-onto &&
93 git log -g --format=%gs -3 >actual &&
94 cat >expect <<-\EOF &&
95 rebase finished: returning to refs/heads/reflog-topic
@@ -99,7 +99,7 @@ test_expect_success 'GIT_REFLOG_ACTION' '
99 test_cmp expect actual &&
100
101 git checkout -b reflog-prefix reflog-to-rebase &&
102 - GIT_REFLOG_ACTION=change-the-reflog git rebase --am reflog-onto &&
102 + GIT_REFLOG_ACTION=change-the-reflog git rebase --apply reflog-onto &&
103 git log -g --format=%gs -3 >actual &&
104 cat >expect <<-\EOF &&
105 rebase finished: returning to refs/heads/reflog-prefix
t/t3407-rebase-abort.sh
+3 -3
@@ -96,14 +96,14 @@ testrebase() {
96 '
97 }
98
99 -testrebase " --am" .git/rebase-apply
99 +testrebase " --apply" .git/rebase-apply
100 testrebase " --merge" .git/rebase-merge
101
102 -test_expect_success 'rebase --am --quit' '
102 +test_expect_success 'rebase --apply --quit' '
103 cd "$work_dir" &&
104 # Clean up the state from the previous one
105 git reset --hard pre-rebase &&
106 - test_must_fail git rebase --am master &&
106 + test_must_fail git rebase --apply master &&
107 test_path_is_dir .git/rebase-apply &&
108 head_before=$(git rev-parse HEAD) &&
109 git rebase --quit &&
t/t3420-rebase-autostash.sh
+11 -11
@@ -34,7 +34,7 @@ test_expect_success setup '
34 remove_progress_re="$(printf "s/.*\\r//")"
35 '
36
37 -create_expected_success_am () {
37 +create_expected_success_apply () {
38 cat >expected <<-EOF
39 $(grep "^Created autostash: [0-9a-f][0-9a-f]*\$" actual)
40 First, rewinding head to replay your work on top of it...
@@ -44,7 +44,7 @@ create_expected_success_am () {
44 EOF
45 }
46
47 -create_expected_success_interactive () {
47 +create_expected_success_merge () {
48 q_to_cr >expected <<-EOF
49 $(grep "^Created autostash: [0-9a-f][0-9a-f]*\$" actual)
50 Applied autostash.
@@ -52,7 +52,7 @@ create_expected_success_interactive () {
52 EOF
53 }
54
55 -create_expected_failure_am () {
55 +create_expected_failure_apply () {
56 cat >expected <<-EOF
57 $(grep "^Created autostash: [0-9a-f][0-9a-f]*\$" actual)
58 First, rewinding head to replay your work on top of it...
@@ -64,7 +64,7 @@ create_expected_failure_am () {
64 EOF
65 }
66
67 -create_expected_failure_interactive () {
67 +create_expected_failure_merge () {
68 cat >expected <<-EOF
69 $(grep "^Created autostash: [0-9a-f][0-9a-f]*\$" actual)
70 Applying autostash resulted in conflicts.
@@ -101,9 +101,9 @@ testrebase () {
101
102 test_expect_success "rebase$type --autostash: check output" '
103 test_when_finished git branch -D rebased-feature-branch &&
104 - suffix=${type#\ --} && suffix=${suffix:-am} &&
105 - if test ${suffix} = "merge"; then
106 - suffix=interactive
104 + suffix=${type#\ --} && suffix=${suffix:-apply} &&
105 + if test ${suffix} = "interactive"; then
106 + suffix=merge
107 fi &&
108 create_expected_success_$suffix &&
109 sed "$remove_progress_re" <actual >actual2 &&
@@ -202,9 +202,9 @@ testrebase () {
202
203 test_expect_success "rebase$type: check output with conflicting stash" '
204 test_when_finished git branch -D rebased-feature-branch &&
205 - suffix=${type#\ --} && suffix=${suffix:-am} &&
206 - if test ${suffix} = "merge"; then
207 - suffix=interactive
205 + suffix=${type#\ --} && suffix=${suffix:-apply} &&
206 + if test ${suffix} = "interactive"; then
207 + suffix=merge
208 fi &&
209 create_expected_failure_$suffix &&
210 sed "$remove_progress_re" <actual >actual2 &&
@@ -234,7 +234,7 @@ test_expect_success "rebase: noop rebase" '
234 git checkout feature-branch
235 '
236
237 -testrebase " --am" .git/rebase-apply
237 +testrebase " --apply" .git/rebase-apply
238 testrebase " --merge" .git/rebase-merge
239 testrebase " --interactive" .git/rebase-merge
240
t/t3421-rebase-topology-linear.sh
+17 -17
@@ -26,7 +26,7 @@ test_run_rebase () {
26 test_linear_range 'd e' c..
27 "
28 }
29 -test_run_rebase success --am
29 +test_run_rebase success --apply
30 test_run_rebase success -m
31 test_run_rebase success -i
32 test_have_prereq !REBASE_P || test_run_rebase success -p
@@ -50,7 +50,7 @@ test_run_rebase () {
50 test_cmp_rev e HEAD
51 "
52 }
53 -test_run_rebase success --am
53 +test_run_rebase success --apply
54 test_run_rebase success -m
55 test_run_rebase success -i
56 test_have_prereq !REBASE_P || test_run_rebase success -p
@@ -66,7 +66,7 @@ test_run_rebase () {
66 test_linear_range 'd e' b..
67 "
68 }
69 -test_run_rebase success --am
69 +test_run_rebase success --apply
70 test_run_rebase success --fork-point
71 test_run_rebase success -m
72 test_run_rebase success -i
@@ -83,7 +83,7 @@ test_run_rebase () {
83 test_linear_range 'd e' branch-b..
84 "
85 }
86 -test_run_rebase success --am
86 +test_run_rebase success --apply
87 test_run_rebase success --fork-point
88 test_run_rebase success -m
89 test_run_rebase success -i
@@ -98,7 +98,7 @@ test_run_rebase () {
98 test_cmp_rev e HEAD
99 "
100 }
101 -test_run_rebase success --am
101 +test_run_rebase success --apply
102 test_run_rebase success --fork-point
103 test_run_rebase success -m
104 test_run_rebase success -i
@@ -139,7 +139,7 @@ test_run_rebase () {
139 test_linear_range 'd i' h..
140 "
141 }
142 -test_run_rebase success --am
142 +test_run_rebase success --apply
143 test_run_rebase success -m
144 test_run_rebase success -i
145 test_have_prereq !REBASE_P || test_run_rebase success -p
@@ -154,7 +154,7 @@ test_run_rebase () {
154 test_linear_range 'd' h..
155 "
156 }
157 -test_run_rebase success --am
157 +test_run_rebase success --apply
158 test_run_rebase success -m
159 test_run_rebase success -i
160 test_have_prereq !REBASE_P || test_run_rebase success -p
@@ -169,7 +169,7 @@ test_run_rebase () {
169 test_linear_range 'd i' f..
170 "
171 }
172 -test_run_rebase success --am
172 +test_run_rebase success --apply
173 test_run_rebase success -m
174 test_run_rebase success -i
175 test_have_prereq !REBASE_P || test_run_rebase success -p
@@ -184,7 +184,7 @@ test_run_rebase () {
184 test_linear_range 'd gp i' h..
185 "
186 }
187 -test_run_rebase success --am
187 +test_run_rebase success --apply
188 test_run_rebase success -m
189 test_run_rebase success -i
190 test_have_prereq !REBASE_P || test_run_rebase success -p
@@ -212,7 +212,7 @@ test_run_rebase () {
212 test_linear_range 'j d k l' c..
213 "
214 }
215 -test_run_rebase failure --am
215 +test_run_rebase failure --apply
216 test_run_rebase success -m
217 test_run_rebase success -i
218 test_have_prereq !REBASE_P || test_run_rebase failure -p
@@ -227,7 +227,7 @@ test_run_rebase () {
227 test_linear_range 'd k l' c..
228 "
229 }
230 -test_run_rebase success --am
230 +test_run_rebase success --apply
231 test_run_rebase success -m
232 test_run_rebase success -i
233 test_have_prereq !REBASE_P || test_run_rebase success -p
@@ -242,7 +242,7 @@ test_run_rebase () {
242 test_linear_range 'd k l' j..
243 "
244 }
245 -test_run_rebase success --am
245 +test_run_rebase success --apply
246 test_run_rebase success -m
247 test_run_rebase success -i
248 test_have_prereq !REBASE_P || test_run_rebase success -p
@@ -282,7 +282,7 @@ test_run_rebase () {
282 test_linear_range 'x y' c..
283 "
284 }
285 -test_run_rebase success --am
285 +test_run_rebase success --apply
286 test_run_rebase success -m
287 test_run_rebase success -i
288 test_have_prereq !REBASE_P || test_run_rebase success -p
@@ -297,7 +297,7 @@ test_run_rebase () {
297 test_linear_range 'x y' c..
298 "
299 }
300 -test_run_rebase success --am
300 +test_run_rebase success --apply
301 test_run_rebase success -m
302 test_run_rebase success -i
303 test_have_prereq !REBASE_P || test_run_rebase failure -p
@@ -312,7 +312,7 @@ test_run_rebase () {
312 test_linear_range 'x y' m..
313 "
314 }
315 -test_run_rebase success --am
315 +test_run_rebase success --apply
316 test_run_rebase success -m
317 test_run_rebase success -i
318 test_have_prereq !REBASE_P || test_run_rebase success -p
@@ -328,7 +328,7 @@ test_run_rebase () {
328 "
329 }
330
331 -test_run_rebase success --am
331 +test_run_rebase success --apply
332 test_run_rebase success -m
333 test_run_rebase success -i
334 test_have_prereq !REBASE_P || test_run_rebase failure -p
@@ -343,7 +343,7 @@ test_run_rebase () {
343 test_linear_range 'x y' m..
344 "
345 }
346 -test_run_rebase success --am
346 +test_run_rebase success --apply
347 test_run_rebase success -m
348 test_run_rebase success -i
349 test_have_prereq !REBASE_P || test_run_rebase failure -p
t/t3424-rebase-empty.sh
+3 -3
@@ -34,11 +34,11 @@ test_expect_success 'setup test repository' '
34 git commit -m "Five letters ought to be enough for anybody"
35 '
36
37 -test_expect_failure 'rebase (am-backend)' '
37 +test_expect_failure 'rebase (apply-backend)' '
38 test_when_finished "git rebase --abort" &&
39 git checkout -B testing localmods &&
40 - # rebase (--am) should not drop commits that start empty
41 - git rebase upstream &&
40 + # rebase (--apply) should not drop commits that start empty
41 + git rebase --apply upstream &&
42
43 test_write_lines D C B A >expect &&
44 git log --format=%s >actual &&
t/t3425-rebase-topology-merges.sh
+4 -4
@@ -54,7 +54,7 @@ test_run_rebase () {
54 test_linear_range 'n o' e..
55 "
56 }
57 -test_run_rebase success --am
57 +test_run_rebase success --apply
58 test_run_rebase success -m
59 test_run_rebase success -i
60
@@ -70,7 +70,7 @@ test_run_rebase () {
70 test_linear_range "\'"$expected"\'" d..
71 "
72 }
73 -test_run_rebase success 'n o e' --am
73 +test_run_rebase success 'n o e' --apply
74 test_run_rebase success 'n o e' -m
75 test_run_rebase success 'n o e' -i
76
@@ -86,7 +86,7 @@ test_run_rebase () {
86 test_linear_range "\'"$expected"\'" c..
87 "
88 }
89 -test_run_rebase success 'd n o e' --am
89 +test_run_rebase success 'd n o e' --apply
90 test_run_rebase success 'd n o e' -m
91 test_run_rebase success 'd n o e' -i
92
@@ -102,7 +102,7 @@ test_run_rebase () {
102 test_linear_range "\'"$expected"\'" c..
103 "
104 }
105 -test_run_rebase success 'd n o e' --am
105 +test_run_rebase success 'd n o e' --apply
106 test_run_rebase success 'd n o e' -m
107 test_run_rebase success 'd n o e' -i
108
t/t3432-rebase-fast-forward.sh
+2 -2
@@ -28,8 +28,8 @@ test_rebase_same_head () {
28 shift &&
29 cmp_f="$1" &&
30 shift &&
31 - test_rebase_same_head_ $status_n $what_n $cmp_n " --am" "$*" &&
32 - test_rebase_same_head_ $status_f $what_f $cmp_f " --am --no-ff" "$*"
31 + test_rebase_same_head_ $status_n $what_n $cmp_n " --apply" "$*" &&
32 + test_rebase_same_head_ $status_f $what_f $cmp_f " --apply --no-ff" "$*"
33 test_rebase_same_head_ $status_n $what_n $cmp_n " --merge" "$*" &&
34 test_rebase_same_head_ $status_f $what_f $cmp_f " --merge --no-ff" "$*"
35 }
t/t5407-post-rewrite-hook.sh
+8 -8
@@ -53,10 +53,10 @@ test_expect_success 'git commit --amend --no-post-rewrite' '
53 test ! -f post-rewrite.data
54 '
55
56 -test_expect_success 'git rebase --am' '
56 +test_expect_success 'git rebase --apply' '
57 git reset --hard D &&
58 clear_hook_input &&
59 - test_must_fail git rebase --am --onto A B &&
59 + test_must_fail git rebase --apply --onto A B &&
60 echo C > foo &&
61 git add foo &&
62 git rebase --continue &&
@@ -68,10 +68,10 @@ test_expect_success 'git rebase --am' '
68 verify_hook_input
69 '
70
71 -test_expect_success 'git rebase --am --skip' '
71 +test_expect_success 'git rebase --apply --skip' '
72 git reset --hard D &&
73 clear_hook_input &&
74 - test_must_fail git rebase --am --onto A B &&
74 + test_must_fail git rebase --apply --onto A B &&
75 test_must_fail git rebase --skip &&
76 echo D > foo &&
77 git add foo &&
@@ -84,10 +84,10 @@ test_expect_success 'git rebase --am --skip' '
84 verify_hook_input
85 '
86
87 -test_expect_success 'git rebase --am --skip the last one' '
87 +test_expect_success 'git rebase --apply --skip the last one' '
88 git reset --hard F &&
89 clear_hook_input &&
90 - test_must_fail git rebase --am --onto D A &&
90 + test_must_fail git rebase --apply --onto D A &&
91 git rebase --skip &&
92 echo rebase >expected.args &&
93 cat >expected.data <<-EOF &&
@@ -128,7 +128,7 @@ test_expect_success 'git rebase -m --skip' '
128 verify_hook_input
129 '
130
131 -test_expect_success 'git rebase with implicit use of interactive backend' '
131 +test_expect_success 'git rebase with implicit use of merge backend' '
132 git reset --hard D &&
133 clear_hook_input &&
134 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' '
143 verify_hook_input
144 '
145
146 -test_expect_success 'git rebase --skip with implicit use of interactive backend' '
146 +test_expect_success 'git rebase --skip with implicit use of merge backend' '
147 git reset --hard D &&
148 clear_hook_input &&
149 test_must_fail git rebase --keep-empty --onto A B &&
t/t5520-pull.sh
+1 -1
@@ -297,7 +297,7 @@ test_expect_success '--rebase (merge) fast forward' '
297 test_expect_success '--rebase (am) fast forward' '
298 git reset --hard before-rebase &&
299
300 - git -c rebase.backend=am pull --rebase . ff &&
300 + git -c rebase.backend=apply pull --rebase . ff &&
301 test_cmp_rev HEAD ff &&
302
303 # The above only validates the result. Did we actually bypass rebase?
t/t6047-diff3-conflict-markers.sh
+2 -2
@@ -199,11 +199,11 @@ test_expect_success 'rebase --merge describes parent of commit being picked' '
199 )
200 '
201
202 -test_expect_success 'rebase --am describes fake ancestor base' '
202 +test_expect_success 'rebase --apply describes fake ancestor base' '
203 (
204 cd rebase &&
205 git rebase --abort &&
206 - test_must_fail git -c merge.conflictstyle=diff3 rebase --am master &&
206 + test_must_fail git -c merge.conflictstyle=diff3 rebase --apply master &&
207 grep "||||||| constructed merge base" file
208 )
209 '
t/t7512-status-help.sh
+6 -6
@@ -71,10 +71,10 @@ test_expect_success 'prepare for rebase conflicts' '
71 '
72
73
74 -test_expect_success 'status when rebase --am in progress before resolving conflicts' '
74 +test_expect_success 'status when rebase --apply in progress before resolving conflicts' '
75 test_when_finished "git rebase --abort" &&
76 ONTO=$(git rev-parse --short HEAD^^) &&
77 - test_must_fail git rebase --am HEAD^ --onto HEAD^^ &&
77 + test_must_fail git rebase --apply HEAD^ --onto HEAD^^ &&
78 cat >expected <<EOF &&
79 rebase in progress; onto $ONTO
80 You are currently rebasing branch '\''rebase_conflicts'\'' on '\''$ONTO'\''.
@@ -94,11 +94,11 @@ EOF
94 '
95
96
97 -test_expect_success 'status when rebase --am in progress before rebase --continue' '
97 +test_expect_success 'status when rebase --apply in progress before rebase --continue' '
98 git reset --hard rebase_conflicts &&
99 test_when_finished "git rebase --abort" &&
100 ONTO=$(git rev-parse --short HEAD^^) &&
101 - test_must_fail git rebase --am HEAD^ --onto HEAD^^ &&
101 + test_must_fail git rebase --apply HEAD^ --onto HEAD^^ &&
102 echo three >main.txt &&
103 git add main.txt &&
104 cat >expected <<EOF &&
@@ -688,7 +688,7 @@ EOF
688 '
689
690
691 -test_expect_success 'status when rebase --am conflicts with statushints disabled' '
691 +test_expect_success 'status when rebase --apply conflicts with statushints disabled' '
692 git reset --hard master &&
693 git checkout -b statushints_disabled &&
694 test_when_finished "git config --local advice.statushints true" &&
@@ -698,7 +698,7 @@ test_expect_success 'status when rebase --am conflicts with statushints disabled
698 test_commit three_statushints main.txt three &&
699 test_when_finished "git rebase --abort" &&
700 ONTO=$(git rev-parse --short HEAD^^) &&
701 - test_must_fail git rebase --am HEAD^ --onto HEAD^^ &&
701 + test_must_fail git rebase --apply HEAD^ --onto HEAD^^ &&
702 cat >expected <<EOF &&
703 rebase in progress; onto $ONTO
704 You are currently rebasing branch '\''statushints_disabled'\'' on '\''$ONTO'\''.
t/t9903-bash-prompt.sh
+1 -1
@@ -193,7 +193,7 @@ test_expect_success 'prompt - rebase am' '
193 printf " (b2|REBASE 1/3)" >expected &&
194 git checkout b2 &&
195 test_when_finished "git checkout master" &&
196 - test_must_fail git rebase --am b1 b2 &&
196 + test_must_fail git rebase --apply b1 b2 &&
197 test_when_finished "git rebase --abort" &&
198 __git_ps1 >"$actual" &&
199 test_cmp expected "$actual"