t / t1415-worktree-refs.shon commit Add a place for (not) sharing stuff between worktrees (8aff1a9)
   1#!/bin/sh
   2
   3test_description='per-worktree refs'
   4
   5. ./test-lib.sh
   6
   7test_expect_success 'setup' '
   8        test_commit initial &&
   9        test_commit wt1 &&
  10        test_commit wt2 &&
  11        git worktree add wt1 wt1 &&
  12        git worktree add wt2 wt2 &&
  13        git checkout initial &&
  14        git update-ref refs/worktree/foo HEAD &&
  15        git -C wt1 update-ref refs/worktree/foo HEAD &&
  16        git -C wt2 update-ref refs/worktree/foo HEAD
  17'
  18
  19test_expect_success 'refs/worktree must not be packed' '
  20        git pack-refs --all &&
  21        test_path_is_missing .git/refs/tags/wt1 &&
  22        test_path_is_file .git/refs/worktree/foo &&
  23        test_path_is_file .git/worktrees/wt1/refs/worktree/foo &&
  24        test_path_is_file .git/worktrees/wt2/refs/worktree/foo
  25'
  26
  27test_expect_success 'refs/worktree are per-worktree' '
  28        test_cmp_rev worktree/foo initial &&
  29        ( cd wt1 && test_cmp_rev worktree/foo wt1 ) &&
  30        ( cd wt2 && test_cmp_rev worktree/foo wt2 )
  31'
  32
  33test_done