mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-05-11 12:25:47 +02:00
Retry on index.lock error
I don't know why we're getting index.lock errors but they're impossile to stop anyway given that other processes can be calling git commands. So we're retrying a few times before re-raising. To do this we need to clone the command and the current implementation for that is best-effort. I do worry about the maintainability of that but we'll see how it goes. Also, I thought you'd need to clone the task (if it exists) but now I think not; as long as you don't call done twice on it you should be fine, and you shouldn't be done'ing a task as part of running a command: that should happen higher up.
This commit is contained in:
parent
d44d164a5a
commit
16ed3c2377
3 changed files with 58 additions and 3 deletions
|
@ -65,6 +65,8 @@ type ICmdObj interface {
|
|||
|
||||
GetCredentialStrategy() CredentialStrategy
|
||||
GetTask() gocui.Task
|
||||
|
||||
Clone() ICmdObj
|
||||
}
|
||||
|
||||
type CmdObj struct {
|
||||
|
@ -215,3 +217,17 @@ func (self *CmdObj) GetCredentialStrategy() CredentialStrategy {
|
|||
func (self *CmdObj) GetTask() gocui.Task {
|
||||
return self.task
|
||||
}
|
||||
|
||||
func (self *CmdObj) Clone() ICmdObj {
|
||||
clone := &CmdObj{}
|
||||
*clone = *self
|
||||
clone.cmd = cloneCmd(self.cmd)
|
||||
return clone
|
||||
}
|
||||
|
||||
func cloneCmd(cmd *exec.Cmd) *exec.Cmd {
|
||||
clone := &exec.Cmd{}
|
||||
*clone = *cmd
|
||||
|
||||
return clone
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue