-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Make cloning git repos faster #4475
Conversation
ca618e5
to
ca5ce65
Compare
This should be mostly working now, and it does result in a significant improvement for large git repositories. For example, bundling rails edge with a cold cache: Before
After
I did try to make this backwards compatible but I'm afraid this needs more work because this feature of git depends on both client and server versions, and also on the server having the So we probably need to ask this to the server to decide whether we should fetch the whole repository or not. Apparently git servers have this
|
Hate being that guy but any update on this? Looks like it's pretty close? |
Hi. No updates. What's left to do is what I said in the previous message. Alternatively, instead of try to explicitly "feature detect" this capability, we could rescue errors when fetching specific revisions, and fallback to the current mode in that case. |
I think this would be super! I don't want to expand the scope or delay this work, but wanted to mention that a couple related options to minimize clone size are --branch and --no-tags. My understanding is In terms of feature detection, is there a minimum git version that bundler aims to support? I think all of the clone options mentioned are available on the versions of Thanks for this work, it'd be great to see it land, and I'd be glad to test or help 🙂 |
The problem is this not only depends on |
91e8c21
to
88868ff
Compare
If CI agrees, I believe this is ready. I decided to pass on supporting git servers without the I am still falling back to full clones on some edge cases, and when old client git version is used. The old client code paths are untested, but they are "duplicated" with other tested cases like like pinning to shortened sha's, so I believe it's fine. These are updated results on my laptop for bundling rails edge with a cold cache: On master
On this branch
|
9511891
to
03fb49b
Compare
This is ready for a review now! |
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.
Awesome work getting this set up!
Thank you, this is great! |
I am not seeing a README update with this change? Should Thanks |
No README update, because there's no user facing change caused by this PR, other than Bundler being faster.
|
Sorry for commenting on this already closed PR, @deivid-rodriguez. I think there was a user-facing change. Maybe unintentional (still trying to understand it completely). I'm trying to troubleshoot and fix an issue appraisal is having since this PR was merged, see thoughtbot/appraisal#218 (comment). Acceptance tests in appraisal are setting up some git repositories with gems and then try to run bundler against this Gemfile:
$ git clone --bare --no-hardlinks --quiet --no-tags --depth 1 --single-branch -- file://../gems/omelette /path/to/bundler/git/cache
|
@tisba Is there any reason to use require 'spec_helper'
describe 'Debugging Bundler Issues' do
it 'does something' do
build_git_gems %w(omelette)
build_gemfile <<-Gemfile
source 'https://rubygems.org'
gem "omelette", path: "../gems/omelette"
Gemfile
run 'bundle install --local --verbose'
end
end Does this pass? |
@simi sure. In case you don't now, Appraisal is a testing tool where you can define multiple variants of Gemfiles to test your code against. In their acceptance tests they want to ensure that git sourced gem definition work. Again, I'm not sure if this (cloning with a relative path reference) was ever supposed to be supported by Bundler, but it worked at one time and it broke. If this was not supported and it won't be fixed: I'd suggest raise an error if Bundler sees a local path for the |
@tisba I'm familiar with Appraisal. Per my understanding |
Alright. I'll take a look then if I can provide a PR to raise a proper error message. Like I said, technically it works just fine, just not with relative paths. I'll need to go through the bundler code a bit more, but maybe another option is to detect local paths and clone (slightly) differently. IMO it would be more consistent and less surprising to the user, granted that this might be a rare use case.
Yes, but that's not what bundler is using currently. |
@tisba this is not about what's using bundler currently, but where do you point bundler to. Bundler uses the passed |
hmm, not sure if we have a misunderstanding here :) I'll create a new issue, doublecheck my observations and add a repro case. |
Hei. Yeah, I'm not sure giving a relative path was explicitly supported before. It seems you'd want |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
What was the end-user or developer problem that led to this PR?
The problem was that cloning bit git repos can be very slow, because we are cloning the full history of the repo.
What is your fix for the problem, implemented in this PR?
My fix is to use
--depth 1
for remote clones to only download what's necessary.This approach doesn't really work and needs more work. A potential fix was suggested here.
Fixes #3332.
Fixes #3378.
Fixes #3775.
Supersedes rubygems/bundler#7054.
Make sure the following tasks are checked