From 9ff9479baf3e7cbde101decddf607cf7c12f41fa Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Mon, 2 Nov 2026 19:58:12 +0100 Subject: [PATCH] Exclude the current repo from the recent repos menu by its path The menu leaves out the first entry of the recent repos list because that's the repo we're in. This is true as long as each lazygit instance keeps its own copy of state.yml. The following commits make instances read the list from the file. The first entry is then the repo that any instance opened most recently, and that may be a different one. Co-Authored-By: Claude Opus 5.5 --- pkg/gui/controllers/helpers/repos_helper.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pkg/gui/controllers/helpers/repos_helper.go b/pkg/gui/controllers/helpers/repos_helper.go index b31185659..63715a69a 100644 --- a/pkg/gui/controllers/helpers/repos_helper.go +++ b/pkg/gui/controllers/helpers/repos_helper.go @@ -280,12 +280,12 @@ func (self *ReposHelper) recentRepoMenuItem(entry recentRepoEntry, widths recent } func (self *ReposHelper) CreateRecentReposMenu() error { - // we'll show an empty panel if there are no recent repos - recentRepoPaths := []string{} - if len(self.c.GetAppState().RecentRepos) > 0 { - // we skip the first one because we're currently in it - recentRepoPaths = self.c.GetAppState().RecentRepos[1:] + currentRepo, err := os.Getwd() + if err != nil { + return err } + // Don't offer the repo we're in + recentRepoPaths := lo.Without(self.c.GetAppState().RecentRepos, currentRepo) currentBranches := make([]string, len(recentRepoPaths))