summaryrefslogtreecommitdiffstats
path: root/pkg/commands/submodules.go
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2021-04-05 21:08:33 +1000
committerJesse Duffield <jessedduffield@gmail.com>2021-04-06 19:34:32 +1000
commit5ce9e0193a47692d38a2b2aa549630458ccf3038 (patch)
tree205d9730e521e566123669035bc0c05e536ad1dd /pkg/commands/submodules.go
parent4c71c26593e76e34bafcb7df717e53204b522da5 (diff)
add retry logic for running git commands to avoid index.lock problems
Diffstat (limited to 'pkg/commands/submodules.go')
-rw-r--r--pkg/commands/submodules.go22
1 files changed, 11 insertions, 11 deletions
diff --git a/pkg/commands/submodules.go b/pkg/commands/submodules.go
index 101c6178c..856bc4cbe 100644
--- a/pkg/commands/submodules.go
+++ b/pkg/commands/submodules.go
@@ -69,28 +69,28 @@ func (c *GitCommand) SubmoduleStash(submodule *models.SubmoduleConfig) error {
return nil
}
- return c.OSCommand.RunCommand("git -C %s stash --include-untracked", submodule.Path)
+ return c.RunCommand("git -C %s stash --include-untracked", submodule.Path)
}
func (c *GitCommand) SubmoduleReset(submodule *models.SubmoduleConfig) error {
- return c.OSCommand.RunCommand("git submodule update --init --force %s", submodule.Path)
+ return c.RunCommand("git submodule update --init --force %s", submodule.Path)
}
func (c *GitCommand) SubmoduleUpdateAll() error {
// not doing an --init here because the user probably doesn't want that
- return c.OSCommand.RunCommand("git submodule update --force")
+ return c.RunCommand("git submodule update --force")
}
func (c *GitCommand) SubmoduleDelete(submodule *models.SubmoduleConfig) error {
// based on https://gist.github.com/myusuf3/7f645819ded92bda6677
- if err := c.OSCommand.RunCommand("git submodule deinit --force %s", submodule.Path); err != nil {
+ if err := c.RunCommand("git submodule deinit --force %s", submodule.Path); err != nil {
if strings.Contains(err.Error(), "did not match any file(s) known to git") {
- if err := c.OSCommand.RunCommand("git config --file .gitmodules --remove-section submodule.%s", submodule.Name); err != nil {
+ if err := c.RunCommand("git config --file .gitmodules --remove-section submodule.%s", submodule.Name); err != nil {
return err
}
- if err := c.OSCommand.RunCommand("git config --remove-section submodule.%s", submodule.Name); err != nil {
+ if err := c.RunCommand("git config --remove-section submodule.%s", submodule.Name); err != nil {
return err
}
@@ -100,7 +100,7 @@ func (c *GitCommand) SubmoduleDelete(submodule *models.SubmoduleConfig) error {
}
}
- if err := c.OSCommand.RunCommand("git rm --force -r %s", submodule.Path); err != nil {
+ if err := c.RunCommand("git rm --force -r %s", submodule.Path); err != nil {
// if the directory isn't there then that's fine
c.Log.Error(err)
}
@@ -119,11 +119,11 @@ func (c *GitCommand) SubmoduleAdd(name string, path string, url string) error {
func (c *GitCommand) SubmoduleUpdateUrl(name string, path string, newUrl string) error {
// the set-url command is only for later git versions so we're doing it manually here
- if err := c.OSCommand.RunCommand("git config --file .gitmodules submodule.%s.url %s", name, newUrl); err != nil {
+ if err := c.RunCommand("git config --file .gitmodules submodule.%s.url %s", name, newUrl); err != nil {
return err
}
- if err := c.OSCommand.RunCommand("git submodule sync %s", path); err != nil {
+ if err := c.RunCommand("git submodule sync %s", path); err != nil {
return err
}
@@ -131,11 +131,11 @@ func (c *GitCommand) SubmoduleUpdateUrl(name string, path string, newUrl string)
}
func (c *GitCommand) SubmoduleInit(path string) error {
- return c.OSCommand.RunCommand("git submodule init %s", path)
+ return c.RunCommand("git submodule init %s", path)
}
func (c *GitCommand) SubmoduleUpdate(path string) error {
- return c.OSCommand.RunCommand("git submodule update --init %s", path)
+ return c.RunCommand("git submodule update --init %s", path)
}
func (c *GitCommand) SubmoduleBulkInitCmdStr() string {