3 # Copyright (c) 2008 Nguyễn Thái Ngọc Duy
 
   6 test_description='skip-worktree bit test'
 
  10 cat >expect.full <<EOF
 
  17 cat >expect.skip <<EOF
 
  24 test_expect_success 'setup' '
 
  26         touch ./1 ./2 sub/1 sub/2 &&
 
  27         git add 1 2 sub/1 sub/2 &&
 
  28         git ls-files -t | test_cmp expect.full -
 
  31 test_expect_success 'index is at version 2' '
 
  32         test "$(test-index-version < .git/index)" = 2
 
  35 test_expect_success 'update-index --skip-worktree' '
 
  36         git update-index --skip-worktree 1 sub/1 &&
 
  37         git ls-files -t | test_cmp expect.skip -
 
  40 test_expect_success 'index is at version 3 after having some skip-worktree entries' '
 
  41         test "$(test-index-version < .git/index)" = 3
 
  44 test_expect_success 'ls-files -t' '
 
  45         git ls-files -t | test_cmp expect.skip -
 
  48 test_expect_success 'update-index --no-skip-worktree' '
 
  49         git update-index --no-skip-worktree 1 sub/1 &&
 
  50         git ls-files -t | test_cmp expect.full -
 
  53 test_expect_success 'index version is back to 2 when there is no skip-worktree entry' '
 
  54         test "$(test-index-version < .git/index)" = 2