aboutsummaryrefslogtreecommitdiff
path: root/read-cache.c
diff options
context:
space:
mode:
authorJunio C Hamano <junkio@cox.net>2006-08-27 20:18:58 -0700
committerJunio C Hamano <junkio@cox.net>2006-08-27 20:33:46 -0700
commit1e49cb8ad44cfb926b719061fa41f42e62291560 (patch)
tree97fd2f10f3bccb9d3b47de025f48ad15cfa2e922 /read-cache.c
parentd5d0a0e748025bf253db5f0cde7b22cb0feeced2 (diff)
parenteed94a570e0421175d6b4342c0ac48e03ceedf0b (diff)
downloadgit-1e49cb8ad44cfb926b719061fa41f42e62291560.tar.gz
git-1e49cb8ad44cfb926b719061fa41f42e62291560.tar.xz
Merge branch 'js/c-merge-recursive'
* js/c-merge-recursive: (21 commits) discard_cache(): discard index, even if no file was mmap()ed merge-recur: do not die unnecessarily merge-recur: try to merge older merge bases first merge-recur: if there is no common ancestor, fake empty one merge-recur: do not setenv("GIT_INDEX_FILE") merge-recur: do not call git-write-tree merge-recursive: fix rename handling .gitignore: git-merge-recur is a built file. merge-recur: virtual commits shall never be parsed merge-recur: use the unpack_trees() interface instead of exec()ing read-tree merge-recur: fix thinko in unique_path() Makefile: git-merge-recur depends on xdiff libraries. merge-recur: Explain why sha_eq() and struct stage_data cannot go merge-recur: Cleanup last mixedCase variables... merge-recur: Fix compiler warning with -pedantic merge-recur: Remove dead code merge-recur: Get rid of debug code merge-recur: Convert variable names to lower_case Cumulative update of merge-recursive in C recur vs recursive: help testing without touching too many stuff. ... This is an evil merge that removes TEST script from the toplevel.
Diffstat (limited to 'read-cache.c')
-rw-r--r--read-cache.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/read-cache.c b/read-cache.c
index b6982eac4..20c9d494a 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -842,6 +842,23 @@ unmap:
die("index file corrupt");
}
+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;
+
+ /* no need to throw away allocated active_cache */
+ return ret;
+}
+
#define WRITE_BUFFER_SIZE 8192
static unsigned char write_buffer[WRITE_BUFFER_SIZE];
static unsigned long write_buffer_len;