Commit 9fbbb0eec5fc46cc9c36abf25b9baf653eb12372

Edward Thomson 2016-10-01T19:32:16

Merge pull request #3931 from libgit2/ethomson/checkout_dont_calculate_oid_for_dirs checkout: don't try to calculate oid for directories

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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;