diff options
author | Stefan Haller <stefan@haller-berlin.de> | 2023-09-24 12:43:31 +0200 |
---|---|---|
committer | Stefan Haller <stefan@haller-berlin.de> | 2023-10-08 18:45:36 +0200 |
commit | be3b4bd79133df5001f89f8f8c997fbcbe9a30d9 (patch) | |
tree | 500cdffaed171175326e09647dda3d62b89c6680 /pkg/commands | |
parent | 67d6447e12a7f1d7af0171d4b905adde20c877ab (diff) |
Remove sync mutex
I'm pretty convinced we don't need it. Git itself does a good job of making sure
that concurrent operations don't corrupt anything.
Diffstat (limited to 'pkg/commands')
-rw-r--r-- | pkg/commands/git.go | 6 | ||||
-rw-r--r-- | pkg/commands/git_commands/common.go | 5 | ||||
-rw-r--r-- | pkg/commands/git_commands/remote.go | 4 | ||||
-rw-r--r-- | pkg/commands/git_commands/sync.go | 9 | ||||
-rw-r--r-- | pkg/commands/git_commands/tag.go | 2 |
5 files changed, 8 insertions, 18 deletions
diff --git a/pkg/commands/git.go b/pkg/commands/git.go index f057f8d54..510661034 100644 --- a/pkg/commands/git.go +++ b/pkg/commands/git.go @@ -7,7 +7,6 @@ import ( "strings" "github.com/go-errors/errors" - "github.com/sasha-s/go-deadlock" "github.com/spf13/afero" gogit "github.com/jesseduffield/go-git/v5" @@ -63,7 +62,6 @@ func NewGitCommand( version *git_commands.GitVersion, osCommand *oscommands.OSCommand, gitConfig git_config.IGitConfig, - syncMutex *deadlock.Mutex, ) (*GitCommand, error) { currentPath, err := os.Getwd() if err != nil { @@ -118,7 +116,6 @@ func NewGitCommand( gitConfig, repoPaths, repository, - syncMutex, ), nil } @@ -129,7 +126,6 @@ func NewGitCommandAux( gitConfig git_config.IGitConfig, repoPaths *git_commands.RepoPaths, repo *gogit.Repository, - syncMutex *deadlock.Mutex, ) *GitCommand { cmd := NewGitCmdObjBuilder(cmn.Log, osCommand.Cmd) @@ -140,7 +136,7 @@ func NewGitCommandAux( // common ones are: cmn, osCommand, dotGitDir, configCommands configCommands := git_commands.NewConfigCommands(cmn, gitConfig, repo) - gitCommon := git_commands.NewGitCommon(cmn, version, cmd, osCommand, repoPaths, repo, configCommands, syncMutex) + gitCommon := git_commands.NewGitCommon(cmn, version, cmd, osCommand, repoPaths, repo, configCommands) fileLoader := git_commands.NewFileLoader(gitCommon, cmd, configCommands) statusCommands := git_commands.NewStatusCommands(gitCommon) diff --git a/pkg/commands/git_commands/common.go b/pkg/commands/git_commands/common.go index cf8250863..b9537165c 100644 --- a/pkg/commands/git_commands/common.go +++ b/pkg/commands/git_commands/common.go @@ -4,7 +4,6 @@ import ( gogit "github.com/jesseduffield/go-git/v5" "github.com/jesseduffield/lazygit/pkg/commands/oscommands" "github.com/jesseduffield/lazygit/pkg/common" - "github.com/sasha-s/go-deadlock" ) type GitCommon struct { @@ -15,8 +14,6 @@ type GitCommon struct { repoPaths *RepoPaths repo *gogit.Repository config *ConfigCommands - // mutex for doing things like push/pull/fetch - syncMutex *deadlock.Mutex } func NewGitCommon( @@ -27,7 +24,6 @@ func NewGitCommon( repoPaths *RepoPaths, repo *gogit.Repository, config *ConfigCommands, - syncMutex *deadlock.Mutex, ) *GitCommon { return &GitCommon{ Common: cmn, @@ -37,6 +33,5 @@ func NewGitCommon( repoPaths: repoPaths, repo: repo, config: config, - syncMutex: syncMutex, } } diff --git a/pkg/commands/git_commands/remote.go b/pkg/commands/git_commands/remote.go index ce8f79442..acfb51dc9 100644 --- a/pkg/commands/git_commands/remote.go +++ b/pkg/commands/git_commands/remote.go @@ -53,7 +53,7 @@ func (self *RemoteCommands) DeleteRemoteBranch(task gocui.Task, remoteName strin Arg(remoteName, "--delete", branchName). ToArgv() - return self.cmd.New(cmdArgs).PromptOnCredentialRequest(task).WithMutex(self.syncMutex).Run() + return self.cmd.New(cmdArgs).PromptOnCredentialRequest(task).Run() } func (self *RemoteCommands) DeleteRemoteTag(task gocui.Task, remoteName string, tagName string) error { @@ -61,7 +61,7 @@ func (self *RemoteCommands) DeleteRemoteTag(task gocui.Task, remoteName string, Arg(remoteName, "--delete", tagName). ToArgv() - return self.cmd.New(cmdArgs).PromptOnCredentialRequest(task).WithMutex(self.syncMutex).Run() + return self.cmd.New(cmdArgs).PromptOnCredentialRequest(task).Run() } // CheckRemoteBranchExists Returns remote branch diff --git a/pkg/commands/git_commands/sync.go b/pkg/commands/git_commands/sync.go index c32286e6d..fd7584aea 100644 --- a/pkg/commands/git_commands/sync.go +++ b/pkg/commands/git_commands/sync.go @@ -36,7 +36,7 @@ func (self *SyncCommands) PushCmdObj(task gocui.Task, opts PushOpts) (oscommands ArgIf(opts.UpstreamBranch != "", opts.UpstreamBranch). ToArgv() - cmdObj := self.cmd.New(cmdArgs).PromptOnCredentialRequest(task).WithMutex(self.syncMutex) + cmdObj := self.cmd.New(cmdArgs).PromptOnCredentialRequest(task) return cmdObj, nil } @@ -70,7 +70,6 @@ func (self *SyncCommands) FetchBackgroundCmdObj() oscommands.ICmdObj { cmdObj := self.cmd.New(cmdArgs) cmdObj.DontLog().FailOnCredentialRequest() - cmdObj.WithMutex(self.syncMutex) return cmdObj } @@ -96,7 +95,7 @@ func (self *SyncCommands) Pull(task gocui.Task, opts PullOptions) error { // setting GIT_SEQUENCE_EDITOR to ':' as a way of skipping it, in case the user // has 'pull.rebase = interactive' configured. - return self.cmd.New(cmdArgs).AddEnvVars("GIT_SEQUENCE_EDITOR=:").PromptOnCredentialRequest(task).WithMutex(self.syncMutex).Run() + return self.cmd.New(cmdArgs).AddEnvVars("GIT_SEQUENCE_EDITOR=:").PromptOnCredentialRequest(task).Run() } func (self *SyncCommands) FastForward( @@ -110,7 +109,7 @@ func (self *SyncCommands) FastForward( Arg(remoteBranchName + ":" + branchName). ToArgv() - return self.cmd.New(cmdArgs).PromptOnCredentialRequest(task).WithMutex(self.syncMutex).Run() + return self.cmd.New(cmdArgs).PromptOnCredentialRequest(task).Run() } func (self *SyncCommands) FetchRemote(task gocui.Task, remoteName string) error { @@ -118,5 +117,5 @@ func (self *SyncCommands) FetchRemote(task gocui.Task, remoteName string) error Arg(remoteName). ToArgv() - return self.cmd.New(cmdArgs).PromptOnCredentialRequest(task).WithMutex(self.syncMutex).Run() + return self.cmd.New(cmdArgs).PromptOnCredentialRequest(task).Run() } diff --git a/pkg/commands/git_commands/tag.go b/pkg/commands/git_commands/tag.go index 0656e1e19..d2b01ba7e 100644 --- a/pkg/commands/git_commands/tag.go +++ b/pkg/commands/git_commands/tag.go @@ -52,5 +52,5 @@ func (self *TagCommands) Push(task gocui.Task, remoteName string, tagName string cmdArgs := NewGitCmd("push").Arg(remoteName, "tag", tagName). ToArgv() - return self.cmd.New(cmdArgs).PromptOnCredentialRequest(task).WithMutex(self.syncMutex).Run() + return self.cmd.New(cmdArgs).PromptOnCredentialRequest(task).Run() } |