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

Added config option '[ui.user] COMMITS_PAGING_NUM'.
master
Unknwon 2017-03-16 22:28:32 -04:00
parent d591cb0dfb
commit bc630cc52b
No known key found for this signature in database
GPG Key ID: 25B575AE3213B2B3
7 changed files with 13 additions and 9 deletions

View File

@ -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

View File

@ -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 one or more lines are too long

View File

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

View File

@ -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.

View File

@ -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) {

6
vendor/vendor.json vendored
View File

@ -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=",