git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[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
Previous: Simon HausmannNext: Marius Storm-Olsen
Message 6 of 11 in “Ensure that commit/status don't stat all files when core.ignoreStat = true”
  1. Ensure that commit/status don't stat all files when core.ignoreStat = trueMarius Storm-Olsen, May 27, 2008
  2. Junio C HamanoMay 27, 2008
  3. Marius Storm-OlsenMay 27, 2008
  4. 1/3 Clearify the documentation for core.ignoreStatMarius Storm-Olsen, May 30, 2008
  5. 2/3 Introduce core.showUntrackedFiles to make it possible to disable showing of untracked files.Simon Hausmann, May 30, 2008
  6. 3/3 Add shortcut in refresh_cache_ent() for marked entries.Marius Storm-Olsen, May 30, 2008
  7. Marius Storm-OlsenMay 30, 2008
  8. Marius Storm-OlsenMay 30, 2008
  9. Marius Storm-OlsenMay 30, 2008
  10. Junio C HamanoMay 30, 2008
  11. Marius Storm-OlsenMay 31, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.