Bundler::Source::Git: avoid re-fetching the repo - #9806
Conversation
9c0411f to
e548525
Compare
| at = humanized_ref || current_branch | ||
|
|
||
| rev = "at #{at}@#{shortref_for_display(revision)}" | ||
| at = humanized_ref || @branch |
There was a problem hiding this comment.
|| @branch looks unreachable: @ref includes options["branch"], so whenever @branch is set humanized_ref already returns it. at = humanized_ref alone should be equivalent.
|
👍 Can you look my comment? I will merge this after that. |
In `install`, `self.to_s` is called by `print_using_message "Using ... from #{self}`.
This in turn calls `current_branch` which if the local git cache
is missing will re-clone it from scratch.
This is an issue, because a common optimization for build system
that are bundler aware is to prune bundler's cache to remove
large git repositories.
See my feature request from 2020 for context:
ruby#7018
In our case, these git repositories account for over 50%
of the bundler cache, causing the cache restoration and
persist steps to be very significantly slowed down.
Overall I don't think triggering a full on git clone operation
from a call to `to_s` make sense.
e548525 to
0733910
Compare
|
@byroot I'm positive about providing an official prune feature. I'm not sure what the right interface would be. An environment variable, a flag on an existing command, and a separate bundle prune subcommand all seem plausible to me. Do you have a preference method? |
I suppose we could have them all, but if we go to the absolutely essential one, then I think it would be an environment variable, e.g. |
And also the Rails default |
|
NB: the lint step failed because of some GItHub issue, but I don't have the permissions to re-run it. I think other than that the PR is green. |
|
oh, thanks. I re-run that job. |
In
install,self.to_sis called byprint_using_message "Using ... from #{self}. This in turn callscurrent_branchwhich if the local git cache is missing will re-clone it from scratch.This is an issue, because a common optimisation for build system that are bundler aware is to prune bundler's cache to remove large git repositories.
See my feature request from 2020 for context: #7018
In our case, these git repositories account for over 50% of the bundler cache, causing the cache restoration and persist steps to be very significantly slowed down.
Overall I don't think triggering a full on git clone operation from a call to
to_smake sense.NB: This can be worked around by always specifying a
ref:argument on the gem.