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

submodule update doesn't work with relative submodule paths (in GitPython 2.1.14) #944

Open
Genovese-martijn opened this issue Oct 18, 2019 · 8 comments

Comments

@Genovese-martijn
Copy link

@Genovese-martijn Genovese-martijn commented Oct 18, 2019

When using the git.objects.submodules.base.Submodule.update method (https://gitpython.readthedocs.io/en/stable/reference.html#git.objects.submodule.base.Submodule.update), the git python module seems to fake a git submodule call with git clone. It executes git clone -n --separate-git-dir=<workspace>/.git/modules/<submodule_path> -v <submodule_url> <workspace>/<submodule_path>. This command doesn't work when a submodule is specified as a relative path in the .gitmodules path. For example:

[submodule "main_project/submodule"]
  path = main_project/submodule
  url = ../../other_project/some_module.git

The git.objects.submodules.base.Submodule.update then fails with `repository '../../other_project/some_module.git' does not exist.

The regular git submodule command is able to resolve the paths.

@Byron
Copy link
Member

@Byron Byron commented Oct 19, 2019

Thanks for posting. Which version of GitPython are you using?

Even though the submodule implementation may not be up to date with what git produces, I remember that some improvements were made in the past which might resolve this issue.

@Genovese-martijn
Copy link
Author

@Genovese-martijn Genovese-martijn commented Oct 21, 2019

Thanks for the feedback, I am using version 2.1.14 due to external python2 requirement. The issue is indeed resolved when using version 3.0.3.

@Byron Byron changed the title submodule update doesn't work with relative submodule paths submodule update doesn't work with relative submodule paths (in GitPython 2.1.14) Oct 21, 2019
@Byron Byron added wont fix and removed waiting for feedback labels Oct 21, 2019
@Byron
Copy link
Member

@Byron Byron commented Oct 21, 2019

Thanks for your reply! I am closing this issue as it is already resolved.

Interestingly, in the last released version of GitPython with Python 2 compatibility, the submodule improvements should already be present. If you can spot the difference, I would be happy to receive a PR against 2.1.14 that fixes the issue there as well and release 2.1.15.

@Genovese-martijn
Copy link
Author

@Genovese-martijn Genovese-martijn commented Oct 21, 2019

Sorry, I made a mistake in my setup while I was testing it with python3 and git python version 3.0.3. On version 3.0.3 the relative submodule paths also does not work

@Ferenc-
Copy link

@Ferenc- Ferenc- commented Jan 16, 2020

This bug is still present in 3.0.5 any chance to increase priority?

@Byron
Copy link
Member

@Byron Byron commented Feb 8, 2020

I am afraid there is no priority beyond what people decide to contribute. GitPython is in maintenance mode.

@Genovese-martijn
Copy link
Author

@Genovese-martijn Genovese-martijn commented Feb 11, 2020

When looking trough other issues, I think this issue is the same as issue 730. Is there any reason why gitpython doesn't use the "native" git submodule calls?

@Byron
Copy link
Member

@Byron Byron commented Feb 12, 2020

If memory serves, back in the days I wanted to have 'smart' submodules, that are easier to handle and to update. For that, a lot of additional logic was added to what constitutes a very own implementation, compatible to git-submodules. In retrospect that turned out to be coming with maintenance costs that are now unaffordable.

Luckily, users can always workaround themselves by using repo.git.submodule(…), which may be enough for most usecases.

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

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.