diff options
author | skyblue <ssx205@gmail.com> | 2014-04-12 23:19:22 +0800 |
---|---|---|
committer | skyblue <ssx205@gmail.com> | 2014-04-12 23:19:22 +0800 |
commit | f92851e347c6db6468555373bd43c7b507c5fce9 (patch) | |
tree | 1eaa45ea5e973edd4f6b39fd92c0a0b4f36b98d5 /routers | |
parent | 2ce0c3befef3becd48660e600ef70e8affd5bc7c (diff) | |
parent | 802a110e4255d0860c3942feffd23b2376c75eb7 (diff) | |
download | gitea-f92851e347c6db6468555373bd43c7b507c5fce9.tar.gz gitea-f92851e347c6db6468555373bd43c7b507c5fce9.zip |
Merge branch 'dev' of github.com:gogits/gogs into dev
Diffstat (limited to 'routers')
-rw-r--r-- | routers/install.go | 4 | ||||
-rw-r--r-- | routers/repo/commit.go | 13 |
2 files changed, 6 insertions, 11 deletions
diff --git a/routers/install.go b/routers/install.go index 78ba383dee..76c03f0529 100644 --- a/routers/install.go +++ b/routers/install.go @@ -146,9 +146,9 @@ func InstallPost(ctx *middleware.Context, form auth.InstallForm) { } // Check run user. - curUser := os.Getenv("USERNAME") + curUser := os.Getenv("USER") if len(curUser) == 0 { - curUser = os.Getenv("USER") + curUser = os.Getenv("USERNAME") } // Does not check run user when the install lock is off. if form.RunUser != curUser { diff --git a/routers/repo/commit.go b/routers/repo/commit.go index e6f6d7ed89..dbfd9af297 100644 --- a/routers/repo/commit.go +++ b/routers/repo/commit.go @@ -50,16 +50,10 @@ func Commits(ctx *middleware.Context, params martini.Params) { nextPage = 0 } - var commits *list.List - if models.IsBranchExist(userName, repoName, branchName) { - // commits, err = models.GetCommitsByBranch(userName, repoName, branchName) - commits, err = models.GetCommitsByRange(repoPath, branchName, page) - } else { - commits, err = models.GetCommitsByCommitId(userName, repoName, branchName) - } - + //both `git log branchName` and `git log commitId` work + commits, err := models.GetCommitsByRange(repoPath, branchName, page) if err != nil { - ctx.Handle(404, "repo.Commits(get commits)", err) + ctx.Handle(500, "repo.Commits(get commits)", err) return } @@ -109,6 +103,7 @@ func Diff(ctx *middleware.Context, params martini.Params) { ctx.Data["Title"] = commit.Message() + " ยท " + base.ShortSha(commitId) ctx.Data["Commit"] = commit ctx.Data["Diff"] = diff + ctx.Data["DiffNotAvailable"] = diff.NumFiles() == 0 ctx.Data["IsRepoToolbarCommits"] = true ctx.Data["SourcePath"] = "/" + path.Join(userName, repoName, "src", commitId) ctx.Data["RawPath"] = "/" + path.Join(userName, repoName, "raw", commitId) |