@@ -242,7 +242,7 @@ static int add_path_to_index(const struct object_id *oid,
242242 size_t len = base -> len ;
243243
244244 if (S_ISDIR (mode )) {
245- int dtype ;
245+ int dtype = DT_DIR ;
246246 size_t baselen = base -> len ;
247247 if (!ctx -> pl )
248248 return READ_TREE_RECURSIVE ;
@@ -360,7 +360,7 @@ void expand_index(struct index_state *istate, struct pattern_list *pl)
360360 struct cache_entry * ce = istate -> cache [i ];
361361 struct tree * tree ;
362362 struct pathspec ps ;
363- int dtype ;
363+ int dtype = DT_UNKNOWN ;
364364
365365 if (!S_ISSPARSEDIR (ce -> ce_mode )) {
366366 set_index_entry (full , full -> cache_nr ++ , ce );
@@ -371,7 +371,7 @@ void expand_index(struct index_state *istate, struct pattern_list *pl)
371371 if (pl &&
372372 path_matches_pattern_list (ce -> name , ce -> ce_namelen ,
373373 NULL , & dtype ,
374- pl , istate ) == NOT_MATCHED ) {
374+ pl , full ) == NOT_MATCHED ) {
375375 set_index_entry (full , full -> cache_nr ++ , ce );
376376 continue ;
377377 }
@@ -399,6 +399,7 @@ void expand_index(struct index_state *istate, struct pattern_list *pl)
399399 }
400400
401401 /* Copy back into original index. */
402+ istate -> name_hash_initialized = full -> name_hash_initialized ;
402403 memcpy (& istate -> name_hash , & full -> name_hash , sizeof (full -> name_hash ));
403404 memcpy (& istate -> dir_hash , & full -> dir_hash , sizeof (full -> dir_hash ));
404405 istate -> sparse_index = pl ? INDEX_PARTIALLY_SPARSE : INDEX_EXPANDED ;
0 commit comments