Skip to content

Add copy performance optimization (reflink/hardlink fallback) #230

Description

@ulises-jeremias

Feature Request

Optimize template file copying by trying reflink (FICLONE) first, then hardlink, then falling back to recursive copy — instead of always using shutil.copytree.

Background

Template checkout copies hundreds of files. On supported filesystems (Btrfs, XFS, ZFS, APFS), reflink copies are near-instant and space-efficient. Hardlinks are a fast second option.

Suggested approach

  • Try os.copy_file_range() or fcntl.FICLONE on each file copy
  • Fall back to shutil.copy2() (preserves metadata)
  • Avoid hardlinks for files that would be modified during template rendering (.template suffixed files)

Reference

CNA uses a reflink → hardlink → recursive copy chain. Parity gap documented in the feature alignment sweep.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions