Add shortcut in refresh_cache_ent() for marked entries.
When a cache entry has been marked as CE_VALID, the user has promised us that any change in the work tree does not matter. Just mark the entry as up-to-date, and continue. Signed-off-by: Marius Storm-Olsen <marius@trolltech.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Marius Storm-Olsen committed
May 30, 2008 at 14:38 UTC
aa9349d449bbf6bd7d28a5279f30a9734f77da8f
1 file changed
+9
read-cache.c
+9
@@ -893,6 +893,15 @@ static struct cache_entry *refresh_cache_ent(struct index_state *istate,
893
if (ce_uptodate(ce))
894
return ce;
895
896
+ /*
897
+ * CE_VALID means the user promised us that the change to
898
+ * the work tree does not matter and told us not to worry.
899
+ */
900
+ if (!ignore_valid && (ce->ce_flags & CE_VALID)) {
901
+ ce_mark_uptodate(ce);
902
+ return ce;
903
+ }
904
+
905
if (lstat(ce->name, &st) < 0) {
906
if (err)
907
*err = errno;