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 <noreply@anthropic.com>
This commit is contained in:
Stefan HallerandClaude Opus 5.5 committed 2026-11-15 08:10:58 +01:00
1 parent ad50d2fb2a
commit 9ff9479baf
1 file changed
+5 -5
+5 -5
View File
@@ -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))