]> git.ipfire.org Git - thirdparty/git.git/blame - t/t2104-update-index-skip-worktree.sh
The thirteenth batch
[thirdparty/git.git] / t / t2104-update-index-skip-worktree.sh
CommitLineData
44a36913
NTND
1#!/bin/sh
2#
3# Copyright (c) 2008 Nguyễn Thái Ngọc Duy
4#
5
6test_description='skip-worktree bit test'
7
977e458c 8TEST_PASSES_SANITIZE_LEAK=true
44a36913
NTND
9. ./test-lib.sh
10
5b0a78c1
NTND
11sane_unset GIT_TEST_SPLIT_INDEX
12
762ccf99
ÆAB
13test_set_index_version () {
14 GIT_INDEX_VERSION="$1"
15 export GIT_INDEX_VERSION
16}
17
5d9fc888
TG
18test_set_index_version 3
19
44a36913
NTND
20cat >expect.full <<EOF
21H 1
22H 2
23H sub/1
24H sub/2
25EOF
26
27cat >expect.skip <<EOF
28S 1
29H 2
30S sub/1
31H sub/2
32EOF
33
34test_expect_success 'setup' '
35 mkdir sub &&
36 touch ./1 ./2 sub/1 sub/2 &&
37 git add 1 2 sub/1 sub/2 &&
38 git ls-files -t | test_cmp expect.full -
39'
40
41test_expect_success 'index is at version 2' '
83708f80 42 test "$(git update-index --show-index-version)" = 2
44a36913
NTND
43'
44
45test_expect_success 'update-index --skip-worktree' '
46 git update-index --skip-worktree 1 sub/1 &&
47 git ls-files -t | test_cmp expect.skip -
48'
49
50test_expect_success 'index is at version 3 after having some skip-worktree entries' '
83708f80 51 test "$(git update-index --show-index-version)" = 3
44a36913
NTND
52'
53
54test_expect_success 'ls-files -t' '
55 git ls-files -t | test_cmp expect.skip -
56'
57
58test_expect_success 'update-index --no-skip-worktree' '
59 git update-index --no-skip-worktree 1 sub/1 &&
60 git ls-files -t | test_cmp expect.full -
61'
62
63test_expect_success 'index version is back to 2 when there is no skip-worktree entry' '
83708f80 64 test "$(git update-index --show-index-version)" = 2
44a36913
NTND
65'
66
67test_done