]> git.ipfire.org Git - thirdparty/git.git/blame - t/t2104-update-index-skip-worktree.sh
path.c: don't call the match function without value in trie_find()
[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
8. ./test-lib.sh
9
5b0a78c1
NTND
10sane_unset GIT_TEST_SPLIT_INDEX
11
5d9fc888
TG
12test_set_index_version 3
13
44a36913
NTND
14cat >expect.full <<EOF
15H 1
16H 2
17H sub/1
18H sub/2
19EOF
20
21cat >expect.skip <<EOF
22S 1
23H 2
24S sub/1
25H sub/2
26EOF
27
28test_expect_success 'setup' '
29 mkdir sub &&
30 touch ./1 ./2 sub/1 sub/2 &&
31 git add 1 2 sub/1 sub/2 &&
32 git ls-files -t | test_cmp expect.full -
33'
34
35test_expect_success 'index is at version 2' '
cc6f663d 36 test "$(test-tool index-version < .git/index)" = 2
44a36913
NTND
37'
38
39test_expect_success 'update-index --skip-worktree' '
40 git update-index --skip-worktree 1 sub/1 &&
41 git ls-files -t | test_cmp expect.skip -
42'
43
44test_expect_success 'index is at version 3 after having some skip-worktree entries' '
cc6f663d 45 test "$(test-tool index-version < .git/index)" = 3
44a36913
NTND
46'
47
48test_expect_success 'ls-files -t' '
49 git ls-files -t | test_cmp expect.skip -
50'
51
52test_expect_success 'update-index --no-skip-worktree' '
53 git update-index --no-skip-worktree 1 sub/1 &&
54 git ls-files -t | test_cmp expect.full -
55'
56
57test_expect_success 'index version is back to 2 when there is no skip-worktree entry' '
cc6f663d 58 test "$(test-tool index-version < .git/index)" = 2
44a36913
NTND
59'
60
61test_done