From patchwork Fri Aug 2 09:56:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Martin_=C3=85gren?= X-Patchwork-Id: 11073057 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 C89DD1395 for ; Fri, 2 Aug 2019 09:57:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B426D287D2 for ; Fri, 2 Aug 2019 09:57:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A8562287DE; Fri, 2 Aug 2019 09:57:45 +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 4F12A287D2 for ; Fri, 2 Aug 2019 09:57:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2406955AbfHBJ5o (ORCPT ); Fri, 2 Aug 2019 05:57:44 -0400 Received: from mail-lj1-f196.google.com ([209.85.208.196]:42901 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2406642AbfHBJ5o (ORCPT ); Fri, 2 Aug 2019 05:57:44 -0400 Received: by mail-lj1-f196.google.com with SMTP id t28so72260153lje.9 for ; Fri, 02 Aug 2019 02:57:42 -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=+Wvp/mL8/suDq6gcHIqOxEFgwK3hpx7xnZIAAB/rPm8=; b=AjT40ThegrXWUOKCQwKTyF6c9nsQwWe/ehECguaJbmhE64BG7Sa1mw8L2Uy7EgA1AQ KonhN45rXY1gLkjLMnMwxmr6zT55O+uj17QYfQDvU1QsqxzMITZu103gHQklc0al8Z1n iemWxiMvbKW75bqcjApgDCLGYF17LC76VIw/f2ABx/IgTgr8wzSdjae0EbY4xRjMEc8y 0kt0apxwvLagv5oGgjKYdFzHdZRxrDXXZFmpxirzVRv6cN56TougXZOQ/22zlpsAIIXd 4VPhVwRGGHLPvOg7xXCPg8nwnpUfZqXDibW1IM0vXKZ8cM0KLIbqI/M1BUkWV9ntE3Bw Rhng== 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=+Wvp/mL8/suDq6gcHIqOxEFgwK3hpx7xnZIAAB/rPm8=; b=Qf6SVkGFskCZQesEEDJ81fwG6IiUdGlgUP/Z9Jvt/aizv+j4oO1I9eHzgTJIzZGFyN xoCBgYxhJxhOFTkowQ9RRXLtEknd4l/SNppb2oxRRPx58iXt6GgoLwGH9zWA6pgMlXDJ 3VMrHOdfb/vD5iignrwluQsgWOI745u1eIlt1HFVPeO2yLLTGk3jgO12PlyQkYmXl8Gk L0BkYHndietkPHOqofyQxzLcm9E94AhC0YaTCHn2Nyn9aYGACFAd2Oocg6IDBrs3crGk cZfdPmmp4HZd/XBv4VChmeOLNsIy5A6eOsjRyjlYCLWV0sqUi20ZNKbFVG6vrq9Vyj/p cCYQ== X-Gm-Message-State: APjAAAU2mocFYGYuk5WGOkIxWir1wBNKKamXDFP6IIsTcJkKsIWfviXK SjsaZ7+w7GCy5+9Qpi/KtZI= X-Google-Smtp-Source: APXvYqwLv4E8VkH+zsh6fUTGXfbqtDGkkWY8meMwstT31j0H6u0hfgvTjBkkHNX1kH1ZUyQuttEQ2w== X-Received: by 2002:a2e:8802:: with SMTP id x2mr50354879ljh.200.1564739862175; Fri, 02 Aug 2019 02:57:42 -0700 (PDT) Received: from localhost.localdomain (31-211-229-121.customers.ownit.se. [31.211.229.121]) by smtp.gmail.com with ESMTPSA id y12sm14237344lfy.36.2019.08.02.02.57.41 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 02 Aug 2019 02:57:41 -0700 (PDT) From: =?utf-8?q?Martin_=C3=85gren?= To: Josh Steadmon Cc: git@vger.kernel.org, Junio C Hamano , Michael J Gruber Subject: [PATCH 5/5] t7503: test failing merge with both hooks available Date: Fri, 2 Aug 2019 11:56:39 +0200 Message-Id: <1a65bc5519e59934bf665175b4377c5d6427b77a.1564737003.git.martin.agren@gmail.com> X-Mailer: git-send-email 2.23.0.rc0.30.g51cf315870 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 With a failing automatic merge, we want to make sure that we *don't* call the pre-merge-commit hook and that we (eventually) *do* call the pre-commit hook. Signed-off-by: Martin Ă…gren --- ...3-pre-commit-and-pre-merge-commit-hooks.sh | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/t/t7503-pre-commit-and-pre-merge-commit-hooks.sh b/t/t7503-pre-commit-and-pre-merge-commit-hooks.sh index f0c73fd58d..4bf359c097 100755 --- a/t/t7503-pre-commit-and-pre-merge-commit-hooks.sh +++ b/t/t7503-pre-commit-and-pre-merge-commit-hooks.sh @@ -41,6 +41,18 @@ test_expect_success 'root commit' ' git checkout master ' +test_expect_success 'setup conflicting branches' ' + test_when_finished "git checkout master" && + git checkout -b conflicting-a master && + echo a >conflicting && + git add conflicting && + git commit -m conflicting-a && + git checkout -b conflicting-b master && + echo b >conflicting && + git add conflicting && + git commit -m conflicting-b +' + test_expect_success 'with no hook' ' test_when_finished "rm -f actual_hooks" && echo "foo" >file && @@ -93,6 +105,24 @@ test_expect_success 'with succeeding hook (merge)' ' test_cmp expected_hooks actual_hooks ' +test_expect_success 'automatic merge fails; both hooks are available' ' + test_when_finished "rm -f \"$PREMERGE\" \"$PRECOMMIT\"" && + test_when_finished "rm -f expected_hooks actual_hooks" && + test_when_finished "git checkout master" && + ln -s "success.sample" "$PREMERGE" && + ln -s "success.sample" "$PRECOMMIT" && + + git checkout conflicting-a && + test_must_fail git merge -m "merge conflicting-b" conflicting-b && + test_path_is_missing actual_hooks && + + echo "$PRECOMMIT" >expected_hooks && + echo a+b >conflicting && + git add conflicting && + git commit -m "resolve conflict" && + test_cmp expected_hooks actual_hooks +' + test_expect_success '--no-verify with succeeding hook' ' test_when_finished "rm -f \"$PRECOMMIT\" actual_hooks" && ln -s "success.sample" "$PRECOMMIT" &&