From patchwork Wed May 8 00:12:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= X-Patchwork-Id: 10933929 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 0D0CF912 for ; Wed, 8 May 2019 00:13:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F042926256 for ; Wed, 8 May 2019 00:13:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E4D882864E; Wed, 8 May 2019 00:13:13 +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 78B4026256 for ; Wed, 8 May 2019 00:13:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726548AbfEHANM (ORCPT ); Tue, 7 May 2019 20:13:12 -0400 Received: from mail-wr1-f65.google.com ([209.85.221.65]:38389 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726313AbfEHANL (ORCPT ); Tue, 7 May 2019 20:13:11 -0400 Received: by mail-wr1-f65.google.com with SMTP id v11so4529942wru.5 for ; Tue, 07 May 2019 17:13:10 -0700 (PDT) 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=egxeRZ0jBIHNCIEs98FZxVkqchu8J9mt89jBuwoOlXg=; b=lzyRMos4lfY9peqr2vjlQewXuNHnz3BOqB21suOeox8bLkblDB1KPql2RtwJyo9C8e jDYkU+QIMwXPyh5WSe/SJ3N3N/spRulSCUb1AMJGlQCJhK5O+1qtHB0PnASqQBZxvfwg R5CDfPsYnVMTh6dYGGMEJI9OeGg6qDhJ3r2U8Wdp1PP6gO4bXc3wv/MzJmMQA9Sgou/w 7R3FbM+g3TYaVgvsh2FIoFTWTkhpV0O6U9yquIsTyKUVeH3gsFLX5iF347luhaa8wAtx GyVmZ92cduc8K65bmxyyKft1RAAxmeZ2iSlbZ8c1MgmSaxeEu7rnQMKvKcKY3Y+nKvu/ Czyw== 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=egxeRZ0jBIHNCIEs98FZxVkqchu8J9mt89jBuwoOlXg=; b=jidLVNNhCUcfpKnH8cUmNzwt3+qbvif9qT/+vDGFhWwnZ6VbVz9iyZxj67nR7ai5Ux Qxp+DWohULxYzDql+H7CExzQJr9f6hoFt3ECU8693kZdx3597OgGy4G6YSJbPajmubW4 wYkjnOYiRk9ZF07gU3UA1Q3/iI468QINEkPJmaha2qUJ0G7nQYMknT/V0oYfsD89FW/u a0yhdyiwdbN/Ia2bNdUCoZp0UUqNGDmYMKvrnQsjLi0EEEyXS9tIW5xeEW3L5LgfrSn8 xm4lj6W2IuG0d2onnf8baoPrRe3bNvzdZ3l+S7MTouL4TjiOhtC+6yFQpO/KenqNyN7r Y9dg== X-Gm-Message-State: APjAAAXy9r5m0xe9bVe8jtetAuADyydIlt4u5pDZEDJ2F7kvY9mUUy77 3wLT5BTqBT7OZqKhNr1FmlI/CJnkjHU= X-Google-Smtp-Source: APXvYqwVlSa7mNPxeyrK4PJSFQnOa2g0nGRoTXr5nIF6O6gipkN6w+EzN/tQK0/7YUBkUEy0P7htkQ== X-Received: by 2002:adf:b446:: with SMTP id v6mr9024775wrd.30.1557274389319; Tue, 07 May 2019 17:13:09 -0700 (PDT) Received: from vm.nix.is ([2a01:4f8:120:2468::2]) by smtp.gmail.com with ESMTPSA id n15sm5167825wrp.58.2019.05.07.17.13.07 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Tue, 07 May 2019 17:13:08 -0700 (PDT) From: =?utf-8?b?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= To: git@vger.kernel.org Cc: Junio C Hamano , Denton Liu , Eric Sunshine , Johannes Schindelin , Johannes Sixt , =?utf-8?q?SZEDER_G=C3=A1bor?= Subject: [RFC WIP PATCH v8 02/13] t3432: test rebase fast-forward behavior Date: Wed, 8 May 2019 02:12:41 +0200 Message-Id: <20190508001252.15752-3-avarab@gmail.com> X-Mailer: git-send-email 2.21.0.1020.gf2820cf01a In-Reply-To: References: MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Denton Liu When rebase is run on a branch that can be fast-forwarded, this should automatically be done. Create test to ensure this behavior happens. There are some cases that currently don't pass. The first case is where a feature and master have diverged, running "git rebase master... master" causes a full rebase to happen even though a fast-forward should happen. The second case is when we are doing "git rebase --fork-point" and a fork-point commit is found. Once again, a full rebase happens even though a fast-forward should happen. Mark these cases as failure so we can fix it later. Signed-off-by: Denton Liu Signed-off-by: Junio C Hamano --- t/t3432-rebase-fast-forward.sh | 72 ++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100755 t/t3432-rebase-fast-forward.sh diff --git a/t/t3432-rebase-fast-forward.sh b/t/t3432-rebase-fast-forward.sh new file mode 100755 index 0000000000..f49af274e0 --- /dev/null +++ b/t/t3432-rebase-fast-forward.sh @@ -0,0 +1,72 @@ +#!/bin/sh +# +# Copyright (c) 2019 Denton Liu +# + +test_description='ensure rebase fast-forwards commits when possible' + +. ./test-lib.sh + +test_expect_success setup ' + test_commit A && + test_commit B && + test_commit C && + test_commit D && + git checkout -t -b side +' + +test_rebase_same_head () { + status="$1" && + shift && + test_expect_$status "git rebase $* with $changes is no-op" " + oldhead=\$(git rev-parse HEAD) && + test_when_finished 'git reset --hard \$oldhead' && + git rebase $* && + newhead=\$(git rev-parse HEAD) && + test_cmp_rev \$oldhead \$newhead + " +} + +changes='no changes' +test_rebase_same_head success +test_rebase_same_head success master +test_rebase_same_head success --onto B B +test_rebase_same_head success --onto B... B +test_rebase_same_head success --onto master... master +test_rebase_same_head success --no-fork-point +test_rebase_same_head success --fork-point master +test_rebase_same_head failure --fork-point --onto B B +test_rebase_same_head failure --fork-point --onto B... B +test_rebase_same_head success --fork-point --onto master... master + +test_expect_success 'add work to side' ' + test_commit E +' + +changes='our changes' +test_rebase_same_head success +test_rebase_same_head success master +test_rebase_same_head success --onto B B +test_rebase_same_head success --onto B... B +test_rebase_same_head success --onto master... master +test_rebase_same_head success --no-fork-point +test_rebase_same_head success --fork-point master +test_rebase_same_head failure --fork-point --onto B B +test_rebase_same_head failure --fork-point --onto B... B +test_rebase_same_head success --fork-point --onto master... master + +test_expect_success 'add work to upstream' ' + git checkout master && + test_commit F && + git checkout side +' + +changes='our and their changes' +test_rebase_same_head success --onto B B +test_rebase_same_head success --onto B... B +test_rebase_same_head failure --onto master... master +test_rebase_same_head failure --fork-point --onto B B +test_rebase_same_head failure --fork-point --onto B... B +test_rebase_same_head failure --fork-point --onto master... master + +test_done