Skip to content

Commit 1207599

Browse files
newrengitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 56c8fb1 commit 1207599

File tree

3 files changed

+15
-5
lines changed

3 files changed

+15
-5
lines changed

Documentation/git-rebase.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -630,6 +630,8 @@ start would be overridden by the presence of
630630
+
631631
If the configuration variable `rebase.updateRefs` is set, then this option
632632
can be used to override and disable this setting.
633+
+
634+
See also INCOMPATIBLE OPTIONS below.
633635

634636
INCOMPATIBLE OPTIONS
635637
--------------------

builtin/rebase.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1492,6 +1492,9 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
14921492
}
14931493
}
14941494

1495+
if (options.update_refs)
1496+
imply_merge(&options, "--update-refs");
1497+
14951498
if (options.type == REBASE_UNSPECIFIED) {
14961499
if (!strcmp(options.default_backend, "merge"))
14971500
imply_merge(&options, "--merge");

t/t3422-rebase-incompatible-options.sh

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ test_expect_success 'setup' '
2525
'
2626

2727
#
28-
# Rebase has lots of useful options like --whitepsace=fix, which are
29-
# actually all built in terms of flags to git-am. Since neither
30-
# --merge nor --interactive (nor any options that imply those two) use
31-
# git-am, using them together will result in flags like --whitespace=fix
32-
# being ignored. Make sure rebase warns the user and aborts instead.
28+
# Rebase has a couple options which are specific to the apply backend,
29+
# and several options which are specific to the merge backend. Flags
30+
# from the different sets cannot work together, and we do not want to
31+
# just ignore one of the sets of flags. Make sure rebase warns the
32+
# user and aborts instead.
3333
#
3434

3535
test_rebase_am_only () {
@@ -60,6 +60,11 @@ test_rebase_am_only () {
6060
test_must_fail git rebase $opt --exec 'true' A
6161
"
6262

63+
test_expect_success "$opt incompatible with --update-refs" "
64+
git checkout B^0 &&
65+
test_must_fail git rebase $opt --update-refs A
66+
"
67+
6368
}
6469

6570
test_rebase_am_only --whitespace=fix

0 commit comments

Comments
 (0)