l10n: bg.po: Updated Bulgarian translation (5211t)
[git.git] / t / t3320-notes-merge-worktrees.sh
blob6b2d507f3e7f0ef9ed9db25a6129259627ecacfc
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-lib.sh
13 test_expect_success 'setup commit' '
14 test_commit tantrum
17 commit_tantrum=$(git rev-parse tantrum^{commit})
19 test_expect_success 'setup notes ref (x)' '
20 git config core.notesRef refs/notes/x &&
21 git notes add -m "x notes on tantrum" tantrum
24 test_expect_success 'setup local branch (y)' '
25 git update-ref refs/notes/y refs/notes/x &&
26 git config core.notesRef refs/notes/y &&
27 git notes remove tantrum
30 test_expect_success 'setup remote branch (z)' '
31 git update-ref refs/notes/z refs/notes/x &&
32 git config core.notesRef refs/notes/z &&
33 git notes add -f -m "conflicting notes on tantrum" tantrum
36 test_expect_success 'modify notes ref ourselves (x)' '
37 git config core.notesRef refs/notes/x &&
38 git notes add -f -m "more conflicting notes on tantrum" tantrum
41 test_expect_success 'create some new worktrees' '
42 git worktree add -b newbranch worktree main &&
43 git worktree add -b newbranch2 worktree2 main
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 "refs/notes/y" >expect &&
50 git symbolic-ref NOTES_MERGE_REF >actual &&
51 test_cmp expect actual
54 test_expect_success 'merge z into y while mid-merge in another workdir fails' '
56 cd worktree &&
57 git config core.notesRef refs/notes/y &&
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 ) &&
61 test_must_fail git -C worktree symbolic-ref NOTES_MERGE_REF
64 test_expect_success 'merge z into x while mid-merge on y succeeds' '
66 cd worktree2 &&
67 git config core.notesRef refs/notes/x &&
68 test_must_fail git notes merge z >out 2>&1 &&
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 ) &&
72 echo "refs/notes/x" >expect &&
73 git -C worktree2 symbolic-ref NOTES_MERGE_REF >actual &&
74 test_cmp expect actual
77 test_done