Skip to content

Commit 4fd155b

Browse files
committed
bug: crash when replacing an existing link
1 parent 39ae45b commit 4fd155b

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

dotter/sync_plan.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,14 @@ def reconcile_touch(self) -> List[PhysicalSyncPlan]:
135135
ops = []
136136
ops.extend(self.reconcile_dir(self.dst_path))
137137

138-
if self.dst_path.exists():
138+
dst_path_stat = None
139+
try:
140+
dst_path_stat = self.dst_path.lstat()
141+
except:
142+
pass
143+
144+
if dst_path_stat is not None:
145+
# if dst_path exists in any form.
139146
return []
140147

141148
ops.append(PhysicalSyncPlan(
@@ -149,7 +156,14 @@ def reconcile_link(self) -> List[PhysicalSyncPlan]:
149156
ops = []
150157
ops.extend(self.reconcile_dir(self.dst_path))
151158

152-
if not self.dst_path.exists():
159+
dst_path_stat = None
160+
try:
161+
dst_path_stat = self.dst_path.lstat()
162+
except:
163+
pass
164+
165+
if dst_path_stat is None:
166+
# if dst_path does not exist.
153167
ops.append(PhysicalSyncPlan(
154168
type="link", action="create",
155169
src_path=self.src_path,

dotter/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "0.1.5"
1+
__version__ = "0.1.7"

0 commit comments

Comments
 (0)