summaryrefslogtreecommitdiff
path: root/unpack-trees.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2008-03-21 22:53:00 (GMT)
committerJunio C Hamano <gitster@pobox.com>2008-04-09 08:22:25 (GMT)
commitdf292c791ab790340cc9e3577a073bcb9d1900ea (patch)
treed3f1995f5d8c7c46779bd071703eb8ea6a46e3ed /unpack-trees.c
parent96872bc200c41407607019c1f0fb005840f576a2 (diff)
downloadgit-df292c791ab790340cc9e3577a073bcb9d1900ea.zip
git-df292c791ab790340cc9e3577a073bcb9d1900ea.tar.gz
git-df292c791ab790340cc9e3577a073bcb9d1900ea.tar.bz2
Make "index_name_exists()" return the cache_entry it found
This allows verify_absent() in unpack_trees() to use the hash chains rather than looking it up using the binary search. Perhaps more importantly, it's also going to be useful for the next phase, where we actually start looking at the cache entry when we do case-insensitive lookups and checking the result. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'unpack-trees.c')
-rw-r--r--unpack-trees.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/unpack-trees.c b/unpack-trees.c
index a59f475..ca4c845 100644
--- a/unpack-trees.c
+++ b/unpack-trees.c
@@ -538,6 +538,7 @@ static int verify_absent(struct cache_entry *ce, const char *action,
if (!lstat(ce->name, &st)) {
int cnt;
int dtype = ce_to_dtype(ce);
+ struct cache_entry *result;
if (o->dir && excluded(o->dir, ce->name, &dtype))
/*
@@ -581,10 +582,9 @@ static int verify_absent(struct cache_entry *ce, const char *action,
* delete this path, which is in a subdirectory that
* is being replaced with a blob.
*/
- cnt = index_name_pos(&o->result, ce->name, strlen(ce->name));
- if (0 <= cnt) {
- struct cache_entry *ce = o->result.cache[cnt];
- if (ce->ce_flags & CE_REMOVE)
+ result = index_name_exists(&o->result, ce->name, ce_namelen(ce));
+ if (result) {
+ if (result->ce_flags & CE_REMOVE)
return 0;
}