Skip to content

shell --sync: Allow excluding files/folders from rsync #4887

@peschmae

Description

@peschmae

Description

Description

When running limactl shell --sync currently the whole working directory is synced to the guest system, and then also synced back. For projects with large genereated/dependency directories (eg. node_modules, vendor, build) this can make the initial sync slower, and make the sync-back noisier then necessary.

Especially in the AI agent use-case, we might also want to exclude certain folders being synced to the guest (eg. .git to exclude metadata).

Proposal

To allow the user to exclude a path a --sync-exclude flag could be introduced, which is then passed as --exclude to rsync. Making this flag repeatable would provide a lot of flexibility, while keeping the implementation simple as rsync also accepts multiple --exclude flags.

$ limactl shell --sync . --sync-exclude=node_modules --sync-exclude=.git default

Another option would be to introduce a .limasyncignore file, simlar to .dockerignore or .gitignore. This would need to reside in the root directory beeing synced, and could be passed to rsync as --exclude-from. The format would be the same as the rsync exclude file with one pattern per line.

eg.

node_modules
.git
vendor
build
dist
*.o

Implementation

The excludes could be appended to the additionalArgs when running the shell --sync command, and would also need to be apllied when running getRsyncStats as well as rsyncBack

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/clilimactl CLI user experienceenhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions