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=-3.2 required=3.0 tests=AWL,BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI shortcircuit=no autolearn=ham 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 296F61F424 for ; Sat, 21 Apr 2018 07:35:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751373AbeDUHfD (ORCPT ); Sat, 21 Apr 2018 03:35:03 -0400 Received: from mout.gmx.net ([212.227.17.20]:42579 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751223AbeDUHfC (ORCPT ); Sat, 21 Apr 2018 03:35:02 -0400 Received: from [192.168.0.129] ([37.201.195.116]) by mail.gmx.com (mrgmx103 [212.227.17.168]) with ESMTPSA (Nemesis) id 0M0QLp-1eHxNM39mX-00uWqA; Sat, 21 Apr 2018 09:34:57 +0200 Date: Sat, 21 Apr 2018 09:34:41 +0200 (DST) From: Johannes Schindelin X-X-Sender: virtualbox@MININT-6BKU6QN.europe.corp.microsoft.com To: git@vger.kernel.org cc: Junio C Hamano , Eric Sunshine , Stefan Beller Subject: [PATCH v3 0/4] rebase -i: avoid stale "# This is a combination of" in commit messages 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:K1:RunrBIiCdntGPlmlGh7HaAQaYUcdLFe6LvqfrWrTk5EvtiNHlXu x/XuHA8rW5E5J5f54N8m3vxV9a04AzjnVY2QSfEegxVK/e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el.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Eric Sunshine pointed out that I had such a commit message in https://public-inbox.org/git/CAPig+cRrS0_nYJJY=O6cboV630sNQHPV5QGrQdD8MW-sYzNFGQ@mail.gmail.com/ and I went on a hunt to figure out how the heck this happened. Turns out that if there is a fixup/squash chain where the *last* command fails with merge conflicts, and we either --skip ahead or resolve the conflict to a clean tree and then --continue, our code does not do a final cleanup. Contrary to my initial gut feeling, this bug was not introduced by my rewrite in C of the core parts of rebase -i, but it looks to me as if that bug was with us for a very long time (at least the --skip part). The developer (read: user of rebase -i) in me says that we would want to fast-track this, but the author of rebase -i in me says that we should be cautious and cook this in `next` for a while. Fixes since v2 (thanks, Stefan!): - Fixed commit message of 2/4: "Thisis" -> "This is". - Reinstated the order where the `message-squash` file is renamed to `message` first, and only if that succeeded, we delete the `message-fixup` file. Johannes Schindelin (4): rebase -i: demonstrate bugs with fixup!/squash! commit messages rebase -i: Handle "combination of commits" with GETTEXT_POISON sequencer: leave a tell-tale when a fixup/squash failed rebase --skip: clean up commit message after a failed fixup/squash sequencer.c | 94 ++++++++++++++++++++++++++++---------- t/t3418-rebase-continue.sh | 22 +++++++++ 2 files changed, 93 insertions(+), 23 deletions(-) base-commit: fe0a9eaf31dd0c349ae4308498c33a5c3794b293 Published-As: https://github.com/dscho/git/releases/tag/clean-msg-after-fixup-continue-v3 Fetch-It-Via: git fetch https://github.com/dscho/git clean-msg-after-fixup-continue-v3 Interdiff vs v2: diff --git a/sequencer.c b/sequencer.c index 881503a6463..b8b72fd540f 100644 --- a/sequencer.c +++ b/sequencer.c @@ -2409,6 +2409,10 @@ static int error_failed_squash(struct commit *commit, { const char *amend_type = "squash"; + if (rename(rebase_path_squash_msg(), rebase_path_message())) + return error(_("could not rename '%s' to '%s'"), + rebase_path_squash_msg(), rebase_path_message()); + if (file_exists(rebase_path_fixup_msg())) { unlink(rebase_path_fixup_msg()); amend_type = "fixup"; @@ -2418,9 +2422,6 @@ static int error_failed_squash(struct commit *commit, return error(_("could not write '%s'"), rebase_path_amend_type()); - if (rename(rebase_path_squash_msg(), rebase_path_message())) - return error(_("could not rename '%s' to '%s'"), - rebase_path_squash_msg(), rebase_path_message()); unlink(git_path_merge_msg()); if (copy_file(git_path_merge_msg(), rebase_path_message(), 0666)) return error(_("could not copy '%s' to '%s'"), -- 2.17.0.windows.1.15.gaa56ade3205