From 8536bfa688945aab3ac89f429531f5f4a0748e12 Mon Sep 17 00:00:00 2001 From: ItsDrike Date: Sat, 29 Oct 2022 20:34:42 +0200 Subject: [PATCH] Handle sys file being a directory while dotfile is file --- sync.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sync.py b/sync.py index ad5e83a..255e47a 100755 --- a/sync.py +++ b/sync.py @@ -28,6 +28,7 @@ class DiffStatus(Enum): UNEXPECTED_SYMLINK = auto() CONTENT_DIFFERS = auto() SYMLINK_DIFFERS = auto() + UNEXPECTED_DIRECTORY = auto() class FileDiff(NamedTuple): @@ -90,6 +91,9 @@ def compare_files(dot_file: Path, sys_file: Path) -> DiffStatus: elif sys_file.is_symlink(): return DiffStatus.UNEXPECTED_SYMLINK + if sys_file.is_dir(): + return DiffStatus.UNEXPECTED_DIRECTORY + try: if file_sum(dot_file) == file_sum(sys_file): return DiffStatus.MATCH