From patchwork Sun Sep 13 19:31:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aaron Lipman X-Patchwork-Id: 11772441 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 226686CA for ; Sun, 13 Sep 2020 19:32:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 08C62221E3 for ; Sun, 13 Sep 2020 19:32:15 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="YODxLM2l" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725956AbgIMTcN (ORCPT ); Sun, 13 Sep 2020 15:32:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60778 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725938AbgIMTb6 (ORCPT ); Sun, 13 Sep 2020 15:31:58 -0400 Received: from mail-qv1-xf41.google.com (mail-qv1-xf41.google.com [IPv6:2607:f8b0:4864:20::f41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5F79BC06174A for ; Sun, 13 Sep 2020 12:31:57 -0700 (PDT) Received: by mail-qv1-xf41.google.com with SMTP id p15so7358462qvk.5 for ; Sun, 13 Sep 2020 12:31:57 -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=lbhW87v1kDJqhf/IDKE1qK3DxUpDUYZWsvgqgsYAhbE=; b=YODxLM2lR3sKYvukDWIcm7vXdZFDuxxYuIGqd037LuT8KKGut/xGDAsHOIUhMvgmE7 q+UJpxvT3KCvmLfszaeqM1AXtsXIxxdwmxmVTacG7B/Z36OhuDveRdAIjN/KYDkHgxpY OzHQDs6CpAFXiKmQ0Pp/S37K+ZXfPZ0DwAyqV1bx71TTQQQ8+HeFgLKy/YPyAPqJRkk1 0W1+cME/ENis45n9gWZRZfjXEPttM/KF0ruZtTzWs6gx5UnIomhR6A3DhiOMvUarqkWk AvEhOEPes51I05ddVyeOxMXJw3iW7txanld1o6WcrQwuwu5w0Q8DOGHjo+fUo/pyyZPZ ghfQ== 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=lbhW87v1kDJqhf/IDKE1qK3DxUpDUYZWsvgqgsYAhbE=; b=DWGECoNRLktP5LxhVSbhCPJOhbU7jL735h+NhleM2f9MjdQURJIM+EPeIjzgNbL4y7 wLPFpzqqlKodIRjmVVuM1AGeottJOf7T1thZemXq7kR9DHRdH4fkqnge+QDZLxM/AZwi 0tPTCPnMFpjeNVeb3pQUR++qE1zx9uduP//+0ae9bi04Ad+Bwdw7wT/EX1kcYXMj0xp3 jbftQiX6Vif2ayfClzyCqVtlz4ts/SRoTy2x+WwbNP5rFbMN1qb03VSD/8dH+GDaHw/c yKXRComJ++53eFOiMJtDqmlqFLKH+yIbt10QUOq7BGwqk2vUXogfpr+FeftMce8ttT6/ r+Og== X-Gm-Message-State: AOAM532auItvfplGo2iqIxBi3wZ7gmaNzplJa7Ak2eGk3rBzCiDiVfOx 3wD1U6M0wdY8kVzobjN6t2ApOgQ6DazWAUdF X-Google-Smtp-Source: ABdhPJyCKbxaS+spQ+nvlTLisKpGMIqi/YgPkfQY0B8GnOxINy1h55lcQvA0TwuBjjZIHwIwfOMMCg== X-Received: by 2002:ad4:43e5:: with SMTP id f5mr10044519qvu.12.1600025514686; Sun, 13 Sep 2020 12:31:54 -0700 (PDT) Received: from localhost.localdomain (c-98-229-3-81.hsd1.vt.comcast.net. [98.229.3.81]) by smtp.gmail.com with ESMTPSA id e13sm11523924qtr.85.2020.09.13.12.31.54 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 13 Sep 2020 12:31:54 -0700 (PDT) From: Aaron Lipman To: git@vger.kernel.org Cc: Aaron Lipman Subject: [PATCH v3 1/3] t3201: test multiple branch filter combinations Date: Sun, 13 Sep 2020 15:31:38 -0400 Message-Id: <20200913193140.66906-2-alipman88@gmail.com> X-Mailer: git-send-email 2.24.3 (Apple Git-128) In-Reply-To: <20200913193140.66906-1-alipman88@gmail.com> References: <20200911185754.64173-3-alipman88@gmail.com> <20200913193140.66906-1-alipman88@gmail.com> MIME-Version: 1.0 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Add tests covering the behavior of passing multiple contains/no-contains filters to git branch, e.g.: $ git branch --contains feature_a --contains feature_b $ git branch --no-contains feature_a --no-contains feature_b When passed more than one contains (or no-contains) filter, the tips of the branches returned must be reachable from any of the contains commits and from none of the no-contains commits. This logic is useful to describe prior to enabling multiple merged/no-merged filters, so that future tests will demonstrate consistent behavior between merged/no-merged and contains/no-contains filters. Signed-off-by: Aaron Lipman --- t/t3201-branch-contains.sh | 44 ++++++++++++++++++++++++++++++++++---- 1 file changed, 40 insertions(+), 4 deletions(-) diff --git a/t/t3201-branch-contains.sh b/t/t3201-branch-contains.sh index 40251c9f8f..cd205b5560 100755 --- a/t/t3201-branch-contains.sh +++ b/t/t3201-branch-contains.sh @@ -200,15 +200,51 @@ test_expect_success 'branch --merged with --verbose' ' test_i18ncmp expect actual ' -test_expect_success 'branch --contains combined with --no-contains' ' - git branch --contains zzz --no-contains topic >actual && +# The next series of tests covers multiple filter combinations +test_expect_success 'set up repo for multiple filter combination tests' ' + git checkout master && + git branch | grep -v master | xargs git branch -D && + git checkout -b feature_a master && + >feature_a && + git add feature_a && + git commit -m "add feature a" && + git checkout -b feature_b master && + >feature_b && + git add feature_b && + git commit -m "add feature b" +' + +test_expect_success 'multiple branch --contains' ' + git checkout -b next master && + git merge feature_a && + git branch --contains feature_a --contains feature_b >actual && + cat >expect <<-\EOF && + feature_a + feature_b + * next + EOF + test_cmp expect actual +' + +test_expect_success 'multiple branch --no-contains' ' + git branch --no-contains feature_a --no-contains feature_b >actual && cat >expect <<-\EOF && master - side - zzz EOF test_cmp expect actual +' +test_expect_success 'branch --contains combined with --no-contains' ' + git checkout master && + git merge feature_a && + git checkout next && + git merge feature_b && + git branch --contains feature_a --no-contains feature_b >actual && + cat >expect <<-\EOF && + feature_a + master + EOF + test_cmp expect actual ' test_done