summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2016-03-21 10:49:46 -0400
committerUnknwon <u@gogs.io>2016-03-21 10:49:46 -0400
commit60ae8ac3d2995d46156ead8ad93004801daad4ce (patch)
tree274591915fc6d2a56067d83fdf329ff67c3270f2
parent004fb30ebe403625b2315b284a85124611ba303b (diff)
downloadgitea-60ae8ac3d2995d46156ead8ad93004801daad4ce.tar.gz
gitea-60ae8ac3d2995d46156ead8ad93004801daad4ce.zip
Add route for #2846
-rw-r--r--cmd/web.go3
-rw-r--r--gogs.go2
-rw-r--r--routers/repo/commit.go14
-rw-r--r--routers/repo/http.go2
-rw-r--r--templates/.VERSION2
5 files changed, 17 insertions, 6 deletions
diff --git a/cmd/web.go b/cmd/web.go
index b1d8b0fc84..1378cc3eca 100644
--- a/cmd/web.go
+++ b/cmd/web.go
@@ -520,9 +520,10 @@ func runWeb(ctx *cli.Context) {
m.Get("/src/*", repo.Home)
m.Get("/raw/*", repo.SingleDownload)
m.Get("/commits/*", repo.RefCommits)
- m.Get("/commit/*", repo.Diff)
+ m.Get("/commit/:sha([a-z0-9]{40})$", repo.Diff)
m.Get("/forks", repo.Forks)
}, context.RepoRef())
+ m.Get("/commit/:sha([a-z0-9]{40})\\.:ext(patch|diff)", repo.RawDiff)
m.Get("/compare/:before([a-z0-9]{40})\\.\\.\\.:after([a-z0-9]{40})", repo.CompareDiff)
}, ignSignIn, context.RepoAssignment(), repo.MustBeNotBare)
diff --git a/gogs.go b/gogs.go
index 43bc7a68b1..cc3c436ffe 100644
--- a/gogs.go
+++ b/gogs.go
@@ -17,7 +17,7 @@ import (
"github.com/gogits/gogs/modules/setting"
)
-const APP_VER = "0.9.13.0319"
+const APP_VER = "0.9.13.0321"
func init() {
runtime.GOMAXPROCS(runtime.NumCPU())
diff --git a/routers/repo/commit.go b/routers/repo/commit.go
index 97584c4d1a..16f7b63d40 100644
--- a/routers/repo/commit.go
+++ b/routers/repo/commit.go
@@ -148,9 +148,14 @@ func Diff(ctx *context.Context) {
userName := ctx.Repo.Owner.Name
repoName := ctx.Repo.Repository.Name
- commitID := ctx.Repo.CommitID
+ commitID := ctx.Params(":sha")
+
+ commit, err := ctx.Repo.GitRepo.GetCommit(commitID)
+ if err != nil {
+ ctx.Handle(500, "Repo.GitRepo.GetCommit", err)
+ return
+ }
- commit := ctx.Repo.Commit
diff, err := models.GetDiffCommit(models.RepoPath(userName, repoName),
commitID, setting.Git.MaxGitDiffLines)
if err != nil {
@@ -168,6 +173,7 @@ func Diff(ctx *context.Context) {
}
}
+ ctx.Data["CommitID"] = commitID
ctx.Data["IsSplitStyle"] = ctx.Query("style") == "split"
ctx.Data["Username"] = userName
ctx.Data["Reponame"] = repoName
@@ -187,6 +193,10 @@ func Diff(ctx *context.Context) {
ctx.HTML(200, DIFF)
}
+func RawDiff(ctx *context.Context) {
+ panic("not implemented")
+}
+
func CompareDiff(ctx *context.Context) {
ctx.Data["IsRepoToolbarCommits"] = true
ctx.Data["IsDiffCompare"] = true
diff --git a/routers/repo/http.go b/routers/repo/http.go
index b273b2334e..46e4508980 100644
--- a/routers/repo/http.go
+++ b/routers/repo/http.go
@@ -511,7 +511,7 @@ func gitCommand(gitBinPath, dir string, args ...string) []byte {
out, err := command.Output()
if err != nil {
- log.GitLogger.Error(4, err.Error())
+ log.GitLogger.Error(4, fmt.Sprintf("%v - %s", err, out))
}
return out
diff --git a/templates/.VERSION b/templates/.VERSION
index 6a20966ed1..f983a7d616 100644
--- a/templates/.VERSION
+++ b/templates/.VERSION
@@ -1 +1 @@
-0.9.13.0319 \ No newline at end of file
+0.9.13.0321 \ No newline at end of file