-
Notifications
You must be signed in to change notification settings - Fork 143
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: Honor .gitignore
for rsync
#3037
Conversation
I don't quite understand why we need even a logical copy of the context directory at all by default. I would expect tests to just not mutate it. But, if we wanted to be more sure, we could of course try to design a flow where we run tmt in a container, with the context mounted readonly. |
Big +1. In Cockpit we are actually in the same boat -- a lot of our developer trees have a ~ 1 GB node_modules/ (most of which isn't needed for running tests) and often also a multi-GB |
.gitignore
for rsync
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lovely, thanks @cgwalters ! Neither my previous 👎 nor my 👍 here are authoritative of course, but this is really nice!
Love the idea. Could it check for the presence of |
This PR doesn't change anything if the directory isn't a git tree. The question is just if anyone should rely on built (i.e. not git-tracked) files to go into the tmt target. IMHO this is just confusing, inefficient, and unpredictable, so I'm all for making this not configurable. (But as always, https://m.xkcd.com/1172/ 😁 ) |
I'm not sure about that, I don't see relevant checks for if the worktree is a git near where |
Seems like a good idea, although my experience with various directories in tmt is still limited. I would just propose different $SUBJ, |
@happz ping - since you know the tmt code can I please ask you to drive this PR to completion? |
Hmm wait, are there two rsyncs that tmt does? Oh wow...there is...we do an rsync of the worktree once into
? Ouch...so we'd clearly need to factor out shared rsync exclusions for these two things. (This said again, the best fix would be to avoid full copies; for the local virt one we could use virtiofs, although that doesn't work for remote VMs) |
Yeah, it's still on the roadmap for 1.35, I just need to find some time to wrap it up & ask folks for review :/ |
My additions are in b7e8759. |
/packit build |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't rsync --filter=':- .gitignore'
work in this context? I see it mentioned also in the stackoverflow question linked in comment.
EDIT: Seems to work for me when copying tmt repo. --filter=':- .gitignore' --exclude=.git
My main concern was if it picked up recursive $ tree -a ./
./
├── copy_this
├── .gitignore
├── other_value
├── some_folder
│ ├── copy_this_too
│ ├── .gitignore
│ └── ignore_me_too
└── some_valueA
2 directories, 7 files
$ tail .gitignore some_folder/.gitignore
==> .gitignore <==
some_value*
/other_value
==> some_folder/.gitignore <==
ignore_me_too
$ rsync -a --filter=':- .gitignore' ./ ../test_rsync_out/
$ tree -a ../test_rsync_out/
../test_rsync_out/
├── copy_this
├── .gitignore
└── some_folder
├── copy_this_too
└── .gitignore
2 directories, 4 files 👍 for such an approach IMO |
Using |
Well I guess one benefit would be that it works without git and perhaps speed?(haven't tested). But I don't have a strong opinion on this either way, just throwing it in for smarter people to evaluate ;) |
This approach should also pick up |
The current code also works without git, outside of a git repository, |
/packit build |
I am guessing I may be one of the first people to try using tmt with a Rust project. The default for the `cargo` toolchain is to keep a *lot* of cached incremental data in `target/`. In my case with bootc, it's currently 20G. A plain rsync() of this is *incredibly* inefficient. rsync doesn't even use reflinks if available, though that's a distinct bug. Use `git ls-files` to honor `.gitignore`. Signed-off-by: Colin Walters <[email protected]>
/packit build |
I am guessing I may be one of the first people to try using tmt with a Rust project. The default for the `cargo` toolchain is to keep a *lot* of cached incremental data in `target/`. In my case with bootc, it's currently 20G. A plain rsync() of this is *incredibly* inefficient. rsync doesn't even use reflinks if available, though that's a distinct bug. Co-authored-by: Colin Walters <[email protected]> Co-authored-by: Miloš Prchlík <[email protected]>
I am guessing I may be one of the first people to try using tmt
with a Rust project. The default for the
cargo
toolchainis to keep a lot of cached incremental data in
target/
.In my case with bootc, it's currently 20G.
A plain rsync() of this is incredibly inefficient. rsync doesn't
even use reflinks if available, though that's a distinct bug.
Use
git ls-files
to honor.gitignore
.Signed-off-by: Colin Walters [email protected]