From 3f06a3ba4b72816d3416111e11b41c954a4c5804 Mon Sep 17 00:00:00 2001 From: Michal Lula Date: Wed, 2 Oct 2019 16:33:44 +0200 Subject: [PATCH] :spakrles: add git submodules support --- cmd/git-sync/main.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/cmd/git-sync/main.go b/cmd/git-sync/main.go index 872338e..e73ef46 100644 --- a/cmd/git-sync/main.go +++ b/cmd/git-sync/main.go @@ -452,6 +452,14 @@ func addWorktreeAndSwap(ctx context.Context, gitRoot, dest, branch, rev string, } log.V(0).Info("reset worktree to hash", "path", worktreePath, "hash", hash) + // Update submodules + + _, err = runCommand(ctx, worktreePath, *flGitCmd, "submodule", "update", "--init", "--recursive") + if err != nil { + return err + } + log.V(0).Info("updating submodules") + if *flChmod != 0 { // set file permissions _, err = runCommand(ctx, "", "chmod", "-R", strconv.Itoa(*flChmod), worktreePath)