rebase: mark --update-refs as requiring the merge backend

--update-refs is built in terms of the sequencer, which requires the
merge backend.  It was already marked as incompatible with the apply
backend in the git-rebase manual, but the code didn't check for this
incompatibility and warn the user.  Check and error now.

While at it, fix a typo in t3422...and fix some misleading wording
(most options which used to be am-specific have since been implemented
in the merge backend 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 2023-01-25 04:03:45 +00:00 committed by Junio C Hamano
parent 56c8fb1e95
commit 1207599e83
3 changed files with 15 additions and 5 deletions

View File

@ -630,6 +630,8 @@ start would be overridden by the presence of
+ +
If the configuration variable `rebase.updateRefs` is set, then this option If the configuration variable `rebase.updateRefs` is set, then this option
can be used to override and disable this setting. can be used to override and disable this setting.
+
See also INCOMPATIBLE OPTIONS below.
INCOMPATIBLE OPTIONS INCOMPATIBLE OPTIONS
-------------------- --------------------

View File

@ -1492,6 +1492,9 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
} }
} }
if (options.update_refs)
imply_merge(&options, "--update-refs");
if (options.type == REBASE_UNSPECIFIED) { if (options.type == REBASE_UNSPECIFIED) {
if (!strcmp(options.default_backend, "merge")) if (!strcmp(options.default_backend, "merge"))
imply_merge(&options, "--merge"); imply_merge(&options, "--merge");

View File

@ -25,11 +25,11 @@ test_expect_success 'setup' '
' '
# #
# Rebase has lots of useful options like --whitepsace=fix, which are # Rebase has a couple options which are specific to the apply backend,
# actually all built in terms of flags to git-am. Since neither # and several options which are specific to the merge backend. Flags
# --merge nor --interactive (nor any options that imply those two) use # from the different sets cannot work together, and we do not want to
# git-am, using them together will result in flags like --whitespace=fix # just ignore one of the sets of flags. Make sure rebase warns the
# being ignored. Make sure rebase warns the user and aborts instead. # user and aborts instead.
# #
test_rebase_am_only () { test_rebase_am_only () {
@ -60,6 +60,11 @@ test_rebase_am_only () {
test_must_fail git rebase $opt --exec 'true' A test_must_fail git rebase $opt --exec 'true' A
" "
test_expect_success "$opt incompatible with --update-refs" "
git checkout B^0 &&
test_must_fail git rebase $opt --update-refs A
"
} }
test_rebase_am_only --whitespace=fix test_rebase_am_only --whitespace=fix