Browse Source

fix bool check for repo max limit and fix hang when push repo with tons of commits

Unknwon 4 years ago
parent
commit
99e9bbef6c
6 changed files with 8 additions and 9 deletions
  1. 1 1
      README.md
  2. 1 1
      gogs.go
  3. 0 4
      models/action.go
  4. 2 2
      models/update.go
  5. 3 0
      models/user.go
  6. 1 1
      templates/.VERSION

+ 1 - 1
README.md

@@ -5,7 +5,7 @@ Gogs - Go Git Service [![Build Status](https://travis-ci.org/gogits/gogs.svg?bra
5 5
 
6 6
 ![](public/img/gogs-large-resize.png)
7 7
 
8
-##### Current version: 0.7.39 Beta
8
+##### Current version: 0.7.40 Beta
9 9
 
10 10
 | Web | UI  | Preview  |
11 11
 |:-------------:|:-------:|:-------:|

+ 1 - 1
gogs.go

@@ -18,7 +18,7 @@ import (
18 18
 	"github.com/gogits/gogs/modules/setting"
19 19
 )
20 20
 
21
-const APP_VER = "0.7.39.1210 Beta"
21
+const APP_VER = "0.7.40.1210 Beta"
22 22
 
23 23
 func init() {
24 24
 	runtime.GOMAXPROCS(runtime.NumCPU())

+ 0 - 4
models/action.go

@@ -440,10 +440,6 @@ func CommitRepoAction(
440 440
 			isNewBranch = true
441 441
 		}
442 442
 
443
-		// NOTE: limit to detect latest 100 commits.
444
-		if len(commit.Commits) > 100 {
445
-			commit.Commits = commit.Commits[len(commit.Commits)-100:]
446
-		}
447 443
 		if err = updateIssuesCommit(u, repo, repoUserName, repoName, commit.Commits); err != nil {
448 444
 			log.Error(4, "updateIssuesCommit: %v", err)
449 445
 		}

+ 2 - 2
models/update.go

@@ -10,7 +10,7 @@ import (
10 10
 	"os/exec"
11 11
 	"strings"
12 12
 
13
-	"github.com/gogits/git-shell"
13
+	git "github.com/gogits/git-shell"
14 14
 
15 15
 	"github.com/gogits/gogs/modules/log"
16 16
 )
@@ -135,7 +135,7 @@ func Update(refName, oldCommitID, newCommitID, userName, repoUserName, repoName
135 135
 	// Push new branch.
136 136
 	var l *list.List
137 137
 	if isNew {
138
-		l, err = newCommit.CommitsBefore()
138
+		l, err = newCommit.CommitsBeforeLimit(10)
139 139
 		if err != nil {
140 140
 			return fmt.Errorf("CommitsBefore: %v", err)
141 141
 		}

+ 3 - 0
models/user.go

@@ -133,6 +133,9 @@ func (u *User) RepoCreationNum() int {
133 133
 
134 134
 func (u *User) CanCreateRepo() bool {
135 135
 	if u.MaxRepoCreation <= -1 {
136
+		if setting.Repository.MaxCreationLimit == -1 {
137
+			return true
138
+		}
136 139
 		return u.NumRepos < setting.Repository.MaxCreationLimit
137 140
 	}
138 141
 	return u.NumRepos < u.MaxRepoCreation

+ 1 - 1
templates/.VERSION

@@ -1 +1 @@
1
-0.7.39.1210 Beta
1
+0.7.40.1210 Beta