aboutsummaryrefslogtreecommitdiffstats
path: root/builtin/rebase.c
diff options
context:
space:
mode:
authorPhillip Wood <phillip.wood@dunelm.org.uk>2022-10-17 13:17:45 +0000
committerJunio C Hamano <gitster@pobox.com>2022-10-17 11:53:03 -0700
commitaa1df8146d70bb85c63b0999868fe29aebc1173e (patch)
tree8a3f340c4ab0cdcdd8e76decc533645717beb1ca /builtin/rebase.c
parentce5238a690821d1de230091dd6c9c13a99ed6752 (diff)
downloadgit-aa1df8146d70bb85c63b0999868fe29aebc1173e.tar.gz
rebase --keep-base: imply --no-fork-point
Given the name of the option it is confusing if --keep-base actually changes the base of the branch without --fork-point being explicitly given on the command line. The combination of --keep-base with an explicit --fork-point is still supported even though --fork-point means we do not keep the same base if the upstream branch has been rewound. We do this in case anyone is relying on this behavior which is tested in t3431[1] [1] https://lore.kernel.org/git/20200715032014.GA10818@generichostname/ Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/rebase.c')
-rw-r--r--builtin/rebase.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/builtin/rebase.c b/builtin/rebase.c
index 0287f3e817..ef520f66fb 100644
--- a/builtin/rebase.c
+++ b/builtin/rebase.c
@@ -1230,6 +1230,12 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
die(_("options '%s' and '%s' cannot be used together"), "--keep-base", "--onto");
if (options.root)
die(_("options '%s' and '%s' cannot be used together"), "--keep-base", "--root");
+ /*
+ * --keep-base defaults to --no-fork-point to keep the
+ * base the same.
+ */
+ if (options.fork_point < 0)
+ options.fork_point = 0;
}
/*
* --keep-base defaults to --reapply-cherry-picks to avoid losing