summaryrefslogtreecommitdiff
path: root/t/t1415-worktree-refs.sh
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2021-07-16 17:42:52 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2021-07-16 17:42:52 -0700
commitc4670b8a8df58924dbe051f306f53aaf2e549319 (patch)
tree91ffce3ddd84a0895fbe4598db8344d6b6d7872a /t/t1415-worktree-refs.sh
parentMerge branch 'rs/khash-alloc-cleanup' (diff)
parentt7509: avoid direct file access for writing CHERRY_PICK_HEAD (diff)
downloadtgif-c4670b8a8df58924dbe051f306f53aaf2e549319.tar.xz
Merge branch 'hn/refs-test-cleanup'
Test clean-up. * hn/refs-test-cleanup: t7509: avoid direct file access for writing CHERRY_PICK_HEAD t1415: avoid direct filesystem access for writing refs
Diffstat (limited to 't/t1415-worktree-refs.sh')
-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 66f27d0fdf..a3e6ea0808 100755
--- a/t/t1415-worktree-refs.sh
+++ b/t/t1415-worktree-refs.sh
@@ -40,9 +40,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
'
@@ -54,9 +53,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
'