1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2026-06-20 01:19:23 +02:00

Change "Copy pull request URL to clipboard" command to use existing PR if there is one

This commit is contained in:
Stefan Haller
2026-03-25 12:37:16 +01:00
parent a462b7c420
commit 6ba46ad604
+10 -3
View File
@@ -525,16 +525,23 @@ func (self *BranchesController) handleCreatePullRequestMenu(selectedBranch *mode
return self.createPullRequestMenu(selectedBranch, checkedOutBranch)
}
func (self *BranchesController) copyPullRequestURL() error {
func (self *BranchesController) getPullRequestURL() (string, error) {
branch := self.context().GetSelected()
if pr, ok := self.c.Model().PullRequestsMap[branch.Name]; ok {
return pr.Url, nil
}
branchExistsOnRemote := self.c.Git().Remote.CheckRemoteBranchExists(branch.Name)
if !branchExistsOnRemote {
return errors.New(self.c.Tr.NoBranchOnRemote)
return "", errors.New(self.c.Tr.NoBranchOnRemote)
}
url, err := self.c.Helpers().Host.GetPullRequestURL(branch.Name, "")
return self.c.Helpers().Host.GetPullRequestURL(branch.Name, "")
}
func (self *BranchesController) copyPullRequestURL() error {
url, err := self.getPullRequestURL()
if err != nil {
return err
}