Skip to content

Commit 8fa2960

Browse files
committed
diff-files: mark an index entry we know is up-to-date as such
This does not make any difference when running diff-files alone, but if you internally run run_diff_files() and then run other operations further on the index, we do not have to run lstat(2) again on entries we already have checked. Signed-off-by: Junio C Hamano <[email protected]>
1 parent e06c43c commit 8fa2960

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

diff-lib.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -476,8 +476,11 @@ int run_diff_files(struct rev_info *revs, unsigned int option)
476476
continue;
477477
}
478478
changed = ce_match_stat(ce, &st, ce_option);
479-
if (!changed && !DIFF_OPT_TST(&revs->diffopt, FIND_COPIES_HARDER))
480-
continue;
479+
if (!changed) {
480+
ce_mark_uptodate(ce);
481+
if (!DIFF_OPT_TST(&revs->diffopt, FIND_COPIES_HARDER))
482+
continue;
483+
}
481484
oldmode = ce->ce_mode;
482485
newmode = ce_mode_from_stat(ce, st.st_mode);
483486
diff_change(&revs->diffopt, oldmode, newmode,

0 commit comments

Comments
 (0)