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

[PATCH] discard_cache(): discard index, even if no file was mmap()ed

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Aug 10, 2006, 14:47 UTC
Message-ID
<Pine.LNX.4.63.0608101645590.10541@wbgn013.biozentrum.uni-wuerzburg.de>

Since add_cacheinfo() can be called without a mapped index file, discard_cache() _has_ to discard the entries, even when cache_mmap == NULL.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
	This fixes 41094b8e, the only showstopper I wrote
	about in my last -recur status report. The index file is
	now the same for -recur and -recursive when trying to recreate 
	41094b8e.
	Happy.
 read-cache.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/read-cache.c b/read-cache.c
index de8f690..3559bdc 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -841,14 +841,14 @@ int discard_cache()
 {
 	int ret;
 
+	active_nr = active_cache_changed = 0;
+	index_file_timestamp = 0;
+	cache_tree_free(&active_cache_tree);
 	if (cache_mmap == NULL)
 		return 0;
 	ret = munmap(cache_mmap, cache_mmap_size);
 	cache_mmap = NULL;
 	cache_mmap_size = 0;
-	active_nr = active_cache_changed = 0;
-	index_file_timestamp = 0;
-	cache_tree_free(&active_cache_tree);
 
 	/* no need to throw away allocated active_cache */
 	return ret;
-- 
1.4.2.rc4.g0d295-dirty
Message 1 of 1 in “discard_cache(): discard index, even if no file was mmap()ed”
  1. discard_cache(): discard index, even if no file was mmap()edJohannes Schindelin, Aug 10, 2006

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.