fix bool check for repo max limit and fix hang when push repo with tons of commits
This commit is contained in:
		
							parent
							
								
									0e96a46020
								
							
						
					
					
						commit
						99e9bbef6c
					
				| 
						 | 
					@ -5,7 +5,7 @@ Gogs - Go Git Service [
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
##### Current version: 0.7.39 Beta
 | 
					##### Current version: 0.7.40 Beta
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| Web | UI  | Preview  |
 | 
					| Web | UI  | Preview  |
 | 
				
			||||||
|:-------------:|:-------:|:-------:|
 | 
					|:-------------:|:-------:|:-------:|
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										2
									
								
								gogs.go
								
								
								
								
							
							
						
						
									
										2
									
								
								gogs.go
								
								
								
								
							| 
						 | 
					@ -18,7 +18,7 @@ import (
 | 
				
			||||||
	"github.com/gogits/gogs/modules/setting"
 | 
						"github.com/gogits/gogs/modules/setting"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const APP_VER = "0.7.39.1210 Beta"
 | 
					const APP_VER = "0.7.40.1210 Beta"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func init() {
 | 
					func init() {
 | 
				
			||||||
	runtime.GOMAXPROCS(runtime.NumCPU())
 | 
						runtime.GOMAXPROCS(runtime.NumCPU())
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -440,10 +440,6 @@ func CommitRepoAction(
 | 
				
			||||||
			isNewBranch = true
 | 
								isNewBranch = true
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		// NOTE: limit to detect latest 100 commits.
 | 
					 | 
				
			||||||
		if len(commit.Commits) > 100 {
 | 
					 | 
				
			||||||
			commit.Commits = commit.Commits[len(commit.Commits)-100:]
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		if err = updateIssuesCommit(u, repo, repoUserName, repoName, commit.Commits); err != nil {
 | 
							if err = updateIssuesCommit(u, repo, repoUserName, repoName, commit.Commits); err != nil {
 | 
				
			||||||
			log.Error(4, "updateIssuesCommit: %v", err)
 | 
								log.Error(4, "updateIssuesCommit: %v", err)
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -10,7 +10,7 @@ import (
 | 
				
			||||||
	"os/exec"
 | 
						"os/exec"
 | 
				
			||||||
	"strings"
 | 
						"strings"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	"github.com/gogits/git-shell"
 | 
						git "github.com/gogits/git-shell"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	"github.com/gogits/gogs/modules/log"
 | 
						"github.com/gogits/gogs/modules/log"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
| 
						 | 
					@ -135,7 +135,7 @@ func Update(refName, oldCommitID, newCommitID, userName, repoUserName, repoName
 | 
				
			||||||
	// Push new branch.
 | 
						// Push new branch.
 | 
				
			||||||
	var l *list.List
 | 
						var l *list.List
 | 
				
			||||||
	if isNew {
 | 
						if isNew {
 | 
				
			||||||
		l, err = newCommit.CommitsBefore()
 | 
							l, err = newCommit.CommitsBeforeLimit(10)
 | 
				
			||||||
		if err != nil {
 | 
							if err != nil {
 | 
				
			||||||
			return fmt.Errorf("CommitsBefore: %v", err)
 | 
								return fmt.Errorf("CommitsBefore: %v", err)
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -133,6 +133,9 @@ func (u *User) RepoCreationNum() int {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (u *User) CanCreateRepo() bool {
 | 
					func (u *User) CanCreateRepo() bool {
 | 
				
			||||||
	if u.MaxRepoCreation <= -1 {
 | 
						if u.MaxRepoCreation <= -1 {
 | 
				
			||||||
 | 
							if setting.Repository.MaxCreationLimit == -1 {
 | 
				
			||||||
 | 
								return true
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
		return u.NumRepos < setting.Repository.MaxCreationLimit
 | 
							return u.NumRepos < setting.Repository.MaxCreationLimit
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	return u.NumRepos < u.MaxRepoCreation
 | 
						return u.NumRepos < u.MaxRepoCreation
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1 +1 @@
 | 
				
			||||||
0.7.39.1210 Beta
 | 
					0.7.40.1210 Beta
 | 
				
			||||||
		Loading…
	
		Reference in New Issue