From patchwork Tue May 16 02:26:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Junio C Hamano X-Patchwork-Id: 13242477 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C245CC7EE22 for ; Tue, 16 May 2023 02:28:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229698AbjEPC2z (ORCPT ); Mon, 15 May 2023 22:28:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47454 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229502AbjEPC2y (ORCPT ); Mon, 15 May 2023 22:28:54 -0400 X-Greylist: delayed 122 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Mon, 15 May 2023 19:28:53 PDT Received: from pb-smtp20.pobox.com (pb-smtp20.pobox.com [173.228.157.52]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3DA7C5B80 for ; Mon, 15 May 2023 19:28:52 -0700 (PDT) Received: from pb-smtp20.pobox.com (unknown [127.0.0.1]) by pb-smtp20.pobox.com (Postfix) with ESMTP id 9B04C1F95FF; Mon, 15 May 2023 22:26:52 -0400 (EDT) (envelope-from gitster@pobox.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=pobox.com; h=from:to :subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; s=sasl; bh=mA7HqVqKGVvPcIJc1huVL6qOE stIQG8xAqOsNe6x1Ek=; b=Vmeb8c3n1BCKqA04Ve0Js0IkN9wy4iXRSg0zvj46v pmiUBZf1eGwM8yJPcgiPIpnEJAoQ1MRVUgB9zOQintYnS99BIdYIQkU0AuLo5g6X qAfOTNzVSARpNrj7C+eVja4ZRdKoHE5LHYYyVMWH5Ip0AzMxeeM34AOr9koSTAKY gs= Received: from pb-smtp20.sea.icgroup.com (unknown [127.0.0.1]) by pb-smtp20.pobox.com (Postfix) with ESMTP id 93ABF1F95FD; Mon, 15 May 2023 22:26:52 -0400 (EDT) (envelope-from gitster@pobox.com) Received: from pobox.com (unknown [35.203.137.187]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pb-smtp20.pobox.com (Postfix) with ESMTPSA id C446F1F95F8; Mon, 15 May 2023 22:26:49 -0400 (EDT) (envelope-from gitster@pobox.com) From: Junio C Hamano To: git@vger.kernel.org Subject: [PATCH 1/3] tests: do not negate test_path_exists Date: Mon, 15 May 2023 19:26:44 -0700 Message-ID: <20230516022646.648123-2-gitster@pobox.com> X-Mailer: git-send-email 2.41.0-rc0 In-Reply-To: <20230516022646.648123-1-gitster@pobox.com> References: <20230516022646.648123-1-gitster@pobox.com> MIME-Version: 1.0 X-Pobox-Relay-ID: 1CD92C32-F391-11ED-9B6C-C2DA088D43B2-77302942!pb-smtp20.pobox.com Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org As a way to assert the path 'foo' is missing, "! test_path_exists foo" a poor way to do so, as the helper is designed to complain when 'foo' is missing, but the intention of the author who used negated form was to make sure it does not exist. This does not help debugging the tests. Use test_path_is_missing instead, which is a more appropriate helper. Signed-off-by: Junio C Hamano --- t/t4067-diff-partial-clone.sh | 4 ++-- t/t4115-apply-symlink.sh | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/t/t4067-diff-partial-clone.sh b/t/t4067-diff-partial-clone.sh index f60f5cbd65..7af3a08862 100755 --- a/t/t4067-diff-partial-clone.sh +++ b/t/t4067-diff-partial-clone.sh @@ -151,7 +151,7 @@ test_expect_success 'diff does not fetch anything if inexact rename detection is # Ensure no fetches. GIT_TRACE_PACKET="$(pwd)/trace" git -C client diff --raw -M HEAD^ HEAD && - ! test_path_exists trace + test_path_is_missing trace ' test_expect_success 'diff --break-rewrites fetches only if necessary, and batches blobs if it does' ' @@ -171,7 +171,7 @@ test_expect_success 'diff --break-rewrites fetches only if necessary, and batche # Ensure no fetches. GIT_TRACE_PACKET="$(pwd)/trace" git -C client diff --raw -M HEAD^ HEAD && - ! test_path_exists trace && + test_path_is_missing trace && # But with --break-rewrites, ensure that there is exactly 1 negotiation # by checking that there is only 1 "done" line sent. ("done" marks the diff --git a/t/t4115-apply-symlink.sh b/t/t4115-apply-symlink.sh index e95e6d4e7d..a22a90d552 100755 --- a/t/t4115-apply-symlink.sh +++ b/t/t4115-apply-symlink.sh @@ -74,7 +74,7 @@ test_expect_success SYMLINKS 'symlink escape when creating new files' ' error: affected file ${SQ}renamed-symlink/create-me${SQ} is beyond a symbolic link EOF test_cmp expected_stderr stderr && - ! test_path_exists .git/create-me + test_path_is_missing .git/create-me ' test_expect_success SYMLINKS 'symlink escape when modifying file' ' From patchwork Tue May 16 02:26:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Junio C Hamano X-Patchwork-Id: 13242480 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1C448C77B7D for ; Tue, 16 May 2023 02:32:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229620AbjEPCca (ORCPT ); Mon, 15 May 2023 22:32:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48868 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229452AbjEPCc3 (ORCPT ); Mon, 15 May 2023 22:32:29 -0400 Received: from pb-smtp1.pobox.com (pb-smtp1.pobox.com [64.147.108.70]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B2D5F19BC for ; Mon, 15 May 2023 19:32:28 -0700 (PDT) Received: from pb-smtp1.pobox.com (unknown [127.0.0.1]) by pb-smtp1.pobox.com (Postfix) with ESMTP id 2AA59197E78; Mon, 15 May 2023 22:26:53 -0400 (EDT) (envelope-from gitster@pobox.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=pobox.com; h=from:to :subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; s=sasl; bh=JaK7yHo6aNKVvyDAlq2QQuc/Y gpWc2qHk9ZL3QPfyEo=; b=WkzGgyqusd8dMSNc4mwKTOqsrjKMAU/4XJr0q1O+I z4EnLp1yB6V9l6XHaXjqG7SadbdK9qr+K2ZcqGUqU9TmQIos0WTbc7ANSmz86b0k 1UCcgLrWAiO3BaRdoCW6pMex33CLE7iJUSfEl13kH+Ve7w1myrz3HeYH/EQ+YjEB M8= Received: from pb-smtp1.nyi.icgroup.com (unknown [127.0.0.1]) by pb-smtp1.pobox.com (Postfix) with ESMTP id 24C46197E77; Mon, 15 May 2023 22:26:53 -0400 (EDT) (envelope-from gitster@pobox.com) Received: from pobox.com (unknown [35.203.137.187]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pb-smtp1.pobox.com (Postfix) with ESMTPSA id 93B89197E76; Mon, 15 May 2023 22:26:52 -0400 (EDT) (envelope-from gitster@pobox.com) From: Junio C Hamano To: git@vger.kernel.org Subject: [PATCH 2/3] t2021: do not negate test_path_is_dir Date: Mon, 15 May 2023 19:26:45 -0700 Message-ID: <20230516022646.648123-3-gitster@pobox.com> X-Mailer: git-send-email 2.41.0-rc0 In-Reply-To: <20230516022646.648123-1-gitster@pobox.com> References: <20230516022646.648123-1-gitster@pobox.com> MIME-Version: 1.0 X-Pobox-Relay-ID: 1E8474F6-F391-11ED-9F27-C65BE52EC81B-77302942!pb-smtp1.pobox.com Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org In this test, a path (some_dir) that is originally a directory is to be removed and then to be replaced with a file of the same name. The expectation is that the path becomes a file at the end. However, "! test_path_is_dir some_dir" is used to catch a breakage that leaves the path as a directory. But as with all the "test_path_is..." helpers, this use of the helper makes it loud when the expectation (i.e. it is a directory) is met, and otherwise is silent when it is not---this does not help debugging. Be more explicit and state that we expect the path to become a file. Signed-off-by: Junio C Hamano --- t/t2021-checkout-overwrite.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/t/t2021-checkout-overwrite.sh b/t/t2021-checkout-overwrite.sh index 034f62c13c..ecfacf0f7f 100755 --- a/t/t2021-checkout-overwrite.sh +++ b/t/t2021-checkout-overwrite.sh @@ -77,7 +77,7 @@ test_expect_success 'checkout --overwrite-ignore should succeed if only ignored echo autogenerated information >some_dir/ignore && echo ignore >.git/info/exclude && git checkout --overwrite-ignore df_conflict && - ! test_path_is_dir some_dir + test_path_is_file some_dir ' test_done From patchwork Tue May 16 02:26:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Junio C Hamano X-Patchwork-Id: 13242479 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A6016C7EE22 for ; Tue, 16 May 2023 02:31:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229559AbjEPCbt (ORCPT ); Mon, 15 May 2023 22:31:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48114 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229468AbjEPCbq (ORCPT ); Mon, 15 May 2023 22:31:46 -0400 X-Greylist: delayed 291 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Mon, 15 May 2023 19:31:45 PDT Received: from pb-smtp2.pobox.com (pb-smtp2.pobox.com [64.147.108.71]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 34C165B80 for ; Mon, 15 May 2023 19:31:44 -0700 (PDT) Received: from pb-smtp2.pobox.com (unknown [127.0.0.1]) by pb-smtp2.pobox.com (Postfix) with ESMTP id B25D81892F4; Mon, 15 May 2023 22:26:54 -0400 (EDT) (envelope-from gitster@pobox.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=pobox.com; h=from:to :subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; s=sasl; bh=rg1AOqOhOniL3BZVuPT58cf6Z Jeui0IMuVHMA57nwpQ=; b=hc5h8Nes5dDzE4vavN1PuQQou3OOBA22QRW8l0osi EvEX1xL3bvm3eacJPAaIQPDcbyB0N7OMI1UoUSIm1btyihRPDossdx4I73QL+jT4 BJg5yJK/8zJWIH7QbWLheTn7rsDkcBlxHNWgNHA8bwqIxIHIZEwzR2ivvm0L+oxp eE= Received: from pb-smtp2.nyi.icgroup.com (unknown [127.0.0.1]) by pb-smtp2.pobox.com (Postfix) with ESMTP id AB2C31892F3; Mon, 15 May 2023 22:26:54 -0400 (EDT) (envelope-from gitster@pobox.com) Received: from pobox.com (unknown [35.203.137.187]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pb-smtp2.pobox.com (Postfix) with ESMTPSA id 216341892F2; Mon, 15 May 2023 22:26:54 -0400 (EDT) (envelope-from gitster@pobox.com) From: Junio C Hamano To: git@vger.kernel.org Subject: [PATCH 3/3] test: do not negate test_path_is_* to assert absense Date: Mon, 15 May 2023 19:26:46 -0700 Message-ID: <20230516022646.648123-4-gitster@pobox.com> X-Mailer: git-send-email 2.41.0-rc0 In-Reply-To: <20230516022646.648123-1-gitster@pobox.com> References: <20230516022646.648123-1-gitster@pobox.com> MIME-Version: 1.0 X-Pobox-Relay-ID: 1F6EA760-F391-11ED-BF3E-307A8E0A682E-77302942!pb-smtp2.pobox.com Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org These tests use "! test_path_is_dir" or "! test_path_is_file" to ensure that the path is not recursively checked out or "submodule update" did not touch the working tree. Use "test_path_is_missing" to assert that the path does not exist, instead of negating test_path_is_* helpers; they are designed to be loud in wrong occasions. Besides, negating "test_path_is_dir" would mean we would be happy if a file exists there, which is not the case for these tests. Signed-off-by: Junio C Hamano --- t/lib-submodule-update.sh | 2 +- t/t5572-pull-submodule.sh | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/t/lib-submodule-update.sh b/t/lib-submodule-update.sh index dee14992c5..9acb0d5d19 100644 --- a/t/lib-submodule-update.sh +++ b/t/lib-submodule-update.sh @@ -802,7 +802,7 @@ test_submodule_recursing_with_args_common () { git branch -t no_submodule origin/no_submodule && $command no_submodule && test_superproject_content origin/no_submodule && - ! test_path_is_dir sub1 && + test_path_is_missing sub1 && test_must_fail git config -f .git/modules/sub1/config core.worktree && test_must_fail git config -f .git/modules/sub1/modules/sub2/config core.worktree ) diff --git a/t/t5572-pull-submodule.sh b/t/t5572-pull-submodule.sh index 09097eff3f..4e917bf87d 100755 --- a/t/t5572-pull-submodule.sh +++ b/t/t5572-pull-submodule.sh @@ -121,7 +121,7 @@ test_expect_success "fetch.recurseSubmodules option triggers recursive fetch (bu sub_oid=$(git -C child rev-parse HEAD) && git -C super/sub cat-file -e $sub_oid && # Check that the submodule worktree did not update - ! test_path_is_file super/sub/merge_strategy_5.t + test_path_is_missing super/sub/merge_strategy_5.t ' test_expect_success "fetch.recurseSubmodules takes precedence over submodule.recurse" ' @@ -134,7 +134,7 @@ test_expect_success "fetch.recurseSubmodules takes precedence over submodule.rec sub_oid=$(git -C child rev-parse HEAD) && git -C super/sub cat-file -e $sub_oid && # Check that the submodule worktree did not update - ! test_path_is_file super/sub/merge_strategy_6.t + test_path_is_missing super/sub/merge_strategy_6.t ' test_expect_success 'pull --rebase --recurse-submodules (remote superproject submodule changes, local submodule changes)' '