summaryrefslogtreecommitdiff
path: root/src/checkout.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/checkout.c')
-rw-r--r--src/checkout.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/checkout.c b/src/checkout.c
index 2a29b1862..24fa21024 100644
--- a/src/checkout.c
+++ b/src/checkout.c
@@ -235,10 +235,13 @@ static int checkout_action_wd_only(
/* check if item is tracked in the index but not in the checkout diff */
if (data->index != NULL) {
if (wd->mode != GIT_FILEMODE_TREE) {
- if (git_index_get_bypath(data->index, wd->path, 0) != NULL) {
+ int error;
+
+ if ((error = git_index_find(NULL, data->index, wd->path)) == 0) {
notify = GIT_CHECKOUT_NOTIFY_DIRTY;
remove = ((data->strategy & GIT_CHECKOUT_FORCE) != 0);
- }
+ } else if (error != GIT_ENOTFOUND)
+ return error;
} else {
/* for tree entries, we have to see if there are any index
* entries that are contained inside that tree