mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-21 08:31:27 -05:00
api: The repo wiki APIs should respect WikiBranch
Back in #2264, we made it possible to change the branch wikis use from the hardcoded "master" branch to `[repository].DEFAULT_BRANCH`. However, the API endpoints were not updated, and the "master" branch remained hardcoded there. This change fixes that, the API endpoints will now respect the repository's `WikiBranch`. Fixes #3391. Signed-off-by: Gergely Nagy <forgejo@gergo.csillger.hu>
This commit is contained in:
parent
e7fcf3f189
commit
c647e8639f
1 changed files with 4 additions and 4 deletions
|
@ -193,7 +193,7 @@ func getWikiPage(ctx *context.APIContext, wikiName wiki_service.WebPath) *api.Wi
|
|||
}
|
||||
|
||||
// get commit count - wiki revisions
|
||||
commitsCount, _ := wikiRepo.FileCommitsCount("master", pageFilename)
|
||||
commitsCount, _ := wikiRepo.FileCommitsCount(ctx.Repo.Repository.GetWikiBranchName(), pageFilename)
|
||||
|
||||
// Get last change information.
|
||||
lastCommit, err := wikiRepo.GetCommitByPath(pageFilename)
|
||||
|
@ -432,7 +432,7 @@ func ListPageRevisions(ctx *context.APIContext) {
|
|||
}
|
||||
|
||||
// get commit count - wiki revisions
|
||||
commitsCount, _ := wikiRepo.FileCommitsCount("master", pageFilename)
|
||||
commitsCount, _ := wikiRepo.FileCommitsCount(ctx.Repo.Repository.GetWikiBranchName(), pageFilename)
|
||||
|
||||
page := ctx.FormInt("page")
|
||||
if page <= 1 {
|
||||
|
@ -442,7 +442,7 @@ func ListPageRevisions(ctx *context.APIContext) {
|
|||
// get Commit Count
|
||||
commitsHistory, err := wikiRepo.CommitsByFileAndRange(
|
||||
git.CommitsByFileAndRangeOptions{
|
||||
Revision: "master",
|
||||
Revision: ctx.Repo.Repository.GetWikiBranchName(),
|
||||
File: pageFilename,
|
||||
Page: page,
|
||||
})
|
||||
|
@ -487,7 +487,7 @@ func findWikiRepoCommit(ctx *context.APIContext) (*git.Repository, *git.Commit)
|
|||
return nil, nil
|
||||
}
|
||||
|
||||
commit, err := wikiRepo.GetBranchCommit("master")
|
||||
commit, err := wikiRepo.GetBranchCommit(ctx.Repo.Repository.GetWikiBranchName())
|
||||
if err != nil {
|
||||
if git.IsErrNotExist(err) {
|
||||
ctx.NotFound(err)
|
||||
|
|
Loading…
Reference in a new issue