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>
This commit is contained in:
parent
3e22ae3412
commit
dfab54d5a2
2 changed files with 56 additions and 3 deletions
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue