]> git.ipfire.org Git - thirdparty/git.git/blob - t/t2104-update-index-skip-worktree.sh
Merge branch 'jk/complete-commit-c' into maint
[thirdparty/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 #
5
6 test_description='skip-worktree bit test'
7
8 . ./test-lib.sh
9
10 cat >expect.full <<EOF
11 H 1
12 H 2
13 H sub/1
14 H sub/2
15 EOF
16
17 cat >expect.skip <<EOF
18 S 1
19 H 2
20 S sub/1
21 H sub/2
22 EOF
23
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 '
30
31 test_expect_success 'index is at version 2' '
32 test "$(test-index-version < .git/index)" = 2
33 '
34
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 '
39
40 test_expect_success 'index is at version 3 after having some skip-worktree entries' '
41 test "$(test-index-version < .git/index)" = 3
42 '
43
44 test_expect_success 'ls-files -t' '
45 git ls-files -t | test_cmp expect.skip -
46 '
47
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 '
52
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 '
56
57 test_done