mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-06-15 00:15:32 +02:00
Use upstream branch when opening pull requests (#2693)
- **PR Description** Should probably solve #2691 - **Please check if the PR fulfills these requirements** * [x] Cheatsheets are up-to-date (run `go run scripts/cheatsheet/main.go generate`) * [x] Code has been formatted (see [here](https://github.com/jesseduffield/lazygit/blob/master/CONTRIBUTING.md#code-formatting)) * [x] Tests have been added/updated (see [here](https://github.com/jesseduffield/lazygit/blob/master/pkg/integration/README.md) for the integration test guide) * [x] Text is internationalised (see [here](https://github.com/jesseduffield/lazygit/blob/master/CONTRIBUTING.md#internationalisation)) * [x] Docs (specifically `docs/Config.md`) have been updated if necessary * [x] You've read through your own file changes for silly mistakes etc
This commit is contained in:
@ -318,7 +318,10 @@ func (self *BranchesController) promptToCheckoutWorktree(worktree *models.Worktr
|
||||
}
|
||||
|
||||
func (self *BranchesController) handleCreatePullRequest(selectedBranch *models.Branch) error {
|
||||
return self.createPullRequest(selectedBranch.Name, "")
|
||||
if !selectedBranch.IsTrackingRemote() {
|
||||
return self.c.ErrorMsg(self.c.Tr.PullRequestNoUpstream)
|
||||
}
|
||||
return self.createPullRequest(selectedBranch.UpstreamBranch, "")
|
||||
}
|
||||
|
||||
func (self *BranchesController) handleCreatePullRequestMenu(selectedBranch *models.Branch) error {
|
||||
@ -678,7 +681,7 @@ func (self *BranchesController) createPullRequestMenu(selectedBranch *models.Bra
|
||||
{
|
||||
LabelColumns: fromToLabelColumns(branch.Name, self.c.Tr.DefaultBranch),
|
||||
OnPress: func() error {
|
||||
return self.createPullRequest(branch.Name, "")
|
||||
return self.handleCreatePullRequest(branch)
|
||||
},
|
||||
},
|
||||
{
|
||||
@ -686,7 +689,7 @@ func (self *BranchesController) createPullRequestMenu(selectedBranch *models.Bra
|
||||
OnPress: func() error {
|
||||
return self.c.Prompt(types.PromptOpts{
|
||||
Title: branch.Name + " →",
|
||||
FindSuggestionsFunc: self.c.Helpers().Suggestions.GetBranchNameSuggestionsFunc(),
|
||||
FindSuggestionsFunc: self.c.Helpers().Suggestions.GetRemoteBranchesSuggestionsFunc("/"),
|
||||
HandleConfirm: func(targetBranchName string) error {
|
||||
return self.createPullRequest(branch.Name, targetBranchName)
|
||||
},
|
||||
@ -701,7 +704,10 @@ func (self *BranchesController) createPullRequestMenu(selectedBranch *models.Bra
|
||||
&types.MenuItem{
|
||||
LabelColumns: fromToLabelColumns(checkedOutBranch.Name, selectedBranch.Name),
|
||||
OnPress: func() error {
|
||||
return self.createPullRequest(checkedOutBranch.Name, selectedBranch.Name)
|
||||
if !checkedOutBranch.IsTrackingRemote() || !selectedBranch.IsTrackingRemote() {
|
||||
return self.c.ErrorMsg(self.c.Tr.PullRequestNoUpstream)
|
||||
}
|
||||
return self.createPullRequest(checkedOutBranch.UpstreamBranch, selectedBranch.UpstreamBranch)
|
||||
},
|
||||
},
|
||||
)
|
||||
|
Reference in New Issue
Block a user