[PATCH 17/22] teach checkout-index.c to use cache_find_name()
Signed-off-by: Chuck Lever <cel@netapp.com>
---
checkout-index.c | 11 +++++------
1 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/checkout-index.c b/checkout-index.c
--- a/checkout-index.c
+++ b/checkout-index.c
@@ -45,20 +45,19 @@ static struct checkout state = {
static int checkout_file(const char *name)
{
- int pos = cache_name_pos(name, strlen(name));
- if (pos < 0) {
+ struct cache_entry *ce;
+
+ if (!cache_find_entry(name, strlen(name), &ce)) {
if (!state.quiet) {
- pos = -pos - 1;
fprintf(stderr,
"git-checkout-index: %s is %s.\n",
name,
- (pos < active_nr &&
- !strcmp(active_cache[pos]->name, name)) ?
+ !strcmp(ce->name, name) ?
"unmerged" : "not in the cache");
}
return -1;
}
- return checkout_entry(active_cache[pos], &state);
+ return checkout_entry(ce, &state);
}
static int checkout_one(struct cache_cursor *cc, struct cache_entry *ce)