summaryrefslogtreecommitdiff
path: root/diff-lib.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2008-03-30 12:39:25 -0700
committerJunio C Hamano <gitster@pobox.com>2008-04-12 19:42:17 -0700
commit8fa29602d4cf8c9ec7d837f7308a9582a8372cb5 (patch)
tree794186bba2552074ac6e912f8cbdc82bc6b08bee /diff-lib.c
parente06c43c7959042e5612984b8193700f32f12b2be (diff)
downloadgit-8fa29602d4cf8c9ec7d837f7308a9582a8372cb5.tar.gz
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>
Diffstat (limited to 'diff-lib.c')
-rw-r--r--diff-lib.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/diff-lib.c b/diff-lib.c
index 069e4507ae..6e7ab29e34 100644
--- a/diff-lib.c
+++ b/diff-lib.c
@@ -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,