]>
| 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 | ||
| 5b0a78c1 NTND |
10 | sane_unset GIT_TEST_SPLIT_INDEX |
| 11 | ||
| 762ccf99 | 12 | test_set_index_version () { |
| 40c45f80 JH |
13 | GIT_INDEX_VERSION="$1" |
| 14 | export GIT_INDEX_VERSION | |
| 762ccf99 ÆAB |
15 | } |
| 16 | ||
| 5d9fc888 TG |
17 | test_set_index_version 3 |
| 18 | ||
| 40c45f80 JH |
19 | test_expect_success 'setup' ' |
| 20 | cat >expect.full <<-\EOF && | |
| 21 | H 1 | |
| 22 | H 2 | |
| 23 | H sub/1 | |
| 24 | H sub/2 | |
| 25 | EOF | |
| 44a36913 | 26 | |
| 40c45f80 JH |
27 | cat >expect.skip <<-\EOF && |
| 28 | S 1 | |
| 29 | H 2 | |
| 30 | S sub/1 | |
| 31 | H sub/2 | |
| 32 | EOF | |
| 44a36913 | 33 | |
| 44a36913 NTND |
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 - | |
| 38 | ' | |
| 39 | ||
| 40 | test_expect_success 'index is at version 2' ' | |
| 83708f80 | 41 | test "$(git update-index --show-index-version)" = 2 |
| 44a36913 NTND |
42 | ' |
| 43 | ||
| 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 - | |
| 47 | ' | |
| 48 | ||
| 49 | test_expect_success 'index is at version 3 after having some skip-worktree entries' ' | |
| 83708f80 | 50 | test "$(git update-index --show-index-version)" = 3 |
| 44a36913 NTND |
51 | ' |
| 52 | ||
| 53 | test_expect_success 'ls-files -t' ' | |
| 54 | git ls-files -t | test_cmp expect.skip - | |
| 55 | ' | |
| 56 | ||
| 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 - | |
| 60 | ' | |
| 61 | ||
| 62 | test_expect_success 'index version is back to 2 when there is no skip-worktree entry' ' | |
| 83708f80 | 63 | test "$(git update-index --show-index-version)" = 2 |
| 44a36913 NTND |
64 | ' |
| 65 | ||
| 66 | test_done |