diff --git a/pkg/gui/background.go b/pkg/gui/background.go index 0272f0864ef..c9f0e3d40f9 100644 --- a/pkg/gui/background.go +++ b/pkg/gui/background.go @@ -3,7 +3,6 @@ package gui import ( "fmt" "runtime" - "strings" "time" "github.com/jesseduffield/gocui" @@ -76,21 +75,18 @@ func (self *BackgroundRoutineMgr) startBackgroundRoutines() { func (self *BackgroundRoutineMgr) startBackgroundFetch() { self.gui.waitForIntro.Wait() - isNew := self.gui.IsNewRepo - userConfig := self.gui.UserConfig() - if !isNew { - time.After(time.Duration(userConfig.Refresher.FetchInterval) * time.Second) - } - err := self.backgroundFetch() - if err != nil && strings.Contains(err.Error(), "exit status 128") && isNew { - self.gui.c.Alert(self.gui.c.Tr.NoAutomaticGitFetchTitle, self.gui.c.Tr.NoAutomaticGitFetchBody) - } else { - self.goEvery(time.Second*time.Duration(userConfig.Refresher.FetchInterval), self.gui.stopChan, func() error { - err := self.backgroundFetch() - self.gui.c.Render() - return err - }) + fetch := func() error { + err := self.backgroundFetch() + self.gui.c.Render() + return err } + + // We want an immediate fetch at startup, and since goEvery starts by + // waiting for the interval, we need to trigger one manually first + _ = fetch() + + userConfig := self.gui.UserConfig() + self.goEvery(time.Second*time.Duration(userConfig.Refresher.FetchInterval), self.gui.stopChan, fetch) } func (self *BackgroundRoutineMgr) startBackgroundFilesRefresh(refreshInterval int) { diff --git a/pkg/gui/gui.go b/pkg/gui/gui.go index 4d5f625d9fe..1faeb85e4c0 100644 --- a/pkg/gui/gui.go +++ b/pkg/gui/gui.go @@ -108,8 +108,6 @@ type Gui struct { PopupHandler types.IPopupHandler - IsNewRepo bool - IsRefreshingFiles bool // we use this to decide whether we'll return to the original directory that diff --git a/pkg/gui/recent_repos_panel.go b/pkg/gui/recent_repos_panel.go index 0f2f2c7049c..ba6bc8ce133 100644 --- a/pkg/gui/recent_repos_panel.go +++ b/pkg/gui/recent_repos_panel.go @@ -21,8 +21,7 @@ func (gui *Gui) updateRecentRepoList() error { if err != nil { return err } - known, recentRepos := newRecentReposList(recentRepos, currentRepo) - gui.IsNewRepo = known + recentRepos = newRecentReposList(recentRepos, currentRepo) // TODO: migrate this file to use forward slashes on all OSes for consistency // (windows uses backslashes at the moment) gui.c.GetAppState().RecentRepos = recentRepos @@ -30,8 +29,7 @@ func (gui *Gui) updateRecentRepoList() error { } // newRecentReposList returns a new repo list with a new entry but only when it doesn't exist yet -func newRecentReposList(recentRepos []string, currentRepo string) (bool, []string) { - isNew := true +func newRecentReposList(recentRepos []string, currentRepo string) []string { newRepos := []string{currentRepo} for _, repo := range recentRepos { if repo != currentRepo { @@ -39,9 +37,7 @@ func newRecentReposList(recentRepos []string, currentRepo string) (bool, []strin continue } newRepos = append(newRepos, repo) - } else { - isNew = false } } - return isNew, newRepos + return newRepos } diff --git a/pkg/i18n/english.go b/pkg/i18n/english.go index aa942093b8b..2b233cd70b2 100644 --- a/pkg/i18n/english.go +++ b/pkg/i18n/english.go @@ -249,8 +249,6 @@ type TranslationSet struct { NoBranchOnRemote string Fetch string FetchTooltip string - NoAutomaticGitFetchTitle string - NoAutomaticGitFetchBody string FileEnter string FileEnterTooltip string FileStagingRequirements string @@ -1235,8 +1233,6 @@ func EnglishTranslationSet() *TranslationSet { NoBranchOnRemote: `This branch doesn't exist on remote. You need to push it to remote first.`, Fetch: `Fetch`, FetchTooltip: "Fetch changes from remote.", - NoAutomaticGitFetchTitle: `No automatic git fetch`, - NoAutomaticGitFetchBody: `Lazygit can't use "git fetch" in a private repo; use 'f' in the files panel to run "git fetch" manually`, FileEnter: `Stage lines / Collapse directory`, FileEnterTooltip: "If the selected item is a file, focus the staging view so you can stage individual hunks/lines. If the selected item is a directory, collapse/expand it.", FileStagingRequirements: `Can only stage individual lines for tracked files`,