Merge branch 'jk/sha1-file-reduce-useless-warnings' into maint
[git.git] / t / t2104-update-index-skip-worktree.sh
blobcc830da58d920718b7b0a990a359afa9dd783b4c
1 #!/bin/sh
3 # Copyright (c) 2008 Nguyễn Thái Ngọc Duy
6 test_description='skip-worktree bit test'
8 . ./test-lib.sh
10 sane_unset GIT_TEST_SPLIT_INDEX
12 test_set_index_version 3
14 cat >expect.full <<EOF
15 H 1
16 H 2
17 H sub/1
18 H sub/2
19 EOF
21 cat >expect.skip <<EOF
22 S 1
23 H 2
24 S sub/1
25 H sub/2
26 EOF
28 test_expect_success 'setup' '
29 mkdir sub &&
30 touch ./1 ./2 sub/1 sub/2 &&
31 git add 1 2 sub/1 sub/2 &&
32 git ls-files -t | test_cmp expect.full -
35 test_expect_success 'index is at version 2' '
36 test "$(test-index-version < .git/index)" = 2
39 test_expect_success 'update-index --skip-worktree' '
40 git update-index --skip-worktree 1 sub/1 &&
41 git ls-files -t | test_cmp expect.skip -
44 test_expect_success 'index is at version 3 after having some skip-worktree entries' '
45 test "$(test-index-version < .git/index)" = 3
48 test_expect_success 'ls-files -t' '
49 git ls-files -t | test_cmp expect.skip -
52 test_expect_success 'update-index --no-skip-worktree' '
53 git update-index --no-skip-worktree 1 sub/1 &&
54 git ls-files -t | test_cmp expect.full -
57 test_expect_success 'index version is back to 2 when there is no skip-worktree entry' '
58 test "$(test-index-version < .git/index)" = 2
61 test_done