@@ -312,49 +312,40 @@ static void show_files(struct repository *repo, struct dir_struct *dir)
312
312
if (show_killed )
313
313
show_killed_files (repo -> index , dir );
314
314
}
315
- if (show_cached || show_stage ) {
316
- for (i = 0 ; i < repo -> index -> cache_nr ; i ++ ) {
317
- const struct cache_entry * ce = repo -> index -> cache [i ];
318
315
319
- construct_fullname (& fullname , repo , ce );
316
+ if (!(show_cached || show_stage || show_deleted || show_modified ))
317
+ return ;
318
+ for (i = 0 ; i < repo -> index -> cache_nr ; i ++ ) {
319
+ const struct cache_entry * ce = repo -> index -> cache [i ];
320
+ struct stat st ;
321
+ int stat_err ;
320
322
321
- if ((dir -> flags & DIR_SHOW_IGNORED ) &&
322
- !ce_excluded (dir , repo -> index , fullname .buf , ce ))
323
- continue ;
324
- if (show_unmerged && !ce_stage (ce ))
325
- continue ;
326
- if (ce -> ce_flags & CE_UPDATE )
327
- continue ;
323
+ construct_fullname (& fullname , repo , ce );
324
+
325
+ if ((dir -> flags & DIR_SHOW_IGNORED ) &&
326
+ !ce_excluded (dir , repo -> index , fullname .buf , ce ))
327
+ continue ;
328
+ if (ce -> ce_flags & CE_UPDATE )
329
+ continue ;
330
+ if ((show_cached || show_stage ) &&
331
+ (!show_unmerged || ce_stage (ce )))
328
332
show_ce (repo , dir , ce , fullname .buf ,
329
333
ce_stage (ce ) ? tag_unmerged :
330
334
(ce_skip_worktree (ce ) ? tag_skip_worktree :
331
335
tag_cached ));
332
- }
333
- }
334
- if (show_deleted || show_modified ) {
335
- for (i = 0 ; i < repo -> index -> cache_nr ; i ++ ) {
336
- const struct cache_entry * ce = repo -> index -> cache [i ];
337
- struct stat st ;
338
- int stat_err ;
339
-
340
- construct_fullname (& fullname , repo , ce );
341
336
342
- if ((dir -> flags & DIR_SHOW_IGNORED ) &&
343
- !ce_excluded (dir , repo -> index , fullname .buf , ce ))
344
- continue ;
345
- if (ce -> ce_flags & CE_UPDATE )
346
- continue ;
347
- if (ce_skip_worktree (ce ))
348
- continue ;
349
- stat_err = lstat (fullname .buf , & st );
350
- if (stat_err && (errno != ENOENT && errno != ENOTDIR ))
351
- error_errno ("cannot lstat '%s'" , fullname .buf );
352
- if (stat_err && show_deleted )
353
- show_ce (repo , dir , ce , fullname .buf , tag_removed );
354
- if (show_modified &&
355
- (stat_err || ie_modified (repo -> index , ce , & st , 0 )))
356
- show_ce (repo , dir , ce , fullname .buf , tag_modified );
357
- }
337
+ if (!(show_deleted || show_modified ))
338
+ continue ;
339
+ if (ce_skip_worktree (ce ))
340
+ continue ;
341
+ stat_err = lstat (fullname .buf , & st );
342
+ if (stat_err && (errno != ENOENT && errno != ENOTDIR ))
343
+ error_errno ("cannot lstat '%s'" , fullname .buf );
344
+ if (stat_err && show_deleted )
345
+ show_ce (repo , dir , ce , fullname .buf , tag_removed );
346
+ if (show_modified &&
347
+ (stat_err || ie_modified (repo -> index , ce , & st , 0 )))
348
+ show_ce (repo , dir , ce , fullname .buf , tag_modified );
358
349
}
359
350
360
351
strbuf_release (& fullname );
0 commit comments