summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUnknown <joe2010xtmf@163.com>2014-04-11 23:52:08 -0400
committerUnknown <joe2010xtmf@163.com>2014-04-11 23:52:08 -0400
commitd305448fa802a91ba81af1b78294f1658bcf834c (patch)
tree7bd274eb5c14c9d45c964e652b4c35d66de2cec9
parent3df8b2bef0f95f873e955840c6b12c3fe3dc9f8a (diff)
downloadgitea-d305448fa802a91ba81af1b78294f1658bcf834c.tar.gz
gitea-d305448fa802a91ba81af1b78294f1658bcf834c.zip
Mirror bug fix
-rw-r--r--models/repo.go6
-rw-r--r--modules/base/conf.go4
-rw-r--r--routers/install.go4
-rw-r--r--routers/repo/commit.go4
4 files changed, 12 insertions, 6 deletions
diff --git a/models/repo.go b/models/repo.go
index ce8665cc63..d01a716b50 100644
--- a/models/repo.go
+++ b/models/repo.go
@@ -192,8 +192,10 @@ func CreateRepository(user *User, repoName, desc, repoLang, license string, priv
return nil, err
}
- if err = NewRepoAction(user, repo); err != nil {
- log.Error("repo.CreateRepository(NewRepoAction): %v", err)
+ if !repo.IsPrivate {
+ if err = NewRepoAction(user, repo); err != nil {
+ log.Error("repo.CreateRepository(NewRepoAction): %v", err)
+ }
}
if err = WatchRepo(user.Id, repo.Id, true); err != nil {
diff --git a/modules/base/conf.go b/modules/base/conf.go
index 871595e476..d1564aa105 100644
--- a/modules/base/conf.go
+++ b/modules/base/conf.go
@@ -302,9 +302,9 @@ func NewConfigContext() {
InstallLock = Cfg.MustBool("security", "INSTALL_LOCK", false)
RunUser = Cfg.MustValue("", "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 InstallLock && RunUser != curUser {
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 5a7bb589f7..fed1a6badd 100644
--- a/routers/repo/commit.go
+++ b/routers/repo/commit.go
@@ -52,6 +52,10 @@ func Commits(ctx *middleware.Context, params martini.Params) {
//both `git log branchName` and `git log commitId` work
commits, err := models.GetCommitsByRange(repoPath, branchName, page)
+ if err != nil {
+ ctx.Handle(500, "repo.Commits(get commits)", err)
+ return
+ }
ctx.Data["Username"] = userName
ctx.Data["Reponame"] = repoName