Bladeren bron

repo/commit: able to config default commits page size (#4230)

Added config option '[ui.user] COMMITS_PAGING_NUM'.
Unknwon 8 jaren geleden
bovenliggende
commit
bc630cc52b

+ 2 - 0
conf/app.ini

@@ -431,6 +431,8 @@ ORG_PAGING_NUM = 50
 REPO_PAGING_NUM = 15
 ; Number of news feeds that are showed in one page
 NEWS_FEED_PAGING_NUM = 20
+; Number of commits that are showed in one page
+COMMITS_PAGING_NUM = 30
 
 [i18n]
 LANGS = en-US,zh-CN,zh-HK,zh-TW,de-DE,fr-FR,nl-NL,lv-LV,ru-RU,ja-JP,es-ES,pt-BR,pl-PL,bg-BG,it-IT,fi-FI,tr-TR,cs-CZ,sr-SP,sv-SE,ko-KR,gl-ES,uk-UA

+ 1 - 0
models/repo.go

@@ -115,6 +115,7 @@ func NewRepoContext() {
 	}
 	git.HookDir = "custom_hooks"
 	git.HookSampleDir = "hooks"
+	git.DefaultCommitsPageSize = setting.UI.User.CommitsPagingNum
 
 	// Git requires setting user.name and user.email in order to commit changes.
 	for configKey, defaultValue := range map[string]string{"user.name": "Gogs", "user.email": "gogs@fake.local"} {

File diff suppressed because it is too large
+ 0 - 0
modules/bindata/bindata.go


+ 1 - 0
modules/setting/setting.go

@@ -280,6 +280,7 @@ var (
 		User struct {
 			RepoPagingNum     int
 			NewsFeedPagingNum int
+			CommitsPagingNum  int
 		} `ini:"ui.user"`
 	}
 

+ 1 - 1
routers/repo/commit.go

@@ -52,7 +52,7 @@ func renderCommits(ctx *context.Context, filename string) {
 	}
 	pageSize := ctx.QueryInt("pageSize")
 	if pageSize < 1 {
-		pageSize = git.DEFAULT_COMMITS_PAGE_SIZE
+		pageSize = git.DefaultCommitsPageSize
 	}
 
 	// Both 'git log branchName' and 'git log commitID' work.

+ 3 - 3
vendor/github.com/gogits/git-module/repo_commit.go

@@ -209,10 +209,10 @@ func (repo *Repository) CommitsByRangeSize(revision string, page, size int) (*li
 	return repo.parsePrettyFormatLogToList(stdout)
 }
 
-const DEFAULT_COMMITS_PAGE_SIZE = 30
+var DefaultCommitsPageSize = 30
 
 func (repo *Repository) CommitsByRange(revision string, page int) (*list.List, error) {
-	return repo.CommitsByRangeSize(revision, page, DEFAULT_COMMITS_PAGE_SIZE)
+	return repo.CommitsByRangeSize(revision, page, DefaultCommitsPageSize)
 }
 
 func (repo *Repository) searchCommits(id sha1, keyword string) (*list.List, error) {
@@ -245,7 +245,7 @@ func (repo *Repository) CommitsByFileAndRangeSize(revision, file string, page, s
 }
 
 func (repo *Repository) CommitsByFileAndRange(revision, file string, page int) (*list.List, error) {
-	return repo.CommitsByFileAndRangeSize(revision, file, page, DEFAULT_COMMITS_PAGE_SIZE)
+	return repo.CommitsByFileAndRangeSize(revision, file, page, DefaultCommitsPageSize)
 }
 
 func (repo *Repository) FilesCountBetween(startCommitID, endCommitID string) (int, error) {

+ 3 - 3
vendor/vendor.json

@@ -159,10 +159,10 @@
 			"revisionTime": "2016-08-10T03:50:02Z"
 		},
 		{
-			"checksumSHA1": "zkRQagaPCQPU9o+8kGZYIQoysu4=",
+			"checksumSHA1": "0BVytmK2I0QObcFqVyVWWU544DA=",
 			"path": "github.com/gogits/git-module",
-			"revision": "f9c2e671705cc0bb8281a932efe9371404c956b0",
-			"revisionTime": "2017-03-16T21:31:27Z"
+			"revision": "e0ab95e3e61573e88bb808ae8052fd669324d80f",
+			"revisionTime": "2017-03-17T02:27:16Z"
 		},
 		{
 			"checksumSHA1": "D2kVXl0QpIw6t3891Sl7IM9wL+w=",

Some files were not shown because too many files changed in this diff