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

Convert git submodules of the source repository to subrepos #599

Open
axk126630 opened this issue Oct 4, 2023 · 3 comments
Open

Convert git submodules of the source repository to subrepos #599

axk126630 opened this issue Oct 4, 2023 · 3 comments

Comments

@axk126630
Copy link

I want to clone a Git repository that contains a git submodule. However, when using 'git subrepo clone' to pull in the source repository, the submodule directory remains empty. It appears that 'git subrepo clone' cannot fetch the submodule.
Is this a limitation of 'git subrepo clone'? How can I address this, given that including submodules is a common practice in repositories?
Is there a way to achieve a similar functionality as 'git clone --recurse-submodules' with 'git subrepo clone'?

@admorgan
Copy link
Collaborator

admorgan commented Oct 5, 2023

This is a limitation of git subrepo. It was an intentional decision on the part of the designer. submodules were still an experimental item when subrepo was created, and honestly they are still a real pain to work with. Now that submodules are very common I am considering adding a functionality that would bring in the submodules as subrepos. Still a lot of design work to do for this feature and I a lot of work to do before I get it to it, but it is something I would be happy to work out with someone and PRs are always welcome.

@axk126630
Copy link
Author

axk126630 commented Oct 9, 2023

Thanks @admorgan for your reply. Do you know of any workarounds that involve using 'git subrepo' to clone the repository and also ensure that the submodules from the source repository are included?
For example, can we initially clone the repository using the 'git clone --recurse-submodules' then use the 'git subrepo init' in the cloned repository and separately inside its cloned submodules?

@admorgan
Copy link
Collaborator

admorgan commented Oct 9, 2023

If you are only consuming the repos (you will never git subrepo push) you can manually import the submodules as sub git-subrepos, then delete the .gitmodules file in your local repo. This will tell you when a submodule is updated because you would have to resolve the conflict on a pull that included a submodule update. It is really hackish though.

@admorgan admorgan changed the title Does git subrepo clone pull in the git submodules of the source repository? Convert git submodules of the source repository to subrepos Jul 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants