t3320: use git-symbolic-ref rather than filesystem access

Signed-off-by: Han-Wen Nienhuys <hanwen@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Han-Wen Nienhuys committed Aug 2, 2021 at 16:53 UTC 2f566d665ac3ef97715617aae839fa2e6f7fce93
1 file changed +7 -5
t/t3320-notes-merge-worktrees.sh
+7 -5
@@ -46,8 +46,9 @@ test_expect_success 'create some new worktrees' '
46 test_expect_success 'merge z into y fails and sets NOTES_MERGE_REF' '
47 git config core.notesRef refs/notes/y &&
48 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
52 '
53
54 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' '
58 test_must_fail git notes merge z 2>err &&
59 test_i18ngrep "a notes merge into refs/notes/y is already in-progress at" err
60 ) &&
60 - test_path_is_missing .git/worktrees/worktree/NOTES_MERGE_REF
61 + test_must_fail git -C worktree symbolic-ref NOTES_MERGE_REF
62 '
63
64 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' '
69 test_i18ngrep "Automatic notes merge failed" out &&
70 grep -v "A notes merge into refs/notes/x is already in-progress in" out
71 ) &&
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
75 '
76
77 test_done