Jeff King <peff@xxxxxxxx> writes: > ... So I do think there may be a bug to be fixed, > but it is simply commands being over-eager to make sure we have an > ident when they might not need it. 36267854 (pull: fast-forward "pull --rebase=true", 2016-06-29) may be a part of a good solution for that, perhaps? -- >8 -- From: Junio C Hamano <gitster@xxxxxxxxx> Date: Wed, 29 Jun 2016 10:22:31 -0700 Subject: [PATCH] pull: fast-forward "pull --rebase=true" Signed-off-by: Junio C Hamano <gitster@xxxxxxxxx> --- builtin/pull.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/builtin/pull.c b/builtin/pull.c index bf3fd3f..2a41d41 100644 --- a/builtin/pull.c +++ b/builtin/pull.c @@ -878,10 +878,24 @@ int cmd_pull(int argc, const char **argv, const char *prefix) if (merge_heads.nr > 1) die(_("Cannot merge multiple branches into empty head.")); return pull_into_void(*merge_heads.sha1, curr_head); - } else if (opt_rebase) { - if (merge_heads.nr > 1) - die(_("Cannot rebase onto multiple branches.")); + } + if (opt_rebase && merge_heads.nr > 1) + die(_("Cannot rebase onto multiple branches.")); + + if (opt_rebase) { + struct commit_list *list = NULL; + struct commit *merge_head, *head; + + head = lookup_commit_reference(orig_head); + commit_list_insert(head, &list); + merge_head = lookup_commit_reference(merge_heads.sha1[0]); + if (is_descendant_of(merge_head, list)) { + /* we can fast-forward this without invoking rebase */ + opt_ff = "--ff-only"; + return run_merge(); + } return run_rebase(curr_head, *merge_heads.sha1, rebase_fork_point); - } else + } else { return run_merge(); + } } -- 2.9.2-685-g483c9ea -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html