Merge pull request #3931 from libgit2/ethomson/checkout_dont_calculate_oid_for_dirs checkout: don't try to calculate oid for directories
diff --git a/src/checkout.c b/src/checkout.c
index f11102c..b3427fb 100644
--- a/src/checkout.c
+++ b/src/checkout.c
@@ -212,6 +212,10 @@ static bool checkout_is_workdir_modified(
if (baseitem->size && wditem->file_size != baseitem->size)
return true;
+ /* if the workdir item is a directory, it cannot be a modified file */
+ if (S_ISDIR(wditem->mode))
+ return false;
+
if (git_diff__oid_for_entry(&oid, data->diff, wditem, wditem->mode, NULL) < 0)
return false;