summaryrefslogtreecommitdiffstats
path: root/pkg/gui/global_handlers.go
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2022-01-06 22:05:18 +1100
committerJesse Duffield <jessedduffield@gmail.com>2022-01-07 10:52:51 +1100
commit0d3e5e6a1dc7d131cd714a260b4f365380a033c6 (patch)
treefd857cfd3f65c63119c8eace5917374818abf26e /pkg/gui/global_handlers.go
parent93729ba61bc374c1ffa3d8a521ff75796fb899a2 (diff)
simplify fetch
Diffstat (limited to 'pkg/gui/global_handlers.go')
-rw-r--r--pkg/gui/global_handlers.go23
1 files changed, 15 insertions, 8 deletions
diff --git a/pkg/gui/global_handlers.go b/pkg/gui/global_handlers.go
index 8b437e6e0..68f2b6402 100644
--- a/pkg/gui/global_handlers.go
+++ b/pkg/gui/global_handlers.go
@@ -210,19 +210,15 @@ func (gui *Gui) handleMouseDownSecondary() error {
return nil
}
-func (gui *Gui) fetch(canPromptForCredentials bool, action string) (err error) {
+func (gui *Gui) fetch() (err error) {
gui.Mutexes.FetchMutex.Lock()
defer gui.Mutexes.FetchMutex.Unlock()
- fetchOpts := commands.FetchOptions{}
- if canPromptForCredentials {
- gui.logAction(action)
- fetchOpts.PromptUserForCredential = gui.promptUserForCredential
- }
+ gui.logAction("Fetch")
- err = gui.GitCommand.Fetch(fetchOpts)
+ err = gui.GitCommand.Fetch(commands.FetchOptions{PromptUserForCredential: gui.promptUserForCredential})
- if canPromptForCredentials && err != nil && strings.Contains(err.Error(), "exit status 128") {
+ if err != nil && strings.Contains(err.Error(), "exit status 128") {
_ = gui.createErrorPanel(gui.Tr.PassUnameWrong)
}
@@ -231,6 +227,17 @@ func (gui *Gui) fetch(canPromptForCredentials bool, action string) (err error) {
return err
}
+func (gui *Gui) backgroundFetch() (err error) {
+ gui.Mutexes.FetchMutex.Lock()
+ defer gui.Mutexes.FetchMutex.Unlock()
+
+ err = gui.GitCommand.Fetch(commands.FetchOptions{})
+
+ _ = gui.refreshSidePanels(refreshOptions{scope: []RefreshableView{BRANCHES, COMMITS, REMOTES, TAGS}, mode: ASYNC})
+
+ return err
+}
+
func (gui *Gui) handleCopySelectedSideContextItemToClipboard() error {
// important to note that this assumes we've selected an item in a side context
itemId := gui.getSideContextSelectedItemId()