Skip to content
This repository was archived by the owner on Nov 9, 2017. It is now read-only.

Commit ce7c614

Browse files
pcloudsgitster
authored andcommitted
split-index: do not invalidate cache-tree at read time
We are sure that after merge_base_index() is done. cache-tree can still be used with the final index. So don't destroy cache tree. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 76b07b3 commit ce7c614

File tree

3 files changed

+4
-1
lines changed

3 files changed

+4
-1
lines changed

cache.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -488,6 +488,7 @@ extern int index_name_pos(const struct index_state *, const char *name, int name
488488
#define ADD_CACHE_SKIP_DFCHECK 4 /* Ok to skip DF conflict checks */
489489
#define ADD_CACHE_JUST_APPEND 8 /* Append only; tree.c::read_tree() */
490490
#define ADD_CACHE_NEW_ONLY 16 /* Do not replace existing ones */
491+
#define ADD_CACHE_KEEP_CACHE_TREE 32 /* Do not invalidate cache-tree */
491492
extern int add_index_entry(struct index_state *, struct cache_entry *ce, int option);
492493
extern void rename_index_entry_at(struct index_state *, int pos, const char *new_name);
493494
extern int remove_index_entry_at(struct index_state *, int pos);

read-cache.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -950,7 +950,8 @@ static int add_index_entry_with_check(struct index_state *istate, struct cache_e
950950
int skip_df_check = option & ADD_CACHE_SKIP_DFCHECK;
951951
int new_only = option & ADD_CACHE_NEW_ONLY;
952952

953-
cache_tree_invalidate_path(istate, ce->name);
953+
if (!(option & ADD_CACHE_KEEP_CACHE_TREE))
954+
cache_tree_invalidate_path(istate, ce->name);
954955
pos = index_name_stage_pos(istate, ce->name, ce_namelen(ce), ce_stage(ce));
955956

956957
/* existing match? Just replace it. */

split-index.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ void merge_base_index(struct index_state *istate)
133133
for (i = si->nr_replacements; i < si->saved_cache_nr; i++) {
134134
add_index_entry(istate, si->saved_cache[i],
135135
ADD_CACHE_OK_TO_ADD |
136+
ADD_CACHE_KEEP_CACHE_TREE |
136137
/*
137138
* we may have to replay what
138139
* merge-recursive.c:update_stages()

0 commit comments

Comments
 (0)