Skip to content

Rex::Commands::Sync excludes are poorly handled #1597

@bbrtj

Description

@bbrtj

Describe the bug

There are two issues with sync_up and sync_down commands regarding excluded files and directories:

  1. Excludes are looked at too late, after calculating md5 of all files in the directory (recursively). This means a lot of time is spent doing meaningless work, for example like calculating md5 of all node_modules which are often excluded anyway.
  2. Excludes work well only when a flat file is excluded. Excluding nested files or whole directories does not work as one would expect from using tools like gitignore.

Expected behavior

  1. There's absolutely no need to calculate md5 sums of excluded files, as those will be thrown away unused.
  2. I can't grasp how the excluded directories currently work, but I would expect I have to pass a full path to a file which I want excluded, minus any wildcards.

How to reproduce it

  1. Have a large directory alongside your files
  2. Try syncing up with the directory excluded

Code example

sync_up 'my_dir', 'my_remote_dir', {
  exclude => ['directory_name'],
};

Additional context

No response

Rex version

(R)?ex 1.14.2

Perl version

This is perl 5, version 36, subversion 0 (v5.36.0) built for amd64-freebsd

Operating system running rex

FreeBSD 13.2 (amd64)

Operating system managed by rex

FreeBSD 13.1

How rex was installed?

cpan client

Metadata

Metadata

Assignees

No one assigned

    Labels

    triage neededA potential bug that needs to be reproduced and understood

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions