3 test_description
="Test whether cache-tree is properly updated
5 Tests whether various commands properly update and/or rewrite the
11 test-dump-cache-tree
>actual
&&
12 sed "s/$_x40/SHA/" <actual
>filtered
&&
13 test_cmp
"$1" filtered
16 # We don't bother with actually checking the SHA1:
17 # test-dump-cache-tree already verifies that all existing data is
19 test_shallow_cache_tree
() {
21 "($(git ls-files|wc -l) entries, 0 subtrees)" >expect
&&
25 test_invalid_cache_tree
() {
26 echo "invalid (0 subtrees)" >expect
&&
28 "($(git ls-files|wc -l) entries, 0 subtrees)" >>expect
&&
32 test_no_cache_tree
() {
37 test_expect_failure
'initial commit has cache-tree' '
39 test_shallow_cache_tree
42 test_expect_success
'read-tree HEAD establishes cache-tree' '
44 test_shallow_cache_tree
47 test_expect_success
'git-add invalidates cache-tree' '
48 test_when_finished "git reset --hard; git read-tree HEAD" &&
49 echo "I changed this file" > foo &&
51 test_invalid_cache_tree
54 test_expect_success
'update-index invalidates cache-tree' '
55 test_when_finished "git reset --hard; git read-tree HEAD" &&
56 echo "I changed this file" > foo &&
57 git update-index --add foo &&
58 test_invalid_cache_tree
61 test_expect_success
'write-tree establishes cache-tree' '
62 test-scrap-cache-tree &&
64 test_shallow_cache_tree
67 test_expect_success
'test-scrap-cache-tree works' '
69 test-scrap-cache-tree &&
73 test_expect_failure
'second commit has cache-tree' '
75 test_shallow_cache_tree
78 test_expect_failure
'reset --hard gives cache-tree' '
79 test-scrap-cache-tree &&
81 test_shallow_cache_tree
84 test_expect_failure
'reset --hard without index gives cache-tree' '
87 test_shallow_cache_tree
90 test_expect_failure
'checkout gives cache-tree' '
92 test_shallow_cache_tree