From 20aa65c0ee59bbcd5d0b0ea9a57e0b43942007e1 Mon Sep 17 00:00:00 2001 From: Andres Erbsen Date: Wed, 24 Apr 2019 20:01:53 -0400 Subject: [PATCH] Initialize submodules after checking out git ref Fixes #214 --- worker/tasks.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/worker/tasks.go b/worker/tasks.go index 042f2b9..75d79ec 100644 --- a/worker/tasks.go +++ b/worker/tasks.go @@ -324,7 +324,7 @@ func (ctx *JobContext) CloneRepos() error { repo_name = strings.TrimSuffix(repo_name, ".git") git := ctx.SSH("GIT_SSH_COMMAND='ssh -o " + "UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no'", - "git", "clone", "--recursive", purl.String()) + "git", "clone", purl.String()) git.Stdout = ctx.LogFile git.Stderr = ctx.LogFile if err := git.Run(); err != nil { @@ -342,6 +342,15 @@ func (ctx *JobContext) CloneRepos() error { if err := git.Run(); err != nil { return errors.Wrap(err, "git checkout") } + git = ctx.SSH("GIT_SSH_COMMAND='ssh -o " + + "UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no'", + "sh", "-euxc", + fmt.Sprintf("'cd %s && git submodule update --init'", repo_name)) + git.Stdout = ctx.LogFile + git.Stderr = ctx.LogFile + if err := git.Run(); err != nil { + return errors.Wrap(err, "git submodule update") + } } } else if scm == "hg" { repo_name := path.Base(purl.Path) -- 2.38.5