[PATCH 3/3] Add shortcut in refresh_cache_ent() for marked entries.
- From
Marius Storm-Olsen <marius@trolltech.com>
- Date
- May 30, 2008, 12:38 UTC
- Message-ID
- <c581c03d8d8bfc76753018d4399a79b02a057186.1212152269.git.marius@trolltech.com>
- In-Reply-To
- <3088e5a9507aa55ee55f512fb3bd554f1658d2e3.1212152269.git.marius@trolltech.com>
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.
Done-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Marius Storm-Olsen <marius@trolltech.com> --- read-cache.c | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/read-cache.c b/read-cache.c index ac9a8e7..8e5fbb6 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;
-- 1.5.5.GIT