]>
Commit | Line | Data |
---|---|---|
44a36913 NTND |
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 | ||
5d9fc888 TG |
10 | test_set_index_version 3 |
11 | ||
44a36913 NTND |
12 | cat >expect.full <<EOF |
13 | H 1 | |
14 | H 2 | |
15 | H sub/1 | |
16 | H sub/2 | |
17 | EOF | |
18 | ||
19 | cat >expect.skip <<EOF | |
20 | S 1 | |
21 | H 2 | |
22 | S sub/1 | |
23 | H sub/2 | |
24 | EOF | |
25 | ||
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 - | |
31 | ' | |
32 | ||
33 | test_expect_success 'index is at version 2' ' | |
34 | test "$(test-index-version < .git/index)" = 2 | |
35 | ' | |
36 | ||
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 - | |
40 | ' | |
41 | ||
42 | test_expect_success 'index is at version 3 after having some skip-worktree entries' ' | |
43 | test "$(test-index-version < .git/index)" = 3 | |
44 | ' | |
45 | ||
46 | test_expect_success 'ls-files -t' ' | |
47 | git ls-files -t | test_cmp expect.skip - | |
48 | ' | |
49 | ||
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 - | |
53 | ' | |
54 | ||
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 | |
57 | ' | |
58 | ||
59 | test_done |