-
Notifications
You must be signed in to change notification settings - Fork 223
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Rex::Commands::Sync excludes are poorly handled #1597
Comments
Then I would recommend opening two separate GitHub issues ;) I'm OK treating Nr. 1 as a bug, but Nr 2. definitely feels like a new feature. History shows they tend to need different details, reasoning, discussion, timelines, etc., and bundling is rarely the simplest way to track them. I propose focusing on the "superfluous checksumming of excluded files" bug in this issue, and when that's done we'll see if it's best to bundle the rest of the ideas here, or to split that off into its own discussion and solution. |
@ferki I can chop off fixing how excludes work from the PR, but then I will not deliver as detailed tests for sync_up/down with excludes. I just don't get them, apart from excluding a single flat file. Will that do? Also, I think making excludes work like gitignore should not be considered a new feature. I mean, it is a functional change, but the current system is underwhelming and straight up confusing to use - and I tried for several hours before doing the refactor. I consider it a bugfix. |
It seems to me that sync_down's excludes should work the same as sync_up and allow excluding directories. |
@mrmuskrat: yes, I agree in principle 👍 I didn't look into deeper implications on the actual implementation side yet, though. |
Looking at the current tests around syncing functionality, I find them to be in a quite poor state. There's no Rex::Commands::Sync tests at all yet, and Based on that, I would certainly start with fixing that before attempting to change anything about the code. I would probably approach further work on these topics something like the following:
Note that that up until this point is about covering the existing code with tests, against current expectations. The sync code is ~10 years old, we certainly don't want to accidentally break it. It's also certainly interesting to find any bugs against original expectations that may have been hidden so far due to lack of test coverage. The goal is to reach a state where it is safe and simple to express new expectations by new test code.
In fact, I started some of this work locally as an exploration of possibilities, but I haven't progressed too much yet. I might revisit the branch and try to push it somewhere for reference on initial work (so that part does not need to be duplicated by someone else).
It is a quite old part of the codebase, without any test coverage, and which was added as an escape hatch for situations when Going forward I see two options:
|
I'm tempted to turn this into a new module, but I don't think leaving Sync as it is is a good idea. Keeping backward compatibility here is likely a mistake. The old behavior seems to be exclude any file that matches the basename. If you specify I'd say breaking compatibility with this would cause less headaches than leaving it as it is and letting people find out why they are missing random files. This is a possibility given that there is no documentation explaining how these excludes work and the code is not that straightforward either. The code I delivered in the PR is fine and I'm using it successfully, but I have difficulty living up to the standards of this repository, for which I apologize. |
If anyone needs this, I created a new module with my modifications: https://metacpan.org/dist/Rex-Commands-PerlSync |
Describe the bug
There are two issues with sync_up and sync_down commands regarding excluded files and directories:
node_modules
which are often excluded anyway.Expected behavior
How to reproduce it
Code example
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
The text was updated successfully, but these errors were encountered: