t / t3320-notes-merge-worktrees.shon commit t0001: don't let a default ACL interfere with the umask test (d549d21)
   1#!/bin/sh
   2#
   3# Copyright (c) 2015 Twitter, Inc
   4#
   5
   6test_description='Test merging of notes trees in multiple worktrees'
   7
   8. ./test-lib.sh
   9
  10test_expect_success 'setup commit' '
  11        test_commit tantrum
  12'
  13
  14commit_tantrum=$(git rev-parse tantrum^{commit})
  15
  16test_expect_success 'setup notes ref (x)' '
  17        git config core.notesRef refs/notes/x &&
  18        git notes add -m "x notes on tantrum" tantrum
  19'
  20
  21test_expect_success 'setup local branch (y)' '
  22        git update-ref refs/notes/y refs/notes/x &&
  23        git config core.notesRef refs/notes/y &&
  24        git notes remove tantrum
  25'
  26
  27test_expect_success 'setup remote branch (z)' '
  28        git update-ref refs/notes/z refs/notes/x &&
  29        git config core.notesRef refs/notes/z &&
  30        git notes add -f -m "conflicting notes on tantrum" tantrum
  31'
  32
  33test_expect_success 'modify notes ref ourselves (x)' '
  34        git config core.notesRef refs/notes/x &&
  35        git notes add -f -m "more conflicting notes on tantrum" tantrum
  36'
  37
  38test_expect_success 'create some new worktrees' '
  39        git worktree add -b newbranch worktree master &&
  40        git worktree add -b newbranch2 worktree2 master
  41'
  42
  43test_expect_success 'merge z into y fails and sets NOTES_MERGE_REF' '
  44        git config core.notesRef refs/notes/y &&
  45        test_must_fail git notes merge z &&
  46        echo "ref: refs/notes/y" >expect &&
  47        test_cmp .git/NOTES_MERGE_REF expect
  48'
  49
  50test_expect_success 'merge z into y while mid-merge in another workdir fails' '
  51        (
  52                cd worktree &&
  53                git config core.notesRef refs/notes/y &&
  54                test_must_fail git notes merge z 2>err &&
  55                grep "A notes merge into refs/notes/y is already in-progress at" err
  56        ) &&
  57        test_path_is_missing .git/worktrees/worktree/NOTES_MERGE_REF
  58'
  59
  60test_expect_success 'merge z into x while mid-merge on y succeeds' '
  61        (
  62                cd worktree2 &&
  63                git config core.notesRef refs/notes/x &&
  64                test_must_fail git notes merge z 2>&1 >out &&
  65                grep "Automatic notes merge failed" out &&
  66                grep -v "A notes merge into refs/notes/x is already in-progress in" out
  67        ) &&
  68        echo "ref: refs/notes/x" >expect &&
  69        test_cmp .git/worktrees/worktree2/NOTES_MERGE_REF expect
  70'
  71
  72test_done