0
0
Fork 0
mirror of https://github.com/go-gitea/gitea synced 2024-11-21 22:51:10 +01:00

Use fmt.Sprintf correctly (#17886)

This commit is contained in:
delvh 2021-12-02 20:36:50 +01:00 committed by GitHub
parent fbf3208229
commit 4646c7c52d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 4 additions and 4 deletions

View file

@ -215,7 +215,7 @@ func main() {
//Use git cli command for windows
runCmd("git", "fetch", remoteUpstream, fmt.Sprintf("pull/%s/head:%s", pr, branch))
} 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{
RemoteName: remoteUpstream,
RefSpecs: []config.RefSpec{

View file

@ -350,7 +350,7 @@ func (pr *PullRequest) GetDefaultSquashMessage() string {
// GetGitRefName returns git ref for hidden pull request branch
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.

View file

@ -79,7 +79,7 @@ func ToAPIPullRequest(pr *models.PullRequest, doer *user_model.User) *api.PullRe
},
Head: &api.PRBranchInfo{
Name: pr.HeadBranch,
Ref: fmt.Sprintf(git.PullPrefix+"%d/head", pr.Index),
Ref: fmt.Sprintf("%s%d/head", git.PullPrefix, pr.Index),
RepoID: -1,
},
}

View file

@ -45,7 +45,7 @@ func (p *PullRequest) IsForkPullRequest() bool {
// GetGitRefName returns pull request relative path to head
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