blame: factor out get_next_line()
[git.git] / t / t2104-update-index-skip-worktree.sh
blob29c1fb10cad93818d467780b799ff874e8fdcab0
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 test_set_index_version 3
12 cat >expect.full <<EOF
13 H 1
14 H 2
15 H sub/1
16 H sub/2
17 EOF
19 cat >expect.skip <<EOF
20 S 1
21 H 2
22 S sub/1
23 H sub/2
24 EOF
26 test_expect_success 'setup' '
27 mkdir sub &&
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
59 test_done