pull: --ff-only should make it a noop when already-up-to-date
[git/debian.git] / t / t2104-update-index-skip-worktree.sh
blob30666fc70d28264d036105659871a68323ce2460
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 () {
13 GIT_INDEX_VERSION="$1"
14 export GIT_INDEX_VERSION
17 test_set_index_version 3
19 cat >expect.full <<EOF
20 H 1
21 H 2
22 H sub/1
23 H sub/2
24 EOF
26 cat >expect.skip <<EOF
27 S 1
28 H 2
29 S sub/1
30 H sub/2
31 EOF
33 test_expect_success 'setup' '
34 mkdir sub &&
35 touch ./1 ./2 sub/1 sub/2 &&
36 git add 1 2 sub/1 sub/2 &&
37 git ls-files -t | test_cmp expect.full -
40 test_expect_success 'index is at version 2' '
41 test "$(test-tool index-version < .git/index)" = 2
44 test_expect_success 'update-index --skip-worktree' '
45 git update-index --skip-worktree 1 sub/1 &&
46 git ls-files -t | test_cmp expect.skip -
49 test_expect_success 'index is at version 3 after having some skip-worktree entries' '
50 test "$(test-tool index-version < .git/index)" = 3
53 test_expect_success 'ls-files -t' '
54 git ls-files -t | test_cmp expect.skip -
57 test_expect_success 'update-index --no-skip-worktree' '
58 git update-index --no-skip-worktree 1 sub/1 &&
59 git ls-files -t | test_cmp expect.full -
62 test_expect_success 'index version is back to 2 when there is no skip-worktree entry' '
63 test "$(test-tool index-version < .git/index)" = 2
66 test_done