summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorLibravatar Han-Wen Nienhuys <hanwen@google.com>2021-07-06 18:47:56 +0000
committerLibravatar Junio C Hamano <gitster@pobox.com>2021-07-06 12:56:38 -0700
commitae815940f6efde993083e6e7ae655f8b3d16754c (patch)
tree34765d9560790cb7c2a4a2b01562e9e5c0db4be9 /t
parentThe second batch (diff)
downloadtgif-ae815940f6efde993083e6e7ae655f8b3d16754c.tar.xz
t1415: avoid direct filesystem access for writing refs
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rwxr-xr-xt/t1415-worktree-refs.sh10
1 files changed, 4 insertions, 6 deletions
diff --git a/t/t1415-worktree-refs.sh b/t/t1415-worktree-refs.sh
index 7ab91241ab..011a1a5e5e 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
'