$line !== '' && $line[0] !== '#'); } private static function parseGitAttributes(string $file): array { $lines = file($file); $ignores = []; foreach ($lines as $line) { if (strpos($line, 'export-ignore') !== false) { $parts = preg_split('/\s+/', trim($line)); if (!empty($parts[0])) { $ignores[] = $parts[0]; } } } return $ignores; } public static function shouldIgnore(string $relativePath, array $ignorePaths): bool { foreach ($ignorePaths as $ignored) { $normalized = ltrim($ignored, '/'); if ( $relativePath === $normalized || str_starts_with($relativePath, rtrim($normalized, '/') . '/') ) { return true; } } return false; } }