t7800: improve test descriptions with empty arguments
[alt-git.git] / t / t3320-notes-merge-worktrees.sh
blob0fd33280cf91f7fe9384205df8b7570363a37076
1 #!/bin/sh
3 # Copyright (c) 2015 Twitter, Inc
6 test_description='Test merging of notes trees in multiple worktrees'
8 GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME=main
9 export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME
11 TEST_PASSES_SANITIZE_LEAK=true
12 . ./test-lib.sh
14 test_expect_success 'setup commit' '
15 test_commit tantrum
18 commit_tantrum=$(git rev-parse tantrum^{commit})
20 test_expect_success 'setup notes ref (x)' '
21 git config core.notesRef refs/notes/x &&
22 git notes add -m "x notes on tantrum" tantrum
25 test_expect_success 'setup local branch (y)' '
26 git update-ref refs/notes/y refs/notes/x &&
27 git config core.notesRef refs/notes/y &&
28 git notes remove tantrum
31 test_expect_success 'setup remote branch (z)' '
32 git update-ref refs/notes/z refs/notes/x &&
33 git config core.notesRef refs/notes/z &&
34 git notes add -f -m "conflicting notes on tantrum" tantrum
37 test_expect_success 'modify notes ref ourselves (x)' '
38 git config core.notesRef refs/notes/x &&
39 git notes add -f -m "more conflicting notes on tantrum" tantrum
42 test_expect_success 'create some new worktrees' '
43 git worktree add -b newbranch worktree main &&
44 git worktree add -b newbranch2 worktree2 main
47 test_expect_success 'merge z into y fails and sets NOTES_MERGE_REF' '
48 git config core.notesRef refs/notes/y &&
49 test_must_fail git notes merge z &&
50 echo "refs/notes/y" >expect &&
51 git symbolic-ref NOTES_MERGE_REF >actual &&
52 test_cmp expect actual
55 test_expect_success 'merge z into y while mid-merge in another workdir fails' '
57 cd worktree &&
58 git config core.notesRef refs/notes/y &&
59 test_must_fail git notes merge z 2>err &&
60 test_grep "a notes merge into refs/notes/y is already in-progress at" err
61 ) &&
62 test_must_fail git -C worktree symbolic-ref NOTES_MERGE_REF
65 test_expect_success 'merge z into x while mid-merge on y succeeds' '
67 cd worktree2 &&
68 git config core.notesRef refs/notes/x &&
69 test_must_fail git notes merge z >out 2>&1 &&
70 test_grep "Automatic notes merge failed" out &&
71 grep -v "A notes merge into refs/notes/x is already in-progress in" out
72 ) &&
73 echo "refs/notes/x" >expect &&
74 git -C worktree2 symbolic-ref NOTES_MERGE_REF >actual &&
75 test_cmp expect actual
78 test_done