name-hash.c: remove cache entries instead of marking them CE_UNHASHED
The new hashmap implementation supports remove, so really remove unused cache entries from the name hashmap instead of just marking them. The CE_UNHASHED flag and CE_STATE_MASK are no longer needed. Keep the CE_HASHED flag to prevent adding entries twice. Signed-off-by: Karsten Blees <blees@dcon.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
8b013788a1
commit
419a597f64
6
cache.h
6
cache.h
@ -160,7 +160,6 @@ struct cache_entry {
|
||||
#define CE_ADDED (1 << 19)
|
||||
|
||||
#define CE_HASHED (1 << 20)
|
||||
#define CE_UNHASHED (1 << 21)
|
||||
#define CE_WT_REMOVE (1 << 22) /* remove in work directory */
|
||||
#define CE_CONFLICTED (1 << 23)
|
||||
|
||||
@ -196,11 +195,10 @@ struct pathspec;
|
||||
* Copy the sha1 and stat state of a cache entry from one to
|
||||
* another. But we never change the name, or the hash state!
|
||||
*/
|
||||
#define CE_STATE_MASK (CE_HASHED | CE_UNHASHED)
|
||||
static inline void copy_cache_entry(struct cache_entry *dst,
|
||||
const struct cache_entry *src)
|
||||
{
|
||||
unsigned int state = dst->ce_flags & CE_STATE_MASK;
|
||||
unsigned int state = dst->ce_flags & CE_HASHED;
|
||||
|
||||
/* Don't copy hash chain and name */
|
||||
memcpy(&dst->ce_stat_data, &src->ce_stat_data,
|
||||
@ -208,7 +206,7 @@ static inline void copy_cache_entry(struct cache_entry *dst,
|
||||
offsetof(struct cache_entry, ce_stat_data));
|
||||
|
||||
/* Restore the hash state */
|
||||
dst->ce_flags = (dst->ce_flags & ~CE_STATE_MASK) | state;
|
||||
dst->ce_flags = (dst->ce_flags & ~CE_HASHED) | state;
|
||||
}
|
||||
|
||||
static inline unsigned create_ce_flags(unsigned stage)
|
||||
|
Reference in New Issue
Block a user