[PATCH 1/2] t1415: avoid direct filesystem access for writing refs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Han-Wen Nienhuys <hanwen@xxxxxxxxxx>

Signed-off-by: Han-Wen Nienhuys <hanwen@xxxxxxxxxx>
---
 t/t1415-worktree-refs.sh | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/t/t1415-worktree-refs.sh b/t/t1415-worktree-refs.sh
index 7ab91241ab7..011a1a5e5e3 100755
--- a/t/t1415-worktree-refs.sh
+++ b/t/t1415-worktree-refs.sh
@@ -37,9 +37,8 @@ test_expect_success 'resolve main-worktree/HEAD' '
 '
 
 test_expect_success 'ambiguous main-worktree/HEAD' '
-	mkdir -p .git/refs/heads/main-worktree &&
-	test_when_finished rm -f .git/refs/heads/main-worktree/HEAD &&
-	cp .git/HEAD .git/refs/heads/main-worktree/HEAD &&
+	test_when_finished git update-ref -d refs/heads/main-worktree/HEAD &&
+	git update-ref refs/heads/main-worktree/HEAD $(git rev-parse HEAD) &&
 	git rev-parse main-worktree/HEAD 2>warn &&
 	grep "main-worktree/HEAD.*ambiguous" warn
 '
@@ -51,9 +50,8 @@ test_expect_success 'resolve worktrees/xx/HEAD' '
 '
 
 test_expect_success 'ambiguous worktrees/xx/HEAD' '
-	mkdir -p .git/refs/heads/worktrees/wt1 &&
-	test_when_finished rm -f .git/refs/heads/worktrees/wt1/HEAD &&
-	cp .git/HEAD .git/refs/heads/worktrees/wt1/HEAD &&
+	git update-ref refs/heads/worktrees/wt1/HEAD $(git rev-parse HEAD) &&
+	test_when_finished git update-ref -d refs/heads/worktrees/wt1/HEAD &&
 	git rev-parse worktrees/wt1/HEAD 2>warn &&
 	grep "worktrees/wt1/HEAD.*ambiguous" warn
 '
-- 
gitgitgadget




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux