Skip to content

Commit 10cdb9f

Browse files
newrengitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 2ac0d62 commit 10cdb9f

18 files changed

+166
-168
lines changed

Documentation/config/rebase.txt

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,9 @@ rebase.useBuiltin::
77

88
rebase.backend::
99
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.
1513

1614
rebase.stat::
1715
Whether to show a diffstat of what changed upstream since the last

Documentation/git-rebase.txt

Lines changed: 41 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -258,10 +258,10 @@ See also INCOMPATIBLE OPTIONS below.
258258
original branch. The index and working tree are also left
259259
unchanged as a result.
260260

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.
265265
+
266266
See also INCOMPATIBLE OPTIONS below.
267267

@@ -385,7 +385,7 @@ See also INCOMPATIBLE OPTIONS below.
385385
Ensure at least <n> lines of surrounding context match before
386386
and after each change. When fewer lines of surrounding
387387
context exist they all must match. By default no context is
388-
ever ignored. Implies --am.
388+
ever ignored. Implies --apply.
389389
+
390390
See also INCOMPATIBLE OPTIONS below.
391391

@@ -425,7 +425,7 @@ with `--keep-base` in order to drop those commits from your branch.
425425
--whitespace=<option>::
426426
These flags are passed to the 'git apply' program
427427
(see linkgit:git-apply[1]) that applies the patch.
428-
Implies --am.
428+
Implies --apply.
429429
+
430430
See also INCOMPATIBLE OPTIONS below.
431431

@@ -569,7 +569,7 @@ INCOMPATIBLE OPTIONS
569569

570570
The following options:
571571

572-
* --am
572+
* --apply
573573
* --committer-date-is-author-date
574574
* --ignore-date
575575
* --ignore-whitespace
@@ -604,42 +604,48 @@ In addition, the following pairs of options are incompatible:
604604
BEHAVIORAL DIFFERENCES
605605
-----------------------
606606

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:
608614

609615
Empty commits
610616
~~~~~~~~~~~~~
611617

612-
The am backend unfortunately drops intentionally empty commits, i.e.
618+
The apply backend unfortunately drops intentionally empty commits, i.e.
613619
commits that started empty, though these are rare in practice. It
614620
also drops commits that become empty and has no option for controlling
615621
this behavior.
616622

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.
623629

624630
Directory rename detection
625631
~~~~~~~~~~~~~~~~~~~~~~~~~~
626632

627633
Due to the lack of accurate tree information (arising from
628634
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.
630636
Disabled directory rename detection means that if one side of history
631637
renames a directory and the other adds new files to the old directory,
632638
then the new files will be left behind in the old directory without
633639
any warning at the time of rebasing that you may want to move these
634640
files into the new directory.
635641

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.
638644

639645
Context
640646
~~~~~~~
641647

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
643649
`format-patch` internally), and then applying the patches in sequence
644650
(calling `am` internally). Patches are composed of multiple hunks,
645651
each with line numbers, a context region, and the actual changes. The
@@ -654,42 +660,41 @@ Setting diff.context to a larger value may prevent such types of
654660
problems, but increases the chance of spurious conflicts (since it
655661
will require more lines of matching context to apply).
656662

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,
658664
insulating it from these types of problems.
659665

660666
Labelling of conflicts markers
661667
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
662668

663669
When there are content conflicts, the merge machinery tries to
664670
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
666672
information about the rebased commits and their parents (and instead
667673
generates new fake commits based off limited information in the
668674
generated patches), those commits cannot be identified; instead it has
669675
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
671677
label the content from the merge base, and thus provide no information
672678
about the merge base commit whatsoever.
673679

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.
676682

677683
Hooks
678684
~~~~~
679685

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.
685690

686691
Interruptability
687692
~~~~~~~~~~~~~~~~
688693

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
693698
suffer from the same shortcoming. (See
694699
https://lore.kernel.org/git/[email protected]/ for
695700
details.)
@@ -707,9 +712,9 @@ completeness:
707712

708713
* Progress, informational, and error messages: The two backends
709714
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.
713718

714719
* State directories: The two backends keep their state in different
715720
directories under .git/

0 commit comments

Comments
 (0)