Skip to content

Store submodule name #679

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

Merged
merged 1 commit into from
Oct 2, 2017

Conversation

jakirkham
Copy link
Contributor

Fixes #678

Seems there are a plethora of things that expect to be able to get a submodule's name. However it is not defined if Submodule.add finds the submodule already exists. This is one attempt at trying to solve this issue.

@Byron
Copy link
Member

Byron commented Oct 2, 2017

Thanks for your contribution! At this time I unfortunately also don’t know if there are better ways to fix this, but believe it’s OK to assume it’s not making anything worse if the tests are not breaking.
Ideally there would also be a test that requires the code-change in order to be passing, but I understand the test-suite is messy and impossible to understand, so I wouldn’t ask for it :)!

@Byron Byron merged commit 95ff827 into gitpython-developers:master Oct 2, 2017
@jakirkham jakirkham deleted the fix_create_submodule branch October 2, 2017 15:07
@jakirkham
Copy link
Contributor Author

At this time I unfortunately also don’t know if there are better ways to fix this, but believe it’s OK to assume it’s not making anything worse if the tests are not breaking.

After trying a few things locally, this seemed to allow the submodule to behave normally. Though would think the name should be coming from .gitmodules. Just wasn't clear to me why that wasn't happening or how to fix it.

Ideally there would also be a test that requires the code-change in order to be passing, but I understand the test-suite is messy and impossible to understand, so I wouldn’t ask for it :)!

Sorry. Should have included a test. TBH wasn't sure if this seemingly hacky fix would be accepted or so quickly. 😄 Thanks for that. I'll give the test some thought.

jakirkham added a commit to jakirkham/conda-forge-webservices that referenced this pull request Oct 2, 2017
Uses a workaround already accepted upstream to fix `create_submodule`
when the submodule already exists. In particular naming the submodule
with the user provided name. By being able to use `create_submodule`,
this script runs substantially faster than when calling `submodule`.
Reason being calling `submodule` lists all submodules in the repo and
then selects the one we named. Whereas `create_submodule` simply
provides us the requested submodule. So using this workaround is
necessary for the performance improvement it provides.

ref: gitpython-developers/GitPython#679
riley-martine pushed a commit to riley-martine/GitPython that referenced this pull request Dec 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants