diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2020-10-01 22:13:32 +1000 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2020-10-02 08:09:42 +1000 |
commit | 2dc848506cb465cd46006b4a2a6dca2bdc5cf89d (patch) | |
tree | 58ea3cbafe116ced5bd7fbf7197c6cecc6ac0db8 /pkg/commands/submodules.go | |
parent | 9125e3c0c6f9c2f83ba74f33b5899054b8641218 (diff) |
bulk submodule menu
Diffstat (limited to 'pkg/commands/submodules.go')
-rw-r--r-- | pkg/commands/submodules.go | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/pkg/commands/submodules.go b/pkg/commands/submodules.go index 1444890f7..53a201c1e 100644 --- a/pkg/commands/submodules.go +++ b/pkg/commands/submodules.go @@ -123,7 +123,15 @@ func (c *GitCommand) SubmoduleUpdateUrl(name string, path string, newUrl string) return err } - return c.OSCommand.RunCommand("git submodule sync %s", path) + if err := c.OSCommand.RunCommand("git submodule sync %s", path); err != nil { + return err + } + + if err := c.OSCommand.RunCommand("git submodule update --init %s", path); err != nil { + return err + } + + return nil } func (c *GitCommand) SubmoduleInit(path string) error { @@ -133,3 +141,29 @@ func (c *GitCommand) SubmoduleInit(path string) error { func (c *GitCommand) SubmoduleUpdate(path string) error { return c.OSCommand.RunCommand("git submodule update --init %s", path) } + +func (c *GitCommand) SubmoduleBulkInitCmdStr() string { + return "git submodule init" +} + +func (c *GitCommand) SubmoduleBulkUpdateCmdStr() string { + return "git submodule update" +} + +func (c *GitCommand) SubmoduleForceBulkUpdateCmdStr() string { + return "git submodule update --force" +} + +func (c *GitCommand) SubmoduleBulkDeinitCmdStr() string { + return "git submodule deinit --all --force" +} + +func (c *GitCommand) ResetSubmodules(submodules []*models.SubmoduleConfig) error { + for _, submodule := range submodules { + if err := c.SubmoduleStash(submodule); err != nil { + return err + } + } + + return c.SubmoduleUpdateAll() +} |