Code

Sync with 1.7.9.5
[git.git] / t / t2104-update-index-skip-worktree.sh
1 #!/bin/sh
2 #
3 # Copyright (c) 2008 Nguyễn Thái Ngọc Duy
4 #
6 test_description='skip-worktree bit test'
8 . ./test-lib.sh
10 cat >expect.full <<EOF
11 H 1
12 H 2
13 H sub/1
14 H sub/2
15 EOF
17 cat >expect.skip <<EOF
18 S 1
19 H 2
20 S sub/1
21 H sub/2
22 EOF
24 test_expect_success 'setup' '
25         mkdir sub &&
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 -
29 '
31 test_expect_success 'index is at version 2' '
32         test "$(test-index-version < .git/index)" = 2
33 '
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 -
38 '
40 test_expect_success 'index is at version 3 after having some skip-worktree entries' '
41         test "$(test-index-version < .git/index)" = 3
42 '
44 test_expect_success 'ls-files -t' '
45         git ls-files -t | test_cmp expect.skip -
46 '
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 -
51 '
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
55 '
57 test_done