Skip to content

Commit

Permalink
initialize submodules as part of the clone command
Browse files Browse the repository at this point in the history
  • Loading branch information
mhmd-azeez committed May 23, 2024
1 parent d5485af commit 3b4c638
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,17 +123,10 @@ func runCmdInDir(dir, name string, args ...string) error {
}

func cloneTemplate(pdk pdkTemplate, dir, tag string) error {
if err := runCmdInDir("", "git", "clone", "--depth=1", pdk.Url, "--branch", tag, dir); err != nil {
if err := runCmdInDir("", "git", "clone", "--depth=1", pdk.Url, "--branch", tag, "--recurse-submodules", dir); err != nil {
return err
}

// 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
}
}

// recursively check that parents are not a git repository, create an orphan branch & commit, cleanup
// otherwise, remove the git repository and assume this should be a plain directory within the parent
absDir, err := filepath.Abs(dir)
Expand Down

0 comments on commit 3b4c638

Please sign in to comment.