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

Explicitly checkout submodules when needed #58

Merged
merged 1 commit into from
Jun 23, 2016
Merged

Explicitly checkout submodules when needed #58

merged 1 commit into from
Jun 23, 2016

Conversation

gfontenot
Copy link
Contributor

After doing some research, it looks like git 2.9 made a change so that command
line flags are now sent to the submodule commands as well, where pre-2.9
releases ignored those flags for submodules.

That seems like a great change on the surface. But unfortunately for us, it
means that using --depth=1 and --recursive in the same command will almost
always result in a failed clone. This is because the submodule is also
initially checked out using --depth=1 and so when it then tries to check out
the commit specified by the .gitmodules file, it fails because it doesn't see
that SHA in the git history. The only way it will succeed is if the specified
commit also happens to be the HEAD of master.

This issue can be fixed by removing the --recursive flag from the initial
git command, and then running git submodules --init --recursive inside the
repo to pull down the submodules.

Fixes CocoaPods/CocoaPods#5555

@segiddins
Copy link
Member

<3 thanks @gfontenot! Could you slap a quick changelog entry on this? We should backport & release it as 1.0.1

@gfontenot
Copy link
Contributor Author

Added the changelog entry by ammending the previous commit.

`--depth=1` under git 2.9.
[Gordon Fontenot](https://github.com/gfontenot)
[#58](https://github.com/CocoaPods/cocoapods-downloader/pull/58)
[CocoaPods#5555]()https://github.com/CocoaPods/CocoaPods/issues/5555)

Choose a reason for hiding this comment

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

Extra ) before https

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oops, good catch. Fixed.

After doing some research, it looks like git 2.9 made a change so that command
line flags are now sent to the submodule commands as well, where pre-2.9
releases ignored those flags for submodules.

That seems like a great change on the surface. But unfortunately for us, it
means that using `--depth=1` and `--recursive` in the same command will almost
always result in a failed clone. This is because the submodule is also
initially checked out using `--depth=1` and so when it then tries to check out
the commit specified by the .gitmodules file, it fails because it doesn't see
that SHA in the git history. The only way it will succeed is if the specified
commit also happens to be the HEAD of master.

This issue can be fixed by removing the `--recursive` flag from the initial
git command, and then running `git submodules --init --recursive` inside the
repo to pull down the submodules.
@gfontenot
Copy link
Contributor Author

Fixed this up by using an actual git command, as opposed to one my dumb brain decided to make up.

@gfontenot
Copy link
Contributor Author

@segiddins Any idea about a timeframe for getting a release with this? I'm happy to help however I can, I'm blocked locally by it.

@segiddins
Copy link
Member

@gfontenot I can try and get around to it today but no promises, in the meantime see https://guides.cocoapods.org/using/unreleased-features.html

@segiddins segiddins merged commit a378ad7 into CocoaPods:master Jun 23, 2016
segiddins added a commit that referenced this pull request Jun 24, 2016
Explicitly checkout submodules when needed
(cherry picked from commit a378ad7)
@segiddins
Copy link
Member

Released

@gfontenot
Copy link
Contributor Author

🎉 Thanks @segiddins!

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 submodule support broken when using git 2.9
3 participants