mirror of
https://gitea.com/gitea/tea.git
synced 2025-09-01 09:28:30 +02:00
Find DefaultPRHead based on branch and SHA (#514)
Reviewed-on: https://gitea.com/gitea/tea/pulls/514 Reviewed-by: strk <strk@noreply.gitea.io> Reviewed-by: Norwin <noerw@noreply.gitea.io>
This commit is contained in:
@ -99,11 +99,12 @@ func GetDefaultPRBase(login *config.Login, owner, repo string) (string, error) {
|
||||
// that has a branch with the same name, and extracts the owner from its URL.
|
||||
// If no remote matches, owner is empty, meaning same as head repo owner.
|
||||
func GetDefaultPRHead(localRepo *local_git.TeaRepo) (owner, branch string, err error) {
|
||||
if branch, err = localRepo.TeaGetCurrentBranchName(); err != nil {
|
||||
var sha string
|
||||
if branch, sha, err = localRepo.TeaGetCurrentBranchNameAndSHA(); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
remote, err := localRepo.TeaFindBranchRemote(branch, "")
|
||||
remote, err := localRepo.TeaFindBranchRemote(branch, sha)
|
||||
if err != nil {
|
||||
err = fmt.Errorf("could not determine remote for current branch: %s", err)
|
||||
return
|
||||
|
Reference in New Issue
Block a user