Merge branch 'ah/rebase-merges-config'

Streamline --rebase-merges command line option handling and
introduce rebase.merges configuration variable.

* ah/rebase-merges-config:
  rebase: add a config option for --rebase-merges
  rebase: deprecate --rebase-merges=""
  rebase: add documentation and test for --no-rebase-merges
This commit is contained in:
Junio C Hamano
2023-04-04 14:28:27 -07:00
5 changed files with 138 additions and 22 deletions

View File

@ -67,3 +67,13 @@ rebase.rescheduleFailedExec::
rebase.forkPoint::
If set to false set `--no-fork-point` option by default.
rebase.rebaseMerges::
Whether and how to set the `--rebase-merges` option by default. Can
be `rebase-cousins`, `no-rebase-cousins`, or a boolean. Setting to
true or to `no-rebase-cousins` is equivalent to
`--rebase-merges=no-rebase-cousins`, setting to `rebase-cousins` is
equivalent to `--rebase-merges=rebase-cousins`, and setting to false is
equivalent to `--no-rebase-merges`. Passing `--rebase-merges` on the
command line, with or without an argument, overrides any
`rebase.rebaseMerges` configuration.

View File

@ -529,20 +529,25 @@ See also INCOMPATIBLE OPTIONS below.
-r::
--rebase-merges[=(rebase-cousins|no-rebase-cousins)]::
--no-rebase-merges::
By default, a rebase will simply drop merge commits from the todo
list, and put the rebased commits into a single, linear branch.
With `--rebase-merges`, the rebase will instead try to preserve
the branching structure within the commits that are to be rebased,
by recreating the merge commits. Any resolved merge conflicts or
manual amendments in these merge commits will have to be
resolved/re-applied manually.
resolved/re-applied manually. `--no-rebase-merges` can be used to
countermand both the `rebase.rebaseMerges` config option and a previous
`--rebase-merges`.
+
By default, or when `no-rebase-cousins` was specified, commits which do not
have `<upstream>` as direct ancestor will keep their original branch point,
i.e. commits that would be excluded by linkgit:git-log[1]'s
`--ancestry-path` option will keep their original ancestry by default. If
the `rebase-cousins` mode is turned on, such commits are instead rebased
onto `<upstream>` (or `<onto>`, if specified).
When rebasing merges, there are two modes: `rebase-cousins` and
`no-rebase-cousins`. If the mode is not specified, it defaults to
`no-rebase-cousins`. In `no-rebase-cousins` mode, commits which do not have
`<upstream>` as direct ancestor will keep their original branch point, i.e.
commits that would be excluded by linkgit:git-log[1]'s `--ancestry-path`
option will keep their original ancestry by default. In `rebase-cousins` mode,
such commits are instead rebased onto `<upstream>` (or `<onto>`, if
specified).
+
It is currently only possible to recreate the merge commits using the
`ort` merge strategy; different merge strategies can be used only via