From: Chuck Lever Date: Mon, 12 Sep 2005 14:56:20 GMT Subject: [PATCH 17/22] teach checkout-index.c to use cache_find_name() Message-ID: <20050912145620.28120.86534.stgit@dexter.citi.umich.edu> In-Reply-To: <20050912145543.28120.7086.stgit@dexter.citi.umich.edu> Signed-off-by: Chuck Lever --- 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)