From patchwork Fri Aug 2 09:56:35 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: 11073053 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 846E314DB for ; Fri, 2 Aug 2019 09:57:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 70196287D2 for ; Fri, 2 Aug 2019 09:57:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 64363287DE; Fri, 2 Aug 2019 09:57:25 +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 14799287D2 for ; Fri, 2 Aug 2019 09:57:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2406890AbfHBJ5X (ORCPT ); Fri, 2 Aug 2019 05:57:23 -0400 Received: from mail-lj1-f196.google.com ([209.85.208.196]:37104 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2406883AbfHBJ5X (ORCPT ); Fri, 2 Aug 2019 05:57:23 -0400 Received: by mail-lj1-f196.google.com with SMTP id z28so18043662ljn.4 for ; Fri, 02 Aug 2019 02:57:21 -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=1zXtyV/4V4fQyVHLz8p1CSwfozW6e0zPbl0nRfqsWDQ=; b=itE0QSjUqafXwuc7LiL3wksg/8KlTeILxvpNvE2m472ROG8M2XBgUuQaXvp0PqQZTA m93/eM4ciL7pFG13VoQd3K28zd9ZclOVbA1oj4C+O+B0yvtKLgfM5tCF5kAQQtdFAQfM 7jEPCIY4A5F1so7jfTYPVDgEAZ+VE4I9sxz2ukDNyHV+a53Nyww/7wb4Hoe2ITruCyhA SEhJ/yvq6ceoC8moEtGjiMl1BWFhSjcnrROmHFe//3Se/58WFSmRQivu0YdavY73wh2k XGIgZmMQR3Nabh/OhE5h+4phetiGXTMhh1nDl/RR4pzbwUBpss6bD4mrDJbLAtW5ju6X MC7g== 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=1zXtyV/4V4fQyVHLz8p1CSwfozW6e0zPbl0nRfqsWDQ=; b=Fk/cbqiWG5DZCnaExj7YHZzhSeXZJs5l2/bmKCtJ5IpLqNIEyKQF8GPT7FnMNlpaAe TRNI+cy8ekGvt9wjsPHnYUFkQ/pBUbeer52cGdjh5OIuMtuZnNEFtl8BTZEZnUfL52kn c6AgF/Ui0W96UYXennOr74/zPIPGfWF77lSwJRSGglHHRLu6QSBisS8fYgJR1IpI89Yv fG7UVg40/2FGPXh7xQEAiCKVqyVCuiE3Jaclw9LnFgx58KlgaVoxPOt2uYnBoQi05k4x a2Gq9nBOSAZizlgc41uRZG2qjVjJBgb9eONfToynQDkB9aWp0aMTTeELyWSZynVym4wS rSIQ== X-Gm-Message-State: APjAAAVJ851GqHkJhjkjOSnboJ3Ya3nlzUAM7JKnQJ4aM8N6lcZpI64w 6m8G50V6uP492wAOTqqBMgY= X-Google-Smtp-Source: APXvYqyeygUf17BEGLaC2i64A5hMw6tiOwT1NA4ScY1szgEVXKnzvDVxJhE/UZaiaxWd1K6oYIIOeA== X-Received: by 2002:a2e:9643:: with SMTP id z3mr72069614ljh.43.1564739840843; Fri, 02 Aug 2019 02:57:20 -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.19 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 02 Aug 2019 02:57:20 -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 1/5] t7503: use "&&" in "test_when_finished" rather than ";" Date: Fri, 2 Aug 2019 11:56:35 +0200 Message-Id: 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 Signed-off-by: Martin Ågren --- t/t7503-pre-commit-and-pre-merge-commit-hooks.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 86a375ab3e..5cc6c98375 100755 --- a/t/t7503-pre-commit-and-pre-merge-commit-hooks.sh +++ b/t/t7503-pre-commit-and-pre-merge-commit-hooks.sh @@ -162,7 +162,7 @@ test_expect_success '--no-verify with failing hook (merge)' ' ' test_expect_success POSIXPERM 'with non-executable hook' ' - test_when_finished "rm -f \"$PRECOMMIT\" expected_hooks actual_hooks; chmod +x \"$HOOKDIR/fail.sample\"" && + test_when_finished "rm -f \"$PRECOMMIT\" expected_hooks actual_hooks && chmod +x \"$HOOKDIR/fail.sample\"" && ln -s "fail.sample" "$PRECOMMIT" && chmod -x "$HOOKDIR/fail.sample" && touch expected_hooks actual_hooks && @@ -173,7 +173,7 @@ test_expect_success POSIXPERM 'with non-executable hook' ' ' test_expect_success POSIXPERM '--no-verify with non-executable hook' ' - test_when_finished "rm -f \"$PRECOMMIT\" expected_hooks actual_hooks; chmod +x \"$HOOKDIR/fail.sample\"" && + test_when_finished "rm -f \"$PRECOMMIT\" expected_hooks actual_hooks && chmod +x \"$HOOKDIR/fail.sample\"" && ln -s "fail.sample" "$PRECOMMIT" && chmod -x "$HOOKDIR/fail.sample" && touch expected_hooks actual_hooks && From patchwork Fri Aug 2 09:56:36 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: 11073055 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 CC39014DB for ; Fri, 2 Aug 2019 09:57:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B7549287D2 for ; Fri, 2 Aug 2019 09:57:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AB837287DE; Fri, 2 Aug 2019 09:57:32 +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 1E02F287D3 for ; Fri, 2 Aug 2019 09:57:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2406913AbfHBJ5b (ORCPT ); Fri, 2 Aug 2019 05:57:31 -0400 Received: from mail-lj1-f196.google.com ([209.85.208.196]:41130 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2406906AbfHBJ53 (ORCPT ); Fri, 2 Aug 2019 05:57:29 -0400 Received: by mail-lj1-f196.google.com with SMTP id d24so72247529ljg.8 for ; Fri, 02 Aug 2019 02:57:27 -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=f/mkRSPOhZqzzguOzOHp9b4AxQzYxh/Ey6mL0ccDOfA=; b=DVBWHVIUBSrXII67fXmB7pnsiHX9yN0pcerfHNVZq8Bqt6uf4BvLMIbGCB30/IHvqn iF0slG0VLDza7IKCV48uPMNKqG0TIPL0bb58ib/7zPeTXdixSAfgnuNKAM9QY/quIVII oTc+WB048yfpx0igZd5L+BUbOATYivv4E7LBZI56TJPjvP5ty8hIfifvyqTOHlbj8OTz AqMe5zztC3lIhfP2WERX9R7SvPP9tCbcKp1L1lE+ROcnccVGBTYgYVJSte74pIc9dIHF pynaUpmOM1OX2L/OnFm7hUlf2v5gWaNPdIkhFIFnamyuY0l3qi0qiYddDaA8UYm+P38H OeHg== 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=f/mkRSPOhZqzzguOzOHp9b4AxQzYxh/Ey6mL0ccDOfA=; b=fHy8HtckOIQCW9jFGv6qPg/yFloHnn0nr9j1b9mL22Z21f7t414FRcxQXHDH1je/jE Hw+ZS5w/EcWyJqYQQPOAR4WYfLLjjNRJW1oQ3OHyOBjYi9iowIoMLBS0E8AfVlo2XQDv XYqnUXN+gAn3NkLMNTZ6hojjYMsLdW5vC8f/lPLemAQ6Gcj/kl7layON0tUB07gn/SdS JQNYehuodYQc1MyMoVbMxq8slbH+8ZVTUMcqhazd/VzUUhQVPc9N4fIL/71jizctT0RL cqsd0tDyC14+JIicYGCwOgk6oNtm5DPn2YQy5wlfw7uqujaTlA9TDWFkstfjr97GJDkG q4sw== X-Gm-Message-State: APjAAAWv4n7CTQ3LG0UvV0ljKiLEh/YpPgX4mLAOn8qeR7qfcVACL0Yp dSiRu+3f6or5qJxLTvrhHDQ= X-Google-Smtp-Source: APXvYqwm1HOC71qLvIAuP9ndwvXR8cI8XC3gjupyT+GyLYNZUTGFLoBh0BKDUj3xrCRE+aWwqIis1Q== X-Received: by 2002:a2e:9753:: with SMTP id f19mr70494522ljj.113.1564739846969; Fri, 02 Aug 2019 02:57:26 -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.25 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 02 Aug 2019 02:57:26 -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 2/5] t7503: avoid touch when mtime doesn't matter Date: Fri, 2 Aug 2019 11:56:36 +0200 Message-Id: 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 AFAIU, we avoid using `touch` unless we really do want to update the mtime. Here, we just want to create empty files, so write `>foo` instead. Signed-off-by: Martin Ågren --- ...3-pre-commit-and-pre-merge-commit-hooks.sh | 38 ++++++++++++------- 1 file changed, 24 insertions(+), 14 deletions(-) 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 5cc6c98375..a6f1240aa2 100755 --- a/t/t7503-pre-commit-and-pre-merge-commit-hooks.sh +++ b/t/t7503-pre-commit-and-pre-merge-commit-hooks.sh @@ -43,7 +43,8 @@ test_expect_success 'root commit' ' test_expect_success 'with no hook' ' test_when_finished "rm -f expected_hooks actual_hooks" && - touch expected_hooks actual_hooks && + >expected_hooks && + >actual_hooks && echo "foo" >file && git add file && git commit -m "first" && @@ -52,7 +53,8 @@ test_expect_success 'with no hook' ' test_expect_success 'with no hook (merge)' ' test_when_finished "rm -f expected_hooks actual_hooks" && - touch expected_hooks actual_hooks && + >expected_hooks && + >actual_hooks && git checkout side && git merge -m "merge master" master && git checkout master && @@ -61,7 +63,8 @@ test_expect_success 'with no hook (merge)' ' test_expect_success '--no-verify with no hook' ' test_when_finished "rm -f expected_hooks actual_hooks" && - touch expected_hooks actual_hooks && + >expected_hooks && + >actual_hooks && echo "bar" >file && git add file && git commit --no-verify -m "bar" && @@ -70,7 +73,8 @@ test_expect_success '--no-verify with no hook' ' test_expect_success '--no-verify with no hook (merge)' ' test_when_finished "rm -f expected_hooks actual_hooks" && - touch expected_hooks actual_hooks && + >expected_hooks && + >actual_hooks && git checkout side && git merge --no-verify -m "merge master" master && git checkout master && @@ -80,7 +84,7 @@ test_expect_success '--no-verify with no hook (merge)' ' test_expect_success 'with succeeding hook' ' test_when_finished "rm -f \"$PRECOMMIT\" expected_hooks actual_hooks" && ln -s "success.sample" "$PRECOMMIT" && - touch actual_hooks && + >actual_hooks && echo "$PRECOMMIT" >expected_hooks && echo "more" >>file && git add file && @@ -91,7 +95,7 @@ test_expect_success 'with succeeding hook' ' test_expect_success 'with succeeding hook (merge)' ' test_when_finished "rm -f \"$PREMERGE\" expected_hooks actual_hooks" && ln -s "success.sample" "$PREMERGE" && - touch actual_hooks && + >actual_hooks && echo "$PREMERGE" >expected_hooks && git checkout side && git merge -m "merge master" master && @@ -102,7 +106,8 @@ test_expect_success 'with succeeding hook (merge)' ' test_expect_success '--no-verify with succeeding hook' ' test_when_finished "rm -f \"$PRECOMMIT\" expected_hooks actual_hooks" && ln -s "success.sample" "$PRECOMMIT" && - touch expected_hooks actual_hooks && + >expected_hooks && + >actual_hooks && echo "even more" >>file && git add file && git commit --no-verify -m "even more" && @@ -112,7 +117,8 @@ test_expect_success '--no-verify with succeeding hook' ' test_expect_success '--no-verify with succeeding hook (merge)' ' test_when_finished "rm -f \"$PREMERGE\" expected_hooks actual_hooks" && ln -s "success.sample" "$PREMERGE" && - touch expected_hooks actual_hooks && + >expected_hooks && + >actual_hooks && git checkout side && git merge --no-verify -m "merge master" master && git checkout master && @@ -122,7 +128,7 @@ test_expect_success '--no-verify with succeeding hook (merge)' ' test_expect_success 'with failing hook' ' test_when_finished "rm -f \"$PRECOMMIT\" expected_hooks actual_hooks" && ln -s "fail.sample" "$PRECOMMIT" && - touch actual_hooks && + >actual_hooks && echo "$PRECOMMIT" >expected_hooks && echo "another" >>file && git add file && @@ -133,7 +139,8 @@ test_expect_success 'with failing hook' ' test_expect_success '--no-verify with failing hook' ' test_when_finished "rm -f \"$PRECOMMIT\" expected_hooks actual_hooks" && ln -s "fail.sample" "$PRECOMMIT" && - touch expected_hooks actual_hooks && + >expected_hooks && + >actual_hooks && echo "stuff" >>file && git add file && git commit --no-verify -m "stuff" && @@ -143,7 +150,7 @@ test_expect_success '--no-verify with failing hook' ' test_expect_success 'with failing hook (merge)' ' test_when_finished "rm -f \"$PREMERGE\" expected_hooks actual_hooks" && ln -s "fail.sample" "$PREMERGE" && - touch actual_hooks && + >actual_hooks && echo "$PREMERGE" >expected_hooks && git checkout side && test_must_fail git merge -m "merge master" master && @@ -154,7 +161,8 @@ test_expect_success 'with failing hook (merge)' ' test_expect_success '--no-verify with failing hook (merge)' ' test_when_finished "rm -f \"$PREMERGE\" expected_hooks actual_hooks" && ln -s "fail.sample" "$PREMERGE" && - touch expected_hooks actual_hooks && + >expected_hooks && + >actual_hooks && git checkout side && git merge --no-verify -m "merge master" master && git checkout master && @@ -165,7 +173,8 @@ test_expect_success POSIXPERM 'with non-executable hook' ' test_when_finished "rm -f \"$PRECOMMIT\" expected_hooks actual_hooks && chmod +x \"$HOOKDIR/fail.sample\"" && ln -s "fail.sample" "$PRECOMMIT" && chmod -x "$HOOKDIR/fail.sample" && - touch expected_hooks actual_hooks && + >expected_hooks && + >actual_hooks && echo "content" >>file && git add file && git commit -m "content" && @@ -176,7 +185,8 @@ test_expect_success POSIXPERM '--no-verify with non-executable hook' ' test_when_finished "rm -f \"$PRECOMMIT\" expected_hooks actual_hooks && chmod +x \"$HOOKDIR/fail.sample\"" && ln -s "fail.sample" "$PRECOMMIT" && chmod -x "$HOOKDIR/fail.sample" && - touch expected_hooks actual_hooks && + >expected_hooks && + >actual_hooks && echo "more content" >>file && git add file && git commit --no-verify -m "more content" && From patchwork Fri Aug 2 09:56:37 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: 11073061 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 4183B14DB for ; Fri, 2 Aug 2019 09:58:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2CB10287D2 for ; Fri, 2 Aug 2019 09:58:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 21161287DE; Fri, 2 Aug 2019 09:58:48 +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 91490287D2 for ; Fri, 2 Aug 2019 09:58:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2406607AbfHBJ6q (ORCPT ); Fri, 2 Aug 2019 05:58:46 -0400 Received: from mail-lf1-f65.google.com ([209.85.167.65]:44524 "EHLO mail-lf1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2406906AbfHBJ5c (ORCPT ); Fri, 2 Aug 2019 05:57:32 -0400 Received: by mail-lf1-f65.google.com with SMTP id r15so35517189lfm.11 for ; Fri, 02 Aug 2019 02:57:31 -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=KYw7b3C7A2T1RxNYvfesLCz7CAX7DrwKH/9YTZcpHWs=; b=uSFSFdmKAT8w3eAcKBJRYxb/dW9ga99iN0pZtQ3//tE/Fy03dzo07AyYUeTrhNxo1h MzMFa1cGtLFbUQMXzK1L2GC+jU8g+LCXwizq9VECKzJm17dLC3nXo9trG62uQJqiXyYt cf2VPDE2F6XbvRWfTJA6/SwI1UR5APvdY+ge93AXmM+XCO5C5dY2jvVEPafNMPod6PEh KkO3GwUy6TnLjTnpkRaFbNppBcKmK3IXFIIL1xPgtJGH8nZcEgvlWTvSnBzxZHpd4DVy UmAqzne7yfKgiBv2xR1GyDIgif6STn9t15k5G3oNGthfmGOZX22k2E48HsuagPoXbD07 vrKQ== 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=KYw7b3C7A2T1RxNYvfesLCz7CAX7DrwKH/9YTZcpHWs=; b=lN+zQRK7XTr1ihMC6DQlxgZUunToAOih2j6jhMPfsuC5/MRML3g9uatW5l24QbSjl6 RnkB5FgrxJStRD3Fvtbg/xu/bck1mGmf1fPoSzqm+q9QBnwaRw+Z0VbIwZIsRUiUFeDc 8fzFFW7y+DaRr+JprvAimOlQ/KaILsCZclP8c4Uztgx7MfWE7DEjjD39hVQbC12lGEJD aRcSa1MQ1Tnepe/3O27ix0UaDTlgVojSl7UYiRpV/qMaMCUbHnNGUqza9wak3mLwh4Wz 0xyUQifU/CT7J4V8CvtEbcRPH5bK8RN3MHkJpXB250QpsoYsFpvOVRGDldU9uszisCRd LaxA== X-Gm-Message-State: APjAAAXX8TSf7vAJuUgMtjALYUxdTrT75Yj1oNdK4NN+Qpe2uJ4qBfg/ NYaIe6gKzcv1hAMpiUcqzSu/3Jnz X-Google-Smtp-Source: APXvYqwpg3pFqV3mDlbHbH+wjqRAeedWOYRqCzvbqI1ar3bpoKX0BYShJjMax0YAT3P2M6mrsZe5Nw== X-Received: by 2002:ac2:4201:: with SMTP id y1mr1750045lfh.127.1564739850936; Fri, 02 Aug 2019 02:57:30 -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.29 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 02 Aug 2019 02:57:30 -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 3/5] t7503: simplify file-juggling Date: Fri, 2 Aug 2019 11:56:37 +0200 Message-Id: <12cae1e82eceb0586bbc132bf8f883bb862189d7.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 Rather than creating an empty "expected_hooks" file and another empty file "actual_hooks" (which we want to not be appended to), just verify that "actual_hooks" isn't created. Do still clean up the "actual_hooks" file, so that a failing test won't start affecting later tests too. Signed-off-by: Martin Ågren --- ...3-pre-commit-and-pre-merge-commit-hooks.sh | 60 +++++++------------ 1 file changed, 20 insertions(+), 40 deletions(-) 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 a6f1240aa2..477207cb5c 100755 --- a/t/t7503-pre-commit-and-pre-merge-commit-hooks.sh +++ b/t/t7503-pre-commit-and-pre-merge-commit-hooks.sh @@ -42,43 +42,35 @@ test_expect_success 'root commit' ' ' test_expect_success 'with no hook' ' - test_when_finished "rm -f expected_hooks actual_hooks" && - >expected_hooks && - >actual_hooks && + test_when_finished "rm -f actual_hooks" && echo "foo" >file && git add file && git commit -m "first" && - test_cmp expected_hooks actual_hooks + test_path_is_missing actual_hooks ' test_expect_success 'with no hook (merge)' ' - test_when_finished "rm -f expected_hooks actual_hooks" && - >expected_hooks && - >actual_hooks && + test_when_finished "rm -f actual_hooks" && git checkout side && git merge -m "merge master" master && git checkout master && - test_cmp expected_hooks actual_hooks + test_path_is_missing actual_hooks ' test_expect_success '--no-verify with no hook' ' - test_when_finished "rm -f expected_hooks actual_hooks" && - >expected_hooks && - >actual_hooks && + test_when_finished "rm -f actual_hooks" && echo "bar" >file && git add file && git commit --no-verify -m "bar" && - test_cmp expected_hooks actual_hooks + test_path_is_missing actual_hooks ' test_expect_success '--no-verify with no hook (merge)' ' - test_when_finished "rm -f expected_hooks actual_hooks" && - >expected_hooks && - >actual_hooks && + test_when_finished "rm -f actual_hooks" && git checkout side && git merge --no-verify -m "merge master" master && git checkout master && - test_cmp expected_hooks actual_hooks + test_path_is_missing actual_hooks ' test_expect_success 'with succeeding hook' ' @@ -104,25 +96,21 @@ test_expect_success 'with succeeding hook (merge)' ' ' test_expect_success '--no-verify with succeeding hook' ' - test_when_finished "rm -f \"$PRECOMMIT\" expected_hooks actual_hooks" && + test_when_finished "rm -f \"$PRECOMMIT\" actual_hooks" && ln -s "success.sample" "$PRECOMMIT" && - >expected_hooks && - >actual_hooks && echo "even more" >>file && git add file && git commit --no-verify -m "even more" && - test_cmp expected_hooks actual_hooks + test_path_is_missing actual_hooks ' test_expect_success '--no-verify with succeeding hook (merge)' ' - test_when_finished "rm -f \"$PREMERGE\" expected_hooks actual_hooks" && + test_when_finished "rm -f \"$PREMERGE\" actual_hooks" && ln -s "success.sample" "$PREMERGE" && - >expected_hooks && - >actual_hooks && git checkout side && git merge --no-verify -m "merge master" master && git checkout master && - test_cmp expected_hooks actual_hooks + test_path_is_missing actual_hooks ' test_expect_success 'with failing hook' ' @@ -137,14 +125,12 @@ test_expect_success 'with failing hook' ' ' test_expect_success '--no-verify with failing hook' ' - test_when_finished "rm -f \"$PRECOMMIT\" expected_hooks actual_hooks" && + test_when_finished "rm -f \"$PRECOMMIT\" actual_hooks" && ln -s "fail.sample" "$PRECOMMIT" && - >expected_hooks && - >actual_hooks && echo "stuff" >>file && git add file && git commit --no-verify -m "stuff" && - test_cmp expected_hooks actual_hooks + test_path_is_missing actual_hooks ' test_expect_success 'with failing hook (merge)' ' @@ -159,38 +145,32 @@ test_expect_success 'with failing hook (merge)' ' ' test_expect_success '--no-verify with failing hook (merge)' ' - test_when_finished "rm -f \"$PREMERGE\" expected_hooks actual_hooks" && + test_when_finished "rm -f \"$PREMERGE\" actual_hooks" && ln -s "fail.sample" "$PREMERGE" && - >expected_hooks && - >actual_hooks && git checkout side && git merge --no-verify -m "merge master" master && git checkout master && - test_cmp expected_hooks actual_hooks + test_path_is_missing actual_hooks ' test_expect_success POSIXPERM 'with non-executable hook' ' - test_when_finished "rm -f \"$PRECOMMIT\" expected_hooks actual_hooks && chmod +x \"$HOOKDIR/fail.sample\"" && + test_when_finished "rm -f \"$PRECOMMIT\" actual_hooks && chmod +x \"$HOOKDIR/fail.sample\"" && ln -s "fail.sample" "$PRECOMMIT" && chmod -x "$HOOKDIR/fail.sample" && - >expected_hooks && - >actual_hooks && echo "content" >>file && git add file && git commit -m "content" && - test_cmp expected_hooks actual_hooks + test_path_is_missing actual_hooks ' test_expect_success POSIXPERM '--no-verify with non-executable hook' ' - test_when_finished "rm -f \"$PRECOMMIT\" expected_hooks actual_hooks && chmod +x \"$HOOKDIR/fail.sample\"" && + test_when_finished "rm -f \"$PRECOMMIT\" actual_hooks && chmod +x \"$HOOKDIR/fail.sample\"" && ln -s "fail.sample" "$PRECOMMIT" && chmod -x "$HOOKDIR/fail.sample" && - >expected_hooks && - >actual_hooks && echo "more content" >>file && git add file && git commit --no-verify -m "more content" && - test_cmp expected_hooks actual_hooks + test_path_is_missing actual_hooks ' test_expect_success 'with hook requiring GIT_PREFIX' ' From patchwork Fri Aug 2 09:56:38 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: 11073059 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 E19C41395 for ; Fri, 2 Aug 2019 09:58:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C9DA7287D2 for ; Fri, 2 Aug 2019 09:58:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BB9A2287DE; Fri, 2 Aug 2019 09:58:44 +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 DC88C287D2 for ; Fri, 2 Aug 2019 09:58:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2406603AbfHBJ6l (ORCPT ); Fri, 2 Aug 2019 05:58:41 -0400 Received: from mail-lj1-f196.google.com ([209.85.208.196]:43655 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2406933AbfHBJ5h (ORCPT ); Fri, 2 Aug 2019 05:57:37 -0400 Received: by mail-lj1-f196.google.com with SMTP id y17so47708688ljk.10 for ; Fri, 02 Aug 2019 02:57:36 -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=UWWx71o67XTI0PBPUgG3FzPmjhvDdfA99bgmG9NcGZc=; b=e999KSoLZtsaSXN3ooH7a3l9CivmP/ZdQ/rTKzaU5IHmPvgDqVritYyjY3dtSZIL0f h98B+9nfE32NPAaJ5OuEUA+PC50qTXm/dDOvkcu+LEp3QkQiRaluNVfAebXXYKV98MtP rQl9Z4Kno5jeIZ5DnTL6ETwab8Hxwb/4BT5BWYe/2rZ2XVO4bdJP1VGgzCioa3RG4x/d YgeYqQ17TmMXXcmCyzjxOY5a9UcRBoSQmT7hNZc4Afx4ANVT07LRZWv+lJffzlegkNWF GmiQdBq53B8CvZg2nHDSBIE7klB3j6VtXmVdYhDXhcZpInnlBBtXC3QaZUZtZzdW9kyG UU0Q== 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=UWWx71o67XTI0PBPUgG3FzPmjhvDdfA99bgmG9NcGZc=; b=dI+b8/wsAVH43XHAXmFmOgPcNHVKgb2DoDfXV5FES8/GEDqjN2vvwgIaVQTnWTR/aL lDZjesvHu3F0X1RZ4GbKUJebspc8UMh1k1mskMaP9GIAbTYQch0d3BxbhncoN5SQ3aLj hmauFz4pNoMkYp/mVX1yLho1sghK9rut8f+isP4GjQJdgcK8p4BjeVKMalu8Fr877DZi CEryx7C7S0Ev8VfhsL2MsnmtJU8STlArhs6vEj5elYn7jxFUS1bGEHfK+DF4/e1tQoE0 Sw9Axj/mzx27mS3j2R2Fu/w6NEowf5B7Bqb+fxYl0PvcglE+pYuWhlOcRIcQHo+2JzqO GAfQ== X-Gm-Message-State: APjAAAUakDi3IbBYYBt7dM2SUVe8PTbSahMB08QzESmnZw5acF4UPB+5 9wj9NhextjYRIFO3jrosfaw= X-Google-Smtp-Source: APXvYqzEJOmMbmtS7PtyWaJ8OFKJbMmdBhpzjeiU+wwiFJeu8/O63VKFsWdxfVIKdh1CuMg4q4XD/w== X-Received: by 2002:a2e:854d:: with SMTP id u13mr72650580ljj.236.1564739855345; Fri, 02 Aug 2019 02:57:35 -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.34 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 02 Aug 2019 02:57:34 -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 4/5] t7503: don't create "actual_hooks" for later appending Date: Fri, 2 Aug 2019 11:56:38 +0200 Message-Id: <4901b00e7c96452c030354e4e582f55f5d6b1de1.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 If we fail to call the hook, we won't append to "actual_hooks". "test_cmp" is able to handle a missing file just fine, so these "pre-creations" are mostly confusing. Let's drop them. Signed-off-by: Martin Ågren --- This "pre-creation" does protect against the file already existing, i.e., it could be seen as a "clearing". But since we use "test_when_finished" in this script... Also, these were "touch" before another of my suggestions, so these really were "pre-creating" these files if needed. t/t7503-pre-commit-and-pre-merge-commit-hooks.sh | 4 ---- 1 file changed, 4 deletions(-) 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 477207cb5c..f0c73fd58d 100755 --- a/t/t7503-pre-commit-and-pre-merge-commit-hooks.sh +++ b/t/t7503-pre-commit-and-pre-merge-commit-hooks.sh @@ -76,7 +76,6 @@ test_expect_success '--no-verify with no hook (merge)' ' test_expect_success 'with succeeding hook' ' test_when_finished "rm -f \"$PRECOMMIT\" expected_hooks actual_hooks" && ln -s "success.sample" "$PRECOMMIT" && - >actual_hooks && echo "$PRECOMMIT" >expected_hooks && echo "more" >>file && git add file && @@ -87,7 +86,6 @@ test_expect_success 'with succeeding hook' ' test_expect_success 'with succeeding hook (merge)' ' test_when_finished "rm -f \"$PREMERGE\" expected_hooks actual_hooks" && ln -s "success.sample" "$PREMERGE" && - >actual_hooks && echo "$PREMERGE" >expected_hooks && git checkout side && git merge -m "merge master" master && @@ -116,7 +114,6 @@ test_expect_success '--no-verify with succeeding hook (merge)' ' test_expect_success 'with failing hook' ' test_when_finished "rm -f \"$PRECOMMIT\" expected_hooks actual_hooks" && ln -s "fail.sample" "$PRECOMMIT" && - >actual_hooks && echo "$PRECOMMIT" >expected_hooks && echo "another" >>file && git add file && @@ -136,7 +133,6 @@ test_expect_success '--no-verify with failing hook' ' test_expect_success 'with failing hook (merge)' ' test_when_finished "rm -f \"$PREMERGE\" expected_hooks actual_hooks" && ln -s "fail.sample" "$PREMERGE" && - >actual_hooks && echo "$PREMERGE" >expected_hooks && git checkout side && test_must_fail git merge -m "merge master" master && 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" &&