Skip to content

Commit f92851e

Browse files
committed
Merge branch 'dev' of github.com:gogits/gogs into dev
2 parents 2ce0c3b + 802a110 commit f92851e

File tree

9 files changed

+103
-24
lines changed

9 files changed

+103
-24
lines changed

models/git.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import (
2121
"github.com/gogits/git"
2222

2323
"github.com/gogits/gogs/modules/base"
24+
"github.com/gogits/gogs/modules/log"
2425
)
2526

2627
// RepoFile represents a file object in git repository.
@@ -300,6 +301,13 @@ func ParsePatch(reader io.Reader) (*Diff, error) {
300301
}
301302

302303
i = i + 1
304+
305+
// Diff data too large.
306+
if i == 5000 {
307+
log.Warn("Diff data too large")
308+
return &Diff{}, nil
309+
}
310+
303311
if line == "" {
304312
continue
305313
}

models/repo.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,8 +192,10 @@ func CreateRepository(user *User, repoName, desc, repoLang, license string, priv
192192
return nil, err
193193
}
194194

195-
if err = NewRepoAction(user, repo); err != nil {
196-
log.Error("repo.CreateRepository(NewRepoAction): %v", err)
195+
if !repo.IsPrivate {
196+
if err = NewRepoAction(user, repo); err != nil {
197+
log.Error("repo.CreateRepository(NewRepoAction): %v", err)
198+
}
197199
}
198200

199201
if err = WatchRepo(user.Id, repo.Id, true); err != nil {

modules/base/conf.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -302,9 +302,9 @@ func NewConfigContext() {
302302
InstallLock = Cfg.MustBool("security", "INSTALL_LOCK", false)
303303

304304
RunUser = Cfg.MustValue("", "RUN_USER")
305-
curUser := os.Getenv("USERNAME")
305+
curUser := os.Getenv("USER")
306306
if len(curUser) == 0 {
307-
curUser = os.Getenv("USER")
307+
curUser = os.Getenv("USERNAME")
308308
}
309309
// Does not check run user when the install lock is off.
310310
if InstallLock && RunUser != curUser {

public/css/gogs.css

Lines changed: 46 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ html, body {
7474
padding-left: 0;
7575
padding-right: 0;
7676
margin-right: 10px;
77+
margin-top: 0;
7778
}
7879

7980
.nav-item:hover,
@@ -258,14 +259,40 @@ html, body {
258259
}
259260

260261
#social-login {
261-
margin-top: 30px;
262-
padding-top: 20px;
262+
margin-top: 40px;
263+
padding-top: 40px;
263264
border-top: 1px solid #ccc;
265+
position: relative;
264266
}
265267

266268
#social-login .btn {
267269
float: none;
268-
margin: auto;
270+
margin: auto 4px;
271+
}
272+
273+
#social-login .btn .fa {
274+
margin-left: 0;
275+
margin-right: 4px;
276+
}
277+
278+
#social-login .btn span {
279+
display: inline-block;
280+
vertical-align: top;
281+
font-size: 16px;
282+
margin-top: 5px;
283+
}
284+
285+
#social-login h4 {
286+
position: absolute;
287+
top: -20px;
288+
width: 100%;
289+
text-align: center;
290+
background-color: transparent;
291+
}
292+
293+
#social-login h4 span {
294+
background-color: #FFF;
295+
padding: 0 12px;
269296
}
270297

271298
/* gogs-user-profile */
@@ -310,6 +337,22 @@ html, body {
310337
padding-right: 18px;
311338
}
312339

340+
#user-profile .profile-rel .col-md-6 {
341+
text-align: center;
342+
padding-bottom: 12px;
343+
}
344+
345+
#user-profile .profile-rel strong {
346+
font-size: 24px;
347+
color: #444;
348+
display: block;
349+
}
350+
351+
#user-profile .profile-rel p {
352+
margin-right: 0;
353+
color: #888;
354+
}
355+
313356
#user-activity .tab-pane {
314357
padding: 20px;
315358
}

routers/install.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,9 +146,9 @@ func InstallPost(ctx *middleware.Context, form auth.InstallForm) {
146146
}
147147

