From patchwork Wed Jan 24 08:45:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 13528806 Received: from wout3-smtp.messagingengine.com (wout3-smtp.messagingengine.com [64.147.123.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E575F17BA7 for ; Wed, 24 Jan 2024 08:45:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=64.147.123.19 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706085920; cv=none; b=mSCPsUAj3+oniGjLO4JrGkTGX4uHKcIsdxZUikh6ByTUvg5AuulEzdWKYdWHHaxaqST6ONSNUs4Pu0EkeUFz0xbh9jDorU0EtIbbaQn6HfG3YfTdKWe8Ccu6B7Bo7i3+9C0moASc9Lknvz3fsVKBgl9HQAF1YPPoXPzRcW0sP4Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706085920; c=relaxed/simple; bh=sVk6RHTOHgVv7eXOkfQdo+dM5q9krh+FP1KMYcsopzQ=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=jdGkgwaQWCAn+2zR11Yq65vcvHKDaML44BcZEjvQCBg1bIbBpoabfECyiVRu9hnKbMDrOytBOr0vriUFohJ9jAEMKNNYLGGQj7zc/0a+vDPuIetoNhP/diDkMJ6eU5WUEPKAkFlGnhqxN4M2poiRk+iNbYS+eoDxqD+gnlbA0iU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pks.im; spf=pass smtp.mailfrom=pks.im; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b=SUwdcNzg; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=Sg25j+ef; arc=none smtp.client-ip=64.147.123.19 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pks.im Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pks.im Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b="SUwdcNzg"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="Sg25j+ef" Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.west.internal (Postfix) with ESMTP id B3AC53200AEB; Wed, 24 Jan 2024 03:45:17 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Wed, 24 Jan 2024 03:45:18 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pks.im; h=cc:cc :content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm3; t=1706085917; x=1706172317; bh=28kkoTR9hx Fd+b5burZKsFuLkbASjrfM5ha9ImfZW+4=; b=SUwdcNzgApFICQZyvnX3/2856E X+ETs8tyOab2Qj0rOdIbexoryfzmChaW3h0BsPklwXmTrLVeVfAHRHw4vve6Bswo kLtm26VG8sYju5h6msPhjULCMhG7Pl1pj1dc3SBSi0YesiWp89JlwV74sTs/zDJD Sf9gbPnheUGi1AmRFlS/AyTkjdq8aqI9Nv+yuqcZfADWlxgcnl5+U+K6XXLR4gic zKX6DCkcN6KqwIfTSCzEnCnByJUhL7jyaKbbk8WCvd1RC4XapqOkI1GZkPmoMDeI EKAd4Bq7wYprzhgX/EntclX/+z0GnmZr/Pv+YLZAvJ9xdbSmmU6fxKiDZ05Q== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; t=1706085917; x=1706172317; bh=28kkoTR9hxFd+b5burZKsFuLkbAS jrfM5ha9ImfZW+4=; b=Sg25j+efGOFuI+fWpbTtpEWMXc7+bqvb2mJI6zWjdwlA UOEg6e0ohTFi+o0zYbOs86ke7ERyN9MWq3EYh9EsfRqIYScioslaFuyhqMJzm4QX 1ZAWsIaHl/1tsODqRf6ScVzHPwBIlmwWWEpXZKto0fWC/x9KRnemIv0LEBWDcErr yGbG9a8E7QzAgSxhlqRBBjkiIiM3Nt0e1aiPGNWKrpB+ZLTB1Fw6uuYZ37+e+vFH qFj54rht5pbLyQXtimHe4wbKyjqWBTc/IrFHEkxRJT1ji/H8RdUAPitST4WNN1QY 7Vu1ZEZ0TwkSK2wA95EEFwZZWBYwGafYcUxUbP199Q== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrvdeltddgleduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvfevuffkfhggtggujgesghdtreertddtvdenucfhrhhomheprfgrthhr ihgtkhcuufhtvghinhhhrghrughtuceophhssehpkhhsrdhimheqnecuggftrfgrthhtvg hrnhepueektdevtdffveeljeetgfehheeigeekleduvdeffeeghefgledttdehjeelffet necuvehluhhsthgvrhfuihiivgepudenucfrrghrrghmpehmrghilhhfrhhomhepphhsse hpkhhsrdhimh X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 24 Jan 2024 03:45:15 -0500 (EST) Received: by vm-mail (OpenSMTPD) with ESMTPSA id a427360a (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Wed, 24 Jan 2024 08:42:09 +0000 (UTC) Date: Wed, 24 Jan 2024 09:45:13 +0100 From: Patrick Steinhardt To: git@vger.kernel.org Cc: Taylor Blau , Eric Sunshine , Toon Claes , Christian Couder , Justin Tobler Subject: [PATCH v3 3/6] t1302: make tests more robust with new extensions Message-ID: References: Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: In t1302 we exercise logic around "core.repositoryFormatVersion" and extensions. These tests are not particularly robust against extensions like the newly introduced "refStorage" extension as we tend to clobber the repository's config file. We thus overwrite any extensions that were set, which may render the repository inaccessible in case it has to be accessed with a non-default ref storage. Refactor the tests to be more robust: - Check the DEFAULT_REPO_FORMAT prereq to determine the expected repository format version. This helps to ensure that we only need to update the prereq in a central place when new extensions are added. Furthermore, this allows us to stop seeding the now-unneeded object ID cache that was only used to figure out the repository version. - Use a separate repository to rewrite ".git/config" to test combinations of the repository format version and extensions. This ensures that we don't break the main test repository. While we could rewrite these tests to not overwrite preexisting extensions, it feels cleaner like this so that we can test extensions standalone without interference from the environment. - Do not rewrite ".git/config" when exercising the "preciousObjects" extension. Signed-off-by: Patrick Steinhardt --- t/t1302-repo-version.sh | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/t/t1302-repo-version.sh b/t/t1302-repo-version.sh index 179474fa65..42caa0d297 100755 --- a/t/t1302-repo-version.sh +++ b/t/t1302-repo-version.sh @@ -9,10 +9,6 @@ TEST_PASSES_SANITIZE_LEAK=true . ./test-lib.sh test_expect_success 'setup' ' - test_oid_cache <<-\EOF && - version sha1:0 - version sha256:1 - EOF cat >test.patch <<-\EOF && diff --git a/test.txt b/test.txt new file mode 100644 @@ -28,7 +24,12 @@ test_expect_success 'setup' ' ' test_expect_success 'gitdir selection on normal repos' ' - test_oid version >expect && + if test_have_prereq DEFAULT_REPO_FORMAT + then + echo 0 + else + echo 1 + fi >expect && git config core.repositoryformatversion >actual && git -C test config core.repositoryformatversion >actual2 && test_cmp expect actual && @@ -79,8 +80,13 @@ mkconfig () { while read outcome version extensions; do test_expect_success "$outcome version=$version $extensions" " - mkconfig $version $extensions >.git/config && - check_${outcome} + test_when_finished 'rm -rf extensions' && + git init extensions && + ( + cd extensions && + mkconfig $version $extensions >.git/config && + check_${outcome} + ) " done <<\EOF allow 0 @@ -94,7 +100,8 @@ allow 1 noop-v1 EOF test_expect_success 'precious-objects allowed' ' - mkconfig 1 preciousObjects >.git/config && + git config core.repositoryFormatVersion 1 && + git config extensions.preciousObjects 1 && check_allow '