aboutsummaryrefslogtreecommitdiff
path: root/t/t0090-cache-tree.sh
diff options
context:
space:
mode:
authorDavid Turner <dturner@twopensource.com>2014-07-05 21:06:56 -0700
committerJunio C Hamano <gitster@pobox.com>2014-07-07 12:30:34 -0700
commitaecf567cbfb6ab46e82f7f5df36fb6a2dd5bee69 (patch)
treebb7e31b4b9ebe4adb3a78a9f2012815658b17ca3 /t/t0090-cache-tree.sh
parentc2f7b1026e33e308782fcb1b60e3d7af107fdc18 (diff)
downloadgit-aecf567cbfb6ab46e82f7f5df36fb6a2dd5bee69.tar.gz
git-aecf567cbfb6ab46e82f7f5df36fb6a2dd5bee69.tar.xz
cache-tree: create/update cache-tree on checkout
When git checkout checks out a branch, create or update the cache-tree so that subsequent operations are faster. update_main_cache_tree learned a new flag, WRITE_TREE_REPAIR. When WRITE_TREE_REPAIR is set, portions of the cache-tree which do not correspond to existing tree objects are invalidated (and portions which do are marked as valid). No new tree objects are created. Signed-off-by: David Turner <dturner@twitter.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t0090-cache-tree.sh')
-rwxr-xr-xt/t0090-cache-tree.sh19
1 files changed, 16 insertions, 3 deletions
diff --git a/t/t0090-cache-tree.sh b/t/t0090-cache-tree.sh
index 6c33e28ee..98fb1ab6d 100755
--- a/t/t0090-cache-tree.sh
+++ b/t/t0090-cache-tree.sh
@@ -44,14 +44,14 @@ test_expect_success 'read-tree HEAD establishes cache-tree' '
test_expect_success 'git-add invalidates cache-tree' '
test_when_finished "git reset --hard; git read-tree HEAD" &&
- echo "I changed this file" > foo &&
+ echo "I changed this file" >foo &&
git add foo &&
test_invalid_cache_tree
'
test_expect_success 'update-index invalidates cache-tree' '
test_when_finished "git reset --hard; git read-tree HEAD" &&
- echo "I changed this file" > foo &&
+ echo "I changed this file" >foo &&
git update-index --add foo &&
test_invalid_cache_tree
'
@@ -85,9 +85,22 @@ test_expect_success 'reset --hard without index gives cache-tree' '
test_shallow_cache_tree
'
-test_expect_failure 'checkout gives cache-tree' '
+test_expect_success 'checkout gives cache-tree' '
+ git tag current &&
git checkout HEAD^ &&
test_shallow_cache_tree
'
+test_expect_success 'checkout -b gives cache-tree' '
+ git checkout current &&
+ git checkout -b prev HEAD^ &&
+ test_shallow_cache_tree
+'
+
+test_expect_success 'checkout -B gives cache-tree' '
+ git checkout current &&
+ git checkout -B prev HEAD^ &&
+ test_shallow_cache_tree
+'
+
test_done