diff --git a/models/git.go b/models/git.go index f20e663b1..e32b5ba96 100644 --- a/models/git.go +++ b/models/git.go @@ -21,6 +21,7 @@ import ( "github.com/gogits/git" "github.com/gogits/gogs/modules/base" + "github.com/gogits/gogs/modules/log" ) // RepoFile represents a file object in git repository. @@ -300,6 +301,13 @@ func ParsePatch(reader io.Reader) (*Diff, error) { } i = i + 1 + + // Diff data too large. + if i == 5000 { + log.Warn("Diff data too large") + return &Diff{}, nil + } + if line == "" { continue } diff --git a/models/repo.go b/models/repo.go index ce8665cc6..d01a716b5 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 871595e47..d1564aa10 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/public/css/gogs.css b/public/css/gogs.css index 634548b8c..b9c7b6ae4 100755 --- a/public/css/gogs.css +++ b/public/css/gogs.css @@ -74,6 +74,7 @@ html, body { padding-left: 0; padding-right: 0; margin-right: 10px; + margin-top: 0; } .nav-item:hover, @@ -258,14 +259,40 @@ html, body { } #social-login { - margin-top: 30px; - padding-top: 20px; + margin-top: 40px; + padding-top: 40px; border-top: 1px solid #ccc; + position: relative; } #social-login .btn { float: none; - margin: auto; + margin: auto 4px; +} + +#social-login .btn .fa { + margin-left: 0; + margin-right: 4px; +} + +#social-login .btn span { + display: inline-block; + vertical-align: top; + font-size: 16px; + margin-top: 5px; +} + +#social-login h4 { + position: absolute; + top: -20px; + width: 100%; + text-align: center; + background-color: transparent; +} + +#social-login h4 span { + background-color: #FFF; + padding: 0 12px; } /* gogs-user-profile */ @@ -310,6 +337,22 @@ html, body { padding-right: 18px; } +#user-profile .profile-rel .col-md-6 { + text-align: center; + padding-bottom: 12px; +} + +#user-profile .profile-rel strong { + font-size: 24px; + color: #444; + display: block; +} + +#user-profile .profile-rel p { + margin-right: 0; + color: #888; +} + #user-activity .tab-pane { padding: 20px; } diff --git a/routers/install.go b/routers/install.go index 78ba383de..76c03f052 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 e6f6d7ed8..dbfd9af29 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) diff --git a/templates/repo/diff.tmpl b/templates/repo/diff.tmpl index a041284d0..796a8e94c 100644 --- a/templates/repo/diff.tmpl +++ b/templates/repo/diff.tmpl @@ -20,6 +20,9 @@ + {{if .DiffNotAvailable}} +
@@ -97,6 +100,7 @@
followers
+following
+