148148
// Check run user.
149-
curUser := os.Getenv("USERNAME")
149+
curUser := os.Getenv("USER")
150150
if len(curUser) == 0 {
151-
curUser = os.Getenv("USER")
151+
curUser = os.Getenv("USERNAME")
152152
}
153153
// Does not check run user when the install lock is off.
154154
if form.RunUser != curUser {

routers/repo/commit.go

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,16 +50,10 @@ func Commits(ctx *middleware.Context, params martini.Params) {
5050
nextPage = 0
5151
}
5252

53-
var commits *list.List
54-
if models.IsBranchExist(userName, repoName, branchName) {
55-
// commits, err = models.GetCommitsByBranch(userName, repoName, branchName)
56-
commits, err = models.GetCommitsByRange(repoPath, branchName, page)
57-
} else {
58-
commits, err = models.GetCommitsByCommitId(userName, repoName, branchName)
59-
}
60-
53+
//both `git log branchName` and `git log commitId` work
54+
commits, err := models.GetCommitsByRange(repoPath, branchName, page)
6155
if err != nil {
62-
ctx.Handle(404, "repo.Commits(get commits)", err)
56+
ctx.Handle(500, "repo.Commits(get commits)", err)
6357
return
6458
}
6559

@@ -109,6 +103,7 @@ func Diff(ctx *middleware.Context, params martini.Params) {
109103
ctx.Data["Title"] = commit.Message() + " · " + base.ShortSha(commitId)
110104
ctx.Data["Commit"] = commit
111105
ctx.Data["Diff"] = diff
106+
ctx.Data["DiffNotAvailable"] = diff.NumFiles() == 0
112107
ctx.Data["IsRepoToolbarCommits"] = true
113108
ctx.Data["SourcePath"] = "/" + path.Join(userName, repoName, "src", commitId)
114109
ctx.Data["RawPath"] = "/" + path.Join(userName, repoName, "raw", commitId)

templates/repo/diff.tmpl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@
2020
</div>
2121
</div>
2222

23+
{{if .DiffNotAvailable}}
24+
<h4>Diff Data Not Available.</h4>
25+
{{else}}
2326
<div class="diff-detail-box diff-box">
2427
<a class="pull-right btn btn-default" data-toggle="collapse" data-target="#diff-files">Show Diff Stats</a>
2528
<p class="showing">
@@ -97,6 +100,7 @@
97100
</div>
98101
</div>
99102
{{end}}
103+
{{end}}
100104
</div>
101105
</div>
102106
{{template "base/footer" .}}

templates/user/profile.tmpl

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,18 @@
1010
</div>
1111
<div class="profile-info">
1212
<ul class="list-group">
13+
<li class="list-group-item">
14+
<div class="profile-rel">
15+
<div class="col-md-6 followers">
16+
<strong>123</strong>
17+
<p>followers</p>
18+
</div>
19+
<div class="col-md-6 following">
20+
<strong>123</strong>
21+
<p>following</p>
22+
</div>
23+
</div>
24+
</li>
1325
{{if .Owner.Location}}
1426
<li class="list-group-item"><i class="fa fa-thumb-tack"></i>{{.Owner.Location}}</li>
1527
{{end}}

templates/user/signin.tmpl

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
<form action="/user/login" method="post" class="form-horizontal card" id="login-card">
55
{{.CsrfTokenHtml}}
66
<h3>Log in
7-
{{if .OauthEnabled}}
7+
<!--{{if .OauthEnabled}}
88
<small class="pull-right">social login:
99
{{if .OauthGitHubEnabled}}
1010
<a href="/user/login/github?next=/user/sign_up"><i class="fa fa-github-square fa-2x"></i></a>
1111
{{end}}
1212
</small>
13-
{{end}}
13+
{{end}}-->
1414
</h3>
1515
{{template "base/alert" .}}
1616
<div class="form-group {{if .Err_UserName}}has-error has-feedback{{end}}">
@@ -51,12 +51,27 @@
5151
</div>
5252
</div>
5353

54-
<!-- {{if .OauthEnabled}}
54+
{{if .OauthEnabled}}
5555
<div class="form-group text-center" id="social-login">
56-
<h4>Log In with Social Accounts</h4>
57-
{{if .OauthGitHubEnabled}}<a href="/user/login/github?next=/user/sign_up"><i class="fa fa-github-square fa-3x"></i></a>{{end}}
56+
<h4><span>or</span></h4>
57+
<!--<a href="/user/login/github?next=/user/sign_up" class="btn btn-default google">
58+
<i class="fa fa-google-plus-square fa-2x"></i>
59+
<span>Google</span>
60+
</a>
61+
<a href="/user/login/github?next=/user/sign_up" class="btn btn-default facebbok">
62+
<i class="fa fa-facebook-square fa-2x"></i>
63+
<span>Facebook</span>
64+
</a>
65+
<a href="/user/login/github?next=/user/sign_up" class="btn btn-default weibo">
66+
<i class="fa fa-weibo fa-2x"></i>
67+
<span>Weibo</span>
68+
</a>-->
69+
{{if .OauthGitHubEnabled}}<a href="/user/login/github?next=/user/sign_up" class="github btn btn-default">
70+
<i class="fa fa-github-square fa-2x"></i>
71+
<span>GitHub</span>
72+
</a>{{end}}
5873
</div>
59-
{{end}} -->
74+
{{end}}
6075
</form>
6176
</div>
6277
{{template "base/footer" .}}

0 commit comments

Comments
 (0)