Skip to content

Commit c5888eb

Browse files
authored
Set commit id when ref used explicitly (#26447)
In the `RepoRefForAPI()` context function `CommitID` is not set if `ref` is used. It is set correctly for other if/else branches where `Commit` is set. It doesn't appear that any routes that use `RepoRefForAPI()` also use `CommitID` but that may be the case in the future. ## Changes - Sets `ctx.Repo.CommitID` when `ref` is explicitly used for api routes that use `RepoRefForAPI()`
1 parent 9fc68b6 commit c5888eb

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

modules/context/api.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,7 @@ func RepoRefForAPI(next http.Handler) http.Handler {
340340
return
341341
}
342342
ctx.Repo.Commit = commit
343+
ctx.Repo.CommitID = ctx.Repo.Commit.ID.String()
343344
ctx.Repo.TreePath = ctx.Params("*")
344345
next.ServeHTTP(w, req)
345346
return

0 commit comments

Comments
 (0)