summaryrefslogtreecommitdiffstats
path: root/routers
diff options
context:
space:
mode:
authorDennis Chen <barracks510@gmail.com>2016-07-30 11:02:22 -0400
committer无闻 <u@gogs.io>2016-07-30 23:02:22 +0800
commitdfab54d5a2739b3b2a1fe45481c2269d1aeec1a9 (patch)
tree28ee62bf282ef7117a1d499a821a2e1d8ca90052 /routers
parent3e22ae3412409caa6f1a456a59d9524f96a3dce2 (diff)
downloadgitea-dfab54d5a2739b3b2a1fe45481c2269d1aeec1a9.tar.gz
gitea-dfab54d5a2739b3b2a1fe45481c2269d1aeec1a9.zip
Diff patch (#3345)
* Add support for .diff and .patch Add the ability to get text-diff and format-patch by adding .diff or .patch in the end of a commit url. Issue #2641 * models: git_diff: various fixes * Renames commitId to commitID. * Writes stderr to a bytes.Buffer and displays proper error message on command failure. * Various style changes. Signed-off-by: Dennis Chen <barracks510@gmail.com>
Diffstat (limited to 'routers')
-rw-r--r--routers/repo/commit.go11
1 files changed, 10 insertions, 1 deletions
diff --git a/routers/repo/commit.go b/routers/repo/commit.go
index 436a06ee9b..779fd644d3 100644
--- a/routers/repo/commit.go
+++ b/routers/repo/commit.go
@@ -195,7 +195,16 @@ func Diff(ctx *context.Context) {
}
func RawDiff(ctx *context.Context) {
- panic("not implemented")
+ diff, err := models.GetRawDiff(
+ models.RepoPath(ctx.Repo.Owner.Name, ctx.Repo.Repository.Name),
+ ctx.Params(":sha"),
+ ctx.Params(":ext"),
+ )
+ if err != nil {
+ ctx.Handle(404, "GetRawDiff", err)
+ return
+ }
+ ctx.HandleText(200, diff)
}
func CompareDiff(ctx *context.Context) {