Skip to content

Commit 2ab8bc2

Browse files
committed
Merge branch 'hn/refs-test-cleanup' into next
A handful of tests that assumed implementation details of files backend for refs have been cleaned up. * hn/refs-test-cleanup: t2402: use ref-store test helper to create broken symlink t3320: use git-symbolic-ref rather than filesystem access t6120: use git-update-ref rather than filesystem access t1503: mark symlink test as REFFILES t6050: use git-update-ref rather than filesystem access
2 parents b8b636c + 3736b09 commit 2ab8bc2

File tree

5 files changed

+14
-10
lines changed

5 files changed

+14
-10
lines changed

t/t1503-rev-parse-verify.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ test_expect_success 'main@{n} for various n' '
142142
test_must_fail git rev-parse --verify main@{$Np1}
143143
'
144144

145-
test_expect_success SYMLINKS 'ref resolution not confused by broken symlinks' '
145+
test_expect_success SYMLINKS,REFFILES 'ref resolution not confused by broken symlinks' '
146146
ln -s does-not-exist .git/refs/heads/broken &&
147147
test_must_fail git rev-parse --verify broken
148148
'

t/t2402-worktree-list.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ test_expect_success 'broken main worktree still at the top' '
230230
EOF
231231
cd linked &&
232232
echo "worktree $(pwd)" >expected &&
233-
echo "ref: .broken" >../.git/HEAD &&
233+
(cd ../ && test-tool ref-store main create-symref HEAD .broken ) &&
234234
git worktree list --porcelain >out &&
235235
head -n 3 out >actual &&
236236
test_cmp ../expected actual &&

t/t3320-notes-merge-worktrees.sh

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,9 @@ test_expect_success 'create some new worktrees' '
4646
test_expect_success 'merge z into y fails and sets NOTES_MERGE_REF' '
4747
git config core.notesRef refs/notes/y &&
4848
test_must_fail git notes merge z &&
49-
echo "ref: refs/notes/y" >expect &&
50-
test_cmp expect .git/NOTES_MERGE_REF
49+
echo "refs/notes/y" >expect &&
50+
git symbolic-ref NOTES_MERGE_REF >actual &&
51+
test_cmp expect actual
5152
'
5253

5354
test_expect_success 'merge z into y while mid-merge in another workdir fails' '
@@ -57,7 +58,7 @@ test_expect_success 'merge z into y while mid-merge in another workdir fails' '
5758
test_must_fail git notes merge z 2>err &&
5859
test_i18ngrep "a notes merge into refs/notes/y is already in-progress at" err
5960
) &&
60-
test_path_is_missing .git/worktrees/worktree/NOTES_MERGE_REF
61+
test_must_fail git -C worktree symbolic-ref NOTES_MERGE_REF
6162
'
6263

6364
test_expect_success 'merge z into x while mid-merge on y succeeds' '
@@ -68,8 +69,9 @@ test_expect_success 'merge z into x while mid-merge on y succeeds' '
6869
test_i18ngrep "Automatic notes merge failed" out &&
6970
grep -v "A notes merge into refs/notes/x is already in-progress in" out
7071
) &&
71-
echo "ref: refs/notes/x" >expect &&
72-
test_cmp expect .git/worktrees/worktree2/NOTES_MERGE_REF
72+
echo "refs/notes/x" >expect &&
73+
git -C worktree2 symbolic-ref NOTES_MERGE_REF >actual &&
74+
test_cmp expect actual
7375
'
7476

7577
test_done

t/t6050-replace.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ tagger T A Gger <> 0 +0000
132132
EOF
133133

134134
test_expect_success 'tag replaced commit' '
135-
git mktag <tag.sig >.git/refs/tags/mytag
135+
git update-ref refs/tags/mytag $(git mktag <tag.sig)
136136
'
137137

138138
test_expect_success '"git fsck" works' '

t/t6120-describe.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,8 @@ test_expect_success 'describe --contains defaults to HEAD without commit-ish' '
107107
check_describe tags/A --all A^0
108108

109109
test_expect_success 'renaming tag A to Q locally produces a warning' "
110-
mv .git/refs/tags/A .git/refs/tags/Q &&
110+
git update-ref refs/tags/Q $(git rev-parse refs/tags/A) &&
111+
git update-ref -d refs/tags/A &&
111112
git describe HEAD 2>err >out &&
112113
cat >expected <<-\EOF &&
113114
warning: tag 'Q' is externally known as 'A'
@@ -135,7 +136,8 @@ test_expect_success 'abbrev=0 will not break misplaced tag (2)' '
135136
'
136137

137138
test_expect_success 'rename tag Q back to A' '
138-
mv .git/refs/tags/Q .git/refs/tags/A
139+
git update-ref refs/tags/A $(git rev-parse refs/tags/Q) &&
140+
git update-ref -d refs/tags/Q
139141
'
140142

141143
test_expect_success 'pack tag refs' 'git pack-refs'

0 commit comments

Comments
 (0)