Skip to content

Git submodule support #74

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

Open
Tracked by #132
rgalonso opened this issue Dec 20, 2023 · 2 comments
Open
Tracked by #132

Git submodule support #74

rgalonso opened this issue Dec 20, 2023 · 2 comments

Comments

@rgalonso
Copy link

There doesn't appear to be a way to clone a repo with submodules. In my use case, the devcontainer is built up using files coming in from a submod, so this is critical.

It looks looks like support for this would need to be added to CloneRepoOptions in git.go. The underlying git-go options already support this, so hopefully this isn't a heavy lift. See CloneOptions.RecurseSubmodules in go-git/options.go.

Finding the above references is about the extent of my Go knowledge though, so I can't offer a patch myself.

@bpmct bpmct added this to the envbuilder v1.0 milestone Apr 10, 2024
@bpmct bpmct mentioned this issue Apr 18, 2024
36 tasks
@mafredri
Copy link
Member

mafredri commented May 7, 2024

Hey @rgalonso could you share a bit more about how your repositories are structured and where the devcontainer files are located?

I'm not sure whether or not we support it currently, but utilizing the devcontainer.json initialize command seems like it could be one solution to this issue:

.devcontainer/devcontainer.json:

{
	"initializeCommand": ".devcontainer/initialize.sh"
}

.devcontainer/initialize.sh:

#!/bin/sh

git submodule update --init

That said, I do think it's a good idea to expand envbuilder with an GIT_CLONE_RECURSE_SUBMODULES=true option. The default behavior should be false so that we don't needlessly enable long checkout times for every project utilizing submodules.

@rgalonso
Copy link
Author

rgalonso commented Jul 8, 2024

@mafredri , sorry for the delay in replying but I haven't been working on this project recently. The repo is set up as follows:

.
└── .devcontainer
    ├── Dockerfile
    ├── devcontainer.json
    └── submod
        └── install.sh

devcontainer.json references a Dockerfile which in turn has a COPY command that references install.sh. install.sh is found in the Git submodule checked out at .devcontainer/submod.

Your suggestion to use initializeCommand may be a viable workaround. It's not ideal though, because VSCode is already properly handling the submod, so I wouldn't want to duplicate the effort.

Agreed that GIT_CLONE_RECURSE_SUBMODULES should default to false. No need to slow everyone down with unnecessary checkouts.

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

No branches or pull requests

4 participants