diff options
| author | nsfisis <nsfisis@gmail.com> | 2026-05-05 17:29:12 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2026-05-05 17:29:12 +0900 |
| commit | 49b0884701a84731652fc934d428932ff6029bd4 (patch) | |
| tree | 7477029b8ed686b9b3b06d960cab2b54ba87b579 /crates/mozart-archiver | |
| parent | 4623874d1c95414dcd5ae194d2561f2d98b40982 (diff) | |
| download | php-mozart-49b0884701a84731652fc934d428932ff6029bd4.tar.gz php-mozart-49b0884701a84731652fc934d428932ff6029bd4.tar.zst php-mozart-49b0884701a84731652fc934d428932ff6029bd4.zip | |
chore: remove redundant comments
Diffstat (limited to 'crates/mozart-archiver')
| -rw-r--r-- | crates/mozart-archiver/src/lib.rs | 33 |
1 files changed, 0 insertions, 33 deletions
diff --git a/crates/mozart-archiver/src/lib.rs b/crates/mozart-archiver/src/lib.rs index 19889ef..575f024 100644 --- a/crates/mozart-archiver/src/lib.rs +++ b/crates/mozart-archiver/src/lib.rs @@ -5,8 +5,6 @@ use std::fs; use std::io::Write as IoWrite; use std::path::{Path, PathBuf}; -// ─── Exclude filters ───────────────────────────────────────────────────────── - /// A compiled exclude pattern derived from a gitignore-style rule. pub struct ExcludePattern { regex: Regex, @@ -132,8 +130,6 @@ fn apply_filters( excluded } -// ─── GitExcludeFilter ───────────────────────────────────────────────────────── - /// Parse `.gitattributes` from the source directory. /// /// Returns exclude patterns for lines containing `export-ignore` or @@ -174,8 +170,6 @@ pub fn parse_gitattributes(source_dir: &Path) -> Vec<ExcludePattern> { patterns } -// ─── ComposerExcludeFilter ──────────────────────────────────────────────────── - /// Convert `composer.json` `archive.exclude` rules into exclude patterns. pub fn parse_composer_excludes(excludes: &[String]) -> Vec<ExcludePattern> { excludes @@ -184,12 +178,8 @@ pub fn parse_composer_excludes(excludes: &[String]) -> Vec<ExcludePattern> { .collect() } -// ─── VCS directory names ────────────────────────────────────────────────────── - const VCS_DIRS: &[&str] = &[".git", ".svn", ".hg", "CVS", ".bzr"]; -// ─── File collection ────────────────────────────────────────────────────────── - /// Collect all archivable files from the source directory. /// /// Returns paths relative to `source_dir`, sorted for deterministic output. @@ -276,8 +266,6 @@ fn collect_recursive( Ok(()) } -// ─── Archive formats ────────────────────────────────────────────────────────── - /// Supported archive formats. #[derive(Debug, Clone, PartialEq, Eq)] pub enum ArchiveFormat { @@ -310,8 +298,6 @@ impl ArchiveFormat { } } -// ─── Archive creation ───────────────────────────────────────────────────────── - /// Create an archive of the given files. /// /// - `source_dir`: the root of the source tree @@ -430,8 +416,6 @@ fn create_tar_bz2(source_dir: &Path, files: &[PathBuf], target: &Path) -> anyhow Ok(()) } -// ─── Filename generation ────────────────────────────────────────────────────── - /// Generate an archive filename (without extension) for a package. /// /// Mirrors Composer's `ArchiveManager::getPackageFilenameParts()`. @@ -492,8 +476,6 @@ pub fn generate_archive_filename( .join("-") } -// ─── Self-exclusion patterns ────────────────────────────────────────────────── - /// The set of archive extensions we support. const ARCHIVE_EXTENSIONS: &[&str] = &["zip", "tar", "tar.gz", "tar.bz2"]; @@ -514,14 +496,11 @@ pub fn self_exclusion_patterns(base_name: &str, has_extra_parts: bool) -> Vec<St .collect() } -// ─── Tests ──────────────────────────────────────────────────────────────────── - #[cfg(test)] mod tests { use super::*; use tempfile::tempdir; - // ── glob_to_regex ───────────────────────────────────────────────────────── // Note: glob_to_regex produces a *fragment* for use inside a larger pattern. // We test it by embedding it in a full anchored regex. @@ -566,8 +545,6 @@ mod tests { assert!(!re.is_match("/d.txt")); } - // ── parse_gitignore_pattern ─────────────────────────────────────────────── - #[test] fn test_parse_gitignore_simple() { let pat = parse_gitignore_pattern("docs/").unwrap(); @@ -601,8 +578,6 @@ mod tests { assert!(pat.regex.is_match("/sub/dir/foo.log")); } - // ── parse_gitattributes ─────────────────────────────────────────────────── - #[test] fn test_parse_gitattributes_export_ignore() { let dir = tempdir().unwrap(); @@ -649,8 +624,6 @@ mod tests { assert!(patterns.is_empty()); } - // ── collect_archivable_files ────────────────────────────────────────────── - #[test] fn test_collect_files_basic() { let dir = tempdir().unwrap(); @@ -721,8 +694,6 @@ mod tests { assert!(strs.contains(&"empty_dir".to_string())); } - // ── create_archive ──────────────────────────────────────────────────────── - fn make_source_tree(dir: &Path) { fs::write(dir.join("main.php"), b"<?php echo 'hello';").unwrap(); fs::create_dir(dir.join("src")).unwrap(); @@ -848,8 +819,6 @@ mod tests { assert_eq!(mode & 0o777, 0o755); } - // ── generate_archive_filename ───────────────────────────────────────────── - #[test] fn test_filename_simple_package() { let name = generate_archive_filename("vendor/pkg", None, Some("1.2.3"), None, None, None); @@ -909,8 +878,6 @@ mod tests { assert_eq!(name, "vendor-my-pkg-1.0-beta"); } - // ── self_exclusion_patterns ─────────────────────────────────────────────── - #[test] fn test_self_exclusion_patterns_with_extra_parts() { let patterns = self_exclusion_patterns("vendor-pkg", true); |
