summaryrefslogtreecommitdiff
path: root/read-cache.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-02-23 04:39:21 (GMT)
committerJunio C Hamano <gitster@pobox.com>2008-02-23 05:24:47 (GMT)
commitd070e3a31bf94de1ef503b155a5e028545f7decc (patch)
treea394ab813127f35832d04fd05c462f651e6d6310 /read-cache.c
parenta22c637124a2f591382d56546136a8e2bb2c2c66 (diff)
downloadgit-d070e3a31bf94de1ef503b155a5e028545f7decc.zip
git-d070e3a31bf94de1ef503b155a5e028545f7decc.tar.gz
git-d070e3a31bf94de1ef503b155a5e028545f7decc.tar.bz2
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 'read-cache.c')
-rw-r--r--read-cache.c18
1 files changed, 2 insertions, 16 deletions
diff --git a/read-cache.c b/read-cache.c
index eb58b03..fee0c80 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -70,25 +70,11 @@ static void set_index_entry(struct index_state *istate, int nr, struct cache_ent
hash_index_entry(istate, ce);
}
-/*
- * 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 void remove_hash_entry(struct index_state *istate, struct cache_entry *ce)
-{
- ce->ce_flags |= CE_UNHASHED;
-}
-
static void replace_index_entry(struct index_state *istate, int nr, struct cache_entry *ce)
{
struct cache_entry *old = istate->cache[nr];
- remove_hash_entry(istate, old);
+ remove_index_entry(old);
set_index_entry(istate, nr, ce);
istate->cache_changed = 1;
}
@@ -417,7 +403,7 @@ int remove_index_entry_at(struct index_state *istate, int pos)
{
struct cache_entry *ce = istate->cache[pos];
- remove_hash_entry(istate, ce);
+ remove_index_entry(ce);
istate->cache_changed = 1;
istate->cache_nr--;
if (pos >= istate->cache_nr)