optimize check_case_conflict.parents
diff --git a/pre_commit_hooks/check_case_conflict.py b/pre_commit_hooks/check_case_conflict.py
index 024c1c3..d7ab860 100644
--- a/pre_commit_hooks/check_case_conflict.py
+++ b/pre_commit_hooks/check_case_conflict.py
@@ -15,10 +15,11 @@
 
 
 def parents(file: str) -> Iterator[str]:
-    file = os.path.dirname(file)
-    while file:
-        yield file
-        file = os.path.dirname(file)
+    path_parts = file.split('/')
+    path_parts.pop()
+    while path_parts:
+        yield '/'.join(path_parts)
+        path_parts.pop()
 
 
 def directories_for(files: Set[str]) -> Set[str]: