diff options
author | 6543 <6543@obermui.de> | 2022-04-25 20:45:18 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-25 20:45:18 +0200 |
commit | 1ebb30e41bf3b44404d7d03a5541729762c226b5 (patch) | |
tree | e549366c1166082c22784b85633a90d5dd56e91f /routers/api/v1/repo | |
parent | 7c164d5a918c2461bbdf2a1ef79a20908c3259be (diff) | |
download | gitea-1ebb30e41bf3b44404d7d03a5541729762c226b5.tar.gz gitea-1ebb30e41bf3b44404d7d03a5541729762c226b5.zip |
Pass gitRepo down to GetRawDiff, since its used for main repo and wiki (#19461)
as per https://github.com/go-gitea/gitea/pull/19449#issuecomment-1105283931
pass gitRepo down to GetRawDiff, since its used for main repo and wiki
Diffstat (limited to 'routers/api/v1/repo')
-rw-r--r-- | routers/api/v1/repo/commits.go | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/routers/api/v1/repo/commits.go b/routers/api/v1/repo/commits.go index c79c34ec42..b196ce9774 100644 --- a/routers/api/v1/repo/commits.go +++ b/routers/api/v1/repo/commits.go @@ -11,7 +11,6 @@ import ( "net/http" "strconv" - repo_model "code.gitea.io/gitea/models/repo" user_model "code.gitea.io/gitea/models/user" "code.gitea.io/gitea/modules/context" "code.gitea.io/gitea/modules/convert" @@ -268,17 +267,12 @@ func DownloadCommitDiffOrPatch(ctx *context.APIContext) { // "$ref": "#/responses/string" // "404": // "$ref": "#/responses/notFound" - repoPath := repo_model.RepoPath(ctx.Repo.Owner.Name, ctx.Repo.Repository.Name) - // TODO: use gitRepo from context - if err := git.GetRawDiff( - ctx, - repoPath, - ctx.Params(":sha"), - git.RawDiffType(ctx.Params(":diffType")), - ctx.Resp, - ); err != nil { + sha := ctx.Params(":sha") + diffType := git.RawDiffType(ctx.Params(":diffType")) + + if err := git.GetRawDiff(ctx.Repo.GitRepo, sha, diffType, ctx.Resp); err != nil { if git.IsErrNotExist(err) { - ctx.NotFound(ctx.Params(":sha")) + ctx.NotFound(sha) return } ctx.Error(http.StatusInternalServerError, "DownloadCommitDiffOrPatch", err) |