diff options
author | Dennis Chen <barracks510@gmail.com> | 2016-07-30 11:02:22 -0400 |
---|---|---|
committer | 无闻 <u@gogs.io> | 2016-07-30 23:02:22 +0800 |
commit | dfab54d5a2739b3b2a1fe45481c2269d1aeec1a9 (patch) | |
tree | 28ee62bf282ef7117a1d499a821a2e1d8ca90052 /routers | |
parent | 3e22ae3412409caa6f1a456a59d9524f96a3dce2 (diff) | |
download | gitea-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.go | 11 |
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) { |