From 6145eaf9397e0039964ec8bef9ef631769f4b589 Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Tue, 24 Mar 2026 17:31:54 +0100 Subject: [PATCH] Prompt only once per session for each repo If the user hits escape in the "Select base repository for pull requests" prompt, don't bother them again for this repo at the next refresh. --- pkg/gui/controllers/helpers/refresh_helper.go | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/pkg/gui/controllers/helpers/refresh_helper.go b/pkg/gui/controllers/helpers/refresh_helper.go index e70951970..126018da6 100644 --- a/pkg/gui/controllers/helpers/refresh_helper.go +++ b/pkg/gui/controllers/helpers/refresh_helper.go @@ -30,6 +30,12 @@ type RefreshHelper struct { mergeConflictsHelper *MergeConflictsHelper worktreeHelper *WorktreeHelper searchHelper *SearchHelper + + // Tracks repos for which the user has dismissed the "select base GitHub remote" + // prompt, to avoid re-prompting on every subsequent refresh within the same session. + // Keyed by repo path so that switching to a different repo while lazygit is running + // still triggers the prompt there. + githubBaseRemotePromptDismissed map[string]bool } func NewRefreshHelper( @@ -813,7 +819,9 @@ func (self *RefreshHelper) refreshGithubPullRequests() { baseRemote := self.getGithubBaseRemote() if baseRemote == nil { - self.promptForBaseGithubRepo(authToken) + if !self.githubBaseRemotePromptDismissed[self.c.Git().RepoPaths.RepoPath()] { + self.promptForBaseGithubRepo(authToken) + } return } @@ -879,6 +887,13 @@ func (self *RefreshHelper) promptForBaseGithubRepo(authToken string) { _ = self.c.Menu(types.CreateMenuOptions{ Title: self.c.Tr.SelectRemoteRepository, Items: menuItems, + OnCancel: func() error { + if self.githubBaseRemotePromptDismissed == nil { + self.githubBaseRemotePromptDismissed = make(map[string]bool) + } + self.githubBaseRemotePromptDismissed[self.c.Git().RepoPaths.RepoPath()] = true + return nil + }, }) }