summaryrefslogtreecommitdiff
path: root/read-cache.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-05-06 16:48:43 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-05-06 16:48:43 -0700
commitee267527aa80807f37caf1d00bcf1b5263945adb (patch)
tree4176958cd88ae4187b85f1d6bc4b2dd40cd63f28 /read-cache.c
parenta02ebff6127c5fc981668fb570f0a80f2b7657ca (diff)
downloadgit-ee267527aa80807f37caf1d00bcf1b5263945adb.tar.gz
Revert bogus optimization that avoids index file writes
It didn't properly mark all cache updates as being dirty, and causes merge errors due to that. In particular, it didn't notice when a file was force-removed. Besides, it was ugly as hell. I've put in place a slightly cleaner version, but I've not enabled the optimization because I don't want to be burned again.
Diffstat (limited to 'read-cache.c')
-rw-r--r--read-cache.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/read-cache.c b/read-cache.c
index 2a88d18b16..6a04cf194c 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -7,7 +7,7 @@
#include "cache.h"
struct cache_entry **active_cache = NULL;
-unsigned int active_nr = 0, active_alloc = 0;
+unsigned int active_nr = 0, active_alloc = 0, active_cache_changed = 0;
int cache_match_stat(struct cache_entry *ce, struct stat *st)
{
@@ -99,6 +99,7 @@ int cache_name_pos(const char *name, int namelen)
/* Remove entry, return true if there are more entries to go.. */
int remove_entry_at(int pos)
{
+ active_cache_changed = 1;
active_nr--;
if (pos >= active_nr)
return 0;
@@ -130,6 +131,7 @@ int add_cache_entry(struct cache_entry *ce, int ok_to_add)
/* existing match? Just replace it */
if (pos >= 0) {
+ active_cache_changed = 1;
active_cache[pos] = ce;
return 0;
}
@@ -161,6 +163,7 @@ int add_cache_entry(struct cache_entry *ce, int ok_to_add)
if (active_nr > pos)
memmove(active_cache + pos + 1, active_cache + pos, (active_nr - pos - 1) * sizeof(ce));
active_cache[pos] = ce;
+ active_cache_changed = 1;
return 0;
}