Skip to content

Commit 6cf1a72

Browse files
committed
calculate relative patch only once
1 parent 4662e8f commit 6cf1a72

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

dfetch/project/subproject.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ def _apply_patches(self) -> list[str]:
148148
patch_path = (cwd / patch).resolve()
149149

150150
try:
151-
patch_path.relative_to(cwd)
151+
relative_patch_path = patch_path.relative_to(cwd)
152152
except ValueError:
153153
self._log_project(f'Skipping patch "{patch}" which is outside {cwd}.')
154154
continue
@@ -157,7 +157,7 @@ def _apply_patches(self) -> list[str]:
157157
self._log_project(f"Skipping non-existent patch {patch}")
158158
continue
159159

160-
normalized_patch_path = str(patch_path.relative_to(cwd).as_posix())
160+
normalized_patch_path = str(relative_patch_path.as_posix())
161161

162162
apply_patch(normalized_patch_path, root=self.local_path)
163163
self._log_project(f'Applied patch "{normalized_patch_path}"')

0 commit comments

Comments
 (0)