[PATCH 16/22] teach apply.c to use cache_find_name()
Signed-off-by: Chuck Lever <cel@netapp.com>
---
apply.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/apply.c b/apply.c
--- a/apply.c
+++ b/apply.c
@@ -1021,10 +1021,10 @@ static int check_patch(struct patch *pat
if (lstat(old_name, &st) < 0)
return error("%s: %s", old_name, strerror(errno));
if (check_index) {
- int pos = cache_name_pos(old_name, strlen(old_name));
- if (pos < 0)
+ struct cache_entry *ce;
+ if (!cache_find_entry(old_name, strlen(old_name), &ce))
return error("%s: does not exist in index", old_name);
- changed = ce_match_stat(active_cache[pos], &st);
+ changed = ce_match_stat(ce, &st);
if (changed)
return error("%s: does not match index", old_name);
}
@@ -1041,7 +1041,7 @@ static int check_patch(struct patch *pat
}
if (new_name && (patch->is_new | patch->is_rename | patch->is_copy)) {
- if (check_index && cache_name_pos(new_name, strlen(new_name)) >= 0)
+ if (check_index && cache_find_entry(new_name, strlen(new_name), NULL))
return error("%s: already exists in index", new_name);
if (!lstat(new_name, &st))
return error("%s: already exists in working directory", new_name);