Skip to content

Commit 867fa20

Browse files
committed
Merge branch 'jc/lstat'
* jc/lstat: diff-files: mark an index entry we know is up-to-date as such write_index(): optimize ce_smudge_racily_clean_entry() calls with CE_UPTODATE
2 parents e9dd751 + 8fa2960 commit 867fa20

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

diff-lib.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -479,8 +479,11 @@ int run_diff_files(struct rev_info *revs, unsigned int option)
479479
continue;
480480
}
481481
changed = ce_match_stat(ce, &st, ce_option);
482-
if (!changed && !DIFF_OPT_TST(&revs->diffopt, FIND_COPIES_HARDER))
483-
continue;
482+
if (!changed) {
483+
ce_mark_uptodate(ce);
484+
if (!DIFF_OPT_TST(&revs->diffopt, FIND_COPIES_HARDER))
485+
continue;
486+
}
484487
oldmode = ce->ce_mode;
485488
newmode = ce_mode_from_stat(ce, st.st_mode);
486489
diff_change(&revs->diffopt, oldmode, newmode,

read-cache.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1370,7 +1370,7 @@ int write_index(const struct index_state *istate, int newfd)
13701370
struct cache_entry *ce = cache[i];
13711371
if (ce->ce_flags & CE_REMOVE)
13721372
continue;
1373-
if (is_racy_timestamp(istate, ce))
1373+
if (!ce_uptodate(ce) && is_racy_timestamp(istate, ce))
13741374
ce_smudge_racily_clean_entry(ce);
13751375
if (ce_write_entry(&c, newfd, ce) < 0)
13761376
return -1;

0 commit comments

Comments
 (0)