From 6d257691a39fb8c4191f4564ec6406d080dbf6b5 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sun, 9 Aug 2026 18:41:49 +0900 Subject: feat(path-downloader): restrict a mirrored path package to its archivable files PathDownloader builds an ArchivableFilesFinder and hands it to Filesystem::mirror as the iterator that selects what to copy, so a path package installed by mirroring drops what .gitattributes marks export-ignore, what .gitignore excludes and the VCS directories. The port dropped the argument, and mirrored the source tree whole. Every method mirror() calls on the entries it walks is derived from the pathname, so the iterator is modeled as a list of pathnames rather than as a Traversable of SplFileInfo. Co-Authored-By: Claude Opus 5 (1M context) --- crates/shirabe/src/downloader/path_downloader.rs | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'crates/shirabe/src') diff --git a/crates/shirabe/src/downloader/path_downloader.rs b/crates/shirabe/src/downloader/path_downloader.rs index 076f313d..5fa69ec7 100644 --- a/crates/shirabe/src/downloader/path_downloader.rs +++ b/crates/shirabe/src/downloader/path_downloader.rs @@ -443,13 +443,14 @@ impl DownloaderInterface for PathDownloader { io_interface::NORMAL, ); } - let _iterator = ArchivableFilesFinder::new(&real_url, vec![], false)?; - // PHP: $symfonyFilesystem->mirror($realUrl, $path, $iterator); - // TODO(phase-c): Symfony Filesystem::mirror takes a Traversable iterator as its third - // argument, but the external-package Filesystem stub does not model the iterator type - // that ArchivableFilesFinder (an IteratorAggregate) would be wrapped into, so None is - // passed and the mirrored file list is not restricted. - symfony_filesystem.mirror(&real_url, &path)?; + let iterator = ArchivableFilesFinder::new(&real_url, vec![], false)?; + symfony_filesystem.mirror( + &real_url, + &path, + iterator + .map(|entry| entry.to_string_lossy().into_owned()) + .collect(), + )?; } if output { -- cgit v1.3.1-4-g156e