summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorLibravatar David Turner <dturner@twopensource.com>2015-08-27 13:07:54 -0400
committerLibravatar Junio C Hamano <gitster@pobox.com>2015-08-31 08:41:07 -0700
commit475a34451f86d1b954c5da37f04ed044544cf6e4 (patch)
tree4e41cc4a71da24cfd4a40260b05d2f45b8949299 /t
parentMerge branch 'jk/guess-repo-name-regression-fix' into maint (diff)
downloadtgif-475a34451f86d1b954c5da37f04ed044544cf6e4.tar.xz
commit: don't rewrite shared index unnecessarily
Remove a cache invalidation which would cause the shared index to be rewritten on as-is commits. When the cache-tree has changed, we need to update it. But we don't necessarily need to update the shared index. So setting active_cache_changed to SOMETHING_CHANGED is unnecessary. Instead, we let update_main_cache_tree just update the CACHE_TREE_CHANGED bit. In order to test this, make test-dump-split-index not segfault on missing replace_bitmap/delete_bitmap. This new codepath is not called now that the test passes, but is necessary to avoid a segfault when the new test is run with the old builtin/commit.c code. Signed-off-by: David Turner <dturner@twopensource.com> Acked-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rwxr-xr-xt/t0090-cache-tree.sh10
1 files changed, 10 insertions, 0 deletions
diff --git a/t/t0090-cache-tree.sh b/t/t0090-cache-tree.sh
index 601d02d71f..f92dd1f1dc 100755
--- a/t/t0090-cache-tree.sh
+++ b/t/t0090-cache-tree.sh
@@ -218,4 +218,14 @@ test_expect_success 'no phantom error when switching trees' '
! test -s errors
'
+test_expect_success 'switching trees does not invalidate shared index' '
+ git update-index --split-index &&
+ >split &&
+ git add split &&
+ test-dump-split-index .git/index | grep -v ^own >before &&
+ git commit -m "as-is" &&
+ test-dump-split-index .git/index | grep -v ^own >after &&
+ test_cmp before after
+'
+
test_done