aboutsummaryrefslogtreecommitdiff
path: root/read-cache.c
diff options
context:
space:
mode:
authorMarius Storm-Olsen <marius@trolltech.com>2008-05-30 14:38:35 +0200
committerJunio C Hamano <gitster@pobox.com>2008-05-31 14:18:20 -0700
commitaa9349d449bbf6bd7d28a5279f30a9734f77da8f (patch)
treef37b6bd112618d9e7a0beb72db44cd29b2107902 /read-cache.c
parentb7f685a754fc7ad313ecf7ad717f3ce35195ff33 (diff)
downloadgit-aa9349d449bbf6bd7d28a5279f30a9734f77da8f.tar.gz
git-aa9349d449bbf6bd7d28a5279f30a9734f77da8f.tar.xz
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>
Diffstat (limited to 'read-cache.c')
-rw-r--r--read-cache.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/read-cache.c b/read-cache.c
index ac9a8e7e3..8e5fbb619 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -893,6 +893,15 @@ static struct cache_entry *refresh_cache_ent(struct index_state *istate,
if (ce_uptodate(ce))
return ce;
+ /*
+ * CE_VALID means the user promised us that the change to
+ * the work tree does not matter and told us not to worry.
+ */
+ if (!ignore_valid && (ce->ce_flags & CE_VALID)) {
+ ce_mark_uptodate(ce);
+ return ce;
+ }
+
if (lstat(ce->name, &st) < 0) {
if (err)
*err = errno;