Skip to content

Commit

Permalink
diff-files: mark an index entry we know is up-to-date as such
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Junio C Hamano committed Apr 13, 2008
1 parent e06c43c commit 8fa2960
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions diff-lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -476,8 +476,11 @@ int run_diff_files(struct rev_info *revs, unsigned int option)
continue;
}
changed = ce_match_stat(ce, &st, ce_option);
if (!changed && !DIFF_OPT_TST(&revs->diffopt, FIND_COPIES_HARDER))
continue;
if (!changed) {
ce_mark_uptodate(ce);
if (!DIFF_OPT_TST(&revs->diffopt, FIND_COPIES_HARDER))
continue;
}
oldmode = ce->ce_mode;
newmode = ce_mode_from_stat(ce, st.st_mode);
diff_change(&revs->diffopt, oldmode, newmode,
Expand Down

0 comments on commit 8fa2960

Please sign in to comment.