From patchwork Fri Jan 8 09:23:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Charvi Mendiratta X-Patchwork-Id: 12006123 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DB218C433DB for ; Fri, 8 Jan 2021 09:26:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8E290233EA for ; Fri, 8 Jan 2021 09:26:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728014AbhAHJ0K (ORCPT ); Fri, 8 Jan 2021 04:26:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35944 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727639AbhAHJ0J (ORCPT ); Fri, 8 Jan 2021 04:26:09 -0500 Received: from mail-pg1-x530.google.com (mail-pg1-x530.google.com [IPv6:2607:f8b0:4864:20::530]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ABD9DC0612F5 for ; Fri, 8 Jan 2021 01:25:29 -0800 (PST) Received: by mail-pg1-x530.google.com with SMTP id p18so7281163pgm.11 for ; Fri, 08 Jan 2021 01:25:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=n+928/NLQrAzhBc/uF6G3lqqK0enztvZp/wEKWLJI8E=; b=SP2wOyAJp7SIOukdr/b2RPEa0a1eZrzkW9k3s+abuT+OwsZK5dNwMbRy+VUEEngXkb s6caeK6nfcCKUXxP+nqPCxhq24GDrUzpgi+5+3/LAp9otJWVIY3Y2y7nHr8ZiAq7v62B e+0k5b2gAHrdFF2tMvgUUH6ZymSXOFn1u+ZPBohwRqJL/n5K3F0pDiySwkba8xG4Dzcl nZzCQbMTa8kZMC5IBDb1MnAXt0123EKA98iex5rnmEATru72JuhLzOurGZHuBs67UT+g LBzchOZZEJ7AkqadvhFmi47DAqi1gOXyW1V+WTA7X+Jdrz4c2RVwiV36FROgVt/Q9bHd Iu7w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=n+928/NLQrAzhBc/uF6G3lqqK0enztvZp/wEKWLJI8E=; b=MPjMNOHZpaydSKJofN94iG6F4VOHggj/T4TmROQyKo0u6552fwYx3CMXiIkRvTCAqV f16j3qZgRM3psVHiSlKnG9qdfLo875B+IbhAScrnkVSD/4rsd4uOXlHYtDOyXcnBO/eJ 4hJTzag2YYcUNUc/2HkwAH49Js00nNzXnrVq8HMQ1nmo4VbPhGrZuQvdOLvgVUjPpASp 9wTrugWD6BXlo8e4hAqhNfXLbn4eOO1Ctc40hmEaGT3M9QQcZazBhVl24hF/EB9+2Ot1 R2sC4SWVdGPt2KxNoiEdqGoOVOYQVzImi8tZltKWrOUmZljU3Q3bnGq4JJ2+7gVyWvDj cbyg== X-Gm-Message-State: AOAM531oV9Ot8/51lQDFbBDJgIbjbOhprNfFLc1UyNBx+1HF2BJAHmbu HO9jI7M8FgIG9dnAQOdQjhvWEFA0WmtwyA== X-Google-Smtp-Source: ABdhPJwsNDZ8ULjzLUFcmGeN736n4I8m/pTnn8/iMtrIrCuZGn5J5w5P5lERa2WtIWEC6voAaVrfWw== X-Received: by 2002:a63:b4a:: with SMTP id a10mr6117095pgl.112.1610097929020; Fri, 08 Jan 2021 01:25:29 -0800 (PST) Received: from localhost.localdomain ([2409:4050:e06:7e2e:2d21:e266:30b:8fc]) by smtp.googlemail.com with ESMTPSA id 6sm8384234pfj.216.2021.01.08.01.25.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Jan 2021 01:25:28 -0800 (PST) From: Charvi Mendiratta To: git@vger.kernel.org Cc: christian.couder@gmail.com, phillip.wood@dunelm.org.uk, Johannes.Schindelin@gmx.de, Charvi Mendiratta Subject: [RFC PATCH 1/9] rebase -i: only write fixup-message when it's needed Date: Fri, 8 Jan 2021 14:53:39 +0530 Message-Id: <20210108092345.2178-2-charvi077@gmail.com> X-Mailer: git-send-email 2.29.0.rc1 In-Reply-To: <20210108092345.2178-1-charvi077@gmail.com> References: <20210108092345.2178-1-charvi077@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Phillip Wood The file "$GIT_DIR/rebase-merge/fixup-message" is only used for fixup commands, there's no point in writing it for squash commands as it is immediately deleted. Signed-off-by: Phillip Wood Signed-off-by: Charvi Mendiratta --- sequencer.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/sequencer.c b/sequencer.c index 8909a46770..f888a7ed3b 100644 --- a/sequencer.c +++ b/sequencer.c @@ -1757,11 +1757,13 @@ static int update_squash_messages(struct repository *r, return error(_("could not read HEAD's commit message")); find_commit_subject(head_message, &body); - if (write_message(body, strlen(body), - rebase_path_fixup_msg(), 0)) { - unuse_commit_buffer(head_commit, head_message); - return error(_("cannot write '%s'"), - rebase_path_fixup_msg()); + if (command == TODO_FIXUP) { + if (write_message(body, strlen(body), + rebase_path_fixup_msg(), 0)) { + unuse_commit_buffer(head_commit, head_message); + return error(_("cannot write '%s'"), + rebase_path_fixup_msg()); + } } strbuf_addf(&buf, "%c ", comment_line_char); From patchwork Fri Jan 8 09:23:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Charvi Mendiratta X-Patchwork-Id: 12006125 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E8401C433E0 for ; Fri, 8 Jan 2021 09:26:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B868B235FC for ; Fri, 8 Jan 2021 09:26:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728023AbhAHJ0X (ORCPT ); Fri, 8 Jan 2021 04:26:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35980 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727639AbhAHJ0W (ORCPT ); Fri, 8 Jan 2021 04:26:22 -0500 Received: from mail-pf1-x42d.google.com (mail-pf1-x42d.google.com [IPv6:2607:f8b0:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 21667C0612F4 for ; Fri, 8 Jan 2021 01:25:42 -0800 (PST) Received: by mail-pf1-x42d.google.com with SMTP id c13so3179675pfi.12 for ; Fri, 08 Jan 2021 01:25:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=+iuw58bpRNV/4LmdjqxdI+1xwKuxJqIpLxTjv0CSVa0=; b=VxwsW35LCKGFYC6C2aVR9Pa3mwgJ5FydZAloIOyWCtHeIWH25yKnU8HTSi3BY8iNqp 8Y6RVLeoN2gGoOCtnInA6FeDq3aWFV5IvXhVIsG/R9plHqpThciiC2Nqt2tgNeZKpoWe 8ss9GiTypWw11QnRuDai9VLDSUQSuk+GbwWEvqgoUKxMICMj/vmPXMApVPAhf78RVLmz LWEyrG5LxKCR/WQP3+3UtOOUGb0lWCqwvuwcsyChfj99rqEvPc/BO6X0RecwUyC8cu4d Y6+FQpj0BrRgwnzbiFivU5KkOsCcCOX/R8EKG4RDb7kU+75DrcioEY1J9Cb4V04Je0w5 SKPA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=+iuw58bpRNV/4LmdjqxdI+1xwKuxJqIpLxTjv0CSVa0=; b=XA5BgU74Qkg02qomqsFQSjuDg0GusxjQys24gZ+B7k8GCAcEROjCWOI+8nHQ9QiYlv xBZIrqPnZY/Qe5apOsHwzP5K+Aas6y6mR9SEzuswPQnTds1dvAxSQTo0YPjjNCHbZRZE iC7EotDpWhXfOD3yu/hr/agbI7TkNr+Cwyo+ygQt3YDSqtaTVZ6+luXtPuOoiMjSKp6z pGy2yLlwgxZ6wRGaGaLhJ1a5u1r2qwUc/wChW2mCfT3Lfo6bbQLj+to6zL5gpWM+BgjW dH0JgeLBPzNxbgBfcA6CDavt1peKEFVHOVa9rmoi4/sxrD7IOInZahk1XEXwJftcB77v aUyw== X-Gm-Message-State: AOAM531AoNNIIpRT7IvxyqxOtcp8P4dkLHLopOOOH851eLVDTXGvzKyD jLX5PpPHp3w2Yzewvlr0BT6CSVAl7BAhQw== X-Google-Smtp-Source: ABdhPJyZIM1ozs7uEeVYYRkoR9kq7UgryWLoAwijAjBvhqkfwSvuIvTQ+/iJQNAM+wWZILgBvQJO/Q== X-Received: by 2002:a63:f44f:: with SMTP id p15mr6250997pgk.141.1610097941583; Fri, 08 Jan 2021 01:25:41 -0800 (PST) Received: from localhost.localdomain ([2409:4050:e06:7e2e:2d21:e266:30b:8fc]) by smtp.googlemail.com with ESMTPSA id 6sm8384234pfj.216.2021.01.08.01.25.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Jan 2021 01:25:41 -0800 (PST) From: Charvi Mendiratta To: git@vger.kernel.org Cc: christian.couder@gmail.com, phillip.wood@dunelm.org.uk, Johannes.Schindelin@gmx.de, Charvi Mendiratta Subject: [RFC PATCH 2/9] sequencer: factor out code to append squash message Date: Fri, 8 Jan 2021 14:53:40 +0530 Message-Id: <20210108092345.2178-3-charvi077@gmail.com> X-Mailer: git-send-email 2.29.0.rc1 In-Reply-To: <20210108092345.2178-1-charvi077@gmail.com> References: <20210108092345.2178-1-charvi077@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Phillip Wood This code is going to grow over the next two commits so move it to its own function. Signed-off-by: Phillip Wood Signed-off-by: Charvi Mendiratta --- sequencer.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/sequencer.c b/sequencer.c index f888a7ed3b..5062976d10 100644 --- a/sequencer.c +++ b/sequencer.c @@ -1718,6 +1718,17 @@ static int is_pick_or_similar(enum todo_command command) } } +static void append_squash_message(struct strbuf *buf, const char *body, + struct replay_opts *opts) +{ + unlink(rebase_path_fixup_msg()); + strbuf_addf(buf, "\n%c ", comment_line_char); + strbuf_addf(buf, _("This is the commit message #%d:"), + ++opts->current_fixup_count + 1); + strbuf_addstr(buf, "\n\n"); + strbuf_addstr(buf, body); +} + static int update_squash_messages(struct repository *r, enum todo_command command, struct commit *commit, @@ -1782,12 +1793,7 @@ static int update_squash_messages(struct repository *r, find_commit_subject(message, &body); if (command == TODO_SQUASH) { - unlink(rebase_path_fixup_msg()); - strbuf_addf(&buf, "\n%c ", comment_line_char); - strbuf_addf(&buf, _("This is the commit message #%d:"), - ++opts->current_fixup_count + 1); - strbuf_addstr(&buf, "\n\n"); - strbuf_addstr(&buf, body); + append_squash_message(&buf, body, opts); } else if (command == TODO_FIXUP) { strbuf_addf(&buf, "\n%c ", comment_line_char); strbuf_addf(&buf, _("The commit message #%d will be skipped:"), From patchwork Fri Jan 8 09:23:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Charvi Mendiratta X-Patchwork-Id: 12006127 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C4B07C433DB for ; Fri, 8 Jan 2021 09:26:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7C6B8233EA for ; Fri, 8 Jan 2021 09:26:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727001AbhAHJ0b (ORCPT ); Fri, 8 Jan 2021 04:26:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36004 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728177AbhAHJ0a (ORCPT ); Fri, 8 Jan 2021 04:26:30 -0500 Received: from mail-pg1-x530.google.com (mail-pg1-x530.google.com [IPv6:2607:f8b0:4864:20::530]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 327D9C0612F6 for ; Fri, 8 Jan 2021 01:25:50 -0800 (PST) Received: by mail-pg1-x530.google.com with SMTP id q7so5395326pgm.5 for ; Fri, 08 Jan 2021 01:25:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=XVazqsLii5/Yx5E37iI8kmGavf3SZpF0w4rTci7EMX4=; b=YaUWKGVkUPmBGSSMLulKoAEo2+cYnVDRE35WJpQsWcBBaEZy4XnK9xbA0uhnukSEXa yBHYBwNcRBUerzBDbbVUaZ8d1KE1OhGelahMprR+bObH2iN53pRDSil1LMy4bCYlsSVm DYSHV62UP452nZtVLg0V5MG/OnUcWiTplb6pIx2LC70qGjUsHXr12KN3Iz3GJaniAKIq NwmzvIZlKVCUS3Tfs0ALqgklZ7e6lJho9UjSMgzs+ATukuY0xGZLnyOtWe8qqpp0abkE uFCc7TjXJjIMYEdQXtIy6ExN/EzKvc/mT2vWpneZdUbesfGIxxxkF/8lGHoLkq3v+hb5 YPig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=XVazqsLii5/Yx5E37iI8kmGavf3SZpF0w4rTci7EMX4=; b=TkwetO3WwEHGYXYGDrlBOLBnMXrUifwYOgPfwkTRX9nQzGJ9gTHccvU27n8khzpoC/ Aj14p1LEZ4GHehw92i6PbTMaTCa8waCpJhOdt+8wxViOT1WeSBwOCqLoxnuwrcoWT+08 Exn5OnGfxHnV/xTNv4EzR10wB2leVDtShPoxeOnQKGKLTTW+0YVvFHfGM4sbn4GBXsXN Q1lS3WyZG2xRr3Z754Nr8YgOce5ICkulNy6WQE/0rn2BQwa4zNDm+RD6iJ4oNaEi8mx/ kdi7tu/haxO98lfWjn7OfxyJGzOKsxp1NtYwL0lyg1XoYlSOnCXfYdHV/ol6zlJPEgS+ B8ow== X-Gm-Message-State: AOAM532A5yWqYb9Sl/jtXWlnQwj2Q1a+sWCRDZbIRs7axaStFe9pHIqG gMgNWTZs9GNkhz6AbizOI0lvfr3PIymfNw== X-Google-Smtp-Source: ABdhPJx8EZZVdQFgoOP7hk4phJNMZ5tEnF4lKJgAXzxHger4LeZDMoi6Tsszz3c+Jtj9xMTrBxG5hQ== X-Received: by 2002:aa7:93cf:0:b029:19d:e287:b02b with SMTP id y15-20020aa793cf0000b029019de287b02bmr2920217pff.66.1610097949493; Fri, 08 Jan 2021 01:25:49 -0800 (PST) Received: from localhost.localdomain ([2409:4050:e06:7e2e:2d21:e266:30b:8fc]) by smtp.googlemail.com with ESMTPSA id 6sm8384234pfj.216.2021.01.08.01.25.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Jan 2021 01:25:49 -0800 (PST) From: Charvi Mendiratta To: git@vger.kernel.org Cc: christian.couder@gmail.com, phillip.wood@dunelm.org.uk, Johannes.Schindelin@gmx.de, Charvi Mendiratta Subject: [RFC PATCH 3/9] rebase -i: comment out squash!/fixup! subjects from squash message Date: Fri, 8 Jan 2021 14:53:41 +0530 Message-Id: <20210108092345.2178-4-charvi077@gmail.com> X-Mailer: git-send-email 2.29.0.rc1 In-Reply-To: <20210108092345.2178-1-charvi077@gmail.com> References: <20210108092345.2178-1-charvi077@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Phillip Wood When squashing commit messages the squash!/fixup! subjects are not of interest so comment them out to stop them becoming part of the final message. This change breaks a bunch of --autosquash tests which rely on the "squash! " line appearing in the final commit message. This is addressed by adding a second line to the commit message of the "squash! ..." commits and testing for that. Signed-off-by: Phillip Wood Signed-off-by: Charvi Mendiratta --- sequencer.c | 25 ++++++++++++++++++++++++- t/t3415-rebase-autosquash.sh | 27 +++++++++++++-------------- t/t3900-i18n-commit.sh | 4 ---- 3 files changed, 37 insertions(+), 19 deletions(-) diff --git a/sequencer.c b/sequencer.c index 5062976d10..b050a9a212 100644 --- a/sequencer.c +++ b/sequencer.c @@ -1718,15 +1718,38 @@ static int is_pick_or_similar(enum todo_command command) } } +static size_t subject_length(const char *body) +{ + size_t i, len = 0; + char c; + int blank_line = 1; + for (i = 0, c = body[i]; c; c = body[++i]) { + if (c == '\n') { + if (blank_line) + return len; + len = i + 1; + blank_line = 1; + } else if (!isspace(c)) { + blank_line = 0; + } + } + return blank_line ? len : i; +} + static void append_squash_message(struct strbuf *buf, const char *body, struct replay_opts *opts) { + size_t commented_len = 0; + unlink(rebase_path_fixup_msg()); + if (starts_with(body, "squash!") || starts_with(body, "fixup!")) + commented_len = subject_length(body); strbuf_addf(buf, "\n%c ", comment_line_char); strbuf_addf(buf, _("This is the commit message #%d:"), ++opts->current_fixup_count + 1); strbuf_addstr(buf, "\n\n"); - strbuf_addstr(buf, body); + strbuf_add_commented_lines(buf, body, commented_len); + strbuf_addstr(buf, body + commented_len); } static int update_squash_messages(struct repository *r, diff --git a/t/t3415-rebase-autosquash.sh b/t/t3415-rebase-autosquash.sh index 7bab6000dc..45fe6a227e 100755 --- a/t/t3415-rebase-autosquash.sh +++ b/t/t3415-rebase-autosquash.sh @@ -81,8 +81,7 @@ test_auto_squash () { echo 1 >file1 && git add -u && test_tick && - git commit -m "squash! first" && - + git commit -m "squash! first" -m "extra para for first" && git tag $1 && test_tick && git rebase $2 -i HEAD^^^ && @@ -139,7 +138,7 @@ test_expect_success 'auto squash that matches 2 commits' ' echo 1 >file1 && git add -u && test_tick && - git commit -m "squash! first" && + git commit -m "squash! first" -m "extra para for first" && git tag final-multisquash && test_tick && git rebase --autosquash -i HEAD~4 && @@ -192,7 +191,7 @@ test_expect_success 'auto squash that matches a sha1' ' git add -u && test_tick && oid=$(git rev-parse --short HEAD^) && - git commit -m "squash! $oid" && + git commit -m "squash! $oid" -m "extra para" && git tag final-shasquash && test_tick && git rebase --autosquash -i HEAD^^^ && @@ -203,7 +202,7 @@ test_expect_success 'auto squash that matches a sha1' ' git cat-file blob HEAD^:file1 >actual && test_cmp expect actual && git cat-file commit HEAD^ >commit && - grep squash commit >actual && + grep "extra para" commit >actual && test_line_count = 1 actual ' @@ -213,7 +212,7 @@ test_expect_success 'auto squash that matches longer sha1' ' git add -u && test_tick && oid=$(git rev-parse --short=11 HEAD^) && - git commit -m "squash! $oid" && + git commit -m "squash! $oid" -m "extra para" && git tag final-longshasquash && test_tick && git rebase --autosquash -i HEAD^^^ && @@ -224,7 +223,7 @@ test_expect_success 'auto squash that matches longer sha1' ' git cat-file blob HEAD^:file1 >actual && test_cmp expect actual && git cat-file commit HEAD^ >commit && - grep squash commit >actual && + grep "extra para" commit >actual && test_line_count = 1 actual ' @@ -233,7 +232,7 @@ test_auto_commit_flags () { echo 1 >file1 && git add -u && test_tick && - git commit --$1 first-commit && + git commit --$1 first-commit -m "extra para for first" && git tag final-commit-$1 && test_tick && git rebase --autosquash -i HEAD^^^ && @@ -261,11 +260,11 @@ test_auto_fixup_fixup () { echo 1 >file1 && git add -u && test_tick && - git commit -m "$1! first" && + git commit -m "$1! first" -m "extra para for first" && echo 2 >file1 && git add -u && test_tick && - git commit -m "$1! $2! first" && + git commit -m "$1! $2! first" -m "second extra para for first" && git tag "final-$1-$2" && test_tick && ( @@ -326,12 +325,12 @@ test_expect_success C_LOCALE_OUTPUT 'autosquash with custom inst format' ' git add -u && test_tick && oid=$(git rev-parse --short HEAD^) && - git commit -m "squash! $oid" && + git commit -m "squash! $oid" -m "extra para for first" && echo 1 >file1 && git add -u && test_tick && subject=$(git log -n 1 --format=%s HEAD~2) && - git commit -m "squash! $subject" && + git commit -m "squash! $subject" -m "second extra para for first" && git tag final-squash-instFmt && test_tick && git rebase --autosquash -i HEAD~4 && @@ -342,8 +341,8 @@ test_expect_success C_LOCALE_OUTPUT 'autosquash with custom inst format' ' git cat-file blob HEAD^:file1 >actual && test_cmp expect actual && git cat-file commit HEAD^ >commit && - grep squash commit >actual && - test_line_count = 2 actual + grep first commit >actual && + test_line_count = 3 actual ' test_expect_success 'autosquash with empty custom instructionFormat' ' diff --git a/t/t3900-i18n-commit.sh b/t/t3900-i18n-commit.sh index d277a9f4b7..bfab245eb3 100755 --- a/t/t3900-i18n-commit.sh +++ b/t/t3900-i18n-commit.sh @@ -226,10 +226,6 @@ test_commit_autosquash_multi_encoding () { git rev-list HEAD >actual && test_line_count = 3 actual && iconv -f $old -t UTF-8 "$TEST_DIRECTORY"/t3900/$msg >expect && - if test $flag = squash; then - subject="$(head -1 expect)" && - printf "\nsquash! %s\n" "$subject" >>expect - fi && git cat-file commit HEAD^ >raw && (sed "1,/^$/d" raw | iconv -f $new -t utf-8) >actual && test_cmp expect actual From patchwork Fri Jan 8 09:23:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Charvi Mendiratta X-Patchwork-Id: 12006129 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A745DC433E6 for ; Fri, 8 Jan 2021 09:26:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5DE3123383 for ; Fri, 8 Jan 2021 09:26:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728107AbhAHJ0i (ORCPT ); Fri, 8 Jan 2021 04:26:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36024 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727525AbhAHJ0h (ORCPT ); Fri, 8 Jan 2021 04:26:37 -0500 Received: from mail-pj1-x1030.google.com (mail-pj1-x1030.google.com [IPv6:2607:f8b0:4864:20::1030]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2E7FAC0612F9 for ; Fri, 8 Jan 2021 01:25:57 -0800 (PST) Received: by mail-pj1-x1030.google.com with SMTP id iq13so3330082pjb.3 for ; Fri, 08 Jan 2021 01:25:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=beWNG+690OTiaPIvDDb4xzSXF3VhJt/XqaUnPr4PUMk=; b=BsZvG4Qbb4Y4DdKal2dvlSoeiE9EImLdsbHD9/5hgsynjUUXPsN6onOYOVDsog1CtB 64zzKuE0tbacgjPtmpngmkeow18gaJoKHOM1FuHkRXnvZniAgLMNXgKs8y8V6R4Y5N+R NU32Cp+wXJjU+a0vnFId1ShZCEfR8DI1iZpMhA2ldbr/fwXg3IIhg/f9PkHu6vjTTSs8 z22Cdj+QOH8PhnoGItld3ZmS5Di6/5WlVPR68ZBsX3rHAOFuP8QUPXPMaoq+/lPFAoz9 VStvIIyVNn1rpSclFHqKWM6moxEJodonngAGHtIj+b2ewBM81GDplVXipOBH2tKZKGeb HuUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=beWNG+690OTiaPIvDDb4xzSXF3VhJt/XqaUnPr4PUMk=; b=J8LZyR2hM04KMUtJKAlOYwqqFdGMc34Y8nSvuwxrbDtbDyJSgu4m0nZAhKKyFQ8MIX BA5dR3dYqSR+kcWwe4uEQ0vK2/snRYylzeXky1F/Xgux2YGfhswwNjI7O0az7kY85Zp2 t7I4ZO0ymjYro8vd4ENCOhPCjOzMCkDQEK79KFu+QlntZ4TQw/+iY1GOtNJ2T94ApEhh ozO07jZ8a4pqlcz+zvPMi7gwT+cZoqWx0ml81twT976lgpCwA8abwhhps1RLjhsFcnJ8 WVk0dzxqkCSEo2qRCp3RqQrVw7lNQfs4nVoMIMJEE1ow5OpQAPfyCfgvF8LFQ8XrAzMc LpxQ== X-Gm-Message-State: AOAM530vDfBi/f1zGDtOcXMSmvGdosMNBmG0vVsK0NSIHClaj2Mf0zQs z+2ZgWb8PSivCT2D8HZ0XiHuFpS1kJZOuA== X-Google-Smtp-Source: ABdhPJyc9yQj5SJhErzHBrUCkj6I12glssNXIGfAM464EC950veM0a+BWlbOylYsXVtlMuQd25To5w== X-Received: by 2002:a17:90a:e64e:: with SMTP id ep14mr2723993pjb.5.1610097956525; Fri, 08 Jan 2021 01:25:56 -0800 (PST) Received: from localhost.localdomain ([2409:4050:e06:7e2e:2d21:e266:30b:8fc]) by smtp.googlemail.com with ESMTPSA id 6sm8384234pfj.216.2021.01.08.01.25.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Jan 2021 01:25:56 -0800 (PST) From: Charvi Mendiratta To: git@vger.kernel.org Cc: christian.couder@gmail.com, phillip.wood@dunelm.org.uk, Johannes.Schindelin@gmx.de, Charvi Mendiratta , Christian Couder Subject: [RFC PATCH 4/9] sequencer: pass todo_item to do_pick_commit() Date: Fri, 8 Jan 2021 14:53:42 +0530 Message-Id: <20210108092345.2178-5-charvi077@gmail.com> X-Mailer: git-send-email 2.29.0.rc1 In-Reply-To: <20210108092345.2178-1-charvi077@gmail.com> References: <20210108092345.2178-1-charvi077@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org As an additional member of the structure todo_item will be required in future commits pass the complete structure. Mentored-by: Christian Couder Mentored-by: Phillip Wood Signed-off-by: Charvi Mendiratta --- sequencer.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/sequencer.c b/sequencer.c index b050a9a212..cdafc2e0e8 100644 --- a/sequencer.c +++ b/sequencer.c @@ -1884,8 +1884,7 @@ static void record_in_rewritten(struct object_id *oid, } static int do_pick_commit(struct repository *r, - enum todo_command command, - struct commit *commit, + struct todo_item *item, struct replay_opts *opts, int final_fixup, int *check_todo) { @@ -1898,6 +1897,8 @@ static int do_pick_commit(struct repository *r, struct commit_message msg = { NULL, NULL, NULL, NULL }; struct strbuf msgbuf = STRBUF_INIT; int res, unborn = 0, reword = 0, allow, drop_commit; + enum todo_command command = item->command; + struct commit *commit = item->commit; if (opts->no_commit) { /* @@ -4147,8 +4148,8 @@ static int pick_commits(struct repository *r, setenv(GIT_REFLOG_ACTION, reflog_message(opts, command_to_string(item->command), NULL), 1); - res = do_pick_commit(r, item->command, item->commit, - opts, is_final_fixup(todo_list), + res = do_pick_commit(r, item, opts, + is_final_fixup(todo_list), &check_todo); if (is_rebase_i(opts)) setenv(GIT_REFLOG_ACTION, prev_reflog_action, 1); @@ -4610,11 +4611,14 @@ static int single_pick(struct repository *r, struct replay_opts *opts) { int check_todo; + struct todo_item item; + + item.command = opts->action == REPLAY_PICK ? + TODO_PICK : TODO_REVERT; + item.commit = cmit; setenv(GIT_REFLOG_ACTION, action_name(opts), 0); - return do_pick_commit(r, opts->action == REPLAY_PICK ? - TODO_PICK : TODO_REVERT, cmit, opts, 0, - &check_todo); + return do_pick_commit(r, &item, opts, 0, &check_todo); } int sequencer_pick_revisions(struct repository *r, From patchwork Fri Jan 8 09:23:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Charvi Mendiratta X-Patchwork-Id: 12006131 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 546C4C433DB for ; Fri, 8 Jan 2021 09:27:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EF6FE233EA for ; Fri, 8 Jan 2021 09:27:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728152AbhAHJ0p (ORCPT ); Fri, 8 Jan 2021 04:26:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36046 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727525AbhAHJ0o (ORCPT ); Fri, 8 Jan 2021 04:26:44 -0500 Received: from mail-pj1-x102b.google.com (mail-pj1-x102b.google.com [IPv6:2607:f8b0:4864:20::102b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 192E1C0612FA for ; Fri, 8 Jan 2021 01:26:04 -0800 (PST) Received: by mail-pj1-x102b.google.com with SMTP id lj6so3340763pjb.0 for ; Fri, 08 Jan 2021 01:26:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=RVX6eJ3wxIokxH7wit+ZYj6rChgUicxUxJe7J+MG3Ag=; b=CfaUFUg10BQ2aeub8dYQ355hfpOT2vu/XXIsH4vj3483qeZNiMIdcHV09cP8e4Vjx/ vPrKDICwsfAsHHA0paYGnShRKW+3xq8iOGrJMzU8v5MaqQga79wwB83NX0I6HRuy+PQz SR6M4pugRmZy6+arHOdCTx1gCe7uTqYJHcIdMQa/z76/lq+Q4EXcSxULFJ3o1G6GLm68 i6T+AC+DQCS/Q5FFCMXCUAa35hF39LNmXOEE+T/MGGCvDHl+GztT4D6TzHX4ilcV6Ped Q/DglwMEQYri+nd6Y9K9iLzC+iKcuRl/bsCZ7tj6YNIWNENbXvXtssIlU4p4Knm067tH 6qkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=RVX6eJ3wxIokxH7wit+ZYj6rChgUicxUxJe7J+MG3Ag=; b=tMjK7N6UFJbElZPSJh8kTMXRY28wEQWeQVNVFHHeixG8hy9wz4osVvwQYzX/07xVwh gi034HVSQb5b9jImcjDoxHkLy+hoXdviJg8NjxlmPkGpAwueV0OFVVJkajrqSou5ykqr vMk5U+IEbkoOnYRSuGcg4Nby1DIW2KgbCMP5KhNra1A9RUKeSSOhetQl5zpX8JkTu1HG TIv/8DtI4AQLJ/U+RFTQ3QTWNTpUDLnthTfJM5pncL6o3ilBNZIySw7cUIdLLF6SSXCX T+zY6tSvR0QAjEWRn/Ao6G2q9a8hD9OLbQA6CQliEZnfc/h7ggr1/mzhgetD7YSnZGv2 DF3g== X-Gm-Message-State: AOAM5310AIz5qBp1VwEmbEo/ihW1DMRNQ1q8PT3VKqe7w2l8jnN12pS/ iBGfbQ3WNJzTAjmOOIR3bAIWMl648GT6ew== X-Google-Smtp-Source: ABdhPJwmb0Yd12KhPwlkz3i8gjvbeFkrtThqm/anYto0CFvq5DL36kM/kycT/fsQoaB6B1SxFpi+6A== X-Received: by 2002:a17:90b:228e:: with SMTP id kx14mr2939620pjb.210.1610097963427; Fri, 08 Jan 2021 01:26:03 -0800 (PST) Received: from localhost.localdomain ([2409:4050:e06:7e2e:2d21:e266:30b:8fc]) by smtp.googlemail.com with ESMTPSA id 6sm8384234pfj.216.2021.01.08.01.25.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Jan 2021 01:26:02 -0800 (PST) From: Charvi Mendiratta To: git@vger.kernel.org Cc: christian.couder@gmail.com, phillip.wood@dunelm.org.uk, Johannes.Schindelin@gmx.de, Charvi Mendiratta , Christian Couder Subject: [RFC PATCH 5/9] sequencer: use const variable for commit message comments Date: Fri, 8 Jan 2021 14:53:43 +0530 Message-Id: <20210108092345.2178-6-charvi077@gmail.com> X-Mailer: git-send-email 2.29.0.rc1 In-Reply-To: <20210108092345.2178-1-charvi077@gmail.com> References: <20210108092345.2178-1-charvi077@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org This makes it easier to use and reuse the comments. Mentored-by: Christian Couder Mentored-by: Phillip Wood Signed-off-by: Charvi Mendiratta --- sequencer.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/sequencer.c b/sequencer.c index cdafc2e0e8..b9295b5a02 100644 --- a/sequencer.c +++ b/sequencer.c @@ -1736,6 +1736,15 @@ static size_t subject_length(const char *body) return blank_line ? len : i; } +static const char first_commit_msg_str[] = +N_("This is the 1st commit message:"); +static const char nth_commit_msg_fmt[] = +N_("This is the commit message #%d:"); +static const char skip_nth_commit_msg_fmt[] = +N_("The commit message #%d will be skipped:"); +static const char combined_commit_msg_str[] = +N_("This is a combination of %d commits."); + static void append_squash_message(struct strbuf *buf, const char *body, struct replay_opts *opts) { @@ -1745,7 +1754,7 @@ static void append_squash_message(struct strbuf *buf, const char *body, if (starts_with(body, "squash!") || starts_with(body, "fixup!")) commented_len = subject_length(body); strbuf_addf(buf, "\n%c ", comment_line_char); - strbuf_addf(buf, _("This is the commit message #%d:"), + strbuf_addf(buf, _(nth_commit_msg_fmt), ++opts->current_fixup_count + 1); strbuf_addstr(buf, "\n\n"); strbuf_add_commented_lines(buf, body, commented_len); @@ -1774,7 +1783,7 @@ static int update_squash_messages(struct repository *r, buf.buf : strchrnul(buf.buf, '\n'); strbuf_addf(&header, "%c ", comment_line_char); - strbuf_addf(&header, _("This is a combination of %d commits."), + strbuf_addf(&header, _(combined_commit_msg_str), opts->current_fixup_count + 2); strbuf_splice(&buf, 0, eol - buf.buf, header.buf, header.len); strbuf_release(&header); @@ -1801,9 +1810,9 @@ static int update_squash_messages(struct repository *r, } strbuf_addf(&buf, "%c ", comment_line_char); - strbuf_addf(&buf, _("This is a combination of %d commits."), 2); + strbuf_addf(&buf, _(combined_commit_msg_str), 2); strbuf_addf(&buf, "\n%c ", comment_line_char); - strbuf_addstr(&buf, _("This is the 1st commit message:")); + strbuf_addstr(&buf, _(first_commit_msg_str)); strbuf_addstr(&buf, "\n\n"); strbuf_addstr(&buf, body); @@ -1819,7 +1828,7 @@ static int update_squash_messages(struct repository *r, append_squash_message(&buf, body, opts); } else if (command == TODO_FIXUP) { strbuf_addf(&buf, "\n%c ", comment_line_char); - strbuf_addf(&buf, _("The commit message #%d will be skipped:"), + strbuf_addf(&buf, _(skip_nth_commit_msg_fmt), ++opts->current_fixup_count + 1); strbuf_addstr(&buf, "\n\n"); strbuf_add_commented_lines(&buf, body, strlen(body)); From patchwork Fri Jan 8 09:23:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Charvi Mendiratta X-Patchwork-Id: 12006133 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 85CC7C433E0 for ; Fri, 8 Jan 2021 09:27:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2821B23435 for ; Fri, 8 Jan 2021 09:27:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728168AbhAHJ0v (ORCPT ); Fri, 8 Jan 2021 04:26:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36062 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727416AbhAHJ0u (ORCPT ); Fri, 8 Jan 2021 04:26:50 -0500 Received: from mail-pj1-x1036.google.com (mail-pj1-x1036.google.com [IPv6:2607:f8b0:4864:20::1036]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DA73EC0612FB for ; Fri, 8 Jan 2021 01:26:09 -0800 (PST) Received: by mail-pj1-x1036.google.com with SMTP id j13so5827808pjz.3 for ; Fri, 08 Jan 2021 01:26:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=HkmQk7fTvhK5foBZhhvKRI9VhQrnviDaiTBUvFmUoHE=; b=OmUt/9HpyENhKfId5NLC/Uf9NRY0tI0OZVUg2Bc5/IMAEfECE/u3K8QDxlSsfYo7W3 Lq7eMLCjKZ/C7Ip2UdRxbL+jk2F5MWUcp6/D6dQy+XHWNV6AAUWJXNYmKtLo7IJv2fKE E96nZt9/60QCDZXeONHnWvBCijFljsnYQjPuRHlY+T7a9YB7MMsMhS3madVUNIEkKuL7 NYBKR18dyQXBWNJu/7Z8x//SiAdlXueFq1+2TP8VrMxNF+cFWpOdaTZ7nHNAMUtu6Huh EUvp19OdlHTmcrZOefLdfc1dPoKIwE6r3S6pWWtcYiWQbolzOdwgU40VaE9BH3bnopT4 gV4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=HkmQk7fTvhK5foBZhhvKRI9VhQrnviDaiTBUvFmUoHE=; b=pqweLMBMmYrNpwe9XuUG8JwcePs9uVhO3DgoHv2QzrxT2Rx5WnHGjmon371W0DlWj9 R0AB5BtBnaN8IrbFGTONfLxu0Nr36h4pbthjoiY9OS1ORNfLDqOvAY801kkhUj6ntscW esRNDYW1Pw7a8ryPcP5W42Fir9LFsn70U1OH/9gm77DvLeuVqHHrQ92QhKB6dm23F1q+ qvBw/j7EcNc7VVl2o2H/QAMBVLrMJjm6qBD68UnTNJay+LDxVrX1BFzJXEOb/tDC4Lhk BFXUoCad6pk51jTh9e1gh1vmUoklH67Jmp946vTGEm0AcBRXHhy7II0Qb5jLYzKzN+HR Lrmw== X-Gm-Message-State: AOAM533l3aV8O5WFMz4d31P0tH+CqpamLYvTJsdIt6CRjxPAwn5Qhmq7 zJva+Nh7VcE8xO3mffi+6d4Qgp+WlCVowQ== X-Google-Smtp-Source: ABdhPJyg4tWO+UQ/zg93z1MyqWWPlz5trEQmOIomEYKoVukQHUh8rOCpybLZ8cE82NZ6euDXv5V5qw== X-Received: by 2002:a17:90b:1249:: with SMTP id gx9mr2786179pjb.169.1610097969064; Fri, 08 Jan 2021 01:26:09 -0800 (PST) Received: from localhost.localdomain ([2409:4050:e06:7e2e:2d21:e266:30b:8fc]) by smtp.googlemail.com with ESMTPSA id 6sm8384234pfj.216.2021.01.08.01.26.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Jan 2021 01:26:08 -0800 (PST) From: Charvi Mendiratta To: git@vger.kernel.org Cc: christian.couder@gmail.com, phillip.wood@dunelm.org.uk, Johannes.Schindelin@gmx.de, Charvi Mendiratta , Christian Couder Subject: [RFC PATCH 6/9] rebase -i: add fixup [-C | -c] command Date: Fri, 8 Jan 2021 14:53:44 +0530 Message-Id: <20210108092345.2178-7-charvi077@gmail.com> X-Mailer: git-send-email 2.29.0.rc1 In-Reply-To: <20210108092345.2178-1-charvi077@gmail.com> References: <20210108092345.2178-1-charvi077@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Add options to `fixup` command to fixup both the commit contents and message. `fixup -C` command is used to replace the original commit message and `fixup -c`, additionally allows to edit the commit message. Original-patch-by: Phillip Wood Mentored-by: Christian Couder Mentored-by: Phillip Wood Signed-off-by: Charvi Mendiratta --- rebase-interactive.c | 4 +- sequencer.c | 212 +++++++++++++++++++++++++++++++++++++++---- 2 files changed, 196 insertions(+), 20 deletions(-) diff --git a/rebase-interactive.c b/rebase-interactive.c index 762853bc7e..c3bd02adee 100644 --- a/rebase-interactive.c +++ b/rebase-interactive.c @@ -44,7 +44,9 @@ void append_todo_help(int command_count, "r, reword = use commit, but edit the commit message\n" "e, edit = use commit, but stop for amending\n" "s, squash = use commit, but meld into previous commit\n" -"f, fixup = like \"squash\", but discard this commit's log message\n" +"f, fixup [-C | -c] = like \"squash\", but discard this\n" +" commit's log message. Use -C to replace with this\n" +" commit message or -c to edit the commit message\n" "x, exec = run command (the rest of the line) using shell\n" "b, break = stop here (continue rebase later with 'git rebase --continue')\n" "d, drop = remove commit\n" diff --git a/sequencer.c b/sequencer.c index b9295b5a02..db016717d1 100644 --- a/sequencer.c +++ b/sequencer.c @@ -1718,6 +1718,12 @@ static int is_pick_or_similar(enum todo_command command) } } +enum todo_item_flags { + TODO_EDIT_MERGE_MSG = (1 << 0), + TODO_REPLACE_FIXUP_MSG = (1 << 1), + TODO_EDIT_FIXUP_MSG = (1 << 2), +}; + static size_t subject_length(const char *body) { size_t i, len = 0; @@ -1740,34 +1746,177 @@ static const char first_commit_msg_str[] = N_("This is the 1st commit message:"); static const char nth_commit_msg_fmt[] = N_("This is the commit message #%d:"); +static const char skip_first_commit_msg_str[] = +N_("The 1st commit message will be skipped:"); static const char skip_nth_commit_msg_fmt[] = N_("The commit message #%d will be skipped:"); static const char combined_commit_msg_str[] = N_("This is a combination of %d commits."); -static void append_squash_message(struct strbuf *buf, const char *body, - struct replay_opts *opts) +static int check_fixup_flag(enum todo_command command, + enum todo_item_flags flag) +{ + return command == TODO_FIXUP && ((flag & TODO_REPLACE_FIXUP_MSG) || + (flag & TODO_EDIT_FIXUP_MSG)); +} + +/* + * Wrapper around strbuf_add_commented_lines() which avoids double + * commenting commit subjects. + */ +static void add_commented_lines(struct strbuf *buf, const void *str, size_t len) +{ + const char *s = str; + while (len > 0 && s[0] == comment_line_char) { + size_t count; + const char *n = memchr(s, '\n', len); + if (!n) + count = len; + else + count = n - s + 1; + strbuf_add(buf, s, count); + s += count; + len -= count; + } + strbuf_add_commented_lines(buf, s, len); +} + +/* Does the current fixup chain contain a squash command? */ +static int seen_squash(struct replay_opts *opts) { - size_t commented_len = 0; + return starts_with(opts->current_fixups.buf, "squash") || + strstr(opts->current_fixups.buf, "\nsquash"); +} - unlink(rebase_path_fixup_msg()); - if (starts_with(body, "squash!") || starts_with(body, "fixup!")) +static void update_comment_bufs(struct strbuf *buf1, struct strbuf *buf2, int n) +{ + strbuf_setlen(buf1, 2); + strbuf_addf(buf1, nth_commit_msg_fmt, n); + strbuf_addch(buf1, '\n'); + strbuf_setlen(buf2, 2); + strbuf_addf(buf2, skip_nth_commit_msg_fmt, n); + strbuf_addch(buf2, '\n'); +} + +/* + * Comment out any un-commented commit messages, updating the message comments + * to say they will be skipped but do not comment out the empty lines that + * surround commit messages and their comments. + */ +static void update_squash_message_for_fixup(struct strbuf *msg) +{ + void (*copy_lines)(struct strbuf *, const void *, size_t) = strbuf_add; + struct strbuf buf1 = STRBUF_INIT, buf2 = STRBUF_INIT; + const char *s, *start; + char *orig_msg; + size_t orig_msg_len; + int i = 1; + + strbuf_addf(&buf1, "# %s\n", first_commit_msg_str); + strbuf_addf(&buf2, "# %s\n", skip_first_commit_msg_str); + s = start = orig_msg = strbuf_detach(msg, &orig_msg_len); + while (s) { + const char *next; + size_t off; + if (skip_prefix(s, buf1.buf, &next)) { + /* + * Copy the last message, preserving the blank line + * preceding the current line + */ + off = (s > start + 1 && s[-2] == '\n') ? 1 : 0; + copy_lines(msg, start, s - start - off); + if (off) + strbuf_addch(msg, '\n'); + /* + * The next message needs to be commented out but the + * message header is already commented out so just copy + * it and the blank line that follows it. + */ + strbuf_addbuf(msg, &buf2); + if (*next == '\n') + strbuf_addch(msg, *next++); + start = s = next; + copy_lines = add_commented_lines; + update_comment_bufs(&buf1, &buf2, ++i); + } else if (skip_prefix(s, buf2.buf, &next)) { + off = (s > start + 1 && s[-2] == '\n') ? 1 : 0; + copy_lines(msg, start, s - start - off); + start = s - off; + s = next; + copy_lines = strbuf_add; + update_comment_bufs(&buf1, &buf2, ++i); + } else { + s = strchr(s, '\n'); + if (s) + s++; + } + } + copy_lines(msg, start, orig_msg_len - (start - orig_msg)); + free(orig_msg); + strbuf_release(&buf1); + strbuf_release(&buf2); +} + +static int append_squash_message(struct strbuf *buf, const char *body, + enum todo_command command, struct replay_opts *opts, + enum todo_item_flags flag) +{ + const char *fixup_msg; + size_t commented_len = 0, fixup_off; + /* + * amend is non-interactive and not normally used with fixup! + * or squash! commits, so only comment out those subjects when + * squashing commit messages. + */ + if (starts_with(body, "amend!") || + ((command == TODO_SQUASH || seen_squash(opts)) && + (starts_with(body, "squash!") || starts_with(body, "fixup!")))) commented_len = subject_length(body); + strbuf_addf(buf, "\n%c ", comment_line_char); strbuf_addf(buf, _(nth_commit_msg_fmt), ++opts->current_fixup_count + 1); strbuf_addstr(buf, "\n\n"); strbuf_add_commented_lines(buf, body, commented_len); + /* buf->buf may be reallocated so store an offset into the buffer */ + fixup_off = buf->len; strbuf_addstr(buf, body + commented_len); + + /* fixup -C after squash behaves like squash */ + if (check_fixup_flag(command, flag) && !seen_squash(opts)) { + /* + * We're replacing the commit message so we need to + * append the Signed-off-by: trailer if the user + * requested '--signoff'. + */ + if (opts->signoff) + append_signoff(buf, 0, 0); + + if ((command == TODO_FIXUP) && + (flag & TODO_REPLACE_FIXUP_MSG)) { + fixup_msg = skip_blank_lines(buf->buf + fixup_off); + if (write_message(fixup_msg, strlen(fixup_msg), + rebase_path_fixup_msg(), 0)) + return error(_("cannot write '%s'"), + rebase_path_fixup_msg()); + } else { + unlink(rebase_path_fixup_msg()); + } + } else { + unlink(rebase_path_fixup_msg()); + } + + return 0; } static int update_squash_messages(struct repository *r, enum todo_command command, struct commit *commit, - struct replay_opts *opts) + struct replay_opts *opts, + enum todo_item_flags flag) { struct strbuf buf = STRBUF_INIT; - int res; + int res = 0; const char *message, *body; const char *encoding = get_commit_output_encoding(); @@ -1787,6 +1936,8 @@ static int update_squash_messages(struct repository *r, opts->current_fixup_count + 2); strbuf_splice(&buf, 0, eol - buf.buf, header.buf, header.len); strbuf_release(&header); + if (check_fixup_flag(command, flag) && !seen_squash(opts)) + update_squash_message_for_fixup(&buf); } else { struct object_id head; struct commit *head_commit; @@ -1800,7 +1951,7 @@ static int update_squash_messages(struct repository *r, return error(_("could not read HEAD's commit message")); find_commit_subject(head_message, &body); - if (command == TODO_FIXUP) { + if (command == TODO_FIXUP && !flag) { if (write_message(body, strlen(body), rebase_path_fixup_msg(), 0)) { unuse_commit_buffer(head_commit, head_message); @@ -1808,13 +1959,17 @@ static int update_squash_messages(struct repository *r, rebase_path_fixup_msg()); } } - strbuf_addf(&buf, "%c ", comment_line_char); strbuf_addf(&buf, _(combined_commit_msg_str), 2); strbuf_addf(&buf, "\n%c ", comment_line_char); - strbuf_addstr(&buf, _(first_commit_msg_str)); + strbuf_addstr(&buf, check_fixup_flag(command, flag) ? + _(skip_first_commit_msg_str) : + _(first_commit_msg_str)); strbuf_addstr(&buf, "\n\n"); - strbuf_addstr(&buf, body); + if (check_fixup_flag(command, flag)) + strbuf_add_commented_lines(&buf, body, strlen(body)); + else + strbuf_addstr(&buf, body); unuse_commit_buffer(head_commit, head_message); } @@ -1824,8 +1979,8 @@ static int update_squash_messages(struct repository *r, oid_to_hex(&commit->object.oid)); find_commit_subject(message, &body); - if (command == TODO_SQUASH) { - append_squash_message(&buf, body, opts); + if (command == TODO_SQUASH || check_fixup_flag(command, flag)) { + res = append_squash_message(&buf, body, command, opts, flag); } else if (command == TODO_FIXUP) { strbuf_addf(&buf, "\n%c ", comment_line_char); strbuf_addf(&buf, _(skip_nth_commit_msg_fmt), @@ -1836,7 +1991,9 @@ static int update_squash_messages(struct repository *r, return error(_("unknown command: %d"), command); unuse_commit_buffer(commit, message); - res = write_message(buf.buf, buf.len, rebase_path_squash_msg(), 0); + if (!res) + res = write_message(buf.buf, buf.len, rebase_path_squash_msg(), + 0); strbuf_release(&buf); if (!res) { @@ -2037,7 +2194,8 @@ static int do_pick_commit(struct repository *r, if (command == TODO_REWORD) reword = 1; else if (is_fixup(command)) { - if (update_squash_messages(r, command, commit, opts)) + if (update_squash_messages(r, command, commit, + opts, item->flags)) return -1; flags |= AMEND_MSG; if (!final_fixup) @@ -2202,10 +2360,6 @@ static int read_and_refresh_cache(struct repository *r, return 0; } -enum todo_item_flags { - TODO_EDIT_MERGE_MSG = 1 -}; - void todo_list_release(struct todo_list *todo_list) { strbuf_release(&todo_list->buf); @@ -2292,6 +2446,18 @@ static int parse_insn_line(struct repository *r, struct todo_item *item, return 0; } + if (item->command == TODO_FIXUP) { + if (skip_prefix(bol, "-C", &bol) && + (*bol == ' ' || *bol == '\t')) { + bol += strspn(bol, " \t"); + item->flags |= TODO_REPLACE_FIXUP_MSG; + } else if (skip_prefix(bol, "-c", &bol) && + (*bol == ' ' || *bol == '\t')) { + bol += strspn(bol, " \t"); + item->flags |= TODO_EDIT_FIXUP_MSG; + } + } + if (item->command == TODO_MERGE) { if (skip_prefix(bol, "-C", &bol)) bol += strspn(bol, " \t"); @@ -5298,6 +5464,14 @@ static void todo_list_to_strbuf(struct repository *r, struct todo_list *todo_lis short_commit_name(item->commit) : oid_to_hex(&item->commit->object.oid); + if (item->command == TODO_FIXUP) { + if (item->flags & TODO_EDIT_FIXUP_MSG) + strbuf_addstr(buf, " -c"); + else if (item->flags & TODO_REPLACE_FIXUP_MSG) { + strbuf_addstr(buf, " -C"); + } + } + if (item->command == TODO_MERGE) { if (item->flags & TODO_EDIT_MERGE_MSG) strbuf_addstr(buf, " -c"); From patchwork Fri Jan 8 09:23:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Charvi Mendiratta X-Patchwork-Id: 12006139 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B0768C433E6 for ; Fri, 8 Jan 2021 09:27:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 57BAF235FA for ; Fri, 8 Jan 2021 09:27:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728189AbhAHJ05 (ORCPT ); Fri, 8 Jan 2021 04:26:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36076 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728176AbhAHJ04 (ORCPT ); Fri, 8 Jan 2021 04:26:56 -0500 Received: from mail-pj1-x1029.google.com (mail-pj1-x1029.google.com [IPv6:2607:f8b0:4864:20::1029]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E91ADC0612F5 for ; Fri, 8 Jan 2021 01:26:15 -0800 (PST) Received: by mail-pj1-x1029.google.com with SMTP id v1so3333988pjr.2 for ; Fri, 08 Jan 2021 01:26:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Pa7GN651VEy240z9LxKSf3B8sUbdQIIjGYh0exLbalA=; b=YFvVibLoEaJmCaeqfu421ALSj2GuMBc0AFQLOrTHBg2eEkqWw4MGGV9IZpHzTp16i5 GFIYXDXeZsVVb9dHzn0hdsJJ9ZNOKTiqFqpP/WKLpG8yAe//amiin2NAeKGZDw3Ns0T2 1bFnFZucpptyihJF2IDeofSpTM4SOfGmn6G+Ta2+MMn5cxLJi9LbFFZ4gV8TOK2bGRKd Qdakx+4JoyO+vk2dZhPzNYtGsCt2rIVmDBZeoDxMPzHHQ6Flt2Exx6sMyxl3sfggArN1 lV53m5JVVpPBUTZ4PeEp3A0heU0q8nd33LLGgYDdZsQ8aTo4Kf0XMG5/3VwYYnrDgsYB LzKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Pa7GN651VEy240z9LxKSf3B8sUbdQIIjGYh0exLbalA=; b=Lw7Mq18Wihrh5CZZbQZ1MbDNj0RePsHuWCNnm77sxZYvQttQ1VFWNn+E0XdbIBbbLN XBwjhr1kKCVNfvZLE03Na+4GRUEqGqFDNcmCOJCAcQTKwxRSKUbA1gX9kSSnlEDkkNMv MZc9wnJPU8htRCFTtImyjym5Aq3ibB7DKBYlY+G1dQ8UyftdsM9WPqcK+9h+YH7A1RUD lOptgzRu2vZ8KGgznEX39eriDTG4Tm8ejt1x59xKVS+t55epxA4NG9UJVyNFp00x/qWe gQfzNFwZf//ZT3v+eeua+Ai1kbBwx1vYJvp/NLt15BM6mG7CDYILJuErF/eT3Gb/HChU DM3Q== X-Gm-Message-State: AOAM532CNgTUEDvkLsaUjDckN/v3ysGXrLvkxWRc6DAzp8utaPqeWFq3 JRg7C/QFPO6hdOFzBxuSoBdhGwScLXhvxg== X-Google-Smtp-Source: ABdhPJwrVfPHQAHauBOx9qv9WpnKvVv1pB8DYhGIQ94dw1DfdpMipZzxlAc19VsnmaqZ63e4/qcn0g== X-Received: by 2002:a17:90a:bf05:: with SMTP id c5mr2774645pjs.95.1610097975179; Fri, 08 Jan 2021 01:26:15 -0800 (PST) Received: from localhost.localdomain ([2409:4050:e06:7e2e:2d21:e266:30b:8fc]) by smtp.googlemail.com with ESMTPSA id 6sm8384234pfj.216.2021.01.08.01.26.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Jan 2021 01:26:14 -0800 (PST) From: Charvi Mendiratta To: git@vger.kernel.org Cc: christian.couder@gmail.com, phillip.wood@dunelm.org.uk, Johannes.Schindelin@gmx.de, Charvi Mendiratta , Christian Couder Subject: [RFC PATCH 7/9] t3437: test script for fixup [-C|-c] options in interactive rebase Date: Fri, 8 Jan 2021 14:53:45 +0530 Message-Id: <20210108092345.2178-8-charvi077@gmail.com> X-Mailer: git-send-email 2.29.0.rc1 In-Reply-To: <20210108092345.2178-1-charvi077@gmail.com> References: <20210108092345.2178-1-charvi077@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Mentored-by: Christian Couder Mentored-by: Phillip Wood Signed-off-by: Charvi Mendiratta --- t/lib-rebase.sh | 4 + t/t3437-rebase-fixup-options.sh | 190 ++++++++++++++++++++++++++++++++ t/t3437/expected-squash-message | 51 +++++++++ 3 files changed, 245 insertions(+) create mode 100755 t/t3437-rebase-fixup-options.sh create mode 100644 t/t3437/expected-squash-message diff --git a/t/lib-rebase.sh b/t/lib-rebase.sh index b72c051f47..e10e38060b 100644 --- a/t/lib-rebase.sh +++ b/t/lib-rebase.sh @@ -4,6 +4,7 @@ # # - override the commit message with $FAKE_COMMIT_MESSAGE # - amend the commit message with $FAKE_COMMIT_AMEND +# - copy the original commit message to a file with $FAKE_MESSAGE_COPY # - check that non-commit messages have a certain line count with $EXPECT_COUNT # - check the commit count in the commit message header with $EXPECT_HEADER_COUNT # - rewrite a rebase -i script as directed by $FAKE_LINES. @@ -33,6 +34,7 @@ set_fake_editor () { exit test -z "$FAKE_COMMIT_MESSAGE" || echo "$FAKE_COMMIT_MESSAGE" > "$1" test -z "$FAKE_COMMIT_AMEND" || echo "$FAKE_COMMIT_AMEND" >> "$1" + test -z "$FAKE_MESSAGE_COPY" || cat "$1" >"$FAKE_MESSAGE_COPY" exit ;; esac @@ -51,6 +53,8 @@ set_fake_editor () { action="$line";; exec_*|x_*|break|b) echo "$line" | sed 's/_/ /g' >> "$1";; + merge_*|fixup_*) + action=$(echo "$line" | sed 's/_/ /g');; "#") echo '# comment' >> "$1";; ">") diff --git a/t/t3437-rebase-fixup-options.sh b/t/t3437-rebase-fixup-options.sh new file mode 100755 index 0000000000..9e62d74249 --- /dev/null +++ b/t/t3437-rebase-fixup-options.sh @@ -0,0 +1,190 @@ +#!/bin/sh +# +# Copyright (c) 2018 Phillip Wood +# + +test_description='git rebase interactive fixup options + +This test checks the "fixup [-C|-c]" command of rebase interactive. +In addition to amending the contents of the commit, "fixup -C" +replaces the original commit message with the message of the fixup +commit. "fixup -c" also replaces the original message, but opens the +editor to allow the user to edit the message before committing. +' + +. ./test-lib.sh + +. "$TEST_DIRECTORY"/lib-rebase.sh + +EMPTY="" + +test_commit_message () { + rev="$1" && # commit or tag we want to test + file="$2" && # test against the content of a file + git show --no-patch --pretty=format:%B "$rev" >actual-message && + if test "$2" = -m + then + str="$3" && # test against a string + printf "%s\n" "$str" >tmp-expected-message && + file="tmp-expected-message" + fi + test_cmp "$file" actual-message +} + +get_author () { + rev="$1" && + git log -1 --pretty=format:"%an %ae" "$rev" +} + +test_expect_success 'setup' ' + cat >message <<-EOF && + amend! B + ${EMPTY} + new subject + ${EMPTY} + new + body + EOF + + sed "1,2d" message >expected-message && + + test_commit A A && + test_commit B B && + get_author HEAD >expected-author && + ORIG_AUTHOR_NAME="$GIT_AUTHOR_NAME" && + ORIG_AUTHOR_EMAIL="$GIT_AUTHOR_EMAIL" && + GIT_AUTHOR_NAME="Amend Author" && + GIT_AUTHOR_EMAIL="amend@example.com" && + test_commit "$(cat message)" A A1 A1 && + test_commit A2 A && + test_commit A3 A && + GIT_AUTHOR_NAME="$ORIG_AUTHOR_NAME" && + GIT_AUTHOR_EMAIL="$ORIG_AUTHOR_EMAIL" && + git checkout -b conflicts-branch A && + test_commit conflicts A && + + set_fake_editor && + git checkout -b branch B && + echo B1 >B && + test_tick && + git commit --fixup=HEAD -a && + test_tick && + git commit --allow-empty -F - <<-EOF && + amend! B + ${EMPTY} + B + ${EMPTY} + edited 1 + EOF + test_tick && + git commit --allow-empty -F - <<-EOF && + amend! amend! B + ${EMPTY} + B + ${EMPTY} + edited 1 + ${EMPTY} + edited 2 + EOF + echo B2 >B && + test_tick && + FAKE_COMMIT_AMEND="edited squash" git commit --squash=HEAD -a && + echo B3 >B && + test_tick && + git commit -a -F - <<-EOF && + amend! amend! amend! B + ${EMPTY} + B + ${EMPTY} + edited 1 + ${EMPTY} + edited 2 + ${EMPTY} + edited 3 + EOF + + GIT_AUTHOR_NAME="Rebase Author" && + GIT_AUTHOR_EMAIL="rebase.author@example.com" && + GIT_COMMITTER_NAME="Rebase Committer" && + GIT_COMMITTER_EMAIL="rebase.committer@example.com" +' + +test_expect_success 'simple fixup -C works' ' + test_when_finished "test_might_fail git rebase --abort" && + git checkout --detach A2 && + FAKE_LINES="1 fixup_-C 2" git rebase -i B && + test_cmp_rev HEAD^ B && + test_cmp_rev HEAD^{tree} A2^{tree} && + test_commit_message HEAD -m "A2" +' + +test_expect_success 'simple fixup -c works' ' + test_when_finished "test_might_fail git rebase --abort" && + git checkout --detach A2 && + git log -1 --pretty=format:%B >expected-fixup-message && + test_write_lines "" "Modified A2" >>expected-fixup-message && + FAKE_LINES="1 fixup_-c 2" \ + FAKE_COMMIT_AMEND="Modified A2" \ + git rebase -i B && + test_cmp_rev HEAD^ B && + test_cmp_rev HEAD^{tree} A2^{tree} && + test_commit_message HEAD expected-fixup-message +' + +test_expect_success 'fixup -C removes amend! from message' ' + test_when_finished "test_might_fail git rebase --abort" && + git checkout --detach A1 && + FAKE_LINES="1 fixup_-C 2" git rebase -i A && + test_cmp_rev HEAD^ A && + test_cmp_rev HEAD^{tree} A1^{tree} && + test_commit_message HEAD expected-message && + get_author HEAD >actual-author && + test_cmp expected-author actual-author +' + +test_expect_success 'fixup -C with conflicts gives correct message' ' + test_when_finished "test_might_fail git rebase --abort" && + git checkout --detach A1 && + test_must_fail env FAKE_LINES="1 fixup_-C 2" git rebase -i conflicts && + git checkout --theirs -- A && + git add A && + FAKE_COMMIT_AMEND=edited git rebase --continue && + test_cmp_rev HEAD^ conflicts && + test_cmp_rev HEAD^{tree} A1^{tree} && + test_write_lines "" edited >>expected-message && + test_commit_message HEAD expected-message && + get_author HEAD >actual-author && + test_cmp expected-author actual-author +' + +test_expect_success 'skipping fixup -C after fixup gives correct message' ' + test_when_finished "test_might_fail git rebase --abort" && + git checkout --detach A3 && + test_must_fail env FAKE_LINES="1 fixup 2 fixup_-C 4" git rebase -i A && + git reset --hard && + FAKE_COMMIT_AMEND=edited git rebase --continue && + test_commit_message HEAD -m "B" +' + +test_expect_success 'sequence of fixup, fixup -C & squash --signoff works' ' + git checkout --detach branch && + FAKE_LINES="1 fixup 2 fixup_-C 3 fixup_-C 4 squash 5 fixup_-C 6" \ + FAKE_COMMIT_AMEND=squashed \ + FAKE_MESSAGE_COPY=actual-squash-message \ + git -c commit.status=false rebase -ik --signoff A && + git diff-tree --exit-code --patch HEAD branch -- && + test_cmp_rev HEAD^ A && + test_i18ncmp "$TEST_DIRECTORY/t3437/expected-squash-message" \ + actual-squash-message +' + +test_expect_success 'first fixup -C commented out in sequence fixup fixup -C fixup -C' ' + test_when_finished "test_might_fail git rebase --abort" && + git checkout branch && git checkout --detach branch~2 && + git log -1 --pretty=format:%b >expected-message && + FAKE_LINES="1 fixup 2 fixup_-C 3 fixup_-C 4" git rebase -i A && + test_cmp_rev HEAD^ A && + test_commit_message HEAD expected-message +' + +test_done diff --git a/t/t3437/expected-squash-message b/t/t3437/expected-squash-message new file mode 100644 index 0000000000..ab2434f90e --- /dev/null +++ b/t/t3437/expected-squash-message @@ -0,0 +1,51 @@ +# This is a combination of 6 commits. +# The 1st commit message will be skipped: + +# B +# +# Signed-off-by: Rebase Committer + +# The commit message #2 will be skipped: + +# fixup! B + +# The commit message #3 will be skipped: + +# amend! B +# +# B +# +# edited 1 +# +# Signed-off-by: Rebase Committer + +# This is the commit message #4: + +# amend! amend! B + +B + +edited 1 + +edited 2 + +Signed-off-by: Rebase Committer + +# This is the commit message #5: + +# squash! amend! amend! B + +edited squash + +# This is the commit message #6: + +# amend! amend! amend! B + +B + +edited 1 + +edited 2 + +edited 3 +squashed From patchwork Fri Jan 8 09:23:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Charvi Mendiratta X-Patchwork-Id: 12006135 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D9706C43381 for ; Fri, 8 Jan 2021 09:27:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 870F2233EA for ; Fri, 8 Jan 2021 09:27:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728176AbhAHJ1D (ORCPT ); Fri, 8 Jan 2021 04:27:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36096 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727416AbhAHJ1D (ORCPT ); Fri, 8 Jan 2021 04:27:03 -0500 Received: from mail-pj1-x1032.google.com (mail-pj1-x1032.google.com [IPv6:2607:f8b0:4864:20::1032]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C3A99C0612F4 for ; Fri, 8 Jan 2021 01:26:22 -0800 (PST) Received: by mail-pj1-x1032.google.com with SMTP id u4so4119392pjn.4 for ; Fri, 08 Jan 2021 01:26:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=k5d3r4ROZAvqT/9LDJdc0FjThQBb0/svoVRZRspqCHk=; b=jv5nFjrOme9sGqJ0uhCbaCZdbJj+2JOMcz1lvzVqLvxMUibdnWUmtekh50GZWzZQll 6RB2lteD5F4fx0vzFUZReUAp79p3yA43xP10LNajexfha/MQ/k/MWLi7mFeSfcRz2+xC huRG1VFXzFk0YAFfA85SarUP78TQo9kz8xlTnbU/k8oGFA6rQ1uKHWm6kjDqTH1r+rPf +jPd/XGPM79LEGgDOhR7Be7+I3zFM029es9UHUsgkrJRv4YLphL4uFjGw30PXuIp1sqP JvBjE1zqi6VeuGPcBs9dEKUb7dcttchoBpfsk67FrvHZxleX7nJWmai7nMRGSSjduAVS UIrw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=k5d3r4ROZAvqT/9LDJdc0FjThQBb0/svoVRZRspqCHk=; b=gSNNAhjAQfJHlKznYUMKOqURO9RNu+bogiITv3N2aiF1ad9CYiezfmKxyjSXZsp7sy aYBSKcMbBgwQYdwZrGSy5ZtyOyEVmTukq461qRKSvpRUOSNpg/JqLj+uV2gFVxI7Qjd0 QsfH6Kr0PFO7Pjqx3T7aQ6BREIm/KzBuVq2DuntipUn36aWqUbkrkZ4NHvX2sU6xgrX+ relrckMgglkF86vTovv1c2bRf/Nv2uk+LEqyLit2X0qPAEQ5BnwTzM22icdouKJtoESt +KqiV/mncNFXfekpizyubDyR7On+vY+wFYv+BW4tInDJshZRCiHadfbRvYX2EM9TYKLl eP/g== X-Gm-Message-State: AOAM532rMf3ekq9gS/qoMFTBGPhJQhWduKWWf3BvhkvmU/ki96zi9KGp 8HRYFapvR/DuQ6/HDob9YClMfakZJY47IA== X-Google-Smtp-Source: ABdhPJxk3zpteVopJnVWgatJ7STNM9pcVBLz4N/zjpt9wlJDE+mD+JUnjFZWyB7mDO9G5eyewln/GQ== X-Received: by 2002:a17:902:d90c:b029:da:9930:9da7 with SMTP id c12-20020a170902d90cb02900da99309da7mr2988060plz.85.1610097982115; Fri, 08 Jan 2021 01:26:22 -0800 (PST) Received: from localhost.localdomain ([2409:4050:e06:7e2e:2d21:e266:30b:8fc]) by smtp.googlemail.com with ESMTPSA id 6sm8384234pfj.216.2021.01.08.01.26.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Jan 2021 01:26:21 -0800 (PST) From: Charvi Mendiratta To: git@vger.kernel.org Cc: christian.couder@gmail.com, phillip.wood@dunelm.org.uk, Johannes.Schindelin@gmx.de, Charvi Mendiratta , Christian Couder Subject: [RFC PATCH 8/9] rebase -i: teach --autosquash to work with amend! Date: Fri, 8 Jan 2021 14:53:46 +0530 Message-Id: <20210108092345.2178-9-charvi077@gmail.com> X-Mailer: git-send-email 2.29.0.rc1 In-Reply-To: <20210108092345.2178-1-charvi077@gmail.com> References: <20210108092345.2178-1-charvi077@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org If the commit subject starts with "amend!" then rearrange it like a "fixup!" commit and replace `pick` command with `fixup -C` command, which is used to fixup up the content if any and replaces the original commit message with amend! commit's message. Original-patch-by: Phillip Wood Mentored-by: Christian Couder Mentored-by: Phillip Wood Signed-off-by: Charvi Mendiratta --- sequencer.c | 23 ++++++++++++++++------- t/t3437-rebase-fixup-options.sh | 12 ++++++++++++ 2 files changed, 28 insertions(+), 7 deletions(-) diff --git a/sequencer.c b/sequencer.c index db016717d1..4b2e71cbda 100644 --- a/sequencer.c +++ b/sequencer.c @@ -5672,6 +5672,12 @@ static int subject2item_cmp(const void *fndata, define_commit_slab(commit_todo_item, struct todo_item *); +static inline int skip_fixup_amend_squash(const char *subject, const char **p) { + return skip_prefix(subject, "fixup! ", p) || + skip_prefix(subject, "amend! ", p) || + skip_prefix(subject, "squash! ", p); +} + /* * Rearrange the todo list that has both "pick commit-id msg" and "pick * commit-id fixup!/squash! msg" in it so that the latter is put immediately @@ -5730,15 +5736,13 @@ int todo_list_rearrange_squash(struct todo_list *todo_list) format_subject(&buf, subject, " "); subject = subjects[i] = strbuf_detach(&buf, &subject_len); unuse_commit_buffer(item->commit, commit_buffer); - if ((skip_prefix(subject, "fixup! ", &p) || - skip_prefix(subject, "squash! ", &p))) { + if (skip_fixup_amend_squash(subject, &p)) { struct commit *commit2; for (;;) { while (isspace(*p)) p++; - if (!skip_prefix(p, "fixup! ", &p) && - !skip_prefix(p, "squash! ", &p)) + if (!skip_fixup_amend_squash(p, &p)) break; } @@ -5768,9 +5772,14 @@ int todo_list_rearrange_squash(struct todo_list *todo_list) } if (i2 >= 0) { rearranged = 1; - todo_list->items[i].command = - starts_with(subject, "fixup!") ? - TODO_FIXUP : TODO_SQUASH; + if (starts_with(subject, "fixup!")) { + todo_list->items[i].command = TODO_FIXUP; + } else if (starts_with(subject, "amend!")) { + todo_list->items[i].command = TODO_FIXUP; + todo_list->items[i].flags = TODO_REPLACE_FIXUP_MSG; + } else { + todo_list->items[i].command = TODO_SQUASH; + } if (tail[i2] < 0) { next[i] = next[i2]; next[i2] = i; diff --git a/t/t3437-rebase-fixup-options.sh b/t/t3437-rebase-fixup-options.sh index 9e62d74249..532dc1c11b 100755 --- a/t/t3437-rebase-fixup-options.sh +++ b/t/t3437-rebase-fixup-options.sh @@ -187,4 +187,16 @@ test_expect_success 'first fixup -C commented out in sequence fixup fixup -C fix test_commit_message HEAD expected-message ' +test_expect_success 'fixup -C works upon --autosquash with amend!' ' + git checkout --detach branch && + FAKE_COMMIT_AMEND=squashed \ + FAKE_MESSAGE_COPY=actual-squash-message \ + git -c commit.status=false rebase -ik --autosquash \ + --signoff A && + git diff-tree --exit-code --patch HEAD branch -- && + test_cmp_rev HEAD^ A && + test_i18ncmp "$TEST_DIRECTORY/t3437/expected-squash-message" \ + actual-squash-message +' + test_done From patchwork Fri Jan 8 09:23:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Charvi Mendiratta X-Patchwork-Id: 12006137 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B7421C4332B for ; Fri, 8 Jan 2021 09:27:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6D92C233EA for ; Fri, 8 Jan 2021 09:27:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728197AbhAHJ1J (ORCPT ); Fri, 8 Jan 2021 04:27:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36114 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727416AbhAHJ1I (ORCPT ); Fri, 8 Jan 2021 04:27:08 -0500 Received: from mail-pj1-x102f.google.com (mail-pj1-x102f.google.com [IPv6:2607:f8b0:4864:20::102f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5E9B2C0612FC for ; Fri, 8 Jan 2021 01:26:28 -0800 (PST) Received: by mail-pj1-x102f.google.com with SMTP id p12so3328102pju.5 for ; Fri, 08 Jan 2021 01:26:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=v06s6aZ+KsNyeYsi4lspk3/ZKiIaKcsSjXUrM9gZ5v8=; b=aLKR8ZqzdbcPfh1tMpgY7RxEAtcQfE22468G2R9UAmXpbHngV5ZD/QN68M1XwaPLBy TTlwjav5LC6Hnc7rnXC/JVtgHIdxVrwvHAVgqrJWEggdbQhSkZEwivIs1PTo4ypa4H+t 32QfkqnW0WiL1DQyJuAGGq+1CNxlIXCJHc1Hn40BZx+eO7ilBSzYc/XcT7ZasK+WXpLC oAAWiy/IgvdjGYR7Qsdw6lWi9qxZ4GwFDd+V3O4Ikb0kmBz4aailqEme1ohI4G8ysUWX V1OBjEpSbAwZlfZWakdocYX8mpOZtGfP/6vkEAk4KvR4kUC8P2te57pLkkGiVBaYe2D2 btNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=v06s6aZ+KsNyeYsi4lspk3/ZKiIaKcsSjXUrM9gZ5v8=; b=bwGATiMk+NW/xAdvq0cqp2aldYlYDPaHgZ/tjHRZ/GLHkgZTQIuLVRFqVEjXWk9Q/l AgmMQSCC+O8OAWqQJxcPL7U+dNhpKhyGPIHTdfdmq4O28Mnt4Yw/i+UonAOFBc46mvhM H0r55BrMHrD/5AcWNoONGUs7DhzaDMAHIrSIsEEeM65aCMF0oFrFhwZeSWoySYGsCjZA uMqYqy6tvxwyMrEw4pdQImTX5GRSVp1zTmwGX42h2IdT1c6hQ2mqh9YvjvIpw1KfXrf6 d3AlbA597tjypsY79t2R2BeK0TetMe34V803YS5shkm9n941TqFBIQttm9nnQhNUjBN/ qQcQ== X-Gm-Message-State: AOAM532gqnTxt4upsWPgxX3r5PohJi7pkJY3ioClcMKtt57ydR6r1qIC b+7mtJZGmiknP5TUUgwGSyD4CrJdI27gyA== X-Google-Smtp-Source: ABdhPJwctOrv3UoiDvvU7T8WFJYgGJd27OBm3HTcsiGbC7K8QzdnZiO1hFN+TcBqDU9ZQIMp9LSftA== X-Received: by 2002:a17:90a:dc18:: with SMTP id i24mr2890617pjv.118.1610097987802; Fri, 08 Jan 2021 01:26:27 -0800 (PST) Received: from localhost.localdomain ([2409:4050:e06:7e2e:2d21:e266:30b:8fc]) by smtp.googlemail.com with ESMTPSA id 6sm8384234pfj.216.2021.01.08.01.26.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Jan 2021 01:26:27 -0800 (PST) From: Charvi Mendiratta To: git@vger.kernel.org Cc: christian.couder@gmail.com, phillip.wood@dunelm.org.uk, Johannes.Schindelin@gmx.de, Charvi Mendiratta , Christian Couder Subject: [RFC PATCH 9/9] doc/git-rebase: add documentation for fixup [-C|-c] options Date: Fri, 8 Jan 2021 14:53:47 +0530 Message-Id: <20210108092345.2178-10-charvi077@gmail.com> X-Mailer: git-send-email 2.29.0.rc1 In-Reply-To: <20210108092345.2178-1-charvi077@gmail.com> References: <20210108092345.2178-1-charvi077@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Mentored-by: Christian Couder Mentored-by: Phillip Wood Signed-off-by: Charvi Mendiratta --- Documentation/git-rebase.txt | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt index a0487b5cc5..776507e0cc 100644 --- a/Documentation/git-rebase.txt +++ b/Documentation/git-rebase.txt @@ -887,9 +887,15 @@ If you want to fold two or more commits into one, replace the command "pick" for the second and subsequent commits with "squash" or "fixup". If the commits had different authors, the folded commit will be attributed to the author of the first commit. The suggested commit -message for the folded commit is the concatenation of the commit -messages of the first commit and of those with the "squash" command, -but omits the commit messages of commits with the "fixup" command. +message for the folded commit is created as follows: + + - It is made using the commit message of a commit with the "fixup -C" + or "fixup -c" command. In the later case an editor is opened to edit + the commit message. + - Otherwise it's the concatenation of the commit messages of the first + commit and of those with the "squash" command. + - It omits the commit messages of commits with the "fixup" + (without -C or -c) command. 'git rebase' will stop when "pick" has been replaced with "edit" or when a command fails due to merge errors. When you are done editing