summaryrefslogtreecommitdiff
path: root/builtin/rebase.c
diff options
context:
space:
mode:
Diffstat (limited to 'builtin/rebase.c')
-rw-r--r--builtin/rebase.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/builtin/rebase.c b/builtin/rebase.c
index 1e1406c8ba..7ef9095e7c 100644
--- a/builtin/rebase.c
+++ b/builtin/rebase.c
@@ -1261,6 +1261,7 @@ static int is_linear_history(struct commit *from, struct commit *to)
}
static int can_fast_forward(struct commit *onto, struct commit *upstream,
+ struct commit *restrict_revision,
struct object_id *head_oid, struct object_id *merge_base)
{
struct commit *head = lookup_commit(the_repository, head_oid);
@@ -1280,6 +1281,9 @@ static int can_fast_forward(struct commit *onto, struct commit *upstream,
if (!oideq(merge_base, &onto->object.oid))
goto done;
+ if (restrict_revision && !oideq(&restrict_revision->object.oid, merge_base))
+ goto done;
+
if (!upstream)
goto done;
@@ -2042,9 +2046,9 @@ int cmd_rebase(int argc, const char **argv, const char *prefix)
* with new commits recreated by replaying their changes. This
* optimization must not be done if this is an interactive rebase.
*/
- if (can_fast_forward(options.onto, options.upstream, &options.orig_head,
- &merge_base) &&
- !is_interactive(&options) && !options.restrict_revision) {
+ if (can_fast_forward(options.onto, options.upstream, options.restrict_revision,
+ &options.orig_head, &merge_base) &&
+ !is_interactive(&options)) {
int flag;
if (!(options.flags & REBASE_FORCE)) {