diff options
author | Meaglith Ma <genedna@gmail.com> | 2014-03-31 17:23:37 +0800 |
---|---|---|
committer | Meaglith Ma <genedna@gmail.com> | 2014-03-31 17:23:37 +0800 |
commit | 1a247340dbea3404431f60a24bb8f8d06d94b1e9 (patch) | |
tree | 80d3ecab43506e03405c742a84dcc61f474e2212 /routers/repo/commit.go | |
parent | 9047cadcd33f95eebafa2f794b895c8406eb80c5 (diff) | |
parent | dd9fb807a46db120ef800d7465f50a73a86df288 (diff) |
Merge pull request #1 from gogits/master
Sync to lastest
Diffstat (limited to 'routers/repo/commit.go')
-rw-r--r-- | routers/repo/commit.go | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/routers/repo/commit.go b/routers/repo/commit.go index afc1ffda..d29c40e6 100644 --- a/routers/repo/commit.go +++ b/routers/repo/commit.go @@ -8,7 +8,7 @@ import ( "container/list" "path" - "github.com/codegangsta/martini" + "github.com/go-martini/martini" "github.com/gogits/gogs/models" "github.com/gogits/gogs/modules/base" @@ -50,16 +50,12 @@ func Commits(ctx *middleware.Context, params martini.Params) { } func Diff(ctx *middleware.Context, params martini.Params) { - userName := params["username"] - repoName := params["reponame"] - branchName := params["branchname"] - commitId := params["commitid"] + userName := ctx.Repo.Owner.Name + repoName := ctx.Repo.Repository.Name + branchName := ctx.Repo.BranchName + commitId := ctx.Repo.CommitId - commit, err := models.GetCommit(userName, repoName, branchName, commitId) - if err != nil { - ctx.Handle(404, "repo.Diff", err) - return - } + commit := ctx.Repo.Commit diff, err := models.GetDiff(models.RepoPath(userName, repoName), commitId) if err != nil { @@ -85,11 +81,9 @@ func Diff(ctx *middleware.Context, params martini.Params) { return isImage } - shortSha := params["commitid"][:10] ctx.Data["IsImageFile"] = isImageFile - ctx.Data["Title"] = commit.Message() + " · " + shortSha + ctx.Data["Title"] = commit.Message() + " · " + base.ShortSha(commitId) ctx.Data["Commit"] = commit - ctx.Data["ShortSha"] = shortSha ctx.Data["Diff"] = diff ctx.Data["IsRepoToolbarCommits"] = true ctx.Data["SourcePath"] = "/" + path.Join(userName, repoName, "src", commitId) |