Skip to content

Commit 52b4395

Browse files
committed
Don't let subproject get knowledge about manifest
1 parent 51e4df1 commit 52b4395

3 files changed

Lines changed: 8 additions & 8 deletions

File tree

dfetch/project/subproject.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -142,25 +142,23 @@ def update(
142142

143143
def _apply_patches(self) -> list[str]:
144144
"""Apply the patches."""
145-
manifest_dir = Path(".").resolve()
145+
cwd = Path(".").resolve()
146146
applied_patches = []
147147
for patch in self.__project.patch:
148148

149-
patch_path = (manifest_dir / patch).resolve()
149+
patch_path = (cwd / patch).resolve()
150150

151151
try:
152-
patch_path.relative_to(manifest_dir)
152+
patch_path.relative_to(cwd)
153153
except ValueError:
154-
self._log_project(
155-
f'Skipping patch "{patch}" which is outside manifest dir.'
156-
)
154+
self._log_project(f'Skipping patch "{patch}" which is outside {cwd}.')
157155
continue
158156

159157
if not patch_path.exists():
160158
self._log_project(f"Skipping non-existent patch {patch}")
161159
continue
162160

163-
normalized_patch_path = str(patch_path.relative_to(manifest_dir).as_posix())
161+
normalized_patch_path = str(patch_path.relative_to(cwd).as_posix())
164162

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

features/patch-after-fetch-git.feature

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,5 +195,5 @@ Feature: Patch after fetching from git repo
195195
"""
196196
Dfetch (0.11.0)
197197
ext/test-repo-tag : Fetched v2.0
198-
ext/test-repo-tag : Skipping patch "../diff.patch" which is outside manifest dir.
198+
ext/test-repo-tag : Skipping patch "../diff.patch" which is outside /some/path.
199199
"""

features/steps/generic_steps.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
urn_uuid = re.compile(r"[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}")
2626
bom_ref = re.compile(r"BomRef\.[0-9]+\.[0-9]+")
2727
svn_error = re.compile(r"svn: E\d{6}: .+")
28+
abs_path = re.compile(r"/tmp/[\w_]+")
2829

2930

3031
def remote_server_path(context):
@@ -181,6 +182,7 @@ def check_output(context, line_count=None):
181182
"some-remote-server",
182183
),
183184
(svn_error, "svn: EXXXXXX: <some error text>"),
185+
(abs_path, "/some/path"),
184186
],
185187
text=context.cmd_output,
186188
)

0 commit comments

Comments
 (0)