summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2020-08-23 21:25:39 +1000
committergithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>2020-08-23 11:30:29 +0000
commit0f7003d939a969920ffdb5f2d28fca2fd0eb7f65 (patch)
treebb245de541583ea37e9a656d16689b55035402de
parentd2d88fe64e1fb3b831b283c56294271323bcade1 (diff)
allow spamming the p key
-rw-r--r--pkg/gui/files_panel.go3
-rw-r--r--pkg/gui/global_handlers.go3
-rw-r--r--pkg/gui/gui.go1
-rw-r--r--pkg/gui/remotes_panel.go3
4 files changed, 10 insertions, 0 deletions
diff --git a/pkg/gui/files_panel.go b/pkg/gui/files_panel.go
index c4798c854..f983f5033 100644
--- a/pkg/gui/files_panel.go
+++ b/pkg/gui/files_panel.go
@@ -475,6 +475,9 @@ func (gui *Gui) pullFiles(opts PullFilesOptions) error {
}
func (gui *Gui) pullWithMode(mode string, opts PullFilesOptions) error {
+ gui.State.FetchMutex.Lock()
+ defer gui.State.FetchMutex.Unlock()
+
err := gui.GitCommand.Fetch(
commands.FetchOptions{
PromptUserForCredential: gui.promptUserForCredential,
diff --git a/pkg/gui/global_handlers.go b/pkg/gui/global_handlers.go
index 1129f63fd..d5b25f738 100644
--- a/pkg/gui/global_handlers.go
+++ b/pkg/gui/global_handlers.go
@@ -165,6 +165,9 @@ func (gui *Gui) handleInfoClick(g *gocui.Gui, v *gocui.View) error {
}
func (gui *Gui) fetch(canPromptForCredentials bool) (err error) {
+ gui.State.FetchMutex.Lock()
+ defer gui.State.FetchMutex.Unlock()
+
fetchOpts := commands.FetchOptions{}
if canPromptForCredentials {
fetchOpts.PromptUserForCredential = gui.promptUserForCredential
diff --git a/pkg/gui/gui.go b/pkg/gui/gui.go
index b61170b30..bc6448374 100644
--- a/pkg/gui/gui.go
+++ b/pkg/gui/gui.go
@@ -287,6 +287,7 @@ type guiState struct {
IsRefreshingFiles bool
RefreshingFilesMutex sync.Mutex
RefreshingStatusMutex sync.Mutex
+ FetchMutex sync.Mutex
Searching searchingState
ScreenMode int
SideView *gocui.View
diff --git a/pkg/gui/remotes_panel.go b/pkg/gui/remotes_panel.go
index 92b0e0ffe..e32eb77c6 100644
--- a/pkg/gui/remotes_panel.go
+++ b/pkg/gui/remotes_panel.go
@@ -158,6 +158,9 @@ func (gui *Gui) handleFetchRemote(g *gocui.Gui, v *gocui.View) error {
}
return gui.WithWaitingStatus(gui.Tr.SLocalize("FetchingRemoteStatus"), func() error {
+ gui.State.FetchMutex.Lock()
+ defer gui.State.FetchMutex.Unlock()
+
if err := gui.GitCommand.FetchRemote(remote.Name); err != nil {
return err
}