aboutsummaryrefslogtreecommitdiff
path: root/cache.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-02-22 20:39:21 -0800
committerJunio C Hamano <gitster@pobox.com>2008-02-22 21:24:47 -0800
commitd070e3a31bf94de1ef503b155a5e028545f7decc (patch)
treea394ab813127f35832d04fd05c462f651e6d6310 /cache.h
parenta22c637124a2f591382d56546136a8e2bb2c2c66 (diff)
downloadgit-d070e3a31bf94de1ef503b155a5e028545f7decc.tar.gz
git-d070e3a31bf94de1ef503b155a5e028545f7decc.tar.xz
Name hash fixups: export (and rename) remove_hash_entry
This makes the name hash removal function (which really just sets the bit that disables lookups of it) available to external routines, and makes read_cache_unmerged() use it when it drops an unmerged entry from the index. It's renamed to remove_index_entry(), and we drop the (unused) 'istate' argument. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'cache.h')
-rw-r--r--cache.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/cache.h b/cache.h
index 0b69c92da..88d3b92d2 100644
--- a/cache.h
+++ b/cache.h
@@ -137,6 +137,20 @@ struct cache_entry {
#define CE_HASHED (0x100000)
#define CE_UNHASHED (0x200000)
+/*
+ * We don't actually *remove* it, we can just mark it invalid so that
+ * we won't find it in lookups.
+ *
+ * Not only would we have to search the lists (simple enough), but
+ * we'd also have to rehash other hash buckets in case this makes the
+ * hash bucket empty (common). So it's much better to just mark
+ * it.
+ */
+static inline void remove_index_entry(struct cache_entry *ce)
+{
+ ce->ce_flags |= CE_UNHASHED;
+}
+
static inline unsigned create_ce_flags(size_t len, unsigned stage)
{
if (len >= CE_NAMEMASK)