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>
This commit is contained in:
Han-Wen Nienhuys 2021-07-06 18:47:56 +00:00 committed by Junio C Hamano
parent 670b81a890
commit ae815940f6

View File

@ -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
'