From f6e83cdbdff57e8f3403c6b7f7acd22b88ca8613 Mon Sep 17 00:00:00 2001 From: mjarkk Date: Thu, 6 Dec 2018 08:26:05 +0100 Subject: [PATCH] Started working on the popup --- pkg/gui/branches_panel.go | 11 +++++------ pkg/gui/gui.go | 5 +++-- pkg/i18n/dutch.go | 6 ++++++ pkg/i18n/english.go | 6 ++++++ pkg/i18n/polish.go | 6 ++++++ 5 files changed, 26 insertions(+), 8 deletions(-) diff --git a/pkg/gui/branches_panel.go b/pkg/gui/branches_panel.go index 13267f29d..43c585730 100644 --- a/pkg/gui/branches_panel.go +++ b/pkg/gui/branches_panel.go @@ -97,14 +97,14 @@ func (gui *Gui) deleteBranch(g *gocui.Gui, v *gocui.View, force bool) error { func (gui *Gui) deleteNamedBranch(g *gocui.Gui, v *gocui.View, selectedBranch *commands.Branch, force bool) error { title := gui.Tr.SLocalize("DeleteBranch") - var messageId string + var messageID string if force { - messageId = "ForceDeleteBranchMessage" + messageID = "ForceDeleteBranchMessage" } else { - messageId = "DeleteBranchMessage" + messageID = "DeleteBranchMessage" } message := gui.Tr.TemplateLocalize( - messageId, + messageID, Teml{ "selectedBranchName": selectedBranch.Name, }, @@ -114,9 +114,8 @@ func (gui *Gui) deleteNamedBranch(g *gocui.Gui, v *gocui.View, selectedBranch *c errMessage := err.Error() if !force && strings.Contains(errMessage, "is not fully merged") { return gui.deleteNamedBranch(g, v, selectedBranch, true) - } else { - return gui.createErrorPanel(g, errMessage) } + return gui.createErrorPanel(g, errMessage) } return gui.refreshSidePanels(g) }, nil) diff --git a/pkg/gui/gui.go b/pkg/gui/gui.go index 872a00c37..b443d008d 100644 --- a/pkg/gui/gui.go +++ b/pkg/gui/gui.go @@ -421,9 +421,10 @@ func (gui *Gui) Run() error { } go func() { - time.Sleep(time.Second * 60) err := gui.fetch(g, false) - if err == nil || !strings.Contains(err.Error(), "exit status 128") { + if err != nil && strings.Contains(err.Error(), "exit status 128") { + gui.createConfirmationPanel(g, g.CurrentView(), gui.Tr.SLocalize("NoAutomaticGitFetchTitle"), gui.Tr.SLocalize("NoAutomaticGitFetchBody"), nil, nil) + } else { gui.goEvery(g, time.Second*60, func(g *gocui.Gui) error { return gui.fetch(g, false) }) diff --git a/pkg/i18n/dutch.go b/pkg/i18n/dutch.go index 5f9e4bf34..2f5a3a404 100644 --- a/pkg/i18n/dutch.go +++ b/pkg/i18n/dutch.go @@ -415,6 +415,12 @@ func addDutch(i18nObject *i18n.Bundle) error { }, &i18n.Message{ ID: "fetch", Other: `fetch`, + }, &i18n.Message{ + ID: "NoAutomaticGitFetchTitle", + Other: `No automatic git fetch`, + }, &i18n.Message{ + ID: "NoAutomaticGitFetchBody", + Other: `Lazygit can't use "git fetch" in a private repo use f in the branch panel to run git fetch manually`, }, ) } diff --git a/pkg/i18n/english.go b/pkg/i18n/english.go index 929e8834d..2ef1d8597 100644 --- a/pkg/i18n/english.go +++ b/pkg/i18n/english.go @@ -423,6 +423,12 @@ func addEnglish(i18nObject *i18n.Bundle) error { }, &i18n.Message{ ID: "fetch", Other: `fetch`, + }, &i18n.Message{ + ID: "NoAutomaticGitFetchTitle", + Other: `No automatic git fetch`, + }, &i18n.Message{ + ID: "NoAutomaticGitFetchBody", + Other: `Lazygit can't use "git fetch" in a private repo use f in the branch panel to run git fetch manually`, }, ) } diff --git a/pkg/i18n/polish.go b/pkg/i18n/polish.go index ec59288fa..d2b4a84ed 100644 --- a/pkg/i18n/polish.go +++ b/pkg/i18n/polish.go @@ -398,6 +398,12 @@ func addPolish(i18nObject *i18n.Bundle) error { }, &i18n.Message{ ID: "fetch", Other: `fetch`, + }, &i18n.Message{ + ID: "NoAutomaticGitFetchTitle", + Other: `No automatic git fetch`, + }, &i18n.Message{ + ID: "NoAutomaticGitFetchBody", + Other: `Lazygit can't use "git fetch" in a private repo use f in the branch panel to run git fetch manually`, }, ) }