mirror of
https://github.com/git/git
synced 2024-08-24 18:26:02 +00:00
Merge branch 'dt/commit-preserve-base-index-upon-opportunistic-cache-tree-update'
When re-priming the cache-tree opportunistically while committing the in-core index as-is, we mistakenly invalidated the in-core index too aggressively, causing the experimental split-index code to unnecessarily rewrite the on-disk index file(s). * dt/commit-preserve-base-index-upon-opportunistic-cache-tree-update: commit: don't rewrite shared index unnecessarily
This commit is contained in:
commit
81d0e33a22
|
@ -405,10 +405,8 @@ static const char *prepare_index(int argc, const char **argv, const char *prefix
|
|||
hold_locked_index(&index_lock, 1);
|
||||
refresh_cache_or_die(refresh_flags);
|
||||
if (active_cache_changed
|
||||
|| !cache_tree_fully_valid(active_cache_tree)) {
|
||||
|| !cache_tree_fully_valid(active_cache_tree))
|
||||
update_main_cache_tree(WRITE_TREE_SILENT);
|
||||
active_cache_changed = 1;
|
||||
}
|
||||
if (active_cache_changed) {
|
||||
if (write_locked_index(&the_index, &index_lock,
|
||||
COMMIT_LOCK))
|
||||
|
|
|
@ -242,4 +242,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
|
||||
|
|
|
@ -26,9 +26,11 @@ int main(int ac, char **av)
|
|||
sha1_to_hex(ce->sha1), ce_stage(ce), ce->name);
|
||||
}
|
||||
printf("replacements:");
|
||||
ewah_each_bit(si->replace_bitmap, show_bit, NULL);
|
||||
if (si->replace_bitmap)
|
||||
ewah_each_bit(si->replace_bitmap, show_bit, NULL);
|
||||
printf("\ndeletions:");
|
||||
ewah_each_bit(si->delete_bitmap, show_bit, NULL);
|
||||
if (si->delete_bitmap)
|
||||
ewah_each_bit(si->delete_bitmap, show_bit, NULL);
|
||||
printf("\n");
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue