From: Patrick Steinhardt <ps@pks.im>
To: git@vger.kernel.org
Cc: Han-Wen Nienhuys <hanwen@google.com>,
Eric Sunshine <sunshine@sunshineco.com>,
Taylor Blau <me@ttaylorr.com>, Junio C Hamano <gitster@pobox.com>
Subject: [PATCH v3 5/9] t1450: convert tests to remove worktrees via git-worktree(1)
Date: Thu, 2 Nov 2023 09:46:57 +0100 [thread overview]
Message-ID: <a5d55b6882845d1ae0885b3fc879d3167cb0e816.1698914571.git.ps@pks.im> (raw)
In-Reply-To: <cover.1698914571.git.ps@pks.im>
[-- Attachment #1: Type: text/plain, Size: 2516 bytes --]
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 <ps@pks.im>
---
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 &&
--
2.42.0
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2023-11-02 8:47 UTC|newest]
Thread overview: 59+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-18 5:35 [PATCH 00/11] t: reduce direct disk access to data structures Patrick Steinhardt
2023-10-18 5:35 ` [PATCH 01/11] t: add helpers to test for reference existence Patrick Steinhardt
2023-10-18 16:06 ` Junio C Hamano
2023-10-23 13:58 ` Patrick Steinhardt
2023-10-18 17:08 ` Eric Sunshine
2023-10-23 13:58 ` Patrick Steinhardt
2023-10-18 5:35 ` [PATCH 02/11] t: allow skipping expected object ID in `ref-store update-ref` Patrick Steinhardt
2023-10-18 16:08 ` Junio C Hamano
2023-10-23 13:58 ` Patrick Steinhardt
2023-10-23 19:06 ` Junio C Hamano
2023-10-18 5:35 ` [PATCH 03/11] t: convert tests to use helpers for reference existence Patrick Steinhardt
2023-10-18 16:28 ` Junio C Hamano
2023-10-18 5:35 ` [PATCH 04/11] t: convert tests to not write references via the filesystem Patrick Steinhardt
2023-10-18 18:34 ` Junio C Hamano
2023-10-23 13:58 ` Patrick Steinhardt
2023-10-23 19:10 ` Junio C Hamano
2023-10-18 21:18 ` Junio C Hamano
2023-10-23 13:58 ` Patrick Steinhardt
2023-10-18 5:35 ` [PATCH 05/11] t: convert tests to not access symrefs " Patrick Steinhardt
2023-10-20 19:52 ` Junio C Hamano
2023-10-18 5:35 ` [PATCH 06/11] t: convert tests to not access reflog " Patrick Steinhardt
2023-10-21 23:13 ` Junio C Hamano
2023-10-18 5:35 ` [PATCH 07/11] t1450: convert tests to remove worktrees via git-worktree(1) Patrick Steinhardt
2023-10-18 5:35 ` [PATCH 08/11] t4207: delete replace references via git-update-ref(1) Patrick Steinhardt
2023-10-18 13:27 ` Han-Wen Nienhuys
2023-10-23 13:58 ` Patrick Steinhardt
2023-10-23 16:42 ` Taylor Blau
2023-10-24 6:42 ` Patrick Steinhardt
2023-10-18 5:35 ` [PATCH 09/11] t7300: assert exact states of repo Patrick Steinhardt
2023-10-18 5:35 ` [PATCH 10/11] t7900: assert the absence of refs via git-for-each-ref(1) Patrick Steinhardt
2023-10-18 5:35 ` [PATCH 11/11] t: mark several tests that assume the files backend with REFFILES Patrick Steinhardt
2023-10-18 5:39 ` [PATCH 00/11] t: reduce direct disk access to data structures Patrick Steinhardt
2023-10-18 23:40 ` Junio C Hamano
2023-10-23 11:57 ` Patrick Steinhardt
2023-10-18 15:32 ` Junio C Hamano
2023-10-19 10:13 ` Han-Wen Nienhuys
2023-10-19 17:55 ` Junio C Hamano
2023-10-23 13:58 ` Patrick Steinhardt
2023-10-24 14:04 ` [PATCH v2 0/9] " Patrick Steinhardt
2023-10-24 14:04 ` [PATCH v2 1/9] t: allow skipping expected object ID in `ref-store update-ref` Patrick Steinhardt
2023-10-24 14:04 ` [PATCH v2 2/9] t: convert tests to not write references via the filesystem Patrick Steinhardt
2023-10-24 14:05 ` [PATCH v2 3/9] t: convert tests to not access symrefs " Patrick Steinhardt
2023-10-24 14:05 ` [PATCH v2 4/9] t: convert tests to not access reflog " Patrick Steinhardt
2023-10-24 14:05 ` [PATCH v2 5/9] t1450: convert tests to remove worktrees via git-worktree(1) Patrick Steinhardt
2023-10-27 2:42 ` Eric Sunshine
2023-10-24 14:05 ` [PATCH v2 6/9] t4207: delete replace references via git-update-ref(1) Patrick Steinhardt
2023-10-24 14:05 ` [PATCH v2 7/9] t7300: assert exact states of repo Patrick Steinhardt
2023-10-24 14:05 ` [PATCH v2 8/9] t7900: assert the absence of refs via git-for-each-ref(1) Patrick Steinhardt
2023-10-24 14:05 ` [PATCH v2 9/9] t: mark several tests that assume the files backend with REFFILES Patrick Steinhardt
2023-11-02 8:46 ` [PATCH v3 0/9] t: reduce direct disk access to data structures Patrick Steinhardt
2023-11-02 8:46 ` [PATCH v3 1/9] t: allow skipping expected object ID in `ref-store update-ref` Patrick Steinhardt
2023-11-02 8:46 ` [PATCH v3 2/9] t: convert tests to not write references via the filesystem Patrick Steinhardt
2023-11-02 8:46 ` [PATCH v3 3/9] t: convert tests to not access symrefs " Patrick Steinhardt
2023-11-02 8:46 ` [PATCH v3 4/9] t: convert tests to not access reflog " Patrick Steinhardt
2023-11-02 8:46 ` Patrick Steinhardt [this message]
2023-11-02 8:47 ` [PATCH v3 6/9] t4207: delete replace references via git-update-ref(1) Patrick Steinhardt
2023-11-02 8:47 ` [PATCH v3 7/9] t7300: assert exact states of repo Patrick Steinhardt
2023-11-02 8:47 ` [PATCH v3 8/9] t7900: assert the absence of refs via git-for-each-ref(1) Patrick Steinhardt
2023-11-02 8:47 ` [PATCH v3 9/9] t: mark several tests that assume the files backend with REFFILES Patrick Steinhardt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=a5d55b6882845d1ae0885b3fc879d3167cb0e816.1698914571.git.ps@pks.im \
--to=ps@pks.im \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=hanwen@google.com \
--cc=me@ttaylorr.com \
--cc=sunshine@sunshineco.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).