Skip to content

Commit fd35dc9

Browse files
committed
fix GetCommitPullRequest
1 parent 1b68fb9 commit fd35dc9

File tree

3 files changed

+48
-46
lines changed

3 files changed

+48
-46
lines changed

routers/api/v1/api.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1286,6 +1286,8 @@ func Routes() *web.Router {
12861286
m.Group("/{ref}", func() {
12871287
m.Get("/status", repo.GetCombinedCommitStatusByRef)
12881288
m.Get("/statuses", repo.GetCommitStatusesByRef)
1289+
}, context.ReferencesGitRepo())
1290+
m.Group("/{sha}", func() {
12891291
m.Get("/pull", repo.GetCommitPullRequest)
12901292
}, context.ReferencesGitRepo())
12911293
}, reqRepoReader(unit.TypeCode))

routers/api/v1/repo/commits.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ func DownloadCommitDiffOrPatch(ctx *context.APIContext) {
327327

328328
// GetCommitPullRequest returns the merged pull request of the commit
329329
func GetCommitPullRequest(ctx *context.APIContext) {
330-
// swagger:operation GET /repos/{owner}/{repo}/commits/{ref}/pull repository repoGetCommitPullRequest
330+
// swagger:operation GET /repos/{owner}/{repo}/commits/{sha}/pull repository repoGetCommitPullRequest
331331
// ---
332332
// summary: Get the merged pull request of the commit
333333
// produces:
@@ -343,7 +343,7 @@ func GetCommitPullRequest(ctx *context.APIContext) {
343343
// description: name of the repo
344344
// type: string
345345
// required: true
346-
// - name: ref
346+
// - name: sha
347347
// in: path
348348
// description: SHA of the commit to get
349349
// type: string
@@ -354,7 +354,7 @@ func GetCommitPullRequest(ctx *context.APIContext) {
354354
// "404":
355355
// "$ref": "#/responses/notFound"
356356

357-
pr, err := issues_model.GetPullRequestByMergedCommit(ctx, ctx.Repo.Repository.ID, ctx.PathParam("ref"))
357+
pr, err := issues_model.GetPullRequestByMergedCommit(ctx, ctx.Repo.Repository.ID, ctx.PathParam("sha"))
358358
if err != nil {
359359
if issues_model.IsErrPullRequestNotExist(err) {
360360
ctx.Error(http.StatusNotFound, "GetPullRequestByMergedCommit", err)

templates/swagger/v1_json.tmpl

Lines changed: 43 additions & 43 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)