Skip to content
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

Fix bug of Git shallow cloning is not used when branch is set #117

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

dimohamdy
Copy link

Fix #106

@dimohamdy
Copy link
Author

@dnkoutso I cleaned the branch and update the changelog

@@ -222,6 +222,30 @@ def ensure_only_one_ref(folder)
should.not.raise { downloader.download }
end
end

describe 'get remote default branch if not set branch with shallow clones' do
it 'with git <= 2.10.x' do
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where is this version enforced within the tests? I do not see it.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I only try to follow the same way of this unit-test

describe 'will retry if a remote does not support shallow clones' do

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh interesting, had no idea....curious how this happens.....

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dimohamdy I checked out your branch and it seems even without your change the tests here are still passing? Can you confirm we are testing the right thing and these tests fail without your change?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ping @dimohamdy for any updates here

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @dnkoutso, Git shallow is working fine when branch is set. The real issue is caused by self.preprocess_option(options) method. This method is deleting the :branch option from options, and add :commit option into options and after that it causing to pass adding --depth 1 parameter when git clone shallow_clone && !options[:commit]. We should add test for preprocess_options

@xuzhongping
Copy link

xuzhongping commented Jan 8, 2022

@dimohamdy Hi,I noticed the line of code you deleted:

# lib/cocoapods-downloader/git.rb
options.delete(:branch)

The relevant code comes from a PR #57 , which is used to deal with the cache problem of cocoapods(:git && :branch). If you delete this line of code, it may affect the pod (:git && :branch) cache detection of cocoapods. I don’t know if you have tested these scenarios.

@uliluckas
Copy link

Any chance, this gets merged?

@ptrkstr
Copy link

ptrkstr commented Aug 7, 2023

This would be useful to have 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Git shallow cloning is not used when branch is set
6 participants