@@ -242,7 +242,7 @@ static int add_path_to_index(const struct object_id *oid,
242
242
size_t len = base -> len ;
243
243
244
244
if (S_ISDIR (mode )) {
245
- int dtype ;
245
+ int dtype = DT_DIR ;
246
246
size_t baselen = base -> len ;
247
247
if (!ctx -> pl )
248
248
return READ_TREE_RECURSIVE ;
@@ -360,7 +360,7 @@ void expand_index(struct index_state *istate, struct pattern_list *pl)
360
360
struct cache_entry * ce = istate -> cache [i ];
361
361
struct tree * tree ;
362
362
struct pathspec ps ;
363
- int dtype ;
363
+ int dtype = DT_UNKNOWN ;
364
364
365
365
if (!S_ISSPARSEDIR (ce -> ce_mode )) {
366
366
set_index_entry (full , full -> cache_nr ++ , ce );
@@ -371,7 +371,7 @@ void expand_index(struct index_state *istate, struct pattern_list *pl)
371
371
if (pl &&
372
372
path_matches_pattern_list (ce -> name , ce -> ce_namelen ,
373
373
NULL , & dtype ,
374
- pl , istate ) == NOT_MATCHED ) {
374
+ pl , full ) == NOT_MATCHED ) {
375
375
set_index_entry (full , full -> cache_nr ++ , ce );
376
376
continue ;
377
377
}
@@ -399,6 +399,7 @@ void expand_index(struct index_state *istate, struct pattern_list *pl)
399
399
}
400
400
401
401
/* Copy back into original index. */
402
+ istate -> name_hash_initialized = full -> name_hash_initialized ;
402
403
memcpy (& istate -> name_hash , & full -> name_hash , sizeof (full -> name_hash ));
403
404
memcpy (& istate -> dir_hash , & full -> dir_hash , sizeof (full -> dir_hash ));
404
405
istate -> sparse_index = pl ? INDEX_PARTIALLY_SPARSE : INDEX_EXPANDED ;
0 commit comments