From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS31976 209.132.180.0/23 X-Spam-Status: No, score=-2.6 required=3.0 tests=AWL,BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_HI,T_RP_MATCHES_RCVD shortcircuit=no autolearn=no autolearn_force=no version=3.4.0 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by dcvr.yhbt.net (Postfix) with ESMTP id 33BAC1F404 for ; Sun, 11 Feb 2018 00:10:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752944AbeBKAKN (ORCPT ); Sat, 10 Feb 2018 19:10:13 -0500 Received: from mout.gmx.net ([212.227.15.18]:55681 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752910AbeBKAKM (ORCPT ); Sat, 10 Feb 2018 19:10:12 -0500 Received: from MININT-TB4PCE7.southpacific.corp.microsoft.com ([37.201.195.115]) by mail.gmx.com (mrgmx001 [212.227.17.190]) with ESMTPSA (Nemesis) id 0MK0Np-1ejIAn3Luv-001V8m; Sun, 11 Feb 2018 01:10:00 +0100 Date: Sun, 11 Feb 2018 01:09:58 +0100 (STD) From: Johannes Schindelin X-X-Sender: virtualbox@MININT-6BKU6QN.europe.corp.microsoft.com To: git@vger.kernel.org cc: Junio C Hamano , Jacob Keller , Stefan Beller , Philip Oakley , Eric Sunshine , Phillip Wood Subject: [PATCH v3 00/12] rebase -i: offer to recreate merge commits In-Reply-To: Message-ID: References: User-Agent: Alpine 2.21.1 (DEB 209 2017-03-23) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Provags-ID: V03:K0:3cgo+HD8KwVd316GsxgUvJNRTESvyhNwlf6c/iXVRdE8hk6ONZ4 I7/aL+3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owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Once upon a time, I dreamt of an interactive rebase that would not flatten branch structure, but instead recreate the commit topology faithfully. My original attempt was --preserve-merges, but that design was so limited that I did not even enable it in interactive mode. Subsequently, it *was* enabled in interactive mode, with the predictable consequences: as the --preserve-merges design does not allow for specifying the parents of merge commits explicitly, all the new commits' parents are defined *implicitly* by the previous commit history, and hence it is *not possible to even reorder commits*. This design flaw cannot be fixed. Not without a complete re-design, at least. This patch series offers such a re-design. Think of --recreate-merges as "--preserve-merges done right". It introduces new verbs for the todo list, `label`, `reset` and `merge`. For a commit topology like this: A - B - C \ / D the generated todo list would look like this: # branch D pick 0123 A label branch-point pick 1234 D label D reset branch-point pick 2345 B merge -C 3456 D # C There are more patches in the pipeline, based on this patch series, but left for later in the interest of reviewable patch series: one mini series to use the sequencer even for `git rebase -i --root`, and another one to add support for octopus merges to --recreate-merges. Changes since v2: - fixed the incorrect comment for rebase_path_refs_to_delete. - we now error out properly if read_cache_unmerged() fails. - if there are unresolved merge conflicts, the `reset` command now errors out (even if the current design should not allow for such a scenario to occur). - a diff hunk that was necessary to support `bud` was dropped from 2/10. - changed all `rollback_lock_file(); return error_errno(...);` patterns to first show the errors (i.e. using the correct errno). This added 1/11. - The temporary refs are now also cleaned up upon `git rebase --abort`. - Reworked the entire patch series to support merge -C # instead of the previous `merge `. - Dropped the octopus part of the description of the `merge` command in the usage at the bottom of the todo list, as it is subject to change. - The autosquash handling was not elegant, and cuddled into the same commit as the post-rewrite changes. Now, the autosquash handling is a lot more elegant, and a separate introductory patch (as it arguably improves the current code on its own). Johannes Schindelin (11): sequencer: avoid using errno clobbered by rollback_lock_file() sequencer: make rearrange_squash() a bit more obvious sequencer: introduce new commands to reset the revision sequencer: introduce the `merge` command sequencer: fast-forward merge commits, if possible rebase-helper --make-script: introduce a flag to recreate merges rebase: introduce the --recreate-merges option sequencer: make refs generated by the `label` command worktree-local sequencer: handle post-rewrite for merge commands pull: accept --rebase=recreate to recreate the branch topology rebase -i: introduce --recreate-merges=[no-]rebase-cousins Stefan Beller (1): git-rebase--interactive: clarify arguments Documentation/config.txt | 8 + Documentation/git-pull.txt | 5 +- Documentation/git-rebase.txt | 14 +- builtin/pull.c | 14 +- builtin/rebase--helper.c | 13 +- builtin/remote.c | 2 + contrib/completion/git-completion.bash | 4 +- git-rebase--interactive.sh | 22 +- git-rebase.sh | 16 + refs.c | 3 +- sequencer.c | 736 ++++++++++++++++++++++++++++++++- sequencer.h | 7 + t/t3430-rebase-recreate-merges.sh | 208 ++++++++++ 13 files changed, 1021 insertions(+), 31 deletions(-) create mode 100755 t/t3430-rebase-recreate-merges.sh base-commit: 5be1f00a9a701532232f57958efab4be8c959a29 Published-As: https://github.com/dscho/git/releases/tag/recreate-merges-v3 Fetch-It-Via: git fetch https://github.com/dscho/git recreate-merges-v3 Interdiff vs v2: diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh index 5e21e4cf269..e199fe1cca5 100644 --- a/git-rebase--interactive.sh +++ b/git-rebase--interactive.sh @@ -164,10 +164,10 @@ x, exec = run command (the rest of the line) using shell d, drop = remove commit l, label