Skip to content

Commit c4670b8

Browse files
committed
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
2 parents a91e0bb + 52a47ae commit c4670b8

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

t/t1415-worktree-refs.sh

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,8 @@ test_expect_success 'resolve main-worktree/HEAD' '
4040
'
4141

4242
test_expect_success 'ambiguous main-worktree/HEAD' '
43-
mkdir -p .git/refs/heads/main-worktree &&
44-
test_when_finished rm -f .git/refs/heads/main-worktree/HEAD &&
45-
cp .git/HEAD .git/refs/heads/main-worktree/HEAD &&
43+
test_when_finished git update-ref -d refs/heads/main-worktree/HEAD &&
44+
git update-ref refs/heads/main-worktree/HEAD $(git rev-parse HEAD) &&
4645
git rev-parse main-worktree/HEAD 2>warn &&
4746
grep "main-worktree/HEAD.*ambiguous" warn
4847
'
@@ -54,9 +53,8 @@ test_expect_success 'resolve worktrees/xx/HEAD' '
5453
'
5554

5655
test_expect_success 'ambiguous worktrees/xx/HEAD' '
57-
mkdir -p .git/refs/heads/worktrees/wt1 &&
58-
test_when_finished rm -f .git/refs/heads/worktrees/wt1/HEAD &&
59-
cp .git/HEAD .git/refs/heads/worktrees/wt1/HEAD &&
56+
git update-ref refs/heads/worktrees/wt1/HEAD $(git rev-parse HEAD) &&
57+
test_when_finished git update-ref -d refs/heads/worktrees/wt1/HEAD &&
6058
git rev-parse worktrees/wt1/HEAD 2>warn &&
6159
grep "worktrees/wt1/HEAD.*ambiguous" warn
6260
'

t/t7509-commit-authorship.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ test_expect_success 'commit respects CHERRY_PICK_HEAD and MERGE_MSG' '
147147
test_tick &&
148148
git commit -am "cherry-pick 1" --author="Cherry <[email protected]>" &&
149149
git tag cherry-pick-head &&
150-
git rev-parse cherry-pick-head >.git/CHERRY_PICK_HEAD &&
150+
git update-ref CHERRY_PICK_HEAD $(git rev-parse cherry-pick-head) &&
151151
echo "This is a MERGE_MSG" >.git/MERGE_MSG &&
152152
echo "cherry-pick 1b" >>foo &&
153153
test_tick &&
@@ -162,7 +162,7 @@ test_expect_success 'commit respects CHERRY_PICK_HEAD and MERGE_MSG' '
162162
'
163163

164164
test_expect_success '--reset-author with CHERRY_PICK_HEAD' '
165-
git rev-parse cherry-pick-head >.git/CHERRY_PICK_HEAD &&
165+
git update-ref CHERRY_PICK_HEAD $(git rev-parse cherry-pick-head) &&
166166
echo "cherry-pick 2" >>foo &&
167167
test_tick &&
168168
git commit -am "cherry-pick 2" --reset-author &&

0 commit comments

Comments
 (0)