aboutsummaryrefslogtreecommitdiff
path: root/read-cache.c
diff options
context:
space:
mode:
authorJohannes Schindelin <Johannes.Schindelin@gmx.de>2006-08-10 16:47:21 +0200
committerJunio C Hamano <junkio@cox.net>2006-08-10 14:30:01 -0700
commit4147d801db66df9b127ffe315601f467aa9d1c48 (patch)
treed5a401cef1dd931b32e58e622e6407816baf49b5 /read-cache.c
parent984b65707e25c426a32feb9b9d46f077b605cb31 (diff)
downloadgit-4147d801db66df9b127ffe315601f467aa9d1c48.tar.gz
git-4147d801db66df9b127ffe315601f467aa9d1c48.tar.xz
discard_cache(): discard index, even if no file was mmap()ed
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> Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'read-cache.c')
-rw-r--r--read-cache.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/read-cache.c b/read-cache.c
index c375e912a..fc2af2cb0 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -840,14 +840,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;