3 # Copyright (c) 2008 Nguyễn Thái Ngọc Duy
6 test_description
='skip-worktree bit test'
10 test_set_index_version
3
12 cat >expect.full
<<EOF
19 cat >expect.skip
<<EOF
26 test_expect_success
'setup' '
28 touch ./1 ./2 sub/1 sub/2 &&
29 git add 1 2 sub/1 sub/2 &&
30 git ls-files -t | test_cmp expect.full -
33 test_expect_success
'index is at version 2' '
34 test "$(test-index-version < .git/index)" = 2
37 test_expect_success
'update-index --skip-worktree' '
38 git update-index --skip-worktree 1 sub/1 &&
39 git ls-files -t | test_cmp expect.skip -
42 test_expect_success
'index is at version 3 after having some skip-worktree entries' '
43 test "$(test-index-version < .git/index)" = 3
46 test_expect_success
'ls-files -t' '
47 git ls-files -t | test_cmp expect.skip -
50 test_expect_success
'update-index --no-skip-worktree' '
51 git update-index --no-skip-worktree 1 sub/1 &&
52 git ls-files -t | test_cmp expect.full -
55 test_expect_success
'index version is back to 2 when there is no skip-worktree entry' '
56 test "$(test-index-version < .git/index)" = 2