summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorskyblue <ssx205@gmail.com>2014-04-12 23:19:22 +0800
committerskyblue <ssx205@gmail.com>2014-04-12 23:19:22 +0800
commitf92851e347c6db6468555373bd43c7b507c5fce9 (patch)
tree1eaa45ea5e973edd4f6b39fd92c0a0b4f36b98d5
parent2ce0c3befef3becd48660e600ef70e8affd5bc7c (diff)
parent802a110e4255d0860c3942feffd23b2376c75eb7 (diff)
downloadgitea-f92851e347c6db6468555373bd43c7b507c5fce9.tar.gz
gitea-f92851e347c6db6468555373bd43c7b507c5fce9.zip
Merge branch 'dev' of github.com:gogits/gogs into dev
-rw-r--r--models/git.go8
-rw-r--r--models/repo.go6
-rw-r--r--modules/base/conf.go4
-rwxr-xr-xpublic/css/gogs.css49
-rw-r--r--routers/install.go4
-rw-r--r--routers/repo/commit.go13
-rw-r--r--templates/repo/diff.tmpl4
-rw-r--r--templates/user/profile.tmpl12
-rw-r--r--templates/user/signin.tmpl27
9 files changed, 103 insertions, 24 deletions
diff --git a/models/git.go b/models/git.go
index f20e663b1b..e32b5ba96e 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 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/public/css/gogs.css b/public/css/gogs.css
index 634548b8c8..b9c7b6ae49 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 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)
diff --git a/templates/repo/diff.tmpl b/templates/repo/diff.tmpl
index a041284d00..796a8e94c3 100644
--- a/templates/repo/diff.tmpl
+++ b/templates/repo/diff.tmpl
@@ -20,6 +20,9 @@
</div>
</div>
+ {{if .DiffNotAvailable}}
+ <h4>Diff Data Not Available.</h4>
+ {{else}}
<div class="diff-detail-box diff-box">
<a class="pull-right btn btn-default" data-toggle="collapse" data-target="#diff-files">Show Diff Stats</a>
<p class="showing">
@@ -97,6 +100,7 @@
</div>
</div>
{{end}}
+ {{end}}
</div>
</div>
{{template "base/footer" .}}
diff --git a/templates/user/profile.tmpl b/templates/user/profile.tmpl
index 88ee318f4a..0cbd348910 100644
--- a/templates/user/profile.tmpl
+++ b/templates/user/profile.tmpl
@@ -10,6 +10,18 @@
</div>
<div class="profile-info">
<ul class="list-group">
+ <li class="list-group-item">
+ <div class="profile-rel">
+ <div class="col-md-6 followers">
+ <strong>123</strong>
+ <p>followers</p>
+ </div>
+ <div class="col-md-6 following">
+ <strong>123</strong>
+ <p>following</p>
+ </div>
+ </div>
+ </li>
{{if .Owner.Location}}
<li class="list-group-item"><i class="fa fa-thumb-tack"></i>{{.Owner.Location}}</li>
{{end}}
diff --git a/templates/user/signin.tmpl b/templates/user/signin.tmpl
index 6ccad79e73..4ea4173801 100644
--- a/templates/user/signin.tmpl
+++ b/templates/user/signin.tmpl
@@ -4,13 +4,13 @@
<form action="/user/login" method="post" class="form-horizontal card" id="login-card">
{{.CsrfTokenHtml}}
<h3>Log in
- {{if .OauthEnabled}}
+ <!--{{if .OauthEnabled}}
<small class="pull-right">social login:
{{if .OauthGitHubEnabled}}
<a href="/user/login/github?next=/user/sign_up"><i class="fa fa-github-square fa-2x"></i></a>
{{end}}
</small>
- {{end}}
+ {{end}}-->
</h3>
{{template "base/alert" .}}
<div class="form-group {{if .Err_UserName}}has-error has-feedback{{end}}">
@@ -51,12 +51,27 @@
</div>
</div>
- <!-- {{if .OauthEnabled}}
+ {{if .OauthEnabled}}
<div class="form-group text-center" id="social-login">
- <h4>Log In with Social Accounts</h4>
- {{if .OauthGitHubEnabled}}<a href="/user/login/github?next=/user/sign_up"><i class="fa fa-github-square fa-3x"></i></a>{{end}}
+ <h4><span>or</span></h4>
+ <!--<a href="/user/login/github?next=/user/sign_up" class="btn btn-default google">
+ <i class="fa fa-google-plus-square fa-2x"></i>
+ <span>Google</span>
+ </a>
+ <a href="/user/login/github?next=/user/sign_up" class="btn btn-default facebbok">
+ <i class="fa fa-facebook-square fa-2x"></i>
+ <span>Facebook</span>
+ </a>
+ <a href="/user/login/github?next=/user/sign_up" class="btn btn-default weibo">
+ <i class="fa fa-weibo fa-2x"></i>
+ <span>Weibo</span>
+ </a>-->
+ {{if .OauthGitHubEnabled}}<a href="/user/login/github?next=/user/sign_up" class="github btn btn-default">
+ <i class="fa fa-github-square fa-2x"></i>
+ <span>GitHub</span>
+ </a>{{end}}
</div>
- {{end}} -->
+ {{end}}
</form>
</div>
{{template "base/footer" .}}