@matheusbsbs / matheus-bagliano / commits / 8fa29602d4
Fork 0

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 <gitster@pobox.com>

Junio C Hamano committed Mar 30, 2008 at 12:39 UTC 8fa29602d4cf8c9ec7d837f7308a9582a8372cb5
1 file changed +5 -2
diff-lib.c
+5 -2
@@ -476,8 +476,11 @@ int run_diff_files(struct rev_info *revs, unsigned int option)
476 continue;
477 }
478 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 + }
484 oldmode = ce->ce_mode;
485 newmode = ce_mode_from_stat(ce, st.st_mode);
486 diff_change(&revs->diffopt, oldmode, newmode,