//Use git cli command for windows | //Use git cli command for windows | ||||
runCmd("git", "fetch", remoteUpstream, fmt.Sprintf("pull/%s/head:%s", pr, branch)) | runCmd("git", "fetch", remoteUpstream, fmt.Sprintf("pull/%s/head:%s", pr, branch)) | ||||
} else { | } else { | ||||
ref := fmt.Sprintf(gitea_git.PullPrefix+"%s/head:%s", pr, branchRef) | |||||
ref := fmt.Sprintf("%s%s/head:%s", gitea_git.PullPrefix, pr, branchRef) | |||||
err = repo.Fetch(&git.FetchOptions{ | err = repo.Fetch(&git.FetchOptions{ | ||||
RemoteName: remoteUpstream, | RemoteName: remoteUpstream, | ||||
RefSpecs: []config.RefSpec{ | RefSpecs: []config.RefSpec{ |
// GetGitRefName returns git ref for hidden pull request branch | // GetGitRefName returns git ref for hidden pull request branch | ||||
func (pr *PullRequest) GetGitRefName() string { | func (pr *PullRequest) GetGitRefName() string { | ||||
return fmt.Sprintf(git.PullPrefix+"%d/head", pr.Index) | |||||
return fmt.Sprintf("%s%d/head", git.PullPrefix, pr.Index) | |||||
} | } | ||||
// IsChecking returns true if this pull request is still checking conflict. | // IsChecking returns true if this pull request is still checking conflict. |
}, | }, | ||||
Head: &api.PRBranchInfo{ | Head: &api.PRBranchInfo{ | ||||
Name: pr.HeadBranch, | Name: pr.HeadBranch, | ||||
Ref: fmt.Sprintf(git.PullPrefix+"%d/head", pr.Index), | |||||
Ref: fmt.Sprintf("%s%d/head", git.PullPrefix, pr.Index), | |||||
RepoID: -1, | RepoID: -1, | ||||
}, | }, | ||||
} | } |
// GetGitRefName returns pull request relative path to head | // GetGitRefName returns pull request relative path to head | ||||
func (p PullRequest) GetGitRefName() string { | func (p PullRequest) GetGitRefName() string { | ||||
return fmt.Sprintf(git.PullPrefix+"%d/head", p.Number) | |||||
return fmt.Sprintf("%s%d/head", git.PullPrefix, p.Number) | |||||
} | } | ||||
// PullRequestBranch represents a pull request branch | // PullRequestBranch represents a pull request branch |