mirror of
https://github.com/gogs/gogs.git
synced 2025-12-23 16:50:02 +01:00
repo/commit: able to config default commits page size (#4230)
Added config option '[ui.user] COMMITS_PAGING_NUM'.
This commit is contained in:
@@ -431,6 +431,8 @@ ORG_PAGING_NUM = 50
|
|||||||
REPO_PAGING_NUM = 15
|
REPO_PAGING_NUM = 15
|
||||||
; Number of news feeds that are showed in one page
|
; Number of news feeds that are showed in one page
|
||||||
NEWS_FEED_PAGING_NUM = 20
|
NEWS_FEED_PAGING_NUM = 20
|
||||||
|
; Number of commits that are showed in one page
|
||||||
|
COMMITS_PAGING_NUM = 30
|
||||||
|
|
||||||
[i18n]
|
[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
|
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
|
||||||
|
|||||||
@@ -115,6 +115,7 @@ func NewRepoContext() {
|
|||||||
}
|
}
|
||||||
git.HookDir = "custom_hooks"
|
git.HookDir = "custom_hooks"
|
||||||
git.HookSampleDir = "hooks"
|
git.HookSampleDir = "hooks"
|
||||||
|
git.DefaultCommitsPageSize = setting.UI.User.CommitsPagingNum
|
||||||
|
|
||||||
// Git requires setting user.name and user.email in order to commit changes.
|
// 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"} {
|
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
@@ -280,6 +280,7 @@ var (
|
|||||||
User struct {
|
User struct {
|
||||||
RepoPagingNum int
|
RepoPagingNum int
|
||||||
NewsFeedPagingNum int
|
NewsFeedPagingNum int
|
||||||
|
CommitsPagingNum int
|
||||||
} `ini:"ui.user"`
|
} `ini:"ui.user"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ func renderCommits(ctx *context.Context, filename string) {
|
|||||||
}
|
}
|
||||||
pageSize := ctx.QueryInt("pageSize")
|
pageSize := ctx.QueryInt("pageSize")
|
||||||
if pageSize < 1 {
|
if pageSize < 1 {
|
||||||
pageSize = git.DEFAULT_COMMITS_PAGE_SIZE
|
pageSize = git.DefaultCommitsPageSize
|
||||||
}
|
}
|
||||||
|
|
||||||
// Both 'git log branchName' and 'git log commitID' work.
|
// Both 'git log branchName' and 'git log commitID' work.
|
||||||
|
|||||||
6
vendor/github.com/gogits/git-module/repo_commit.go
generated
vendored
6
vendor/github.com/gogits/git-module/repo_commit.go
generated
vendored
@@ -209,10 +209,10 @@ func (repo *Repository) CommitsByRangeSize(revision string, page, size int) (*li
|
|||||||
return repo.parsePrettyFormatLogToList(stdout)
|
return repo.parsePrettyFormatLogToList(stdout)
|
||||||
}
|
}
|
||||||
|
|
||||||
const DEFAULT_COMMITS_PAGE_SIZE = 30
|
var DefaultCommitsPageSize = 30
|
||||||
|
|
||||||
func (repo *Repository) CommitsByRange(revision string, page int) (*list.List, error) {
|
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) {
|
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) {
|
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) {
|
func (repo *Repository) FilesCountBetween(startCommitID, endCommitID string) (int, error) {
|
||||||
|
|||||||
6
vendor/vendor.json
vendored
6
vendor/vendor.json
vendored
@@ -159,10 +159,10 @@
|
|||||||
"revisionTime": "2016-08-10T03:50:02Z"
|
"revisionTime": "2016-08-10T03:50:02Z"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"checksumSHA1": "zkRQagaPCQPU9o+8kGZYIQoysu4=",
|
"checksumSHA1": "0BVytmK2I0QObcFqVyVWWU544DA=",
|
||||||
"path": "github.com/gogits/git-module",
|
"path": "github.com/gogits/git-module",
|
||||||
"revision": "f9c2e671705cc0bb8281a932efe9371404c956b0",
|
"revision": "e0ab95e3e61573e88bb808ae8052fd669324d80f",
|
||||||
"revisionTime": "2017-03-16T21:31:27Z"
|
"revisionTime": "2017-03-17T02:27:16Z"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"checksumSHA1": "D2kVXl0QpIw6t3891Sl7IM9wL+w=",
|
"checksumSHA1": "D2kVXl0QpIw6t3891Sl7IM9wL+w=",
|
||||||
|
|||||||
Reference in New Issue
Block a user