From patchwork Thu Jul 25 10:11:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Cai via GitGitGadget X-Patchwork-Id: 11058467 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4FCF01398 for ; Thu, 25 Jul 2019 10:11:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3E875288AE for ; Thu, 25 Jul 2019 10:11:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 32ED328906; Thu, 25 Jul 2019 10:11:21 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BB2E5288AE for ; Thu, 25 Jul 2019 10:11:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729820AbfGYKLS (ORCPT ); Thu, 25 Jul 2019 06:11:18 -0400 Received: from mail-wm1-f65.google.com ([209.85.128.65]:51076 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729761AbfGYKLS (ORCPT ); Thu, 25 Jul 2019 06:11:18 -0400 Received: by mail-wm1-f65.google.com with SMTP id v15so44447111wml.0 for ; Thu, 25 Jul 2019 03:11:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:message-id:in-reply-to:references:from:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=moUMSE90+nFsxeOHcgCy5QUerZMMwZsZ2pp3Wa/hwc8=; b=tNJYHPt+3EFNhclRP4ZGrzt41ninNFbR6RROu7Iifiox5VdGmZNjX67ZpoN/G1rXJh PYCZV6B9hOGbZExAaSgFXFBDRkWDN/qrJsShdzNahPn8mU/YUMfXCJV3BGeA/NCD9gU2 mNoskiqwX20ocTqL+MgDc3YlsnsPkR/K8X4ItoZ4WjUPYZjjSQYJfHSjZwtMXOT8BNyr d9dup1z1DTT/QN+BKZ4cv22pQklC8Yj27cl60NZ2VhMfaXsXNHunVEjf3701wOgO+1Q7 ikodJCQ2JSEbLaOmrWzVT/Q/QDtacqRxviR8wnWY8O+b7f5K2y+JpfOPxtWrDuPkmgD4 xUDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:message-id:in-reply-to:references:from :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=moUMSE90+nFsxeOHcgCy5QUerZMMwZsZ2pp3Wa/hwc8=; b=l+eni77Bvl1BKORaLrZWaqTaEyZ8gDaURYmjio8zrOXjjXnrYeprFqW+7OSIX66KQg h/l9QdSZ2my65Pr/Dsq4wDK1GZP2ciIuxAWnlS5miwFwzVmaQuYRchIiSsOHLZytCNOo +KGigI9rcdexzcYLSCxGeDKkR2gebfDbGwMgsdImCYboxJz+giLzmn0vFo7lvbfhacdZ 5MXgSc4G9hVx7LOl9GJgtnhTJg44BMlyWxbqnHsBLUXEH7/0VVD3YZP4x4ozgFAhTlJt f1gsi+ZY5KtTOw44/0Bq1mgLYIm0Ra+/SrWGepWMWVxIvJPxgFBsdic7EH3HgjUMSjKT KZgg== X-Gm-Message-State: APjAAAVDbSo08hDZMtU9ZPSn3W0AIm8iC8/Jxo7XbVljfFUdZsX+4hur SQP7xHlHlR8RcxQjm3ROToWoQGad X-Google-Smtp-Source: APXvYqw1vhNa0OPLyBxlXIG2TZ3VLifr+sg8u2nWkgiLfXUoUtT7S8wLR7J9Sb+3baeb8e2hv3RXQQ== X-Received: by 2002:a05:600c:228b:: with SMTP id 11mr80615693wmf.26.1564049476099; Thu, 25 Jul 2019 03:11:16 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id w25sm47101842wmk.18.2019.07.25.03.11.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 25 Jul 2019 03:11:15 -0700 (PDT) Date: Thu, 25 Jul 2019 03:11:15 -0700 (PDT) X-Google-Original-Date: Thu, 25 Jul 2019 10:11:02 GMT Message-Id: <05be92d9213bf16b479cc95af520eea038748567.1564049473.git.gitgitgadget@gmail.com> In-Reply-To: References: From: "Johannes Schindelin via GitGitGadget" Subject: [PATCH 01/12] t3427: add a clarifying comment Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Junio C Hamano , Johannes Schindelin Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Johannes Schindelin The flow of this test script is outright confusing, and to start the endeavor to address that, let's describe what this test is all about, and how it tries to do it. Signed-off-by: Johannes Schindelin --- t/t3427-rebase-subtree.sh | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/t/t3427-rebase-subtree.sh b/t/t3427-rebase-subtree.sh index 3780877e4e..a9b93c39d0 100755 --- a/t/t3427-rebase-subtree.sh +++ b/t/t3427-rebase-subtree.sh @@ -11,6 +11,34 @@ commit_message() { git log --pretty=format:%s -1 "$1" } +# There are a few bugs in the rebase with regards to the subtree strategy, and +# this test script tries to document them. First, the following commit history +# is generated (the onelines are shown, time flows from left to right): +# +# master1 - master2 - master3 +# \ +# README ---------------------- Add subproject master - master4 - files_subtree/master5 +# +# Where the merge moves the files master[123].t into the subdirectory +# files_subtree/ and master4 as well as files_subtree/master5 add files to that +# directory directly. +# +# Then, in subsequent test cases, `git filter-branch` is used to distill just +# the commits that touch files_subtree/. To give it a final pre-rebase touch, +# an empty commit is added on top. The pre-rebase commit history looks like +# this: +# +# Add subproject master - master4 - files_subtree/master5 - Empty commit +# +# where the root commit adds three files: master1.t, master2.t and master3.t. +# +# This commit history is then rebased onto `master3` with the +# `-Xsubtree=files_subtree` option in three different ways: +# +# 1. using `--preserve-merges` +# 2. using `--preserve-merges` and --keep-empty +# 3. without specifying a rebase backend + test_expect_success 'setup' ' test_commit README && mkdir files && From patchwork Thu Jul 25 10:11:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Cai via GitGitGadget X-Patchwork-Id: 11058465 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7C68813B1 for ; Thu, 25 Jul 2019 10:11:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6BBB3288AE for ; Thu, 25 Jul 2019 10:11:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6001D28906; Thu, 25 Jul 2019 10:11:20 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EBC27288AE for ; Thu, 25 Jul 2019 10:11:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387953AbfGYKLS (ORCPT ); Thu, 25 Jul 2019 06:11:18 -0400 Received: from mail-wm1-f65.google.com ([209.85.128.65]:51079 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729812AbfGYKLS (ORCPT ); Thu, 25 Jul 2019 06:11:18 -0400 Received: by mail-wm1-f65.google.com with SMTP id v15so44447159wml.0 for ; Thu, 25 Jul 2019 03:11:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:message-id:in-reply-to:references:from:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=JC7Y6UUK4wTj8fsWwU1KYecKXknoaBCkaHUBcYWNd1g=; b=E5p7NPtZMLhxYgZbXyvH5JCiLn+eh1ElKmXnPrDN60uX8JYFmfO7sLtbhiqdfpb3m0 4GSh/IaRckGkWax1/5HeRVUXL/0kcf2fcmYORZjBTYn06RVusCEts3lJZybMI68hrfAs JssXh8fduWIErUl5IL4a8Vgwt5VeJmfdVsL4VLVRUu2NcWF5v/FBkpqjnXi9bahNQNCr GJZ8VLEe+TF+RxjW21ocGI00wMoYmBGtHsuotBtL+ouL+P0J/L82+HWhE93q8nPdLhLv 9wjeyudbdPpEZRxw3jouwbTvX++ZKbIH/8bSCys//TT9wqmtmz5UsQutKR4htK65L1dZ V/hg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:message-id:in-reply-to:references:from :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=JC7Y6UUK4wTj8fsWwU1KYecKXknoaBCkaHUBcYWNd1g=; b=bd8FKadeRuzrzGYBOAugcH0w/U9NPzy8KDhgj5dx74BJ5xmJPzCVDQzPkw7/c53zuI R4sqpEB+WAjlp+SRBkA+QqBlYKWoH1ymSLKur9RDrPdko5i3rU4jMTpCSo01RROX8pMi K4CG/2sIh0owfAMyS+CQGT9ryTaK+6S+jd6nOn7mpyiwvQVRG+Tua/jhAxOijJhVQKic s1jnCWTuH2SI1ztTHx4Jpfm2Xg9uQtUCgz3d6Bn1eLpAvoWzTFK6oOpQIYidhpwb6tcc yz2dkX3QBeeFqRT2pYXxNW4z6fe6dGLwb2nn//wFI/F0iZhd177+EOokVquHibHMFkTJ hoHw== X-Gm-Message-State: APjAAAW/v3ILdTZOEm6JeoqOLzDrBqVtA3tpkgikBve4DGGSwrtr+ba0 xTLxh206ZM7kOmtKGu43ASk/MZzX X-Google-Smtp-Source: APXvYqxkPRoxiVsoix0Wx56SxDGtwI6n8wX/dZKZm5QfST0sdqo36HJ5GgODA1IXE66uif1CNE0Fng== X-Received: by 2002:a1c:9a4b:: with SMTP id c72mr53383254wme.102.1564049476877; Thu, 25 Jul 2019 03:11:16 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id f12sm53640703wrg.5.2019.07.25.03.11.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 25 Jul 2019 03:11:16 -0700 (PDT) Date: Thu, 25 Jul 2019 03:11:16 -0700 (PDT) X-Google-Original-Date: Thu, 25 Jul 2019 10:11:03 GMT Message-Id: In-Reply-To: References: From: "Johannes Schindelin via GitGitGadget" Subject: [PATCH 02/12] t3427: simplify the `setup` test case significantly Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Junio C Hamano , Johannes Schindelin Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Johannes Schindelin It still does the very same thing as before, but expresses it in a much more succinct (and still quite readable) manner. Signed-off-by: Johannes Schindelin --- t/t3427-rebase-subtree.sh | 36 +++++++++++++++--------------------- 1 file changed, 15 insertions(+), 21 deletions(-) diff --git a/t/t3427-rebase-subtree.sh b/t/t3427-rebase-subtree.sh index a9b93c39d0..f41a08e436 100755 --- a/t/t3427-rebase-subtree.sh +++ b/t/t3427-rebase-subtree.sh @@ -41,27 +41,21 @@ commit_message() { test_expect_success 'setup' ' test_commit README && - mkdir files && - ( - cd files && - git init && - test_commit master1 && - test_commit master2 && - test_commit master3 - ) && - git fetch files master && - git branch files-master FETCH_HEAD && - git read-tree --prefix=files_subtree files-master && - git checkout -- files_subtree && - tree=$(git write-tree) && - head=$(git rev-parse HEAD) && - rev=$(git rev-parse --verify files-master^0) && - commit=$(git commit-tree -p $head -p $rev -m "Add subproject master" $tree) && - git update-ref HEAD $commit && - ( - cd files_subtree && - test_commit master4 - ) && + + git init files && + test_commit -C files master1 && + test_commit -C files master2 && + test_commit -C files master3 && + + : perform subtree merge into files_subtree/ && + git fetch files refs/heads/master:refs/heads/files-master && + git merge -s ours --no-commit --allow-unrelated-histories \ + files-master && + git read-tree --prefix=files_subtree -u files-master && + git commit -m "Add subproject master" && + + : add two extra commits to rebase && + test_commit -C files_subtree master4 && test_commit files_subtree/master5 ' From patchwork Thu Jul 25 10:11:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Cai via GitGitGadget X-Patchwork-Id: 11058473 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B14E71398 for ; Thu, 25 Jul 2019 10:11:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9EF6F288AE for ; Thu, 25 Jul 2019 10:11:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9356E28931; Thu, 25 Jul 2019 10:11:26 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5BC19288AE for ; Thu, 25 Jul 2019 10:11:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388778AbfGYKLY (ORCPT ); Thu, 25 Jul 2019 06:11:24 -0400 Received: from mail-wr1-f68.google.com ([209.85.221.68]:42168 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729815AbfGYKLU (ORCPT ); Thu, 25 Jul 2019 06:11:20 -0400 Received: by mail-wr1-f68.google.com with SMTP id x1so204921wrr.9 for ; Thu, 25 Jul 2019 03:11:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:message-id:in-reply-to:references:from:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=RMedZnkPl4qfOofvp4du5XYtfe42AbXTaWEPUuPOiNw=; b=oAKxPHHbwZeBQrA0k9mtV8UvmGyGVhzzlH/YzXICICn4tuQu8+uqUaL+0dyWULuOr1 Kx+QjJatzo0dJkLt20wxhz5OQh7tqSejbj/+VRjTa1zHgaNR9gQ+S0r/Eb/nL8zt4bqr ygsciM+O5rlvz+Rl7gdDTEjVUDjzBlG8zAdD7MySew+pN1d3jkZj37W1e/hpQyY1jnpn yyHkcV4mUdqAipFAVYwYyP43ChZO9RvdcUOKemkYMSA/sBsSIllUQZ6ZDkCSUk8iS/5B Et7Kkh2x2YmnEUu4ch6YmaISpZvERSBQk4UNS3ZPvLUGcd4kEdCEC8thV8YaMx9lMYA4 nffg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:message-id:in-reply-to:references:from :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=RMedZnkPl4qfOofvp4du5XYtfe42AbXTaWEPUuPOiNw=; b=IsIRd8tOMZtkyFqrfgsQ8nYIbr/n//+Xf7ucHU5cjrzKp9+tM0S6v7NWQNYTelTPJS j1SO5WzZPokFXj69F9DmBzZZWjou6rE+DBcuEwcrH9o+BXHLgvmqfkzzZaMCqnkgO2Rr JKhnnn/fYu9pA59IuGZtULB3rim8ImDD3udo1p5PY6iYx6yQxCfYf5B3WO0MsHTzCTC0 KpsSc+hz2hAmiNdAJqqMWg1gQVi9Oh4A0rNH0L75rA5oujmdw3U4uW3BZfxv+ZBsCsQC mKVTO4XF4LJ/gH4MrjGMKMu1eIbCj3v/dPsxMrCF/YnK5trEpadzfNYxA5njBdKHqZFt ZQ1w== X-Gm-Message-State: APjAAAU8nsznnasDQ8jZNvtIhYj2RvO2Wv1HlORJ+EF3r0b+ENULLXHU up/ePZp+H/MYPzf1KlmyYCh2rlxW X-Google-Smtp-Source: APXvYqygexMHWNcLcNVYhP/MUTwBXjfnhGC7ZS1UhRVaJOy9fED90gNoHseyQ7gADqkvGN4B7Jgrrw== X-Received: by 2002:a5d:54c7:: with SMTP id x7mr64518489wrv.39.1564049477780; Thu, 25 Jul 2019 03:11:17 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id z7sm46459285wrh.67.2019.07.25.03.11.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 25 Jul 2019 03:11:17 -0700 (PDT) Date: Thu, 25 Jul 2019 03:11:17 -0700 (PDT) X-Google-Original-Date: Thu, 25 Jul 2019 10:11:04 GMT Message-Id: In-Reply-To: References: From: "Johannes Schindelin via GitGitGadget" Subject: [PATCH 03/12] t3427: move the `filter-branch` invocation into the `setup` case Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Junio C Hamano , Johannes Schindelin Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Johannes Schindelin The step to prepare a pre-rebase commit history is _identical_ in _all_ of the test cases (except of course the `setup` case). It should therefore clearly a part of the `setup` test case instead. As the `git filter-branch` command is quite costly on platforms where Unix shell scripting is simply slow (meaning: on Windows), this shaves off a noticeable part of the runtime: in this developer's setup, the time was reduced from ~1m25s to ~1m. Signed-off-by: Johannes Schindelin --- t/t3427-rebase-subtree.sh | 38 +++++++++++++------------------------- 1 file changed, 13 insertions(+), 25 deletions(-) diff --git a/t/t3427-rebase-subtree.sh b/t/t3427-rebase-subtree.sh index f41a08e436..c0e6a49b61 100755 --- a/t/t3427-rebase-subtree.sh +++ b/t/t3427-rebase-subtree.sh @@ -56,15 +56,17 @@ test_expect_success 'setup' ' : add two extra commits to rebase && test_commit -C files_subtree master4 && - test_commit files_subtree/master5 + test_commit files_subtree/master5 && + + git checkout -b to-rebase && + git filter-branch --prune-empty -f --subdirectory-filter files_subtree && + git commit -m "Empty commit" --allow-empty ' # FAILURE: Does not preserve master4. test_expect_failure 'Rebase -Xsubtree --preserve-merges --onto commit 4' ' reset_rebase && - git checkout -b rebase-preserve-merges-4 master && - git filter-branch --prune-empty -f --subdirectory-filter files_subtree && - git commit -m "Empty commit" --allow-empty && + git checkout -b rebase-preserve-merges-4 to-rebase && git rebase -Xsubtree=files_subtree --preserve-merges --onto files-master master && verbose test "$(commit_message HEAD~)" = "files_subtree/master4" ' @@ -72,9 +74,7 @@ test_expect_failure 'Rebase -Xsubtree --preserve-merges --onto commit 4' ' # FAILURE: Does not preserve master5. test_expect_failure 'Rebase -Xsubtree --preserve-merges --onto commit 5' ' reset_rebase && - git checkout -b rebase-preserve-merges-5 master && - git filter-branch --prune-empty -f --subdirectory-filter files_subtree && - git commit -m "Empty commit" --allow-empty && + git checkout -b rebase-preserve-merges-5 to-rebase && git rebase -Xsubtree=files_subtree --preserve-merges --onto files-master master && verbose test "$(commit_message HEAD)" = "files_subtree/master5" ' @@ -82,9 +82,7 @@ test_expect_failure 'Rebase -Xsubtree --preserve-merges --onto commit 5' ' # FAILURE: Does not preserve master4. test_expect_failure 'Rebase -Xsubtree --keep-empty --preserve-merges --onto commit 4' ' reset_rebase && - git checkout -b rebase-keep-empty-4 master && - git filter-branch --prune-empty -f --subdirectory-filter files_subtree && - git commit -m "Empty commit" --allow-empty && + git checkout -b rebase-keep-empty-4 to-rebase && git rebase -Xsubtree=files_subtree --keep-empty --preserve-merges --onto files-master master && verbose test "$(commit_message HEAD~2)" = "files_subtree/master4" ' @@ -92,9 +90,7 @@ test_expect_failure 'Rebase -Xsubtree --keep-empty --preserve-merges --onto comm # FAILURE: Does not preserve master5. test_expect_failure 'Rebase -Xsubtree --keep-empty --preserve-merges --onto commit 5' ' reset_rebase && - git checkout -b rebase-keep-empty-5 master && - git filter-branch --prune-empty -f --subdirectory-filter files_subtree && - git commit -m "Empty commit" --allow-empty && + git checkout -b rebase-keep-empty-5 to-rebase && git rebase -Xsubtree=files_subtree --keep-empty --preserve-merges --onto files-master master && verbose test "$(commit_message HEAD~)" = "files_subtree/master5" ' @@ -102,9 +98,7 @@ test_expect_failure 'Rebase -Xsubtree --keep-empty --preserve-merges --onto comm # FAILURE: Does not preserve Empty. test_expect_failure 'Rebase -Xsubtree --keep-empty --preserve-merges --onto empty commit' ' reset_rebase && - git checkout -b rebase-keep-empty-empty master && - git filter-branch --prune-empty -f --subdirectory-filter files_subtree && - git commit -m "Empty commit" --allow-empty && + git checkout -b rebase-keep-empty-empty to-rebase && git rebase -Xsubtree=files_subtree --keep-empty --preserve-merges --onto files-master master && verbose test "$(commit_message HEAD)" = "Empty commit" ' @@ -112,9 +106,7 @@ test_expect_failure 'Rebase -Xsubtree --keep-empty --preserve-merges --onto empt # FAILURE: fatal: Could not parse object test_expect_failure 'Rebase -Xsubtree --onto commit 4' ' reset_rebase && - git checkout -b rebase-onto-4 master && - git filter-branch --prune-empty -f --subdirectory-filter files_subtree && - git commit -m "Empty commit" --allow-empty && + git checkout -b rebase-onto-4 to-rebase && git rebase -Xsubtree=files_subtree --onto files-master master && verbose test "$(commit_message HEAD~2)" = "files_subtree/master4" ' @@ -122,18 +114,14 @@ test_expect_failure 'Rebase -Xsubtree --onto commit 4' ' # FAILURE: fatal: Could not parse object test_expect_failure 'Rebase -Xsubtree --onto commit 5' ' reset_rebase && - git checkout -b rebase-onto-5 master && - git filter-branch --prune-empty -f --subdirectory-filter files_subtree && - git commit -m "Empty commit" --allow-empty && + git checkout -b rebase-onto-5 to-rebase && git rebase -Xsubtree=files_subtree --onto files-master master && verbose test "$(commit_message HEAD~)" = "files_subtree/master5" ' # FAILURE: fatal: Could not parse object test_expect_failure 'Rebase -Xsubtree --onto empty commit' ' reset_rebase && - git checkout -b rebase-onto-empty master && - git filter-branch --prune-empty -f --subdirectory-filter files_subtree && - git commit -m "Empty commit" --allow-empty && + git checkout -b rebase-onto-empty to-rebase && git rebase -Xsubtree=files_subtree --onto files-master master && verbose test "$(commit_message HEAD)" = "Empty commit" ' From patchwork Thu Jul 25 10:11:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Cai via GitGitGadget X-Patchwork-Id: 11058469 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 586C113B1 for ; Thu, 25 Jul 2019 10:11:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4793D288AE for ; Thu, 25 Jul 2019 10:11:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3B37C28931; Thu, 25 Jul 2019 10:11:24 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A6300288AE for ; Thu, 25 Jul 2019 10:11:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388680AbfGYKLX (ORCPT ); Thu, 25 Jul 2019 06:11:23 -0400 Received: from mail-wm1-f66.google.com ([209.85.128.66]:36201 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388120AbfGYKLU (ORCPT ); Thu, 25 Jul 2019 06:11:20 -0400 Received: by mail-wm1-f66.google.com with SMTP id g67so40088835wme.1 for ; Thu, 25 Jul 2019 03:11:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:message-id:in-reply-to:references:from:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=zML5Qsmc8HszOfCBhNZlNUAJRbxKu5Wz/AFIkV9NkO0=; b=BAr0U4S9AYvpXXFApPOCqqA+PI4oz6U7X6Y9SzHWk6I+5hcQanv+fq9cRKrOC5IxWo JhZ7UF1Mqq4MTUSAuRttgE4AaWQCC17Ki3ZImZol4qcd+4u62FgTACjt5wOzVRaPpp1o 3sCNzTZCFGCF74JFXEd8392BgLjE1nraSUwdwpWyHiNUiC++FZzxdDdnpU52tGmtH2V/ kjZQ5KNIdNVpjgsJSF5YSCfACSA4X7erk2qBdCEqXxCZH8f9NYf8B9pDag0FWmH1zg0q O6KMdi93J3vx3G8S5Ub+uD56gIvxcKGgQ2Vazq5zLbFMNMBX35OgzZjQAiB2Kfr2PAIS fIFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:message-id:in-reply-to:references:from :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=zML5Qsmc8HszOfCBhNZlNUAJRbxKu5Wz/AFIkV9NkO0=; b=oKr49bFgefeP7HGctWqEDC4cOIlLqoOe/YMmbjurzzRyJjFzrzDl8yz+DU4FiZg9J2 rvjDXhQ6zZdJcACS+jq188LhFNT4PCEYWpxna4gfiWZpxf5GlvXn1msg18gzse9gJUXh lkF0wHOFpy8DwUZh3mdHX1f533HtC1zqNyPk9Zr2ZSJu5uObDA7Ze9c9Ksbad63HtyVI CbokFtMlxO+6ccXb7kWVp/Gf2F5cesZDJRINezCPLHTE3zG6vhPocNserTT302vPIj4f aKOQr6exAI4E6jWbejE6rjAwKc6e6pGmhKXF3jV4tQhvi3gPXYnnEKBSYmlJq0F0Os9V MgOQ== X-Gm-Message-State: APjAAAUqM7tHhhpqXzNvbtm6+lqRvg1doiZxalIhjOu0yuf+RDPdURiG nd5S2KNRVXWpWMp1b3j9rxOkWF4K X-Google-Smtp-Source: APXvYqzxMYAahSBgDsUMGZrpK9mrrilNLE972I72s972NwT/LdGiUbo1VHMuL4DEEBs2JpCYLCcMFA== X-Received: by 2002:a05:600c:2102:: with SMTP id u2mr81104579wml.105.1564049478494; Thu, 25 Jul 2019 03:11:18 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id x129sm46805325wmg.44.2019.07.25.03.11.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 25 Jul 2019 03:11:18 -0700 (PDT) Date: Thu, 25 Jul 2019 03:11:18 -0700 (PDT) X-Google-Original-Date: Thu, 25 Jul 2019 10:11:05 GMT Message-Id: <9aeb57fa8f5c882f00c349e01a4459ce21c6cd24.1564049473.git.gitgitgadget@gmail.com> In-Reply-To: References: From: "Johannes Schindelin via GitGitGadget" Subject: [PATCH 04/12] t3427: condense the unnecessarily repetitive test cases into three Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Junio C Hamano , Johannes Schindelin Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Johannes Schindelin Previously, this test script performed essentially three rebases and verified breakages by testing the post-rebase commits' messages. To do so, the rebases were performed multiple times, though, once per commit message to test. This wastes electricity (and CO2) and time. Let's condense the test cases to the essential number: the number of different rebases to validate. On Windows, where the scripted nature of the `--preserve-merges` backend hurts performance rather badly, this reduces the overall runtime in this developer's setup from ~1m to ~28s while still performing the exact same testing as before. Signed-off-by: Johannes Schindelin --- t/t3427-rebase-subtree.sh | 56 ++++++++------------------------------- 1 file changed, 11 insertions(+), 45 deletions(-) diff --git a/t/t3427-rebase-subtree.sh b/t/t3427-rebase-subtree.sh index c0e6a49b61..7d3ba766de 100755 --- a/t/t3427-rebase-subtree.sh +++ b/t/t3427-rebase-subtree.sh @@ -64,65 +64,31 @@ test_expect_success 'setup' ' ' # FAILURE: Does not preserve master4. -test_expect_failure 'Rebase -Xsubtree --preserve-merges --onto commit 4' ' +test_expect_failure 'Rebase -Xsubtree --preserve-merges --onto commit' ' reset_rebase && - git checkout -b rebase-preserve-merges-4 to-rebase && - git rebase -Xsubtree=files_subtree --preserve-merges --onto files-master master && - verbose test "$(commit_message HEAD~)" = "files_subtree/master4" -' - -# FAILURE: Does not preserve master5. -test_expect_failure 'Rebase -Xsubtree --preserve-merges --onto commit 5' ' - reset_rebase && - git checkout -b rebase-preserve-merges-5 to-rebase && + git checkout -b rebase-preserve-merges to-rebase && git rebase -Xsubtree=files_subtree --preserve-merges --onto files-master master && + verbose test "$(commit_message HEAD~)" = "files_subtree/master4" && verbose test "$(commit_message HEAD)" = "files_subtree/master5" ' # FAILURE: Does not preserve master4. -test_expect_failure 'Rebase -Xsubtree --keep-empty --preserve-merges --onto commit 4' ' +test_expect_failure 'Rebase -Xsubtree --keep-empty --preserve-merges --onto commit' ' reset_rebase && - git checkout -b rebase-keep-empty-4 to-rebase && - git rebase -Xsubtree=files_subtree --keep-empty --preserve-merges --onto files-master master && - verbose test "$(commit_message HEAD~2)" = "files_subtree/master4" -' - -# FAILURE: Does not preserve master5. -test_expect_failure 'Rebase -Xsubtree --keep-empty --preserve-merges --onto commit 5' ' - reset_rebase && - git checkout -b rebase-keep-empty-5 to-rebase && - git rebase -Xsubtree=files_subtree --keep-empty --preserve-merges --onto files-master master && - verbose test "$(commit_message HEAD~)" = "files_subtree/master5" -' - -# FAILURE: Does not preserve Empty. -test_expect_failure 'Rebase -Xsubtree --keep-empty --preserve-merges --onto empty commit' ' - reset_rebase && - git checkout -b rebase-keep-empty-empty to-rebase && + git checkout -b rebase-keep-empty to-rebase && git rebase -Xsubtree=files_subtree --keep-empty --preserve-merges --onto files-master master && + verbose test "$(commit_message HEAD~2)" = "files_subtree/master4" && + verbose test "$(commit_message HEAD~)" = "files_subtree/master5" && verbose test "$(commit_message HEAD)" = "Empty commit" ' # FAILURE: fatal: Could not parse object -test_expect_failure 'Rebase -Xsubtree --onto commit 4' ' - reset_rebase && - git checkout -b rebase-onto-4 to-rebase && - git rebase -Xsubtree=files_subtree --onto files-master master && - verbose test "$(commit_message HEAD~2)" = "files_subtree/master4" -' - -# FAILURE: fatal: Could not parse object -test_expect_failure 'Rebase -Xsubtree --onto commit 5' ' - reset_rebase && - git checkout -b rebase-onto-5 to-rebase && - git rebase -Xsubtree=files_subtree --onto files-master master && - verbose test "$(commit_message HEAD~)" = "files_subtree/master5" -' -# FAILURE: fatal: Could not parse object -test_expect_failure 'Rebase -Xsubtree --onto empty commit' ' +test_expect_failure 'Rebase -Xsubtree --onto commit' ' reset_rebase && - git checkout -b rebase-onto-empty to-rebase && + git checkout -b rebase-onto to-rebase && git rebase -Xsubtree=files_subtree --onto files-master master && + verbose test "$(commit_message HEAD~2)" = "files_subtree/master4" && + verbose test "$(commit_message HEAD~)" = "files_subtree/master5" && verbose test "$(commit_message HEAD)" = "Empty commit" ' From patchwork Thu Jul 25 10:11:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Cai via GitGitGadget X-Patchwork-Id: 11058471 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C03EE1580 for ; Thu, 25 Jul 2019 10:11:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ADA0D288AE for ; Thu, 25 Jul 2019 10:11:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A201528906; Thu, 25 Jul 2019 10:11:24 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 33BCA288F1 for ; Thu, 25 Jul 2019 10:11:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388713AbfGYKLX (ORCPT ); Thu, 25 Jul 2019 06:11:23 -0400 Received: from mail-wm1-f67.google.com ([209.85.128.67]:55048 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388139AbfGYKLU (ORCPT ); Thu, 25 Jul 2019 06:11:20 -0400 Received: by mail-wm1-f67.google.com with SMTP id p74so44392111wme.4 for ; Thu, 25 Jul 2019 03:11:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:message-id:in-reply-to:references:from:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=qgc0NnOqvzExLfDn+q9OgvuzvfA1PVDCb+zpDNezixg=; b=UkNHvLBup40fFBGX33Y7/HGvrIiJrNKVQNwLVvEtPcpkf15h8Yl7A72sO+sHYc301i bSSsWG5B8GZ6ITRbMNsBa4+lUhgNlAbm4ldhJaXSB85YLkUlg9zoOKOzE9/T+FLREgZf 6qielaA5Bp5WQ+/4Vp9yv8EsTCcxUbKNekgynNVtETNv/zcmBWZoTzk6EbDW7KWvSAZX /VYo5oymZC1vfPkI68WD6417N78piOs15B0ETku+yCTn2WecIwqAL3XHXSkl6NKhET6h HKI+TnVrvmvpluaadLKyqm5ACsEzvYhy/HEOFe7Qz6K0wqrP0RBU4c+ML75CFqIRCInu uocQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:message-id:in-reply-to:references:from :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=qgc0NnOqvzExLfDn+q9OgvuzvfA1PVDCb+zpDNezixg=; b=TdKJqaxrOyRvVutCAIoczYx/sI7Vh3Xh0c0vy0zHTE7hm1B6q4ipInJqofH8YU4Npi +2YgE7+KO2cuawuhpaqz2IW2D3Zeno3+HRPrCf9DrugMnwdNrllzOKdzmOgowql6KwLy fG0MpOGMm93s8sw+QDnnCFDG9RuY8JIjaWBL7A9UfmPY4o1KEJytfmC1jE3nkemj+MVJ 5S11mw9taldQ/uJo+5wSxxdwBysvNhkVtJ/uPcCWqi9/Xs7cDuYKSzTUrutDDWv8xlcW +3rHGklsxTKesw/akzbjtL4U81cXVSDIV0IgWiLmXSBroFWge7/29t2iqNVS6Q8gZNLk vjyw== X-Gm-Message-State: APjAAAVbLdr5fRS/XENLovbA8EEK/yf/bMUPBu+a1mOf4o8/vn0eBH6X C8zbHUJ+I1dnp5obPoLdA/OIJTK3 X-Google-Smtp-Source: APXvYqxIQ9cqfH7RI3mJ1fr0LrQrMf5AuK2daf5LccAlu0dHyhc3RFRUcckfFnE5foYF/S5SHoeD4g== X-Received: by 2002:a05:600c:c4:: with SMTP id u4mr79101909wmm.96.1564049479205; Thu, 25 Jul 2019 03:11:19 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id t13sm60929426wrr.0.2019.07.25.03.11.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 25 Jul 2019 03:11:18 -0700 (PDT) Date: Thu, 25 Jul 2019 03:11:18 -0700 (PDT) X-Google-Original-Date: Thu, 25 Jul 2019 10:11:06 GMT Message-Id: <3196413c2af972f5ba9745b6bc9f2f9e764e8116.1564049473.git.gitgitgadget@gmail.com> In-Reply-To: References: From: "Johannes Schindelin via GitGitGadget" Subject: [PATCH 05/12] t3427: fix erroneous assumption Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Junio C Hamano , Johannes Schindelin Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Johannes Schindelin Apart from the `setup` test case, `t3427-rebase-subtree.sh` is made up exclusively of demonstrations of breakages. The tricky thing about such demonstrations is that they are often buggy themselves. In this instance, somewhere over the course of the six iterations of the patch that eventually made it into Git's `master` as 5f35900849e (contrib/subtree: Add a test for subtree rebase that loses commits, 2016-06-28), the commit message "files_subtree/master4" was changed to just "master4", but the test cases still expected the old commit message. Let's fix this, at long last. Signed-off-by: Johannes Schindelin --- t/t3427-rebase-subtree.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/t/t3427-rebase-subtree.sh b/t/t3427-rebase-subtree.sh index 7d3ba766de..8c4ddd3408 100755 --- a/t/t3427-rebase-subtree.sh +++ b/t/t3427-rebase-subtree.sh @@ -68,7 +68,7 @@ test_expect_failure 'Rebase -Xsubtree --preserve-merges --onto commit' ' reset_rebase && git checkout -b rebase-preserve-merges to-rebase && git rebase -Xsubtree=files_subtree --preserve-merges --onto files-master master && - verbose test "$(commit_message HEAD~)" = "files_subtree/master4" && + verbose test "$(commit_message HEAD~)" = "master4" && verbose test "$(commit_message HEAD)" = "files_subtree/master5" ' @@ -77,7 +77,7 @@ test_expect_failure 'Rebase -Xsubtree --keep-empty --preserve-merges --onto comm reset_rebase && git checkout -b rebase-keep-empty to-rebase && git rebase -Xsubtree=files_subtree --keep-empty --preserve-merges --onto files-master master && - verbose test "$(commit_message HEAD~2)" = "files_subtree/master4" && + verbose test "$(commit_message HEAD~2)" = "master4" && verbose test "$(commit_message HEAD~)" = "files_subtree/master5" && verbose test "$(commit_message HEAD)" = "Empty commit" ' @@ -87,7 +87,7 @@ test_expect_failure 'Rebase -Xsubtree --onto commit' ' reset_rebase && git checkout -b rebase-onto to-rebase && git rebase -Xsubtree=files_subtree --onto files-master master && - verbose test "$(commit_message HEAD~2)" = "files_subtree/master4" && + verbose test "$(commit_message HEAD~2)" = "master4" && verbose test "$(commit_message HEAD~)" = "files_subtree/master5" && verbose test "$(commit_message HEAD)" = "Empty commit" ' From patchwork Thu Jul 25 10:11:19 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Cai via GitGitGadget X-Patchwork-Id: 11058487 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 746921398 for ; Thu, 25 Jul 2019 10:11:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 63E05288AE for ; Thu, 25 Jul 2019 10:11:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 57CAA28906; Thu, 25 Jul 2019 10:11:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E4B51288AE for ; Thu, 25 Jul 2019 10:11:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388644AbfGYKLW (ORCPT ); Thu, 25 Jul 2019 06:11:22 -0400 Received: from mail-wr1-f65.google.com ([209.85.221.65]:39582 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388446AbfGYKLV (ORCPT ); Thu, 25 Jul 2019 06:11:21 -0400 Received: by mail-wr1-f65.google.com with SMTP id x4so50075145wrt.6 for ; Thu, 25 Jul 2019 03:11:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:message-id:in-reply-to:references:from:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=Q3GR+HmC4hanNi6lsfFbMIJErTjBCcGre4Jjgg3o/LM=; b=EaP+uesEqU3uWG4fq7yw5mtCKmt+pnQaIxNPs+qoErXbdnc7yesVmciHs7YaPoS4jy EDxg6haji0PPQ0D+lweYOiHhu1nbnh+6b5fRZGsfIuGNwt8oeey9JOrdUX6Bf/2Z0xzg KtQik/p/2RAP8+tl7Xx0HU+8F/NbQfw2nqF5Jy2jAm2Wqe46uiCIwbQr5mEpvlBJDPmH MI7yqPI9gun9tuyVx44fzOinb949ppyRL9cnqnx3ZPLGeuDR7CTr0vEw1rT5udnqochL CBn1AkSaIv+ab4V+uPgIgTso68oe8fe35HhQmX/bB7kVVvaFWXBS/0B+HzmaeHyWO8d7 7oog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:message-id:in-reply-to:references:from :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=Q3GR+HmC4hanNi6lsfFbMIJErTjBCcGre4Jjgg3o/LM=; b=nd9d/EVhxXOAAthGcDzCQMqzjB9h5yJch+RQqbAe2AgPP0YpdevSV8PNeyKnXKxeKI NQl75zoemFjIcnh5QK75JGJtsIGF/kOxlnOziIwMxiGbeny4rhDb751quyPQ6KqgvsPt fwJqytxHhmyQPwVJSx/FJYBw3aDbMsS41Ux+dtNgozj40RvcDhB/tKTfXqy8YJWUuhlt esmZh3q+Rbqp1bg3I4KzVRoHhYIuMaHRg2ScLvRtzS4GdNk5sLwpWaBnrsWxTcyN3tik dXTgSHBUbimrifxt3tmtseEoYB3Krhi+9+CXpK2AnBRaY/2wSExU6423ahZk7maLhiU1 ewhg== X-Gm-Message-State: APjAAAXkuHy9KkODRzLSMx34eQpPm5E7NRXo+wBmR+fuLyLo4mfK8NOG 7U8X8uUZPRrEErf34Wew2YX7orDD X-Google-Smtp-Source: APXvYqxz4utVHxw5EUj7v0+nNFjLkEUAb13Yy2JdMhR/FRfnlfcPaDKAU0AP/Q2DlsHdEGiU+KMnVA== X-Received: by 2002:adf:fd08:: with SMTP id e8mr96899767wrr.147.1564049479901; Thu, 25 Jul 2019 03:11:19 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id y6sm60632252wmd.16.2019.07.25.03.11.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 25 Jul 2019 03:11:19 -0700 (PDT) Date: Thu, 25 Jul 2019 03:11:19 -0700 (PDT) X-Google-Original-Date: Thu, 25 Jul 2019 10:11:07 GMT Message-Id: <261825fe442a428ea0724ab6ae9d8d351bda8d3e.1564049473.git.gitgitgadget@gmail.com> In-Reply-To: References: From: "Johannes Schindelin via GitGitGadget" Subject: [PATCH 06/12] t3427: accommodate for the `rebase --merge` backend having been replaced Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Junio C Hamano , Johannes Schindelin Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Johannes Schindelin Since 68aa495b590 (rebase: implement --merge via the interactive machinery, 2018-12-11), the job of the old `--merge` backend is now performed by the `--interactive` backend, too. One consequence is that empty commits are no longer rebased by default. Meaning that the test case that calls `git rebase -Xsubtree` (which used to be handled by the `--merge` backend) now needs to ask explicitly for the empty commit to be rebased. Signed-off-by: Johannes Schindelin --- t/t3427-rebase-subtree.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/t/t3427-rebase-subtree.sh b/t/t3427-rebase-subtree.sh index 8c4ddd3408..b490919c60 100755 --- a/t/t3427-rebase-subtree.sh +++ b/t/t3427-rebase-subtree.sh @@ -83,10 +83,10 @@ test_expect_failure 'Rebase -Xsubtree --keep-empty --preserve-merges --onto comm ' # FAILURE: fatal: Could not parse object -test_expect_failure 'Rebase -Xsubtree --onto commit' ' +test_expect_failure 'Rebase -Xsubtree --keep-empty --onto commit' ' reset_rebase && git checkout -b rebase-onto to-rebase && - git rebase -Xsubtree=files_subtree --onto files-master master && + git rebase -Xsubtree=files_subtree --keep-empty --onto files-master master && verbose test "$(commit_message HEAD~2)" = "master4" && verbose test "$(commit_message HEAD~)" = "files_subtree/master5" && verbose test "$(commit_message HEAD)" = "Empty commit" From patchwork Thu Jul 25 10:11:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Cai via GitGitGadget X-Patchwork-Id: 11058475 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 333E013B1 for ; Thu, 25 Jul 2019 10:11:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 22E1E288AE for ; Thu, 25 Jul 2019 10:11:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 17B2328906; Thu, 25 Jul 2019 10:11:27 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D910B288F1 for ; Thu, 25 Jul 2019 10:11:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388814AbfGYKLZ (ORCPT ); Thu, 25 Jul 2019 06:11:25 -0400 Received: from mail-wm1-f68.google.com ([209.85.128.68]:38837 "EHLO mail-wm1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388564AbfGYKLW (ORCPT ); Thu, 25 Jul 2019 06:11:22 -0400 Received: by mail-wm1-f68.google.com with SMTP id s15so22835576wmj.3 for ; Thu, 25 Jul 2019 03:11:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:message-id:in-reply-to:references:from:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=rPjjuxUAFqGC56EbsBer9zgdLNLAF/xY3UD9zzLTYRM=; b=hUmg7edf+hpOlJMvrRKV7coWouBV/l5oGP8PETWiLTaWYLQxajpfMVBI6x24cSH9n5 VNkAtVJQp1EFl9IUEYmyKzd5JMS3y9nx/XFQL9ZsVN7tD6Q0wWSY9pTmIEPZoR+PSkJQ V0sFkcwV7h8HPYo3Fcd79DO0DToQDhwwwyAl+qE20JFgTUEIoXbOM4jDV1OVZIKq/6sf WizRZLZglWgjuj6Xmk+0E20u2S/FyNfFj+NOMj9pdbKww/0NelnNrg5yZYq4KIP7wfEe aPvso2GUq91dSogyJegu7HwEpU6/mmseQZmdAQ7DrLMEvSdAufSGJZSt+pOiDN3TkobA BU0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:message-id:in-reply-to:references:from :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=rPjjuxUAFqGC56EbsBer9zgdLNLAF/xY3UD9zzLTYRM=; b=Een61x3sM+FAy4PEpApzKnAM0NQgWofKD0O3hGWfTtmHPn9Dj8T622s1ho+og0xksM z4CWgFebVUVCznVswewwh9MZotkckQEELZNPFcFzq0tluOYe7MK3rZ986wvooUPae25y EH9lXjSPKU0aMyBME+gMtKgyGTfqMwjQGYAPzNiEcDqHvfH/mJ/rQDVCphnyD07CGJWb AGQgGz+M5UY2hdkQ8pWy+mtvS30x8hXZzc+aB3OdIEywN2vy9ht0OkzFttBrE0gwIIjv 7xb0BmKomzJgsMXOvk2nvGWktZcSmAS8qPaXI5JZI85Mb2t0tk4dNv9QnJ13McBuPVZ2 vSLg== X-Gm-Message-State: APjAAAXlH5F+ve9UvNpMGS5uPzih22rXi8/a2+HO3eAa9QpCs68oMVd6 GW958F45prWo86u925w0UIB084uH X-Google-Smtp-Source: APXvYqytQGVd5RR/wNXUx/IqqEIi9u7RS132dFpnvWn4UhZ65TzTTC8K2M+6Llfal2NxN3kXWzd+oA== X-Received: by 2002:a1c:a6d3:: with SMTP id p202mr80836704wme.26.1564049480665; Thu, 25 Jul 2019 03:11:20 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id b8sm62551862wmh.46.2019.07.25.03.11.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 25 Jul 2019 03:11:20 -0700 (PDT) Date: Thu, 25 Jul 2019 03:11:20 -0700 (PDT) X-Google-Original-Date: Thu, 25 Jul 2019 10:11:08 GMT Message-Id: In-Reply-To: References: From: "Johannes Schindelin via GitGitGadget" Subject: [PATCH 07/12] t3427: fix another incorrect assumption Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Junio C Hamano , Johannes Schindelin Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Johannes Schindelin The test case that concerns `git rebase -Xsubtree` (with the default rebase backend, not with `--preserve-merges`) starts out with a pre-rebase commit history that begins with a commit that introduces three files: master1.t, master2.t and master3.t. This commit was generated by passing a subtree merge commit through `git filter-branch --subdirectory-filter`, so it looks as if this commit really introduces all those files. The commit history onto which this commit is then rebased, however, introduced those files in individual commits. For that reason, the rebase will fail, it _must_ fail, because the first `pick` results in no changes to be committed. Let's fix the test case to expect exactly this situation. With this change, we can mark the original bug that this test case tried to demonstrate as fixed. Signed-off-by: Johannes Schindelin --- t/t3427-rebase-subtree.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/t/t3427-rebase-subtree.sh b/t/t3427-rebase-subtree.sh index b490919c60..c0ff3241e4 100755 --- a/t/t3427-rebase-subtree.sh +++ b/t/t3427-rebase-subtree.sh @@ -82,11 +82,12 @@ test_expect_failure 'Rebase -Xsubtree --keep-empty --preserve-merges --onto comm verbose test "$(commit_message HEAD)" = "Empty commit" ' -# FAILURE: fatal: Could not parse object -test_expect_failure 'Rebase -Xsubtree --keep-empty --onto commit' ' +test_expect_success 'Rebase -Xsubtree --keep-empty --onto commit' ' reset_rebase && git checkout -b rebase-onto to-rebase && - git rebase -Xsubtree=files_subtree --keep-empty --onto files-master master && + test_must_fail git rebase -Xsubtree=files_subtree --keep-empty --onto files-master master && + : first pick results in no changes && + git rebase --continue && verbose test "$(commit_message HEAD~2)" = "master4" && verbose test "$(commit_message HEAD~)" = "files_subtree/master5" && verbose test "$(commit_message HEAD)" = "Empty commit" From patchwork Thu Jul 25 10:11:20 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Cai via GitGitGadget X-Patchwork-Id: 11058483 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B16C413B1 for ; Thu, 25 Jul 2019 10:11:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9FADE288AE for ; Thu, 25 Jul 2019 10:11:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 93D1728931; Thu, 25 Jul 2019 10:11:31 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6EEC6288AE for ; Thu, 25 Jul 2019 10:11:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388929AbfGYKL2 (ORCPT ); Thu, 25 Jul 2019 06:11:28 -0400 Received: from mail-wr1-f65.google.com ([209.85.221.65]:33047 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388598AbfGYKLX (ORCPT ); Thu, 25 Jul 2019 06:11:23 -0400 Received: by mail-wr1-f65.google.com with SMTP id n9so50214043wru.0 for ; Thu, 25 Jul 2019 03:11:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:message-id:in-reply-to:references:from:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=fQ1jpV5hXG3+KClOooYJ0y0WP14LqHDEEcYhh/tCaRc=; b=jrUOJGs7pkNdf5UePHb4RRFE/CSUYWOJ+8Gqp5Xcn6DJ8DpR8xwqY8t3WeB7fwYiGz JDWi8t/t2SnD1wuLeLZnsn1qmmDHkM4aVkHuKyCTsHznf0QcajS+IR+8CMAsNvCRQo1g rEIvyilr5/TXf8h6GcMl5zbtVmhnSQJap+QHA7+2XqvjM+YeEFpHgoBz2UH8zrUYcM/c QLwbxFi2HasqaRtiKjiliL1YYRpVGHWtUT7d8mpUyVWyRbyBvBeYCeO0c7zaj+CaLMTu 2p8F2HiP0XP/efK375+td3CF2F6HDtY18T4IW1iFNDzuSUPVnaFo18CNz1+fy1R35NqD zWjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:message-id:in-reply-to:references:from :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=fQ1jpV5hXG3+KClOooYJ0y0WP14LqHDEEcYhh/tCaRc=; b=DgoucaN24kDYNjZKKSile8f+BxwJ4bLTfPnexWLhEchBC5zF4JO2c0z7qU1ZU+U1GI 4LrePZgcvMXAp1Q+w2FR/QxlwEY8V323pkLARA7mddcxNixilXXmJSyC8xQoFNkpfwJm B0JV+xDgn/jzs4uPJJLmELgUOBdfqd2DqPN7fd2ucKrNLSRc37HxnwV4Ty1uxYnw/8jH XIFUS1DDkAzkKYDsoxufubUieVWRpkBKCv/hFjUafcMi28YWKwDtu2gQPtSKOiMhRJN/ xQI+iHfVNwu2ETDKA+A7X90Y0mujUt3SMGni7RXs1VeJHrt1waEzjGjfRzHOacBF3zE9 +FBg== X-Gm-Message-State: APjAAAWDI72BEhU/DZZJvQuZzkooWVWN5097FCB3HW/mr1YzqOBrV5pE BBvS/X/QBFsnTXbSYUVdAB22oYoV X-Google-Smtp-Source: APXvYqxZuGeAqrU06JNtGlv3A+BINGlW8sujEqpUT/wCeSmhVYdsCIlmhOYAZkAwJjmXaduBIvtlWA== X-Received: by 2002:adf:e40e:: with SMTP id g14mr12019399wrm.161.1564049481369; Thu, 25 Jul 2019 03:11:21 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id z1sm49927053wrp.51.2019.07.25.03.11.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 25 Jul 2019 03:11:20 -0700 (PDT) Date: Thu, 25 Jul 2019 03:11:20 -0700 (PDT) X-Google-Original-Date: Thu, 25 Jul 2019 10:11:09 GMT Message-Id: <7f60b8e745bd1e1c556c28510ee4211e975d9b6a.1564049474.git.gitgitgadget@gmail.com> In-Reply-To: References: From: "Johannes Schindelin via GitGitGadget" Subject: [PATCH 08/12] t3427: mark two test cases as requiring support for `git rebase -p` Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Junio C Hamano , Johannes Schindelin Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Johannes Schindelin To prepare for the long game, where the `--preserve-merges` backend will be dropped eventually, we already introduced the `REBASE_P` prerequisite to allow saving time by skipping the now-almost-pointless test cases that verify that that backend works as expected. Due to the nature of the tests in t3427 (`test_expect_failure` is happy as long as the scriptlet fails, whether it is for the intended reason or because `git-rebase--preserve-merges.sh` was deleted), these two test cases were missed. When running with GIT_TEST_SKIP_REBASE_P=OhYesPlease, this drops the overall run time of t3427 on this developer's machine from ~28s to ~8.5s. Signed-off-by: Johannes Schindelin --- t/t3427-rebase-subtree.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/t/t3427-rebase-subtree.sh b/t/t3427-rebase-subtree.sh index c0ff3241e4..7a37235768 100755 --- a/t/t3427-rebase-subtree.sh +++ b/t/t3427-rebase-subtree.sh @@ -64,7 +64,7 @@ test_expect_success 'setup' ' ' # FAILURE: Does not preserve master4. -test_expect_failure 'Rebase -Xsubtree --preserve-merges --onto commit' ' +test_expect_failure REBASE_P 'Rebase -Xsubtree --preserve-merges --onto commit' ' reset_rebase && git checkout -b rebase-preserve-merges to-rebase && git rebase -Xsubtree=files_subtree --preserve-merges --onto files-master master && @@ -73,7 +73,7 @@ test_expect_failure 'Rebase -Xsubtree --preserve-merges --onto commit' ' ' # FAILURE: Does not preserve master4. -test_expect_failure 'Rebase -Xsubtree --keep-empty --preserve-merges --onto commit' ' +test_expect_failure REBASE_P 'Rebase -Xsubtree --keep-empty --preserve-merges --onto commit' ' reset_rebase && git checkout -b rebase-keep-empty to-rebase && git rebase -Xsubtree=files_subtree --keep-empty --preserve-merges --onto files-master master && From patchwork Thu Jul 25 10:11:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Cai via GitGitGadget X-Patchwork-Id: 11058477 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6669B17EF for ; Thu, 25 Jul 2019 10:11:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 54BE3288AE for ; Thu, 25 Jul 2019 10:11:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4960B288F1; Thu, 25 Jul 2019 10:11:27 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AA3F828948 for ; Thu, 25 Jul 2019 10:11:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388845AbfGYKLZ (ORCPT ); Thu, 25 Jul 2019 06:11:25 -0400 Received: from mail-wr1-f68.google.com ([209.85.221.68]:46802 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388628AbfGYKLY (ORCPT ); Thu, 25 Jul 2019 06:11:24 -0400 Received: by mail-wr1-f68.google.com with SMTP id z1so50093593wru.13 for ; Thu, 25 Jul 2019 03:11:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:message-id:in-reply-to:references:from:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=b9Vd5lQ92BHgCYhkory5LXdpc0y2dVPAGYbbQWvGUjg=; b=nj66U+FT4yplMJYXMQ7ti3olrExAWgrnibtbt36U8M0qiFvJ8KVyJ2NwuS4NMkaifU jhU5Mk4Ygj1PQIxk9eU1WxR+WPGUIfIMeYaivRyb79TPBqFBNFSZi+UwirGzX4YgTC9z Jnr2MIrvYx4zlT6rumcilg+IzEN5E5Ep2/7qSEELm288kEy9GTbRrshg9XDkmeVKbi3A 9T0g8uZhWcyB1KDdeu8MNMWKsxfzPSaHFXP4WX2DWQODaVmhZx2ZD9vtXOvlb6tUQDji yqecIizjfP5tRRbiastQ2T93/5MDR8s1meW5ygPdLYL6Kww9ofW24WWtuTNbt1UNUahi j3+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:message-id:in-reply-to:references:from :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=b9Vd5lQ92BHgCYhkory5LXdpc0y2dVPAGYbbQWvGUjg=; b=WBrQcQHwpblg8R66TqULDHEake6ksADKgYk2ofvy10TXmQ/xQfRiAquHjcIP7XkdlJ inxp6LJnRWC4fo498qHap4GkKHEFacSp8vHrEPf3kxH92w1grS0SCsC7KQqK3rTEeClz E69kk/8fIbp7DcauhFUPhUCdQn0if3J4uCKN29kQdIMPBvLLKIQ2k6rbEJl6MTcnHz0d aZbbzN6mJdzTWlg1ddVjt95xpLguFQryK5HI/drW21YiDiSFaftLOw/YrSsUu+cqKMOD QCNdIXKkYSEb+40cuA5RultukeU1RMieHU5Pk2gDCQxeNHCRDFpAyj37dYAuflygwXM0 taNA== X-Gm-Message-State: APjAAAXjPfFfNzpLS0CTa4PSNPsWVfQyGtidrsetzFlfU4H2AzJbwZFw pnTfuh7ju8WZpuziwwD76c3hTvlD X-Google-Smtp-Source: APXvYqxcBGHWQlnNQoNX1FXZX5RFHq9EuOwd1YS01dLVqXA5jaGlv1sWrmeDFHoBizM8x7X0afv2Eg== X-Received: by 2002:a5d:4e8a:: with SMTP id e10mr11524150wru.26.1564049482060; Thu, 25 Jul 2019 03:11:22 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id p3sm40831028wmg.15.2019.07.25.03.11.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 25 Jul 2019 03:11:21 -0700 (PDT) Date: Thu, 25 Jul 2019 03:11:21 -0700 (PDT) X-Google-Original-Date: Thu, 25 Jul 2019 10:11:10 GMT Message-Id: <30405df99ff38466987e64c1dea007ff6fb9b8c8.1564049474.git.gitgitgadget@gmail.com> In-Reply-To: References: From: "Johannes Schindelin via GitGitGadget" Subject: [PATCH 09/12] rebase -r: support merge strategies other than `recursive` Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Junio C Hamano , Johannes Schindelin Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Johannes Schindelin We already support merge strategies in the sequencer, but only for `pick` commands. With this commit, we now also support them in `merge` commands. The approach is simple: if any merge strategy option is specified, or if any merge strategy other than `recursive` is specified, we simply spawn the `git merge` command. Otherwise, we handle the merge in-process just as before. Signed-off-by: Johannes Schindelin --- Documentation/git-rebase.txt | 2 -- builtin/rebase.c | 9 --------- sequencer.c | 14 ++++++++++++-- t/t3422-rebase-incompatible-options.sh | 10 ---------- t/t3430-rebase-merges.sh | 21 +++++++++++++++++++++ 5 files changed, 33 insertions(+), 23 deletions(-) diff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt index f5e6ae3907..f67f96425c 100644 --- a/Documentation/git-rebase.txt +++ b/Documentation/git-rebase.txt @@ -543,8 +543,6 @@ In addition, the following pairs of options are incompatible: * --preserve-merges and --interactive * --preserve-merges and --signoff * --preserve-merges and --rebase-merges - * --rebase-merges and --strategy - * --rebase-merges and --strategy-option BEHAVIORAL DIFFERENCES ----------------------- diff --git a/builtin/rebase.c b/builtin/rebase.c index 9c52144fc4..c1ea617125 100644 --- a/builtin/rebase.c +++ b/builtin/rebase.c @@ -1815,15 +1815,6 @@ int cmd_rebase(int argc, const char **argv, const char *prefix) "'--reschedule-failed-exec'")); } - if (options.rebase_merges) { - if (strategy_options.nr) - die(_("cannot combine '--rebase-merges' with " - "'--strategy-option'")); - if (options.strategy) - die(_("cannot combine '--rebase-merges' with " - "'--strategy'")); - } - if (!options.root) { if (argc < 1) { struct branch *branch; diff --git a/sequencer.c b/sequencer.c index 334de14542..d228448cd8 100644 --- a/sequencer.c +++ b/sequencer.c @@ -3256,6 +3256,9 @@ static int do_merge(struct repository *r, struct commit *head_commit, *merge_commit, *i; struct commit_list *bases, *j, *reversed = NULL; struct commit_list *to_merge = NULL, **tail = &to_merge; + const char *strategy = !opts->xopts_nr && + (!opts->strategy || !strcmp(opts->strategy, "recursive")) ? + NULL : opts->strategy; struct merge_options o; int merge_arg_len, oneline_offset, can_fast_forward, ret, k; static struct lock_file lock; @@ -3404,7 +3407,7 @@ static int do_merge(struct repository *r, goto leave_merge; } - if (to_merge->next) { + if (strategy || to_merge->next) { /* Octopus merge */ struct child_process cmd = CHILD_PROCESS_INIT; @@ -3418,7 +3421,14 @@ static int do_merge(struct repository *r, cmd.git_cmd = 1; argv_array_push(&cmd.args, "merge"); argv_array_push(&cmd.args, "-s"); - argv_array_push(&cmd.args, "octopus"); + if (!strategy) + argv_array_push(&cmd.args, "octopus"); + else { + argv_array_push(&cmd.args, strategy); + for (k = 0; k < opts->xopts_nr; k++) + argv_array_pushf(&cmd.args, + "-X%s", opts->xopts[k]); + } argv_array_push(&cmd.args, "--no-edit"); argv_array_push(&cmd.args, "--no-ff"); argv_array_push(&cmd.args, "--no-log"); diff --git a/t/t3422-rebase-incompatible-options.sh b/t/t3422-rebase-incompatible-options.sh index bb78a6ec86..596caf168a 100755 --- a/t/t3422-rebase-incompatible-options.sh +++ b/t/t3422-rebase-incompatible-options.sh @@ -75,14 +75,4 @@ test_expect_success '--preserve-merges incompatible with --rebase-merges' ' test_must_fail git rebase --preserve-merges --rebase-merges A ' -test_expect_success '--rebase-merges incompatible with --strategy' ' - git checkout B^0 && - test_must_fail git rebase --rebase-merges -s resolve A -' - -test_expect_success '--rebase-merges incompatible with --strategy-option' ' - git checkout B^0 && - test_must_fail git rebase --rebase-merges -Xignore-space-change A -' - test_done diff --git a/t/t3430-rebase-merges.sh b/t/t3430-rebase-merges.sh index 42ba5b9f09..8ea6ff3548 100755 --- a/t/t3430-rebase-merges.sh +++ b/t/t3430-rebase-merges.sh @@ -412,4 +412,25 @@ test_expect_success '--continue after resolving conflicts after a merge' ' test_path_is_missing .git/MERGE_HEAD ' +test_expect_success '--rebase-merges with strategies' ' + git checkout -b with-a-strategy F && + test_tick && + git merge -m "Merge conflicting-G" conflicting-G && + + : first, test with a merge strategy option && + git rebase -ir -Xtheirs G && + echo conflicting-G >expect && + test_cmp expect G.t && + + : now, try with a merge strategy other than recursive && + git reset --hard @{1} && + write_script git-merge-override <<-\EOF && + echo overridden$1 >>G.t + git add G.t + EOF + PATH="$PWD:$PATH" git rebase -ir -s override -Xxopt G && + test_write_lines G overridden--xopt >expect && + test_cmp expect G.t +' + test_done From patchwork Thu Jul 25 10:11:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Cai via GitGitGadget X-Patchwork-Id: 11058479 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 773C81398 for ; Thu, 25 Jul 2019 10:11:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 62D20288AE for ; Thu, 25 Jul 2019 10:11:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5340028931; Thu, 25 Jul 2019 10:11:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E0DAF288AE for ; Thu, 25 Jul 2019 10:11:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388941AbfGYKL2 (ORCPT ); Thu, 25 Jul 2019 06:11:28 -0400 Received: from mail-wr1-f68.google.com ([209.85.221.68]:40364 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388724AbfGYKLY (ORCPT ); Thu, 25 Jul 2019 06:11:24 -0400 Received: by mail-wr1-f68.google.com with SMTP id r1so50109320wrl.7 for ; Thu, 25 Jul 2019 03:11:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:message-id:in-reply-to:references:from:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=/O2s2QmVE2pCrDqftaWxp9ULgojs/bvEB6pHGy1iFh8=; b=DurkFjk/E6eJ70K3BEDFvAtXA5n/6nQWs9jl/RCJTLrXnTBBAsV5KsE9087LtYWYgz oXihFj1t9TswPe3CNfyCrYX3OTeEYl8r94aVjlKWfVjlTvbs8JHD25w2HCAr+PeFvy/P gEkab2RZSvMJPo9Hz8mlxIVylMilquS9S+vzbkD/9ZvJYhiXfie3Ow/d/RmHiWTSJrVc 9iBzFdtCXaRgDIQK+9olBUeAk8AQ4MQ8m2sBxvF5DR4PrpU7S6/ZncHFjM33zA+LCnM/ QNVPN+HiVXUJqgbF95jIhW5WJkpPPc8F0XfzOxLucKxRWMu+kMkmHi3jBR2E3XgS3Yf6 5sSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:message-id:in-reply-to:references:from :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=/O2s2QmVE2pCrDqftaWxp9ULgojs/bvEB6pHGy1iFh8=; b=POkI/f7YKanuwuPYUmEnBxwzRT3uRUr15epoLUcXaYFbcgPuXlOZm3tSNpN/fqdC/n 5OfqqpoLuFOXoPO3WqJ/wMp3rwAOEZJLEXrK/8e7DLTujBmSbtT1NwqxLqE/djbG9vpF uPrOa4CzTG+0l8GNV5NW0N+oEU/SEjKjy87iIzNrqJlret8CWTNBjsHBhJvzJ4CrnHmr shCwoOU8CW6XClOp8bhBMHaMV5KqQwmm7oGSkitLqCeH0Y/+nCvphBqKekwRWWHiTrxI eDTq9djDR7GSsT5n9rQWbiej8Jl3FNm2hT1kXWWx35EXk0ONy+qit2i+mo0p0By7njdf TLKQ== X-Gm-Message-State: APjAAAViAYz2QiWuHy+RVv+2pkbk2GXLkM68y1yzZusJLXix7gh38rBY MqbIDIY87kicU8RLvoF0M/gqgxpk X-Google-Smtp-Source: APXvYqwQedtKQaPcv1VJ1KYa8BbW5U7188j/gwQDLynofPzi1QyxPuBl3bCGLFQrvcA/bBdQm77hmg== X-Received: by 2002:adf:8bc2:: with SMTP id w2mr10929882wra.7.1564049482798; Thu, 25 Jul 2019 03:11:22 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id g17sm36168164wrm.7.2019.07.25.03.11.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 25 Jul 2019 03:11:22 -0700 (PDT) Date: Thu, 25 Jul 2019 03:11:22 -0700 (PDT) X-Google-Original-Date: Thu, 25 Jul 2019 10:11:11 GMT Message-Id: In-Reply-To: References: From: "Johannes Schindelin via GitGitGadget" Subject: [PATCH 10/12] t/lib-rebase: prepare for testing `git rebase --rebase-merges` Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Junio C Hamano , Johannes Schindelin Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Johannes Schindelin The format of the todo list is quite a bit different in the `--rebase-merges` mode; Let's prepare the fake editor to handle those todo lists properly, too. Signed-off-by: Johannes Schindelin --- t/lib-rebase.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/t/lib-rebase.sh b/t/lib-rebase.sh index 7ea30e5006..662a958575 100644 --- a/t/lib-rebase.sh +++ b/t/lib-rebase.sh @@ -44,10 +44,10 @@ set_fake_editor () { rm -f "$1" echo 'rebase -i script before editing:' cat "$1".tmp - action=pick + action=\& for line in $FAKE_LINES; do case $line in - pick|p|squash|s|fixup|f|edit|e|reword|r|drop|d) + pick|p|squash|s|fixup|f|edit|e|reword|r|drop|d|label|l|reset|r|merge|m) action="$line";; exec_*|x_*|break|b) echo "$line" | sed 's/_/ /g' >> "$1";; @@ -61,8 +61,8 @@ set_fake_editor () { echo "$action XXXXXXX False commit" >> "$1" action=pick;; *) - sed -n "${line}s/^pick/$action/p" < "$1".tmp >> "$1" - action=pick;; + sed -n "${line}s/^[a-z][a-z]*/$action/p" < "$1".tmp >> "$1" + action=\&;; esac done echo 'rebase -i script after editing:' From patchwork Thu Jul 25 10:11:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Cai via GitGitGadget X-Patchwork-Id: 11058485 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D322C1580 for ; Thu, 25 Jul 2019 10:11:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C21F0288F1 for ; Thu, 25 Jul 2019 10:11:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B64F9288AE; Thu, 25 Jul 2019 10:11:31 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 499CC288F1 for ; Thu, 25 Jul 2019 10:11:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388922AbfGYKL1 (ORCPT ); Thu, 25 Jul 2019 06:11:27 -0400 Received: from mail-wr1-f45.google.com ([209.85.221.45]:34844 "EHLO mail-wr1-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388781AbfGYKLZ (ORCPT ); Thu, 25 Jul 2019 06:11:25 -0400 Received: by mail-wr1-f45.google.com with SMTP id y4so50146770wrm.2 for ; Thu, 25 Jul 2019 03:11:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:message-id:in-reply-to:references:from:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=CtvvfYhgHWuUdEUTYi70g5UR7x+H96DzbzyHvJ14ZZk=; b=RQwzVIyr8TlLkv6dnneascZEDFS6SAdeAHfkBMp5+7joISr7Vqykxhb2HeVm3HsnmA ARyUoJwvjBMqCvpxtyy3TfMlzoEuIeIG7cVxtOZm/82LeYI3qq3HV/8U5dQyWpMUARXr uv09+isT5GFXPqmPFGmjIOoUcSJKp1+OmODQxoGodMwe79c64UXKhw4esQ7zrK/Qfl55 hClpP22Pn4ZZCFZH0KOBMfIXLVAD0I9qDN7OI3qhpfw+onONAdsJ8LbaVupcfA7yXEP8 gclao2WnoOf412zRdhxW3NiOJ6ZVqB/n96IwWSKG9uC46SE+7MtbdqTVyAMbI0YRIGmX ySqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:message-id:in-reply-to:references:from :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=CtvvfYhgHWuUdEUTYi70g5UR7x+H96DzbzyHvJ14ZZk=; b=VPw+HshTBiPk+bFHX2PheV9mVulvleGGf8PuhAmacFujSHxu3mbDVwBR6Xxfh5nl+7 mdy3+5uw2r/Q4IIL5VG0GAmb8BXuy38Q+8crorhstbqlQH48PpRBpzjObPv++8HLlPlU 3IloqDv/4pj7fxiBL16+9Pn0xTjYcO4OkiyDR6kvm/Keo/LLA7Ez9oMIieiFsAU/wSXB HE0tYRXzRutM0NyRxM9NBg+yLAW3F74cR33XDb5W8RtKC/iVplK5lS7CCKZ2BOw0pjom kBDfqJ/eL5yA60t5Bevq05P3F2bc/ybHlv+WOW60bT9TjrSQK1r6YYbiv5FhDcIaRMjp wggA== X-Gm-Message-State: APjAAAVlYCJqm+qC6k7c9we/dt+Qzj0DDPbf4AXD9Dy8v1/adeiiaK4Y QXvJRFuvcEJabJV6xGhX2CuLO6lZ X-Google-Smtp-Source: APXvYqzglpDFVs4PwZYrq8UitvPq/84wOZWjWWbUpadJZhqllDsGRiyQ6fLgZeY1tcyNjo3jcUxFCA== X-Received: by 2002:adf:dfc4:: with SMTP id q4mr91858447wrn.54.1564049483489; Thu, 25 Jul 2019 03:11:23 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id f204sm71892533wme.18.2019.07.25.03.11.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 25 Jul 2019 03:11:23 -0700 (PDT) Date: Thu, 25 Jul 2019 03:11:23 -0700 (PDT) X-Google-Original-Date: Thu, 25 Jul 2019 10:11:12 GMT Message-Id: In-Reply-To: References: From: "Johannes Schindelin via GitGitGadget" Subject: [PATCH 11/12] t3418: test `rebase -r` with merge strategies Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Junio C Hamano , Johannes Schindelin Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Johannes Schindelin There is a test case in this script that verifies that `git rebase --preserve-merges` works all right with non-default merge strategies or non-default merge strategy options. Now that `git rebase --rebase-merges` learned about merge strategies, let's copy-edit this test case to verify that that works as intended, too. Signed-off-by: Johannes Schindelin --- t/t3418-rebase-continue.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/t/t3418-rebase-continue.sh b/t/t3418-rebase-continue.sh index bdaa511bb0..fbf9addfd1 100755 --- a/t/t3418-rebase-continue.sh +++ b/t/t3418-rebase-continue.sh @@ -120,6 +120,20 @@ test_expect_success REBASE_P 'rebase passes merge strategy options correctly' ' git rebase --continue ' +test_expect_success 'rebase -r passes merge strategy options correctly' ' + rm -fr .git/rebase-* && + git reset --hard commit-new-file-F3-on-topic-branch && + test_commit merge-theirs && + git reset --hard HEAD^ && + test_commit some-other-commit && + test_tick && + git merge --no-ff merge-theirs && + FAKE_LINES="1 3 edit 4 5 7 8 9" git rebase -i -f -r -m \ + -s recursive --strategy-option=theirs HEAD~2 && + test_commit force-change-ours && + git rebase --continue +' + test_expect_success '--skip after failed fixup cleans commit message' ' test_when_finished "test_might_fail git rebase --abort" && git checkout -b with-conflicting-fixup && From patchwork Thu Jul 25 10:11:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Cai via GitGitGadget X-Patchwork-Id: 11058481 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EF21A1580 for ; Thu, 25 Jul 2019 10:11:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D9F04288AE for ; Thu, 25 Jul 2019 10:11:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CDF45288F1; Thu, 25 Jul 2019 10:11:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4862828906 for ; Thu, 25 Jul 2019 10:11:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388975AbfGYKL2 (ORCPT ); Thu, 25 Jul 2019 06:11:28 -0400 Received: from mail-wr1-f68.google.com ([209.85.221.68]:33054 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388602AbfGYKL1 (ORCPT ); Thu, 25 Jul 2019 06:11:27 -0400 Received: by mail-wr1-f68.google.com with SMTP id n9so50214229wru.0 for ; Thu, 25 Jul 2019 03:11:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:message-id:in-reply-to:references:from:subject:fcc :content-transfer-encoding:mime-version:to:cc; bh=uFnxawjxK4tSxebjalC2w2K/V4jScZleumkF8di6WZA=; b=Zj1EGX6/4GNYu5NFtuvkjCyHnxALekaQVi0t9YBltC9nrVbRjqaKe26gJ7/CbA/YuO gYu0yngUaKzF4wgFJgt2Rfr6D9nw9O8HLtwkkLMVNFPEallhv8ASQF/8p+E4SqMf/n3g W35d+eJJlnRJOLffQG6ZIGNoc6uZMwUyHhlSaPTDJxKmjwrShxdHDD1XmEII9eBxOIyn aEYiZiOVIQ+dlTNLMfg0zqQnKeRO3asfA7IMummrNYryjNg6Z3LVaDMQXFJkiwE3bqSg Ch95FJ6BvyFKDAGVMBbrsnH6Wqeq4sEJm5AKttGeZH92/+j1v02NF8n/Z4KLW+DbEWLk m8bw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:message-id:in-reply-to:references:from :subject:fcc:content-transfer-encoding:mime-version:to:cc; bh=uFnxawjxK4tSxebjalC2w2K/V4jScZleumkF8di6WZA=; b=MokkWHPz2jfMlQLkP5DCVWoehVyzHSiMdbOqEEx7JJJ9oHon9CDBZrB9pcIhKVpFdM 0wB6xzFLnaGEeEaH0GPgfeEHfM8tixNK2u3wWjXqvanX+MPLXyBQyNDyVQDFECP7ETX+ mVFnvAhflu3r/6HpsTzXE0n1e5YclmDF1OuuGnBirt7G78kYQ2jWkEHYodI2WUoyNCC0 g+CNZ4oHQPW6RUkfHJD/mY52p/sJSCkjJ2bH2VyaQ6cCDlg+tSlYiC/vMNTzHwHhy/4E 3TLMEHX/E4Ijf6bNkoZHATSUcvN4tXjtyeMXCL7BqCoaPHY5G2dauXzd8+xtpyNhv8gP AX9A== X-Gm-Message-State: APjAAAU8IeehITy9uyQSng+clK7yvUN2r4bM8fbI5PDOA/NsTvQEeMNu II5VftluUEp1lfQ6lS9vrVppG1VE X-Google-Smtp-Source: APXvYqxy7fccje77bnkkcSMV5KLMCpeNBn0bKEK9gF9RBBRI8CHZyk66KSFzEEN9ZqaewlZ1tqnvvA== X-Received: by 2002:adf:ea82:: with SMTP id s2mr87261244wrm.91.1564049484376; Thu, 25 Jul 2019 03:11:24 -0700 (PDT) Received: from [127.0.0.1] ([13.74.141.28]) by smtp.gmail.com with ESMTPSA id l9sm41210344wmh.36.2019.07.25.03.11.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 25 Jul 2019 03:11:23 -0700 (PDT) Date: Thu, 25 Jul 2019 03:11:23 -0700 (PDT) X-Google-Original-Date: Thu, 25 Jul 2019 10:11:13 GMT Message-Id: In-Reply-To: References: From: "Johannes Schindelin via GitGitGadget" Subject: [PATCH 12/12] rebase -r: do not (re-)generate root commits with `--root` *and* `--onto` Fcc: Sent MIME-Version: 1.0 To: git@vger.kernel.org Cc: Junio C Hamano , Johannes Schindelin Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Johannes Schindelin When rebasing a complete commit history onto a given commit, it is pretty obvious that the root commits should be rebased on top of said given commit. To test this, let's kill two birds with one stone and add a test case to t3427-rebase-subtree.sh that not only demonstrates that this works, but also that `git rebase -r` works with merge strategies now. Signed-off-by: Johannes Schindelin --- builtin/rebase.c | 7 +++++-- sequencer.c | 4 +++- sequencer.h | 6 ++++++ t/t3427-rebase-subtree.sh | 11 +++++++++++ 4 files changed, 25 insertions(+), 3 deletions(-) diff --git a/builtin/rebase.c b/builtin/rebase.c index c1ea617125..6a789c4421 100644 --- a/builtin/rebase.c +++ b/builtin/rebase.c @@ -62,7 +62,7 @@ struct rebase_options { const char *onto_name; const char *revisions; const char *switch_to; - int root; + int root, root_with_onto; struct object_id *squash_onto; struct commit *restrict_revision; int dont_finish_rebase; @@ -374,6 +374,7 @@ static int run_rebase_interactive(struct rebase_options *opts, flags |= abbreviate_commands ? TODO_LIST_ABBREVIATE_CMDS : 0; flags |= opts->rebase_merges ? TODO_LIST_REBASE_MERGES : 0; flags |= opts->rebase_cousins > 0 ? TODO_LIST_REBASE_COUSINS : 0; + flags |= opts->root_with_onto ? TODO_LIST_ROOT_WITH_ONTO : 0; flags |= command == ACTION_SHORTEN_OIDS ? TODO_LIST_SHORTEN_IDS : 0; switch (command) { @@ -1845,7 +1846,9 @@ int cmd_rebase(int argc, const char **argv, const char *prefix) options.squash_onto = &squash_onto; options.onto_name = squash_onto_name = xstrdup(oid_to_hex(&squash_onto)); - } + } else + options.root_with_onto = 1; + options.upstream_name = NULL; options.upstream = NULL; if (argc > 1) diff --git a/sequencer.c b/sequencer.c index d228448cd8..ca119c84e5 100644 --- a/sequencer.c +++ b/sequencer.c @@ -4440,6 +4440,7 @@ static int make_script_with_merges(struct pretty_print_context *pp, { int keep_empty = flags & TODO_LIST_KEEP_EMPTY; int rebase_cousins = flags & TODO_LIST_REBASE_COUSINS; + int root_with_onto = flags & TODO_LIST_ROOT_WITH_ONTO; struct strbuf buf = STRBUF_INIT, oneline = STRBUF_INIT; struct strbuf label = STRBUF_INIT; struct commit_list *commits = NULL, **tail = &commits, *iter; @@ -4606,7 +4607,8 @@ static int make_script_with_merges(struct pretty_print_context *pp, if (!commit) strbuf_addf(out, "%s %s\n", cmd_reset, - rebase_cousins ? "onto" : "[new root]"); + rebase_cousins || root_with_onto ? + "onto" : "[new root]"); else { const char *to = NULL; diff --git a/sequencer.h b/sequencer.h index 0c494b83d4..d506081d3c 100644 --- a/sequencer.h +++ b/sequencer.h @@ -142,6 +142,12 @@ int sequencer_remove_state(struct replay_opts *opts); */ #define TODO_LIST_REBASE_COUSINS (1U << 4) #define TODO_LIST_APPEND_TODO_HELP (1U << 5) +/* + * When generating a script that rebases merges with `--root` *and* with + * `--onto`, we do not want to re-generate the root commits. + */ +#define TODO_LIST_ROOT_WITH_ONTO (1U << 6) + int sequencer_make_script(struct repository *r, struct strbuf *out, int argc, const char **argv, unsigned flags); diff --git a/t/t3427-rebase-subtree.sh b/t/t3427-rebase-subtree.sh index 7a37235768..39e348de16 100755 --- a/t/t3427-rebase-subtree.sh +++ b/t/t3427-rebase-subtree.sh @@ -93,4 +93,15 @@ test_expect_success 'Rebase -Xsubtree --keep-empty --onto commit' ' verbose test "$(commit_message HEAD)" = "Empty commit" ' +test_expect_success 'Rebase -Xsubtree --keep-empty --rebase-merges --onto commit' ' + reset_rebase && + git checkout -b rebase-merges-onto to-rebase && + test_must_fail git rebase -Xsubtree=files_subtree --keep-empty --rebase-merges --onto files-master --root && + : first pick results in no changes && + git rebase --continue && + verbose test "$(commit_message HEAD~2)" = "master4" && + verbose test "$(commit_message HEAD~)" = "files_subtree/master5" && + verbose test "$(commit_message HEAD)" = "Empty commit" +' + test_done