From patchwork Tue Oct 24 14:04:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 13434672 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.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 9A99D2943C for ; Tue, 24 Oct 2023 14:05:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b="OhMwukcK"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="CROktDWb" Received: from wout4-smtp.messagingengine.com (wout4-smtp.messagingengine.com [64.147.123.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7E99A10A for ; Tue, 24 Oct 2023 07:04:59 -0700 (PDT) Received: from compute7.internal (compute7.nyi.internal [10.202.2.48]) by mailout.west.internal (Postfix) with ESMTP id 14CCC3200A85; Tue, 24 Oct 2023 10:04:57 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute7.internal (MEProxy); Tue, 24 Oct 2023 10:04:58 -0400 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:sender :subject:subject:to:to; s=fm3; t=1698156297; x=1698242697; bh=C+ 5vwRVeS/TbtoQbcWTS8+eNESagAiXw5WXz8u88Bkk=; b=OhMwukcKbqdwN7LC44 wAINEf9n4GsF77srKLyfWGDqw9mwtE5vlM4A2BrTaSo/98vTwPnP/Jtgl8EZyZgD 1PJD1d0LYmtoN7bf8AhHiKJJK3K/kq0BOVyVIKI13idpEb19CP/Wr9IPZFpTKdPZ t1BE8kXve9FVdpFvuZXjPNXyvQktTxdLWX/bYkvrDouG9I8oRfKTa1TGqsmUGiXj vAa3qoa6p3Y9680WePnxJtgk57l2W0TvnNls7bD+BoKHqujgeGyapwdWqL0/5HqJ PS8Qx91IcKE+bYya9ZLnLDa4isWYXNLdp8m6yyKS12J+NzWTrfU9h088RfAkjyL/ Kb8A== 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:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; t=1698156297; x=1698242697; bh=C+5vwRVeS/Tbt oQbcWTS8+eNESagAiXw5WXz8u88Bkk=; b=CROktDWb3nfg4eoxcBR9HHL2M52zN HE2le4Bi4/M6JtgDNT+ew5D9xGT8Cr6BcUqaG/nLihdVNFuLWGwdN1gl0dm4OVva gIe+WW6pU9aqccFDoOvkgGGd2PV13GTpGAdI2w//rxoxrvhZvY5Du+53GiG3C8b8 LQGWObS/Ye957jGgDdu9xGWOcAC0hBGTJCbq/vmhVF3HXrrq0YdHn/1nRcUoCJ3h 2lUv6LUyQNBqqUoI2pxNym59ocNwVF9ezUGGEtlAxNjKOq/1Wu9MLsILcUUqDqkk 61aZUj+zaLyhCJjrcuGnrj32Q1dPH/tVMUcn1/s9G+Wc2zXu+i3HpWaSQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrkeekgdejvdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpeffhffvvefukfhfgggtuggjsehgtderredttddvnecuhfhrohhmpefrrghtrhhi tghkucfuthgvihhnhhgrrhguthcuoehpshesphhkshdrihhmqeenucggtffrrghtthgvrh hnpeeukedtvedtffevleejtefgheehieegkeeluddvfeefgeehgfeltddtheejleffteen ucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehpshesph hkshdrihhm X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 24 Oct 2023 10:04:55 -0400 (EDT) Received: by vm-mail (OpenSMTPD) with ESMTPSA id 92f25b94 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Tue, 24 Oct 2023 14:04:50 +0000 (UTC) Date: Tue, 24 Oct 2023 16:04:53 +0200 From: Patrick Steinhardt To: git@vger.kernel.org Cc: Han-Wen Nienhuys , Eric Sunshine , Taylor Blau , Junio C Hamano Subject: [PATCH v2 1/9] t: allow skipping expected object ID in `ref-store update-ref` 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: We require the caller to pass both the old and new expected object ID to our `test-tool ref-store update-ref` helper. When trying to update a symbolic reference though it's impossible to specify the expected object ID, which means that the test would instead have to force-update the reference. This is currently impossible though. Update the helper to optionally skip verification of the old object ID in case the test passes in an empty old object ID as input. Signed-off-by: Patrick Steinhardt --- t/helper/test-ref-store.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/t/helper/test-ref-store.c b/t/helper/test-ref-store.c index 48552e6a9e0..702ec1f128a 100644 --- a/t/helper/test-ref-store.c +++ b/t/helper/test-ref-store.c @@ -298,16 +298,19 @@ static int cmd_update_ref(struct ref_store *refs, const char **argv) const char *new_sha1_buf = notnull(*argv++, "new-sha1"); const char *old_sha1_buf = notnull(*argv++, "old-sha1"); unsigned int flags = arg_flags(*argv++, "flags", transaction_flags); - struct object_id old_oid; + struct object_id old_oid, *old_oid_ptr = NULL; struct object_id new_oid; - if (get_oid_hex(old_sha1_buf, &old_oid)) - die("cannot parse %s as %s", old_sha1_buf, the_hash_algo->name); + if (*old_sha1_buf) { + if (get_oid_hex(old_sha1_buf, &old_oid)) + die("cannot parse %s as %s", old_sha1_buf, the_hash_algo->name); + old_oid_ptr = &old_oid; + } if (get_oid_hex(new_sha1_buf, &new_oid)) die("cannot parse %s as %s", new_sha1_buf, the_hash_algo->name); return refs_update_ref(refs, msg, refname, - &new_oid, &old_oid, + &new_oid, old_oid_ptr, flags, UPDATE_REFS_DIE_ON_ERR); } From patchwork Tue Oct 24 14:04:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 13434673 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.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 328232C858 for ; Tue, 24 Oct 2023 14:05:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b="JSwr+TrQ"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="e37tPlv0" Received: from wout4-smtp.messagingengine.com (wout4-smtp.messagingengine.com [64.147.123.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7A1E2120 for ; Tue, 24 Oct 2023 07:05:03 -0700 (PDT) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.west.internal (Postfix) with ESMTP id 3B4393200A7E; Tue, 24 Oct 2023 10:05:02 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Tue, 24 Oct 2023 10:05:02 -0400 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:sender :subject:subject:to:to; s=fm3; t=1698156301; x=1698242701; bh=0D dE7d1b6iTcp6aUQf1B1SBodIQ4LToViEPdbNNhGyA=; b=JSwr+TrQfw1dDmaap0 ZXsvthWdQPD1Dqvj5fdLj1aXWZR9PKQ9kbcZmd9kc07/0aXSw2fehZ5OezUNKITi jbFZtnTn55Jtd3C/ggaAegJwLBzOfchiI8TF88+kwvbKWS4o19YzQJ3IAh+hTWOO G8/Bl/+7iWT5AJXgRmF86sf3cLaYI+rTPwsQL0bogVRqJboaq1ha95lxRRkXL+7g RKedNmPhyXTJ39i0IrOQUqvBtGey0mth+QLgP8MHEZOyxgRt8Tq/IWUZOPJH8VhN 7rs4Cg45D7hEjgbsiO4sFsJxM0W3kWYZnV8dmyNHgMXa92hrzP6Z89JlyOIgc3f1 1oCA== 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:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; t=1698156301; x=1698242701; bh=0DdE7d1b6iTcp 6aUQf1B1SBodIQ4LToViEPdbNNhGyA=; b=e37tPlv0QG+GOzZaDCv5hagNnnLU1 q3Xt0/tqM3qxKomGmSAs1jqqlCDkg0+3SxGaiLCYWgYGQODiYQBs972gTLSR1OZe b2AtfvTG0mEWi3m/PNLnsCUnXGfofwEaOCHg7ygJsWnM8ffxTsaMxyiZ0pLhRkM2 KFB7JQbOb/TTq54SIATf0paCQWmPd+RmF88h/eBCqq3b6nDIPz/hbE6tafPpjmr+ DR7BZqjlfh4yCUqOEpIWt6kYBekmPm8CmvdaACZHb9b4mz74vhbzGe9EToZmFGiU OfVSYa6PQaERQZAyR8xs6dsyF5Q7oWnAco0L9GSUlkstAEWviXgp0TgvA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrkeekgdejfecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpeffhffvvefukfhfgggtuggjsehgtderredttddvnecuhfhrohhmpefrrghtrhhi tghkucfuthgvihhnhhgrrhguthcuoehpshesphhkshdrihhmqeenucggtffrrghtthgvrh hnpeeukedtvedtffevleejtefgheehieegkeeluddvfeefgeehgfeltddtheejleffteen ucevlhhushhtvghrufhiiigvpedunecurfgrrhgrmhepmhgrihhlfhhrohhmpehpshesph hkshdrihhm X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 24 Oct 2023 10:05:00 -0400 (EDT) Received: by vm-mail (OpenSMTPD) with ESMTPSA id aeb7c874 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Tue, 24 Oct 2023 14:04:54 +0000 (UTC) Date: Tue, 24 Oct 2023 16:04:58 +0200 From: Patrick Steinhardt To: git@vger.kernel.org Cc: Han-Wen Nienhuys , Eric Sunshine , Taylor Blau , Junio C Hamano Subject: [PATCH v2 2/9] t: convert tests to not write references via the filesystem Message-ID: <4c0939d868efeb11710e68fd81224bcf31d38aba.1698156169.git.ps@pks.im> 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: Some of our tests manually create, update or delete references by writing the respective new values into the filesystem directly. While this works with the current files reference backend, this will break once we have a second reference backend implementation in our codebase. Refactor these tests to instead use git-update-ref(1) or our `ref-store` test tool. The latter is required in some cases where safety checks of git-update-ref(1) would otherwise reject a reference update. While at it, refactor some of the tests to schedule the cleanup command via `test_when_finished` before modifying the repository. Signed-off-by: Patrick Steinhardt --- t/t1400-update-ref.sh | 17 ++++++++--------- t/t1450-fsck.sh | 26 +++++++++++++------------- t/t3404-rebase-interactive.sh | 2 +- t/t5526-fetch-submodules.sh | 2 +- 4 files changed, 23 insertions(+), 24 deletions(-) diff --git a/t/t1400-update-ref.sh b/t/t1400-update-ref.sh index 4d66cd7f4a1..91cc6dff724 100755 --- a/t/t1400-update-ref.sh +++ b/t/t1400-update-ref.sh @@ -9,8 +9,6 @@ test_description='Test git update-ref and basic ref logging' Z=$ZERO_OID m=refs/heads/main -n_dir=refs/heads/gu -n=$n_dir/fixes outside=refs/foo bare=bare-repo @@ -62,10 +60,10 @@ test_expect_success "delete $m without oldvalue verification" ' test_must_fail git show-ref --verify -q $m ' -test_expect_success "fail to create $n" ' - test_when_finished "rm -f .git/$n_dir" && - touch .git/$n_dir && - test_must_fail git update-ref $n $A +test_expect_success "fail to create $n due to file/directory conflict" ' + test_when_finished "git update-ref -d refs/heads/gu" && + git update-ref refs/heads/gu $A && + test_must_fail git update-ref refs/heads/gu/fixes $A ' test_expect_success "create $m (by HEAD)" ' @@ -221,16 +219,16 @@ test_expect_success 'delete symref without dereference when the referred ref is ' test_expect_success 'update-ref -d is not confused by self-reference' ' + test_when_finished "test-tool ref-store main delete-refs REF_NO_DEREF refs/heads/self" && git symbolic-ref refs/heads/self refs/heads/self && - test_when_finished "rm -f .git/refs/heads/self" && test_path_is_file .git/refs/heads/self && test_must_fail git update-ref -d refs/heads/self && test_path_is_file .git/refs/heads/self ' test_expect_success 'update-ref --no-deref -d can delete self-reference' ' + test_when_finished "test-tool ref-store main delete-refs REF_NO_DEREF refs/heads/self" && git symbolic-ref refs/heads/self refs/heads/self && - test_when_finished "rm -f .git/refs/heads/self" && test_path_is_file .git/refs/heads/self && git update-ref --no-deref -d refs/heads/self && test_must_fail git show-ref --verify -q refs/heads/self @@ -434,7 +432,8 @@ test_expect_success 'Query "main@{2005-05-28}" (past end of history)' ' test_i18ngrep -F "warning: log for ref $m unexpectedly ended on $ld" e ' -rm -f .git/$m .git/logs/$m expect +rm -f expect +git update-ref -d $m test_expect_success 'creating initial files' ' test_when_finished rm -f M && diff --git a/t/t1450-fsck.sh b/t/t1450-fsck.sh index 10a539158c4..f55b539b083 100755 --- a/t/t1450-fsck.sh +++ b/t/t1450-fsck.sh @@ -15,6 +15,7 @@ test_expect_success setup ' git config --unset i18n.commitencoding && git checkout HEAD^0 && test_commit B fileB two && + orig_head=$(git rev-parse HEAD) && git tag -d A B && git reflog expire --expire=now --all ' @@ -115,15 +116,15 @@ test_expect_success 'zlib corrupt loose object output ' ' ' test_expect_success 'branch pointing to non-commit' ' - git rev-parse HEAD^{tree} >.git/refs/heads/invalid && + tree_oid=$(git rev-parse --verify HEAD^{tree}) && test_when_finished "git update-ref -d refs/heads/invalid" && + test-tool ref-store main update-ref msg refs/heads/invalid $tree_oid $ZERO_OID REF_SKIP_OID_VERIFICATION && test_must_fail git fsck 2>out && test_i18ngrep "not a commit" out ' test_expect_success 'HEAD link pointing at a funny object' ' - test_when_finished "mv .git/SAVED_HEAD .git/HEAD" && - mv .git/HEAD .git/SAVED_HEAD && + test_when_finished "git update-ref HEAD $orig_head" && echo $ZERO_OID >.git/HEAD && # avoid corrupt/broken HEAD from interfering with repo discovery test_must_fail env GIT_DIR=.git git fsck 2>out && @@ -131,8 +132,7 @@ test_expect_success 'HEAD link pointing at a funny object' ' ' test_expect_success 'HEAD link pointing at a funny place' ' - test_when_finished "mv .git/SAVED_HEAD .git/HEAD" && - mv .git/HEAD .git/SAVED_HEAD && + test_when_finished "git update-ref --no-deref HEAD $orig_head" && echo "ref: refs/funny/place" >.git/HEAD && # avoid corrupt/broken HEAD from interfering with repo discovery test_must_fail env GIT_DIR=.git git fsck 2>out && @@ -140,10 +140,9 @@ test_expect_success 'HEAD link pointing at a funny place' ' ' test_expect_success 'HEAD link pointing at a funny object (from different wt)' ' - test_when_finished "mv .git/SAVED_HEAD .git/HEAD" && + test_when_finished "git update-ref HEAD $orig_head" && test_when_finished "rm -rf .git/worktrees wt" && git worktree add wt && - mv .git/HEAD .git/SAVED_HEAD && echo $ZERO_OID >.git/HEAD && # avoid corrupt/broken HEAD from interfering with repo discovery test_must_fail git -C wt fsck 2>out && @@ -161,7 +160,8 @@ test_expect_success 'other worktree HEAD link pointing at a funny object' ' test_expect_success 'other worktree HEAD link pointing at missing object' ' test_when_finished "rm -rf .git/worktrees other" && git worktree add other && - echo "Contents missing from repo" | git hash-object --stdin >.git/worktrees/other/HEAD && + object_id=$(echo "Contents missing from repo" | git hash-object --stdin) && + test-tool -C other ref-store main update-ref msg HEAD $object_id "" REF_NO_DEREF,REF_SKIP_OID_VERIFICATION && test_must_fail git fsck 2>out && test_i18ngrep "worktrees/other/HEAD: invalid sha1 pointer" out ' @@ -391,7 +391,7 @@ test_expect_success 'tag pointing to nonexistent' ' tag=$(git hash-object -t tag -w --stdin .git/refs/tags/invalid && + git update-ref refs/tags/invalid $tag && test_when_finished "git update-ref -d refs/tags/invalid" && test_must_fail git fsck --tags >out && test_i18ngrep "broken link" out @@ -411,7 +411,7 @@ test_expect_success 'tag pointing to something else than its type' ' tag=$(git hash-object -t tag -w --stdin .git/refs/tags/wrong && + git update-ref refs/tags/wrong $tag && test_when_finished "git update-ref -d refs/tags/wrong" && test_must_fail git fsck --tags ' @@ -428,7 +428,7 @@ test_expect_success 'tag with incorrect tag name & missing tagger' ' tag=$(git hash-object --literally -t tag -w --stdin .git/refs/tags/wrong && + git update-ref refs/tags/wrong $tag && test_when_finished "git update-ref -d refs/tags/wrong" && git fsck --tags 2>out && @@ -452,7 +452,7 @@ test_expect_success 'tag with bad tagger' ' tag=$(git hash-object --literally -t tag -w --stdin .git/refs/tags/wrong && + git update-ref refs/tags/wrong $tag && test_when_finished "git update-ref -d refs/tags/wrong" && test_must_fail git fsck --tags 2>out && test_i18ngrep "error in tag .*: invalid author/committer" out @@ -471,7 +471,7 @@ test_expect_success 'tag with NUL in header' ' tag=$(git hash-object --literally -t tag -w --stdin .git/refs/tags/wrong && + git update-ref refs/tags/wrong $tag && test_when_finished "git update-ref -d refs/tags/wrong" && test_must_fail git fsck --tags 2>out && test_i18ngrep "error in tag $tag.*unterminated header: NUL at offset" out diff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh index 8ea2bf13026..d2a7a91f170 100755 --- a/t/t3404-rebase-interactive.sh +++ b/t/t3404-rebase-interactive.sh @@ -2160,7 +2160,7 @@ test_expect_success '--update-refs: check failed ref update' ' # recorded in the update-refs file. We will force-update the # "second" ref, but "git branch -f" will not work because of # the lock in the update-refs file. - git rev-parse third >.git/refs/heads/second && + git update-ref refs/heads/second third && test_must_fail git rebase --continue 2>err && grep "update_ref failed for ref '\''refs/heads/second'\''" err && diff --git a/t/t5526-fetch-submodules.sh b/t/t5526-fetch-submodules.sh index 26e933f93ae..7ab220fa313 100755 --- a/t/t5526-fetch-submodules.sh +++ b/t/t5526-fetch-submodules.sh @@ -771,7 +771,7 @@ test_expect_success 'fetching submodule into a broken repository' ' git -C dst fetch --recurse-submodules && # Break the receiving submodule - rm -f dst/sub/.git/HEAD && + test-tool -C dst/sub ref-store main delete-refs REF_NO_DEREF msg HEAD && # NOTE: without the fix the following tests will recurse forever! # They should terminate with an error. From patchwork Tue Oct 24 14:05:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 13434674 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.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 46EDC2C86E for ; Tue, 24 Oct 2023 14:05:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b="KWe6FDP3"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="KvwM+Cfn" Received: from wout4-smtp.messagingengine.com (wout4-smtp.messagingengine.com [64.147.123.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DBC2F128 for ; Tue, 24 Oct 2023 07:05:06 -0700 (PDT) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.west.internal (Postfix) with ESMTP id A7EAB3200A8F; Tue, 24 Oct 2023 10:05:05 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Tue, 24 Oct 2023 10:05:06 -0400 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:sender :subject:subject:to:to; s=fm3; t=1698156305; x=1698242705; bh=qy QFOFqQtyyLibNmMF87Y63XIVE7SXR2lM0PUL42Qh4=; b=KWe6FDP3BiRyCcUu7X u4KnVEM2tHIdO2EdBD8VsSUDANda7amcP8Sl/aa36KpxXFviNG32VEic8VI5jN2/ zrUKIqcov+L8M3pKvCRxYR+51IWJHo2I7dcfdbb9w5h1qA5ZjKFe6u6DA1tHUHLF Tmm6aZQSUsC8Ctq7hZmdpM9l8nQEd8h1JxfhdmmvZfnNkxG9ng2cuYmphOXaBkMp 5gcldxIL+x1av7N2XOIrlRx1tQNfaSCYbS8j2dAczJ/r/QgIJ3+TeszyJ5UFGMfX TRoTQ7NiGJhqw8vnogEEo3IdiyTgUKjZ5P1opBtjz8kdQMmFOofRW9ypZtkOAWO1 f9Cw== 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:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; t=1698156305; x=1698242705; bh=qyQFOFqQtyyLi bNmMF87Y63XIVE7SXR2lM0PUL42Qh4=; b=KvwM+CfnBtJSsKQy66s6e4VUVc/rk ygtkFsVyneEiz32aNON0ncc2Gfhm5NRxxip/CeoTU/cqrDLYq4xzqJJgkXxk3ziJ YCax71qEL9G3ScXVJm3WFeer0SPNG2vARhXA22R0QoGHkVfWzUxHFhKSxwxCFg8b w3BYAW9DjVrjRbE0K6C1fj3+09UPDAXWEjt5f6hq50uIyuw80IgCWb+IjnRpE5d4 FqlcEmLrIh12Y3ahRLkp1d/PwcS7AxaQqSwUWwf5vfboIX7bh96D33obaCpWoIFP 8Gj0skO3otUztAlswoEvxBtEtF89T5b2UUn3+L/7CzhHGTym8K+xBqJKg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrkeekgdejfecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpeffhffvvefukfhfgggtuggjsehgtderredttddvnecuhfhrohhmpefrrghtrhhi tghkucfuthgvihhnhhgrrhguthcuoehpshesphhkshdrihhmqeenucggtffrrghtthgvrh hnpeeukedtvedtffevleejtefgheehieegkeeluddvfeefgeehgfeltddtheejleffteen ucevlhhushhtvghrufhiiigvpedvnecurfgrrhgrmhepmhgrihhlfhhrohhmpehpshesph hkshdrihhm X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 24 Oct 2023 10:05:04 -0400 (EDT) Received: by vm-mail (OpenSMTPD) with ESMTPSA id b331e5cd (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Tue, 24 Oct 2023 14:04:59 +0000 (UTC) Date: Tue, 24 Oct 2023 16:05:02 +0200 From: Patrick Steinhardt To: git@vger.kernel.org Cc: Han-Wen Nienhuys , Eric Sunshine , Taylor Blau , Junio C Hamano Subject: [PATCH v2 3/9] t: convert tests to not access symrefs via the filesystem Message-ID: <048583ed2c3bd70fb455b9355c6b9030a7ca77cb.1698156169.git.ps@pks.im> 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: Some of our tests access symbolic references via the filesystem directly. While this works with the current files reference backend, it this will break once we have a second reference backend in our codebase. Refactor these tests to instead use git-symbolic-ref(1) or our `ref-store` test tool. The latter is required in some cases where safety checks of git-symbolic-ref(1) would otherwise reject writing a symbolic reference. Signed-off-by: Patrick Steinhardt --- t/t1400-update-ref.sh | 8 ++++---- t/t1430-bad-ref-name.sh | 12 ++++++------ t/t1450-fsck.sh | 4 ++-- t/t3200-branch.sh | 9 ++++++--- t/t4013-diff-various.sh | 2 +- t/t4202-log.sh | 2 +- t/t5605-clone-local.sh | 2 +- t/t5702-protocol-v2.sh | 24 ++++++++++++++++++------ t/t9133-git-svn-nested-git-repo.sh | 2 +- 9 files changed, 40 insertions(+), 25 deletions(-) diff --git a/t/t1400-update-ref.sh b/t/t1400-update-ref.sh index 91cc6dff724..51a8d0bba98 100755 --- a/t/t1400-update-ref.sh +++ b/t/t1400-update-ref.sh @@ -221,15 +221,15 @@ test_expect_success 'delete symref without dereference when the referred ref is test_expect_success 'update-ref -d is not confused by self-reference' ' test_when_finished "test-tool ref-store main delete-refs REF_NO_DEREF refs/heads/self" && git symbolic-ref refs/heads/self refs/heads/self && - test_path_is_file .git/refs/heads/self && + git symbolic-ref --no-recurse refs/heads/self && test_must_fail git update-ref -d refs/heads/self && - test_path_is_file .git/refs/heads/self + git symbolic-ref --no-recurse refs/heads/self ' test_expect_success 'update-ref --no-deref -d can delete self-reference' ' test_when_finished "test-tool ref-store main delete-refs REF_NO_DEREF refs/heads/self" && git symbolic-ref refs/heads/self refs/heads/self && - test_path_is_file .git/refs/heads/self && + git symbolic-ref --no-recurse refs/heads/self && git update-ref --no-deref -d refs/heads/self && test_must_fail git show-ref --verify -q refs/heads/self ' @@ -239,7 +239,7 @@ test_expect_success 'update-ref --no-deref -d can delete reference to bad ref' ' test_when_finished "rm -f .git/refs/heads/bad" && git symbolic-ref refs/heads/ref-to-bad refs/heads/bad && test_when_finished "git update-ref -d refs/heads/ref-to-bad" && - test_path_is_file .git/refs/heads/ref-to-bad && + git symbolic-ref --no-recurse refs/heads/ref-to-bad && git update-ref --no-deref -d refs/heads/ref-to-bad && test_must_fail git show-ref --verify -q refs/heads/ref-to-bad ' diff --git a/t/t1430-bad-ref-name.sh b/t/t1430-bad-ref-name.sh index ff1c967d550..7d2dfc97256 100755 --- a/t/t1430-bad-ref-name.sh +++ b/t/t1430-bad-ref-name.sh @@ -164,9 +164,9 @@ test_expect_success 'rev-parse skips symref pointing to broken name' ' test_expect_success 'for-each-ref emits warnings for broken names' ' test-tool ref-store main update-ref msg "refs/heads/broken...ref" $main_sha1 $ZERO_OID REF_SKIP_REFNAME_VERIFICATION && test_when_finished "test-tool ref-store main delete-refs REF_NO_DEREF msg refs/heads/broken...ref" && - printf "ref: refs/heads/broken...ref\n" >.git/refs/heads/badname && + test-tool ref-store main create-symref refs/heads/badname refs/heads/broken...ref && test_when_finished "test-tool ref-store main delete-refs REF_NO_DEREF msg refs/heads/badname" && - printf "ref: refs/heads/main\n" >.git/refs/heads/broken...symref && + test-tool ref-store main create-symref refs/heads/broken...symref refs/heads/main && test_when_finished "test-tool ref-store main delete-refs REF_NO_DEREF msg refs/heads/broken...symref" && git for-each-ref >output 2>error && ! grep -e "broken\.\.\.ref" output && @@ -252,7 +252,7 @@ test_expect_success 'update-ref -d can delete broken name through symref' ' ' test_expect_success 'update-ref --no-deref -d can delete symref with broken name' ' - printf "ref: refs/heads/main\n" >.git/refs/heads/broken...symref && + test-tool ref-store main create-symref refs/heads/broken...symref refs/heads/main && test_when_finished "test-tool ref-store main delete-refs REF_NO_DEREF msg refs/heads/broken...symref" && git update-ref --no-deref -d refs/heads/broken...symref >output 2>error && test_path_is_missing .git/refs/heads/broken...symref && @@ -261,7 +261,7 @@ test_expect_success 'update-ref --no-deref -d can delete symref with broken name ' test_expect_success 'branch -d can delete symref with broken name' ' - printf "ref: refs/heads/main\n" >.git/refs/heads/broken...symref && + test-tool ref-store main create-symref refs/heads/broken...symref refs/heads/main && test_when_finished "test-tool ref-store main delete-refs REF_NO_DEREF msg refs/heads/broken...symref" && git branch -d broken...symref >output 2>error && test_path_is_missing .git/refs/heads/broken...symref && @@ -270,7 +270,7 @@ test_expect_success 'branch -d can delete symref with broken name' ' ' test_expect_success 'update-ref --no-deref -d can delete dangling symref with broken name' ' - printf "ref: refs/heads/idonotexist\n" >.git/refs/heads/broken...symref && + test-tool ref-store main create-symref refs/heads/broken...symref refs/heads/idonotexist && test_when_finished "test-tool ref-store main delete-refs REF_NO_DEREF msg refs/heads/broken...symref" && git update-ref --no-deref -d refs/heads/broken...symref >output 2>error && test_path_is_missing .git/refs/heads/broken...symref && @@ -279,7 +279,7 @@ test_expect_success 'update-ref --no-deref -d can delete dangling symref with br ' test_expect_success 'branch -d can delete dangling symref with broken name' ' - printf "ref: refs/heads/idonotexist\n" >.git/refs/heads/broken...symref && + test-tool ref-store main create-symref refs/heads/broken...symref refs/heads/idonotexist && test_when_finished "test-tool ref-store main delete-refs REF_NO_DEREF msg refs/heads/broken...symref" && git branch -d broken...symref >output 2>error && test_path_is_missing .git/refs/heads/broken...symref && diff --git a/t/t1450-fsck.sh b/t/t1450-fsck.sh index f55b539b083..a3c97b9c7fc 100755 --- a/t/t1450-fsck.sh +++ b/t/t1450-fsck.sh @@ -133,7 +133,7 @@ test_expect_success 'HEAD link pointing at a funny object' ' test_expect_success 'HEAD link pointing at a funny place' ' test_when_finished "git update-ref --no-deref HEAD $orig_head" && - echo "ref: refs/funny/place" >.git/HEAD && + test-tool ref-store main create-symref HEAD refs/funny/place && # avoid corrupt/broken HEAD from interfering with repo discovery test_must_fail env GIT_DIR=.git git fsck 2>out && test_i18ngrep "HEAD points to something strange" out @@ -169,7 +169,7 @@ test_expect_success 'other worktree HEAD link pointing at missing object' ' test_expect_success 'other worktree HEAD link pointing at a funny place' ' test_when_finished "rm -rf .git/worktrees other" && git worktree add other && - echo "ref: refs/funny/place" >.git/worktrees/other/HEAD && + git -C other symbolic-ref HEAD refs/funny/place && test_must_fail git fsck 2>out && test_i18ngrep "worktrees/other/HEAD points to something strange" out ' diff --git a/t/t3200-branch.sh b/t/t3200-branch.sh index 080e4f24a6e..7d9393f190d 100755 --- a/t/t3200-branch.sh +++ b/t/t3200-branch.sh @@ -212,10 +212,13 @@ test_expect_success 'git branch -M should leave orphaned HEAD alone' ' cd orphan && test_commit initial && git checkout --orphan lonely && - grep lonely .git/HEAD && + git symbolic-ref HEAD >expect && + echo refs/heads/lonely >actual && + test_cmp expect actual && test_path_is_missing .git/refs/head/lonely && git branch -M main mistress && - grep lonely .git/HEAD + git symbolic-ref HEAD >expect && + test_cmp expect actual ) ' @@ -806,7 +809,7 @@ test_expect_success 'deleting a symref' ' test_expect_success 'deleting a dangling symref' ' git symbolic-ref refs/heads/dangling-symref nowhere && - test_path_is_file .git/refs/heads/dangling-symref && + git symbolic-ref --no-recurse refs/heads/dangling-symref && echo "Deleted branch dangling-symref (was nowhere)." >expect && git branch -d dangling-symref >actual && test_path_is_missing .git/refs/heads/dangling-symref && diff --git a/t/t4013-diff-various.sh b/t/t4013-diff-various.sh index 5de1d190759..5abbea36b39 100755 --- a/t/t4013-diff-various.sh +++ b/t/t4013-diff-various.sh @@ -514,7 +514,7 @@ test_expect_success 'log -S requires an argument' ' ' test_expect_success 'diff --cached on unborn branch' ' - echo ref: refs/heads/unborn >.git/HEAD && + git symbolic-ref HEAD refs/heads/unborn && git diff --cached >result && process_diffs result >actual && process_diffs "$TEST_DIRECTORY/t4013/diff.diff_--cached" >expected && diff --git a/t/t4202-log.sh b/t/t4202-log.sh index af4a123cd22..57b298a4e22 100755 --- a/t/t4202-log.sh +++ b/t/t4202-log.sh @@ -2265,7 +2265,7 @@ test_expect_success REFFILES 'log diagnoses bogus HEAD hash' ' test_expect_success REFFILES 'log diagnoses bogus HEAD symref' ' git init empty && - echo "ref: refs/heads/invalid.lock" > empty/.git/HEAD && + test-tool -C empty ref-store main create-symref HEAD refs/heads/invalid.lock && test_must_fail git -C empty log 2>stderr && test_i18ngrep broken stderr && test_must_fail git -C empty log --default totally-bogus 2>stderr && diff --git a/t/t5605-clone-local.sh b/t/t5605-clone-local.sh index 1d7b1abda1a..a26689de379 100755 --- a/t/t5605-clone-local.sh +++ b/t/t5605-clone-local.sh @@ -65,7 +65,7 @@ test_expect_success 'Even without -l, local will make a hardlink' ' ' test_expect_success 'local clone of repo with nonexistent ref in HEAD' ' - echo "ref: refs/heads/nonexistent" > a.git/HEAD && + git -C a.git symbolic-ref HEAD refs/heads/nonexistent && git clone a d && (cd d && git fetch && diff --git a/t/t5702-protocol-v2.sh b/t/t5702-protocol-v2.sh index 6af5c2062fd..dcc4cd95fe7 100755 --- a/t/t5702-protocol-v2.sh +++ b/t/t5702-protocol-v2.sh @@ -221,7 +221,9 @@ test_expect_success 'clone of empty repo propagates name of default branch' ' GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME= \ git -c init.defaultBranch=main -c protocol.version=2 \ clone "file://$(pwd)/file_empty_parent" file_empty_child && - grep "refs/heads/mydefaultbranch" file_empty_child/.git/HEAD + echo refs/heads/mydefaultbranch >expect && + git -C file_empty_child symbolic-ref HEAD >actual && + test_cmp expect actual ' test_expect_success '...but not if explicitly forbidden by config' ' @@ -234,7 +236,9 @@ test_expect_success '...but not if explicitly forbidden by config' ' GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME= \ git -c init.defaultBranch=main -c protocol.version=2 \ clone "file://$(pwd)/file_empty_parent" file_empty_child && - ! grep "refs/heads/mydefaultbranch" file_empty_child/.git/HEAD + echo refs/heads/main >expect && + git -C file_empty_child symbolic-ref HEAD >actual && + test_cmp expect actual ' test_expect_success 'bare clone propagates empty default branch' ' @@ -247,7 +251,9 @@ test_expect_success 'bare clone propagates empty default branch' ' git -c init.defaultBranch=main -c protocol.version=2 \ clone --bare \ "file://$(pwd)/file_empty_parent" file_empty_child.git && - grep "refs/heads/mydefaultbranch" file_empty_child.git/HEAD + echo "refs/heads/mydefaultbranch" >expect && + git -C file_empty_child.git symbolic-ref HEAD >actual && + test_cmp expect actual ' test_expect_success 'clone propagates unborn HEAD from non-empty repo' ' @@ -265,7 +271,9 @@ test_expect_success 'clone propagates unborn HEAD from non-empty repo' ' git -c init.defaultBranch=main -c protocol.version=2 \ clone "file://$(pwd)/file_unborn_parent" \ file_unborn_child 2>stderr && - grep "refs/heads/mydefaultbranch" file_unborn_child/.git/HEAD && + echo "refs/heads/mydefaultbranch" >expect && + git -C file_unborn_child symbolic-ref HEAD >actual && + test_cmp expect actual && grep "warning: remote HEAD refers to nonexistent ref" stderr ' @@ -295,7 +303,9 @@ test_expect_success 'bare clone propagates unborn HEAD from non-empty repo' ' git -c init.defaultBranch=main -c protocol.version=2 \ clone --bare "file://$(pwd)/file_unborn_parent" \ file_unborn_child.git 2>stderr && - grep "refs/heads/mydefaultbranch" file_unborn_child.git/HEAD && + echo "refs/heads/mydefaultbranch" >expect && + git -C file_unborn_child.git symbolic-ref HEAD >actual && + test_cmp expect actual && ! grep "warning:" stderr ' @@ -315,7 +325,9 @@ test_expect_success 'defaulted HEAD uses remote branch if available' ' git -c init.defaultBranch=branchwithstuff -c protocol.version=2 \ clone "file://$(pwd)/file_unborn_parent" \ file_unborn_child 2>stderr && - grep "refs/heads/branchwithstuff" file_unborn_child/.git/HEAD && + echo "refs/heads/branchwithstuff" >expect && + git -C file_unborn_child symbolic-ref HEAD >actual && + test_cmp expect actual && test_path_is_file file_unborn_child/stuff.t && ! grep "warning:" stderr ' diff --git a/t/t9133-git-svn-nested-git-repo.sh b/t/t9133-git-svn-nested-git-repo.sh index d8d536269cf..8ca24670acb 100755 --- a/t/t9133-git-svn-nested-git-repo.sh +++ b/t/t9133-git-svn-nested-git-repo.sh @@ -11,7 +11,7 @@ test_expect_success 'setup repo with a git repo inside it' ' ( cd s && git init && - test -f .git/HEAD && + git symbolic-ref HEAD && > .git/a && echo a > a && svn_cmd add .git a && From patchwork Tue Oct 24 14:05:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 13434675 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.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 ED7A02C87B for ; Tue, 24 Oct 2023 14:05:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b="Aa9gLN2e"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="d9JSQ/hI" Received: from wout4-smtp.messagingengine.com (wout4-smtp.messagingengine.com [64.147.123.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B1559109 for ; Tue, 24 Oct 2023 07:05:11 -0700 (PDT) Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.west.internal (Postfix) with ESMTP id 6A6F93200A8E; Tue, 24 Oct 2023 10:05:10 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Tue, 24 Oct 2023 10:05:10 -0400 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:sender :subject:subject:to:to; s=fm3; t=1698156309; x=1698242709; bh=Ct 5ovSwmRzrF1V2weXagCPeBCyJ9Npkg4Kqs9W+gekE=; b=Aa9gLN2eLZ8RpRRzY+ ziri2OX/G7JhFNDft3CsIWUQN/Z6XX7qobeyMCZWVYqxDvvlVU4GcYlizSn6mynP pxu3iMRvuWhQ/RWwmClxwp2p4onisWWxdh02TuMEItAfWKpm1PsuC/8OHTRBG3W/ yNQ2NHQNNx5gI6IIao/m8U1lXbM/4qBQnG159Ik8F7qelW7MVExhPs0f8pZ++K/h +thz/W/9xXQUVTDYb6qstdZSoJwtw1GGzxyXSbCJBLUwZc6p1gRXDvVgYV5t2tSP 7yMxdMUlwwgWfCB7P/L9SQPOgf48YqvRwcHd0CP1JFFqtFfVhGKD46MiLO4RQgyN l53A== 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:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; t=1698156309; x=1698242709; bh=Ct5ovSwmRzrF1 V2weXagCPeBCyJ9Npkg4Kqs9W+gekE=; b=d9JSQ/hIefx/Dx0dcRIl/VvDcPuIZ SUqZhpf6UR9JTTNp82gCrIaEj6TsEy1kp6P+F6F5iY/Sc10LeLRA0d+lmHv1HYxZ lK92UNqesjqOGM81FC+HUmXLND976hTIa/RTk03pctIUGRXNIFrpbZ954MUYcXOq CUWxttoLG0zhipFv4j2OXYuHmuoEQUH9EB8azj6i/BkU0isYPL+EbZttKWqFj9nw PWJ2025zRY9NLC8v0etX/bpLUY8uq3ATXF7PAFt3SdTHpIGpy4ZI9tVgegBwll+g vTKKS1R/tArq7KCMoDcD+3wCcLPkuB1A9i9p1gsiy38HBDLAqJ6/QMLUQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrkeekgdejvdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpeffhffvvefukfhfgggtuggjsehgtderredttddvnecuhfhrohhmpefrrghtrhhi tghkucfuthgvihhnhhgrrhguthcuoehpshesphhkshdrihhmqeenucggtffrrghtthgvrh hnpeeukedtvedtffevleejtefgheehieegkeeluddvfeefgeehgfeltddtheejleffteen ucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehpshesph hkshdrihhm X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 24 Oct 2023 10:05:08 -0400 (EDT) Received: by vm-mail (OpenSMTPD) with ESMTPSA id 149f8dd1 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Tue, 24 Oct 2023 14:05:03 +0000 (UTC) Date: Tue, 24 Oct 2023 16:05:06 +0200 From: Patrick Steinhardt To: git@vger.kernel.org Cc: Han-Wen Nienhuys , Eric Sunshine , Taylor Blau , Junio C Hamano Subject: [PATCH v2 4/9] t: convert tests to not access reflog via the filesystem Message-ID: <5e7937e790411a5fe8f3182328ca5a43529f499a.1698156169.git.ps@pks.im> 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: Some of our tests reach directly into the filesystem in order to both read or modify the reflog, which will break once we have a second reference backend in our codebase that stores reflogs differently. Refactor these tests to either use git-reflog(1) or the ref-store test helper. Note that the refactoring to use git-reflog(1) also requires us to adapt our expectations in some cases where we previously verified the exact on-disk log entries. This seems like an acceptable tradeoff though to ensure that different backends have the same user-visible behaviour as any user would typically use git-reflog(1) anyway to access the logs. Any backend-specific verification of the written on-disk format should be implemented in a separate, backend-specific test. Signed-off-by: Patrick Steinhardt --- t/t1400-update-ref.sh | 17 +++++++++++------ t/t3200-branch.sh | 24 ++++++++++++------------ 2 files changed, 23 insertions(+), 18 deletions(-) diff --git a/t/t1400-update-ref.sh b/t/t1400-update-ref.sh index 51a8d0bba98..b7d1e5deede 100755 --- a/t/t1400-update-ref.sh +++ b/t/t1400-update-ref.sh @@ -90,7 +90,8 @@ test_expect_success "deleting current branch adds message to HEAD's log" ' git symbolic-ref HEAD $m && git update-ref -m delete-$m -d $m && test_must_fail git show-ref --verify -q $m && - grep "delete-$m$" .git/logs/HEAD + test-tool ref-store main for-each-reflog-ent HEAD >actual && + grep "delete-$m$" actual ' test_expect_success "deleting by HEAD adds message to HEAD's log" ' @@ -99,7 +100,8 @@ test_expect_success "deleting by HEAD adds message to HEAD's log" ' git symbolic-ref HEAD $m && git update-ref -m delete-by-head -d HEAD && test_must_fail git show-ref --verify -q $m && - grep "delete-by-head$" .git/logs/HEAD + test-tool ref-store main for-each-reflog-ent HEAD >actual && + grep "delete-by-head$" actual ' test_expect_success 'update-ref does not create reflogs by default' ' @@ -130,7 +132,7 @@ test_expect_success 'creates no reflog in bare repository' ' test_expect_success 'core.logAllRefUpdates=true creates reflog in bare repository' ' test_when_finished "git -C $bare config --unset core.logAllRefUpdates && \ - rm $bare/logs/$m" && + test-tool ref-store main delete-reflog $m" && git -C $bare config core.logAllRefUpdates true && git -C $bare update-ref $m $bareB && git -C $bare rev-parse $bareB >expect && @@ -263,7 +265,10 @@ test_expect_success "(not) changed .git/$m" ' ! test $B = $(git show-ref -s --verify $m) ' -rm -f .git/logs/refs/heads/main +test_expect_success "clean up reflog" ' + test-tool ref-store main delete-reflog $m +' + test_expect_success "create $m (logged by touch)" ' test_config core.logAllRefUpdates false && GIT_COMMITTER_DATE="2005-05-26 23:30" \ @@ -316,7 +321,7 @@ $A $B $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150260 +0000 Switch $B $A $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150860 +0000 EOF test_expect_success "verifying $m's log (logged by touch)" ' - test_when_finished "git update-ref -d $m && rm -rf .git/logs actual expect" && + test_when_finished "git update-ref -d $m && git reflog expire --expire=all --all && rm -rf actual expect" && test-tool ref-store main for-each-reflog-ent $m >actual && test_cmp actual expect ' @@ -346,7 +351,7 @@ $A $B $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150380 +0000 Switch $B $A $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150980 +0000 EOF test_expect_success "verifying $m's log (logged by config)" ' - test_when_finished "git update-ref -d $m && rm -rf .git/logs actual expect" && + test_when_finished "git update-ref -d $m && git reflog expire --expire=all --all && rm -rf actual expect" && test-tool ref-store main for-each-reflog-ent $m >actual && test_cmp actual expect ' diff --git a/t/t3200-branch.sh b/t/t3200-branch.sh index 7d9393f190d..a38601dbbb7 100755 --- a/t/t3200-branch.sh +++ b/t/t3200-branch.sh @@ -73,14 +73,14 @@ test_expect_success 'git branch HEAD should fail' ' ' cat >expect < 1117150200 +0000 branch: Created from main +$HEAD refs/heads/d/e/f@{0}: branch: Created from main EOF test_expect_success 'git branch --create-reflog d/e/f should create a branch and a log' ' GIT_COMMITTER_DATE="2005-05-26 23:30" \ git -c core.logallrefupdates=false branch --create-reflog d/e/f && test_path_is_file .git/refs/heads/d/e/f && - test_path_is_file .git/logs/refs/heads/d/e/f && - test_cmp expect .git/logs/refs/heads/d/e/f + git reflog show --no-abbrev-commit refs/heads/d/e/f >actual && + test_cmp expect actual ' test_expect_success 'git branch -d d/e/f should delete a branch and a log' ' @@ -200,10 +200,9 @@ test_expect_success 'git branch -M baz bam should succeed when baz is checked ou test $(git rev-parse --abbrev-ref HEAD) = bam ' -test_expect_success 'git branch -M baz bam should add entries to .git/logs/HEAD' ' - msg="Branch: renamed refs/heads/baz to refs/heads/bam" && - grep " $ZERO_OID.*$msg$" .git/logs/HEAD && - grep "^$ZERO_OID.*$msg$" .git/logs/HEAD +test_expect_success 'git branch -M baz bam should add entries to HEAD reflog' ' + git reflog show HEAD >actual && + grep "HEAD@{0}: Branch: renamed refs/heads/baz to refs/heads/bam" actual ' test_expect_success 'git branch -M should leave orphaned HEAD alone' ' @@ -225,7 +224,7 @@ test_expect_success 'git branch -M should leave orphaned HEAD alone' ' test_expect_success 'resulting reflog can be shown by log -g' ' oid=$(git rev-parse HEAD) && cat >expect <<-EOF && - HEAD@{0} $oid $msg + HEAD@{0} $oid Branch: renamed refs/heads/baz to refs/heads/bam HEAD@{2} $oid checkout: moving from foo to baz EOF git log -g --format="%gd %H %gs" -2 HEAD >actual && @@ -699,7 +698,8 @@ test_expect_success 'git branch -C c1 c2 should succeed when c1 is checked out' test_expect_success 'git branch -C c1 c2 should never touch HEAD' ' msg="Branch: copied refs/heads/c1 to refs/heads/c2" && - ! grep "$msg$" .git/logs/HEAD + git reflog HEAD >actual && + ! grep "$msg$" actual ' test_expect_success 'git branch -C main should work when main is checked out' ' @@ -1140,14 +1140,14 @@ test_expect_success '--set-upstream-to notices an error to set branch as own ups # Keep this test last, as it changes the current branch cat >expect < 1117150200 +0000 branch: Created from main +$HEAD refs/heads/g/h/i@{0}: branch: Created from main EOF test_expect_success 'git checkout -b g/h/i -l should create a branch and a log' ' GIT_COMMITTER_DATE="2005-05-26 23:30" \ git checkout -b g/h/i -l main && test_path_is_file .git/refs/heads/g/h/i && - test_path_is_file .git/logs/refs/heads/g/h/i && - test_cmp expect .git/logs/refs/heads/g/h/i + git reflog show --no-abbrev-commit refs/heads/g/h/i >actual && + test_cmp expect actual ' test_expect_success 'checkout -b makes reflog by default' ' From patchwork Tue Oct 24 14:05:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 13434676 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.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 8FEC72C850 for ; Tue, 24 Oct 2023 14:05:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b="XTJi66ZC"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="mEJ+9fl/" Received: from wout4-smtp.messagingengine.com (wout4-smtp.messagingengine.com [64.147.123.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 48AFDDC for ; Tue, 24 Oct 2023 07:05:15 -0700 (PDT) Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.west.internal (Postfix) with ESMTP id 272863200A8E; Tue, 24 Oct 2023 10:05:14 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Tue, 24 Oct 2023 10:05:14 -0400 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:sender :subject:subject:to:to; s=fm3; t=1698156313; x=1698242713; bh=Wx 3ZUx2HqPkZz8f/zHU3CJgu7TWN6FHawgUmSnqQ1/A=; b=XTJi66ZCZ6hArG78XP hrPQxvf1LIMjllqvUipMzaN4LZyKXXLvkGbRFpZAuJoe0Kr05ywp1xB4tDtdWUkz BcnGQmUKhITBmm9NqkaYAe5BfFLfnbUWQaExvaidchmuvacr1o4g9IX4mSJqF4e7 5aua4rmuGuPda578UaTcx4UgtdGOZFj4jvYHHn4io2MrOWIT9+NbJujyA9zF+0Le nCVsZhJOQknuw3XaW+5bOobFdoyOPNnpE1Ajioj7bQun4ziJ9MkwFqhk2lklAOyN HMhcgDSt42hZ7ptCtbsKkP+2saNmv1hpN+CYZ44gq7jTXjx2/VrjviFoXJukoQ6Z cobQ== 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:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; t=1698156313; x=1698242713; bh=Wx3ZUx2HqPkZz 8f/zHU3CJgu7TWN6FHawgUmSnqQ1/A=; b=mEJ+9fl/IF/YgzDE0j14+dejtS/eR VW4IJeYHa4KHHsoNEY0axWdkWkoJEGiPlT4kxkKwQfFSaFl9Al8NV+jD11+n3mEh aPXEvJ8sjHveGwt64hyMjqreh5N7ZFJOxOyOqMzRLxIb6dDTWXY8qABg9QAkX+3+ H0OQ1lXWb2vzrY7HyyQtjzsQ/8clQWOzDRreYsYPcv8WoZ7+6ST8FUDludtkgWcs 2rtJysf3HR7T+TktsrNYDrTd+6175Kmqgqz40AlmI6I2HJ/IAELsxAUjUzT+u8vx dbSvInyLqwYxzL67ktSL2KIvqZAoV2QkT4hrNoyFoCYUBAVVL51tARR4Q== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrkeekgdejvdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpeffhffvvefukfhfgggtuggjsehgtderredttddvnecuhfhrohhmpefrrghtrhhi tghkucfuthgvihhnhhgrrhguthcuoehpshesphhkshdrihhmqeenucggtffrrghtthgvrh hnpeeukedtvedtffevleejtefgheehieegkeeluddvfeefgeehgfeltddtheejleffteen ucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehpshesph hkshdrihhm X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 24 Oct 2023 10:05:12 -0400 (EDT) Received: by vm-mail (OpenSMTPD) with ESMTPSA id 7f8a1993 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Tue, 24 Oct 2023 14:05:07 +0000 (UTC) Date: Tue, 24 Oct 2023 16:05:10 +0200 From: Patrick Steinhardt To: git@vger.kernel.org Cc: Han-Wen Nienhuys , Eric Sunshine , Taylor Blau , Junio C Hamano Subject: [PATCH v2 5/9] t1450: convert tests to remove worktrees via git-worktree(1) Message-ID: <089565a358eb28544f0ad6b83b8c47e1edf2db6f.1698156169.git.ps@pks.im> 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: Some of our tests in t1450 create worktrees and then corrupt them. As it is impossible to delete such worktrees via a normal call to `git worktree remove`, we instead opt to remove them manually by calling rm(1) instead. This is ultimately unnecessary though as we can use the `-f` switch to remove the worktree. Let's convert the tests to do so such that we don't have to reach into internal implementation details of worktrees. Signed-off-by: Patrick Steinhardt --- t/t1450-fsck.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/t/t1450-fsck.sh b/t/t1450-fsck.sh index a3c97b9c7fc..a6af550867c 100755 --- a/t/t1450-fsck.sh +++ b/t/t1450-fsck.sh @@ -141,7 +141,7 @@ test_expect_success 'HEAD link pointing at a funny place' ' test_expect_success 'HEAD link pointing at a funny object (from different wt)' ' test_when_finished "git update-ref HEAD $orig_head" && - test_when_finished "rm -rf .git/worktrees wt" && + test_when_finished "git worktree remove -f wt" && git worktree add wt && echo $ZERO_OID >.git/HEAD && # avoid corrupt/broken HEAD from interfering with repo discovery @@ -150,7 +150,7 @@ test_expect_success 'HEAD link pointing at a funny object (from different wt)' ' ' test_expect_success 'other worktree HEAD link pointing at a funny object' ' - test_when_finished "rm -rf .git/worktrees other" && + test_when_finished "git worktree remove -f other" && git worktree add other && echo $ZERO_OID >.git/worktrees/other/HEAD && test_must_fail git fsck 2>out && @@ -158,7 +158,7 @@ test_expect_success 'other worktree HEAD link pointing at a funny object' ' ' test_expect_success 'other worktree HEAD link pointing at missing object' ' - test_when_finished "rm -rf .git/worktrees other" && + test_when_finished "git worktree remove -f other" && git worktree add other && object_id=$(echo "Contents missing from repo" | git hash-object --stdin) && test-tool -C other ref-store main update-ref msg HEAD $object_id "" REF_NO_DEREF,REF_SKIP_OID_VERIFICATION && @@ -167,7 +167,7 @@ test_expect_success 'other worktree HEAD link pointing at missing object' ' ' test_expect_success 'other worktree HEAD link pointing at a funny place' ' - test_when_finished "rm -rf .git/worktrees other" && + test_when_finished "git worktree remove -f other" && git worktree add other && git -C other symbolic-ref HEAD refs/funny/place && test_must_fail git fsck 2>out && From patchwork Tue Oct 24 14:05:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 13434677 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.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 98F1F2C850 for ; Tue, 24 Oct 2023 14:05:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b="ysJFVOg/"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="q6jRty0T" Received: from wout4-smtp.messagingengine.com (wout4-smtp.messagingengine.com [64.147.123.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E9A8F109 for ; Tue, 24 Oct 2023 07:05:19 -0700 (PDT) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.west.internal (Postfix) with ESMTP id C9B323200A8E; Tue, 24 Oct 2023 10:05:18 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Tue, 24 Oct 2023 10:05:19 -0400 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:sender :subject:subject:to:to; s=fm3; t=1698156318; x=1698242718; bh=Bk xXEuIpNIP5gskQfRfHKB3VPm9zWsfFzv36JPmj3ds=; b=ysJFVOg/fv11CZ9ItX O1oGrtJEVl6IV7yJSNXjF0qa4ONhi7UzhqwGjFSVxLiDDPhV+mmCMxG7na18ZEGp 0b78mnlZunQf5QZFqBg0dONhWRZGH/2IL6a4D21E13QwnCNk66RoOX9hhGqFYlXW V5M8RlkO6NK1hG5yiqtCZBKyigzsKo3TAtKqztcCz+6aP7i62upTFZ9cwr6IJURE NA2JUCuWwp3Ujyf7SWF2WqovTd8BNKyesJ/EAJtbpuFKvG3UW+2qC/WCJ5gl/oEI TtpGwt25lsyjXuC5i0/8weuf1cYcXfd25m99o3+oH2NFMcMfc1X9t5Sln9/87VMj awIQ== 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:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; t=1698156318; x=1698242718; bh=BkxXEuIpNIP5g skQfRfHKB3VPm9zWsfFzv36JPmj3ds=; b=q6jRty0TzFc2c30s7/knLFLczL5J7 ikvNRTsLF3KpAh3fql+W9lAO8Bt1jKl28YxUqlNsniE3/D2i3cpTUEsiApIHhtql lZUO8ErbmpY62oYIyUV0khAFVYoybRj60Aj6vNPrtJGWDbniNlesLk/X76MKpWMl 1ueApG7vg/6Z0Umi3YcgAKgRUPsYU+NDI+L6IJHDozCzUIWT/gB4TdsqXjRa4P+q 1EH/+hYvJq0tFqXg3da92Vj/3SuLvI3wJUdSEkRVGqs0o0UNm4IlWieZuXBqYBDv yrDSeaIZT8Cl8UC9vu2XpHFpu+InG/CcNVloCGmteg9qL6yhfekaslHwg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrkeekgdejfecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpeffhffvvefukfhfgggtuggjsehgtderredttddvnecuhfhrohhmpefrrghtrhhi tghkucfuthgvihhnhhgrrhguthcuoehpshesphhkshdrihhmqeenucggtffrrghtthgvrh hnpeeukedtvedtffevleejtefgheehieegkeeluddvfeefgeehgfeltddtheejleffteen ucevlhhushhtvghrufhiiigvpeefnecurfgrrhgrmhepmhgrihhlfhhrohhmpehpshesph hkshdrihhm X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 24 Oct 2023 10:05:16 -0400 (EDT) Received: by vm-mail (OpenSMTPD) with ESMTPSA id 82bf9ad5 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Tue, 24 Oct 2023 14:05:11 +0000 (UTC) Date: Tue, 24 Oct 2023 16:05:15 +0200 From: Patrick Steinhardt To: git@vger.kernel.org Cc: Han-Wen Nienhuys , Eric Sunshine , Taylor Blau , Junio C Hamano Subject: [PATCH v2 6/9] t4207: delete replace references via git-update-ref(1) 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 t4207 we set up a set of replace objects via git-replace(1). Because these references should not be impacting subsequent tests we also set up some cleanup logic that deletes the replacement references via a call to `rm -rf`. This reaches into the internal implementation details of the reference backend and will thus break when we grow an alternative refdb implementation. Refactor the tests to delete the replacement refs via Git commands so that we become independent of the actual refdb that's in use. As we don't have a nice way to delete all replacements or all references in a certain namespace, we opt for a combination of git-for-each-ref(1) and git-update-ref(1)'s `--stdin` mode. Signed-off-by: Patrick Steinhardt --- t/t4207-log-decoration-colors.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/t/t4207-log-decoration-colors.sh b/t/t4207-log-decoration-colors.sh index 21986a866df..73ea9e51550 100755 --- a/t/t4207-log-decoration-colors.sh +++ b/t/t4207-log-decoration-colors.sh @@ -70,8 +70,14 @@ ${c_tag}tag: ${c_reset}${c_tag}A${c_reset}${c_commit})${c_reset} A cmp_filtered_decorations ' +remove_replace_refs () { + git for-each-ref 'refs/replace*/**' --format='delete %(refname)' >in && + git update-ref --stdin X-Patchwork-Id: 13434678 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.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 701652C850 for ; Tue, 24 Oct 2023 14:05:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b="B388bqC+"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="dSwHeyll" Received: from wout4-smtp.messagingengine.com (wout4-smtp.messagingengine.com [64.147.123.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5353DA4 for ; Tue, 24 Oct 2023 07:05:24 -0700 (PDT) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.west.internal (Postfix) with ESMTP id 46CF63200A26; Tue, 24 Oct 2023 10:05:23 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Tue, 24 Oct 2023 10:05:23 -0400 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:sender :subject:subject:to:to; s=fm3; t=1698156322; x=1698242722; bh=S2 M6DAjWYAx/9AZ8mzV93iEIGMiVCXxlTzdmqPCMthQ=; b=B388bqC+sxKARIMJ0A khMEeo2MegmISUQ+dDHiNweIX+FWDCw0NK4jdBxKy6Aso3DKQeGYhVtF+Ag1qK3N 2guh9HWJ3EW5LLkokMo5gJUV72OL0F3qzZLlWe6Wdb2ElpuBAcf7WcB2oTKEMlw9 2wr400e183I7vWljv3ombsuwlOSU1Nx0IggkyjmH2IqACgWrHtLBM0SAG34cdFl1 7SIBvmjCfvu+m9pQ3RikZ0+eA6dJynPjeUnlnGTKBUh9XpkVn2IPTUiU+ueBTi9S PnExCJV2xbuksc1K3tysUEC/Ylsg1YZ+fcQuFRFaIw1ziBZUGNn5+pLxr8WfNs4E kjmA== 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:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; t=1698156322; x=1698242722; bh=S2M6DAjWYAx/9 AZ8mzV93iEIGMiVCXxlTzdmqPCMthQ=; b=dSwHeyll3mIvjFZX3nvmX9Cvbk93J TjwpxvFBE3nsSRCIIAj/md3NtNBJvwBpReVvhnjaMaArx93S0hdRIYosdIy6NMX1 taIyLZc+xUaDYe4niNR9CTU75mFFQtVgmbhESd047+oxFW1YJXGgXhLOgfqs3frX PtNNqiXDxMZeHTAZiuQJ9J+zsy2Ij/lgvjlvIjewkxtaRlSXQGlEQlXGHFkoGQdt sgo2FuKcKGe+tosZmMoFQ4AmDcl/Yc578iBA4QWggSfzpm9fR5bn+XZDF2+MAGlK Kle++7Yop5wDxF73/ABzYhLeX4qzkEDUBKWEWbD6No5T160caGmHcnXXw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrkeekgdejfecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpeffhffvvefukfhfgggtuggjsehgtderredttddvnecuhfhrohhmpefrrghtrhhi tghkucfuthgvihhnhhgrrhguthcuoehpshesphhkshdrihhmqeenucggtffrrghtthgvrh hnpeeukedtvedtffevleejtefgheehieegkeeluddvfeefgeehgfeltddtheejleffteen ucevlhhushhtvghrufhiiigvpeegnecurfgrrhgrmhepmhgrihhlfhhrohhmpehpshesph hkshdrihhm X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 24 Oct 2023 10:05:21 -0400 (EDT) Received: by vm-mail (OpenSMTPD) with ESMTPSA id 4d1d2e79 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Tue, 24 Oct 2023 14:05:16 +0000 (UTC) Date: Tue, 24 Oct 2023 16:05:19 +0200 From: Patrick Steinhardt To: git@vger.kernel.org Cc: Han-Wen Nienhuys , Eric Sunshine , Taylor Blau , Junio C Hamano Subject: [PATCH v2 7/9] t7300: assert exact states of repo 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: Some of the tests in t7300 verify that git-clean(1) doesn't touch repositories that are embedded into the main repository. This is done by asserting a small set of substructures that are assumed to always exist, like the "refs/", "objects/" or "HEAD". This has the downside that we need to assume a specific repository structure that may be subject to change when new backends for the refdb land. At the same time, we don't thoroughly assert that git-clean(1) really didn't end up cleaning any files in the repository either. Convert the tests to instead assert that all files continue to exist after git-clean(1) by comparing a file listing via find(1) before and after executing clean. This makes our actual assertions stricter while having to care less about the repository's actual on-disk format. Signed-off-by: Patrick Steinhardt --- t/t7300-clean.sh | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/t/t7300-clean.sh b/t/t7300-clean.sh index 0ef7b784573..d7d9202f37f 100755 --- a/t/t7300-clean.sh +++ b/t/t7300-clean.sh @@ -517,8 +517,12 @@ test_expect_success 'nested (empty) git should be kept' ' git init empty_repo && mkdir to_clean && >to_clean/should_clean.this && + # Note that we put the expect file in the .git directory so that it + # does not get cleaned. + find empty_repo | sort >.git/expect && git clean -f -d && - test_path_is_file empty_repo/.git/HEAD && + find empty_repo | sort >actual && + test_cmp .git/expect actual && test_path_is_missing to_clean ' @@ -559,10 +563,10 @@ test_expect_success 'giving path in nested git work tree will NOT remove it' ' mkdir -p bar/baz && test_commit msg bar/baz/hello.world ) && + find repo | sort >expect && git clean -f -d repo/bar/baz && - test_path_is_file repo/.git/HEAD && - test_path_is_dir repo/bar/ && - test_path_is_file repo/bar/baz/hello.world + find repo | sort >actual && + test_cmp expect actual ' test_expect_success 'giving path to nested .git will not remove it' ' @@ -573,10 +577,10 @@ test_expect_success 'giving path to nested .git will not remove it' ' git init && test_commit msg hello.world ) && + find repo | sort >expect && git clean -f -d repo/.git && - test_path_is_file repo/.git/HEAD && - test_path_is_dir repo/.git/refs && - test_path_is_dir repo/.git/objects && + find repo | sort >actual && + test_cmp expect actual && test_path_is_dir untracked/ ' @@ -588,9 +592,10 @@ test_expect_success 'giving path to nested .git/ will NOT remove contents' ' git init && test_commit msg hello.world ) && + find repo | sort >expect && git clean -f -d repo/.git/ && - test_path_is_dir repo/.git && - test_path_is_file repo/.git/HEAD && + find repo | sort >actual && + test_cmp expect actual && test_path_is_dir untracked/ ' From patchwork Tue Oct 24 14:05:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 13434679 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.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 15F4D2C873 for ; Tue, 24 Oct 2023 14:05:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b="Naop6MoG"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="UfIhjkej" Received: from wout4-smtp.messagingengine.com (wout4-smtp.messagingengine.com [64.147.123.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 75815DC for ; Tue, 24 Oct 2023 07:05:27 -0700 (PDT) Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.west.internal (Postfix) with ESMTP id C5CC93200A26; Tue, 24 Oct 2023 10:05:26 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Tue, 24 Oct 2023 10:05:27 -0400 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:sender :subject:subject:to:to; s=fm3; t=1698156326; x=1698242726; bh=Ln Rlj6rvSYEp3PwNsfIS+5SxkhOMpdMHWtika5DL1rc=; b=Naop6MoG6pF817RgFI DSCybvBJy0HLPmRa/NLMnT3GLCpObD5XxfZVqFWUTpeQBw4n+kqvrCAHfUqeQKPd D+Ga2Vd321U8AVq4dFnwyyinuu1bI3quAclejUgv6L/J3aqUlV+NMRgTU0+BXNPu ngy+u2wdrItvbRivQG/i3GR1KzEixhFqLn10gyYQg0OZpbocSuUOGv+MX9taZuHN PeWWyYqIUiwJ4suXvC2RTU+EmXYzGKqLxh5bBDjw5oGP9mpWL5hMmp+pHiQbd3wP I7CgGXyKqqcrCd6iLeanB9P3rOq90KjuA2+SCHyzzy7ZM+/D5RlWVhLGO92ZB+u3 fFMA== 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:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; t=1698156326; x=1698242726; bh=LnRlj6rvSYEp3 PwNsfIS+5SxkhOMpdMHWtika5DL1rc=; b=UfIhjkejHmDLmuaF4abDxI4i2rVM9 7vP7cuUH4j6uzlapQsM0CJLDCq08tNBnEpUMU0xjwqotfs9JOMBpTAXmj/mupH7q ySWILmX4uPPLUKbkgmgpjuNWvxIEjrPkCT1we0xV5TFKIZPGT5Ox7CGGNKlZS0Vm qYYn8GT11bOBHGZlXJABbSTZcDPGr0z+h99n89o0cEyFotFaXUKCsS2RxR1n+QD6 eof0xpQiFBjQgC42jPW0t3JklRRuzwaJOVX4w7MLN+QlQrRjOmMyUAC4B/04xcoN e8sVS0sIjbvmfR4xfxf5oYUUgne/bQ1X2vw2+qD4gZcaOR4dKqCO/Klbg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrkeekgdejvdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpeffhffvvefukfhfgggtuggjsehgtderredttddvnecuhfhrohhmpefrrghtrhhi tghkucfuthgvihhnhhgrrhguthcuoehpshesphhkshdrihhmqeenucggtffrrghtthgvrh hnpeeukedtvedtffevleejtefgheehieegkeeluddvfeefgeehgfeltddtheejleffteen ucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehpshesph hkshdrihhm X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 24 Oct 2023 10:05:25 -0400 (EDT) Received: by vm-mail (OpenSMTPD) with ESMTPSA id cf549bdd (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Tue, 24 Oct 2023 14:05:20 +0000 (UTC) Date: Tue, 24 Oct 2023 16:05:23 +0200 From: Patrick Steinhardt To: git@vger.kernel.org Cc: Han-Wen Nienhuys , Eric Sunshine , Taylor Blau , Junio C Hamano Subject: [PATCH v2 8/9] t7900: assert the absence of refs via git-for-each-ref(1) 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: We're asserting that a prefetch of remotes via git-maintenance(1) doesn't write any references in refs/remotes by validating that the directory ".git/refs/remotes" is missing. This is quite roundabout: we don't care about the directory existing, we care about the references not existing, and the way these are stored is on the behest of the reference database. Convert the test to instead check via git-for-each-ref(1) whether any remote reference exist. Signed-off-by: Patrick Steinhardt --- t/t7900-maintenance.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/t/t7900-maintenance.sh b/t/t7900-maintenance.sh index e56f5980dc4..cefecee732f 100755 --- a/t/t7900-maintenance.sh +++ b/t/t7900-maintenance.sh @@ -157,7 +157,8 @@ test_expect_success 'prefetch multiple remotes' ' fetchargs="--prefetch --prune --no-tags --no-write-fetch-head --recurse-submodules=no --quiet" && test_subcommand git fetch remote1 $fetchargs actual && + test_must_be_empty actual && git log prefetch/remotes/remote1/one && git log prefetch/remotes/remote2/two && git fetch --all && From patchwork Tue Oct 24 14:05:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Steinhardt X-Patchwork-Id: 13434680 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.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 E12212E62F for ; Tue, 24 Oct 2023 14:05:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pks.im header.i=@pks.im header.b="tTCYQLS9"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="aAzuCILt" Received: from wout4-smtp.messagingengine.com (wout4-smtp.messagingengine.com [64.147.123.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BCABD10C3 for ; Tue, 24 Oct 2023 07:05:33 -0700 (PDT) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.west.internal (Postfix) with ESMTP id 4E34E3200A8D; Tue, 24 Oct 2023 10:05:32 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Tue, 24 Oct 2023 10:05:32 -0400 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:sender :subject:subject:to:to; s=fm3; t=1698156331; x=1698242731; bh=xC 5MSLBIaMkZjTcJpiDNpb7tTBB9/8ix79RVCdctk5Y=; b=tTCYQLS9gnAQWyi8VI iDqI6zrUPpfN1m4zkCtMZHicwNbOuyfZ9MguBOM//BYB9IOyhRpRhZslGTr4NgzT h+jcMb1hh7v63vs7nAHmntlS6l/zSPwDMSS2y22jGeP+IwPoctllyncOXLK6vD9v d9OgX8m71dBnX6cu4kKmwjHsUCOmSiqwsCmNVaXY5t5x9QxJ9nVBu2Sa2hJNALEA ZKY6QJfKIqtiuuevVQ5lz2rGwf9wYqbRP0Ejvo+/WVibTxicZ8NjylsLSXvRCx6P GdDbalAbc3YZoWRx2QfK1SL55owSfzETcj4uKmUxYRTvjOQr8OeSqxPluCDgVRfU yANA== 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:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; t=1698156331; x=1698242731; bh=xC5MSLBIaMkZj TcJpiDNpb7tTBB9/8ix79RVCdctk5Y=; b=aAzuCILtAlJt/qscfr3i2nusyEN51 0dsvDJIHZWOjRS/6pPhOLHB+2xmxVSal/r7JjemGh6kbTst0vGnu563S8L/r9V4O XWDIqWQIGcrLt9x9bLrMv6oH3T8ur9Q9U1kEX8wVYv1K05iJdFm1TFLMjAWwumfh 81dgsVMSLOn3q/VY1evUkbdMEeAKszTW4PHpNvBZG++53rD56sgZlS43hrZiXAaN BiJjidtIWfMPumbmafCwuuGB4sSXQCHj7hV4lPwnrnrlYBj/DNi2OeXK2TL1DL3q B3dbBiT6KUa/Sjs2t+MDtfZ+N1AzoZRYVHykO6dz4qUKgY3XVJlQWH1TA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrkeekgdejfecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpeffhffvvefukfhfgggtuggjsehgtderredttddvnecuhfhrohhmpefrrghtrhhi tghkucfuthgvihhnhhgrrhguthcuoehpshesphhkshdrihhmqeenucggtffrrghtthgvrh hnpeeukedtvedtffevleejtefgheehieegkeeluddvfeefgeehgfeltddtheejleffteen ucevlhhushhtvghrufhiiigvpeehnecurfgrrhgrmhepmhgrihhlfhhrohhmpehpshesph hkshdrihhm X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 24 Oct 2023 10:05:30 -0400 (EDT) Received: by vm-mail (OpenSMTPD) with ESMTPSA id 32c6180b (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Tue, 24 Oct 2023 14:05:25 +0000 (UTC) Date: Tue, 24 Oct 2023 16:05:28 +0200 From: Patrick Steinhardt To: git@vger.kernel.org Cc: Han-Wen Nienhuys , Eric Sunshine , Taylor Blau , Junio C Hamano Subject: [PATCH v2 9/9] t: mark several tests that assume the files backend with REFFILES Message-ID: <497e43ae5c362da9ad972e2813dc907df58a8676.1698156169.git.ps@pks.im> 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: Add the REFFILES prerequisite to several tests that assume we're using the files backend. There are various reasons why we cannot easily convert those tests to be backend-independent, where the most common one is that we have no way to write corrupt references into the refdb via our tooling. We may at a later point in time grow the tooling to make this possible, but for now we just mark these tests as requiring the files backend. Signed-off-by: Patrick Steinhardt --- t/t1400-update-ref.sh | 8 ++++---- t/t1450-fsck.sh | 6 +++--- t/t2011-checkout-invalid-head.sh | 16 ++++++++-------- t/t3200-branch.sh | 8 ++++---- t/t3400-rebase.sh | 2 +- t/t5605-clone-local.sh | 2 +- 6 files changed, 21 insertions(+), 21 deletions(-) diff --git a/t/t1400-update-ref.sh b/t/t1400-update-ref.sh index b7d1e5deede..70a760ba378 100755 --- a/t/t1400-update-ref.sh +++ b/t/t1400-update-ref.sh @@ -236,7 +236,7 @@ test_expect_success 'update-ref --no-deref -d can delete self-reference' ' test_must_fail git show-ref --verify -q refs/heads/self ' -test_expect_success 'update-ref --no-deref -d can delete reference to bad ref' ' +test_expect_success REFFILES 'update-ref --no-deref -d can delete reference to bad ref' ' >.git/refs/heads/bad && test_when_finished "rm -f .git/refs/heads/bad" && git symbolic-ref refs/heads/ref-to-bad refs/heads/bad && @@ -288,7 +288,7 @@ test_expect_success "set $m (logged by touch)" ' test $A = $(git show-ref -s --verify $m) ' -test_expect_success 'empty directory removal' ' +test_expect_success REFFILES 'empty directory removal' ' git branch d1/d2/r1 HEAD && git branch d1/r2 HEAD && test_path_is_file .git/refs/heads/d1/d2/r1 && @@ -300,7 +300,7 @@ test_expect_success 'empty directory removal' ' test_path_is_file .git/logs/refs/heads/d1/r2 ' -test_expect_success 'symref empty directory removal' ' +test_expect_success REFFILES 'symref empty directory removal' ' git branch e1/e2/r1 HEAD && git branch e1/r2 HEAD && git checkout e1/e2/r1 && @@ -1639,7 +1639,7 @@ test_expect_success PIPE 'transaction flushes status updates' ' test_cmp expected actual ' -test_expect_success 'directory not created deleting packed ref' ' +test_expect_success REFFILES 'directory not created deleting packed ref' ' git branch d1/d2/r1 HEAD && git pack-refs --all && test_path_is_missing .git/refs/heads/d1/d2 && diff --git a/t/t1450-fsck.sh b/t/t1450-fsck.sh index a6af550867c..50b15bd7fc0 100755 --- a/t/t1450-fsck.sh +++ b/t/t1450-fsck.sh @@ -123,7 +123,7 @@ test_expect_success 'branch pointing to non-commit' ' test_i18ngrep "not a commit" out ' -test_expect_success 'HEAD link pointing at a funny object' ' +test_expect_success REFFILES 'HEAD link pointing at a funny object' ' test_when_finished "git update-ref HEAD $orig_head" && echo $ZERO_OID >.git/HEAD && # avoid corrupt/broken HEAD from interfering with repo discovery @@ -139,7 +139,7 @@ test_expect_success 'HEAD link pointing at a funny place' ' test_i18ngrep "HEAD points to something strange" out ' -test_expect_success 'HEAD link pointing at a funny object (from different wt)' ' +test_expect_success REFFILES 'HEAD link pointing at a funny object (from different wt)' ' test_when_finished "git update-ref HEAD $orig_head" && test_when_finished "git worktree remove -f wt" && git worktree add wt && @@ -149,7 +149,7 @@ test_expect_success 'HEAD link pointing at a funny object (from different wt)' ' test_i18ngrep "main-worktree/HEAD: detached HEAD points" out ' -test_expect_success 'other worktree HEAD link pointing at a funny object' ' +test_expect_success REFFILES 'other worktree HEAD link pointing at a funny object' ' test_when_finished "git worktree remove -f other" && git worktree add other && echo $ZERO_OID >.git/worktrees/other/HEAD && diff --git a/t/t2011-checkout-invalid-head.sh b/t/t2011-checkout-invalid-head.sh index d9997e7b6b4..3c8135831b8 100755 --- a/t/t2011-checkout-invalid-head.sh +++ b/t/t2011-checkout-invalid-head.sh @@ -18,18 +18,18 @@ test_expect_success 'checkout should not start branch from a tree' ' test_must_fail git checkout -b newbranch main^{tree} ' -test_expect_success 'checkout main from invalid HEAD' ' +test_expect_success REFFILES 'checkout main from invalid HEAD' ' echo $ZERO_OID >.git/HEAD && git checkout main -- ' -test_expect_success 'checkout notices failure to lock HEAD' ' +test_expect_success REFFILES 'checkout notices failure to lock HEAD' ' test_when_finished "rm -f .git/HEAD.lock" && >.git/HEAD.lock && test_must_fail git checkout -b other ' -test_expect_success 'create ref directory/file conflict scenario' ' +test_expect_success REFFILES 'create ref directory/file conflict scenario' ' git update-ref refs/heads/outer/inner main && # do not rely on symbolic-ref to get a known state, @@ -39,26 +39,26 @@ test_expect_success 'create ref directory/file conflict scenario' ' } ' -test_expect_success 'checkout away from d/f HEAD (unpacked, to branch)' ' +test_expect_success REFFILES 'checkout away from d/f HEAD (unpacked, to branch)' ' reset_to_df && git checkout main ' -test_expect_success 'checkout away from d/f HEAD (unpacked, to detached)' ' +test_expect_success REFFILES 'checkout away from d/f HEAD (unpacked, to detached)' ' reset_to_df && git checkout --detach main ' -test_expect_success 'pack refs' ' +test_expect_success REFFILES 'pack refs' ' git pack-refs --all --prune ' -test_expect_success 'checkout away from d/f HEAD (packed, to branch)' ' +test_expect_success REFFILES 'checkout away from d/f HEAD (packed, to branch)' ' reset_to_df && git checkout main ' -test_expect_success 'checkout away from d/f HEAD (packed, to detached)' ' +test_expect_success REFFILES 'checkout away from d/f HEAD (packed, to detached)' ' reset_to_df && git checkout --detach main ' diff --git a/t/t3200-branch.sh b/t/t3200-branch.sh index a38601dbbb7..8d82f9bc52a 100755 --- a/t/t3200-branch.sh +++ b/t/t3200-branch.sh @@ -28,7 +28,7 @@ test_expect_success 'git branch --help should not have created a bogus branch' ' test_path_is_missing .git/refs/heads/--help ' -test_expect_success 'branch -h in broken repository' ' +test_expect_success REFFILES 'branch -h in broken repository' ' mkdir broken && ( cd broken && @@ -242,7 +242,7 @@ test_expect_success 'git branch -M baz bam should succeed when baz is checked ou git worktree prune ' -test_expect_success 'git branch -M fails if updating any linked working tree fails' ' +test_expect_success REFFILES 'git branch -M fails if updating any linked working tree fails' ' git worktree add -b baz bazdir1 && git worktree add -f bazdir2 baz && touch .git/worktrees/bazdir1/HEAD.lock && @@ -833,14 +833,14 @@ test_expect_success 'renaming a symref is not allowed' ' test_path_is_missing .git/refs/heads/new-topic ' -test_expect_success SYMLINKS 'git branch -m u v should fail when the reflog for u is a symlink' ' +test_expect_success SYMLINKS,REFFILES 'git branch -m u v should fail when the reflog for u is a symlink' ' git branch --create-reflog u && mv .git/logs/refs/heads/u real-u && ln -s real-u .git/logs/refs/heads/u && test_must_fail git branch -m u v ' -test_expect_success SYMLINKS 'git branch -m with symlinked .git/refs' ' +test_expect_success SYMLINKS,REFFILES 'git branch -m with symlinked .git/refs' ' test_when_finished "rm -rf subdir" && git init --bare subdir && diff --git a/t/t3400-rebase.sh b/t/t3400-rebase.sh index d3df19a51f8..435943a0891 100755 --- a/t/t3400-rebase.sh +++ b/t/t3400-rebase.sh @@ -424,7 +424,7 @@ test_expect_success 'refuse to switch to branch checked out elsewhere' ' test_i18ngrep "already used by worktree at" err ' -test_expect_success MINGW,SYMLINKS_WINDOWS 'rebase when .git/logs is a symlink' ' +test_expect_success REFFILES,MINGW,SYMLINKS_WINDOWS 'rebase when .git/logs is a symlink' ' git checkout main && mv .git/logs actual_logs && cmd //c "mklink /D .git\logs ..\actual_logs" && diff --git a/t/t5605-clone-local.sh b/t/t5605-clone-local.sh index a26689de379..8ad6445eca7 100755 --- a/t/t5605-clone-local.sh +++ b/t/t5605-clone-local.sh @@ -157,7 +157,7 @@ test_expect_success 'cloning locally respects "-u" for fetching refs' ' test_must_fail git clone --bare -u false a should_not_work.git ' -test_expect_success 'local clone from repo with corrupt refs fails gracefully' ' +test_expect_success REFFILES 'local clone from repo with corrupt refs fails gracefully' ' git init corrupt && test_commit -C corrupt one && echo a >corrupt/.git/refs/heads/topic &&