-
Notifications
You must be signed in to change notification settings - Fork 8
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
feat: gen plugin automatically initializes submodules after cloning the template repo #88
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me, but wondering if @nilslice thinks this works with the changes to detect existing git repos?
It seems ok -- since that new "delete the .git repo if a parent one exists" code runs after this process: // ...
// initialize submodules if any
if _, err := os.Stat(filepath.Join(dir, ".gitmodules")); err == nil {
if err := runCmdInDir(dir, "git", "submodule", "update", "--init", "--recursive"); err != nil {
return err
}
}
absDir, err := filepath.Abs(dir)
if err != nil {
return err
}
if hasGitRepoInParents(absDir, 100) { // <--- this should take care of any cleanup we'd want
if err := os.RemoveAll(filepath.Join(dir, ".git")); err != nil {
return err
}
} else {
/// ... |
I am not sure if there is any downside to removing the .git dir when submodules are involved.. I'd assume they become "vendored" into the project vs. a link. |
In that case maybe people can manually add the submodule to the parent repo, since the .gitmodules file is still present |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah, good idea to use the original clone!
@bhelx is a git wizard 🪄 |
I assume it’s safe whether the module has sub modules or not but please double check
…On May 23, 2024 at 6:06 PM -0500, Muhammad Azeez ***@***.***>, wrote:
Merged #88 into main.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you commented.Message ID: ***@***.***>
|
tested it with the go pdk template, seems to be working |
Fixes #87